Section 1
//DebugDispatcher (com.blitzagency.xray.logger.events.DebugDispatcher)
package com.blitzagency.xray.logger.events {
import flash.events.*;
public class DebugDispatcher extends EventDispatcher {
public static var TRACE:String = "trace";
public function sendEvent(_arg1:String, _arg2:Object):void{
trace(_arg2.message);
dispatchEvent(new DebugEvent(DebugDispatcher.TRACE, false, false, _arg2));
}
}
}//package com.blitzagency.xray.logger.events
Section 2
//DebugEvent (com.blitzagency.xray.logger.events.DebugEvent)
package com.blitzagency.xray.logger.events {
import flash.events.*;
public class DebugEvent extends Event {
public var obj:Object;
public function DebugEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean, _arg4:Object):void{
obj = new Object();
super(_arg1, _arg2, _arg3);
obj = _arg4;
}
}
}//package com.blitzagency.xray.logger.events
Section 3
//ObjectTools (com.blitzagency.xray.logger.util.ObjectTools)
package com.blitzagency.xray.logger.util {
import com.blitzagency.xray.logger.*;
import flash.utils.*;
public class ObjectTools {
private static var log:XrayLog = new XrayLog();
public function resolveBaseType(_arg1:Object):String{
return ("");
}
public static function getFullClassPath(_arg1:Object):String{
var _local5:XML;
var _local6:String;
var _local2:XML = describeType(_arg1);
var _local3:Array = [];
var _local4:String = getQualifiedClassName(_arg1);
_local4 = ((_local4.indexOf("::") > -1)) ? _local4.split("::").join(".") : _local4;
_local3.push(_local4);
for each (_local5 in _local2.extendsClass) {
_local6 = ((_local5.@type.toString().indexOf("::") > -1)) ? _local5.@type.toString().split("::")[1] : _local5.@type.toString();
_local3.push(_local6);
};
return (_local3.join("."));
}
public static function getImmediateClassPath(_arg1:Object):String{
var _local2:String = getQualifiedClassName(_arg1);
var _local3:String = getQualifiedSuperclassName(_arg1);
_local2 = ((_local2.indexOf("::") > -1)) ? _local2.split("::").join(".") : _local2;
if (_local3 == null){
return (_local2);
};
_local3 = ((_local3.indexOf("::") > -1)) ? _local3.split("::").join(".") : _local3;
return (((_local3 + ".") + _local2));
}
}
}//package com.blitzagency.xray.logger.util
Section 4
//PropertyTools (com.blitzagency.xray.logger.util.PropertyTools)
package com.blitzagency.xray.logger.util {
import flash.utils.*;
public class PropertyTools {
public static function getProperties(_arg1:Object):Array{
var _local3:XML;
var _local4:XML;
var _local5:String;
var _local6:String;
var _local7:Object;
var _local2:Array = [];
try {
_local3 = describeType(_arg1);
for each (_local4 in _local3.variable) {
_local5 = _local4.@name.toString();
_local6 = _local4.@type.toString();
_local7 = ((_arg1[_local5])!=null) ? _arg1[_local5] : "";
_local2.push({name:_local5, type:_local6, value:_local7});
};
} catch(e:Error) {
};
return (_local2);
}
private static function getVariables():void{
}
private static function getMethods():void{
}
}
}//package com.blitzagency.xray.logger.util
Section 5
//Debug (com.blitzagency.xray.logger.Debug)
package com.blitzagency.xray.logger {
import flash.events.*;
import flash.utils.*;
import com.blitzagency.xray.logger.events.*;
import flash.net.*;
public class Debug {
private static var xrayLC:LocalConnection;
private static var connected:Boolean = false;
private static var ed:DebugDispatcher = new DebugDispatcher();
private static function initialize():Boolean{
ed = new DebugDispatcher();
return (true);
}
private static function makeConnection():void{
var err:LogError;
xrayLC = new LocalConnection();
xrayLC.addEventListener("status", statusHandler);
xrayLC.allowDomain("*");
try {
xrayLC.connect(("_xray_standAlone_debug" + getTimer()));
connected = true;
} catch(e:Error) {
err = new LogError("log");
setTimeout(makeConnection, 1000);
};
}
private static function statusHandler(_arg1:StatusEvent):void{
if ((((((_arg1.code == null)) && ((_arg1.level == "error")))) && (connected))){
connected = false;
} else {
if ((((_arg1.level == "status")) && ((_arg1.code == null)))){
connected = true;
};
};
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
ed.addEventListener(_arg1, _arg2);
}
public static function trace(_arg1:Object, _arg2:String="", _arg3:Number=0):void{
var msg:String;
var pMsg = _arg1;
var pPackage = _arg2;
var pLevel = _arg3;
ed.sendEvent(DebugDispatcher.TRACE, {message:pMsg, classPackage:pPackage});
if (!connected){
makeConnection();
};
if (connected){
try {
msg = ((String(pMsg).length >= 39995)) ? (String(pMsg).substr(0, 39995) + "...") : String(pMsg);
xrayLC.send("_xray_view_conn", "setTrace", msg, pLevel, pPackage);
} catch(e:LogError) {
LogError("No Xray Interface running");
};
};
}
public static function traceObject(_arg1:Object, _arg2:Number=254, _arg3:Number=0, _arg4:String="", _arg5:Number=0):void{
var _local6:Number;
var _local7:Number;
var _local8:String;
var _local9:String;
var _local10:Number;
var _local11:String;
try {
_local6 = _arg2;
_local7 = _arg3;
for (_local8 in _arg1) {
_local9 = "";
_local10 = 0;
while (_local10 < _local7) {
_local9 = (_local9 + " ");
_local10++;
};
_local11 = _arg1[_local8].toString();
if ((_arg1[_local8] is Array)){
_local11 = "[Array]";
};
if (_local11 == "[object Object]"){
_local11 = "[Object]";
};
Debug.trace((((_local9 + _local8) + ": ") + _local11), _arg4, _arg5);
if (_local6 > 0){
Debug.traceObject(_arg1[_local8], (_local6 - 1), (_local7 + 1), _arg4, _arg5);
};
};
} catch(e:Error) {
};
}
}
}//package com.blitzagency.xray.logger
class LogError extends Error {
private function LogError(_arg1:String){
super(_arg1);
}
}
Section 6
//Log (com.blitzagency.xray.logger.Log)
package com.blitzagency.xray.logger {
import com.blitzagency.xray.logger.util.*;
public class Log {
private var message:String;
private var dump:Object;
private var level:Number;
private var classPackage:String;
private var caller:String;// = ""
public function Log(_arg1:String, _arg2:Object, _arg3:Number, ... _args){
var err:LogError;
var nullArray:Array;
var str:String;
var p_message = _arg1;
var p_dump = _arg2;
var p_level = _arg3;
var rest = _args;
super();
try {
nullArray.push("bogus");
} catch(e:Error) {
err = new LogError("log");
} finally {
if (err.hasOwnProperty("getStackTrace")){
str = err.getStackTrace();
setCaller(resolveCaller(str));
} else {
setCaller("");
};
setMessage(p_message);
setDump(p_dump);
setLevel(p_level);
setClassPackage(p_dump);
};
}
public function setMessage(_arg1:String):void{
message = _arg1;
}
public function setDump(_arg1:Object):void{
dump = _arg1;
}
public function setLevel(_arg1:Number):void{
level = _arg1;
}
public function getMessage():String{
return (message);
}
public function getDump():Object{
return (dump);
}
public function getLevel():Number{
return (level);
}
public function getClassPackage():String{
return (classPackage);
}
public function setClassPackage(_arg1:Object):void{
classPackage = ObjectTools.getImmediateClassPath(_arg1);
}
private function resolveCaller(_arg1:String):String{
var str = _arg1;
var ary:Array = [];
try {
str = str.split("\n").join("");
ary = str.split("\tat ");
str = ary[3];
} catch(e:Error) {
} finally {
str = "";
};
return (str);
}
public function setCaller(_arg1:String):void{
caller = _arg1;
}
public function getCaller():String{
return (caller);
}
}
}//package com.blitzagency.xray.logger
class LogError extends Error {
private function LogError(_arg1:String){
super(_arg1);
}
}
Section 7
//Logger (com.blitzagency.xray.logger.Logger)
package com.blitzagency.xray.logger {
public interface Logger {
function setLevel(_arg1:Number=0):void;
function debug(_arg1:Log):void;
function info(_arg1:Log):void;
function warn(_arg1:Log):void;
function error(_arg1:Log):void;
function fatal(_arg1:Log):void;
function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void;
}
}//package com.blitzagency.xray.logger
Section 8
//XrayLog (com.blitzagency.xray.logger.XrayLog)
package com.blitzagency.xray.logger {
public class XrayLog {
private var logger:XrayLogger;
public function XrayLog(){
logger = XrayLogger.getInstance();
}
public function debug(_arg1:String, ... _args):void{
if (_args.length == 0){
logger.debug(new Log(_arg1, null, XrayLogger.DEBUG));
};
var _local3:Number = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.debug(new Log(_arg1, _args[_local3], XrayLogger.DEBUG));
_local3++;
};
}
public function info(_arg1:String, ... _args):void{
if (_args.length == 0){
logger.info(new Log(_arg1, null, XrayLogger.INFO));
};
var _local3:Number = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.info(new Log(_arg1, _args[_local3], XrayLogger.INFO));
_local3++;
};
}
public function warn(_arg1:String, ... _args):void{
if (_args.length == 0){
logger.warn(new Log(_arg1, null, XrayLogger.WARN));
};
var _local3:Number = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.warn(new Log(_arg1, _args[_local3], XrayLogger.WARN));
_local3++;
};
}
public function error(_arg1:String, ... _args):void{
if (_args.length == 0){
logger.error(new Log(_arg1, null, XrayLogger.ERROR));
};
var _local3:Number = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.error(new Log(_arg1, _args[_local3], XrayLogger.ERROR));
_local3++;
};
}
public function fatal(_arg1:String, ... _args):void{
if (_args.length == 0){
logger.fatal(new Log(_arg1, null, XrayLogger.FATAL));
};
var _local3:Number = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.fatal(new Log(_arg1, _args[_local3], XrayLogger.FATAL));
_local3++;
};
}
}
}//package com.blitzagency.xray.logger
Section 9
//XrayLogger (com.blitzagency.xray.logger.XrayLogger)
package com.blitzagency.xray.logger {
import flash.events.*;
import flash.utils.*;
import com.blitzagency.xray.logger.util.*;
public class XrayLogger extends EventDispatcher implements Logger {
private var level:Number;// = 0
private var displayObjectRecursionDepth:Number;// = 3
private var objectRecursionDepth:Number;// = 254
private var indentation:Number;// = 0
private var filters:Array;
public static var DEBUG:Number = 0;
public static var INFO:Number = 1;
public static var WARN:Number = 2;
public static var ERROR:Number = 3;
public static var FATAL:Number = 4;
public static var NONE:Number = 5;
private static var _instance:XrayLogger = null;
public function XrayLogger(){
filters = [];
super();
}
public function setDisplayClipRecursionDepth(_arg1:Number):void{
displayObjectRecursionDepth = _arg1;
}
public function setObjectRecursionDepth(_arg1:Number):void{
objectRecursionDepth = _arg1;
}
public function setIndentation(_arg1:Number=0):void{
indentation = _arg1;
}
public function setLevel(_arg1:Number=0):void{
level = _arg1;
}
public function setFilters(_arg1:Array):void{
filters = _arg1;
}
public function debug(_arg1:Log):void{
if (_arg1.getLevel() == level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 0, _arg1.getDump());
};
}
public function info(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 1, _arg1.getDump());
};
}
public function warn(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 2, _arg1.getDump());
};
}
public function error(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 3, _arg1.getDump());
};
}
public function fatal(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 4, _arg1.getDump());
};
}
public function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void{
var _local8:String;
var _local9:Object;
var _local6 = (("(" + getTimer()) + ") ");
if (_arg3.length > 0){
_local6 = (_local6 + (_arg2 + "\n"));
};
_local6 = (_local6 + _arg1);
if (_arg1.length > 0){
Debug.trace(_local6, _arg3, _arg4);
};
if (_arg5 == null){
return;
};
var _local7 = typeof(_arg5);
if ((((((((((_local7 == "string")) || ((_local7 == "number")))) || ((_local7 == "boolean")))) || ((_local7 == "undefined")))) || ((_local7 == "null")))){
Debug.trace(_arg5, _arg3, _arg4);
} else {
if (_local7 == "xml"){
Debug.trace(_arg5.toString(), _arg3, _arg4);
} else {
_local8 = ObjectTools.getImmediateClassPath(_arg5);
if ((((_local8 == "Object")) || ((_local8 == "Object.Array")))){
Debug.traceObject(_arg5, objectRecursionDepth, indentation, _arg3, _arg4);
} else {
_local9 = PropertyTools.getProperties(_arg5);
Debug.traceObject(_local9, displayObjectRecursionDepth, indentation, _arg3, _arg4);
};
};
};
}
public function checkFilters():Boolean{
if (filters.length == 0){
return (true);
};
var _local1:uint;
while (_local1 < filters.length) {
_local1++;
};
return (true);
}
public static function resolveLevelAsName(_arg1:Number):String{
switch (_arg1){
case 0:
return ("debug");
case 1:
return ("info");
case 2:
return ("warn");
case 3:
return ("error");
case 4:
return ("fatal");
default:
return ("debug");
};
}
public static function getInstance():XrayLogger{
if (_instance == null){
_instance = new (XrayLogger);
};
return (_instance);
}
}
}//package com.blitzagency.xray.logger
Section 10
//FullOver_2 (line_fla.FullOver_2)
package line_fla {
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.system.*;
import flash.ui.*;
public dynamic class FullOver_2 extends MovieClip {
public function FullOver_2(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package line_fla
Section 11
//FullUp_3 (line_fla.FullUp_3)
package line_fla {
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.system.*;
import flash.ui.*;
public dynamic class FullUp_3 extends MovieClip {
public function FullUp_3(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package line_fla
Section 12
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "4.0.0.14159";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
}
}//package mx.core
Section 13
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "4.0.0.14159";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 14
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 15
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.events.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get root():DisplayObject;
function get stage():Stage;
function get name():String;
function set name(_arg1:String):void;
function get parent():DisplayObjectContainer;
function get mask():DisplayObject;
function set mask(_arg1:DisplayObject):void;
function get visible():Boolean;
function set visible(_arg1:Boolean):void;
function get x():Number;
function set x(_arg1:Number):void;
function get y():Number;
function set y(_arg1:Number):void;
function get scaleX():Number;
function set scaleX(_arg1:Number):void;
function get scaleY():Number;
function set scaleY(_arg1:Number):void;
function get mouseX():Number;
function get mouseY():Number;
function get rotation():Number;
function set rotation(_arg1:Number):void;
function get alpha():Number;
function set alpha(_arg1:Number):void;
function get width():Number;
function set width(_arg1:Number):void;
function get height():Number;
function set height(_arg1:Number):void;
function get cacheAsBitmap():Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get opaqueBackground():Object;
function set opaqueBackground(_arg1:Object):void;
function get scrollRect():Rectangle;
function set scrollRect(_arg1:Rectangle):void;
function get filters():Array;
function set filters(_arg1:Array):void;
function get blendMode():String;
function set blendMode(_arg1:String):void;
function get transform():Transform;
function set transform(_arg1:Transform):void;
function get scale9Grid():Rectangle;
function set scale9Grid(_arg1:Rectangle):void;
function globalToLocal(_arg1:Point):Point;
function localToGlobal(_arg1:Point):Point;
function getBounds(_arg1:DisplayObject):Rectangle;
function getRect(_arg1:DisplayObject):Rectangle;
function get loaderInfo():LoaderInfo;
function hitTestObject(_arg1:DisplayObject):Boolean;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function get accessibilityProperties():AccessibilityProperties;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get measuredHeight():Number;
function get measuredWidth():Number;
function move(_arg1:Number, _arg2:Number):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
}
}//package mx.core
Section 16
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function get repeaterIndices():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaters():Array;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
}
}//package mx.core
Section 17
//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 18
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "4.0.0.14159";
private static var counter:int = 0;
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
public static function displayObjectToString(_arg1:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = _arg1;
try {
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = (((("id" in o)) && (o["id"]))) ? o["id"] : o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
} catch(e:SecurityError) {
};
return (result);
}
public static function getUnqualifiedClassName(_arg1:Object):String{
var _local2:String;
if ((_arg1 is String)){
_local2 = (_arg1 as String);
} else {
_local2 = getQualifiedClassName(_arg1);
};
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
return (_local2);
}
}
}//package mx.utils
Section 19
//FrustumCamera3D (org.papervision3d.cameras.FrustumCamera3D)
package org.papervision3d.cameras {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.*;
import flash.geom.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.culling.*;
public class FrustumCamera3D extends CameraObject3D implements IObjectCuller {
public var planes:Array;
public var _projection:Matrix3D;
private var _fov:Number;// = 50
private var _near:Number;// = 10
private var _far:Number;// = 1000
private var _viewport:Rectangle;
private var _aspect:Number;
private var _ortho:Boolean;// = false
private var _target:DisplayObject3D;
private var _objpos:Vertex3D;
private var _orthoScale:Number;// = 0.1
private var _orthoScaleMatrix:Matrix3D;
private var _viewport3D:Viewport3D;
private var _rightHanded:Boolean;// = false
public static const TYPE:String = "FRUSTRUMCAMERA3D";
public static const INSIDE:int = 1;
public static const OUTSIDE:int = -1;
public static const INTERSECT:int = 0;
public static const NEAR:uint = 0;
public static const LEFT:uint = 1;
public static const RIGHT:uint = 2;
public static const TOP:uint = 3;
public static const BOTTOM:uint = 4;
public static const FAR:uint = 5;
public function FrustumCamera3D(_arg1:Viewport3D, _arg2:Number=90, _arg3:Number=10, _arg4:Number=1000):void{
_fov = _arg2;
_near = _arg3;
_far = _arg4;
_target = DisplayObject3D.ZERO;
this.viewport3D = _arg1;
init();
}
public function get fov():Number{
return (_fov);
}
public function set fov(_arg1:Number):void{
_fov = _arg1;
init();
}
public function get far():Number{
return (_far);
}
public function set far(_arg1:Number):void{
_far = _arg1;
init();
}
public function get near():Number{
return (_near);
}
public function set near(_arg1:Number):void{
_near = Math.abs(_arg1);
init();
}
public function get ortho():Boolean{
return (_ortho);
}
public function set ortho(_arg1:Boolean):void{
if (_ortho != _arg1){
_ortho = _arg1;
init();
};
}
public function get orthoScale():Number{
return (_orthoScale);
}
public function set orthoScale(_arg1:Number):void{
if (((!((_arg1 == _orthoScale))) && ((_arg1 > 0)))){
_orthoScale = _arg1;
init();
};
}
public function get projection():Matrix3D{
return (_projection);
}
public function set projection(_arg1:Matrix3D):void{
_projection = _arg1;
}
public function get rightHanded():Boolean{
return (_rightHanded);
}
public function set rightHanded(_arg1:Boolean):void{
_rightHanded = _arg1;
}
public function set viewport3D(_arg1:Viewport3D):void{
_viewport3D = _arg1;
viewport = _arg1.sizeRectangle;
}
public function get viewport3D():Viewport3D{
return (_viewport3D);
}
override public function transformView(_arg1:Matrix3D=null):void{
if (_rightHanded){
this.eye = Matrix3D.inverse(((_arg1) || (this.transform)));
} else {
super.transformView(_arg1);
};
this.eye.calculateMultiply4x4(_projection, this.eye);
extractPlanes(this.eye);
}
public function orbit(_arg1:DisplayObject3D, _arg2:Number, _arg3:Number, _arg4:Number=1000):void{
var _local5:Number = (Math.cos(_arg3) * Math.sin(_arg2));
var _local6:Number = (Math.sin(_arg3) * Math.sin(_arg2));
var _local7:Number = Math.cos(_arg2);
this.x = _arg1.x;
this.y = _arg1.y;
this.z = _arg1.z;
this.x = (this.x + (_local5 * _arg4));
this.y = (this.y + (_local7 * _arg4));
this.z = (this.z + (_local6 * _arg4));
this.lookAt(_target);
}
public function sphereInFrustum(_arg1:Vertex3D, _arg2:Number):int{
var _local5:Number;
var _local3:int = INSIDE;
var _local4:int;
while (_local4 < planes.length) {
_local5 = planes[_local4].distance(_arg1);
if (_local5 < -(_arg2)){
return (OUTSIDE);
};
if (_local5 < _arg2){
_local3 = INTERSECT;
};
_local4++;
};
return (_local3);
}
public function testObject(_arg1:DisplayObject3D):int{
if (((((!(_arg1.geometry)) || (!(_arg1.geometry.vertices)))) || (!(_arg1.geometry.vertices.length)))){
return (INSIDE);
};
var _local2:Number = _arg1.geometry.boundingSphere2;
_objpos.x = _arg1.world.n14;
_objpos.y = _arg1.world.n24;
_objpos.z = _arg1.world.n34;
return (sphereInFrustum(_objpos, (_local2 * _local2)));
}
public function init():void{
var _local2:Number;
var _local3:Number;
_objpos = new Vertex3D();
_viewport = this.viewport;
_aspect = (_viewport.width / _viewport.height);
if (_ortho){
_local2 = (_viewport.width / 2);
_local3 = (_viewport.height / 2);
_projection = createOrthoMatrix(-(_local2), _local2, -(_local3), _local3, -(_far), _far);
_orthoScaleMatrix = Matrix3D.scaleMatrix(_orthoScale, _orthoScale, _orthoScale);
_projection = Matrix3D.multiply(_orthoScaleMatrix, _projection);
} else {
_projection = createPerspectiveMatrix(_fov, _aspect, _near, _far);
};
this.planes = new Array(6);
var _local1:int;
while (_local1 < 6) {
this.planes[_local1] = new Plane3D();
_local1++;
};
}
public function extractPlanes(_arg1:Matrix3D):void{
var _local2:Number = _arg1.n11;
var _local3:Number = _arg1.n12;
var _local4:Number = _arg1.n13;
var _local5:Number = _arg1.n14;
var _local6:Number = _arg1.n21;
var _local7:Number = _arg1.n22;
var _local8:Number = _arg1.n23;
var _local9:Number = _arg1.n24;
var _local10:Number = _arg1.n31;
var _local11:Number = _arg1.n32;
var _local12:Number = _arg1.n33;
var _local13:Number = _arg1.n34;
var _local14:Number = _arg1.n41;
var _local15:Number = _arg1.n42;
var _local16:Number = _arg1.n43;
var _local17:Number = _arg1.n44;
planes[NEAR].setCoefficients((_local10 + _local14), (_local11 + _local15), (_local12 + _local16), (_local13 + _local17));
planes[FAR].setCoefficients((-(_local10) + _local14), (-(_local11) + _local15), (-(_local12) + _local16), (-(_local13) + _local17));
planes[BOTTOM].setCoefficients((_local6 + _local14), (_local7 + _local15), (_local8 + _local16), (_local9 + _local17));
planes[TOP].setCoefficients((-(_local6) + _local14), (-(_local7) + _local15), (-(_local8) + _local16), (-(_local9) + _local17));
planes[LEFT].setCoefficients((_local2 + _local14), (_local3 + _local15), (_local4 + _local16), (_local5 + _local17));
planes[RIGHT].setCoefficients((-(_local2) + _local14), (-(_local3) + _local15), (-(_local4) + _local16), (-(_local5) + _local17));
}
public static function createOrthoMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Matrix3D{
var _local7:Number = ((_arg2 + _arg1) / (_arg2 - _arg1));
var _local8:Number = ((_arg4 + _arg3) / (_arg4 - _arg3));
var _local9:Number = ((_arg6 + _arg5) / (_arg6 - _arg5));
var _local10:Matrix3D = new Matrix3D([(2 / (_arg2 - _arg1)), 0, 0, _local7, 0, (2 / (_arg4 - _arg3)), 0, _local8, 0, 0, (-2 / (_arg6 - _arg5)), _local9, 0, 0, 0, 1]);
_local10.calculateMultiply(Matrix3D.scaleMatrix(1, 1, -1), _local10);
return (_local10);
}
public static function createPerspectiveMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Number = ((_arg1 / 2) * (Math.PI / 180));
var _local6:Number = Math.tan(_local5);
var _local7:Number = (1 / _local6);
return (new Matrix3D([(_local7 / _arg2), 0, 0, 0, 0, _local7, 0, 0, 0, 0, -(((_arg3 + _arg4) / (_arg3 - _arg4))), (((2 * _arg4) * _arg3) / (_arg3 - _arg4)), 0, 0, 1, 0]));
}
}
}//package org.papervision3d.cameras
Section 20
//AbstractController (org.papervision3d.core.animation.core.AbstractController)
package org.papervision3d.core.animation.core {
import flash.events.*;
public class AbstractController extends EventDispatcher {
public var playing:Boolean;
public var frames:Array;
public var duration:uint;// = 0
protected var engine:AnimationEngine;
protected var currentFrame:int;// = 0
protected var nextFrame:int;// = 0
protected var totalFrames:uint;// = 0
protected var lastFrame:uint;// = 0
protected var firstFrame:uint;// = 0
protected var split:Number;
public function AbstractController():void{
this.frames = new Array();
this.engine = AnimationEngine.getInstance();
playing = false;
currentFrame = 0;
nextFrame = 1;
firstFrame = uint.MAX_VALUE;
lastFrame = uint.MIN_VALUE;
}
public function addFrame(_arg1:AnimationFrame):void{
this.frames[_arg1.frame] = _arg1;
totalFrames++;
firstFrame = Math.min(firstFrame, _arg1.frame);
lastFrame = Math.max(lastFrame, _arg1.frame);
}
public function findFrameByName(_arg1:String, _arg2:Boolean):AnimationFrame{
var _local3:AnimationFrame;
var _local4:RegExp;
var _local5:Object;
if (_arg2){
_local4 = /^([a-z]+)(\d+)$/i;
_local5 = _local4.exec(_arg1);
if (((((_local5) && (_local5[1]))) && (_local5[2]))){
_arg1 = _local5[1];
};
};
for each (_local3 in this.frames) {
if (_local3.name == _arg1){
return (_local3);
};
};
return (null);
}
public function gotoAndPlay(_arg1:uint=0):void{
currentFrame = (_arg1 % this.frames.length);
nextFrame = ((_arg1 + 1) % this.frames.length);
playing = true;
}
public function gotoAndStop(_arg1:uint=0):void{
currentFrame = (_arg1 % this.frames.length);
nextFrame = ((_arg1 + 1) % this.frames.length);
}
public function play():void{
gotoAndPlay(currentFrame);
}
public function stop():void{
playing = false;
}
public function tick(_arg1:Number):void{
}
}
}//package org.papervision3d.core.animation.core
Section 21
//AnimationEngine (org.papervision3d.core.animation.core.AnimationEngine)
package org.papervision3d.core.animation.core {
import org.papervision3d.objects.*;
import flash.utils.*;
import org.papervision3d.*;
public class AnimationEngine {
public var time:Number;// = 0
public var currentFrame:uint;// = 0
public var maxTime:Number;
public static var NUM_FRAMES:uint = 100;
public static var TICK:Number = 50;
private static var instance:AnimationEngine = new (AnimationEngine);
;
private static var _time:Number;
private static var _controllers:Array;
private static var _animatedObjects:Dictionary;
public function AnimationEngine():void{
maxTime = (NUM_FRAMES * TICK);
super();
if (instance){
throw (new Error("org.papervision3d.animation.AnimationEngine is a singleton class!"));
};
_animatedObjects = new Dictionary();
_controllers = new Array();
_time = getTimer();
Papervision3D.log(((("[AnimationEngine] initialized => NUM_FRAMES:" + NUM_FRAMES) + " TICK:") + TICK));
}
public function tick():void{
var _local1:*;
var _local2:Array;
var _local3:int;
time = (getTimer() - _time);
if (time > TICK){
_time = getTimer();
currentFrame = ((currentFrame < (NUM_FRAMES - 1))) ? (currentFrame + 1) : 0;
};
for (_local1 in _animatedObjects) {
_local2 = _animatedObjects[_local1];
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].tick(time);
_local3++;
};
};
}
public static function addController(_arg1:DisplayObject3D, _arg2:AbstractController):AbstractController{
var _local5:AnimationFrame;
var _local6:uint;
var _local3:uint = NUM_FRAMES;
if (!_animatedObjects[_arg1]){
_animatedObjects[_arg1] = new Array();
};
var _local4:uint;
for each (_local5 in _arg2.frames) {
_local6 = _local5.frame;
if (_local6 > NUM_FRAMES){
NUM_FRAMES = _local6;
};
_local4 = Math.max(_local4, _local6);
};
instance.maxTime = (NUM_FRAMES * TICK);
if (NUM_FRAMES > _local3){
Papervision3D.log((("[AnimationEngine] resizing timeline to " + NUM_FRAMES) + " frames"));
};
if (NUM_FRAMES > _local4){
NUM_FRAMES = _local4;
Papervision3D.log((("[AnimationEngine] resizing timeline to " + NUM_FRAMES) + " frames"));
};
_animatedObjects[_arg1].push(_arg2);
return (_arg2);
}
public static function getControllers(_arg1:DisplayObject3D):Array{
if (_animatedObjects[_arg1]){
return (_animatedObjects[_arg1]);
};
return (null);
}
public static function setControllers(_arg1:DisplayObject3D, _arg2:Array, _arg3:Boolean=false):void{
if (_arg3){
_animatedObjects[_arg1] = new Array();
};
var _local4:int;
while (_local4 < _arg2.length) {
addController(_arg1, _arg2[_local4]);
_local4++;
};
}
public static function getInstance():AnimationEngine{
return (instance);
}
public static function millisToFrame(_arg1:Number):uint{
return (Math.floor((_arg1 / TICK)));
}
public static function secondsToFrame(_arg1:Number):uint{
return (millisToFrame((_arg1 * 1000)));
}
}
}//package org.papervision3d.core.animation.core
Section 22
//AnimationFrame (org.papervision3d.core.animation.core.AnimationFrame)
package org.papervision3d.core.animation.core {
public class AnimationFrame {
public var frame:uint;
public var duration:uint;
public var nextFrame:uint;
public var values:Array;
public var name:String;
public var type:uint;
public function AnimationFrame(_arg1:uint, _arg2:uint=1, _arg3:Array=null, _arg4:String=""):void{
this.frame = _arg1;
this.duration = _arg2;
this.values = ((_arg3) || (new Array()));
this.name = _arg4;
}
}
}//package org.papervision3d.core.animation.core
Section 23
//CoordinateTools (org.papervision3d.core.components.as3.utils.CoordinateTools)
package org.papervision3d.core.components.as3.utils {
import flash.display.*;
import flash.geom.*;
public class CoordinateTools {
public static function localToLocal(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Point=null):Point{
var _local4:Point = (_arg3) ? _arg3 : new Point();
_local4 = _arg1.localToGlobal(_local4);
_local4 = _arg2.globalToLocal(_local4);
return (_local4);
}
public static function random(_arg1:Number):Number{
return (Math.floor((Math.random() * _arg1)));
}
}
}//package org.papervision3d.core.components.as3.utils
Section 24
//DefaultParticleCuller (org.papervision3d.core.culling.DefaultParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public class DefaultParticleCuller implements IParticleCuller {
public function testParticle(_arg1:Particle):Boolean{
if (_arg1.material.invisible == false){
if (_arg1.vertex3D.vertex3DInstance.visible == true){
return (true);
};
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 25
//DefaultTriangleCuller (org.papervision3d.core.culling.DefaultTriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
public class DefaultTriangleCuller implements ITriangleCuller {
private static var x0:Number;
private static var y0:Number;
private static var x1:Number;
private static var y1:Number;
private static var x2:Number;
private static var y2:Number;
public function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
var _local5:MaterialObject3D;
if (((((_arg2.visible) && (_arg3.visible))) && (_arg4.visible))){
_local5 = (_arg1.material) ? _arg1.material : _arg1.instance.material;
if (_local5.invisible){
return (false);
};
x0 = _arg2.x;
y0 = _arg2.y;
x1 = _arg3.x;
y1 = _arg3.y;
x2 = _arg4.x;
y2 = _arg4.y;
if (_local5.oneSide){
if (_local5.opposite){
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) > 0){
return (false);
};
} else {
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) < 0){
return (false);
};
};
};
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 26
//IObjectCuller (org.papervision3d.core.culling.IObjectCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
public interface IObjectCuller {
function testObject(_arg1:DisplayObject3D):int;
}
}//package org.papervision3d.core.culling
Section 27
//IParticleCuller (org.papervision3d.core.culling.IParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface IParticleCuller {
function testParticle(_arg1:Particle):Boolean;
}
}//package org.papervision3d.core.culling
Section 28
//ITriangleCuller (org.papervision3d.core.culling.ITriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface ITriangleCuller {
function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean;
}
}//package org.papervision3d.core.culling
Section 29
//RectangleParticleCuller (org.papervision3d.core.culling.RectangleParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
import flash.geom.*;
public class RectangleParticleCuller implements IParticleCuller {
public var cullingRectangle:Rectangle;
private static var vInstance:Vertex3DInstance;
private static var testPoint:Point;
public function RectangleParticleCuller(_arg1:Rectangle=null){
this.cullingRectangle = _arg1;
testPoint = new Point();
}
public function testParticle(_arg1:Particle):Boolean{
vInstance = _arg1.vertex3D.vertex3DInstance;
if (_arg1.renderRect.intersects(cullingRectangle)){
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 30
//RectangleTriangleCuller (org.papervision3d.core.culling.RectangleTriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
import flash.geom.*;
public class RectangleTriangleCuller extends DefaultTriangleCuller implements ITriangleCuller {
public var cullingRectangle:Rectangle;
private static const DEFAULT_RECT_W:Number = 640;
private static const DEFAULT_RECT_H:Number = 480;
private static const DEFAULT_RECT_X:Number = -((DEFAULT_RECT_W / 2));
private static const DEFAULT_RECT_Y:Number = -((DEFAULT_RECT_H / 2));
private static var hitRect:Rectangle = new Rectangle();
public function RectangleTriangleCuller(_arg1:Rectangle=null):void{
cullingRectangle = new Rectangle(DEFAULT_RECT_X, DEFAULT_RECT_Y, DEFAULT_RECT_W, DEFAULT_RECT_H);
super();
if (_arg1){
this.cullingRectangle = _arg1;
};
}
override public function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
if (super.testFace(_arg1, _arg2, _arg3, _arg4)){
hitRect.x = Math.min(_arg4.x, Math.min(_arg3.x, _arg2.x));
hitRect.width = (Math.max(_arg4.x, Math.max(_arg3.x, _arg2.x)) + Math.abs(hitRect.x));
hitRect.y = Math.min(_arg4.y, Math.min(_arg3.y, _arg2.y));
hitRect.height = (Math.max(_arg4.y, Math.max(_arg3.y, _arg2.y)) + Math.abs(hitRect.y));
return (cullingRectangle.intersects(hitRect));
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 31
//ViewportObjectFilter (org.papervision3d.core.culling.ViewportObjectFilter)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import flash.utils.*;
public class ViewportObjectFilter implements IObjectCuller {
protected var _mode:int;
protected var objects:Dictionary;
public function ViewportObjectFilter(_arg1:int):void{
this.mode = _arg1;
init();
}
private function init():void{
objects = new Dictionary(true);
}
public function testObject(_arg1:DisplayObject3D):int{
if (objects[_arg1]){
if (_mode == ViewportObjectFilterMode.INCLUSIVE){
return (1);
};
if (_mode == ViewportObjectFilterMode.EXCLUSIVE){
return (0);
};
} else {
if (_mode == ViewportObjectFilterMode.INCLUSIVE){
return (0);
};
if (_mode == ViewportObjectFilterMode.EXCLUSIVE){
return (1);
};
};
return (0);
}
public function addObject(_arg1:DisplayObject3D):void{
objects[_arg1] = _arg1;
}
public function removeObject(_arg1:DisplayObject3D):void{
delete objects[_arg1];
}
public function set mode(_arg1:int):void{
_mode = _arg1;
}
public function get mode():int{
return (_mode);
}
public function destroy():void{
objects = null;
}
}
}//package org.papervision3d.core.culling
Section 32
//ViewportObjectFilterMode (org.papervision3d.core.culling.ViewportObjectFilterMode)
package org.papervision3d.core.culling {
public class ViewportObjectFilterMode {
public static const INCLUSIVE:int = 0;
public static const EXCLUSIVE:int = 1;
}
}//package org.papervision3d.core.culling
Section 33
//UserData (org.papervision3d.core.data.UserData)
package org.papervision3d.core.data {
public class UserData {
public var data;
public function UserData(_arg1=null){
this.data = _arg1;
}
}
}//package org.papervision3d.core.data
Section 34
//AbstractRenderable (org.papervision3d.core.geom.renderables.AbstractRenderable)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.data.*;
public class AbstractRenderable implements IRenderable {
public var _userData:UserData;
public function getRenderListItem():IRenderListItem{
return (null);
}
public function set userData(_arg1:UserData):void{
_userData = _arg1;
}
public function get userData():UserData{
return (_userData);
}
}
}//package org.papervision3d.core.geom.renderables
Section 35
//IRenderable (org.papervision3d.core.geom.renderables.IRenderable)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
public interface IRenderable {
function getRenderListItem():IRenderListItem;
}
}//package org.papervision3d.core.geom.renderables
Section 36
//Line3D (org.papervision3d.core.geom.renderables.Line3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.materials.special.*;
public class Line3D extends AbstractRenderable implements IRenderable {
public var v0:Vertex3D;
public var v1:Vertex3D;
public var material:LineMaterial;
public var renderCommand:RenderLine;
public var size:Number;
public var instance:Lines3D;
public function Line3D(_arg1:Lines3D, _arg2:LineMaterial, _arg3:Number, _arg4:Vertex3D, _arg5:Vertex3D){
this.size = _arg3;
this.material = _arg2;
this.v0 = _arg4;
this.v1 = _arg5;
this.instance = _arg1;
this.renderCommand = new RenderLine(this);
}
override public function getRenderListItem():IRenderListItem{
return (this.renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 37
//Particle (org.papervision3d.core.geom.renderables.Particle)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.materials.special.*;
public class Particle extends AbstractRenderable implements IRenderable {
public var size:Number;
public var vertex3D:Vertex3D;
public var material:ParticleMaterial;
public var renderCommand:RenderParticle;
public var instance:Particles;
public var renderScale:Number;
public var renderRect:Rectangle;
public function Particle(_arg1:ParticleMaterial, _arg2:Number=1, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
this.material = _arg1;
this.size = _arg2;
this.renderCommand = new RenderParticle(this);
this.renderRect = new Rectangle();
vertex3D = new Vertex3D(_arg3, _arg4, _arg5);
}
public function updateRenderRect():void{
material.updateRenderRect(this);
}
public function set x(_arg1:Number):void{
vertex3D.x = _arg1;
}
public function get x():Number{
return (vertex3D.x);
}
public function set y(_arg1:Number):void{
vertex3D.y = _arg1;
}
public function get y():Number{
return (vertex3D.y);
}
public function set z(_arg1:Number):void{
vertex3D.z = _arg1;
}
public function get z():Number{
return (vertex3D.z);
}
override public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 38
//Triangle3D (org.papervision3d.core.geom.renderables.Triangle3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.math.*;
public class Triangle3D extends AbstractRenderable implements IRenderable {
public var vertices:Array;
public var _materialName:String;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var uv2:NumberUV;
private var _uvArray:Array;
public var screenZ:Number;
public var visible:Boolean;
public var id:Number;
public var v0:Vertex3D;
public var v1:Vertex3D;
public var v2:Vertex3D;
public var faceNormal:Number3D;
public var face3DInstance:Triangle3DInstance;
public var instance:DisplayObject3D;
public var material:MaterialObject3D;
public var renderCommand:RenderTriangle;
private static var _totalFaces:Number = 0;
public function Triangle3D(_arg1:DisplayObject3D, _arg2:Array, _arg3:MaterialObject3D=null, _arg4:Array=null){
this.instance = _arg1;
this.renderCommand = new RenderTriangle(this);
face3DInstance = new Triangle3DInstance(this, _arg1);
this.vertices = _arg2;
v0 = _arg2[0];
v1 = _arg2[1];
v2 = _arg2[2];
this.material = _arg3;
this.uv = _arg4;
this.id = _totalFaces++;
createNormal();
}
public function set uv(_arg1:Array):void{
uv0 = NumberUV(_arg1[0]);
uv1 = NumberUV(_arg1[1]);
uv2 = NumberUV(_arg1[2]);
_uvArray = _arg1;
}
public function get uv():Array{
return (_uvArray);
}
public function createNormal():void{
var _local1:Number3D = v0.toNumber3D();
var _local2:Number3D = v1.toNumber3D();
var _local3:Number3D = v2.toNumber3D();
var _local4:Number3D = Number3D.sub(_local2, _local1);
var _local5:Number3D = Number3D.sub(_local3, _local1);
faceNormal = Number3D.cross(_local4, _local5);
faceNormal.normalize();
}
override public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 39
//Triangle3DInstance (org.papervision3d.core.geom.renderables.Triangle3DInstance)
package org.papervision3d.core.geom.renderables {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
public class Triangle3DInstance {
public var instance:DisplayObject3D;
public var container:Sprite;
public var visible:Boolean;// = false
public var screenZ:Number;
public var faceNormal:Number3D;
public function Triangle3DInstance(_arg1:Triangle3D, _arg2:DisplayObject3D){
this.instance = _arg2;
faceNormal = new Number3D();
}
}
}//package org.papervision3d.core.geom.renderables
Section 40
//Vertex3D (org.papervision3d.core.geom.renderables.Vertex3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.math.*;
import flash.utils.*;
public class Vertex3D extends AbstractRenderable implements IRenderable {
public var x:Number;
public var y:Number;
public var z:Number;
public var extra:Object;
public var vertex3DInstance:Vertex3DInstance;
public var normal:Number3D;
public var connectedFaces:Dictionary;
public function Vertex3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.vertex3DInstance = new Vertex3DInstance();
this.normal = new Number3D();
this.connectedFaces = new Dictionary();
}
public function toNumber3D():Number3D{
return (new Number3D(x, y, z));
}
public function clone():Vertex3D{
var _local1:Vertex3D = new Vertex3D(x, y, z);
_local1.extra = extra;
_local1.vertex3DInstance = vertex3DInstance.clone();
_local1.normal = normal.clone();
return (_local1);
}
public function calculateNormal():void{
var _local1:Triangle3D;
normal = new Number3D();
var _local2:Number = 0;
for each (_local1 in connectedFaces) {
_local2++;
normal = Number3D.add(_local1.faceNormal, normal);
};
normal.x = (normal.x / _local2);
normal.y = (normal.y / _local2);
normal.z = (normal.z / _local2);
normal.normalize();
}
override public function getRenderListItem():IRenderListItem{
return (null);
}
}
}//package org.papervision3d.core.geom.renderables
Section 41
//Vertex3DInstance (org.papervision3d.core.geom.renderables.Vertex3DInstance)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.math.*;
public class Vertex3DInstance {
public var x:Number;
public var y:Number;
public var z:Number;
public var extra:Object;
public var visible:Boolean;
public var normal:Number3D;
public function Vertex3DInstance(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.visible = false;
this.normal = new Number3D();
}
public function clone():Vertex3DInstance{
var _local1:Vertex3DInstance = new Vertex3DInstance(x, y, z);
_local1.visible = visible;
_local1.extra = extra;
return (_local1);
}
public static function dot(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function cross(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.y) - (_arg2.x * _arg1.y)));
}
public static function sub(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Vertex3DInstance{
return (new Vertex3DInstance((_arg2.x - _arg1.x), (_arg2.y - _arg1.y)));
}
}
}//package org.papervision3d.core.geom.renderables
Section 42
//Lines3D (org.papervision3d.core.geom.Lines3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.special.*;
import org.papervision3d.core.render.draw.*;
public class Lines3D extends Vertices3D {
public var lines:Array;
private var _material:ILineDrawer;
public function Lines3D(_arg1:LineMaterial, _arg2:String=null){
super(null, _arg2);
this.material = _arg1;
init();
}
private function init():void{
this.lines = new Array();
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local3:Line3D;
var _local4:Number;
super.project(_arg1, _arg2);
for each (_local3 in lines) {
if (((_local3.v0.vertex3DInstance.visible) && (_local3.v1.vertex3DInstance.visible))){
_local3.renderCommand.renderer = _local3.material;
_local4 = (_local4 + (_local3.renderCommand.screenDepth = ((_local3.v0.vertex3DInstance.z + _local3.v1.vertex3DInstance.z) / 2)));
_arg2.renderer.addToRenderList(_local3.renderCommand);
};
};
return ((_local4 / (lines.length + 1)));
}
public function addLine(_arg1:Line3D):void{
lines.push(_arg1);
_arg1.instance = this;
if (geometry.vertices.indexOf(_arg1.v0) == -1){
geometry.vertices.push(_arg1.v0);
};
if (geometry.vertices.indexOf(_arg1.v1) == -1){
geometry.vertices.push(_arg1.v1);
};
}
public function addNewLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):void{
var _local8:Line3D = new Line3D(this, (material as LineMaterial), _arg1, new Vertex3D(_arg2, _arg3, _arg4), new Vertex3D(_arg5, _arg6, _arg7));
addLine(_local8);
}
public function addNewSegmentedLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{
var _local12:Line3D;
var _local14:Vertex3D;
var _local9:Number = ((_arg6 - _arg3) / _arg2);
var _local10:Number = ((_arg7 - _arg4) / _arg2);
var _local11:Number = ((_arg8 - _arg5) / _arg2);
var _local13:Vertex3D = new Vertex3D(_arg3, _arg4, _arg5);
var _local15:Number = 0;
while (_local15 <= _arg2) {
_local14 = new Vertex3D((_arg3 + (_local9 * _local15)), (_arg4 + (_local10 * _local15)), (_arg5 + (_local11 * _local15)));
_local12 = new Line3D(this, (material as LineMaterial), _arg1, _local13, _local14);
addLine(_local12);
_local13 = _local14;
_local15++;
};
}
public function removeLine(_arg1:Line3D):void{
geometry.vertices.splice(0, 1);
lines.splice(lines.indexOf(_arg1), 1);
}
}
}//package org.papervision3d.core.geom
Section 43
//Particles (org.papervision3d.core.geom.Particles)
package org.papervision3d.core.geom {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
public class Particles extends Vertices3D {
private var vertices:Array;
public var particles:Array;
public function Particles(_arg1:String="VertexParticles"){
this.vertices = new Array();
this.particles = new Array();
super(vertices, _arg1);
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local3:Particle;
super.project(_arg1, _arg2);
var _local4:Number = (_arg2.camera.focus * _arg2.camera.zoom);
for each (_local3 in particles) {
_local3.renderScale = (_local4 / (_arg2.camera.focus + _local3.vertex3D.vertex3DInstance.z));
_local3.updateRenderRect();
if (_arg2.viewPort.particleCuller.testParticle(_local3)){
_local3.renderCommand.screenDepth = _local3.vertex3D.vertex3DInstance.z;
_arg2.renderer.addToRenderList(_local3.renderCommand);
} else {
_arg2.renderStatistics.culledParticles++;
};
};
return (1);
}
public function addParticle(_arg1:Particle):void{
_arg1.instance = this;
particles.push(_arg1);
vertices.push(_arg1.vertex3D);
}
public function removeParticle(_arg1:Particle):void{
_arg1.instance = null;
particles.splice(particles.indexOf(_arg1, 0));
vertices.splice(vertices.indexOf(_arg1.vertex3D, 0));
}
public function removeAllParticles():void{
particles = new Array();
vertices = new Array();
geometry.vertices = vertices;
}
}
}//package org.papervision3d.core.geom
Section 44
//TriangleMesh3D (org.papervision3d.core.geom.TriangleMesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.culling.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMesh3D extends Vertices3D {
public function TriangleMesh3D(_arg1:MaterialObject3D, _arg2:Array, _arg3:Array, _arg4:String=null, _arg5:Object=null){
super(_arg2, _arg4, _arg5);
this.geometry.faces = ((_arg3) || (new Array()));
this.material = ((_arg1) || (MaterialObject3D.DEFAULT));
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:ITriangleCuller;
var _local7:Vertex3DInstance;
var _local8:Vertex3DInstance;
var _local9:Vertex3DInstance;
var _local10:Triangle3DInstance;
var _local11:Triangle3D;
var _local12:MaterialObject3D;
var _local13:RenderTriangle;
super.project(_arg1, _arg2);
if (!this.culled){
_local3 = this.geometry.faces;
_local4 = 0;
_local5 = 0;
_local6 = _arg2.triangleCuller;
for each (_local11 in _local3) {
_local12 = (_local11.material) ? _local11.material : material;
_local10 = _local11.face3DInstance;
_local7 = _local11.v0.vertex3DInstance;
_local8 = _local11.v1.vertex3DInstance;
_local9 = _local11.v2.vertex3DInstance;
if ((_local10.visible = _local6.testFace(_local11, _local7, _local8, _local9))){
_local4 = (_local4 + (_local10.screenZ = (((_local7.z + _local8.z) + _local9.z) / 3)));
_local13 = _local11.renderCommand;
_local5++;
_local13.renderer = (_local12 as ITriangleDrawer);
_local13.screenDepth = _local10.screenZ;
_arg2.renderer.addToRenderList(_local13);
} else {
_arg2.renderStatistics.culledTriangles++;
};
};
return ((this.screenZ = (_local4 / _local5)));
//unresolved jump
};
return (0);
}
public function projectTexture(_arg1:String="x", _arg2:String="y"):void{
var _local10:String;
var _local11:Triangle3D;
var _local12:Array;
var _local13:Vertex3D;
var _local14:Vertex3D;
var _local15:Vertex3D;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:NumberUV;
var _local3:Array = this.geometry.faces;
var _local4:Object = this.boundingBox();
var _local5:Number = _local4.min[_arg1];
var _local6:Number = _local4.size[_arg1];
var _local7:Number = _local4.min[_arg2];
var _local8:Number = _local4.size[_arg2];
var _local9:MaterialObject3D = this.material;
for (_local10 in _local3) {
_local11 = _local3[Number(_local10)];
_local12 = _local11.vertices;
_local13 = _local12[0];
_local14 = _local12[1];
_local15 = _local12[2];
_local16 = new NumberUV(((_local13[_arg1] - _local5) / _local6), ((_local13[_arg2] - _local7) / _local8));
_local17 = new NumberUV(((_local14[_arg1] - _local5) / _local6), ((_local14[_arg2] - _local7) / _local8));
_local18 = new NumberUV(((_local15[_arg1] - _local5) / _local6), ((_local15[_arg2] - _local7) / _local8));
_local11.uv = [_local16, _local17, _local18];
};
}
public function quarterFaces():void{
var _local4:Triangle3D;
var _local6:Vertex3D;
var _local7:Vertex3D;
var _local8:Vertex3D;
var _local9:Vertex3D;
var _local10:Vertex3D;
var _local11:Vertex3D;
var _local12:NumberUV;
var _local13:NumberUV;
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:Triangle3D;
var _local19:Triangle3D;
var _local20:Triangle3D;
var _local21:Triangle3D;
var _local1:Array = new Array();
var _local2:Array = new Array();
var _local3:Array = this.geometry.faces;
var _local5:int = _local3.length;
while ((_local4 = _local3[--_local5])) {
_local6 = _local4.v0;
_local7 = _local4.v1;
_local8 = _local4.v2;
_local9 = new Vertex3D(((_local6.x + _local7.x) / 2), ((_local6.y + _local7.y) / 2), ((_local6.z + _local7.z) / 2));
_local10 = new Vertex3D(((_local7.x + _local8.x) / 2), ((_local7.y + _local8.y) / 2), ((_local7.z + _local8.z) / 2));
_local11 = new Vertex3D(((_local8.x + _local6.x) / 2), ((_local8.y + _local6.y) / 2), ((_local8.z + _local6.z) / 2));
this.geometry.vertices.push(_local9, _local10, _local11);
_local12 = _local4.uv[0];
_local13 = _local4.uv[1];
_local14 = _local4.uv[2];
_local15 = new NumberUV(((_local12.u + _local13.u) / 2), ((_local12.v + _local13.v) / 2));
_local16 = new NumberUV(((_local13.u + _local14.u) / 2), ((_local13.v + _local14.v) / 2));
_local17 = new NumberUV(((_local14.u + _local12.u) / 2), ((_local14.v + _local12.v) / 2));
_local18 = new Triangle3D(this, [_local6, _local9, _local11], _local4.material, [_local12, _local15, _local17]);
_local19 = new Triangle3D(this, [_local9, _local7, _local10], _local4.material, [_local15, _local13, _local16]);
_local20 = new Triangle3D(this, [_local11, _local10, _local8], _local4.material, [_local17, _local16, _local14]);
_local21 = new Triangle3D(this, [_local9, _local10, _local11], _local4.material, [_local15, _local16, _local17]);
_local2.push(_local18, _local19, _local20, _local21);
};
this.geometry.faces = _local2;
this.mergeVertices();
this.geometry.ready = true;
}
public function mergeVertices():void{
var _local3:Vertex3D;
var _local4:Triangle3D;
var _local5:Vertex3D;
var _local1:Dictionary = new Dictionary();
var _local2:Array = new Array();
for each (_local3 in this.geometry.vertices) {
for each (_local5 in _local1) {
if ((((((_local3.x == _local5.x)) && ((_local3.y == _local5.y)))) && ((_local3.z == _local5.z)))){
_local1[_local3] = _local5;
break;
};
};
if (!_local1[_local3]){
_local1[_local3] = _local3;
_local2.push(_local3);
};
};
this.geometry.vertices = _local2;
for each (_local4 in geometry.faces) {
_local4.v0 = _local1[_local4.v0];
_local4.v1 = _local1[_local4.v1];
_local4.v2 = _local1[_local4.v2];
};
}
}
}//package org.papervision3d.core.geom
Section 45
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import flash.geom.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.culling.*;
public class Vertices3D extends DisplayObject3D {
public function Vertices3D(_arg1:Array, _arg2:String=null, _arg3:Object=null){
super(_arg2, new GeometryObject3D(), _arg3);
this.geometry.vertices = ((_arg1) || (new Array()));
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Vertex3D;
var _local20:Vertex3DInstance;
var _local21:Number;
super.project(_arg1, _arg2);
if (this.culled){
return (0);
};
if ((_arg2.camera is IObjectCuller)){
return (projectFrustum(_arg1, _arg2));
};
var _local3:Matrix3D = this.view;
var _local4:Number = _local3.n11;
var _local5:Number = _local3.n12;
var _local6:Number = _local3.n13;
var _local7:Number = _local3.n21;
var _local8:Number = _local3.n22;
var _local9:Number = _local3.n23;
var _local10:Number = _local3.n31;
var _local11:Number = _local3.n32;
var _local12:Number = _local3.n33;
var _local22:Array = this.geometry.vertices;
var _local23:int = _local22.length;
var _local24:Number = _arg2.camera.focus;
var _local25:Number = (_local24 * _arg2.camera.zoom);
while ((_local19 = _local22[--_local23])) {
_local13 = _local19.x;
_local14 = _local19.y;
_local15 = _local19.z;
_local18 = ((((_local13 * _local10) + (_local14 * _local11)) + (_local15 * _local12)) + _local3.n34);
_local20 = _local19.vertex3DInstance;
if ((_local20.visible = (_local18 > 0))){
_local16 = ((((_local13 * _local4) + (_local14 * _local5)) + (_local15 * _local6)) + _local3.n14);
_local17 = ((((_local13 * _local7) + (_local14 * _local8)) + (_local15 * _local9)) + _local3.n24);
_local21 = (_local25 / (_local24 + _local18));
_local20.x = (_local16 * _local21);
_local20.y = (_local17 * _local21);
_local20.z = _local18;
};
};
return (0);
}
public function projectFrustum(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local26:Vertex3D;
var _local27:Vertex3DInstance;
var _local3:Matrix3D = this.view;
var _local4:Rectangle = _arg2.camera.viewport;
var _local5:Number = _local3.n11;
var _local6:Number = _local3.n12;
var _local7:Number = _local3.n13;
var _local8:Number = _local3.n21;
var _local9:Number = _local3.n22;
var _local10:Number = _local3.n23;
var _local11:Number = _local3.n31;
var _local12:Number = _local3.n32;
var _local13:Number = _local3.n33;
var _local14:Number = _local3.n41;
var _local15:Number = _local3.n42;
var _local16:Number = _local3.n43;
var _local24:Number = (_local4.width / 2);
var _local25:Number = (_local4.height / 2);
var _local28:Array = this.geometry.vertices;
var _local29:int = _local28.length;
while ((_local26 = _local28[--_local29])) {
_local17 = _local26.x;
_local18 = _local26.y;
_local19 = _local26.z;
_local22 = ((((_local17 * _local11) + (_local18 * _local12)) + (_local19 * _local13)) + _local3.n34);
_local23 = ((((_local17 * _local14) + (_local18 * _local15)) + (_local19 * _local16)) + _local3.n44);
_local27 = _local26.vertex3DInstance;
if ((_local27.visible = (_local22 > 0))){
_local20 = (((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local3.n14) / _local23);
_local21 = (((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local3.n24) / _local23);
_local27.x = (_local20 * _local24);
_local27.y = (_local21 * _local25);
_local27.z = _local22;
};
};
return (0);
}
public function boundingBox():Object{
var _local3:String;
var _local4:Vertex3D;
var _local1:Object = this.geometry.vertices;
var _local2:Object = new Object();
_local2.min = new Number3D();
_local2.max = new Number3D();
_local2.size = new Number3D();
for (_local3 in _local1) {
_local4 = _local1[Number(_local3)];
_local2.min.x = ((_local2.min.x)==undefined) ? _local4.x : Math.min(_local4.x, _local2.min.x);
_local2.max.x = ((_local2.max.x)==undefined) ? _local4.x : Math.max(_local4.x, _local2.max.x);
_local2.min.y = ((_local2.min.y)==undefined) ? _local4.y : Math.min(_local4.y, _local2.min.y);
_local2.max.y = ((_local2.max.y)==undefined) ? _local4.y : Math.max(_local4.y, _local2.max.y);
_local2.min.z = ((_local2.min.z)==undefined) ? _local4.z : Math.min(_local4.z, _local2.min.z);
_local2.max.z = ((_local2.max.z)==undefined) ? _local4.z : Math.max(_local4.z, _local2.max.z);
};
_local2.size.x = (_local2.max.x - _local2.min.x);
_local2.size.y = (_local2.max.y - _local2.min.y);
_local2.size.z = (_local2.max.z - _local2.min.z);
return (_local2);
}
public function transformVertices(_arg1:Matrix3D):void{
var _local16:Vertex3D;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local2:Number = _arg1.n11;
var _local3:Number = _arg1.n12;
var _local4:Number = _arg1.n13;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg1.n22;
var _local7:Number = _arg1.n23;
var _local8:Number = _arg1.n31;
var _local9:Number = _arg1.n32;
var _local10:Number = _arg1.n33;
var _local11:Number = _arg1.n14;
var _local12:Number = _arg1.n24;
var _local13:Number = _arg1.n34;
var _local14:Array = this.geometry.vertices;
var _local15:int = _local14.length;
while ((_local16 = _local14[--_local15])) {
_local17 = _local16.x;
_local18 = _local16.y;
_local19 = _local16.z;
_local20 = ((((_local17 * _local2) + (_local18 * _local3)) + (_local19 * _local4)) + _local11);
_local21 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local12);
_local22 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local13);
_local16.x = _local20;
_local16.y = _local21;
_local16.z = _local22;
};
}
}
}//package org.papervision3d.core.geom
Section 46
//TriangleMaterial (org.papervision3d.core.material.TriangleMaterial)
package org.papervision3d.core.material {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMaterial extends MaterialObject3D implements ITriangleDrawer {
override public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
}
}
}//package org.papervision3d.core.material
Section 47
//Matrix3D (org.papervision3d.core.math.Matrix3D)
package org.papervision3d.core.math {
public class Matrix3D {
public var n11:Number;
public var n12:Number;
public var n13:Number;
public var n14:Number;
public var n21:Number;
public var n22:Number;
public var n23:Number;
public var n24:Number;
public var n31:Number;
public var n32:Number;
public var n33:Number;
public var n34:Number;
public var n41:Number;
public var n42:Number;
public var n43:Number;
public var n44:Number;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
private static var _sin:Function = Math.sin;
private static var _cos:Function = Math.cos;
public function Matrix3D(_arg1:Array=null){
if (((!(_arg1)) || ((_arg1.length < 12)))){
n11 = (n22 = (n33 = (n44 = 1)));
n12 = (n13 = (n14 = (n21 = (n23 = (n24 = (n31 = (n32 = (n34 = (n41 = (n42 = (n43 = 0)))))))))));
} else {
n11 = _arg1[0];
n12 = _arg1[1];
n13 = _arg1[2];
n14 = _arg1[3];
n21 = _arg1[4];
n22 = _arg1[5];
n23 = _arg1[6];
n24 = _arg1[7];
n31 = _arg1[8];
n32 = _arg1[9];
n33 = _arg1[10];
n34 = _arg1[11];
if (_arg1.length == 16){
n41 = _arg1[12];
n42 = _arg1[13];
n43 = _arg1[14];
n44 = _arg1[15];
};
};
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + ((((((((int((n11 * 1000)) / 1000) + "\t\t") + (int((n12 * 1000)) / 1000)) + "\t\t") + (int((n13 * 1000)) / 1000)) + "\t\t") + (int((n14 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n21 * 1000)) / 1000) + "\t\t") + (int((n22 * 1000)) / 1000)) + "\t\t") + (int((n23 * 1000)) / 1000)) + "\t\t") + (int((n24 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n31 * 1000)) / 1000) + "\t\t") + (int((n32 * 1000)) / 1000)) + "\t\t") + (int((n33 * 1000)) / 1000)) + "\t\t") + (int((n34 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n41 * 1000)) / 1000) + "\t\t") + (int((n42 * 1000)) / 1000)) + "\t\t") + (int((n43 * 1000)) / 1000)) + "\t\t") + (int((n44 * 1000)) / 1000)) + "\n"));
return (_local1);
}
public function calculateMultiply(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number = _arg1.n11;
var _local4:Number = _arg2.n11;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg2.n21;
var _local7:Number = _arg1.n31;
var _local8:Number = _arg2.n31;
var _local9:Number = _arg1.n12;
var _local10:Number = _arg2.n12;
var _local11:Number = _arg1.n22;
var _local12:Number = _arg2.n22;
var _local13:Number = _arg1.n32;
var _local14:Number = _arg2.n32;
var _local15:Number = _arg1.n13;
var _local16:Number = _arg2.n13;
var _local17:Number = _arg1.n23;
var _local18:Number = _arg2.n23;
var _local19:Number = _arg1.n33;
var _local20:Number = _arg2.n33;
var _local21:Number = _arg1.n14;
var _local22:Number = _arg2.n14;
var _local23:Number = _arg1.n24;
var _local24:Number = _arg2.n24;
var _local25:Number = _arg1.n34;
var _local26:Number = _arg2.n34;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n14 = ((((_local3 * _local22) + (_local9 * _local24)) + (_local15 * _local26)) + _local21);
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n24 = ((((_local5 * _local22) + (_local11 * _local24)) + (_local17 * _local26)) + _local23);
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
this.n34 = ((((_local7 * _local22) + (_local13 * _local24)) + (_local19 * _local26)) + _local25);
}
public function calculateMultiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number = _arg1.n11;
var _local4:Number = _arg2.n11;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg2.n21;
var _local7:Number = _arg1.n31;
var _local8:Number = _arg2.n31;
var _local9:Number = _arg1.n12;
var _local10:Number = _arg2.n12;
var _local11:Number = _arg1.n22;
var _local12:Number = _arg2.n22;
var _local13:Number = _arg1.n32;
var _local14:Number = _arg2.n32;
var _local15:Number = _arg1.n13;
var _local16:Number = _arg2.n13;
var _local17:Number = _arg1.n23;
var _local18:Number = _arg2.n23;
var _local19:Number = _arg1.n33;
var _local20:Number = _arg2.n33;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
}
public function calculateMultiply4x4(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number = _arg1.n11;
var _local4:Number = _arg2.n11;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg2.n21;
var _local7:Number = _arg1.n31;
var _local8:Number = _arg2.n31;
var _local9:Number = _arg1.n41;
var _local10:Number = _arg2.n41;
var _local11:Number = _arg1.n12;
var _local12:Number = _arg2.n12;
var _local13:Number = _arg1.n22;
var _local14:Number = _arg2.n22;
var _local15:Number = _arg1.n32;
var _local16:Number = _arg2.n32;
var _local17:Number = _arg1.n42;
var _local18:Number = _arg2.n42;
var _local19:Number = _arg1.n13;
var _local20:Number = _arg2.n13;
var _local21:Number = _arg1.n23;
var _local22:Number = _arg2.n23;
var _local23:Number = _arg1.n33;
var _local24:Number = _arg2.n33;
var _local25:Number = _arg1.n43;
var _local26:Number = _arg2.n43;
var _local27:Number = _arg1.n14;
var _local28:Number = _arg2.n14;
var _local29:Number = _arg1.n24;
var _local30:Number = _arg2.n24;
var _local31:Number = _arg1.n34;
var _local32:Number = _arg2.n34;
var _local33:Number = _arg1.n44;
var _local34:Number = _arg2.n44;
this.n11 = (((_local3 * _local4) + (_local11 * _local6)) + (_local19 * _local8));
this.n12 = (((_local3 * _local12) + (_local11 * _local14)) + (_local19 * _local16));
this.n13 = (((_local3 * _local20) + (_local11 * _local22)) + (_local19 * _local24));
this.n14 = ((((_local3 * _local28) + (_local11 * _local30)) + (_local19 * _local32)) + _local27);
this.n21 = (((_local5 * _local4) + (_local13 * _local6)) + (_local21 * _local8));
this.n22 = (((_local5 * _local12) + (_local13 * _local14)) + (_local21 * _local16));
this.n23 = (((_local5 * _local20) + (_local13 * _local22)) + (_local21 * _local24));
this.n24 = ((((_local5 * _local28) + (_local13 * _local30)) + (_local21 * _local32)) + _local29);
this.n31 = (((_local7 * _local4) + (_local15 * _local6)) + (_local23 * _local8));
this.n32 = (((_local7 * _local12) + (_local15 * _local14)) + (_local23 * _local16));
this.n33 = (((_local7 * _local20) + (_local15 * _local22)) + (_local23 * _local24));
this.n34 = ((((_local7 * _local28) + (_local15 * _local30)) + (_local23 * _local32)) + _local31);
this.n41 = (((_local9 * _local4) + (_local17 * _local6)) + (_local25 * _local8));
this.n42 = (((_local9 * _local12) + (_local17 * _local14)) + (_local25 * _local16));
this.n43 = (((_local9 * _local20) + (_local17 * _local22)) + (_local25 * _local24));
this.n44 = ((((_local9 * _local28) + (_local17 * _local30)) + (_local25 * _local32)) + _local33);
}
public function calculateAdd(_arg1:Matrix3D, _arg2:Matrix3D):void{
this.n11 = (_arg1.n11 + _arg2.n11);
this.n12 = (_arg1.n12 + _arg2.n12);
this.n13 = (_arg1.n13 + _arg2.n13);
this.n14 = (_arg1.n14 + _arg2.n14);
this.n21 = (_arg1.n21 + _arg2.n21);
this.n22 = (_arg1.n22 + _arg2.n22);
this.n23 = (_arg1.n23 + _arg2.n23);
this.n24 = (_arg1.n24 + _arg2.n24);
this.n31 = (_arg1.n31 + _arg2.n31);
this.n32 = (_arg1.n32 + _arg2.n32);
this.n33 = (_arg1.n33 + _arg2.n33);
this.n34 = (_arg1.n34 + _arg2.n34);
}
public function calculateInverse(_arg1:Matrix3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local2:Number = _arg1.det;
if (Math.abs(_local2) > 0.001){
_local2 = (1 / _local2);
_local3 = _arg1.n11;
_local4 = _arg1.n21;
_local5 = _arg1.n31;
_local6 = _arg1.n12;
_local7 = _arg1.n22;
_local8 = _arg1.n32;
_local9 = _arg1.n13;
_local10 = _arg1.n23;
_local11 = _arg1.n33;
_local12 = _arg1.n14;
_local13 = _arg1.n24;
_local14 = _arg1.n34;
this.n11 = (_local2 * ((_local7 * _local11) - (_local8 * _local10)));
this.n12 = (-(_local2) * ((_local6 * _local11) - (_local8 * _local9)));
this.n13 = (_local2 * ((_local6 * _local10) - (_local7 * _local9)));
this.n14 = (-(_local2) * (((_local6 * ((_local10 * _local14) - (_local11 * _local13))) - (_local7 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local8 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n21 = (-(_local2) * ((_local4 * _local11) - (_local5 * _local10)));
this.n22 = (_local2 * ((_local3 * _local11) - (_local5 * _local9)));
this.n23 = (-(_local2) * ((_local3 * _local10) - (_local4 * _local9)));
this.n24 = (_local2 * (((_local3 * ((_local10 * _local14) - (_local11 * _local13))) - (_local4 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local5 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n31 = (_local2 * ((_local4 * _local8) - (_local5 * _local7)));
this.n32 = (-(_local2) * ((_local3 * _local8) - (_local5 * _local6)));
this.n33 = (_local2 * ((_local3 * _local7) - (_local4 * _local6)));
this.n34 = (-(_local2) * (((_local3 * ((_local7 * _local14) - (_local8 * _local13))) - (_local4 * ((_local6 * _local14) - (_local8 * _local12)))) + (_local5 * ((_local6 * _local13) - (_local7 * _local12)))));
};
}
public function get det():Number{
return ((((((this.n11 * this.n22) - (this.n21 * this.n12)) * this.n33) - (((this.n11 * this.n32) - (this.n31 * this.n12)) * this.n23)) + (((this.n21 * this.n32) - (this.n31 * this.n22)) * this.n13)));
}
public function get trace():Number{
return ((((this.n11 + this.n22) + this.n33) + 1));
}
public function copy(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n14 = _arg1.n14;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n24 = _arg1.n24;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
this.n34 = _arg1.n34;
return (this);
}
public function copy3x3(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
return (this);
}
public static function get IDENTITY():Matrix3D{
return (new Matrix3D([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]));
}
public static function multiply(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D = new (Matrix3D);
_local3.calculateMultiply(_arg1, _arg2);
return (_local3);
}
public static function multiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D = new (Matrix3D);
_local3.calculateMultiply3x3(_arg1, _arg2);
return (_local3);
}
public static function add(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D = new (Matrix3D);
_local3.calculateAdd(_arg1, _arg2);
return (_local3);
}
public static function inverse(_arg1:Matrix3D):Matrix3D{
var _local2:Matrix3D = new (Matrix3D);
_local2.calculateInverse(_arg1);
return (_local2);
}
public static function clone(_arg1:Matrix3D):Matrix3D{
return (new Matrix3D([_arg1.n11, _arg1.n12, _arg1.n13, _arg1.n14, _arg1.n21, _arg1.n22, _arg1.n23, _arg1.n24, _arg1.n31, _arg1.n32, _arg1.n33, _arg1.n34]));
}
public static function multiplyVector(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number = _arg2.x;
var _local4:Number = _arg2.y;
var _local5:Number = _arg2.z;
_arg2.x = ((((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13)) + _arg1.n14);
_arg2.y = ((((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23)) + _arg1.n24);
_arg2.z = ((((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33)) + _arg1.n34);
}
public static function multiplyVector3x3(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number = _arg2.x;
var _local4:Number = _arg2.y;
var _local5:Number = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
}
public static function multiplyVector4x4(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number = _arg2.x;
var _local4:Number = _arg2.y;
var _local5:Number = _arg2.z;
var _local6:Number = (1 / ((((_local3 * _arg1.n41) + (_local4 * _arg1.n42)) + (_local5 * _arg1.n43)) + _arg1.n44));
_arg2.x = ((((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13)) + _arg1.n14);
_arg2.y = ((((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23)) + _arg1.n24);
_arg2.z = ((((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33)) + _arg1.n34);
_arg2.x = (_arg2.x * _local6);
_arg2.y = (_arg2.y * _local6);
_arg2.z = (_arg2.z * _local6);
}
public static function rotateAxis(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number = _arg2.x;
var _local4:Number = _arg2.y;
var _local5:Number = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
_arg2.normalize();
}
public static function matrix2euler(_arg1:Matrix3D):Number3D{
var _local2:Number3D = new Number3D();
var _local3:Number3D = new Number3D(_arg1.n11, _arg1.n21, _arg1.n31);
var _local4:Number3D = new Number3D(_arg1.n12, _arg1.n22, _arg1.n32);
var _local5:Number3D = new Number3D(_arg1.n13, _arg1.n23, _arg1.n33);
_local3.normalize();
_local4.normalize();
_local5.normalize();
var _local6:Matrix3D = new Matrix3D([_local3.x, _local4.x, _local5.x, 0, _local3.y, _local4.y, _local5.y, 0, _local3.z, _local4.z, _local5.z, 0]);
_local2.x = Math.atan2(_local6.n23, _local6.n33);
var _local7:Matrix3D = Matrix3D.rotationX(-(_local2.x));
var _local8:Matrix3D = Matrix3D.multiply(_local7, _local6);
var _local9:Number = Math.sqrt(((_local8.n11 * _local8.n11) + (_local8.n21 * _local8.n21)));
_local2.y = Math.atan2(-(_local8.n31), _local9);
_local2.z = Math.atan2(-(_local8.n12), _local8.n11);
if (_local2.x == Math.PI){
if (_local2.y > 0){
_local2.y = (_local2.y - Math.PI);
} else {
_local2.y = (_local2.y + Math.PI);
};
_local2.x = 0;
_local2.z = (_local2.z + Math.PI);
};
_local2.x = (_local2.x * toDEGREES);
_local2.y = (_local2.y * toDEGREES);
_local2.z = (_local2.z * toDEGREES);
return (_local2);
}
public static function euler2matrix(_arg1:Number3D):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = (_arg1.x * toRADIANS);
var _local4:Number = (_arg1.y * toRADIANS);
var _local5:Number = (_arg1.z * toRADIANS);
var _local6:Number = Math.cos(_local3);
var _local7:Number = Math.sin(_local3);
var _local8:Number = Math.cos(_local4);
var _local9:Number = Math.sin(_local4);
var _local10:Number = Math.cos(_local5);
var _local11:Number = Math.sin(_local5);
var _local12:Number = (_local6 * _local9);
var _local13:Number = (_local7 * _local9);
_local2.n11 = (_local8 * _local10);
_local2.n12 = (-(_local8) * _local11);
_local2.n13 = _local9;
_local2.n21 = ((_local13 * _local10) + (_local6 * _local11));
_local2.n22 = ((-(_local13) * _local11) + (_local6 * _local10));
_local2.n23 = (-(_local7) * _local8);
_local2.n31 = ((-(_local12) * _local10) + (_local7 * _local11));
_local2.n32 = ((_local12 * _local11) + (_local7 * _local10));
_local2.n33 = (_local6 * _local8);
return (_local2);
}
public static function rotationX(_arg1:Number):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
_local2.n22 = _local3;
_local2.n23 = -(_local4);
_local2.n32 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationY(_arg1:Number):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n13 = -(_local4);
_local2.n31 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationZ(_arg1:Number):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n12 = -(_local4);
_local2.n21 = _local4;
_local2.n22 = _local3;
return (_local2);
}
public static function rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Matrix3D = IDENTITY;
var _local6:Number = Math.cos(_arg4);
var _local7:Number = Math.sin(_arg4);
var _local8:Number = (1 - _local6);
var _local9:Number = ((_arg1 * _arg2) * _local8);
var _local10:Number = ((_arg2 * _arg3) * _local8);
var _local11:Number = ((_arg1 * _arg3) * _local8);
var _local12:Number = (_local7 * _arg3);
var _local13:Number = (_local7 * _arg2);
var _local14:Number = (_local7 * _arg1);
_local5.n11 = (_local6 + ((_arg1 * _arg1) * _local8));
_local5.n12 = (-(_local12) + _local9);
_local5.n13 = (_local13 + _local11);
_local5.n21 = (_local12 + _local9);
_local5.n22 = (_local6 + ((_arg2 * _arg2) * _local8));
_local5.n23 = (-(_local14) + _local10);
_local5.n31 = (-(_local13) + _local11);
_local5.n32 = (_local14 + _local10);
_local5.n33 = (_local6 + ((_arg3 * _arg3) * _local8));
return (_local5);
}
public static function rotationMatrixWithReference(_arg1:Number3D, _arg2:Number, _arg3:Number3D):Matrix3D{
var _local4:Matrix3D = Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z);
Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z).calculateMultiply(_local4, Matrix3D.rotationMatrix(_arg1.x, _arg1.y, _arg1.z, _arg2));
_local4.calculateMultiply(_local4, Matrix3D.translationMatrix(-(_arg3.x), _arg3.y, -(_arg3.z)));
return (_local4);
}
public static function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D = IDENTITY;
_local4.n14 = _arg1;
_local4.n24 = _arg2;
_local4.n34 = _arg3;
return (_local4);
}
public static function scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D = IDENTITY;
_local4.n11 = _arg1;
_local4.n22 = _arg2;
_local4.n33 = _arg3;
return (_local4);
}
public static function magnitudeQuaternion(_arg1:Object):Number{
return (Math.sqrt(((((_arg1.w * _arg1.w) + (_arg1.x * _arg1.x)) + (_arg1.y * _arg1.y)) + (_arg1.z * _arg1.z))));
}
public static function normalizeQuaternion(_arg1:Object):Object{
var _local2:Number = magnitudeQuaternion(_arg1);
_arg1.x = (_arg1.x / _local2);
_arg1.y = (_arg1.y / _local2);
_arg1.z = (_arg1.z / _local2);
_arg1.w = (_arg1.w / _local2);
return (_arg1);
}
public static function axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Object{
var _local5:Number = Math.sin((_arg4 / 2));
var _local6:Number = Math.cos((_arg4 / 2));
var _local7:Object = new Object();
_local7.x = (_arg1 * _local5);
_local7.y = (_arg2 * _local5);
_local7.z = (_arg3 * _local5);
_local7.w = _local6;
return (normalizeQuaternion(_local7));
}
public static function euler2quaternion(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:Number = Math.sin((_arg1 * 0.5));
var _local5:Number = Math.cos((_arg1 * 0.5));
var _local6:Number = Math.sin((_arg2 * 0.5));
var _local7:Number = Math.cos((_arg2 * 0.5));
var _local8:Number = Math.sin((_arg3 * 0.5));
var _local9:Number = Math.cos((_arg3 * 0.5));
var _local10:Number = (_local5 * _local7);
var _local11:Number = (_local4 * _local6);
var _local12:Object = new Object();
_local12.x = ((_local8 * _local10) - (_local9 * _local11));
_local12.y = (((_local9 * _local4) * _local7) + ((_local8 * _local5) * _local6));
_local12.z = (((_local9 * _local5) * _local6) - ((_local8 * _local4) * _local7));
_local12.w = ((_local9 * _local10) + (_local8 * _local11));
return (_local12);
}
public static function quaternion2matrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Number = (_arg1 * _arg1);
var _local6:Number = (_arg1 * _arg2);
var _local7:Number = (_arg1 * _arg3);
var _local8:Number = (_arg1 * _arg4);
var _local9:Number = (_arg2 * _arg2);
var _local10:Number = (_arg2 * _arg3);
var _local11:Number = (_arg2 * _arg4);
var _local12:Number = (_arg3 * _arg3);
var _local13:Number = (_arg3 * _arg4);
var _local14:Matrix3D = IDENTITY;
_local14.n11 = (1 - (2 * (_local9 + _local12)));
_local14.n12 = (2 * (_local6 - _local13));
_local14.n13 = (2 * (_local7 + _local11));
_local14.n21 = (2 * (_local6 + _local13));
_local14.n22 = (1 - (2 * (_local5 + _local12)));
_local14.n23 = (2 * (_local10 - _local8));
_local14.n31 = (2 * (_local7 - _local11));
_local14.n32 = (2 * (_local10 + _local8));
_local14.n33 = (1 - (2 * (_local5 + _local9)));
return (_local14);
}
public static function multiplyQuaternion(_arg1:Object, _arg2:Object):Object{
var _local3:Number = _arg1.x;
var _local4:Number = _arg1.y;
var _local5:Number = _arg1.z;
var _local6:Number = _arg1.w;
var _local7:Number = _arg2.x;
var _local8:Number = _arg2.y;
var _local9:Number = _arg2.z;
var _local10:Number = _arg2.w;
var _local11:Object = new Object();
_local11.x = ((((_local6 * _local7) + (_local3 * _local10)) + (_local4 * _local9)) - (_local5 * _local8));
_local11.y = ((((_local6 * _local8) + (_local4 * _local10)) + (_local5 * _local7)) - (_local3 * _local9));
_local11.z = ((((_local6 * _local9) + (_local5 * _local10)) + (_local3 * _local8)) - (_local4 * _local7));
_local11.w = ((((_local6 * _local10) - (_local3 * _local7)) - (_local4 * _local8)) - (_local5 * _local9));
return (_local11);
}
}
}//package org.papervision3d.core.math
Section 48
//Number2D (org.papervision3d.core.math.Number2D)
package org.papervision3d.core.math {
import org.papervision3d.*;
public class Number2D {
public var x:Number;
public var y:Number;
public static const RADTODEG:Number = 57.2957795130823;
public static const DEGTORAD:Number = 0.0174532925199433;
public function Number2D(_arg1:Number=0, _arg2:Number=0){
this.x = _arg1;
this.y = _arg2;
}
public function toString():String{
var _local1:Number = (Math.round((this.x * 1000)) / 1000);
var _local2:Number = (Math.round((this.y * 1000)) / 1000);
return ((((("[" + _local1) + ", ") + _local2) + "]"));
}
public function clone():Number2D{
return (new Number2D(this.x, this.y));
}
public function copyTo(_arg1:Number2D):void{
_arg1.x = this.x;
_arg1.y = this.y;
}
public function copyFrom(_arg1:Number2D):void{
this.x = _arg1.x;
this.y = _arg1.y;
}
public function get modulo():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function normalise():void{
var _local1:Number = this.modulo;
this.x = (this.x / _local1);
this.y = (this.y / _local1);
}
public function reverse():void{
this.x = -(this.x);
this.y = -(this.y);
}
public function angle():Number{
if (Papervision3D.useDEGREES){
return ((RADTODEG * Math.atan2(y, x)));
};
return (Math.atan2(y, x));
}
public function rotate(_arg1:Number):void{
var _local4:Number2D;
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * DEGTORAD);
};
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
_local4 = clone();
this.x = ((_local4.x * _local2) - (_local4.y * _local3));
this.y = ((_local4.x * _local3) + (_local4.y * _local2));
}
public function set(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function isModuloLessThan(_arg1:Number):Boolean{
return ((moduloSquared < (_arg1 * _arg1)));
}
public function isModuloGreaterThan(_arg1:Number):Boolean{
return ((moduloSquared > (_arg1 * _arg1)));
}
public function isModuloEqualTo(_arg1:Number):Boolean{
return ((moduloSquared == (_arg1 * _arg1)));
}
public function get moduloSquared():Number{
return (((this.x * this.x) + (this.y * this.y)));
}
public static function add(_arg1:Number2D, _arg2:Number2D):Number2D{
return (new Number2D((_arg1.x = (_arg1.x + _arg2.x)), (_arg1.y + _arg2.y)));
}
public static function subtract(_arg1:Number2D, _arg2:Number2D):Number2D{
return (new Number2D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)));
}
public static function multiplyScalar(_arg1:Number2D, _arg2:Number):Number2D{
return (new Number2D((_arg1.x * _arg2), (_arg1.y * _arg2)));
}
public static function dot(_arg1:Number2D, _arg2:Number2D):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
}
}//package org.papervision3d.core.math
Section 49
//Number3D (org.papervision3d.core.math.Number3D)
package org.papervision3d.core.math {
public class Number3D {
public var x:Number;
public var y:Number;
public var z:Number;
public function Number3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function clone():Number3D{
return (new Number3D(this.x, this.y, this.z));
}
public function copyTo(_arg1:Number3D):void{
_arg1.x = x;
_arg1.y = y;
_arg1.z = z;
}
public function set(_arg1:Number, _arg2:Number, _arg3:Number):void{
x = _arg1;
y = _arg2;
z = _arg3;
}
public function get modulo():Number{
return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z))));
}
public function normalize():void{
var _local1:Number = this.modulo;
if (((!((_local1 == 0))) && (!((_local1 == 1))))){
this.x = (this.x / _local1);
this.y = (this.y / _local1);
this.z = (this.z / _local1);
};
}
public function isModuloLessThan(_arg1:Number):Boolean{
return ((moduloSquared < (_arg1 * _arg1)));
}
public function isModuloGreaterThan(_arg1:Number):Boolean{
return ((moduloSquared > (_arg1 * _arg1)));
}
public function isModuloEqualTo(_arg1:Number):Boolean{
return ((moduloSquared == (_arg1 * _arg1)));
}
public function get moduloSquared():Number{
return ((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)));
}
public function toString():String{
return (((((("x:" + x) + " y:") + y) + " z:") + z));
}
public static function add(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function sub(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z)));
}
public static function dot(_arg1:Number3D, _arg2:Number3D):Number{
return ((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg2.z * _arg1.z)));
}
public static function cross(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D(((_arg2.y * _arg1.z) - (_arg2.z * _arg1.y)), ((_arg2.z * _arg1.x) - (_arg2.x * _arg1.z)), ((_arg2.x * _arg1.y) - (_arg2.y * _arg1.x))));
}
public static function get ZERO():Number3D{
return (new Number3D(0, 0, 0));
}
}
}//package org.papervision3d.core.math
Section 50
//NumberUV (org.papervision3d.core.math.NumberUV)
package org.papervision3d.core.math {
public class NumberUV {
public var u:Number;
public var v:Number;
public function NumberUV(_arg1:Number=0, _arg2:Number=0){
this.u = _arg1;
this.v = _arg2;
}
public function clone():NumberUV{
return (new NumberUV(this.u, this.v));
}
public function toString():String{
return (((("u:" + u) + " v:") + v));
}
public static function get ZERO():NumberUV{
return (new NumberUV(0, 0));
}
}
}//package org.papervision3d.core.math
Section 51
//Plane3D (org.papervision3d.core.math.Plane3D)
package org.papervision3d.core.math {
import org.papervision3d.core.geom.renderables.*;
public class Plane3D {
public var normal:Number3D;
public var d:Number;
private static var _yUP:Number3D = new Number3D(0, 1, 0);
private static var _zUP:Number3D = new Number3D(0, 0, 1);
public function Plane3D(_arg1:Number3D=null, _arg2:Number3D=null):void{
if (((_arg1) && (_arg2))){
this.normal = _arg1;
this.d = -(Number3D.dot(_arg1, _arg2));
} else {
this.normal = new Number3D();
this.d = 0;
};
}
public function closestPointOnPlane(_arg1:Number3D, _arg2:Number3D):Number3D{
var _local3:Number = Number3D.dot(this.normal, Number3D.sub(_arg1, _arg2));
var _local4:Number3D = _arg1.clone();
_arg1.clone().x = (_local4.x - (_local3 * this.normal.x));
_local4.y = (_local4.y - (_local3 * this.normal.y));
_local4.z = (_local4.z - (_local3 * this.normal.z));
return (_local4);
}
public function distance(_arg1):Number{
var _local2:Number3D = ((_arg1 is Vertex3D)) ? _arg1.toNumber3D() : _arg1;
return ((Number3D.dot(_local2, normal) + d));
}
public function normalize():void{
var _local1:Number3D = this.normal;
var _local2:Number = Math.sqrt((((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z)));
_local1.x = (_local1.x / _local2);
_local1.y = (_local1.y / _local2);
_local1.z = (_local1.z / _local2);
this.d = (this.d / _local2);
}
public function setCoefficients(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
this.normal.x = _arg1;
this.normal.y = _arg2;
this.normal.z = _arg3;
this.d = _arg4;
normalize();
}
public function setNormalAndPoint(_arg1:Number3D, _arg2:Number3D):void{
this.normal = _arg1;
this.d = -(Number3D.dot(_arg1, _arg2));
}
public function setThreePoints(_arg1:Number3D, _arg2:Number3D, _arg3:Number3D):void{
var _local4:Number3D = Number3D.sub(_arg2, _arg1);
var _local5:Number3D = Number3D.sub(_arg3, _arg1);
this.normal = Number3D.cross(_local4, _local5);
this.normal.normalize();
this.d = -(Number3D.dot(normal, _arg1));
}
public function projectPoints(_arg1:Array, _arg2:Number3D=null):void{
var _local8:*;
var _local3:Number = Number3D.dot(_yUP, this.normal);
var _local4:Number3D = ((Math.abs(_local3) > 0.99)) ? _zUP : _yUP;
var _local5:Number3D = Number3D.cross(_local4, normal);
_local5.normalize();
_local4 = Number3D.cross(normal, _local5);
_local4.normalize();
var _local6:Matrix3D = new Matrix3D([_local5.x, _local4.x, normal.x, 0, _local5.y, _local4.y, normal.y, 0, _local5.z, _local4.z, normal.z, 0, 0, 0, 0, 1]);
if (_arg2){
_local6 = Matrix3D.multiply(Matrix3D.translationMatrix(_arg2.x, _arg2.y, _arg2.z), _local6);
};
var _local7:Number3D = new Number3D();
for each (_local8 in _arg1) {
_local7.x = _local8["x"];
_local7.y = _local8["y"];
_local7.z = _local8["z"];
Matrix3D.multiplyVector(_local6, _local7);
_local8["x"] = _local7.x;
_local8["y"] = _local7.y;
_local8["z"] = _local7.z;
};
}
public function toString():String{
return ((((((((("[a:" + normal.x) + " b:") + normal.y) + " c:") + normal.z) + " d:") + d) + "]"));
}
public static function fromCoefficients(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Plane3D{
var _local5:Plane3D = new (Plane3D);
_local5.setCoefficients(_arg1, _arg2, _arg3, _arg4);
return (_local5);
}
public static function fromNormalAndPoint(_arg1, _arg2):Plane3D{
var _local3:Number3D = ((_arg1 is Number3D)) ? _arg1 : new Number3D(_arg1.x, _arg1.y, _arg1.z);
var _local4:Number3D = ((_arg2 is Number3D)) ? _arg2 : new Number3D(_arg2.x, _arg2.y, _arg2.z);
return (new Plane3D(_local3, _local4));
}
public static function fromThreePoints(_arg1, _arg2, _arg3):Plane3D{
var _local4:Plane3D = new (Plane3D);
var _local5:Number3D = ((_arg1 is Number3D)) ? _arg1 : new Number3D(_arg1.x, _arg1.y, _arg1.z);
var _local6:Number3D = ((_arg2 is Number3D)) ? _arg2 : new Number3D(_arg2.x, _arg2.y, _arg2.z);
var _local7:Number3D = ((_arg3 is Number3D)) ? _arg3 : new Number3D(_arg3.x, _arg3.y, _arg3.z);
_local4.setThreePoints(_local5, _local6, _local7);
return (_local4);
}
}
}//package org.papervision3d.core.math
Section 52
//pv3dview (org.papervision3d.core.ns.pv3dview)
package org.papervision3d.core.ns {
public namespace pv3dview;
}//package org.papervision3d.core.ns
Section 53
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.objects.*;
import flash.geom.*;
import org.papervision3d.core.math.*;
public class CameraObject3D extends DisplayObject3D {
public var zoom:Number;
public var focus:Number;
public var sort:Boolean;
public var eye:Matrix3D;
public var viewport:Rectangle;
public static const TYPE:String = "ABSTRACT";
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
private static var _flipY:Matrix3D = Matrix3D.scaleMatrix(1, -1, 1);
public function CameraObject3D(_arg1:Number=3, _arg2:Number=500, _arg3:Object=null){
this.x = (_arg3) ? ((_arg3.x) || (DEFAULT_POS.x)) : DEFAULT_POS.x;
this.y = (_arg3) ? ((_arg3.y) || (DEFAULT_POS.y)) : DEFAULT_POS.y;
this.z = (_arg3) ? ((_arg3.z) || (DEFAULT_POS.z)) : DEFAULT_POS.z;
this.zoom = _arg1;
this.focus = _arg2;
this.eye = Matrix3D.IDENTITY;
this.sort = (_arg3) ? !((_arg3.sort == false)) : true;
}
public function transformView(_arg1:Matrix3D=null):void{
this.eye = Matrix3D.inverse(Matrix3D.multiply(((_arg1) || (this.transform)), _flipY));
}
public function tilt(_arg1:Number):void{
super.pitch(_arg1);
}
public function pan(_arg1:Number):void{
super.yaw(_arg1);
}
}
}//package org.papervision3d.core.proto
Section 54
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D)
package org.papervision3d.core.proto {
import org.papervision3d.materials.utils.*;
import org.papervision3d.objects.*;
import flash.events.*;
import flash.utils.*;
import org.papervision3d.*;
public class DisplayObjectContainer3D extends EventDispatcher {
public var root:DisplayObjectContainer3D;
protected var _children:Dictionary;
protected var _childrenByName:Object;
private var _childrenTotal:int;
public function DisplayObjectContainer3D():void{
this._children = new Dictionary(false);
this._childrenByName = new Dictionary(true);
this._childrenTotal = 0;
}
public function addCollada(_arg1:String, _arg2:MaterialsList=null, _arg3:Number=1):void{
Papervision3D.log("The addCollada() method has been deprecated. Use addChildren( new Collada( filename ) )");
}
public function get numChildren():int{
return (this._childrenTotal);
}
public function get children():Object{
return (this._childrenByName);
}
public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this._children[_arg1] = _arg2;
this._childrenByName[_arg2] = _arg1;
this._childrenTotal++;
_arg1.parent = this;
_arg1.root = this.root;
return (_arg1);
}
public function addChildren(_arg1:DisplayObject3D):DisplayObjectContainer3D{
var _local2:DisplayObject3D;
for each (_local2 in _arg1.children) {
_arg1.removeChild(_local2);
this.addChild(_local2);
};
return (this);
}
public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
if (_arg1){
delete this._childrenByName[this._children[_arg1]];
delete this._children[_arg1];
_arg1.parent = null;
_arg1.root = null;
return (_arg1);
};
return (null);
}
public function getChildByName(_arg1:String):DisplayObject3D{
return (this._childrenByName[_arg1]);
}
public function removeChildByName(_arg1:String):DisplayObject3D{
return (removeChild(getChildByName(_arg1)));
}
override public function toString():String{
return (childrenList());
}
public function childrenList():String{
var _local2:String;
var _local1 = "";
for (_local2 in this._children) {
_local1 = (_local1 + (_local2 + "\n"));
};
return (_local1);
}
}
}//package org.papervision3d.core.proto
Section 55
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import flash.events.*;
import flash.utils.*;
public class GeometryObject3D extends EventDispatcher {
public var dirty:Boolean;
public var faces:Array;
public var vertices:Array;
public var _ready:Boolean;// = false
protected var _boundingSphere2:Number;
protected var _boundingSphereDirty:Boolean;// = true
public function GeometryObject3D(_arg1:Object=null):void{
this.dirty = true;
}
public function get boundingSphere2():Number{
if (_boundingSphereDirty){
return (getBoundingSphere2());
};
return (_boundingSphere2);
}
public function transformVertices(_arg1:Matrix3D):void{
}
public function transformUV(_arg1:MaterialObject3D):void{
var _local2:String;
if (_arg1.bitmap){
for (_local2 in this.faces) {
faces[_local2].transformUV(_arg1);
};
};
}
public function getBoundingSphere2():Number{
var _local2:Number;
var _local3:Vertex3D;
var _local1:Number = 0;
for each (_local3 in this.vertices) {
_local2 = (((_local3.x * _local3.x) + (_local3.y * _local3.y)) + (_local3.z * _local3.z));
_local1 = ((_local2)>_local1) ? _local2 : _local1;
};
this._boundingSphereDirty = false;
return ((_boundingSphere2 = _local1));
}
private function createVertexNormals():void{
var _local2:Triangle3D;
var _local3:Vertex3D;
var _local1:Dictionary = new Dictionary(true);
for each (_local2 in faces) {
_local2.v0.connectedFaces[_local2] = _local2;
_local2.v1.connectedFaces[_local2] = _local2;
_local2.v2.connectedFaces[_local2] = _local2;
_local1[_local2.v0] = _local2.v0;
_local1[_local2.v1] = _local2.v1;
_local1[_local2.v2] = _local2.v2;
};
for each (_local3 in _local1) {
_local3.calculateNormal();
};
}
public function set ready(_arg1:Boolean):void{
if (_arg1){
createVertexNormals();
this.dirty = false;
};
_ready = _arg1;
}
public function get ready():Boolean{
return (_ready);
}
}
}//package org.papervision3d.core.proto
Section 56
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import flash.geom.*;
import org.papervision3d.core.render.material.*;
import flash.events.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.materials.*;
public class MaterialObject3D extends EventDispatcher implements ITriangleDrawer {
public var bitmap:BitmapData;
public var smooth:Boolean;// = false
public var tiled:Boolean;// = false
public var lineColor:Number;
public var lineAlpha:Number;// = 0
public var lineThickness:Number;// = 1
public var fillColor:Number;
public var fillAlpha:Number;// = 0
public var oneSide:Boolean;// = true
public var invisible:Boolean;// = false
public var opposite:Boolean;// = false
public var scene:SceneObject3D;
public var name:String;
public var id:Number;
public var maxU:Number;
public var maxV:Number;
public var widthOffset:Number;// = 0
public var heightOffset:Number;// = 0
public var interactive:Boolean;// = false
protected var objects:Dictionary;
public static var DEFAULT_COLOR:int = 0;
public static var DEBUG_COLOR:int = 0xFF00FF;
private static var _totalMaterialObjects:Number = 0;
public function MaterialObject3D(){
lineColor = DEFAULT_COLOR;
fillColor = DEFAULT_COLOR;
super();
this.id = _totalMaterialObjects++;
MaterialManager.registerMaterial(this);
objects = new Dictionary();
}
public function get doubleSided():Boolean{
return (!(this.oneSide));
}
public function set doubleSided(_arg1:Boolean):void{
this.oneSide = !(_arg1);
}
public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
}
public function updateBitmap():void{
}
public function copy(_arg1:MaterialObject3D):void{
this.bitmap = _arg1.bitmap;
this.smooth = _arg1.smooth;
this.lineColor = _arg1.lineColor;
this.lineAlpha = _arg1.lineAlpha;
this.fillColor = _arg1.fillColor;
this.fillAlpha = _arg1.fillAlpha;
this.oneSide = _arg1.oneSide;
this.opposite = _arg1.opposite;
this.invisible = _arg1.invisible;
this.scene = _arg1.scene;
this.name = _arg1.name;
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
public function clone():MaterialObject3D{
var _local1:MaterialObject3D = new MaterialObject3D();
_local1.copy(this);
return (_local1);
}
public function registerObject(_arg1:DisplayObject3D):void{
objects[_arg1] = _arg1;
}
public function unregisterObject(_arg1:DisplayObject3D):void{
if (objects[_arg1] != null){
delete objects[_arg1];
};
}
protected function destroy():void{
MaterialManager.unRegisterMaterial(this);
}
override public function toString():String{
return (((((("[MaterialObject3D] bitmap:" + this.bitmap) + " lineColor:") + this.lineColor) + " fillColor:") + fillColor));
}
public static function get DEFAULT():MaterialObject3D{
var _local1:MaterialObject3D = new WireframeMaterial();
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEFAULT_COLOR;
_local1.fillAlpha = 1;
_local1.doubleSided = false;
return (_local1);
}
public static function get DEBUG():MaterialObject3D{
var _local1:MaterialObject3D = new (MaterialObject3D);
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEBUG_COLOR;
_local1.fillAlpha = 0.37;
_local1.doubleSided = true;
return (_local1);
}
}
}//package org.papervision3d.core.proto
Section 57
//SceneObject3D (org.papervision3d.core.proto.SceneObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.materials.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.animation.core.*;
import org.papervision3d.*;
public class SceneObject3D extends DisplayObjectContainer3D {
public var objects:Array;
public var materials:MaterialsList;
public var animated:Boolean;// = false
public var animationEngine:AnimationEngine;
public function SceneObject3D(){
this.objects = new Array();
this.materials = new MaterialsList();
Papervision3D.log((((((Papervision3D.NAME + " ") + Papervision3D.VERSION) + " (") + Papervision3D.DATE) + ")\n"));
trace("PV3D 2.0a WARNING : DO NOT USE WITH BETA 9 PLAYERS. ONLY WITH OFFICIAL TO TEST.");
trace("CHECK YOUR VERSION!");
this.root = this;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
var _local3:DisplayObject3D = super.addChild(_arg1, (_arg2) ? _arg2 : _arg1.name);
_arg1.scene = this;
this.objects.push(_local3);
return (_local3);
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
super.removeChild(_arg1);
var _local2:int;
while (_local2 < this.objects.length) {
if (this.objects[_local2] === _arg1){
this.objects.splice(_local2, 1);
return (_arg1);
};
_local2++;
};
return (_arg1);
}
}
}//package org.papervision3d.core.proto
Section 58
//AbstractRenderListItem (org.papervision3d.core.render.command.AbstractRenderListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.render.data.*;
public class AbstractRenderListItem implements IRenderListItem {
public var screenDepth:Number;
public function render(_arg1:RenderSessionData):void{
}
}
}//package org.papervision3d.core.render.command
Section 59
//IRenderListItem (org.papervision3d.core.render.command.IRenderListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.render.data.*;
public interface IRenderListItem {
function render(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.command
Section 60
//RenderableListItem (org.papervision3d.core.render.command.RenderableListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
public class RenderableListItem extends AbstractRenderListItem {
public var renderable:Class;
public var renderableInstance:IRenderable;
public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
return (_arg2);
}
}
}//package org.papervision3d.core.render.command
Section 61
//RenderLine (org.papervision3d.core.render.command.RenderLine)
package org.papervision3d.core.render.command {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.special.*;
public class RenderLine extends RenderableListItem implements IRenderListItem {
public var line:Line3D;
public var renderer:LineMaterial;
private static var lineVector:Number3D = Number3D.ZERO;
private static var mouseVector:Number3D = Number3D.ZERO;
public function RenderLine(_arg1:Line3D){
this.renderable = Line3D;
this.renderableInstance = _arg1;
this.line = _arg1;
}
override public function render(_arg1:RenderSessionData):void{
renderer.drawLine(line, _arg1.container.graphics, _arg1);
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
var _local3:Number;
var _local4:Number2D;
var _local5:Number2D;
var _local6:Number2D;
var _local7:Number2D;
var _local8:Number;
var _local9:Number2D;
var _local10:Number2D;
var _local11:Number;
var _local12:Number3D;
if (renderer.interactive){
_local3 = line.size;
_local4 = new Number2D(_arg1.x, _arg1.y);
_local5 = new Number2D(line.v0.vertex3DInstance.x, line.v0.vertex3DInstance.y);
_local6 = new Number2D(line.v1.vertex3DInstance.x, line.v1.vertex3DInstance.y);
_local7 = Number2D.subtract(_local6, _local5);
_local8 = ((((_local4.x - _local5.x) * (_local6.x - _local5.x)) + ((_local4.y - _local5.y) * (_local6.y - _local5.y))) / ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
if ((((_local8 > 0)) && ((_local8 < 1)))){
_local9 = Number2D.multiplyScalar(_local7, _local8);
_local9 = Number2D.add(_local9, _local5);
_local10 = Number2D.subtract(_local9, _local4);
_local11 = ((_local10.x * _local10.x) + (_local10.y * _local10.y));
if (_local11 < (_local3 * _local3)){
_arg2.displayObject3D = line.instance;
_arg2.material = renderer;
_arg2.renderable = line;
_arg2.hasHit = true;
_local12 = new Number3D((line.v1.x - line.v0.x), (line.v1.y - line.v0.y), (line.v1.x - line.v0.x));
new Number3D((line.v1.x - line.v0.x), (line.v1.y - line.v0.y), (line.v1.x - line.v0.x)).x = (_local12.x * _local8);
_local12.y = (_local12.y * _local8);
_local12.z = (_local12.z * _local8);
_local12.x = (_local12.x + line.v0.x);
_local12.y = (_local12.y + line.v0.y);
_local12.z = (_local12.z + line.v0.z);
_arg2.x = _local12.x;
_arg2.y = _local12.y;
_arg2.z = _local12.z;
_arg2.u = 0;
_arg2.v = 0;
return (_arg2);
};
};
};
return (_arg2);
}
}
}//package org.papervision3d.core.render.command
Section 62
//RenderParticle (org.papervision3d.core.render.command.RenderParticle)
package org.papervision3d.core.render.command {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.materials.special.*;
public class RenderParticle extends RenderableListItem implements IRenderListItem {
public var particle:Particle;
public var renderMat:ParticleMaterial;
public function RenderParticle(_arg1:Particle){
this.particle = _arg1;
}
override public function render(_arg1:RenderSessionData):void{
particle.material.drawParticle(particle, _arg1.container.graphics, _arg1);
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
renderMat = particle.material;
if (renderMat.interactive){
if (particle.renderRect.contains(_arg1.x, _arg1.y)){
_arg2.displayObject3D = particle.instance;
_arg2.material = renderMat;
_arg2.renderable = particle;
_arg2.hasHit = true;
_arg2.x = particle.x;
_arg2.y = particle.y;
_arg2.z = particle.z;
_arg2.u = 0;
_arg2.v = 0;
return (_arg2);
};
};
return (_arg2);
}
}
}//package org.papervision3d.core.render.command
Section 63
//RenderTriangle (org.papervision3d.core.render.command.RenderTriangle)
package org.papervision3d.core.render.command {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.materials.*;
public class RenderTriangle extends RenderableListItem implements IRenderListItem {
private var position:Number3D;
public var triangle:Triangle3D;
public var container:Sprite;
public var renderer:ITriangleDrawer;
public var renderMat:MaterialObject3D;
public function RenderTriangle(_arg1:Triangle3D):void{
position = new Number3D();
super();
this.triangle = _arg1;
renderableInstance = _arg1;
renderable = Triangle3D;
}
override public function render(_arg1:RenderSessionData):void{
renderer.drawTriangle(triangle, _arg1.container.graphics, _arg1);
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
var _local3:Vertex3DInstance;
var _local4:Vertex3DInstance;
var _local5:Vertex3DInstance;
var _local6:Vertex3DInstance;
renderMat = triangle.material;
if (!renderMat){
renderMat = triangle.instance.material;
};
if (renderMat.interactive){
_local3 = new Vertex3DInstance(_arg1.x, _arg1.y);
_local4 = triangle.v0.vertex3DInstance;
_local5 = triangle.v1.vertex3DInstance;
_local6 = triangle.v2.vertex3DInstance;
if (sameSide(_local3, _local4, _local5, _local6)){
if (sameSide(_local3, _local5, _local4, _local6)){
if (sameSide(_local3, _local6, _local4, _local5)){
return (deepHitTest(triangle, _local3, _arg2));
};
};
};
};
return (_arg2);
}
public function sameSide(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
var _local5:Number = (Vertex3DInstance.cross(Vertex3DInstance.sub(_arg4, _arg3), Vertex3DInstance.sub(_arg1, _arg3)) * Vertex3DInstance.cross(Vertex3DInstance.sub(_arg4, _arg3), Vertex3DInstance.sub(_arg2, _arg3)));
return ((_local5 > 0));
}
private function deepHitTest(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:RenderHitData):RenderHitData{
var _local4:Vertex3DInstance = _arg1.v0.vertex3DInstance;
var _local5:Vertex3DInstance = _arg1.v1.vertex3DInstance;
var _local6:Vertex3DInstance = _arg1.v2.vertex3DInstance;
var _local7:Number = (_local6.x - _local4.x);
var _local8:Number = (_local6.y - _local4.y);
var _local9:Number = (_local5.x - _local4.x);
var _local10:Number = (_local5.y - _local4.y);
var _local11:Number = (_arg2.x - _local4.x);
var _local12:Number = (_arg2.y - _local4.y);
var _local13:Number = ((_local7 * _local7) + (_local8 * _local8));
var _local14:Number = ((_local7 * _local9) + (_local8 * _local10));
var _local15:Number = ((_local7 * _local11) + (_local8 * _local12));
var _local16:Number = ((_local9 * _local9) + (_local10 * _local10));
var _local17:Number = ((_local9 * _local11) + (_local10 * _local12));
var _local18:Number = (1 / ((_local13 * _local16) - (_local14 * _local14)));
var _local19:Number = (((_local16 * _local15) - (_local14 * _local17)) * _local18);
var _local20:Number = (((_local13 * _local17) - (_local14 * _local15)) * _local18);
var _local21:Number = (_arg1.v2.x - _arg1.v0.x);
var _local22:Number = (_arg1.v2.y - _arg1.v0.y);
var _local23:Number = (_arg1.v2.z - _arg1.v0.z);
var _local24:Number = (_arg1.v1.x - _arg1.v0.x);
var _local25:Number = (_arg1.v1.y - _arg1.v0.y);
var _local26:Number = (_arg1.v1.z - _arg1.v0.z);
var _local27:Number = ((_arg1.v0.x + (_local21 * _local19)) + (_local24 * _local20));
var _local28:Number = ((_arg1.v0.y + (_local22 * _local19)) + (_local25 * _local20));
var _local29:Number = ((_arg1.v0.z + (_local23 * _local19)) + (_local26 * _local20));
var _local30:Array = _arg1.uv;
var _local31:Number = _local30[0].u;
var _local32:Number = _local30[1].u;
var _local33:Number = _local30[2].u;
var _local34:Number = _local30[0].v;
var _local35:Number = _local30[1].v;
var _local36:Number = _local30[2].v;
var _local37:Number = ((((_local32 - _local31) * _local20) + ((_local33 - _local31) * _local19)) + _local31);
var _local38:Number = ((((_local35 - _local34) * _local20) + ((_local36 - _local34) * _local19)) + _local34);
if (triangle.material){
renderMat = _arg1.material;
} else {
renderMat = _arg1.instance.material;
};
var _local39:BitmapData = renderMat.bitmap;
var _local40:Number = 1;
var _local41:Number = 1;
if (_local39){
_local40 = (BitmapMaterial.AUTO_MIP_MAPPING) ? renderMat.widthOffset : _local39.width;
_local41 = (BitmapMaterial.AUTO_MIP_MAPPING) ? renderMat.heightOffset : _local39.height;
};
_arg3.displayObject3D = _arg1.instance;
_arg3.material = renderMat;
_arg3.renderable = _arg1;
_arg3.hasHit = true;
position.x = _local27;
position.y = _local28;
position.z = _local29;
Matrix3D.multiplyVector(_arg1.instance.world, position);
_arg3.x = position.x;
_arg3.y = position.y;
_arg3.z = position.z;
_arg3.u = (_local37 * _local40);
_arg3.v = (_local41 - (_local38 * _local41));
return (_arg3);
}
}
}//package org.papervision3d.core.render.command
Section 64
//RenderHitData (org.papervision3d.core.render.data.RenderHitData)
package org.papervision3d.core.render.data {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.objects.*;
public class RenderHitData {
public var startTime:int;// = 0
public var endTime:int;// = 0
public var hasHit:Boolean;// = false
public var displayObject3D:DisplayObject3D;
public var material:MaterialObject3D;
public var renderable:IRenderable;
public var u:Number;
public var v:Number;
public var x:Number;
public var y:Number;
public var z:Number;
public function toString():String{
return (((displayObject3D + " ") + renderable));
}
}
}//package org.papervision3d.core.render.data
Section 65
//RenderSessionData (org.papervision3d.core.render.data.RenderSessionData)
package org.papervision3d.core.render.data {
import org.papervision3d.core.proto.*;
import flash.display.*;
import org.papervision3d.view.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.render.*;
public class RenderSessionData {
public var sorted:Boolean;
public var triangleCuller:ITriangleCuller;
public var particleCuller:IParticleCuller;
public var viewPort:Viewport3D;
public var container:Sprite;
public var scene:SceneObject3D;
public var camera:CameraObject3D;
public var renderer:IRenderEngine;
public var renderStatistics:RenderStatistics;
public function RenderSessionData():void{
this.renderStatistics = new RenderStatistics();
}
}
}//package org.papervision3d.core.render.data
Section 66
//RenderStatistics (org.papervision3d.core.render.data.RenderStatistics)
package org.papervision3d.core.render.data {
public class RenderStatistics {
public var projectionTime:int;// = 0
public var renderTime:int;// = 0
public var rendered:int;// = 0
public var triangles:int;// = 0
public var culledTriangles:int;// = 0
public var particles:int;// = 0
public var culledParticles:int;// = 0
public var lines:int;// = 0
public var shadedTriangles:int;// = 0
public var filteredObjects:int;// = 0
public var culledObjects:int;// = 0
public function clear():void{
projectionTime = 0;
renderTime = 0;
rendered = 0;
particles = 0;
triangles = 0;
culledTriangles = 0;
culledParticles = 0;
lines = 0;
shadedTriangles = 0;
filteredObjects = 0;
culledObjects = 0;
}
public function toString():String{
return (new String((((((((((((((((((("ProjectionTime:" + projectionTime) + " RenderTime:") + renderTime) + " Particles:") + particles) + " CulledParticles :") + culledParticles) + " Triangles:") + triangles) + " ShadedTriangles :") + shadedTriangles) + " CulledTriangles:") + culledTriangles) + " FilteredObjects:") + filteredObjects) + " CulledObjects:") + culledObjects) + "")));
}
}
}//package org.papervision3d.core.render.data
Section 67
//ILineDrawer (org.papervision3d.core.render.draw.ILineDrawer)
package org.papervision3d.core.render.draw {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
public interface ILineDrawer {
function drawLine(_arg1:Line3D, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 68
//IParticleDrawer (org.papervision3d.core.render.draw.IParticleDrawer)
package org.papervision3d.core.render.draw {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
public interface IParticleDrawer {
function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void;
function updateRenderRect(_arg1:Particle):void;
}
}//package org.papervision3d.core.render.draw
Section 69
//ITriangleDrawer (org.papervision3d.core.render.draw.ITriangleDrawer)
package org.papervision3d.core.render.draw {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
public interface ITriangleDrawer {
function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void;
}
}//package org.papervision3d.core.render.draw
Section 70
//BasicRenderFilter (org.papervision3d.core.render.filter.BasicRenderFilter)
package org.papervision3d.core.render.filter {
public class BasicRenderFilter implements IRenderFilter {
public function filter(_arg1:Array):int{
return (0);
}
}
}//package org.papervision3d.core.render.filter
Section 71
//IRenderFilter (org.papervision3d.core.render.filter.IRenderFilter)
package org.papervision3d.core.render.filter {
public interface IRenderFilter {
function filter(_arg1:Array):int;
}
}//package org.papervision3d.core.render.filter
Section 72
//IUpdateAfterMaterial (org.papervision3d.core.render.material.IUpdateAfterMaterial)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
public interface IUpdateAfterMaterial {
function updateAfterRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.material
Section 73
//IUpdateBeforeMaterial (org.papervision3d.core.render.material.IUpdateBeforeMaterial)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
public interface IUpdateBeforeMaterial {
function updateBeforeRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.material
Section 74
//MaterialManager (org.papervision3d.core.render.material.MaterialManager)
package org.papervision3d.core.render.material {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
public class MaterialManager {
private var materials:Dictionary;
private static var instance:MaterialManager;
public function MaterialManager():void{
if (instance){
throw (new Error("Only 1 instance of materialmanager allowed"));
};
init();
}
private function init():void{
materials = new Dictionary();
}
private function _registerMaterial(_arg1:MaterialObject3D):void{
materials[_arg1] = _arg1;
}
private function _unRegisterMaterial(_arg1:MaterialObject3D):void{
delete materials[_arg1];
}
public function updateMaterialsBeforeRender(_arg1:RenderSessionData):void{
var _local2:IUpdateBeforeMaterial;
var _local3:MaterialObject3D;
for each (_local3 in materials) {
if ((_local3 is IUpdateBeforeMaterial)){
_local2 = (_local3 as IUpdateBeforeMaterial);
_local2.updateBeforeRender(_arg1);
};
};
}
public function updateMaterialsAfterRender(_arg1:RenderSessionData):void{
var _local2:IUpdateAfterMaterial;
var _local3:MaterialObject3D;
for each (_local3 in materials) {
if ((_local3 is IUpdateAfterMaterial)){
_local2 = (_local3 as IUpdateAfterMaterial);
_local2.updateAfterRender(_arg1);
};
};
}
public static function registerMaterial(_arg1:MaterialObject3D):void{
getInstance()._registerMaterial(_arg1);
}
public static function unRegisterMaterial(_arg1:MaterialObject3D):void{
getInstance()._unRegisterMaterial(_arg1);
}
public static function getInstance():MaterialManager{
if (!instance){
instance = new (MaterialManager);
};
return (instance);
}
}
}//package org.papervision3d.core.render.material
Section 75
//BasicRenderSorter (org.papervision3d.core.render.sort.BasicRenderSorter)
package org.papervision3d.core.render.sort {
public class BasicRenderSorter implements IRenderSorter {
public function sort(_arg1:Array):void{
_arg1.sortOn("screenDepth", Array.NUMERIC);
}
}
}//package org.papervision3d.core.render.sort
Section 76
//IRenderSorter (org.papervision3d.core.render.sort.IRenderSorter)
package org.papervision3d.core.render.sort {
public interface IRenderSorter {
function sort(_arg1:Array):void;
}
}//package org.papervision3d.core.render.sort
Section 77
//AbstractRenderEngine (org.papervision3d.core.render.AbstractRenderEngine)
package org.papervision3d.core.render {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
import flash.events.*;
public class AbstractRenderEngine extends EventDispatcher implements IRenderEngine {
public function AbstractRenderEngine(_arg1:IEventDispatcher=null){
super(_arg1);
}
public function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D, _arg4:Boolean=true):RenderStatistics{
return (null);
}
public function addToRenderList(_arg1:IRenderListItem):int{
return (0);
}
public function removeFromRenderList(_arg1:IRenderListItem):int{
return (0);
}
}
}//package org.papervision3d.core.render
Section 78
//IRenderEngine (org.papervision3d.core.render.IRenderEngine)
package org.papervision3d.core.render {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
public interface IRenderEngine {
function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D, _arg4:Boolean=true):RenderStatistics;
function addToRenderList(_arg1:IRenderListItem):int;
function removeFromRenderList(_arg1:IRenderListItem):int;
}
}//package org.papervision3d.core.render
Section 79
//IVirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.core.utils.virtualmouse
Section 80
//VirtualMouse (org.papervision3d.core.utils.virtualmouse.VirtualMouse)
package org.papervision3d.core.utils.virtualmouse {
import flash.display.*;
import flash.geom.*;
import com.blitzagency.xray.logger.*;
import flash.events.*;
import flash.utils.*;
import org.papervision3d.core.components.as3.utils.*;
public class VirtualMouse extends EventDispatcher {
private var altKey:Boolean;// = false
private var ctrlKey:Boolean;// = false
private var shiftKey:Boolean;// = false
private var delta:int;// = 0
private var _stage:Stage;
private var _container:Sprite;
private var target:InteractiveObject;
private var location:Point;
private var isLocked:Boolean;// = false
private var isDoubleClickEvent:Boolean;// = false
private var disabledEvents:Object;
private var ignoredInstances:Dictionary;
private var _lastEvent:Event;
private var lastMouseDown:Boolean;// = false
private var updateMouseDown:Boolean;// = false
private var lastLocation:Point;
private var lastDownTarget:DisplayObject;
private var lastWithinStage:Boolean;// = true
private var _useNativeEvents:Boolean;// = false
private var eventEvent:Class;
private var mouseEventEvent:Class;
private var log:XrayLog;
public static const UPDATE:String = "update";
private static var _mouseIsDown:Boolean = false;
public function VirtualMouse(_arg1:Stage=null, _arg2:Sprite=null, _arg3:Number=0, _arg4:Number=0){
disabledEvents = new Object();
ignoredInstances = new Dictionary(true);
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
log = new XrayLog();
super();
this.stage = _arg1;
this.container = _arg2;
location = new Point(_arg3, _arg4);
lastLocation = location.clone();
addEventListener(UPDATE, handleUpdate);
update();
}
public function get stage():Stage{
return (_stage);
}
public function set stage(_arg1:Stage):void{
var _local2:Boolean;
if (_stage){
_local2 = true;
_stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
_stage.removeEventListener(KeyboardEvent.KEY_UP, keyHandler);
} else {
_local2 = false;
};
_stage = _arg1;
if (_stage){
_stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
_stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
target = _stage;
if (!_local2){
update();
};
};
}
public function set container(_arg1:Sprite):void{
_container = _arg1;
}
public function get container():Sprite{
return (_container);
}
public function get lastEvent():Event{
return (_lastEvent);
}
public function get mouseIsDown():Boolean{
return (_mouseIsDown);
}
public function get x():Number{
return (location.x);
}
public function set x(_arg1:Number):void{
location.x = _arg1;
if (!isLocked){
update();
};
}
public function get y():Number{
return (location.y);
}
public function set y(_arg1:Number):void{
location.y = _arg1;
if (!isLocked){
update();
};
}
public function get useNativeEvents():Boolean{
return (_useNativeEvents);
}
public function set useNativeEvents(_arg1:Boolean):void{
if (_arg1 == _useNativeEvents){
return;
};
_useNativeEvents = _arg1;
if (_useNativeEvents){
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
} else {
eventEvent = Event;
mouseEventEvent = MouseEvent;
};
}
public function getLocation():Point{
return (location.clone());
}
public function setLocation(_arg1, _arg2=null):void{
var _local3:Point;
if ((_arg1 is Point)){
_local3 = (_arg1 as Point);
trace(_local3);
location.x = _local3.x;
location.y = _local3.y;
} else {
location.x = Number(_arg1);
location.y = Number(_arg2);
};
if (!isLocked){
update();
};
}
public function lock():void{
isLocked = true;
}
public function unlock():void{
isLocked = false;
update();
}
public function disableEvent(_arg1:String):void{
disabledEvents[_arg1] = true;
}
public function enableEvent(_arg1:String):void{
if ((_arg1 in disabledEvents)){
delete disabledEvents[_arg1];
};
}
public function ignore(_arg1:DisplayObject):void{
ignoredInstances[_arg1] = true;
}
public function unignore(_arg1:DisplayObject):void{
if ((_arg1 in ignoredInstances)){
delete ignoredInstances[_arg1];
};
}
public function press():void{
updateMouseDown = true;
_mouseIsDown = true;
if (!isLocked){
update();
};
}
public function release():void{
updateMouseDown = true;
_mouseIsDown = false;
if (!isLocked){
update();
};
}
public function click():void{
press();
release();
}
public function doubleClick():void{
if (isLocked){
release();
} else {
click();
press();
isDoubleClickEvent = true;
release();
isDoubleClickEvent = false;
};
}
public function exitContainer():void{
var _local1:Point = target.globalToLocal(location);
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
container.dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
container.dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
if (target != container){
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
};
target = _stage;
}
public function update():void{
dispatchEvent(new Event(UPDATE, false, false));
}
private function handleUpdate(_arg1:Event):void{
var _local4:InteractiveObject;
var _local5:DisplayObject;
var _local9:Boolean;
if (!container){
return;
};
var _local2:Point = CoordinateTools.localToLocal(container, stage, location);
var _local3:Array = container.getObjectsUnderPoint(location);
var _local6:int = _local3.length;
while (_local6--) {
_local5 = _local3[_local6];
while (_local5) {
if (ignoredInstances[_local5]){
_local4 = null;
break;
};
if (((_local4) && ((_local5 is SimpleButton)))){
_local4 = null;
} else {
if (((_local4) && (!(DisplayObjectContainer(_local5).mouseChildren)))){
_local4 = null;
};
};
if (((((!(_local4)) && ((_local5 is InteractiveObject)))) && (InteractiveObject(_local5).mouseEnabled))){
_local4 = InteractiveObject(_local5);
};
_local5 = _local5.parent;
};
if (_local4){
break;
};
};
if (!_local4){
_local4 = _stage;
};
var _local7:Point = target.globalToLocal(location);
var _local8:Point = _local4.globalToLocal(location);
if (((!((lastLocation.x == location.x))) || (!((lastLocation.y == location.y))))){
_local9 = false;
if (stage){
_local9 = (((((((location.x >= 0)) && ((location.y >= 0)))) && ((location.x <= stage.stageWidth)))) && ((location.y <= stage.stageHeight)));
};
if (((((!(_local9)) && (lastWithinStage))) && (!(disabledEvents[Event.MOUSE_LEAVE])))){
_lastEvent = new eventEvent(Event.MOUSE_LEAVE, false, false);
stage.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (((_local9) && (!(disabledEvents[MouseEvent.MOUSE_MOVE])))){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_MOVE, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastWithinStage = _local9;
};
if (_local4 != target){
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local7.x, _local7.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local7.x, _local7.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.MOUSE_OVER]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OVER, true, false, _local8.x, _local8.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OVER]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OVER, false, false, _local8.x, _local8.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
};
if (updateMouseDown){
if (_mouseIsDown){
if (!disabledEvents[MouseEvent.MOUSE_DOWN]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_DOWN, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastDownTarget = _local4;
updateMouseDown = false;
} else {
if (!disabledEvents[MouseEvent.MOUSE_UP]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_UP, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (((!(disabledEvents[MouseEvent.CLICK])) && ((_local4 == lastDownTarget)))){
_lastEvent = new mouseEventEvent(MouseEvent.CLICK, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastDownTarget = null;
updateMouseDown = false;
};
};
if (((((isDoubleClickEvent) && (!(disabledEvents[MouseEvent.DOUBLE_CLICK])))) && (_local4.doubleClickEnabled))){
_lastEvent = new mouseEventEvent(MouseEvent.DOUBLE_CLICK, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastLocation = location.clone();
lastMouseDown = _mouseIsDown;
target = _local4;
}
private function keyHandler(_arg1:KeyboardEvent):void{
altKey = _arg1.altKey;
ctrlKey = _arg1.ctrlKey;
shiftKey = _arg1.shiftKey;
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 81
//VirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.VirtualMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
import flash.events.*;
public class VirtualMouseEvent extends Event implements IVirtualMouseEvent {
public function VirtualMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 82
//VirtualMouseMouseEvent (org.papervision3d.core.utils.virtualmouse.VirtualMouseMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
public class VirtualMouseMouseEvent extends MouseEvent implements IVirtualMouseEvent {
public function VirtualMouseMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:InteractiveObject=null, _arg7:Boolean=false, _arg8:Boolean=false, _arg9:Boolean=false, _arg10:Boolean=false, _arg11:int=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 83
//InteractiveSceneManager (org.papervision3d.core.utils.InteractiveSceneManager)
package org.papervision3d.core.utils {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.*;
import flash.geom.*;
import com.blitzagency.xray.logger.*;
import flash.events.*;
import org.papervision3d.events.*;
import org.papervision3d.core.utils.virtualmouse.*;
import org.papervision3d.materials.*;
public class InteractiveSceneManager extends EventDispatcher {
public var virtualMouse:VirtualMouse;
public var mouse3D:Mouse3D;
public var viewport:Viewport3D;
public var container:Sprite;
public var renderHitData:RenderHitData;
public var currentDisplayObject3D:DisplayObject3D;
public var currentMaterial:MaterialObject3D;
public var enableOverOut:Boolean;// = true
public var currentMouseDO3D:DisplayObject3D;// = null
public var debug:Boolean;// = false
protected var log:XrayLog;
public static var MOUSE_IS_DOWN:Boolean = false;
public function InteractiveSceneManager(_arg1:Viewport3D){
virtualMouse = new VirtualMouse();
mouse3D = new Mouse3D();
log = new XrayLog();
super();
this.viewport = _arg1;
this.container = _arg1.containerSprite;
init();
}
public function init():void{
if (container){
if (container.stage){
initVirtualMouse();
} else {
container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
};
};
}
protected function handleAddedToStage(_arg1:Event):void{
initVirtualMouse();
initListeners();
}
protected function initVirtualMouse():void{
virtualMouse.stage = container.stage;
virtualMouse.container = container;
}
public function initListeners():void{
if (viewport.interactive){
container.addEventListener(MouseEvent.MOUSE_DOWN, handleMousePress);
container.addEventListener(MouseEvent.MOUSE_UP, handleMouseRelease);
container.addEventListener(MouseEvent.CLICK, handleMouseClick);
container.stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
};
}
public function updateRenderHitData():void{
resolveRenderHitData();
currentDisplayObject3D = renderHitData.displayObject3D;
currentMaterial = renderHitData.material;
manageOverOut();
}
protected function manageOverOut():void{
if (!enableOverOut){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
if (((!(currentMouseDO3D)) && (currentDisplayObject3D))){
handleMouseOver(currentDisplayObject3D);
currentMouseDO3D = currentDisplayObject3D;
} else {
if (((currentMouseDO3D) && (!((currentMouseDO3D == currentDisplayObject3D))))){
handleMouseOut(currentMouseDO3D);
handleMouseOver(currentDisplayObject3D);
currentMouseDO3D = currentDisplayObject3D;
};
};
} else {
if (currentMouseDO3D != null){
handleMouseOut(currentMouseDO3D);
currentMouseDO3D = null;
};
};
}
protected function resolveRenderHitData():void{
var _local1:Point = new Point();
_local1.x = container.mouseX;
_local1.y = container.mouseY;
renderHitData = (viewport.hitTestPoint2D(_local1) as RenderHitData);
}
protected function handleMousePress(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
MOUSE_IS_DOWN = true;
if (virtualMouse){
virtualMouse.press();
};
if (((((Mouse3D.enabled) && (renderHitData))) && (!((renderHitData.renderable == null))))){
mouse3D.updatePosition(renderHitData);
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_PRESS, currentDisplayObject3D);
};
}
protected function handleMouseRelease(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
MOUSE_IS_DOWN = false;
if (virtualMouse){
virtualMouse.release();
};
if (((((Mouse3D.enabled) && (renderHitData))) && (!((renderHitData.renderable == null))))){
mouse3D.updatePosition(renderHitData);
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_RELEASE, currentDisplayObject3D);
};
}
protected function handleMouseClick(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_CLICK, currentDisplayObject3D);
};
}
protected function handleMouseOver(_arg1:DisplayObject3D):void{
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OVER, _arg1);
}
protected function handleMouseOut(_arg1:DisplayObject3D):void{
var _local2:MovieMaterial;
if (_arg1){
_local2 = (_arg1.material as MovieMaterial);
if (_local2){
virtualMouse.exitContainer();
};
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OUT, _arg1);
}
protected function handleMouseMove(_arg1:MouseEvent):void{
var _local2:MovieMaterial;
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((virtualMouse) && (renderHitData))){
_local2 = (currentMaterial as MovieMaterial);
if (_local2){
virtualMouse.container = (_local2.movie as Sprite);
};
if (virtualMouse.container){
virtualMouse.setLocation(renderHitData.u, renderHitData.v);
};
if (((((Mouse3D.enabled) && (renderHitData))) && (!((renderHitData.renderable == null))))){
mouse3D.updatePosition(renderHitData);
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
} else {
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
};
};
}
protected function dispatchObjectEvent(_arg1:String, _arg2:DisplayObject3D):void{
var _local3:Number;
var _local4:Number;
if (debug){
log.debug(_arg1, _arg2.name);
};
if (((renderHitData) && (renderHitData.hasHit))){
_local3 = (renderHitData.u) ? renderHitData.u : 0;
_local4 = (renderHitData.v) ? renderHitData.v : 0;
dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container, (renderHitData.renderable as Triangle3D), _local3, _local4));
_arg2.dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container, (renderHitData.renderable as Triangle3D), _local3, _local4));
} else {
dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container));
if (_arg2){
_arg2.dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container));
};
};
}
}
}//package org.papervision3d.core.utils
Section 84
//Mouse3D (org.papervision3d.core.utils.Mouse3D)
package org.papervision3d.core.utils {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
public class Mouse3D extends DisplayObject3D {
private static var UP:Number3D = new Number3D(0, 1, 0);
public static var enabled:Boolean = false;
public function Mouse3D(_arg1:Object=null):void{
}
public function updatePosition(_arg1:RenderHitData):void{
var _local7:Number3D;
var _local8:Number3D;
var _local9:Matrix3D;
var _local2:Triangle3D = (_arg1.renderable as Triangle3D);
var _local3:Number3D = new Number3D(0, 0, 0);
var _local4:Number3D = new Number3D(_local2.faceNormal.x, _local2.faceNormal.y, _local2.faceNormal.z);
var _local5:Number3D = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local7 = Number3D.cross(_local5, UP);
_local7.normalize();
_local8 = Number3D.cross(_local5, _local7);
_local8.normalize();
_local9 = this.transform;
_local9.n11 = _local7.x;
_local9.n21 = _local7.y;
_local9.n31 = _local7.z;
_local9.n12 = -(_local8.x);
_local9.n22 = -(_local8.y);
_local9.n32 = -(_local8.z);
_local9.n13 = _local5.x;
_local9.n23 = _local5.y;
_local9.n33 = _local5.z;
};
var _local6:Matrix3D = Matrix3D.IDENTITY;
this.transform = Matrix3D.multiply(_local2.instance.world, _local9);
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
}
}//package org.papervision3d.core.utils
Section 85
//StopWatch (org.papervision3d.core.utils.StopWatch)
package org.papervision3d.core.utils {
import flash.events.*;
import flash.utils.*;
public class StopWatch extends EventDispatcher {
private var startTime:int;
private var stopTime:int;
private var elapsedTime:int;
private var isRunning:Boolean;
public function start():void{
if (!isRunning){
startTime = getTimer();
isRunning = true;
};
}
public function stop():int{
if (isRunning){
stopTime = getTimer();
elapsedTime = (stopTime - startTime);
isRunning = false;
return (elapsedTime);
};
return (0);
}
public function reset():void{
isRunning = false;
}
}
}//package org.papervision3d.core.utils
Section 86
//IViewport3D (org.papervision3d.core.view.IViewport3D)
package org.papervision3d.core.view {
public interface IViewport3D {
function updateBeforeRender():void;
function updateAfterRender():void;
}
}//package org.papervision3d.core.view
Section 87
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import flash.events.*;
public class InteractiveScene3DEvent extends Event {
public var displayObject3D:DisplayObject3D;// = null
public var sprite:Sprite;// = null
public var face3d:Triangle3D;// = null
public var x:Number;// = 0
public var y:Number;// = 0
public var renderHitData:RenderHitData;
public static const OBJECT_CLICK:String = "mouseClick";
public static const OBJECT_OVER:String = "mouseOver";
public static const OBJECT_OUT:String = "mouseOut";
public static const OBJECT_MOVE:String = "mouseMove";
public static const OBJECT_PRESS:String = "mousePress";
public static const OBJECT_RELEASE:String = "mouseRelease";
public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
public static const OBJECT_ADDED:String = "objectAdded";
public function InteractiveScene3DEvent(_arg1:String, _arg2:DisplayObject3D=null, _arg3:Sprite=null, _arg4:Triangle3D=null, _arg5:Number=0, _arg6:Number=0, _arg7:RenderHitData=null, _arg8:Boolean=false, _arg9:Boolean=false){
super(_arg1, _arg8, _arg9);
this.displayObject3D = _arg2;
this.sprite = _arg3;
this.face3d = _arg4;
this.x = _arg5;
this.y = _arg6;
this.renderHitData = _arg7;
}
}
}//package org.papervision3d.events
Section 88
//RendererEvent (org.papervision3d.events.RendererEvent)
package org.papervision3d.events {
import org.papervision3d.core.render.data.*;
import flash.events.*;
public class RendererEvent extends Event {
public var renderSessionData:RenderSessionData;
public static var RENDER_DONE:String = "onRenderDone";
public function RendererEvent(_arg1:String, _arg2:RenderSessionData){
super(_arg1);
this.renderSessionData = _arg2;
}
}
}//package org.papervision3d.events
Section 89
//GradientLineMaterial (org.papervision3d.materials.special.GradientLineMaterial)
package org.papervision3d.materials.special {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
public class GradientLineMaterial extends LineMaterial implements ILineDrawer {
private var colors:Array;
private var alphas:Array;
private var ratios:Array;
private var spreadMethod:String;
private var interpolationMethod:String;
private var matrix:Matrix;
private static var halfPI:Number = 1.5707963267949;
public function GradientLineMaterial(_arg1:Array=null, _arg2:Array=null, _arg3:Array=null, _arg4:String="repeat", _arg5:String="linearRGB"){
colors = [0x800000, 0xFF0000, 0x800000];
alphas = [100, 100, 100];
ratios = [0, 125, 0xFF];
super();
if (_arg1 != null){
this.colors = _arg1;
};
if (_arg2 != null){
this.alphas = _arg2;
};
if (_arg3 != null){
this.ratios = _arg3;
};
this.spreadMethod = _arg4;
this.interpolationMethod = _arg5;
matrix = new Matrix();
}
override public function drawLine(_arg1:Line3D, _arg2:Graphics, _arg3:RenderSessionData):void{
var _local4:Number = _arg3.camera.focus;
var _local5:Number = (_local4 * _arg3.camera.zoom);
var _local6:Number = (((_local5 / (_local4 + _arg1.v0.vertex3DInstance.z)) * 0.5) * _arg1.size);
var _local7:Number = (((_local5 / (_local4 + _arg1.v1.vertex3DInstance.z)) * 0.5) * _arg1.size);
var _local8:Number = Math.max(_local7, _local6);
var _local9:Number = _arg1.v0.vertex3DInstance.x;
var _local10:Number = _arg1.v0.vertex3DInstance.y;
var _local11:Number = _arg1.v0.vertex3DInstance.x;
var _local12:Number = _arg1.v0.vertex3DInstance.y;
var _local13:Number = _arg1.v1.vertex3DInstance.x;
var _local14:Number = _arg1.v1.vertex3DInstance.y;
var _local15:Number = _arg1.v1.vertex3DInstance.x;
var _local16:Number = _arg1.v1.vertex3DInstance.y;
var _local17:Number = Math.atan2((_local13 - _local11), (_local14 - _local12));
matrix.createGradientBox((_local8 * 2), (_local8 * 2), 0, ((Math.sin((_local17 - 1.55)) * _local8) * 0.4), (_local8 * 0.2));
matrix.rotate((_local17 * -1));
matrix.translate(_local11, _local12);
var _local18:Number = Math.sin((_local17 - halfPI));
var _local19:Number = Math.cos((_local17 - halfPI));
_local9 = (_local9 - (_local18 * _local6));
_local10 = (_local10 - (_local19 * _local6));
_local11 = (_local11 + (_local18 * _local6));
_local12 = (_local12 + (_local19 * _local6));
_local13 = (_local13 + (_local18 * _local7));
_local14 = (_local14 + (_local19 * _local7));
_local15 = (_local15 - (_local18 * _local7));
_local16 = (_local16 - (_local19 * _local7));
_arg2.lineStyle();
_arg2.beginGradientFill("linear", colors, alphas, ratios, matrix, spreadMethod, interpolationMethod);
_arg2.moveTo(_local9, _local10);
_arg2.curveTo((_arg1.v0.vertex3DInstance.x - (Math.sin(_local17) * _local6)), (_arg1.v0.vertex3DInstance.y - (Math.cos(_local17) * _local6)), _local11, _local12);
_arg2.lineTo(_local13, _local14);
_arg2.curveTo((_arg1.v1.vertex3DInstance.x + (Math.sin(_local17) * _local7)), (_arg1.v1.vertex3DInstance.y + (Math.cos(_local17) * _local7)), _local15, _local16);
_arg2.lineTo(_local9, _local10);
_arg2.endFill();
}
}
}//package org.papervision3d.materials.special
Section 90
//LineMaterial (org.papervision3d.materials.special.LineMaterial)
package org.papervision3d.materials.special {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.draw.*;
public class LineMaterial extends MaterialObject3D implements ILineDrawer {
private static var halfPI:Number = 1.5707963267949;
public function LineMaterial(_arg1:Number=0xFF0000, _arg2:Number=100){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
}
public function drawLine(_arg1:Line3D, _arg2:Graphics, _arg3:RenderSessionData):void{
var _local4:Number = _arg3.camera.focus;
var _local5:Number = (_local4 * _arg3.camera.zoom);
var _local6:Number = (((_local5 / (_local4 + _arg1.v0.vertex3DInstance.z)) * 0.5) * _arg1.size);
var _local7:Number = (((_local5 / (_local4 + _arg1.v1.vertex3DInstance.z)) * 0.5) * _arg1.size);
var _local8:Number = _arg1.v0.vertex3DInstance.x;
var _local9:Number = _arg1.v0.vertex3DInstance.y;
var _local10:Number = _arg1.v0.vertex3DInstance.x;
var _local11:Number = _arg1.v0.vertex3DInstance.y;
var _local12:Number = _arg1.v1.vertex3DInstance.x;
var _local13:Number = _arg1.v1.vertex3DInstance.y;
var _local14:Number = _arg1.v1.vertex3DInstance.x;
var _local15:Number = _arg1.v1.vertex3DInstance.y;
var _local16:Number = Math.atan2((_local12 - _local10), (_local13 - _local11));
var _local17:Number = Math.sin((_local16 - halfPI));
var _local18:Number = Math.cos((_local16 - halfPI));
_local8 = (_local8 - (_local17 * _local6));
_local9 = (_local9 - (_local18 * _local6));
_local10 = (_local10 + (_local17 * _local6));
_local11 = (_local11 + (_local18 * _local6));
_local12 = (_local12 + (_local17 * _local7));
_local13 = (_local13 + (_local18 * _local7));
_local14 = (_local14 - (_local17 * _local7));
_local15 = (_local15 - (_local18 * _local7));
_arg2.lineStyle();
_arg2.beginFill(lineColor, lineAlpha);
_arg2.moveTo(_local8, _local9);
_arg2.curveTo((_arg1.v0.vertex3DInstance.x - (Math.sin(_local16) * _local6)), (_arg1.v0.vertex3DInstance.y - (Math.cos(_local16) * _local6)), _local10, _local11);
_arg2.lineTo(_local12, _local13);
_arg2.curveTo((_arg1.v1.vertex3DInstance.x + (Math.sin(_local16) * _local7)), (_arg1.v1.vertex3DInstance.y + (Math.cos(_local16) * _local7)), _local14, _local15);
_arg2.lineTo(_local8, _local9);
_arg2.endFill();
}
}
}//package org.papervision3d.materials.special
Section 91
//ParticleMaterial (org.papervision3d.materials.special.ParticleMaterial)
package org.papervision3d.materials.special {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
public class ParticleMaterial extends MaterialObject3D implements IParticleDrawer {
public function ParticleMaterial(_arg1:Number, _arg2:Number){
this.fillAlpha = _arg2;
this.fillColor = _arg1;
}
public function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void{
_arg2.beginFill(fillColor, fillAlpha);
var _local4:Rectangle = _arg1.renderRect;
_arg2.drawRect(_local4.x, _local4.y, _local4.width, _local4.height);
_arg2.endFill();
_arg3.renderStatistics.particles++;
}
public function updateRenderRect(_arg1:Particle):void{
var _local2:Rectangle = _arg1.renderRect;
if (_arg1.size == 0){
_local2.width = 1;
_local2.height = 1;
} else {
_local2.width = (_arg1.renderScale * _arg1.size);
_local2.height = (_arg1.renderScale * _arg1.size);
};
_local2.x = (_arg1.vertex3D.vertex3DInstance.x - (_local2.width / 2));
_local2.y = (_arg1.vertex3D.vertex3DInstance.y - (_local2.width / 2));
}
}
}//package org.papervision3d.materials.special
Section 92
//MaterialsList (org.papervision3d.materials.utils.MaterialsList)
package org.papervision3d.materials.utils {
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MaterialsList {
public var materialsByName:Dictionary;
protected var _materials:Dictionary;
private var _materialsTotal:int;
public function MaterialsList(_arg1=null):void{
var _local2:String;
var _local3:String;
super();
this.materialsByName = new Dictionary(true);
this._materials = new Dictionary(false);
this._materialsTotal = 0;
if (_arg1){
if ((_arg1 is Array)){
for (_local2 in _arg1) {
this.addMaterial(_arg1[_local2]);
};
} else {
if ((_arg1 is Object)){
for (_local3 in _arg1) {
this.addMaterial(_arg1[_local3], _local3);
};
};
};
};
}
public function get numMaterials():int{
return (this._materialsTotal);
}
public function addMaterial(_arg1:MaterialObject3D, _arg2:String=null):MaterialObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this._materials[_arg1] = _arg2;
this.materialsByName[_arg2] = _arg1;
this._materialsTotal++;
return (_arg1);
}
public function removeMaterial(_arg1:MaterialObject3D):MaterialObject3D{
delete this.materialsByName[this._materials[_arg1]];
delete this._materials[_arg1];
return (_arg1);
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
return ((this.materialsByName[_arg1]) ? this.materialsByName[_arg1] : this.materialsByName["all"]);
}
public function removeMaterialByName(_arg1:String):MaterialObject3D{
return (removeMaterial(getMaterialByName(_arg1)));
}
public function clone():MaterialsList{
var _local2:MaterialObject3D;
var _local1:MaterialsList = new MaterialsList();
for each (_local2 in this.materialsByName) {
_local1.addMaterial(_local2.clone(), this._materials[_local2]);
};
return (_local1);
}
public function toString():String{
var _local2:MaterialObject3D;
var _local1 = "";
for each (_local2 in this.materialsByName) {
_local1 = (_local1 + (this._materials[_local2] + "\n"));
};
return (_local1);
}
}
}//package org.papervision3d.materials.utils
Section 93
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
import org.papervision3d.core.material.*;
public class BitmapMaterial extends TriangleMaterial implements ITriangleDrawer {
private var _precise:Boolean;
public var focus:Number;// = 100
public var minimumRenderSize:Number;// = 2
public var precision:Number;// = 8
protected var _texture:Object;
public var uvMatrices:Dictionary;
public static var AUTO_MIP_MAPPING:Boolean = false;
public static var MIP_MAP_DEPTH:Number = 8;
protected static var _triMatrix:Matrix = new Matrix();
protected static var _triMap:Matrix;
protected static var _localMatrix:Matrix = new Matrix();
public function BitmapMaterial(_arg1:BitmapData=null, _arg2:Boolean=false){
uvMatrices = new Dictionary();
super();
if (_arg1){
texture = _arg1;
};
this.precise = _arg2;
}
public function resetMapping():void{
uvMatrices = new Dictionary();
}
override public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (!_precise){
if (lineAlpha){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
};
if (bitmap){
_triMap = (_arg5) ? _arg5 : ((uvMatrices[_arg1]) || (transformUV(_arg1)));
_local6 = _arg1.v0.vertex3DInstance.x;
_local7 = _arg1.v0.vertex3DInstance.y;
_local8 = _arg1.v1.vertex3DInstance.x;
_local9 = _arg1.v1.vertex3DInstance.y;
_local10 = _arg1.v2.vertex3DInstance.x;
_local11 = _arg1.v2.vertex3DInstance.y;
_triMatrix.a = (_local8 - _local6);
_triMatrix.b = (_local9 - _local7);
_triMatrix.c = (_local10 - _local6);
_triMatrix.d = (_local11 - _local7);
_triMatrix.tx = _local6;
_triMatrix.ty = _local7;
_localMatrix.a = _triMap.a;
_localMatrix.b = _triMap.b;
_localMatrix.c = _triMap.c;
_localMatrix.d = _triMap.d;
_localMatrix.tx = _triMap.tx;
_localMatrix.ty = _triMap.ty;
_localMatrix.concat(_triMatrix);
_arg2.beginBitmapFill((_arg4) ? _arg4 : bitmap, _localMatrix, tiled, smooth);
};
_arg2.moveTo(_local6, _local7);
_arg2.lineTo(_local8, _local9);
_arg2.lineTo(_local10, _local11);
_arg2.lineTo(_local6, _local7);
if (bitmap){
_arg2.endFill();
};
if (lineAlpha){
_arg2.lineStyle();
};
_arg3.renderStatistics.triangles++;
} else {
_triMap = (_arg5) ? _arg5 : ((uvMatrices[_arg1]) || (transformUV(_arg1)));
focus = _arg3.camera.focus;
renderRec(_arg2, _triMap.a, _triMap.b, _triMap.c, _triMap.d, _triMap.tx, _triMap.ty, _arg1.v0.vertex3DInstance.x, _arg1.v0.vertex3DInstance.y, _arg1.v0.vertex3DInstance.z, _arg1.v1.vertex3DInstance.x, _arg1.v1.vertex3DInstance.y, _arg1.v1.vertex3DInstance.z, _arg1.v2.vertex3DInstance.x, _arg1.v2.vertex3DInstance.y, _arg1.v2.vertex3DInstance.z, 0, _arg3, (_arg4) ? _arg4 : bitmap);
};
}
public function transformUV(_arg1:Triangle3D):Matrix{
var _local2:Array;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Matrix;
var _local16:Matrix;
if (!_arg1.uv){
Papervision3D.log("MaterialObject3D: transformUV() uv not found!");
} else {
if (bitmap){
_local2 = _arg1.uv;
_local3 = (bitmap.width * maxU);
_local4 = (bitmap.height * maxV);
_local5 = (_local3 * _arg1.uv0.u);
_local6 = (_local4 * (1 - _arg1.uv0.v));
_local7 = (_local3 * _arg1.uv1.u);
_local8 = (_local4 * (1 - _arg1.uv1.v));
_local9 = (_local3 * _arg1.uv2.u);
_local10 = (_local4 * (1 - _arg1.uv2.v));
if ((((((_local5 == _local7)) && ((_local6 == _local8)))) || ((((_local5 == _local9)) && ((_local6 == _local10)))))){
_local5 = (_local5 - ((_local5)>0.05) ? 0.05 : -0.05);
_local6 = (_local6 - ((_local6)>0.07) ? 0.07 : -0.07);
};
if ((((_local9 == _local7)) && ((_local10 == _local8)))){
_local9 = (_local9 - ((_local9)>0.05) ? 0.04 : -0.04);
_local10 = (_local10 - ((_local10)>0.06) ? 0.06 : -0.06);
};
_local11 = (_local7 - _local5);
_local12 = (_local8 - _local6);
_local13 = (_local9 - _local5);
_local14 = (_local10 - _local6);
_local15 = new Matrix(_local11, _local12, _local13, _local14, _local5, _local6);
_local15.invert();
_local16 = ((uvMatrices[_arg1]) || ((uvMatrices[_arg1] = _local15.clone())));
_local16.a = _local15.a;
_local16.b = _local15.b;
_local16.c = _local15.c;
_local16.d = _local15.d;
_local16.tx = _local15.tx;
_local16.ty = _local15.ty;
} else {
Papervision3D.log("MaterialObject3D: transformUV() material.bitmap not found!");
};
};
return (_local16);
}
public function renderRec(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number, _arg13:Number, _arg14:Number, _arg15:Number, _arg16:Number, _arg17:Number, _arg18:RenderSessionData, _arg19:BitmapData):void{
if ((((((_arg10 <= 0)) && ((_arg13 <= 0)))) && ((_arg16 <= 0)))){
return;
};
if ((((((((_arg17 >= 100)) || ((focus == Infinity)))) || (((Math.max(Math.max(_arg8, _arg11), _arg14) - Math.min(Math.min(_arg8, _arg11), _arg14)) < minimumRenderSize)))) || (((Math.max(Math.max(_arg9, _arg12), _arg15) - Math.min(Math.min(_arg9, _arg12), _arg15)) < minimumRenderSize)))){
renderTriangleBitmap(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg11, _arg12, _arg14, _arg15, smooth, tiled, _arg19);
_arg18.renderStatistics.triangles++;
return;
};
var _local20:Number = (focus + _arg10);
var _local21:Number = (focus + _arg13);
var _local22:Number = (focus + _arg16);
var _local23:Number = (2 / (_local20 + _local21));
var _local24:Number = (2 / (_local21 + _local22));
var _local25:Number = (2 / (_local22 + _local20));
var _local26:Number = (((_arg8 * _local20) + (_arg11 * _local21)) * _local23);
var _local27:Number = (((_arg9 * _local20) + (_arg12 * _local21)) * _local23);
var _local28:Number = (((_arg11 * _local21) + (_arg14 * _local22)) * _local24);
var _local29:Number = (((_arg12 * _local21) + (_arg15 * _local22)) * _local24);
var _local30:Number = (((_arg14 * _local22) + (_arg8 * _local20)) * _local25);
var _local31:Number = (((_arg15 * _local22) + (_arg9 * _local20)) * _local25);
var _local32:Number = ((_arg8 + _arg11) - _local26);
var _local33:Number = ((_arg9 + _arg12) - _local27);
var _local34:Number = ((_arg11 + _arg14) - _local28);
var _local35:Number = ((_arg12 + _arg15) - _local29);
var _local36:Number = ((_arg14 + _arg8) - _local30);
var _local37:Number = ((_arg15 + _arg9) - _local31);
var _local38:Number = ((_local32 * _local32) + (_local33 * _local33));
var _local39:Number = ((_local34 * _local34) + (_local35 * _local35));
var _local40:Number = ((_local36 * _local36) + (_local37 * _local37));
if ((((((_local38 <= precision)) && ((_local40 <= precision)))) && ((_local39 <= precision)))){
renderTriangleBitmap(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg11, _arg12, _arg14, _arg15, smooth, tiled, _arg19);
_arg18.renderStatistics.triangles++;
return;
};
if ((((((_local38 > precision)) && ((_local40 > precision)))) && ((_local39 > precision)))){
renderRec(_arg1, (_arg2 * 2), (_arg3 * 2), (_arg4 * 2), (_arg5 * 2), (_arg6 * 2), (_arg7 * 2), _arg8, _arg9, _arg10, (_local26 * 0.5), (_local27 * 0.5), ((_arg10 + _arg13) * 0.5), (_local30 * 0.5), (_local31 * 0.5), ((_arg16 + _arg10) * 0.5), (_arg17 + 1), _arg18, _arg19);
renderRec(_arg1, (_arg2 * 2), (_arg3 * 2), (_arg4 * 2), (_arg5 * 2), ((_arg6 * 2) - 1), (_arg7 * 2), (_local26 * 0.5), (_local27 * 0.5), ((_arg10 + _arg13) * 0.5), _arg11, _arg12, _arg13, (_local28 * 0.5), (_local29 * 0.5), ((_arg13 + _arg16) * 0.5), (_arg17 + 1), _arg18, _arg19);
renderRec(_arg1, (_arg2 * 2), (_arg3 * 2), (_arg4 * 2), (_arg5 * 2), (_arg6 * 2), ((_arg7 * 2) - 1), (_local30 * 0.5), (_local31 * 0.5), ((_arg16 + _arg10) * 0.5), (_local28 * 0.5), (_local29 * 0.5), ((_arg13 + _arg16) * 0.5), _arg14, _arg15, _arg16, (_arg17 + 1), _arg18, _arg19);
renderRec(_arg1, (-(_arg2) * 2), (-(_arg3) * 2), (-(_arg4) * 2), (-(_arg5) * 2), ((-(_arg6) * 2) + 1), ((-(_arg7) * 2) + 1), (_local28 * 0.5), (_local29 * 0.5), ((_arg13 + _arg16) * 0.5), (_local30 * 0.5), (_local31 * 0.5), ((_arg16 + _arg10) * 0.5), (_local26 * 0.5), (_local27 * 0.5), ((_arg10 + _arg13) * 0.5), (_arg17 + 1), _arg18, _arg19);
return;
};
var _local41:Number = Math.max(_local38, Math.max(_local40, _local39));
if (_local38 == _local41){
renderRec(_arg1, (_arg2 * 2), (_arg3 * 1), (_arg4 * 2), (_arg5 * 1), (_arg6 * 2), (_arg7 * 1), _arg8, _arg9, _arg10, (_local26 * 0.5), (_local27 * 0.5), ((_arg10 + _arg13) * 0.5), _arg14, _arg15, _arg16, (_arg17 + 1), _arg18, _arg19);
renderRec(_arg1, ((_arg2 * 2) + _arg3), (_arg3 * 1), ((2 * _arg4) + _arg5), (_arg5 * 1), (((_arg6 * 2) + _arg7) - 1), (_arg7 * 1), (_local26 * 0.5), (_local27 * 0.5), ((_arg10 + _arg13) * 0.5), _arg11, _arg12, _arg13, _arg14, _arg15, _arg16, (_arg17 + 1), _arg18, _arg19);
return;
};
if (_local40 == _local41){
renderRec(_arg1, (_arg2 * 1), (_arg3 * 2), (_arg4 * 1), (_arg5 * 2), (_arg6 * 1), (_arg7 * 2), _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, (_local30 * 0.5), (_local31 * 0.5), ((_arg16 + _arg10) * 0.5), (_arg17 + 1), _arg18, _arg19);
renderRec(_arg1, (_arg2 * 1), ((_arg3 * 2) + _arg2), (_arg4 * 1), ((_arg5 * 2) + _arg4), _arg6, (((_arg7 * 2) + _arg6) - 1), (_local30 * 0.5), (_local31 * 0.5), ((_arg16 + _arg10) * 0.5), _arg11, _arg12, _arg13, _arg14, _arg15, _arg16, (_arg17 + 1), _arg18, _arg19);
return;
};
renderRec(_arg1, (_arg2 - _arg3), (_arg3 * 2), (_arg4 - _arg5), (_arg5 * 2), (_arg6 - _arg7), (_arg7 * 2), _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, (_local28 * 0.5), (_local29 * 0.5), ((_arg13 + _arg16) * 0.5), (_arg17 + 1), _arg18, _arg19);
renderRec(_arg1, (2 * _arg2), (_arg3 - _arg2), (_arg4 * 2), (_arg5 - _arg4), (2 * _arg6), (_arg7 - _arg6), _arg8, _arg9, _arg10, (_local28 * 0.5), (_local29 * 0.5), ((_arg13 + _arg16) * 0.5), _arg14, _arg15, _arg16, (_arg17 + 1), _arg18, _arg19);
}
public function renderTriangleBitmap(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number, _arg13:Number, _arg14:Boolean, _arg15:Boolean, _arg16:BitmapData):void{
var _local17:Number = (_arg10 - _arg8);
var _local18:Number = (_arg11 - _arg9);
var _local19:Number = (_arg12 - _arg8);
var _local20:Number = (_arg13 - _arg9);
var _local21:Matrix = new Matrix(((_arg2 * _local17) + (_arg3 * _local19)), ((_arg2 * _local18) + (_arg3 * _local20)), ((_arg4 * _local17) + (_arg5 * _local19)), ((_arg4 * _local18) + (_arg5 * _local20)), (((_arg6 * _local17) + (_arg7 * _local19)) + _arg8), (((_arg6 * _local18) + (_arg7 * _local20)) + _arg9));
_arg1.beginBitmapFill(_arg16, _local21, _arg15, _arg14);
_arg1.moveTo(_arg8, _arg9);
_arg1.lineTo(_arg10, _arg11);
_arg1.lineTo(_arg12, _arg13);
_arg1.endFill();
}
override public function toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
protected function createBitmap(_arg1:BitmapData):BitmapData{
resetMapping();
if (AUTO_MIP_MAPPING){
return (correctBitmap(_arg1));
};
this.maxU = (this.maxV = 1);
return (_arg1);
}
protected function correctBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
var _local3:Number = (1 << MIP_MAP_DEPTH);
var _local4:Number = (_arg1.width / _local3);
_local4 = ((_local4 == uint(_local4))) ? _local4 : (uint(_local4) + 1);
var _local5:Number = (_arg1.height / _local3);
_local5 = ((_local5 == uint(_local5))) ? _local5 : (uint(_local5) + 1);
var _local6:Number = (_local3 * _local4);
var _local7:Number = (_local3 * _local5);
var _local8:Boolean;
if (_local6 > 2880){
_local6 = _arg1.width;
_local8 = false;
};
if (_local7 > 2880){
_local7 = _arg1.height;
_local8 = false;
};
if (!_local8){
Papervision3D.log((("Material " + this.name) + ": Texture too big for mip mapping. Resizing recommended for better performance and quality."));
};
if (((_arg1) && (((!(((_arg1.width % _local3) == 0))) || (!(((_arg1.height % _local3) == 0))))))){
_local2 = new BitmapData(_local6, _local7, _arg1.transparent, 0);
widthOffset = _arg1.width;
heightOffset = _arg1.height;
this.maxU = (_arg1.width / _local6);
this.maxV = (_arg1.height / _local7);
_local2.draw(_arg1);
extendBitmapEdges(_local2, _arg1.width, _arg1.height);
} else {
this.maxU = (this.maxV = 1);
_local2 = _arg1;
};
return (_local2);
}
protected function extendBitmapEdges(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local6:int;
var _local4:Rectangle = new Rectangle();
var _local5:Point = new Point();
if (_arg1.width > _arg2){
_local4.x = (_arg2 - 1);
_local4.y = 0;
_local4.width = 1;
_local4.height = _arg3;
_local5.y = 0;
_local6 = _arg2;
while (_local6 < _arg1.width) {
_local5.x = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
if (_arg1.height > _arg3){
_local4.x = 0;
_local4.y = (_arg3 - 1);
_local4.width = _arg1.width;
_local4.height = 1;
_local5.x = 0;
_local6 = _arg3;
while (_local6 < _arg1.height) {
_local5.y = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
}
override public function copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
override public function clone():MaterialObject3D{
var _local1:MaterialObject3D = super.clone();
_local1.maxU = this.maxU;
_local1.maxV = this.maxV;
return (_local1);
}
public function set precise(_arg1:Boolean):void{
_precise = _arg1;
}
public function get precise():Boolean{
return (_precise);
}
public function get texture():Object{
return (this._texture);
}
public function set texture(_arg1:Object):void{
if ((_arg1 is BitmapData) == false){
Papervision3D.log("Error: BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmap(BitmapData(_arg1));
_texture = _arg1;
}
}
}//package org.papervision3d.materials
Section 94
//MovieAssetMaterial (org.papervision3d.materials.MovieAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
public class MovieAssetMaterial extends MovieMaterial implements ITriangleDrawer {
public var createUnique:Boolean;// = false
private static var _library:Object = new Object();
private static var _count:Object = new Object();
public function MovieAssetMaterial(_arg1:String="", _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Boolean=false){
movieTransparent = _arg2;
this.animated = _arg3;
this.createUnique = _arg4;
this.precise = _arg5;
if (_arg1.length > 0){
texture = _arg1;
};
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is String) == false){
Papervision3D.log("Error: MovieAssetMaterial.texture requires a String to be passed to create the MovieClip reference from the library");
return;
};
movie = Sprite(createMovie(String(_arg1)));
bitmap = createBitmapFromSprite(movie);
_texture = _arg1;
}
protected function createMovie(_arg1):MovieClip{
var _local3:Class;
var _local4:MovieClip;
if (this._texture != _arg1){
var _local5 = _count;
var _local6 = this._texture;
var _local7 = (_local5[_local6] - 1);
_local5[_local6] = _local7;
_local4 = _library[this._texture];
if (((_local4) && ((_count[this._texture] == 0)))){
_library[this._texture] = null;
};
};
var _local2:MovieClip = _library[_arg1];
if (!_local2){
_local3 = (getDefinitionByName(_arg1) as Class);
_local2 = new (_local3);
_library[_arg1] = _local2;
_count[_arg1] = 0;
} else {
if (createUnique){
_local3 = (getDefinitionByName(_arg1) as Class);
_local2 = new (_local3);
} else {
_local5 = _count;
_local6 = _arg1;
_local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
};
};
return (_local2);
}
override protected function destroy():void{
super.destroy();
bitmap.dispose();
}
}
}//package org.papervision3d.materials
Section 95
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
public class MovieMaterial extends BitmapMaterial implements ITriangleDrawer, IUpdateBeforeMaterial {
private var _animated:Boolean;
public var movie:DisplayObject;
public var movieTransparent:Boolean;
public var allowAutoResize:Boolean;// = true
public function MovieMaterial(_arg1:DisplayObject=null, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false){
movieTransparent = _arg2;
this.animated = _arg3;
this.interactive = interactive;
this.precise = _arg4;
if (_arg1){
texture = _arg1;
};
}
public function get animated():Boolean{
return (_animated);
}
public function set animated(_arg1:Boolean):void{
_animated = _arg1;
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is DisplayObject) == false){
Papervision3D.log("Error: MovieMaterial.texture requires a Sprite to be passed as the object");
return;
};
bitmap = createBitmapFromSprite(DisplayObject(_arg1));
_texture = _arg1;
}
protected function createBitmapFromSprite(_arg1:DisplayObject):BitmapData{
movie = _arg1;
initBitmap(movie);
drawBitmap();
bitmap = super.createBitmap(bitmap);
return (bitmap);
}
protected function initBitmap(_arg1:DisplayObject):void{
if (bitmap){
bitmap.dispose();
};
bitmap = new BitmapData(_arg1.width, _arg1.height, this.movieTransparent);
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:int;
var _local3:int;
if (_animated){
_local2 = int(movie.width);
_local3 = int(movie.height);
if (((allowAutoResize) && (((!((_local2 == bitmap.width))) || (!((_local3 == bitmap.height))))))){
initBitmap(movie);
};
drawBitmap();
};
}
public function drawBitmap():void{
bitmap.fillRect(bitmap.rect, this.fillColor);
var _local1:Matrix = new Matrix();
_local1.scale(movie.scaleX, movie.scaleY);
bitmap.draw(movie, _local1, movie.transform.colorTransform);
}
override protected function destroy():void{
super.destroy();
bitmap.dispose();
}
}
}//package org.papervision3d.materials
Section 96
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial)
package org.papervision3d.materials {
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class WireframeMaterial extends TriangleMaterial implements ITriangleDrawer {
public function WireframeMaterial(_arg1:Number=0xFF00FF, _arg2:Number=100, _arg3:Number=0){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
this.lineThickness = _arg3;
this.doubleSided = false;
}
override public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:Number = _arg1.v0.vertex3DInstance.x;
var _local7:Number = _arg1.v0.vertex3DInstance.y;
if (lineAlpha){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
_arg2.moveTo(_local6, _local7);
_arg2.lineTo(_arg1.v1.vertex3DInstance.x, _arg1.v1.vertex3DInstance.y);
_arg2.lineTo(_arg1.v2.vertex3DInstance.x, _arg1.v2.vertex3DInstance.y);
_arg2.lineTo(_local6, _local7);
_arg2.lineStyle();
_arg3.renderStatistics.triangles++;
};
}
override public function toString():String{
return (((("WireframeMaterial - color:" + this.lineColor) + " alpha:") + this.lineAlpha));
}
}
}//package org.papervision3d.materials
Section 97
//Cube (org.papervision3d.objects.primitives.Cube)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.*;
public class Cube extends TriangleMesh3D {
public var segments:Number3D;
private var insideFaces:int;
private var excludeFaces:int;
public static var NONE:int = 0;
public static var FRONT:int = 1;
public static var BACK:int = 2;
public static var RIGHT:int = 4;
public static var LEFT:int = 8;
public static var TOP:int = 16;
public static var BOTTOM:int = 32;
public static var ALL:int = (((((FRONT + BACK) + RIGHT) + LEFT) + TOP) + BOTTOM);
public function Cube(_arg1:MaterialsList, _arg2:Number=500, _arg3:Number=500, _arg4:Number=500, _arg5:int=1, _arg6:int=1, _arg7:int=1, _arg8:int=0, _arg9:int=0, _arg10:Object=null){
super(_arg1.getMaterialByName("all"), new Array(), new Array(), null, _arg10);
this.materials = _arg1;
this.insideFaces = _arg8;
this.excludeFaces = _arg9;
segments = new Number3D(_arg5, _arg6, _arg7);
buildCube(_arg2, _arg4, _arg3);
}
private function buildCube(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number = (_arg1 / 2);
var _local5:Number = (_arg2 / 2);
var _local6:Number = (_arg3 / 2);
if (!(excludeFaces & FRONT)){
buildPlane("front", "x", "y", _arg1, _arg2, _local6, !(Boolean((insideFaces & FRONT))));
};
if (!(excludeFaces & BACK)){
buildPlane("back", "x", "y", _arg1, _arg2, -(_local6), Boolean((insideFaces & BACK)));
};
if (!(excludeFaces & RIGHT)){
buildPlane("right", "z", "y", _arg3, _arg2, _local4, Boolean((insideFaces & RIGHT)));
};
if (!(excludeFaces & LEFT)){
buildPlane("left", "z", "y", _arg3, _arg2, -(_local4), !(Boolean((insideFaces & LEFT))));
};
if (!(excludeFaces & TOP)){
buildPlane("top", "x", "z", _arg1, _arg3, _local5, Boolean((insideFaces & TOP)));
};
if (!(excludeFaces & BOTTOM)){
buildPlane("bottom", "x", "z", _arg1, _arg3, -(_local5), !(Boolean((insideFaces & BOTTOM))));
};
mergeVertices();
this.geometry.ready = true;
}
private function buildPlane(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false):void{
var _local8:MaterialObject3D;
var _local9:String;
var _local23:NumberUV;
var _local24:NumberUV;
var _local25:NumberUV;
var _local26:int;
var _local27:Vertex3D;
var _local28:Vertex3D;
var _local29:Vertex3D;
var _local30:Vertex3D;
_local8 = materials.getMaterialByName(_arg1);
if (!_local8){
_local8 = materials.getMaterialByName("all");
if (!_local8){
Papervision3D.log("Cube: Required material not found in given materials list. Supported materials are: front, back, right, left, top, bottom & all.");
return;
};
};
if ((((((_arg2 == "x")) && ((_arg3 == "y")))) || ((((_arg2 == "y")) && ((_arg3 == "x")))))){
_local9 = "z";
} else {
if ((((((_arg2 == "x")) && ((_arg3 == "z")))) || ((((_arg2 == "z")) && ((_arg3 == "x")))))){
_local9 = "y";
} else {
if ((((((_arg2 == "z")) && ((_arg3 == "y")))) || ((((_arg2 == "y")) && ((_arg3 == "z")))))){
_local9 = "x";
};
};
};
var _local10:Number = (_arg7) ? -1 : 1;
var _local11:Number = this.segments[_arg2];
var _local12:Number = this.segments[_arg3];
var _local13:Number = (_local11 + 1);
var _local14:Number = (_local12 + 1);
var _local15:Array = this.geometry.vertices;
var _local16:Array = this.geometry.faces;
var _local17:Array = new Array();
var _local18:Number = (_arg4 / 2);
var _local19:Number = (_arg5 / 2);
var _local20:Number = (_arg4 / _local11);
var _local21:Number = (_arg5 / _local12);
var _local22:int;
while (_local22 < _local13) {
_local26 = 0;
while (_local26 < _local14) {
_local27 = new Vertex3D();
_local27[_arg2] = (((_local22 * _local20) - _local18) * _local10);
_local27[_arg3] = ((_local26 * _local21) - _local19);
_local27[_local9] = _arg6;
_local15.push(_local27);
_local17.push(_local27);
_local26++;
};
_local22++;
};
_local22 = 0;
while (_local22 < _local11) {
_local26 = 0;
while (_local26 < _local12) {
_local28 = _local17[((_local22 * _local14) + _local26)];
_local29 = _local17[((_local22 * _local14) + (_local26 + 1))];
_local30 = _local17[(((_local22 + 1) * _local14) + _local26)];
_local23 = new NumberUV((_local22 / _local11), (_local26 / _local12));
_local24 = new NumberUV((_local22 / _local11), ((_local26 + 1) / _local12));
_local25 = new NumberUV(((_local22 + 1) / _local11), (_local26 / _local12));
_local16.push(new Triangle3D(this, [_local28, _local30, _local29], _local8, [_local23, _local25, _local24]));
_local28 = _local17[(((_local22 + 1) * _local14) + (_local26 + 1))];
_local29 = _local17[(((_local22 + 1) * _local14) + _local26)];
_local30 = _local17[((_local22 * _local14) + (_local26 + 1))];
_local23 = new NumberUV(((_local22 + 1) / _local11), ((_local26 + 1) / _local12));
_local24 = new NumberUV(((_local22 + 1) / _local11), (_local26 / _local12));
_local25 = new NumberUV((_local22 / _local11), ((_local26 + 1) / _local12));
_local16.push(new Triangle3D(this, [_local29, _local28, _local30], _local8, [_local24, _local23, _local25]));
_local26++;
};
_local22++;
};
}
}
}//package org.papervision3d.objects.primitives
Section 98
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.math.*;
import com.blitzagency.xray.logger.*;
import org.papervision3d.core.data.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.*;
public class DisplayObject3D extends DisplayObjectContainer3D {
public var screen:Number3D;
public var visible:Boolean;
public var name:String;
public var id:int;
public var extra:Object;
public var materials:MaterialsList;
protected var _scene:SceneObject3D;// = null
public var parent:DisplayObjectContainer3D;
public var meshSort:uint;// = 1
public var transform:Matrix3D;
public var view:Matrix3D;
public var world:Matrix3D;
public var faces:Array;
public var geometry:GeometryObject3D;
public var screenZ:Number;
public var culled:Boolean;
protected var _transformDirty:Boolean;// = false
private var _rotationX:Number;
private var _rotationY:Number;
private var _rotationZ:Number;
private var _rotationDirty:Boolean;// = false
private var _scaleX:Number;
private var _scaleY:Number;
private var _scaleZ:Number;
private var _scaleDirty:Boolean;// = false
protected var _sorted:Array;
protected var _useOwnContainer:Boolean;
protected var _containerSortMode:int;
protected var _containerBlendMode:int;
protected var _filters:Array;
protected var _userData:UserData;
private var _material:MaterialObject3D;
public static const MESH_SORT_CENTER:uint = 1;
public static const MESH_SORT_FAR:uint = 2;
public static const MESH_SORT_CLOSE:uint = 3;
private static var entry_count:uint = 0;
private static var FORWARD:Number3D = new Number3D(0, 0, 1);
private static var BACKWARD:Number3D = new Number3D(0, 0, -1);
private static var LEFT:Number3D = new Number3D(-1, 0, 0);
private static var RIGHT:Number3D = new Number3D(1, 0, 0);
private static var UP:Number3D = new Number3D(0, 1, 0);
private static var DOWN:Number3D = new Number3D(0, -1, 0);
public static var faceLevelMode:Boolean;
public static var sortedArray:Array = new Array();
private static var _totalDisplayObjects:int = 0;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
public function DisplayObject3D(_arg1:String=null, _arg2:GeometryObject3D=null, _arg3:Object=null):void{
screen = new Number3D();
faces = new Array();
super();
Papervision3D.log(("DisplayObject3D: " + _arg1));
this.culled = false;
this.transform = Matrix3D.IDENTITY;
this.world = Matrix3D.IDENTITY;
this.view = Matrix3D.IDENTITY;
if (_arg3 != null){
this.x = (_arg3.x) ? ((_arg3.x) || (0)) : 0;
this.y = (_arg3.y) ? ((_arg3.y) || (0)) : 0;
this.z = (_arg3.z) ? ((_arg3.z) || (0)) : 0;
};
rotationX = (_arg3) ? ((_arg3.rotationX) || (0)) : 0;
rotationY = (_arg3) ? ((_arg3.rotationY) || (0)) : 0;
rotationZ = (_arg3) ? ((_arg3.rotationZ) || (0)) : 0;
var _local4:Number = (Papervision3D.usePERCENT) ? 100 : 1;
scaleX = (_arg3) ? ((_arg3.scaleX) || (_local4)) : _local4;
scaleY = (_arg3) ? ((_arg3.scaleY) || (_local4)) : _local4;
scaleZ = (_arg3) ? ((_arg3.scaleZ) || (_local4)) : _local4;
if (((_arg3) && (_arg3.extra))){
this.extra = _arg3.extra;
};
this.visible = true;
this.id = _totalDisplayObjects++;
this.name = ((_arg1) || (String(this.id)));
if (_arg2){
addGeometry(_arg2);
};
}
public function get x():Number{
return (this.transform.n14);
}
public function set x(_arg1:Number):void{
this.transform.n14 = _arg1;
}
public function get y():Number{
return (this.transform.n24);
}
public function set y(_arg1:Number):void{
this.transform.n24 = _arg1;
}
public function get z():Number{
return (this.transform.n34);
}
public function set z(_arg1:Number):void{
this.transform.n34 = _arg1;
}
public function get rotationX():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (-(this._rotationX) * toDEGREES) : -(this._rotationX));
}
public function set rotationX(_arg1:Number):void{
this._rotationX = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function get rotationY():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (-(this._rotationY) * toDEGREES) : -(this._rotationY));
}
public function set rotationY(_arg1:Number):void{
this._rotationY = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function get rotationZ():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (-(this._rotationZ) * toDEGREES) : -(this._rotationZ));
}
public function set rotationZ(_arg1:Number):void{
this._rotationZ = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
private function updateRotation():void{
var _local1:Number3D = Matrix3D.matrix2euler(this.transform);
this._rotationX = (_local1.x * toRADIANS);
this._rotationY = (_local1.y * toRADIANS);
this._rotationZ = (_local1.z * toRADIANS);
this._rotationDirty = false;
}
public function get scale():Number{
if ((((this._scaleX == this._scaleY)) && ((this._scaleX == this._scaleZ)))){
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
//unresolved jump
};
return (NaN);
}
public function set scale(_arg1:Number):void{
if (Papervision3D.usePERCENT){
_arg1 = (_arg1 / 100);
};
this._scaleX = (this._scaleY = (this._scaleZ = _arg1));
this._transformDirty = true;
}
public function get scaleX():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
}
public function set scaleX(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleX = (_arg1 / 100);
} else {
this._scaleX = _arg1;
};
this._transformDirty = true;
}
public function get scaleY():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleY * 100));
};
return (this._scaleY);
}
public function set scaleY(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleY = (_arg1 / 100);
} else {
this._scaleY = _arg1;
};
this._transformDirty = true;
}
public function get scaleZ():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleZ * 100));
};
return (this._scaleZ);
}
public function set scaleZ(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleZ = (_arg1 / 100);
} else {
this._scaleZ = _arg1;
};
this._transformDirty = true;
}
public function get sceneX():Number{
return (this.world.n14);
}
public function get sceneY():Number{
return (this.world.n24);
}
public function get sceneZ():Number{
return (this.world.n34);
}
public function set material(_arg1:MaterialObject3D):void{
if (_material){
_material.unregisterObject(this);
};
_material = _arg1;
_material.registerObject(this);
}
public function get material():MaterialObject3D{
return (_material);
}
public function set scene(_arg1:SceneObject3D):void{
var _local2:DisplayObject3D;
_scene = _arg1;
for each (_local2 in this._childrenByName) {
if (_local2.scene == null){
_local2.scene = _scene;
};
};
}
public function get scene():SceneObject3D{
return (_scene);
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
if (_arg1.scene == null){
_arg1.scene = scene;
};
return (_arg1);
}
public function addGeometry(_arg1:GeometryObject3D=null):void{
if (_arg1){
this.geometry = _arg1;
};
}
public function distanceTo(_arg1:DisplayObject3D):Number{
var _local2:Number = (this.x - _arg1.x);
var _local3:Number = (this.y - _arg1.y);
var _local4:Number = (this.z - _arg1.z);
return (Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))));
}
public function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number = (this.x - _arg1);
var _local5:Number = (this.y - _arg2);
var _local6:Number = (this.z - _arg3);
var _local7:Number = (((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6));
var _local8:Number = (this.geometry) ? this.geometry.boundingSphere2 : 0;
return ((_local8 > _local7));
}
public function hitTestObject(_arg1:DisplayObject3D, _arg2:Number=1):Boolean{
var _local3:Number = (this.x - _arg1.x);
var _local4:Number = (this.y - _arg1.y);
var _local5:Number = (this.z - _arg1.z);
var _local6:Number = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5));
var _local7:Number = (this.geometry) ? this.geometry.boundingSphere2 : 0;
var _local8:Number = (_arg1.geometry) ? _arg1.geometry.boundingSphere2 : 0;
_local7 = (_local7 * _arg2);
return (((_local7 + _local8) > _local6));
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
var _local3:DisplayObject3D;
var _local2:MaterialObject3D = this.materials.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
for each (_local3 in this._childrenByName) {
_local2 = _local3.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
};
return (null);
}
public function materialsList():String{
var _local2:String;
var _local3:DisplayObject3D;
var _local1 = "";
for (_local2 in this.materials) {
_local1 = (_local1 + (_local2 + "\n"));
};
for each (_local3 in this._childrenByName) {
for (_local2 in _local3.materials.materialsByName) {
_local1 = (_local1 + (("+ " + _local2) + "\n"));
};
};
return (_local1);
}
public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local5:DisplayObject3D;
if (_arg2.viewPort.viewportObjectFilter){
if (_arg2.viewPort.viewportObjectFilter.testObject(this) == 0){
return (0);
};
};
if (this._transformDirty){
updateTransform();
};
this.world.calculateMultiply(_arg1.world, this.transform);
if ((_arg2.camera is IObjectCuller)){
if (this === _arg2.camera){
this.culled = true;
} else {
this.culled = (IObjectCuller(_arg2.camera).testObject(this) < 0);
};
if (this.culled){
_arg2.renderStatistics.culledObjects++;
return (0);
};
if (_arg1 !== _arg2.camera){
this.view.calculateMultiply4x4(_arg1.view, this.transform);
};
} else {
if (_arg1 !== _arg2.camera){
this.view.calculateMultiply(_arg1.view, this.transform);
};
};
calculateScreenCoords(_arg2.camera);
var _local3:Number = 0;
var _local4:Number = 0;
if (_useOwnContainer){
};
for each (_local5 in this._childrenByName) {
if (_local5.visible){
_local3 = (_local3 + _local5.project(this, _arg2));
_local4++;
};
};
return ((this.screenZ = (_local3 / _local4)));
}
private function calculateScreenCoords(_arg1:CameraObject3D):void{
var _local2:Number = ((_arg1.focus * _arg1.zoom) / (_arg1.focus + view.n34));
screen.x = (view.n14 * _local2);
screen.y = (view.n24 * _local2);
screen.z = view.n34;
}
public function moveForward(_arg1:Number):void{
translate(_arg1, FORWARD);
}
public function moveBackward(_arg1:Number):void{
translate(_arg1, BACKWARD);
}
public function moveLeft(_arg1:Number):void{
translate(_arg1, LEFT);
}
public function moveRight(_arg1:Number):void{
translate(_arg1, RIGHT);
}
public function moveUp(_arg1:Number):void{
translate(_arg1, UP);
}
public function moveDown(_arg1:Number):void{
translate(_arg1, DOWN);
}
public function translate(_arg1:Number, _arg2:Number3D):void{
var _local3:Number3D = _arg2.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local3);
this.x = (this.x + (_arg1 * _local3.x));
this.y = (this.y + (_arg1 * _local3.y));
this.z = (this.z + (_arg1 * _local3.z));
}
public function pitch(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
var _local2:Number3D = RIGHT.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
var _local3:Matrix3D = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function yaw(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
var _local2:Number3D = UP.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
var _local3:Matrix3D = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function roll(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
var _local2:Number3D = FORWARD.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
var _local3:Matrix3D = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
var _local6:Number3D;
var _local7:Number3D;
var _local8:Matrix3D;
var _local9:XrayLog;
var _local3:Number3D = new Number3D(this.x, this.y, this.z);
var _local4:Number3D = new Number3D(_arg1.x, _arg1.y, _arg1.z);
var _local5:Number3D = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local6 = Number3D.cross(_local5, ((_arg2) || (UP)));
_local6.normalize();
_local7 = Number3D.cross(_local5, _local6);
_local7.normalize();
_local8 = this.transform;
_local8.n11 = (_local6.x * _scaleX);
_local8.n21 = (_local6.y * _scaleX);
_local8.n31 = (_local6.z * _scaleX);
_local8.n12 = (-(_local7.x) * _scaleY);
_local8.n22 = (-(_local7.y) * _scaleY);
_local8.n32 = (-(_local7.z) * _scaleY);
_local8.n13 = (_local5.x * _scaleZ);
_local8.n23 = (_local5.y * _scaleZ);
_local8.n33 = (_local5.z * _scaleZ);
this._transformDirty = false;
this._rotationDirty = true;
} else {
_local9 = new XrayLog();
_local9.debug("lookAt Error");
};
}
public function copyPosition(_arg1):void{
var _local2:Matrix3D = this.transform;
var _local3:Matrix3D = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
}
public function copyTransform(_arg1):void{
var _local2:Matrix3D = this.transform;
var _local3:Matrix3D = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n11 = _local3.n11;
_local2.n12 = _local3.n12;
_local2.n13 = _local3.n13;
_local2.n14 = _local3.n14;
_local2.n21 = _local3.n21;
_local2.n22 = _local3.n22;
_local2.n23 = _local3.n23;
_local2.n24 = _local3.n24;
_local2.n31 = _local3.n31;
_local2.n32 = _local3.n32;
_local2.n33 = _local3.n33;
_local2.n34 = _local3.n34;
this._transformDirty = false;
this._rotationDirty = true;
}
protected function updateTransform():void{
var _local1:Object = Matrix3D.euler2quaternion(-(this._rotationY), -(this._rotationZ), this._rotationX);
var _local2:Matrix3D = Matrix3D.quaternion2matrix(_local1.x, _local1.y, _local1.z, _local1.w);
var _local3:Matrix3D = this.transform;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
_local3.copy(_local2);
var _local4:Matrix3D = Matrix3D.IDENTITY;
_local4.n11 = this._scaleX;
_local4.n22 = this._scaleY;
_local4.n33 = this._scaleZ;
this.transform.calculateMultiply(_local3, _local4);
this._transformDirty = false;
}
override public function toString():String{
return (((((((this.name + ": x:") + Math.round(this.x)) + " y:") + Math.round(this.y)) + " z:") + Math.round(this.z)));
}
public function set useOwnContainer(_arg1:Boolean):void{
_useOwnContainer = _arg1;
}
public function get useOwnContainer():Boolean{
return (_useOwnContainer);
}
public function set containerSortMode(_arg1:int):void{
_containerSortMode = _arg1;
}
public function get containerSortMode():int{
return (_containerSortMode);
}
public function set containerBlendMode(_arg1:int):void{
_containerBlendMode = _arg1;
}
public function get containerBlendMode():int{
return (_containerBlendMode);
}
public function set filters(_arg1:Array):void{
_filters = _arg1;
}
public function get filters():Array{
return (_filters);
}
function setLayerForViewport(_arg1:ViewportLayer):void{
}
public function set userData(_arg1:UserData):void{
_userData = _arg1;
}
public function get userData():UserData{
return (_userData);
}
public static function get ZERO():DisplayObject3D{
return (new (DisplayObject3D));
}
}
}//package org.papervision3d.objects
Section 99
//BasicRenderEngine (org.papervision3d.render.BasicRenderEngine)
package org.papervision3d.render {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.events.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.render.sort.*;
import org.papervision3d.core.render.filter.*;
import org.papervision3d.core.utils.*;
public class BasicRenderEngine extends AbstractRenderEngine implements IRenderEngine {
public var sorter:IRenderSorter;
public var filter:IRenderFilter;
protected var renderStatistics:RenderStatistics;
protected var renderList:Array;
protected var renderSessionData:RenderSessionData;
protected var cleanRHD:RenderHitData;
protected var stopWatch:StopWatch;
public function BasicRenderEngine():void{
cleanRHD = new RenderHitData();
super();
init();
}
protected function init():void{
renderStatistics = new RenderStatistics();
stopWatch = new StopWatch();
sorter = new BasicRenderSorter();
filter = new BasicRenderFilter();
renderList = new Array();
renderSessionData = new RenderSessionData();
renderSessionData.renderer = this;
}
override public function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D, _arg4:Boolean=true):RenderStatistics{
_arg3.updateBeforeRender();
_arg3.lastRenderer = this;
if (((_arg1.animationEngine) && ((_arg4 == true)))){
_arg1.animationEngine.tick();
};
renderSessionData.scene = _arg1;
renderSessionData.camera = _arg2;
renderSessionData.viewPort = _arg3;
renderSessionData.container = _arg3.containerSprite;
renderSessionData.triangleCuller = _arg3.triangleCuller;
renderSessionData.particleCuller = _arg3.particleCuller;
renderSessionData.renderStatistics.clear();
doProject(renderSessionData);
doRender(renderSessionData);
dispatchEvent(new RendererEvent(RendererEvent.RENDER_DONE, renderSessionData));
return (renderSessionData.renderStatistics);
}
protected function doProject(_arg1:RenderSessionData):void{
var _local3:DisplayObject3D;
stopWatch.reset();
stopWatch.start();
_arg1.camera.transformView();
var _local2:Array = _arg1.scene.objects;
var _local4:Number = _local2.length;
if ((_arg1.camera is IObjectCuller)){
for each (_local3 in _local2) {
if (_local3.visible){
if (_arg1.viewPort.viewportObjectFilter){
if (_arg1.viewPort.viewportObjectFilter.testObject(_local3)){
_local3.view.calculateMultiply4x4(_arg1.camera.eye, _local3.transform);
_local3.project(_arg1.camera, _arg1);
} else {
_arg1.renderStatistics.filteredObjects++;
};
} else {
_local3.view.calculateMultiply4x4(_arg1.camera.eye, _local3.transform);
_local3.project(_arg1.camera, _arg1);
};
};
};
} else {
for each (_local3 in _local2) {
if (_local3.visible){
if (_arg1.viewPort.viewportObjectFilter){
if (_arg1.viewPort.viewportObjectFilter.testObject(_local3)){
_local3.view.calculateMultiply(_arg1.camera.eye, _local3.transform);
_local3.project(_arg1.camera, _arg1);
} else {
_arg1.renderStatistics.filteredObjects++;
};
} else {
_local3.view.calculateMultiply(_arg1.camera.eye, _local3.transform);
_local3.project(_arg1.camera, _arg1);
};
};
};
};
_arg1.renderStatistics.projectionTime = stopWatch.stop();
}
protected function doRender(_arg1:RenderSessionData):RenderStatistics{
var _local2:IRenderListItem;
stopWatch.reset();
stopWatch.start();
MaterialManager.getInstance().updateMaterialsBeforeRender(_arg1);
filter.filter(renderList);
sorter.sort(renderList);
while ((_local2 = renderList.pop())) {
_local2.render(_arg1);
_arg1.viewPort.lastRenderList.push(_local2);
};
MaterialManager.getInstance().updateMaterialsAfterRender(_arg1);
_arg1.renderStatistics.renderTime = stopWatch.stop();
_arg1.viewPort.updateAfterRender();
return (renderStatistics);
}
public function hitTestPoint2D(_arg1:Point, _arg2:Viewport3D):RenderHitData{
return (_arg2.hitTestPoint2D(_arg1));
}
override public function addToRenderList(_arg1:IRenderListItem):int{
return (renderList.push(_arg1));
}
override public function removeFromRenderList(_arg1:IRenderListItem):int{
return (renderList.splice(renderList.indexOf(_arg1), 1));
}
}
}//package org.papervision3d.render
Section 100
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.animation.core.*;
public class Scene3D extends SceneObject3D {
public function Scene3D(_arg1:Boolean=false){
this.animated = _arg1;
if (_arg1){
this.animationEngine = AnimationEngine.getInstance();
};
}
}
}//package org.papervision3d.scenes
Section 101
//ViewportBaseLayer (org.papervision3d.view.layer.ViewportBaseLayer)
package org.papervision3d.view.layer {
import org.papervision3d.view.*;
public class ViewportBaseLayer extends ViewportLayer {
public function ViewportBaseLayer(_arg1:Viewport3D){
super(_arg1, null);
}
}
}//package org.papervision3d.view.layer
Section 102
//ViewportLayer (org.papervision3d.view.layer.ViewportLayer)
package org.papervision3d.view.layer {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.*;
public class ViewportLayer extends Sprite {
private var childLayers:Array;
protected var viewport:Viewport3D;
protected var _displayObject3D:DisplayObject3D;
public function ViewportLayer(_arg1:Viewport3D, _arg2:DisplayObject3D){
this.viewport = _arg1;
this.displayObject3D = _arg2;
init();
}
private function init():void{
childLayers = new Array();
}
function getChildLayerFor(_arg1:DisplayObject3D):ViewportLayer{
var _local2:ViewportLayer;
if (_arg1){
_local2 = new ViewportLayer(viewport, _arg1);
addChild(_local2);
return (_local2);
};
trace("Needs to be a do3d");
return (null);
}
function clear():void{
var _local1:ViewportLayer;
for each (_local1 in childLayers) {
_local1.clear();
removeChild(_local1);
};
graphics.clear();
}
public function set displayObject3D(_arg1:DisplayObject3D):void{
_displayObject3D = _arg1;
}
public function get displayObject3D():DisplayObject3D{
return (_displayObject3D);
}
}
}//package org.papervision3d.view.layer
Section 103
//Viewport3D (org.papervision3d.view.Viewport3D)
package org.papervision3d.view {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import flash.events.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.events.*;
import org.papervision3d.render.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.view.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.utils.*;
public class Viewport3D extends Sprite implements IViewport3D {
protected var _width:Number;
protected var _hWidth:Number;
protected var _height:Number;
protected var _hHeight:Number;
protected var _autoClipping:Boolean;
protected var _autoCulling:Boolean;
protected var _autoScaleToStage:Boolean;
protected var _interactive:Boolean;
protected var _lastRenderer:IRenderEngine;
protected var _viewportObjectFilter:ViewportObjectFilter;
public var sizeRectangle:Rectangle;
public var cullingRectangle:Rectangle;
protected var _containerSprite:ViewportBaseLayer;
public var triangleCuller:ITriangleCuller;
public var particleCuller:IParticleCuller;
public var lastRenderList:Array;
public var interactiveSceneManager:InteractiveSceneManager;
public function Viewport3D(_arg1:Number=640, _arg2:Number=480, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Boolean=true, _arg6:Boolean=true){
this.interactive = _arg4;
init();
this.viewportWidth = _arg1;
this.viewportHeight = _arg2;
this.autoClipping = _arg5;
this.autoCulling = _arg6;
this.autoScaleToStage = _arg3;
}
protected function init():void{
lastRenderList = new Array();
sizeRectangle = new Rectangle();
cullingRectangle = new Rectangle();
_containerSprite = new ViewportBaseLayer(this);
addChild(_containerSprite);
if (interactive){
interactiveSceneManager = new InteractiveSceneManager(this);
};
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
public function hitTestMouse():RenderHitData{
var _local1:Point = new Point(containerSprite.mouseX, containerSprite.mouseY);
return (hitTestPoint2D(_local1));
}
public function hitTestPoint2D(_arg1:Point):RenderHitData{
var _local2:RenderableListItem;
var _local3:RenderHitData;
var _local4:IRenderListItem;
var _local5:uint;
if (interactive){
_local3 = new RenderHitData();
_local5 = lastRenderList.length;
while ((_local4 = lastRenderList[--_local5])) {
if ((_local4 is RenderableListItem)){
_local2 = (_local4 as RenderableListItem);
_local3 = _local2.hitTestPoint2D(_arg1, _local3);
if (_local3.hasHit){
return (_local3);
};
};
};
};
return (new RenderHitData());
}
protected function onAddedToStage(_arg1:Event):void{
stage.addEventListener(Event.RESIZE, onStageResize);
onStageResize();
}
protected function onRemovedFromStage(_arg1:Event):void{
stage.removeEventListener(Event.RESIZE, onStageResize);
}
protected function onStageResize(_arg1:Event=null):void{
if (_autoScaleToStage){
viewportWidth = stage.stageWidth;
viewportHeight = stage.stageHeight;
};
}
protected function handleRenderDone(_arg1:RendererEvent):void{
interactiveSceneManager.updateRenderHitData();
}
public function set lastRenderer(_arg1:BasicRenderEngine):void{
if (!interactive){
return;
};
_arg1.removeEventListener(RendererEvent.RENDER_DONE, handleRenderDone);
_arg1.addEventListener(RendererEvent.RENDER_DONE, handleRenderDone);
}
public function set viewportWidth(_arg1:Number):void{
_width = _arg1;
_hWidth = (_arg1 / 2);
containerSprite.x = _hWidth;
sizeRectangle.width = _arg1;
cullingRectangle.x = -(_hWidth);
cullingRectangle.width = _arg1;
scrollRect = sizeRectangle;
}
public function get viewportWidth():Number{
return (_width);
}
public function set viewportHeight(_arg1:Number):void{
_height = _arg1;
_hHeight = (_arg1 / 2);
containerSprite.y = _hHeight;
sizeRectangle.height = _arg1;
cullingRectangle.y = -(_hHeight);
cullingRectangle.height = _arg1;
scrollRect = sizeRectangle;
}
public function get viewportHeight():Number{
return (_height);
}
public function get containerSprite():ViewportLayer{
return (_containerSprite);
}
public function set autoClipping(_arg1:Boolean):void{
if (_arg1){
scrollRect = sizeRectangle;
} else {
scrollRect = null;
};
_autoClipping = _arg1;
}
public function get autoClipping():Boolean{
return (_autoClipping);
}
public function set autoCulling(_arg1:Boolean):void{
if (_arg1){
triangleCuller = new RectangleTriangleCuller(cullingRectangle);
particleCuller = new RectangleParticleCuller(cullingRectangle);
} else {
if (!_arg1){
triangleCuller = new DefaultTriangleCuller();
particleCuller = new DefaultParticleCuller();
};
};
_autoCulling = _arg1;
}
public function get autoCulling():Boolean{
return (_autoCulling);
}
public function set autoScaleToStage(_arg1:Boolean):void{
_autoScaleToStage = _arg1;
if (((_arg1) && (!((stage == null))))){
onStageResize();
};
}
public function get autoScaleToStage():Boolean{
return (_autoScaleToStage);
}
public function set interactive(_arg1:Boolean):void{
_interactive = _arg1;
}
public function get interactive():Boolean{
return (_interactive);
}
public function updateBeforeRender():void{
lastRenderList.length = 0;
_containerSprite.clear();
}
public function updateAfterRender():void{
}
public function set viewportObjectFilter(_arg1:ViewportObjectFilter):void{
_viewportObjectFilter = _arg1;
}
public function get viewportObjectFilter():ViewportObjectFilter{
return (_viewportObjectFilter);
}
}
}//package org.papervision3d.view
Section 104
//Papervision3D (org.papervision3d.Papervision3D)
package org.papervision3d {
public class Papervision3D {
public static var useDEGREES:Boolean = true;
public static var usePERCENT:Boolean = false;
public static var NAME:String = "Papervision3D";
public static var VERSION:String = "Public Alpha 2.0 - Great White";
public static var DATE:String = "14.2.08";
public static var AUTHOR:String = "(c) 2006-2007 Copyright by Carlos Ulloa - | John Grden | Ralph Hauwert | Tim Knip | Andy Zupko";
public static var VERBOSE:Boolean = true;
public static function log(_arg1:String):void{
if (Papervision3D.VERBOSE){
trace(_arg1);
};
}
}
}//package org.papervision3d
Section 105
//Back (Back)
package {
import flash.display.*;
public dynamic class Back extends MovieClip {
}
}//package
Section 106
//Bottom (Bottom)
package {
import flash.display.*;
public dynamic class Bottom extends MovieClip {
}
}//package
Section 107
//FpsCounter (FpsCounter)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
public class FpsCounter extends MovieClip {
private var time:Number;
private var frameTime:Number;
private var prevFrameTime:Number;
private var secondTime:Number;
private var prevSecondTime:Number;
private var frames:Number;// = 0
private var fps:String;// = "..."
public var tf:TextField;
public var iBar:MovieClip;
public function FpsCounter(){
prevFrameTime = getTimer();
prevSecondTime = getTimer();
super();
addEventListener(Event.ENTER_FRAME, onFrameTick);
}
function onFrameTick(_arg1:Event):void{
time = getTimer();
frameTime = (time - prevFrameTime);
secondTime = (time - prevSecondTime);
if (secondTime >= 1000){
fps = frames.toString();
frames = 0;
prevSecondTime = time;
} else {
frames++;
};
prevFrameTime = time;
tf.text = ((fps + " FPS / ") + frameTime);
if (MarksLine(parent).renderStatistics){
tf.appendText((", stats = " + MarksLine(parent).renderStatistics.toString()));
};
var _local2:Number = (stage.stageWidth * (fps / stage.frameRate));
iBar.width = ((_local2 + iBar.width) / 2);
}
}
}//package
Section 108
//Front (Front)
package {
import flash.display.*;
public dynamic class Front extends MovieClip {
}
}//package
Section 109
//FullscreenButton (FullscreenButton)
package {
import flash.display.*;
import flash.events.*;
public class FullscreenButton extends SimpleButton {
public function FullscreenButton(_arg1:DisplayObject=null, _arg2:DisplayObject=null, _arg3:DisplayObject=null, _arg4:DisplayObject=null){
super(_arg1, _arg2, _arg3, _arg4);
addEventListener(MouseEvent.CLICK, toggleFullScreen);
}
private function toggleFullScreen(_arg1:MouseEvent):void{
try {
switch (stage.displayState){
case StageDisplayState.FULL_SCREEN:
stage.displayState = StageDisplayState.NORMAL;
break;
default:
stage.displayState = StageDisplayState.FULL_SCREEN;
break;
};
} catch(err:SecurityError) {
};
}
}
}//package
Section 110
//Left (Left)
package {
import flash.display.*;
public dynamic class Left extends MovieClip {
}
}//package
Section 111
//Logo (Logo)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Logo extends Sprite {
private var imgClass:Class;
private var imgClassOver:Class;
private var logoBitmap:BitmapData;
private var logoBitmapOver:BitmapData;
private var logo:Bitmap;
public function Logo(){
imgClass = Logo_imgClass;
imgClassOver = Logo_imgClassOver;
super();
logo = new imgClass();
logoBitmap = logo.bitmapData.clone();
addChild(logo);
var _local1:Bitmap = new imgClassOver();
logoBitmapOver = _local1.bitmapData.clone();
buttonMode = true;
useHandCursor = true;
mouseChildren = false;
addEventListener(MouseEvent.CLICK, onLogoClick);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}
private function onLogoClick(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://barcinski.nl"), "_blank");
}
public function onMouseOver(_arg1:Event):void{
logo.bitmapData = logoBitmapOver;
}
public function onMouseOut(_arg1:Event):void{
logo.bitmapData = logoBitmap;
}
}
}//package
Section 112
//Logo_imgClass (Logo_imgClass)
package {
import mx.core.*;
public class Logo_imgClass extends BitmapAsset {
}
}//package
Section 113
//Logo_imgClassOver (Logo_imgClassOver)
package {
import mx.core.*;
public class Logo_imgClassOver extends BitmapAsset {
}
}//package
Section 114
//MarksLine (MarksLine)
package {
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.geom.renderables.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.*;
import flash.events.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.materials.special.*;
import org.papervision3d.render.*;
import org.papervision3d.scenes.*;
import org.papervision3d.materials.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.primitives.*;
public class MarksLine extends Sprite {
private var scene:Scene3D;
private var viewport:Viewport3D;
private var renderer:BasicRenderEngine;
private var cube:Cube;
private var camera:FrustumCamera3D;
private var lines:Lines3D;
private var lineMaterial:LineMaterial;
private var dummy:DisplayObject3D;
public var lineSize:Number;// = 100
private var logo:Logo;
public var fpsCounter:Sprite;
public var fullscreenButton:DisplayObject;
public var renderStatistics:RenderStatistics;
private var sideSpeed:Number;// = 0
private var upRotationSpeed:Number;// = 0
private var forwardSpeed:Number;// = 500
var prevVertex3d:Vertex3D;
public function MarksLine(){
init();
}
private function init():void{
setupScene();
setupDummy();
setupCube();
setupLines();
setupListeners();
logo = new Logo();
addChild(logo);
onResize(null);
}
private function setupScene():void{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
viewport = new Viewport3D(800, 600, true, false, true, true);
addChildAt(viewport, 0);
renderer = new BasicRenderEngine();
scene = new Scene3D();
camera = new FrustumCamera3D(viewport, 90, 0.01, 2000000);
}
private function setupDummy():void{
dummy = new DisplayObject3D();
dummy.rotationY = 180;
dummy.rotationX = 5;
}
private function setupCube():void{
var _local1:Number = 1000000;
var _local2:Number = 6;
var _local3:MaterialsList = new MaterialsList({front:new MovieAssetMaterial("Front"), back:new MovieAssetMaterial("Back"), right:new MovieAssetMaterial("Right"), left:new MovieAssetMaterial("Left"), top:new MovieAssetMaterial("Top"), bottom:new MovieAssetMaterial("Bottom")});
var _local4:int = Cube.ALL;
var _local5:int = Cube.NONE;
cube = new Cube(_local3, _local1, _local1, _local1, _local2, _local2, _local2, _local4, _local5);
scene.addChild(cube);
}
private function setupLines():void{
lineMaterial = new GradientLineMaterial([268435440, 0xAAAAAA, 268435440]);
lines = new Lines3D(lineMaterial);
lines.addNewLine(lineSize, 0, 0, 0, 0, 0, 500);
scene.addChild(lines);
prevVertex3d = lines.geometry.vertices[1];
}
private function setupListeners():void{
addEventListener(Event.ENTER_FRAME, onRenderTick);
stage.addEventListener(Event.RESIZE, onResize);
}
private function onRenderTick(_arg1:Event):void{
sideSpeed = (viewport.containerSprite.mouseX / 100);
upRotationSpeed = (viewport.containerSprite.mouseY / 100);
dummy.pitch(upRotationSpeed);
dummy.yaw(sideSpeed);
dummy.moveForward(forwardSpeed);
var _local2:Vertex3D = new Vertex3D(dummy.x, dummy.y, dummy.z);
var _local3:Line3D = new Line3D(lines, lineMaterial, lineSize, prevVertex3d, _local2);
lines.addLine(_local3);
prevVertex3d = _local2;
camera.copyPosition(dummy);
camera.copyTransform(dummy);
camera.moveUp(5000);
camera.moveBackward(10000);
camera.tilt(20);
renderStatistics = renderer.renderScene(scene, camera, viewport);
if (lines.lines.length > 1000){
lines.removeLine(lines.lines[0]);
};
}
private function onResize(_arg1:Event):void{
fullscreenButton.x = ((stage.stageWidth - fullscreenButton.width) - 15);
fullscreenButton.y = ((stage.stageHeight - fullscreenButton.height) - 15);
}
}
}//package
Section 115
//Right (Right)
package {
import flash.display.*;
public dynamic class Right extends MovieClip {
}
}//package
Section 116
//Top (Top)
package {
import flash.display.*;
public dynamic class Top extends MovieClip {
}
}//package