Section 1
//Tracker (com.memecounter.Tracker)
package com.memecounter {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class Tracker {
public static const ORI_DOM:String = "ori_dom";
public static const LOCALHOST:String = "localhost";
public static const LOCAL:String = "Local";
public static const TRACKER_PATH:String = "/node/tracking/trackerAS3.swf";
private static var ori_dom:String;
private static var lurl:String;
private static var _isReady:Boolean = false;
public static var a:uint = 0;
public static var root:DisplayObject;
public static var c:uint;
public static var d:String = "";
private static var _isInited:Boolean = false;
public static var fpv:String = "";
private static var l:Loader;
private static var tracker:MovieClip;
public static var da:Array = ["distralytics.com", "5.n.distralytics.com", "distralytics.co.uk"];
private static function loadError(_arg1:Event):void{
a++;
lc();
}
public static function init(_arg1:uint, _arg2:DisplayObject):void{
var _local3:uint;
if (!_isInited){
_isInited = true;
c = _arg1;
root = _arg2;
_local3 = 0;
while (_local3 < da.length) {
Security.allowDomain(da[_local3], ((c + ".c.") + da[_local3]), ("*." + da[_local3]));
_local3++;
};
ori_dom = (root.loaderInfo.parameters.hasOwnProperty(ORI_DOM)) ? root.loaderInfo.parameters[ORI_DOM] : "";
d = ((ori_dom)!="") ? ori_dom : ((new LocalConnection().domain.indexOf(LOCALHOST))==-1) ? new LocalConnection().domain : LOCAL;
fpv = Capabilities.version.split(" ")[1].split(",")[0];
lurl = (((((((((TRACKER_PATH + "?c=") + c) + "&r=") + Math.floor((Math.random() * 10000000000))) + "&d=") + d) + "&p=") + fpv) + "&as=3");
l = new Loader();
l.contentLoaderInfo.addEventListener(Event.INIT, loadComplete);
l.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
lc();
};
}
public static function kvClick(_arg1:uint):void{
if (_isReady){
tracker.kvClick(_arg1);
};
}
public static function get isReady():Boolean{
return (_isReady);
}
public static function kvCountry():String{
if (_isReady){
return (tracker.kvCountry());
};
return ("");
}
public static function kvEvent(_arg1:uint):void{
if (_isReady){
tracker.kvEvent(_arg1);
};
}
private static function lc():void{
var _local1:String;
_local1 = (((("http://" + c) + ".c.") + da[(a % da.length)]) + lurl);
Security.allowDomain(_local1);
l.load(new URLRequest(_local1));
}
private static function loadComplete(_arg1:Event):void{
tracker = _arg1.target.content;
tracker.init(getDefinitionByName("com.memecounter.Tracker"), root);
_isReady = true;
}
}
}//package com.memecounter
Section 2
//Cubic (gs.easing.Cubic)
package gs.easing {
public class Cubic {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package gs.easing
Section 3
//TweenLite (gs.TweenLite)
package gs {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
public class TweenLite {
public var delay:Number;
protected var _hasUpdate:Boolean;
public var started:Boolean;
protected var _subTweens:Array;
public var initted:Boolean;
public var active:Boolean;
public var startTime:Number;
public var target:Object;
public var duration:Number;
protected var _hst:Boolean;
protected var _isDisplayObject:Boolean;
public var gc:Boolean;
public var vars:Object;
public var ease:Function;
public var tweens:Array;
protected var _specialVars:Object;
public var combinedTimeScale:Number;
public var initTime:Number;
private static var _timer:Timer = new Timer(2000);
private static var _classInitted:Boolean;
public static var defaultEase:Function = TweenLite.easeOut;
public static var version:Number = 9.3;
public static var masterList:Dictionary = new Dictionary(false);
public static var currentTime:uint;
public static var overwriteManager:Object;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public static var timingSprite:Sprite = new Sprite();
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local4:int;
super();
if (_arg1 == null){
return;
};
if (!_classInitted){
currentTime = getTimer();
timingSprite.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
_timer.addEventListener("timer", killGarbage, false, 0, true);
_timer.start();
_classInitted = true;
};
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
this.combinedTimeScale = ((_arg3.timeScale) || (1));
this.active = Boolean((((_arg2 == 0)) && ((this.delay == 0))));
this.target = _arg1;
_isDisplayObject = Boolean((((_arg1 is DisplayObject)) || (_arg1.hasOwnProperty("isTweenProxy"))));
if (!(this.vars.ease is Function)){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
this.ease = this.vars.ease;
if (!isNaN(Number(this.vars.autoAlpha))){
this.vars.alpha = Number(this.vars.autoAlpha);
this.vars.visible = Boolean((this.vars.alpha > 0));
};
_specialVars = ((this.vars.isTV)==true) ? this.vars.exposedProps : this.vars;
this.tweens = [];
_subTweens = [];
_hst = (this.initted = false);
this.initTime = currentTime;
this.startTime = (this.initTime + (this.delay * 1000));
_local4 = ((((_arg3.overwrite == undefined)) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
if ((((masterList[_arg1] == undefined)) || (((!((_arg1 == null))) && ((_local4 == 1)))))){
masterList[_arg1] = [];
};
masterList[_arg1].push(this);
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (this.active))){
initTweenVals();
if (this.active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
if (((((!((_specialVars.visible == null))) && ((this.vars.runBackwards == true)))) && (_isDisplayObject))){
this.target.visible = _specialVars.visible;
};
};
}
public function set enabled(_arg1:Boolean):void{
var _local2:Array;
var _local3:Boolean;
var _local4:int;
if (_arg1){
if (masterList[this.target] == undefined){
masterList[this.target] = [this];
} else {
_local2 = masterList[this.target];
_local4 = (_local2.length - 1);
while (_local4 > -1) {
if (_local2[_local4] == this){
_local3 = true;
break;
};
_local4--;
};
if (!_local3){
masterList[this.target].push(this);
};
};
};
this.gc = (_arg1) ? false : true;
if (this.gc){
this.active = false;
} else {
this.active = this.started;
};
}
public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:Object;
var _local5:int;
_local2 = ((_arg1 - this.startTime) * 0.001);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4[0][_local4[1]] = (_local4[2] + (_local3 * _local4[3]));
_local5--;
};
if (_hst){
_local5 = (_subTweens.length - 1);
while (_local5 > -1) {
_subTweens[_local5].proxy(_subTweens[_local5], _local2);
_local5--;
};
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
public function activate():void{
this.started = (this.active = true);
if (!this.initted){
initTweenVals();
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
}
public function clear():void{
this.tweens = [];
_subTweens = [];
this.vars = {};
_hst = (_hasUpdate = false);
}
protected function addSubTween(_arg1:String, _arg2:Function, _arg3:Object, _arg4:Object, _arg5:Object=null):void{
var _local6:String;
_subTweens[_subTweens.length] = {name:_arg1, proxy:_arg2, target:_arg3, info:_arg5};
for (_local6 in _arg4) {
if (typeof(_arg4[_local6]) == "number"){
this.tweens[this.tweens.length] = [_arg3, _local6, _arg3[_local6], (_arg4[_local6] - _arg3[_local6]), _arg1];
} else {
this.tweens[this.tweens.length] = [_arg3, _local6, _arg3[_local6], Number(_arg4[_local6]), _arg1];
};
};
_hst = true;
}
public function initTweenVals(_arg1:Boolean=false, _arg2:String=""):void{
var _local3:String;
var _local4:int;
var _local5:Array;
var _local6:ColorTransform;
var _local7:ColorTransform;
var _local8:Object;
if (((!(_arg1)) && (overwriteManager.enabled))){
overwriteManager.manageOverwrites(this, masterList[this.target]);
};
if ((this.target is Array)){
_local5 = ((this.vars.endArray) || ([]));
_local4 = 0;
while (_local4 < _local5.length) {
if (((!((this.target[_local4] == _local5[_local4]))) && (!((this.target[_local4] == undefined))))){
this.tweens[this.tweens.length] = [this.target, _local4.toString(), this.target[_local4], (_local5[_local4] - this.target[_local4]), _local4.toString()];
};
_local4++;
};
} else {
if (((((!((typeof(_specialVars.tint) == "undefined"))) || ((this.vars.removeTint == true)))) && (this.target.hasOwnProperty("transform")))){
_local6 = this.target.transform.colorTransform;
_local7 = new ColorTransform();
if (_specialVars.alpha != undefined){
_local7.alphaMultiplier = _specialVars.alpha;
delete _specialVars.alpha;
} else {
_local7.alphaMultiplier = this.target.alpha;
};
if (((!((this.vars.removeTint == true))) && (((((!((_specialVars.tint == null))) && (!((_specialVars.tint == ""))))) || ((_specialVars.tint == 0)))))){
_local7.color = _specialVars.tint;
};
addSubTween("tint", tintProxy, {progress:0}, {progress:1}, {target:this.target, color:_local6, endColor:_local7});
};
if (((!((_specialVars.frame == null))) && (_isDisplayObject))){
addSubTween("frame", frameProxy, {frame:this.target.currentFrame}, {frame:_specialVars.frame}, {target:this.target});
};
if (((!(isNaN(this.vars.volume))) && (this.target.hasOwnProperty("soundTransform")))){
addSubTween("volume", volumeProxy, this.target.soundTransform, {volume:this.vars.volume}, {target:this.target});
};
if (((!((_specialVars.visible == null))) && (_isDisplayObject))){
addSubTween("visible", visibleProxy, {}, {}, {tween:this});
};
for (_local3 in _specialVars) {
if ((((((((((((((((((((((((((((((((((((_local3 == "ease")) || ((_local3 == "delay")))) || ((_local3 == "overwrite")))) || ((_local3 == "onComplete")))) || ((_local3 == "onCompleteParams")))) || ((_local3 == "runBackwards")))) || ((_local3 == "visible")))) || ((_local3 == "autoOverwrite")))) || ((_local3 == "persist")))) || ((_local3 == "onUpdate")))) || ((_local3 == "onUpdateParams")))) || ((_local3 == "autoAlpha")))) || ((_local3 == "onStart")))) || ((_local3 == "onStartParams")))) || ((_local3 == "renderOnStart")))) || ((_local3 == "proxiedEase")))) || ((_local3 == "easeParams")))) || (((_arg1) && (!((_arg2.indexOf(((" " + _local3) + " ")) == -1))))))){
} else {
if (((!(((_isDisplayObject) && ((((((_local3 == "tint")) || ((_local3 == "removeTint")))) || ((_local3 == "frame"))))))) && (!((((_local3 == "volume")) && (this.target.hasOwnProperty("soundTransform"))))))){
if (typeof(_specialVars[_local3]) == "number"){
this.tweens[this.tweens.length] = [this.target, _local3, this.target[_local3], (_specialVars[_local3] - this.target[_local3]), _local3];
} else {
this.tweens[this.tweens.length] = [this.target, _local3, this.target[_local3], Number(_specialVars[_local3]), _local3];
};
};
};
};
};
if (this.vars.runBackwards == true){
_local4 = (this.tweens.length - 1);
while (_local4 > -1) {
_local8 = this.tweens[_local4];
_local8[2] = (_local8[2] + _local8[3]);
_local8[3] = (_local8[3] * -1);
_local4--;
};
};
if (this.vars.onUpdate != null){
_hasUpdate = true;
};
this.initted = true;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function killVars(_arg1:Object):void{
if (overwriteManager.enabled){
overwriteManager.killVars(_arg1, this.vars, this.tweens, _subTweens, []);
};
}
public function get enabled():Boolean{
return ((this.gc) ? false : true);
}
public function complete(_arg1:Boolean=false):void{
if (!_arg1){
if (!this.initted){
initTweenVals();
};
this.startTime = (currentTime - ((this.duration * 1000) / this.combinedTimeScale));
render(currentTime);
return;
};
if (this.vars.persist != true){
this.enabled = false;
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
}
public static function frameProxy(_arg1:Object, _arg2:Number=0):void{
_arg1.info.target.gotoAndStop(Math.round(_arg1.target.frame));
}
public static function removeTween(_arg1:TweenLite, _arg2:Boolean=true):void{
if (_arg1 != null){
if (_arg2){
_arg1.clear();
};
_arg1.enabled = false;
};
}
public static function visibleProxy(_arg1:Object, _arg2:Number):void{
var _local3:TweenLite;
_local3 = _arg1.info.tween;
if (_local3.duration == _arg2){
if (((!((_local3.vars.runBackwards == true))) && ((_local3.ease == _local3.vars.ease)))){
_local3.target.visible = _local3.vars.visible;
};
} else {
if (_local3.target.visible != true){
_local3.target.visible = true;
};
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
if (((!((_arg1 == null))) && (!((masterList[_arg1] == undefined))))){
_local3 = masterList[_arg1];
_local4 = (_local3.length - 1);
while (_local4 > -1) {
_local5 = _local3[_local4];
if (((_arg2) && (!(_local5.gc)))){
_local5.complete(false);
};
_local5.clear();
_local4--;
};
delete masterList[_arg1];
};
}
public static function updateAll(_arg1:Event=null):void{
var _local2:uint;
var _local3:Dictionary;
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
_local2 = (currentTime = getTimer());
_local3 = masterList;
for each (_local4 in _local3) {
_local5 = (_local4.length - 1);
while (_local5 > -1) {
_local6 = _local4[_local5];
if (_local6 == null){
} else {
if (_local6.active){
_local6.render(_local2);
} else {
if (_local6.gc){
_local4.splice(_local5, 1);
} else {
if (_local2 >= _local6.startTime){
_local6.activate();
_local6.render(_local2);
};
};
};
};
_local5--;
};
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:0}));
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function tintProxy(_arg1:Object, _arg2:Number=0):void{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
_local3 = _arg1.target.progress;
_local4 = (1 - _local3);
_local5 = _arg1.info.color;
_local6 = _arg1.info.endColor;
_arg1.info.target.transform.colorTransform = new ColorTransform(((_local5.redMultiplier * _local4) + (_local6.redMultiplier * _local3)), ((_local5.greenMultiplier * _local4) + (_local6.greenMultiplier * _local3)), ((_local5.blueMultiplier * _local4) + (_local6.blueMultiplier * _local3)), ((_local5.alphaMultiplier * _local4) + (_local6.alphaMultiplier * _local3)), ((_local5.redOffset * _local4) + (_local6.redOffset * _local3)), ((_local5.greenOffset * _local4) + (_local6.greenOffset * _local3)), ((_local5.blueOffset * _local4) + (_local6.blueOffset * _local3)), ((_local5.alphaOffset * _local4) + (_local6.alphaOffset * _local3)));
}
public static function volumeProxy(_arg1:Object, _arg2:Number=0):void{
_arg1.info.target.soundTransform = _arg1.target;
}
protected static function killGarbage(_arg1:TimerEvent):void{
var _local2:Dictionary;
var _local3:Object;
var _local4:Array;
_local2 = masterList;
for (_local3 in _local2) {
if (_local2[_local3].length == 0){
delete _local2[_local3];
};
};
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 4
//Camera3D (org.papervision3d.cameras.Camera3D)
package org.papervision3d.cameras {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import flash.utils.*;
import org.papervision3d.core.culling.*;
public class Camera3D extends CameraObject3D {
protected var _prevZoom:Number;
protected var _prevOrthoProjection:Boolean;
protected var _prevHeight:Number;
protected var _prevFocus:Number;
protected var _prevUseProjection:Boolean;
protected var _focusFix:Matrix3D;
protected var _prevOrtho:Boolean;
protected var _prevWidth:Number;
protected var _projection:Matrix3D;
public function Camera3D(_arg1:Number=60, _arg2:Number=10, _arg3:Number=5000, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg2, 40);
this.fov = _arg1;
_prevFocus = 0;
_prevZoom = 0;
_prevOrtho = false;
_prevUseProjection = false;
_useCulling = _arg4;
_useProjectionMatrix = _arg5;
_far = _arg3;
_focusFix = Matrix3D.IDENTITY;
}
override public function projectFaces(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
var _local4:Matrix3D;
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:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Vertex3D;
var _local25:Vertex3DInstance;
var _local26:Number;
var _local27:int;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Array;
var _local35:Number;
var _local36:Triangle3D;
_local4 = _arg2.view;
_local5 = _local4.n11;
_local6 = _local4.n12;
_local7 = _local4.n13;
_local8 = _local4.n21;
_local9 = _local4.n22;
_local10 = _local4.n23;
_local11 = _local4.n31;
_local12 = _local4.n32;
_local13 = _local4.n33;
_local14 = _local4.n41;
_local15 = _local4.n42;
_local16 = _local4.n43;
_local27 = 0;
_local28 = _arg3.camera.focus;
_local29 = (_local28 * _arg3.camera.zoom);
_local30 = (viewport.width / 2);
_local31 = (viewport.height / 2);
_local32 = _arg3.camera.far;
_local33 = (_local32 - _local28);
_local35 = getTimer();
for each (_local36 in _arg1) {
_local34 = _local36.vertices;
_local27 = _local34.length;
while ((_local24 = _local34[--_local27])) {
if (_local24.timestamp == _local35){
} else {
_local24.timestamp = _local35;
_local17 = _local24.x;
_local18 = _local24.y;
_local19 = _local24.z;
_local22 = ((((_local17 * _local11) + (_local18 * _local12)) + (_local19 * _local13)) + _local4.n34);
_local25 = _local24.vertex3DInstance;
if (_useProjectionMatrix){
_local23 = ((((_local17 * _local14) + (_local18 * _local15)) + (_local19 * _local16)) + _local4.n44);
_local22 = (_local22 / _local23);
if ((_local25.visible = (((_local22 > 0)) && ((_local22 < 1))))){
_local20 = (((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14) / _local23);
_local21 = (((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24) / _local23);
_local25.x = (_local20 * _local30);
_local25.y = (_local21 * _local31);
_local25.z = (_local22 * _local23);
};
} else {
if ((_local25.visible = ((_local28 + _local22) > 0))){
_local20 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14);
_local21 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24);
_local26 = (_local29 / (_local28 + _local22));
_local25.x = (_local20 * _local26);
_local25.y = (_local21 * _local26);
_local25.z = _local22;
};
};
};
};
};
return (0);
}
override public function set far(_arg1:Number):void{
if (_arg1 > this.focus){
_far = _arg1;
this.update(this.viewport);
};
}
override public function projectVertices(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
var _local4:Matrix3D;
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:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Vertex3D;
var _local25:Vertex3DInstance;
var _local26:Number;
var _local27:int;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
_local4 = _arg2.view;
_local5 = _local4.n11;
_local6 = _local4.n12;
_local7 = _local4.n13;
_local8 = _local4.n21;
_local9 = _local4.n22;
_local10 = _local4.n23;
_local11 = _local4.n31;
_local12 = _local4.n32;
_local13 = _local4.n33;
_local14 = _local4.n41;
_local15 = _local4.n42;
_local16 = _local4.n43;
_local27 = _arg1.length;
_local28 = _arg3.camera.focus;
_local29 = (_local28 * _arg3.camera.zoom);
_local30 = (viewport.width / 2);
_local31 = (viewport.height / 2);
_local32 = _arg3.camera.far;
_local33 = (_local32 - _local28);
while ((_local24 = _arg1[--_local27])) {
_local17 = _local24.x;
_local18 = _local24.y;
_local19 = _local24.z;
_local22 = ((((_local17 * _local11) + (_local18 * _local12)) + (_local19 * _local13)) + _local4.n34);
_local25 = _local24.vertex3DInstance;
if (_useProjectionMatrix){
_local23 = ((((_local17 * _local14) + (_local18 * _local15)) + (_local19 * _local16)) + _local4.n44);
_local22 = (_local22 / _local23);
if ((_local25.visible = (((_local22 > 0)) && ((_local22 < 1))))){
_local20 = (((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14) / _local23);
_local21 = (((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24) / _local23);
_local25.x = (_local20 * _local30);
_local25.y = (_local21 * _local31);
_local25.z = (_local22 * _local23);
};
} else {
if ((_local25.visible = ((_local28 + _local22) > 0))){
_local20 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14);
_local21 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24);
_local26 = (_local29 / (_local28 + _local22));
_local25.x = (_local20 * _local26);
_local25.y = (_local21 * _local26);
_local25.z = _local22;
};
};
};
return (0);
}
override public function transformView(_arg1:Matrix3D=null):void{
if (((((((((((!((ortho == _prevOrtho))) || (!((_prevUseProjection == _useProjectionMatrix))))) || (!((focus == _prevFocus))))) || (!((zoom == _prevZoom))))) || (!((viewport.width == _prevWidth))))) || (!((viewport.height == _prevHeight))))){
update(viewport);
};
if (_target){
lookAt(_target);
} else {
if (_transformDirty){
updateTransform();
};
};
if (_useProjectionMatrix){
super.transformView();
this.eye.calculateMultiply4x4(_projection, this.eye);
} else {
_focusFix.copy(this.transform);
_focusFix.n14 = (_focusFix.n14 + (focus * this.transform.n13));
_focusFix.n24 = (_focusFix.n24 + (focus * this.transform.n23));
_focusFix.n34 = (_focusFix.n34 + (focus * this.transform.n33));
super.transformView(_focusFix);
};
if ((culler is FrustumCuller)){
FrustumCuller(culler).transform.copy(this.transform);
};
}
override public function orbit(_arg1:Number, _arg2:Number, _arg3:Boolean=true, _arg4:DisplayObject3D=null):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_arg4 = ((_arg4) || (_target));
_arg4 = ((_arg4) || (DisplayObject3D.ZERO));
if (_arg3){
_arg1 = (_arg1 * (Math.PI / 180));
_arg2 = (_arg2 * (Math.PI / 180));
};
_local5 = (_arg4.world.n14 - this.x);
_local6 = (_arg4.world.n24 - this.y);
_local7 = (_arg4.world.n34 - this.z);
_local8 = Math.sqrt((((_local5 * _local5) + (_local6 * _local6)) + (_local7 * _local7)));
_local9 = (Math.cos(_arg2) * Math.sin(_arg1));
_local10 = (Math.sin(_arg2) * Math.sin(_arg1));
_local11 = Math.cos(_arg1);
this.x = (_arg4.world.n14 + (_local9 * _local8));
this.y = (_arg4.world.n24 + (_local11 * _local8));
this.z = (_arg4.world.n34 + (_local10 * _local8));
this.lookAt(_arg4);
}
override public function set near(_arg1:Number):void{
if (_arg1 > 0){
this.focus = _arg1;
this.update(this.viewport);
};
}
public function update(_arg1:Rectangle):void{
if (!_arg1){
throw (new Error(("Camera3D#update: Invalid viewport rectangle! " + _arg1)));
};
this.viewport = _arg1;
_prevFocus = this.focus;
_prevZoom = this.zoom;
_prevWidth = this.viewport.width;
_prevHeight = this.viewport.height;
if (_prevOrtho != this.ortho){
if (this.ortho){
_prevOrthoProjection = this.useProjectionMatrix;
this.useProjectionMatrix = true;
} else {
this.useProjectionMatrix = _prevOrthoProjection;
};
} else {
if (_prevUseProjection != _useProjectionMatrix){
this.useProjectionMatrix = this._useProjectionMatrix;
};
};
_prevOrtho = this.ortho;
_prevUseProjection = _useProjectionMatrix;
this.useCulling = _useCulling;
}
override public function set orthoScale(_arg1:Number):void{
super.orthoScale = _arg1;
this.useProjectionMatrix = this.useProjectionMatrix;
_prevOrtho = !(this.ortho);
this.update(this.viewport);
}
override public function set useProjectionMatrix(_arg1:Boolean):void{
var _local2:Number;
var _local3:Number;
if (_arg1){
if (this.ortho){
_local2 = (viewport.width / 2);
_local3 = (viewport.height / 2);
_projection = createOrthoMatrix(-(_local2), _local2, -(_local3), _local3, -(_far), _far);
_projection = Matrix3D.multiply(_orthoScaleMatrix, _projection);
} else {
_projection = createPerspectiveMatrix(fov, (viewport.width / viewport.height), this.focus, this.far);
};
} else {
if (this.ortho){
_arg1 = true;
};
};
super.useProjectionMatrix = _arg1;
}
override public function set useCulling(_arg1:Boolean):void{
super.useCulling = _arg1;
if (_useCulling){
if (!this.culler){
this.culler = new FrustumCuller();
};
FrustumCuller(this.culler).initialize(this.fov, (this.viewport.width / this.viewport.height), (this.focus / this.zoom), _far);
} else {
this.culler = null;
};
}
public static function createPerspectiveMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local5 = ((_arg1 / 2) * (Math.PI / 180));
_local6 = Math.tan(_local5);
_local7 = (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]));
}
public static function createOrthoMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Matrix3D{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Matrix3D;
_local7 = ((_arg2 + _arg1) / (_arg2 - _arg1));
_local8 = ((_arg4 + _arg3) / (_arg4 - _arg3));
_local9 = ((_arg6 + _arg5) / (_arg6 - _arg5));
_local10 = 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);
}
}
}//package org.papervision3d.cameras
Section 5
//Clipping (org.papervision3d.core.clipping.draw.Clipping)
package org.papervision3d.core.clipping.draw {
import flash.display.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
public class Clipping {
public var minX:Number;// = -1000000
private var zeroPoint:Point;
private var globalPoint:Point;
public var minY:Number;// = -1000000
private var rectangleClipping:RectangleClipping;
public var maxX:Number;// = 1000000
public var maxY:Number;// = 1000000
public function Clipping(){
zeroPoint = new Point(0, 0);
minX = -1000000;
minY = -1000000;
maxX = 1000000;
maxY = 1000000;
super();
}
public function check(_arg1:RenderableListItem):Boolean{
return (true);
}
public function rect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
return (true);
}
public function screen(_arg1:Sprite):Clipping{
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
switch (_arg1.stage.align){
case StageAlign.TOP_LEFT:
zeroPoint.x = 0;
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.TOP_RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM_LEFT:
zeroPoint.x = 0;
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM_RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.TOP:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.LEFT:
zeroPoint.x = 0;
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
break;
case StageAlign.RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
break;
default:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
};
return (rectangleClipping);
}
public function asRectangleClipping():RectangleClipping{
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
rectangleClipping.minX = -1000000;
rectangleClipping.minY = -1000000;
rectangleClipping.maxX = 1000000;
rectangleClipping.maxY = 1000000;
return (rectangleClipping);
}
}
}//package org.papervision3d.core.clipping.draw
Section 6
//RectangleClipping (org.papervision3d.core.clipping.draw.RectangleClipping)
package org.papervision3d.core.clipping.draw {
import org.papervision3d.core.render.command.*;
public class RectangleClipping extends Clipping {
public function RectangleClipping(_arg1:Number=-1000000, _arg2:Number=-1000000, _arg3:Number=1000000, _arg4:Number=1000000){
this.minX = _arg1;
this.maxX = _arg3;
this.minY = _arg2;
this.maxY = _arg4;
}
override public function rect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
if (this.maxX < _arg1){
return (false);
};
if (this.minX > _arg3){
return (false);
};
if (this.maxY < _arg2){
return (false);
};
if (this.minY > _arg4){
return (false);
};
return (true);
}
override public function check(_arg1:RenderableListItem):Boolean{
if (_arg1.maxX < minX){
return (false);
};
if (_arg1.minX > maxX){
return (false);
};
if (_arg1.maxY < minY){
return (false);
};
if (_arg1.minY > maxY){
return (false);
};
return (true);
}
public function toString():String{
return ((((((((("{minX:" + minX) + " maxX:") + maxX) + " minY:") + minY) + " maxY:") + maxY) + "}"));
}
override public function asRectangleClipping():RectangleClipping{
return (this);
}
}
}//package org.papervision3d.core.clipping.draw
Section 7
//DefaultClipping (org.papervision3d.core.clipping.DefaultClipping)
package org.papervision3d.core.clipping {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class DefaultClipping {
public function reset(_arg1:RenderSessionData):void{
}
public function testFace(_arg1:Triangle3D, _arg2:DisplayObject3D, _arg3:RenderSessionData):Boolean{
return (false);
}
public function clipFace(_arg1:Triangle3D, _arg2:DisplayObject3D, _arg3:MaterialObject3D, _arg4:RenderSessionData, _arg5:Array):Number{
return (0);
}
public function setDisplayObject(_arg1:DisplayObject3D, _arg2:RenderSessionData):void{
}
}
}//package org.papervision3d.core.clipping
Section 8
//DefaultLineCuller (org.papervision3d.core.culling.DefaultLineCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public class DefaultLineCuller implements ILineCuller {
public function testLine(_arg1:Line3D):Boolean{
return (((_arg1.v0.vertex3DInstance.visible) && (_arg1.v1.vertex3DInstance.visible)));
}
}
}//package org.papervision3d.core.culling
Section 9
//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 10
//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 {
protected static var y2:Number;
protected static var y1:Number;
protected static var y0:Number;
protected static var x0:Number;
protected static var x1:Number;
protected static var x2: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 11
//FrustumCuller (org.papervision3d.core.culling.FrustumCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
public class FrustumCuller implements IObjectCuller {
private var _tang:Number;
private var _ratio:Number;
private var _near:Number;
private var _fov:Number;
private var _far:Number;
private var _nh:Number;
private var _fh:Number;
public var transform:Matrix3D;
private var _sphereY:Number;
private var _nw:Number;
private var _sphereX:Number;
private var _fw:Number;
public static const OUTSIDE:int = -1;
public static const INSIDE:int = 1;
public static const INTERSECT:int = 0;
public function FrustumCuller(){
this.transform = Matrix3D.IDENTITY;
this.initialize();
}
public function get ratio():Number{
return (_ratio);
}
public function pointInFrustum(_arg1:Number, _arg2:Number, _arg3:Number):int{
var _local4:Matrix3D;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local4 = this.transform;
_local5 = (_arg1 - _local4.n14);
_local6 = (_arg2 - _local4.n24);
_local7 = (_arg3 - _local4.n34);
_local8 = (((_local5 * _local4.n13) + (_local6 * _local4.n23)) + (_local7 * _local4.n33));
if ((((_local8 > _far)) || ((_local8 < _near)))){
return (OUTSIDE);
};
_local9 = (((_local5 * _local4.n12) + (_local6 * _local4.n22)) + (_local7 * _local4.n32));
_local10 = (_local8 * _tang);
if ((((_local9 > _local10)) || ((_local9 < -(_local10))))){
return (OUTSIDE);
};
_local11 = (((_local5 * _local4.n11) + (_local6 * _local4.n21)) + (_local7 * _local4.n31));
_local10 = (_local10 * _ratio);
if ((((_local11 > _local10)) || ((_local11 < -(_local10))))){
return (OUTSIDE);
};
return (INSIDE);
}
public function initialize(_arg1:Number=60, _arg2:Number=1.333, _arg3:Number=1, _arg4:Number=5000):void{
var _local5:Number;
var _local6:Number;
_fov = _arg1;
_ratio = _arg2;
_near = _arg3;
_far = _arg4;
_local5 = (((Math.PI / 180) * _fov) * 0.5);
_tang = Math.tan(_local5);
_nh = (_near * _tang);
_nw = (_nh * _ratio);
_fh = (_far * _tang);
_fw = (_fh * _ratio);
_local6 = Math.atan((_tang * _ratio));
_sphereX = (1 / Math.cos(_local6));
_sphereY = (1 / Math.cos(_local5));
}
public function get fov():Number{
return (_fov);
}
public function set ratio(_arg1:Number):void{
this.initialize(_fov, _arg1, _near, _far);
}
public function get far():Number{
return (_far);
}
public function set fov(_arg1:Number):void{
this.initialize(_arg1, _ratio, _near, _far);
}
public function get near():Number{
return (_near);
}
public function set far(_arg1:Number):void{
this.initialize(_fov, _ratio, _near, _arg1);
}
public function set near(_arg1:Number):void{
this.initialize(_fov, _ratio, _arg1, _far);
}
public function sphereInFrustum(_arg1:DisplayObject3D, _arg2:BoundingSphere):int{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Matrix3D;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local3 = (_arg2.radius * Math.max(_arg1.scaleX, Math.max(_arg1.scaleY, _arg1.scaleZ)));
_local8 = INSIDE;
_local9 = this.transform;
_local10 = (_arg1.world.n14 - _local9.n14);
_local11 = (_arg1.world.n24 - _local9.n24);
_local12 = (_arg1.world.n34 - _local9.n34);
_local7 = (((_local10 * _local9.n13) + (_local11 * _local9.n23)) + (_local12 * _local9.n33));
if ((((_local7 > (_far + _local3))) || ((_local7 < (_near - _local3))))){
return (OUTSIDE);
};
if ((((_local7 > (_far - _local3))) || ((_local7 < (_near + _local3))))){
_local8 = INTERSECT;
};
_local6 = (((_local10 * _local9.n12) + (_local11 * _local9.n22)) + (_local12 * _local9.n32));
_local4 = (_sphereY * _local3);
_local7 = (_local7 * _tang);
if ((((_local6 > (_local7 + _local4))) || ((_local6 < (-(_local7) - _local4))))){
return (OUTSIDE);
};
if ((((_local6 > (_local7 - _local4))) || ((_local6 < (-(_local7) + _local4))))){
_local8 = INTERSECT;
};
_local5 = (((_local10 * _local9.n11) + (_local11 * _local9.n21)) + (_local12 * _local9.n31));
_local7 = (_local7 * _ratio);
_local4 = (_sphereX * _local3);
if ((((_local5 > (_local7 + _local4))) || ((_local5 < (-(_local7) - _local4))))){
return (OUTSIDE);
};
if ((((_local5 > (_local7 - _local4))) || ((_local5 < (-(_local7) + _local4))))){
_local8 = INTERSECT;
};
return (_local8);
}
public function testObject(_arg1:DisplayObject3D):int{
var _local2:int;
_local2 = INSIDE;
if (((((!(_arg1.geometry)) || (!(_arg1.geometry.vertices)))) || (!(_arg1.geometry.vertices.length)))){
return (_local2);
};
switch (_arg1.frustumTestMethod){
case FrustumTestMethod.BOUNDING_SPHERE:
_local2 = sphereInFrustum(_arg1, _arg1.geometry.boundingSphere);
break;
case FrustumTestMethod.BOUNDING_BOX:
_local2 = aabbInFrustum(_arg1, _arg1.geometry.aabb);
break;
case FrustumTestMethod.NO_TESTING:
break;
default:
break;
};
return (_local2);
}
public function aabbInFrustum(_arg1:DisplayObject3D, _arg2:AxisAlignedBoundingBox, _arg3:Boolean=true):int{
var _local4:Vertex3D;
var _local5:Number3D;
var _local6:int;
var _local7:int;
var _local8:Array;
_local6 = 0;
_local7 = 0;
_local8 = _arg2.getBoxVertices();
for each (_local4 in _local8) {
_local5 = _local4.toNumber3D();
Matrix3D.multiplyVector(_arg1.world, _local5);
if (pointInFrustum(_local5.x, _local5.y, _local5.z) == INSIDE){
_local6++;
if (_arg3){
return (INSIDE);
};
} else {
_local7++;
};
if (((_local6) && (_local7))){
return (INTERSECT);
};
};
if (_local6){
return (((_local6 < 8)) ? INTERSECT : INSIDE);
//unresolved jump
};
return (OUTSIDE);
}
}
}//package org.papervision3d.core.culling
Section 12
//FrustumTestMethod (org.papervision3d.core.culling.FrustumTestMethod)
package org.papervision3d.core.culling {
public class FrustumTestMethod {
public static const BOUNDING_BOX:int = 1;
public static const NO_TESTING:int = -1;
public static const BOUNDING_SPHERE:int = 0;
}
}//package org.papervision3d.core.culling
Section 13
//ILineCuller (org.papervision3d.core.culling.ILineCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface ILineCuller {
function testLine(_arg1:Line3D):Boolean;
}
}//package org.papervision3d.core.culling
Section 14
//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 15
//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 16
//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 17
//RectangleLineCuller (org.papervision3d.core.culling.RectangleLineCuller)
package org.papervision3d.core.culling {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.util.*;
public class RectangleLineCuller implements ILineCuller {
private var rectIntersection:Rectangle;
private var lineBoundsRect:Rectangle;
private var cullingRectangle:Rectangle;
public function RectangleLineCuller(_arg1:Rectangle=null):void{
if (_arg1){
this.cullingRectangle = _arg1;
};
lineBoundsRect = new Rectangle();
rectIntersection = new Rectangle();
}
public function testLine(_arg1:Line3D):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
if (((!(_arg1.v0.vertex3DInstance.visible)) || (!(_arg1.v1.vertex3DInstance.visible)))){
return (false);
};
_local2 = _arg1.v0.vertex3DInstance.x;
_local3 = _arg1.v0.vertex3DInstance.y;
_local4 = _arg1.v1.vertex3DInstance.x;
_local5 = _arg1.v1.vertex3DInstance.y;
lineBoundsRect.width = Math.abs((_local4 - _local2));
lineBoundsRect.height = Math.abs((_local5 - _local3));
if (_local2 < _local4){
lineBoundsRect.x = _local2;
} else {
lineBoundsRect.x = _local4;
};
if (_local3 < _local5){
lineBoundsRect.y = _local3;
} else {
lineBoundsRect.y = _local5;
};
if (cullingRectangle.containsRect(lineBoundsRect)){
return (true);
};
if (!FastRectangleTools.intersects(lineBoundsRect, cullingRectangle)){
return (false);
};
rectIntersection = FastRectangleTools.intersection(lineBoundsRect, cullingRectangle);
_local6 = ((_local5 - _local3) / (_local4 - _local2));
_local7 = (_local3 - (_local6 * _local2));
_local8 = ((cullingRectangle.top - _local7) / _local6);
if ((((_local8 > rectIntersection.left)) && ((_local8 < rectIntersection.right)))){
return (true);
};
_local8 = ((cullingRectangle.bottom - _local7) / _local6);
if ((((_local8 > rectIntersection.left)) && ((_local8 < rectIntersection.right)))){
return (true);
};
_local9 = ((_local6 * cullingRectangle.left) + _local7);
if ((((_local9 > rectIntersection.top)) && ((_local9 < rectIntersection.bottom)))){
return (true);
};
_local9 = ((_local6 * cullingRectangle.right) + _local7);
if ((((_local9 > rectIntersection.top)) && ((_local9 < rectIntersection.bottom)))){
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 18
//RectangleParticleCuller (org.papervision3d.core.culling.RectangleParticleCuller)
package org.papervision3d.core.culling {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.util.*;
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.material.invisible == false){
if (vInstance.visible){
if (FastRectangleTools.intersects(_arg1.renderRect, cullingRectangle)){
return (true);
};
};
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 19
//RectangleTriangleCuller (org.papervision3d.core.culling.RectangleTriangleCuller)
package org.papervision3d.core.culling {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.util.*;
public class RectangleTriangleCuller extends DefaultTriangleCuller implements ITriangleCuller {
public var cullingRectangle:Rectangle;
private static const DEFAULT_RECT_X:Number = -((DEFAULT_RECT_W / 2));
private static const DEFAULT_RECT_W:Number = 640;
private static const DEFAULT_RECT_H:Number = 480;
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 (FastRectangleTools.intersects(cullingRectangle, hitRect));
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 20
//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();
}
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);
}
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 destroy():void{
objects = null;
}
}
}//package org.papervision3d.core.culling
Section 21
//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 22
//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 23
//AbstractRenderable (org.papervision3d.core.geom.renderables.AbstractRenderable)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.data.*;
public class AbstractRenderable implements IRenderable {
public var _userData:UserData;
public var instance:DisplayObject3D;
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 24
//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 25
//Line3D (org.papervision3d.core.geom.renderables.Line3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.materials.special.*;
import org.papervision3d.core.geom.*;
public class Line3D extends AbstractRenderable implements IRenderable {
public var size:Number;
public var cV:Vertex3D;
public var renderCommand:RenderLine;
public var material:LineMaterial;
public var v0:Vertex3D;
public var v1:Vertex3D;
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.cV = _arg5;
this.instance = _arg1;
this.renderCommand = new RenderLine(this);
}
public function addControlVertex(_arg1:Number, _arg2:Number, _arg3:Number):void{
cV = new Vertex3D(_arg1, _arg2, _arg3);
if (instance.geometry.vertices.indexOf(cV) == -1){
instance.geometry.vertices.push(cV);
};
renderCommand.cV = cV.vertex3DInstance;
}
override public function getRenderListItem():IRenderListItem{
return (this.renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 26
//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.materials.special.*;
public class Particle extends AbstractRenderable implements IRenderable {
public var size:Number;
public var renderScale:Number;
public var vertex3D:Vertex3D;
public var renderRect:Rectangle;
public var renderCommand:RenderParticle;
public var material:ParticleMaterial;
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 get y():Number{
return (vertex3D.y);
}
public function updateRenderRect():void{
material.updateRenderRect(this);
}
public function set z(_arg1:Number):void{
vertex3D.z = _arg1;
}
public function set x(_arg1:Number):void{
vertex3D.x = _arg1;
}
public function set y(_arg1:Number):void{
vertex3D.y = _arg1;
}
public function get x():Number{
return (vertex3D.x);
}
public function get z():Number{
return (vertex3D.z);
}
override public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 27
//Triangle3D (org.papervision3d.core.geom.renderables.Triangle3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.special.*;
public class Triangle3D extends AbstractRenderable implements IRenderable {
public var vertices:Array;
public var v1:Vertex3D;
public var _uvArray:Array;
public var visible:Boolean;
public var id:Number;
public var material:MaterialObject3D;
public var renderCommand:RenderTriangle;
public var screenZ:Number;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var uv2:NumberUV;
public var faceNormal:Number3D;
public var _materialName:String;
public var v0:Vertex3D;
public var v2:Vertex3D;
private static var _totalFaces:Number = 0;
public function Triangle3D(_arg1:DisplayObject3D, _arg2:Array, _arg3:MaterialObject3D=null, _arg4:Array=null){
this.instance = _arg1;
faceNormal = new Number3D();
if (((_arg2) && ((_arg2.length == 3)))){
this.vertices = _arg2;
v0 = _arg2[0];
v1 = _arg2[1];
v2 = _arg2[2];
createNormal();
} else {
_arg2 = new Array();
v0 = (_arg2[0] = new Vertex3D());
v1 = (_arg2[1] = new Vertex3D());
v2 = (_arg2[2] = new Vertex3D());
};
this.material = _arg3;
this.uv = _arg4;
this.id = _totalFaces++;
this.renderCommand = new RenderTriangle(this);
}
public function createNormal():void{
var _local1:Number3D;
var _local2:Number3D;
var _local3:Number3D;
_local1 = v0.getPosition();
_local2 = v1.getPosition();
_local3 = v2.getPosition();
_local2.minusEq(_local1);
_local3.minusEq(_local1);
faceNormal = Number3D.cross(_local2, _local3, faceNormal);
faceNormal.normalize();
}
public function set uv(_arg1:Array):void{
if (((_arg1) && ((_arg1.length == 3)))){
uv0 = NumberUV(_arg1[0]);
uv1 = NumberUV(_arg1[1]);
uv2 = NumberUV(_arg1[2]);
};
_uvArray = _arg1;
}
public function reset(_arg1:DisplayObject3D, _arg2:Array, _arg3:MaterialObject3D, _arg4:Array):void{
var _local5:MaterialObject3D;
this.instance = _arg1;
this.renderCommand.instance = _arg1;
this.renderCommand.renderer = _arg3;
this.vertices = _arg2;
updateVertices();
this.material = _arg3;
this.uv = _arg4;
if ((_arg3 is BitmapMaterial)){
BitmapMaterial(_arg3).uvMatrices[this.renderCommand] = null;
};
if ((_arg3 is CompositeMaterial)){
for each (_local5 in CompositeMaterial(_arg3).materials) {
if ((_local5 is BitmapMaterial)){
BitmapMaterial(_local5).uvMatrices[this.renderCommand] = null;
};
};
};
}
public function get uv():Array{
return (_uvArray);
}
public function updateVertices():void{
v0 = vertices[0];
v1 = vertices[1];
v2 = vertices[2];
}
override public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 28
//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 container:Sprite;
public var faceNormal:Number3D;
public var screenZ:Number;
public var visible:Boolean;// = false
public var instance:DisplayObject3D;
public function Triangle3DInstance(_arg1:Triangle3D, _arg2:DisplayObject3D){
visible = false;
super();
this.instance = _arg2;
faceNormal = new Number3D();
}
}
}//package org.papervision3d.core.geom.renderables
Section 29
//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 {
private var persp:Number;// = 0
public var vertex3DInstance:Vertex3DInstance;
public var extra:Object;
public var timestamp:Number;
public var normal:Number3D;
protected var position:Number3D;
public var connectedFaces:Dictionary;
public var x:Number;
public var y:Number;
public var z:Number;
public function Vertex3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
persp = 0;
position = new Number3D();
super();
this.x = (position.x = _arg1);
this.y = (position.y = _arg2);
this.z = (position.z = _arg3);
this.vertex3DInstance = new Vertex3DInstance();
this.normal = new Number3D();
this.connectedFaces = new Dictionary();
}
public function perspective(_arg1:Number):Vertex3DInstance{
persp = (1 / (1 + (z / _arg1)));
return (new Vertex3DInstance((x * persp), (y * persp), z));
}
public function clone():Vertex3D{
var _local1:Vertex3D;
_local1 = new Vertex3D(x, y, z);
_local1.extra = extra;
_local1.vertex3DInstance = vertex3DInstance.clone();
_local1.normal = normal.clone();
return (_local1);
}
public function getPosition():Number3D{
position.x = x;
position.y = y;
position.z = z;
return (position);
}
public function toNumber3D():Number3D{
return (new Number3D(x, y, z));
}
public function calculateNormal():void{
var _local1:Triangle3D;
var _local2:Number;
var _local3:Number3D;
_local2 = 0;
normal.reset();
for each (_local1 in connectedFaces) {
if (_local1.faceNormal){
_local2++;
normal.plusEq(_local1.faceNormal);
};
};
_local3 = getPosition();
_local3.x = (_local3.x / _local2);
_local3.y = (_local3.y / _local2);
_local3.z = (_local3.z / _local2);
_local3.normalize();
normal.plusEq(_local3);
normal.normalize();
}
override public function getRenderListItem():IRenderListItem{
return (null);
}
public static function weighted(_arg1:Vertex3D, _arg2:Vertex3D, _arg3:Number, _arg4:Number):Vertex3D{
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local5 = (_arg3 + _arg4);
_local6 = (_arg3 / _local5);
_local7 = (_arg4 / _local5);
return (new Vertex3D(((_arg1.x * _local6) + (_arg2.x * _local7)), ((_arg1.y * _local6) + (_arg2.y * _local7)), ((_arg1.z * _local6) + (_arg2.z * _local7))));
}
}
}//package org.papervision3d.core.geom.renderables
Section 30
//Vertex3DInstance (org.papervision3d.core.geom.renderables.Vertex3DInstance)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.math.*;
public class Vertex3DInstance {
private var persp:Number;// = 0
public var visible:Boolean;
public var normal:Number3D;
public var extra:Object;
public var x:Number;
public var y:Number;
public var z:Number;
public function Vertex3DInstance(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
persp = 0;
super();
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.visible = false;
this.normal = new Number3D();
}
public function deperspective(_arg1:Number):Vertex3D{
persp = (1 + (z / _arg1));
return (new Vertex3D((x * persp), (y * persp), z));
}
public function distance(_arg1:Vertex3DInstance):Number{
return (Math.sqrt((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y)))));
}
public function clone():Vertex3DInstance{
var _local1:Vertex3DInstance;
_local1 = new Vertex3DInstance(x, y, z);
_local1.visible = visible;
_local1.extra = extra;
return (_local1);
}
public function distanceSqr(_arg1:Vertex3DInstance):Number{
return ((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y))));
}
public static function cross(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.y) - (_arg2.x * _arg1.y)));
}
public static function dot(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function subTo(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance):void{
_arg3.x = (_arg2.x - _arg1.x);
_arg3.y = (_arg2.y - _arg1.y);
}
public static function median(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Number):Vertex3DInstance{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = ((_arg1.z + _arg2.z) / 2);
_local5 = (_arg3 + _arg1.z);
_local6 = (_arg3 + _arg2.z);
_local7 = ((1 / (_arg3 + _local4)) / 2);
return (new Vertex3DInstance((((_arg1.x * _local5) + (_arg2.x * _local6)) * _local7), (((_arg1.y * _local5) + (_arg2.y * _local6)) * _local7), _local4));
}
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 31
//Lines3D (org.papervision3d.core.geom.Lines3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
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=null, _arg2:String=null){
super(null, _arg2);
if (!_arg1){
this.material = new LineMaterial();
} else {
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;
var _local5:RenderLine;
super.project(_arg1, _arg2);
for each (_local3 in lines) {
if (_arg2.viewPort.lineCuller.testLine(_local3)){
_local5 = _local3.renderCommand;
_local5.renderer = _local3.material;
_local5.size = _local3.size;
_local4 = (_local4 + (_local5.screenZ = ((_local3.v0.vertex3DInstance.z + _local3.v1.vertex3DInstance.z) / 2)));
_local5.v0 = _local3.v0.vertex3DInstance;
_local5.v1 = _local3.v1.vertex3DInstance;
_arg2.renderer.addToRenderList(_local5);
};
};
return ((_local4 / (lines.length + 1)));
}
public function addNewSegmentedLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):Array{
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Array;
var _local13:Line3D;
var _local14:Vertex3D;
var _local15:Vertex3D;
var _local16:Number;
_local9 = ((_arg6 - _arg3) / _arg2);
_local10 = ((_arg7 - _arg4) / _arg2);
_local11 = ((_arg8 - _arg5) / _arg2);
_local12 = new Array();
_local14 = new Vertex3D(_arg3, _arg4, _arg5);
_local16 = 0;
while (_local16 <= _arg2) {
_local15 = new Vertex3D((_arg3 + (_local9 * _local16)), (_arg4 + (_local10 * _local16)), (_arg5 + (_local11 * _local16)));
_local13 = new Line3D(this, (material as LineMaterial), _arg1, _local14, _local15);
addLine(_local13);
_local12.push(_local13);
_local14 = _local15;
_local16++;
};
return (_local12);
}
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);
};
if (_arg1.cV){
if (geometry.vertices.indexOf(_arg1.cV) == -1){
geometry.vertices.push(_arg1.cV);
};
};
}
public function removeAllLines():void{
while (lines.length > 0) {
removeLine(lines[0]);
};
}
public function removeLine(_arg1:Line3D):void{
var _local2:int;
_local2 = lines.indexOf(_arg1);
if (_local2 > -1){
lines.splice(_local2, 1);
} else {
PaperLogger.warning("Papervision3D Lines3D.removeLine : WARNING removal of non-existant line attempted. ");
};
}
public function addNewLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Line3D{
var _local8:Line3D;
_local8 = new Line3D(this, (material as LineMaterial), _arg1, new Vertex3D(_arg2, _arg3, _arg4), new Vertex3D(_arg5, _arg6, _arg7));
addLine(_local8);
return (_local8);
}
}
}//package org.papervision3d.core.geom
Section 32
//TriangleMesh3D (org.papervision3d.core.geom.TriangleMesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import flash.utils.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMesh3D extends Vertices3D {
private var _dtStore:Array;
private var _dtActive:Array;
private var _tri:RenderTriangle;
public function TriangleMesh3D(_arg1:MaterialObject3D, _arg2:Array, _arg3:Array, _arg4:String=null){
_dtStore = new Array();
_dtActive = new Array();
super(_arg2, _arg4);
this.geometry.faces = ((_arg3) || (new Array()));
this.material = ((_arg1) || (MaterialObject3D.DEFAULT));
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local3:int;
var _local4:Array;
var _local5:Triangle3D;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:ITriangleCuller;
var _local10:Vertex3DInstance;
var _local11:Vertex3DInstance;
var _local12:Vertex3DInstance;
var _local13:Triangle3DInstance;
var _local14:Triangle3D;
var _local15:MaterialObject3D;
var _local16:RenderTriangle;
_dtStore = [];
_dtActive = new Array();
_local3 = this.geometry.vertices.length;
_local4 = [];
if (((((((_arg2.clipping) && (this.useClipping))) && (!(this.culled)))) && ((_arg2.camera.useCulling) ? (cullTest == 0) : true))){
super.projectEmpty(_arg1, _arg2);
_arg2.clipping.setDisplayObject(this, _arg2);
for each (_local5 in this.geometry.faces) {
if (_arg2.clipping.testFace(_local5, this, _arg2)){
_arg2.clipping.clipFace(_local5, this, _local15, _arg2, _local4);
} else {
_local4.push(_local5);
};
};
super.project(_arg1, _arg2);
_arg2.camera.projectFaces(_local4, this, _arg2);
} else {
super.project(_arg1, _arg2);
_local4 = this.geometry.faces;
};
if (!this.culled){
_local6 = this.geometry.faces;
_local7 = 0;
_local8 = 0;
_local9 = _arg2.triangleCuller;
for each (_local14 in _local4) {
_local15 = (_local14.material) ? _local14.material : material;
_local10 = _local14.v0.vertex3DInstance;
_local11 = _local14.v1.vertex3DInstance;
_local12 = _local14.v2.vertex3DInstance;
if (_local9.testFace(_local14, _local10, _local11, _local12)){
_local16 = _local14.renderCommand;
_local7 = (_local7 + (_local16.screenZ = setScreenZ(meshSort, _local10, _local11, _local12)));
_local8++;
_local16.renderer = (_local15 as ITriangleDrawer);
_local16.v0 = _local10;
_local16.v1 = _local11;
_local16.v2 = _local12;
_local16.uv0 = _local14.uv0;
_local16.uv1 = _local14.uv1;
_local16.uv2 = _local14.uv2;
if (_arg2.quadrantTree){
if (_local16.create == null){
_local16.create = createRenderTriangle;
};
_local16.update();
if ((((_local16.area < 0)) && (((_local14.material.doubleSided) || (((_local14.material.oneSide) && (_local14.material.opposite))))))){
_local16.area = -(_local16.area);
};
};
_arg2.renderer.addToRenderList(_local16);
} else {
_arg2.renderStatistics.culledTriangles++;
};
};
if (_local3){
while (this.geometry.vertices.length > _local3) {
this.geometry.vertices.pop();
};
};
return ((this.screenZ = (_local7 / _local8)));
} else {
_arg2.renderStatistics.culledObjects++;
};
return (0);
}
override public function set material(_arg1:MaterialObject3D):void{
var _local2:Triangle3D;
super.material = _arg1;
for each (_local2 in geometry.faces) {
_local2.material = _arg1;
};
}
public function mergeVertices():void{
var _local1:Dictionary;
var _local2:Array;
var _local3:Vertex3D;
var _local4:Triangle3D;
var _local5:Vertex3D;
_local1 = new Dictionary();
_local2 = 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 = (_local4.vertices[0] = _local1[_local4.v0]);
_local4.v1 = (_local4.vertices[1] = _local1[_local4.v1]);
_local4.v2 = (_local4.vertices[2] = _local1[_local4.v2]);
};
}
public function quarterFaces():void{
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Triangle3D;
var _local5:int;
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;
_local1 = new Array();
_local2 = new Array();
_local3 = this.geometry.faces;
_local5 = _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;
}
override public function clone():DisplayObject3D{
var _local1:DisplayObject3D;
var _local2:TriangleMesh3D;
_local1 = super.clone();
_local2 = new TriangleMesh3D(this.material, [], [], _local1.name);
if (this.materials){
_local2.materials = this.materials.clone();
};
if (_local1.geometry){
_local2.geometry = _local1.geometry.clone(_local2);
};
_local2.copyTransform(this.transform);
return (_local2);
}
protected function setScreenZ(_arg1:uint, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Number{
switch (_arg1){
case DisplayObject3D.MESH_SORT_CENTER:
return ((((_arg2.z + _arg3.z) + _arg4.z) / 3));
case DisplayObject3D.MESH_SORT_FAR:
return (Math.max(_arg2.z, _arg3.z, _arg4.z));
case DisplayObject3D.MESH_SORT_CLOSE:
return (Math.min(_arg2.z, _arg3.z, _arg4.z));
};
return (0);
}
public function projectTexture(_arg1:String="x", _arg2:String="y"):void{
var _local3:Array;
var _local4:Object;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:MaterialObject3D;
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;
_local3 = this.geometry.faces;
_local4 = this.boundingBox();
_local5 = _local4.min[_arg1];
_local6 = _local4.size[_arg1];
_local7 = _local4.min[_arg2];
_local8 = _local4.size[_arg2];
_local9 = 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 createRenderTriangle(_arg1:Triangle3D, _arg2:MaterialObject3D, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance, _arg5:Vertex3DInstance, _arg6:NumberUV, _arg7:NumberUV, _arg8:NumberUV):RenderTriangle{
if (_dtStore.length){
_dtActive.push((_tri = _dtStore.pop()));
} else {
_dtActive.push((_tri = new RenderTriangle(_arg1)));
};
_tri.instance = this;
_tri.triangle = _arg1;
_tri.renderableInstance = _arg1;
_tri.renderer = _arg2;
_tri.create = createRenderTriangle;
_tri.v0 = _arg3;
_tri.v1 = _arg4;
_tri.v2 = _arg5;
_tri.uv0 = _arg6;
_tri.uv1 = _arg7;
_tri.uv2 = _arg8;
_tri.update();
return (_tri);
}
}
}//package org.papervision3d.core.geom
Section 33
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.culling.*;
public class Vertices3D extends DisplayObject3D {
public function Vertices3D(_arg1:Array, _arg2:String=null){
super(_arg2, new GeometryObject3D());
this.geometry.vertices = ((_arg1) || (new Array()));
}
public function projectFrustum(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
return (0);
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
super.project(_arg1, _arg2);
if (this.culled){
return (0);
};
if ((_arg2.camera is IObjectCuller)){
return (projectFrustum(_arg1, _arg2));
};
if (((!(this.geometry)) || (!(this.geometry.vertices)))){
return (0);
};
return (_arg2.camera.projectVertices(this.geometry.vertices, this, _arg2));
}
override public function clone():DisplayObject3D{
var _local1:DisplayObject3D;
var _local2:Vertices3D;
_local1 = super.clone();
_local2 = new Vertices3D(null, _local1.name);
_local2.material = _local1.material;
if (_local1.materials){
_local2.materials = _local1.materials.clone();
};
if (this.geometry){
_local2.geometry = this.geometry.clone(_local2);
};
_local2.copyTransform(this.transform);
return (_local2);
}
public function transformVertices(_arg1:Matrix3D):void{
geometry.transformVertices(_arg1);
}
public function boundingBox():Object{
var _local1:Array;
var _local2:Object;
var _local3:Vertex3D;
_local1 = this.geometry.vertices;
_local2 = new Object();
_local2.min = new Number3D(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
_local2.max = new Number3D(-(Number.MAX_VALUE), -(Number.MAX_VALUE), -(Number.MAX_VALUE));
_local2.size = new Number3D();
for each (_local3 in _local1) {
_local2.min.x = Math.min(_local3.x, _local2.min.x);
_local2.min.y = Math.min(_local3.y, _local2.min.y);
_local2.min.z = Math.min(_local3.z, _local2.min.z);
_local2.max.x = Math.max(_local3.x, _local2.max.x);
_local2.max.y = Math.max(_local3.y, _local2.max.y);
_local2.max.z = Math.max(_local3.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 projectEmpty(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
return (super.project(_arg1, _arg2));
}
}
}//package org.papervision3d.core.geom
Section 34
//PaperLoggerEvent (org.papervision3d.core.log.event.PaperLoggerEvent)
package org.papervision3d.core.log.event {
import flash.events.*;
import org.papervision3d.core.log.*;
public class PaperLoggerEvent extends Event {
public var paperLogVO:PaperLogVO;
public static const TYPE_LOGEVENT:String = "logEvent";
public function PaperLoggerEvent(_arg1:PaperLogVO){
super(TYPE_LOGEVENT);
this.paperLogVO = _arg1;
}
}
}//package org.papervision3d.core.log.event
Section 35
//AbstractPaperLogger (org.papervision3d.core.log.AbstractPaperLogger)
package org.papervision3d.core.log {
import org.papervision3d.core.log.event.*;
public class AbstractPaperLogger implements IPaperLogger {
public function registerWithPaperLogger(_arg1:PaperLogger):void{
_arg1.addEventListener(PaperLoggerEvent.TYPE_LOGEVENT, onLogEvent);
}
public function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function fatal(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
protected function onLogEvent(_arg1:PaperLoggerEvent):void{
var _local2:PaperLogVO;
_local2 = _arg1.paperLogVO;
switch (_local2.level){
case LogLevel.LOG:
log(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.INFO:
info(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.ERROR:
error(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.DEBUG:
debug(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.WARNING:
warning(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.FATAL:
fatal(_local2.msg, _local2.object, _local2.arg);
break;
default:
log(_local2.msg, _local2.object, _local2.arg);
break;
};
}
public function unregisterFromPaperLogger(_arg1:PaperLogger):void{
_arg1.removeEventListener(PaperLoggerEvent.TYPE_LOGEVENT, onLogEvent);
}
public function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
}
}//package org.papervision3d.core.log
Section 36
//IPaperLogger (org.papervision3d.core.log.IPaperLogger)
package org.papervision3d.core.log {
public interface IPaperLogger {
function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function fatal(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
}
}//package org.papervision3d.core.log
Section 37
//LogLevel (org.papervision3d.core.log.LogLevel)
package org.papervision3d.core.log {
public class LogLevel {
public static const FATAL:int = 5;
public static const ERROR:int = 4;
public static const LOG:int = 0;
public static const INFO:int = 1;
public static const DEBUG:int = 2;
public static const WARNING:int = 3;
}
}//package org.papervision3d.core.log
Section 38
//PaperLogger (org.papervision3d.core.log.PaperLogger)
package org.papervision3d.core.log {
import flash.events.*;
import org.papervision3d.core.log.event.*;
public class PaperLogger extends EventDispatcher {
public var traceLogger:PaperTraceLogger;
private static var instance:PaperLogger;
public function PaperLogger(){
if (instance){
throw (new Error("Don't call the PaperLogger constructor directly"));
};
traceLogger = new PaperTraceLogger();
registerLogger(traceLogger);
}
public function registerLogger(_arg1:AbstractPaperLogger):void{
_arg1.registerWithPaperLogger(this);
}
public function _debug(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO;
var _local5:PaperLoggerEvent;
_local4 = new PaperLogVO(LogLevel.DEBUG, _arg1, _arg2, _args);
_local5 = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function _warning(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO;
var _local5:PaperLoggerEvent;
_local4 = new PaperLogVO(LogLevel.WARNING, _arg1, _arg2, _args);
_local5 = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function _error(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO;
var _local5:PaperLoggerEvent;
_local4 = new PaperLogVO(LogLevel.ERROR, _arg1, _arg2, _args);
_local5 = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function unregisterLogger(_arg1:AbstractPaperLogger):void{
_arg1.unregisterFromPaperLogger(this);
}
public function _info(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO;
var _local5:PaperLoggerEvent;
_local4 = new PaperLogVO(LogLevel.INFO, _arg1, _arg2, _args);
_local5 = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function _log(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO;
var _local5:PaperLoggerEvent;
_local4 = new PaperLogVO(LogLevel.LOG, _arg1, _arg2, _args);
_local5 = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public static function debug(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._debug(_arg1);
}
public static function log(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._log(_arg1);
}
public static function error(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._error(_arg1);
}
public static function getInstance():PaperLogger{
if (!instance){
instance = new (PaperLogger);
};
return (instance);
}
public static function warning(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._warning(_arg1);
}
public static function info(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._info(_arg1);
}
}
}//package org.papervision3d.core.log
Section 39
//PaperLogVO (org.papervision3d.core.log.PaperLogVO)
package org.papervision3d.core.log {
public class PaperLogVO {
public var msg:String;
public var level:int;
public var arg:Array;
public var object:Object;
public function PaperLogVO(_arg1:int, _arg2:String, _arg3:Object, _arg4:Array){
this.level = _arg1;
this.msg = _arg2;
this.object = _arg3;
this.arg = _arg4;
}
}
}//package org.papervision3d.core.log
Section 40
//PaperTraceLogger (org.papervision3d.core.log.PaperTraceLogger)
package org.papervision3d.core.log {
public class PaperTraceLogger extends AbstractPaperLogger implements IPaperLogger {
override public function fatal(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("FATAL:", _arg1, _arg3);
}
override public function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("ERROR:", _arg1, _arg3);
}
override public function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("DEBUG:", _arg1, _arg3);
}
override public function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("WARNING:", _arg1, _arg3);
}
override public function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("LOG:", _arg1, _arg3);
}
override public function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("INFO:", _arg1, _arg3);
}
}
}//package org.papervision3d.core.log
Section 41
//AbstractLightShadeMaterial (org.papervision3d.core.material.AbstractLightShadeMaterial)
package org.papervision3d.core.material {
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.material.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
public class AbstractLightShadeMaterial extends TriangleMaterial implements ITriangleDrawer, IUpdateBeforeMaterial {
public var lightMatrices:Dictionary;
private var _light:LightObject3D;
protected static var lightMatrix:Matrix3D;
public function AbstractLightShadeMaterial(){
init();
}
public function get light():LightObject3D{
return (_light);
}
protected function init():void{
lightMatrices = new Dictionary();
}
public function set light(_arg1:LightObject3D):void{
_light = _arg1;
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:Object;
var _local3:DisplayObject3D;
for (_local2 in objects) {
_local3 = (_local2 as DisplayObject3D);
lightMatrices[_local2] = LightMatrix.getLightMatrix(light, _local3, _arg1, lightMatrices[_local2]);
};
}
}
}//package org.papervision3d.core.material
Section 42
//TriangleMaterial (org.papervision3d.core.material.TriangleMaterial)
package org.papervision3d.core.material {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMaterial extends MaterialObject3D implements ITriangleDrawer {
override public function drawRT(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData):void{
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
}
}
}//package org.papervision3d.core.material
Section 43
//FastRectangleTools (org.papervision3d.core.math.util.FastRectangleTools)
package org.papervision3d.core.math.util {
import flash.geom.*;
public class FastRectangleTools {
public static function intersection(_arg1:Rectangle, _arg2:Rectangle, _arg3:Rectangle=null):Rectangle{
if (!_arg3){
_arg3 = new Rectangle();
};
if (!intersects(_arg1, _arg2)){
_arg3.x = (_arg3.y = (_arg3.width = (_arg3.height = 0)));
return (_arg3);
};
_arg3.left = ((_arg1.left)>_arg2.left) ? _arg1.left : _arg2.left;
_arg3.right = ((_arg1.right)<_arg2.right) ? _arg1.right : _arg2.right;
_arg3.top = ((_arg1.top)>_arg2.top) ? _arg1.top : _arg2.top;
_arg3.bottom = ((_arg1.bottom)<_arg2.bottom) ? _arg1.bottom : _arg2.bottom;
return (_arg3);
}
public static function intersects(_arg1:Rectangle, _arg2:Rectangle):Boolean{
if (!(((_arg1.right < _arg2.left)) || ((_arg1.left > _arg2.right)))){
if (!(((_arg1.bottom < _arg2.top)) || ((_arg1.top > _arg2.bottom)))){
return (true);
};
};
return (false);
}
}
}//package org.papervision3d.core.math.util
Section 44
//AxisAlignedBoundingBox (org.papervision3d.core.math.AxisAlignedBoundingBox)
package org.papervision3d.core.math {
import org.papervision3d.core.geom.renderables.*;
public class AxisAlignedBoundingBox {
public var minX:Number;
public var minY:Number;
public var minZ:Number;
public var maxX:Number;
public var maxY:Number;
protected var _vertices:Array;
public var maxZ:Number;
public function AxisAlignedBoundingBox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
this.minX = _arg1;
this.minY = _arg2;
this.minZ = _arg3;
this.maxX = _arg4;
this.maxY = _arg5;
this.maxZ = _arg6;
createBoxVertices();
}
protected function createBoxVertices():void{
_vertices = new Array();
_vertices.push(new Vertex3D(minX, minY, minZ));
_vertices.push(new Vertex3D(minX, minY, maxZ));
_vertices.push(new Vertex3D(minX, maxY, minZ));
_vertices.push(new Vertex3D(minX, maxY, maxZ));
_vertices.push(new Vertex3D(maxX, minY, minZ));
_vertices.push(new Vertex3D(maxX, minY, maxZ));
_vertices.push(new Vertex3D(maxX, maxY, minZ));
_vertices.push(new Vertex3D(maxX, maxY, maxZ));
}
public function getBoxVertices():Array{
return (_vertices);
}
public function merge(_arg1:AxisAlignedBoundingBox):void{
this.minX = Math.min(this.minX, _arg1.minX);
this.minY = Math.min(this.minY, _arg1.minY);
this.minZ = Math.min(this.minZ, _arg1.minZ);
this.maxX = Math.max(this.maxX, _arg1.maxX);
this.maxY = Math.max(this.maxY, _arg1.maxY);
this.maxZ = Math.max(this.maxZ, _arg1.maxZ);
createBoxVertices();
}
public static function createFromVertices(_arg1:Array):AxisAlignedBoundingBox{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Vertex3D;
_local2 = Number.MAX_VALUE;
_local3 = Number.MAX_VALUE;
_local4 = Number.MAX_VALUE;
_local5 = -(_local2);
_local6 = -(_local3);
_local7 = -(_local4);
for each (_local8 in _arg1) {
_local2 = Math.min(_local2, _local8.x);
_local3 = Math.min(_local3, _local8.y);
_local4 = Math.min(_local4, _local8.z);
_local5 = Math.max(_local5, _local8.x);
_local6 = Math.max(_local6, _local8.y);
_local7 = Math.max(_local7, _local8.z);
};
return (new AxisAlignedBoundingBox(_local2, _local3, _local4, _local5, _local6, _local7));
}
}
}//package org.papervision3d.core.math
Section 45
//BoundingSphere (org.papervision3d.core.math.BoundingSphere)
package org.papervision3d.core.math {
import org.papervision3d.core.geom.renderables.*;
public class BoundingSphere {
public var maxDistance:Number;
public var radius:Number;
public function BoundingSphere(_arg1:Number){
this.maxDistance = _arg1;
this.radius = Math.sqrt(_arg1);
}
public static function getFromVertices(_arg1:Array):BoundingSphere{
var _local2:Number;
var _local3:Number;
var _local4:Vertex3D;
_local2 = 0;
for each (_local4 in _arg1) {
_local3 = (((_local4.x * _local4.x) + (_local4.y * _local4.y)) + (_local4.z * _local4.z));
_local2 = ((_local3)>_local2) ? _local3 : _local2;
};
return (new BoundingSphere(_local2));
}
}
}//package org.papervision3d.core.math
Section 46
//Matrix3D (org.papervision3d.core.math.Matrix3D)
package org.papervision3d.core.math {
import org.papervision3d.*;
public class Matrix3D {
public var n31:Number;
public var n32:Number;
public var n11:Number;
public var n13:Number;
public var n14:Number;
public var n33:Number;
public var n12:Number;
public var n42:Number;
public var n21:Number;
public var n22:Number;
public var n23:Number;
public var n24:Number;
public var n34:Number;
public var n41:Number;
public var n43:Number;
public var n44:Number;
private static var _cos:Function = Math.cos;
private static var _sin:Function = Math.sin;
private static var temp:Matrix3D = Matrix3D.IDENTITY;
private static var n3Di:Number3D = Number3D.ZERO;
private static var n3Dj:Number3D = Number3D.ZERO;
private static var n3Dk:Number3D = Number3D.ZERO;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
public function Matrix3D(_arg1:Array=null){
reset(_arg1);
}
public function calculateSkewSymmetric(_arg1:Number3D):void{
this.n11 = 0;
this.n12 = -(_arg1.z);
this.n13 = _arg1.y;
this.n21 = _arg1.z;
this.n22 = 0;
this.n23 = -(_arg1.x);
this.n31 = -(_arg1.y);
this.n32 = _arg1.x;
this.n33 = 0;
}
public function calculateMultiply3x3(_arg1:Matrix3D, _arg2: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 _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n12;
_local10 = _arg2.n12;
_local11 = _arg1.n22;
_local12 = _arg2.n22;
_local13 = _arg1.n32;
_local14 = _arg2.n32;
_local15 = _arg1.n13;
_local16 = _arg2.n13;
_local17 = _arg1.n23;
_local18 = _arg2.n23;
_local19 = _arg1.n33;
_local20 = _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;
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:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n41;
_local10 = _arg2.n41;
_local11 = _arg1.n12;
_local12 = _arg2.n12;
_local13 = _arg1.n22;
_local14 = _arg2.n22;
_local15 = _arg1.n32;
_local16 = _arg2.n32;
_local17 = _arg1.n42;
_local18 = _arg2.n42;
_local19 = _arg1.n13;
_local20 = _arg2.n13;
_local21 = _arg1.n23;
_local22 = _arg2.n23;
_local23 = _arg1.n33;
_local24 = _arg2.n33;
_local25 = _arg1.n43;
_local26 = _arg2.n43;
_local27 = _arg1.n14;
_local28 = _arg2.n14;
_local29 = _arg1.n24;
_local30 = _arg2.n24;
_local31 = _arg1.n34;
_local32 = _arg2.n34;
_local33 = _arg1.n44;
_local34 = _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 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 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 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 calculateMultiply(_arg1:Matrix3D, _arg2: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 _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n12;
_local10 = _arg2.n12;
_local11 = _arg1.n22;
_local12 = _arg2.n22;
_local13 = _arg1.n32;
_local14 = _arg2.n32;
_local15 = _arg1.n13;
_local16 = _arg2.n13;
_local17 = _arg1.n23;
_local18 = _arg2.n23;
_local19 = _arg1.n33;
_local20 = _arg2.n33;
_local21 = _arg1.n14;
_local22 = _arg2.n14;
_local23 = _arg1.n24;
_local24 = _arg2.n24;
_local25 = _arg1.n34;
_local26 = _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 invert():void{
temp.copy(this);
calculateInverse(temp);
}
public function calculateInverse(_arg1:Matrix3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = _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 calculateTranspose():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local1 = this.n11;
_local2 = this.n21;
_local3 = this.n31;
_local4 = this.n41;
_local5 = this.n12;
_local6 = this.n22;
_local7 = this.n32;
_local8 = this.n42;
_local9 = this.n13;
_local10 = this.n23;
_local11 = this.n33;
_local12 = this.n43;
_local13 = this.n14;
_local14 = this.n24;
_local15 = this.n34;
_local16 = this.n44;
this.n11 = _local1;
this.n12 = _local2;
this.n13 = _local3;
this.n14 = _local4;
this.n21 = _local5;
this.n22 = _local6;
this.n23 = _local7;
this.n24 = _local8;
this.n31 = _local9;
this.n32 = _local10;
this.n33 = _local11;
this.n34 = _local12;
this.n41 = _local13;
this.n42 = _local14;
this.n43 = _local15;
this.n44 = _local16;
}
public function toString():String{
var _local1:String;
_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 reset(_arg1:Array=null):void{
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];
} else {
n41 = (n42 = (n43 = 0));
n44 = 1;
};
};
}
public static function rotationMatrixWithReference(_arg1:Number3D, _arg2:Number, _arg3:Number3D):Matrix3D{
var _local4:Matrix3D;
_local4 = 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 multiplyVector(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _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 multiplyVector4x4(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_local6 = (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 multiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateMultiply3x3(_arg1, _arg2);
return (_local3);
}
public static function normalizeQuaternion(_arg1:Object):Object{
var _local2:Number;
_local2 = 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 multiplyVector3x3(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _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 axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Object{
var _local5:Number;
var _local6:Number;
var _local7:Object;
_local5 = Math.sin((_arg4 / 2));
_local6 = Math.cos((_arg4 / 2));
_local7 = new Object();
_local7.x = (_arg1 * _local5);
_local7.y = (_arg2 * _local5);
_local7.z = (_arg3 * _local5);
_local7.w = _local6;
return (normalizeQuaternion(_local7));
}
public static function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D;
_local4 = IDENTITY;
_local4.n14 = _arg1;
_local4.n24 = _arg2;
_local4.n34 = _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 rotationX(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = 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;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = 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;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n12 = -(_local4);
_local2.n21 = _local4;
_local2.n22 = _local3;
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 rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Matrix3D=null):Matrix3D{
var _local6:Matrix3D;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (!_arg5){
_local6 = IDENTITY;
} else {
_local6 = _arg5;
};
_local7 = Math.cos(_arg4);
_local8 = Math.sin(_arg4);
_local9 = (1 - _local7);
_local10 = ((_arg1 * _arg2) * _local9);
_local11 = ((_arg2 * _arg3) * _local9);
_local12 = ((_arg1 * _arg3) * _local9);
_local13 = (_local8 * _arg3);
_local14 = (_local8 * _arg2);
_local15 = (_local8 * _arg1);
_local6.n11 = (_local7 + ((_arg1 * _arg1) * _local9));
_local6.n12 = (-(_local13) + _local10);
_local6.n13 = (_local14 + _local12);
_local6.n14 = 0;
_local6.n21 = (_local13 + _local10);
_local6.n22 = (_local7 + ((_arg2 * _arg2) * _local9));
_local6.n23 = (-(_local15) + _local11);
_local6.n24 = 0;
_local6.n31 = (-(_local14) + _local12);
_local6.n32 = (_local15 + _local11);
_local6.n33 = (_local7 + ((_arg3 * _arg3) * _local9));
_local6.n34 = 0;
return (_local6);
}
public static function add(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateAdd(_arg1, _arg2);
return (_local3);
}
public static function multiply(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateMultiply(_arg1, _arg2);
return (_local3);
}
public static function euler2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Quaternion=null):Quaternion{
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:Quaternion;
_local5 = Math.sin((_arg1 * 0.5));
_local6 = Math.cos((_arg1 * 0.5));
_local7 = Math.sin((_arg2 * 0.5));
_local8 = Math.cos((_arg2 * 0.5));
_local9 = Math.sin((_arg3 * 0.5));
_local10 = Math.cos((_arg3 * 0.5));
_local11 = (_local6 * _local8);
_local12 = (_local5 * _local7);
if (!_arg4){
_local13 = new Quaternion();
} else {
_local13 = _arg4;
};
_local13.x = ((_local9 * _local11) - (_local10 * _local12));
_local13.y = (((_local10 * _local5) * _local8) + ((_local9 * _local6) * _local7));
_local13.z = (((_local10 * _local6) * _local7) - ((_local9 * _local5) * _local8));
_local13.w = ((_local10 * _local11) + (_local9 * _local12));
return (_local13);
}
public static function quaternion2matrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Matrix3D=null):Matrix3D{
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:Matrix3D;
_local6 = (_arg1 * _arg1);
_local7 = (_arg1 * _arg2);
_local8 = (_arg1 * _arg3);
_local9 = (_arg1 * _arg4);
_local10 = (_arg2 * _arg2);
_local11 = (_arg2 * _arg3);
_local12 = (_arg2 * _arg4);
_local13 = (_arg3 * _arg3);
_local14 = (_arg3 * _arg4);
if (!_arg5){
_local15 = IDENTITY;
} else {
_local15 = _arg5;
};
_local15.n11 = (1 - (2 * (_local10 + _local13)));
_local15.n12 = (2 * (_local7 - _local14));
_local15.n13 = (2 * (_local8 + _local12));
_local15.n21 = (2 * (_local7 + _local14));
_local15.n22 = (1 - (2 * (_local6 + _local13)));
_local15.n23 = (2 * (_local11 - _local9));
_local15.n31 = (2 * (_local8 - _local12));
_local15.n32 = (2 * (_local11 + _local9));
_local15.n33 = (1 - (2 * (_local6 + _local10)));
return (_local15);
}
public static function inverse(_arg1:Matrix3D):Matrix3D{
var _local2:Matrix3D;
_local2 = new (Matrix3D);
_local2.calculateInverse(_arg1);
return (_local2);
}
public static function euler2matrix(_arg1:Number3D):Matrix3D{
var _local2:Matrix3D;
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;
temp.reset();
_local2 = temp;
_local2 = temp;
_local3 = (_arg1.x * toRADIANS);
_local4 = (_arg1.y * toRADIANS);
_local5 = (_arg1.z * toRADIANS);
_local6 = Math.cos(_local3);
_local7 = Math.sin(_local3);
_local8 = Math.cos(_local4);
_local9 = Math.sin(_local4);
_local10 = Math.cos(_local5);
_local11 = Math.sin(_local5);
_local12 = (_local6 * _local9);
_local13 = (_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 scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D;
_local4 = IDENTITY;
_local4.n11 = _arg1;
_local4.n22 = _arg2;
_local4.n33 = _arg3;
return (_local4);
}
public static function rotateAxis(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _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, _arg2:Number3D=null, _arg3:Number3D=null):Number3D{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_arg2 = ((_arg2) || (new Number3D()));
_local4 = (((_arg3) && ((_arg3.x == 1)))) ? 1 : Math.sqrt((((_arg1.n11 * _arg1.n11) + (_arg1.n21 * _arg1.n21)) + (_arg1.n31 * _arg1.n31)));
_local5 = (((_arg3) && ((_arg3.y == 1)))) ? 1 : Math.sqrt((((_arg1.n12 * _arg1.n12) + (_arg1.n22 * _arg1.n22)) + (_arg1.n32 * _arg1.n32)));
_local6 = (((_arg3) && ((_arg3.z == 1)))) ? 1 : Math.sqrt((((_arg1.n13 * _arg1.n13) + (_arg1.n23 * _arg1.n23)) + (_arg1.n33 * _arg1.n33)));
_local7 = (_arg1.n11 / _local4);
_local8 = (_arg1.n21 / _local5);
_local9 = (_arg1.n31 / _local6);
_local10 = (_arg1.n32 / _local6);
_local11 = (_arg1.n33 / _local6);
_local9 = ((_local9 > 1)) ? 1 : _local9;
_local9 = ((_local9 < -1)) ? -1 : _local9;
_arg2.y = Math.asin(-(_local9));
_arg2.z = Math.atan2(_local8, _local7);
_arg2.x = Math.atan2(_local10, _local11);
if (Papervision3D.useDEGREES){
_arg2.x = (_arg2.x * toDEGREES);
_arg2.y = (_arg2.y * toDEGREES);
_arg2.z = (_arg2.z * toDEGREES);
};
return (_arg2);
}
public static function multiplyQuaternion(_arg1:Object, _arg2:Object):Object{
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:Object;
_local3 = _arg1.x;
_local4 = _arg1.y;
_local5 = _arg1.z;
_local6 = _arg1.w;
_local7 = _arg2.x;
_local8 = _arg2.y;
_local9 = _arg2.z;
_local10 = _arg2.w;
_local11 = 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);
}
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]));
}
}
}//package org.papervision3d.core.math
Section 47
//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 DEGTORAD:Number = 0.0174532925199433;
public static const RADTODEG:Number = 57.2957795130823;
public function Number2D(_arg1:Number=0, _arg2:Number=0){
this.x = _arg1;
this.y = _arg2;
}
public function divideEq(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
public function copyTo(_arg1:Number2D):void{
_arg1.x = this.x;
_arg1.y = this.y;
}
public function get moduloSquared():Number{
return (((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 reset(_arg1:Number=0, _arg2:Number=0):void{
this.x = _arg1;
this.y = _arg2;
}
public function isModuloGreaterThan(_arg1:Number):Boolean{
return ((moduloSquared > (_arg1 * _arg1)));
}
public function clone():Number2D{
return (new Number2D(this.x, this.y));
}
public function reverse():void{
this.x = -(this.x);
this.y = -(this.y);
}
public function plusEq(_arg1:Number2D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function rotate(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number2D;
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * DEGTORAD);
};
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
_local4 = clone();
this.x = ((_local4.x * _local2) - (_local4.y * _local3));
this.y = ((_local4.x * _local3) + (_local4.y * _local2));
}
public function toString():String{
var _local1:Number;
var _local2:Number;
_local1 = (Math.round((this.x * 1000)) / 1000);
_local2 = (Math.round((this.y * 1000)) / 1000);
return ((((("[" + _local1) + ", ") + _local2) + "]"));
}
public function isModuloEqualTo(_arg1:Number):Boolean{
return ((moduloSquared == (_arg1 * _arg1)));
}
public function multiplyEq(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function normalise():void{
var _local1:Number;
_local1 = this.modulo;
this.x = (this.x / _local1);
this.y = (this.y / _local1);
}
public function get modulo():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function isModuloLessThan(_arg1:Number):Boolean{
return ((moduloSquared < (_arg1 * _arg1)));
}
public function minusEq(_arg1:Number2D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function copyFrom(_arg1:Number2D):void{
this.x = _arg1.x;
this.y = _arg1.y;
}
public static function multiplyScalar(_arg1:Number2D, _arg2:Number):Number2D{
return (new Number2D((_arg1.x * _arg2), (_arg1.y * _arg2)));
}
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 dot(_arg1:Number2D, _arg2:Number2D):Number{
return (((_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)));
}
}
}//package org.papervision3d.core.math
Section 48
//Number3D (org.papervision3d.core.math.Number3D)
package org.papervision3d.core.math {
import org.papervision3d.*;
public class Number3D {
public var z:Number;
public var x:Number;
public var y:Number;
public static var toDEGREES:Number = 57.2957795130823;
private static var temp:Number3D = Number3D.ZERO;
public static var toRADIANS:Number = 0.0174532925199433;
public function Number3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function normalize():void{
var _local1:Number;
_local1 = Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)));
if (((!((_local1 == 0))) && (!((_local1 == 1))))){
_local1 = (1 / _local1);
this.x = (this.x * _local1);
this.y = (this.y * _local1);
this.z = (this.z * _local1);
};
}
public function copyTo(_arg1:Number3D):void{
_arg1.x = x;
_arg1.y = y;
_arg1.z = z;
}
public function get moduloSquared():Number{
return ((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)));
}
public function reset(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):void{
x = _arg1;
y = _arg2;
z = _arg3;
}
public function isModuloGreaterThan(_arg1:Number):Boolean{
return ((moduloSquared > (_arg1 * _arg1)));
}
public function rotateX(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * toRADIANS);
};
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
temp.copyFrom(this);
this.y = ((temp.y * _local2) - (temp.z * _local3));
this.z = ((temp.y * _local3) + (temp.z * _local2));
}
public function rotateY(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * toRADIANS);
};
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
temp.copyFrom(this);
this.x = ((temp.x * _local2) + (temp.z * _local3));
this.z = ((temp.x * -(_local3)) + (temp.z * _local2));
}
public function rotateZ(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * toRADIANS);
};
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
temp.copyFrom(this);
this.x = ((temp.x * _local2) - (temp.y * _local3));
this.y = ((temp.x * _local3) + (temp.y * _local2));
}
public function clone():Number3D{
return (new Number3D(this.x, this.y, this.z));
}
public function plusEq(_arg1:Number3D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
}
public function toString():String{
return (((((("x:" + (Math.round((x * 100)) / 100)) + " y:") + (Math.round((y * 100)) / 100)) + " z:") + (Math.round((z * 100)) / 100)));
}
public function isModuloEqualTo(_arg1:Number):Boolean{
return ((moduloSquared == (_arg1 * _arg1)));
}
public function multiplyEq(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
}
public function get modulo():Number{
return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z))));
}
public function isModuloLessThan(_arg1:Number):Boolean{
return ((moduloSquared < (_arg1 * _arg1)));
}
public function minusEq(_arg1:Number3D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
}
public function copyFrom(_arg1:Number3D):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.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 add(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function cross(_arg1:Number3D, _arg2:Number3D, _arg3:Number3D=null):Number3D{
if (!_arg3){
_arg3 = ZERO;
};
_arg3.reset(((_arg2.y * _arg1.z) - (_arg2.z * _arg1.y)), ((_arg2.z * _arg1.x) - (_arg2.x * _arg1.z)), ((_arg2.x * _arg1.y) - (_arg2.y * _arg1.x)));
return (_arg3);
}
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 get ZERO():Number3D{
return (new Number3D(0, 0, 0));
}
}
}//package org.papervision3d.core.math
Section 49
//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 toString():String{
return (((("u:" + u) + " v:") + v));
}
public function clone():NumberUV{
return (new NumberUV(this.u, this.v));
}
public static function get ZERO():NumberUV{
return (new NumberUV(0, 0));
}
public static function median(_arg1:NumberUV, _arg2:NumberUV):NumberUV{
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
return (new NumberUV(((_arg1.u + _arg2.u) / 2), ((_arg1.v + _arg2.v) / 2)));
}
public static function weighted(_arg1:NumberUV, _arg2:NumberUV, _arg3:Number, _arg4:Number):NumberUV{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
_local5 = (_arg3 + _arg4);
_local6 = (_arg3 / _local5);
_local7 = (_arg4 / _local5);
return (new NumberUV(((_arg1.u * _local6) + (_arg2.u * _local7)), ((_arg1.v * _local6) + (_arg2.v * _local7))));
}
}
}//package org.papervision3d.core.math
Section 50
//Quaternion (org.papervision3d.core.math.Quaternion)
package org.papervision3d.core.math {
public class Quaternion {
private var _matrix:Matrix3D;
public var w:Number;
public var x:Number;
public var y:Number;
public var z:Number;
public static const EPSILON:Number = 1E-6;
public static const DEGTORAD:Number = 0.0174532925199433;
public static const RADTODEG:Number = 57.2957795130823;
public function Quaternion(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=1){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.w = _arg4;
_matrix = Matrix3D.IDENTITY;
}
public function setFromEuler(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
if (_arg4){
_arg1 = (_arg1 * DEGTORAD);
_arg2 = (_arg2 * DEGTORAD);
_arg3 = (_arg3 * DEGTORAD);
};
_local5 = Math.sin((_arg1 * 0.5));
_local6 = Math.cos((_arg1 * 0.5));
_local7 = Math.sin((_arg2 * 0.5));
_local8 = Math.cos((_arg2 * 0.5));
_local9 = Math.sin((_arg3 * 0.5));
_local10 = Math.cos((_arg3 * 0.5));
_local11 = (_local6 * _local8);
_local12 = (_local5 * _local7);
this.x = ((_local9 * _local11) - (_local10 * _local12));
this.y = (((_local10 * _local5) * _local8) + ((_local9 * _local6) * _local7));
this.z = (((_local10 * _local6) * _local7) - ((_local9 * _local5) * _local8));
this.w = ((_local10 * _local11) + (_local9 * _local12));
}
public function setFromAxisAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
_local5 = Math.sin((_arg4 / 2));
_local6 = Math.cos((_arg4 / 2));
this.x = (_arg1 * _local5);
this.y = (_arg2 * _local5);
this.z = (_arg3 * _local5);
this.w = _local6;
this.normalize();
}
public function get matrix():Matrix3D{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local1 = (x * x);
_local2 = (x * y);
_local3 = (x * z);
_local4 = (x * w);
_local5 = (y * y);
_local6 = (y * z);
_local7 = (y * w);
_local8 = (z * z);
_local9 = (z * w);
_matrix.n11 = (1 - (2 * (_local5 + _local8)));
_matrix.n12 = (2 * (_local2 - _local9));
_matrix.n13 = (2 * (_local3 + _local7));
_matrix.n21 = (2 * (_local2 + _local9));
_matrix.n22 = (1 - (2 * (_local1 + _local8)));
_matrix.n23 = (2 * (_local6 - _local4));
_matrix.n31 = (2 * (_local3 - _local7));
_matrix.n32 = (2 * (_local6 + _local4));
_matrix.n33 = (1 - (2 * (_local1 + _local5)));
return (_matrix);
}
public function calculateMultiply(_arg1:Quaternion, _arg2:Quaternion):void{
this.x = ((((_arg1.w * _arg2.x) + (_arg1.x * _arg2.w)) + (_arg1.y * _arg2.z)) - (_arg1.z * _arg2.y));
this.y = ((((_arg1.w * _arg2.y) - (_arg1.x * _arg2.z)) + (_arg1.y * _arg2.w)) + (_arg1.z * _arg2.x));
this.z = ((((_arg1.w * _arg2.z) + (_arg1.x * _arg2.y)) - (_arg1.y * _arg2.x)) + (_arg1.z * _arg2.w));
this.w = ((((_arg1.w * _arg2.w) - (_arg1.x * _arg2.x)) - (_arg1.y * _arg2.y)) - (_arg1.z * _arg2.z));
}
public function toString():String{
return (((((((("Quaternion: x:" + this.x) + " y:") + this.y) + " z:") + this.z) + " w:") + this.w));
}
public function normalize():void{
var _local1:Number;
var _local2:Number;
_local1 = this.modulo;
if (Math.abs(_local1) < EPSILON){
x = (y = (z = 0));
w = 1;
} else {
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
z = (z * _local2);
w = (w * _local2);
};
}
public function get modulo():Number{
return (Math.sqrt(((((x * x) + (y * y)) + (z * z)) + (w * w))));
}
public function toEuler():Number3D{
var _local1:Number3D;
var _local2:Quaternion;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = new Number3D();
_local2 = this;
_local3 = ((_local2.x * _local2.y) + (_local2.z * _local2.w));
if (_local3 > 0.499){
_local1.x = (2 * Math.atan2(_local2.x, _local2.w));
_local1.y = (Math.PI / 2);
_local1.z = 0;
return (_local1);
};
if (_local3 < -0.499){
_local1.x = (-2 * Math.atan2(_local2.x, _local2.w));
_local1.y = (-(Math.PI) / 2);
_local1.z = 0;
return (_local1);
};
_local4 = (_local2.x * _local2.x);
_local5 = (_local2.y * _local2.y);
_local6 = (_local2.z * _local2.z);
_local1.x = Math.atan2((((2 * _local2.y) * _local2.w) - ((2 * _local2.x) * _local2.z)), ((1 - (2 * _local5)) - (2 * _local6)));
_local1.y = Math.asin((2 * _local3));
_local1.z = Math.atan2((((2 * _local2.x) * _local2.w) - ((2 * _local2.y) * _local2.z)), ((1 - (2 * _local4)) - (2 * _local6)));
return (_local1);
}
public function clone():Quaternion{
return (new Quaternion(this.x, this.y, this.z, this.w));
}
public function mult(_arg1:Quaternion):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = this.w;
_local3 = this.x;
_local4 = this.y;
_local5 = this.z;
x = ((((_local2 * _arg1.x) + (_local3 * _arg1.w)) + (_local4 * _arg1.z)) - (_local5 * _arg1.y));
y = ((((_local2 * _arg1.y) - (_local3 * _arg1.z)) + (_local4 * _arg1.w)) + (_local5 * _arg1.x));
z = ((((_local2 * _arg1.z) + (_local3 * _arg1.y)) - (_local4 * _arg1.x)) + (_local5 * _arg1.w));
w = ((((_local2 * _arg1.w) - (_local3 * _arg1.x)) - (_local4 * _arg1.y)) - (_local5 * _arg1.z));
}
public static function sub(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
return (new Quaternion((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z), (_arg1.w - _arg2.w)));
}
public static function add(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
return (new Quaternion((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z), (_arg1.w + _arg2.w)));
}
public static function createFromEuler(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false):Quaternion{
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:Quaternion;
if (_arg4){
_arg1 = (_arg1 * DEGTORAD);
_arg2 = (_arg2 * DEGTORAD);
_arg3 = (_arg3 * DEGTORAD);
};
_local5 = Math.sin((_arg1 * 0.5));
_local6 = Math.cos((_arg1 * 0.5));
_local7 = Math.sin((_arg2 * 0.5));
_local8 = Math.cos((_arg2 * 0.5));
_local9 = Math.sin((_arg3 * 0.5));
_local10 = Math.cos((_arg3 * 0.5));
_local11 = (_local6 * _local8);
_local12 = (_local5 * _local7);
_local13 = new (Quaternion);
_local13.x = ((_local9 * _local11) - (_local10 * _local12));
_local13.y = (((_local10 * _local5) * _local8) + ((_local9 * _local6) * _local7));
_local13.z = (((_local10 * _local6) * _local7) - ((_local9 * _local5) * _local8));
_local13.w = ((_local10 * _local11) + (_local9 * _local12));
return (_local13);
}
public static function createFromMatrix(_arg1:Matrix3D):Quaternion{
var _local2:Quaternion;
var _local3:Number;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:Array;
var _local10:Array;
_local2 = new (Quaternion);
_local4 = new Array(4);
_local8 = ((_arg1.n11 + _arg1.n22) + _arg1.n33);
if (_local8 > 0){
_local3 = Math.sqrt((_local8 + 1));
_local2.w = (_local3 / 2);
_local3 = (0.5 / _local3);
_local2.x = ((_arg1.n32 - _arg1.n23) * _local3);
_local2.y = ((_arg1.n13 - _arg1.n31) * _local3);
_local2.z = ((_arg1.n21 - _arg1.n12) * _local3);
} else {
_local9 = [1, 2, 0];
_local10 = [[_arg1.n11, _arg1.n12, _arg1.n13, _arg1.n14], [_arg1.n21, _arg1.n22, _arg1.n23, _arg1.n24], [_arg1.n31, _arg1.n32, _arg1.n33, _arg1.n34]];
_local5 = 0;
if (_local10[1][1] > _local10[0][0]){
_local5 = 1;
};
if (_local10[2][2] > _local10[_local5][_local5]){
_local5 = 2;
};
_local6 = _local9[_local5];
_local7 = _local9[_local6];
_local3 = Math.sqrt(((_local10[_local5][_local5] - (_local10[_local6][_local6] + _local10[_local7][_local7])) + 1));
_local4[_local5] = (_local3 * 0.5);
if (_local3 != 0){
_local3 = (0.5 / _local3);
};
_local4[3] = ((_local10[_local7][_local6] - _local10[_local6][_local7]) * _local3);
_local4[_local6] = ((_local10[_local6][_local5] + _local10[_local5][_local6]) * _local3);
_local4[_local7] = ((_local10[_local7][_local5] + _local10[_local5][_local7]) * _local3);
_local2.x = _local4[0];
_local2.y = _local4[1];
_local2.z = _local4[2];
_local2.w = _local4[3];
};
return (_local2);
}
public static function dot(_arg1:Quaternion, _arg2:Quaternion):Number{
return (((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z)) + (_arg1.w * _arg2.w)));
}
public static function multiply(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
var _local3:Quaternion;
_local3 = new (Quaternion);
_local3.x = ((((_arg1.w * _arg2.x) + (_arg1.x * _arg2.w)) + (_arg1.y * _arg2.z)) - (_arg1.z * _arg2.y));
_local3.y = ((((_arg1.w * _arg2.y) - (_arg1.x * _arg2.z)) + (_arg1.y * _arg2.w)) + (_arg1.z * _arg2.x));
_local3.z = ((((_arg1.w * _arg2.z) + (_arg1.x * _arg2.y)) - (_arg1.y * _arg2.x)) + (_arg1.z * _arg2.w));
_local3.w = ((((_arg1.w * _arg2.w) - (_arg1.x * _arg2.x)) - (_arg1.y * _arg2.y)) - (_arg1.z * _arg2.z));
return (_local3);
}
public static function createFromAxisAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Quaternion{
var _local5:Quaternion;
_local5 = new (Quaternion);
_local5.setFromAxisAngle(_arg1, _arg2, _arg3, _arg4);
return (_local5);
}
public static function slerp(_arg1:Quaternion, _arg2:Quaternion, _arg3:Number):Quaternion{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = ((((_arg1.w * _arg2.w) + (_arg1.x * _arg2.x)) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z));
if (_local4 < 0){
_arg1.x = (_arg1.x * -1);
_arg1.y = (_arg1.y * -1);
_arg1.z = (_arg1.z * -1);
_arg1.w = (_arg1.w * -1);
_local4 = (_local4 * -1);
};
if ((_local4 + 1) > EPSILON){
if ((1 - _local4) >= EPSILON){
_local7 = Math.acos(_local4);
_local8 = (1 / Math.sin(_local7));
_local5 = (Math.sin((_local7 * (1 - _arg3))) * _local8);
_local6 = (Math.sin((_local7 * _arg3)) * _local8);
} else {
_local5 = (1 - _arg3);
_local6 = _arg3;
};
} else {
_arg2.y = -(_arg1.y);
_arg2.x = _arg1.x;
_arg2.w = -(_arg1.w);
_arg2.z = _arg1.z;
_local5 = Math.sin((Math.PI * (0.5 - _arg3)));
_local6 = Math.sin((Math.PI * _arg3));
};
return (new Quaternion(((_local5 * _arg1.x) + (_local6 * _arg2.x)), ((_local5 * _arg1.y) + (_local6 * _arg2.y)), ((_local5 * _arg1.z) + (_local6 * _arg2.z)), ((_local5 * _arg1.w) + (_local6 * _arg2.w))));
}
public static function createFromOrthoMatrix(_arg1:Matrix3D):Quaternion{
var _local2:Quaternion;
_local2 = new (Quaternion);
_local2.w = (Math.sqrt(Math.max(0, (((1 + _arg1.n11) + _arg1.n22) + _arg1.n33))) / 2);
_local2.x = (Math.sqrt(Math.max(0, (((1 + _arg1.n11) - _arg1.n22) - _arg1.n33))) / 2);
_local2.y = (Math.sqrt(Math.max(0, (((1 - _arg1.n11) + _arg1.n22) - _arg1.n33))) / 2);
_local2.z = (Math.sqrt(Math.max(0, (((1 - _arg1.n11) - _arg1.n22) + _arg1.n33))) / 2);
_local2.x = (((_arg1.n32 - _arg1.n23) < 0)) ? ((_local2.x < 0)) ? _local2.x : -(_local2.x) : ((_local2.x < 0)) ? -(_local2.x) : _local2.x;
_local2.y = (((_arg1.n13 - _arg1.n31) < 0)) ? ((_local2.y < 0)) ? _local2.y : -(_local2.y) : ((_local2.y < 0)) ? -(_local2.y) : _local2.y;
_local2.z = (((_arg1.n21 - _arg1.n12) < 0)) ? ((_local2.z < 0)) ? _local2.z : -(_local2.z) : ((_local2.z < 0)) ? -(_local2.z) : _local2.z;
return (_local2);
}
public static function conjugate(_arg1:Quaternion):Quaternion{
var _local2:Quaternion;
_local2 = new (Quaternion);
_local2.x = -(_arg1.x);
_local2.y = -(_arg1.y);
_local2.z = -(_arg1.z);
_local2.w = _arg1.w;
return (_local2);
}
public static function slerpOld(_arg1:Quaternion, _arg2:Quaternion, _arg3:Number):Quaternion{
var _local4:Quaternion;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local4 = new (Quaternion);
_local5 = ((((_arg1.w * _arg2.w) + (_arg1.x * _arg2.x)) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z));
if (Math.abs(_local5) >= 1){
_local4.w = _arg1.w;
_local4.x = _arg1.x;
_local4.y = _arg1.y;
_local4.z = _arg1.z;
return (_local4);
};
_local6 = Math.acos(_local5);
_local7 = Math.sqrt((1 - (_local5 * _local5)));
if (Math.abs(_local7) < 0.001){
_local4.w = ((_arg1.w * 0.5) + (_arg2.w * 0.5));
_local4.x = ((_arg1.x * 0.5) + (_arg2.x * 0.5));
_local4.y = ((_arg1.y * 0.5) + (_arg2.y * 0.5));
_local4.z = ((_arg1.z * 0.5) + (_arg2.z * 0.5));
return (_local4);
};
_local8 = (Math.sin(((1 - _arg3) * _local6)) / _local7);
_local9 = (Math.sin((_arg3 * _local6)) / _local7);
_local4.w = ((_arg1.w * _local8) + (_arg2.w * _local9));
_local4.x = ((_arg1.x * _local8) + (_arg2.x * _local9));
_local4.y = ((_arg1.y * _local8) + (_arg2.y * _local9));
_local4.z = ((_arg1.z * _local8) + (_arg2.z * _local9));
return (_local4);
}
}
}//package org.papervision3d.core.math
Section 51
//pv3dview (org.papervision3d.core.ns.pv3dview)
package org.papervision3d.core.ns {
public namespace pv3dview;
}//package org.papervision3d.core.ns
Section 52
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.*;
public class CameraObject3D extends DisplayObject3D {
protected var _orthoScale:Number;// = 1
public var eye:Matrix3D;
protected var _far:Number;
public var viewport:Rectangle;
protected var _target:DisplayObject3D;
protected var _ortho:Boolean;
public var yUP:Boolean;
public var focus:Number;
protected var _orthoScaleMatrix:Matrix3D;
protected var _useCulling:Boolean;
public var sort:Boolean;
public var culler:IObjectCuller;
public var zoom:Number;
protected var _useProjectionMatrix:Boolean;
public static var DEFAULT_VIEWPORT:Rectangle = new Rectangle(0, 0, 550, 400);
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
public static var DEFAULT_UP:Number3D = new Number3D(0, 1, 0);
private static var _flipY:Matrix3D = Matrix3D.scaleMatrix(1, -1, 1);
public function CameraObject3D(_arg1:Number=500, _arg2:Number=3){
_orthoScale = 1;
super();
this.x = DEFAULT_POS.x;
this.y = DEFAULT_POS.y;
this.z = DEFAULT_POS.z;
this.zoom = _arg2;
this.focus = _arg1;
this.eye = Matrix3D.IDENTITY;
this.viewport = DEFAULT_VIEWPORT;
this.sort = true;
_ortho = false;
_orthoScaleMatrix = Matrix3D.scaleMatrix(1, 1, 1);
if (Papervision3D.useRIGHTHANDED){
DEFAULT_UP.y = -1;
this.yUP = false;
this.lookAt(DisplayObject3D.ZERO);
} else {
this.yUP = true;
};
}
public function projectFaces(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
return (0);
}
public function get near():Number{
return (this.focus);
}
public function set far(_arg1:Number):void{
if (_arg1 > this.focus){
_far = _arg1;
};
}
public function projectVertices(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
return (0);
}
public function transformView(_arg1:Matrix3D=null):void{
if (this.yUP){
eye.calculateMultiply(((_arg1) || (this.transform)), _flipY);
eye.invert();
} else {
eye.calculateInverse(((_arg1) || (this.transform)));
};
}
public function orbit(_arg1:Number, _arg2:Number, _arg3:Boolean=true, _arg4:DisplayObject3D=null):void{
}
public function set near(_arg1:Number):void{
if (_arg1 > 0){
this.focus = _arg1;
};
}
public function unproject(_arg1:Number, _arg2:Number):Number3D{
var _local3:Number;
var _local4:Number3D;
_local3 = ((focus * zoom) / focus);
_local4 = new Number3D((_arg1 / _local3), (-(_arg2) / _local3), focus);
Matrix3D.multiplyVector3x3(transform, _local4);
return (_local4);
}
public function get orthoScale():Number{
return (_orthoScale);
}
public function get useProjectionMatrix():Boolean{
return (_useProjectionMatrix);
}
public function pan(_arg1:Number):void{
}
public function tilt(_arg1:Number):void{
}
public function get fov():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (((!(viewport)) || (viewport.isEmpty()))){
PaperLogger.warning("CameraObject3D#viewport not set, can't calculate fov!");
return (NaN);
};
_local1 = 0;
_local2 = 0;
_local3 = 0;
if (_target){
_local1 = _target.world.n14;
_local2 = _target.world.n24;
_local3 = _target.world.n34;
};
_local4 = (this.x - _local1);
_local5 = (this.y - _local2);
_local6 = (this.z - _local3);
_local7 = this.focus;
_local8 = this.zoom;
_local9 = (Math.sqrt((((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6))) + _local7);
_local10 = (viewport.height / 2);
_local11 = (180 / Math.PI);
return (((Math.atan(((((_local9 / _local7) / _local8) * _local10) / _local9)) * _local11) * 2));
}
public function set orthoScale(_arg1:Number):void{
_orthoScale = ((_arg1 > 0)) ? _arg1 : 0.0001;
_orthoScaleMatrix.n11 = _orthoScale;
_orthoScaleMatrix.n22 = _orthoScale;
_orthoScaleMatrix.n33 = _orthoScale;
}
public function get far():Number{
return (_far);
}
public function set useProjectionMatrix(_arg1:Boolean):void{
_useProjectionMatrix = _arg1;
}
public function set target(_arg1:DisplayObject3D):void{
_target = _arg1;
}
override public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
if (this.yUP){
super.lookAt(_arg1, _arg2);
} else {
super.lookAt(_arg1, ((_arg2) || (DEFAULT_UP)));
};
}
public function set useCulling(_arg1:Boolean):void{
_useCulling = _arg1;
}
public function set ortho(_arg1:Boolean):void{
_ortho = _arg1;
}
public function get target():DisplayObject3D{
return (_target);
}
public function set fov(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
if (((!(viewport)) || (viewport.isEmpty()))){
PaperLogger.warning("CameraObject3D#viewport not set, can't set fov!");
return;
};
_local2 = 0;
_local3 = 0;
_local4 = 0;
if (_target){
_local2 = _target.world.n14;
_local3 = _target.world.n24;
_local4 = _target.world.n34;
};
_local5 = (viewport.height / 2);
_local6 = ((_arg1 / 2) * (Math.PI / 180));
this.focus = ((_local5 / Math.tan(_local6)) / this.zoom);
}
public function get useCulling():Boolean{
return (_useCulling);
}
public function get ortho():Boolean{
return (_ortho);
}
}
}//package org.papervision3d.core.proto
Section 53
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
public class DisplayObjectContainer3D extends EventDispatcher {
protected var _childrenByName:Object;
private var _childrenTotal:int;
public var root:DisplayObjectContainer3D;
protected var _children:Dictionary;
public function DisplayObjectContainer3D():void{
this._children = new Dictionary(false);
this._childrenByName = new Dictionary(true);
this._childrenTotal = 0;
}
public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
if (_arg1.parent){
PaperLogger.error("DisplayObjectContainer.addChild : DisplayObject3D already has a parent, ie is already added to scene.");
};
_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);
}
private function findChildByName(_arg1:String, _arg2:DisplayObject3D=null):DisplayObject3D{
var _local3:DisplayObject3D;
var _local4:DisplayObject3D;
_arg2 = ((_arg2) || (DisplayObject3D(this)));
if (!_arg2){
return (null);
};
if (_arg2.name == _arg1){
return (_arg2);
};
for each (_local3 in _arg2.children) {
_local4 = findChildByName(_arg1, _local3);
if (_local4){
return (_local4);
};
};
return (null);
}
public function getChildByName(_arg1:String, _arg2:Boolean=false):DisplayObject3D{
if (_arg2){
return (findChildByName(_arg1));
};
return (this._childrenByName[_arg1]);
}
public function get numChildren():int{
return (this._childrenTotal);
}
public function removeChildByName(_arg1:String):DisplayObject3D{
return (removeChild(getChildByName(_arg1)));
}
override public function toString():String{
return (childrenList());
}
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) && (_children[_arg1]))){
delete _childrenByName[this._children[_arg1]];
delete _children[_arg1];
_arg1.parent = null;
_arg1.root = null;
_childrenTotal--;
return (_arg1);
};
return (null);
}
public function childrenList():String{
var _local1:String;
var _local2:String;
_local1 = "";
for (_local2 in this._children) {
_local1 = (_local1 + (_local2 + "\n"));
};
return (_local1);
}
public function get children():Object{
return (this._childrenByName);
}
}
}//package org.papervision3d.core.proto
Section 54
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import flash.utils.*;
public class GeometryObject3D extends EventDispatcher {
protected var _boundingSphereDirty:Boolean;// = true
public var dirty:Boolean;
protected var _aabbDirty:Boolean;// = true
public var _ready:Boolean;// = false
protected var _boundingSphere:BoundingSphere;
public var faces:Array;
private var _numInstances:uint;// = 0
public var vertices:Array;
protected var _aabb:AxisAlignedBoundingBox;
public function GeometryObject3D():void{
_boundingSphereDirty = true;
_aabbDirty = true;
_numInstances = 0;
_ready = false;
super();
dirty = true;
}
public function transformVertices(_arg1:Matrix3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Vertex3D;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local2 = _arg1.n11;
_local3 = _arg1.n12;
_local4 = _arg1.n13;
_local5 = _arg1.n21;
_local6 = _arg1.n22;
_local7 = _arg1.n23;
_local8 = _arg1.n31;
_local9 = _arg1.n32;
_local10 = _arg1.n33;
_local11 = _arg1.n14;
_local12 = _arg1.n24;
_local13 = _arg1.n34;
_local14 = vertices.length;
while ((_local15 = vertices[--_local14])) {
_local16 = _local15.x;
_local17 = _local15.y;
_local18 = _local15.z;
_local19 = ((((_local16 * _local2) + (_local17 * _local3)) + (_local18 * _local4)) + _local11);
_local20 = ((((_local16 * _local5) + (_local17 * _local6)) + (_local18 * _local7)) + _local12);
_local21 = ((((_local16 * _local8) + (_local17 * _local9)) + (_local18 * _local10)) + _local13);
_local15.x = _local19;
_local15.y = _local20;
_local15.z = _local21;
};
}
public function flipFaces():void{
var _local1:Triangle3D;
var _local2:Vertex3D;
for each (_local1 in this.faces) {
_local2 = _local1.v0;
_local1.v0 = _local1.v2;
_local1.v2 = _local2;
_local1.uv = [_local1.uv2, _local1.uv1, _local1.uv0];
_local1.createNormal();
};
this.ready = true;
}
private function createVertexNormals():void{
var _local1:Dictionary;
var _local2:Triangle3D;
var _local3:Vertex3D;
_local1 = 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 clone(_arg1:DisplayObject3D=null):GeometryObject3D{
var _local2:Dictionary;
var _local3:Dictionary;
var _local4:GeometryObject3D;
var _local5:int;
var _local6:MaterialObject3D;
var _local7:Vertex3D;
var _local8:Triangle3D;
var _local9:Vertex3D;
var _local10:Vertex3D;
var _local11:Vertex3D;
_local2 = new Dictionary(true);
_local3 = new Dictionary(true);
_local4 = new GeometryObject3D();
_local4.vertices = new Array();
_local4.faces = new Array();
_local5 = 0;
while (_local5 < this.vertices.length) {
_local7 = this.vertices[_local5];
_local3[_local7] = _local7.clone();
_local4.vertices.push(_local3[_local7]);
_local5++;
};
_local5 = 0;
while (_local5 < this.faces.length) {
_local8 = this.faces[_local5];
_local9 = _local3[_local8.v0];
_local10 = _local3[_local8.v1];
_local11 = _local3[_local8.v2];
_local4.faces.push(new Triangle3D(_arg1, [_local9, _local10, _local11], _local8.material, _local8.uv));
_local2[_local8.material] = _local8.material;
_local5++;
};
for each (_local6 in _local2) {
if (_local6){
_local6.registerObject(_arg1);
};
};
return (_local4);
}
public function set ready(_arg1:Boolean):void{
if (_arg1){
createVertexNormals();
this.dirty = false;
};
_ready = _arg1;
}
public function get ready():Boolean{
return (_ready);
}
public function get aabb():AxisAlignedBoundingBox{
if (_aabbDirty){
_aabb = AxisAlignedBoundingBox.createFromVertices(vertices);
_aabbDirty = false;
};
return (_aabb);
}
public function get boundingSphere():BoundingSphere{
if (_boundingSphereDirty){
_boundingSphere = BoundingSphere.getFromVertices(vertices);
_boundingSphereDirty = false;
};
return (_boundingSphere);
}
}
}//package org.papervision3d.core.proto
Section 55
//LightObject3D (org.papervision3d.core.proto.LightObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.primitives.*;
public class LightObject3D extends DisplayObject3D {
private var displaySphere:Sphere;
public var flipped:Boolean;
public var lightMatrix:Matrix3D;
private var _showLight:Boolean;
public function LightObject3D(_arg1:Boolean=false, _arg2:Boolean=false){
this.lightMatrix = Matrix3D.IDENTITY;
this.showLight = _arg1;
this.flipped = _arg2;
}
public function set showLight(_arg1:Boolean):void{
if (_showLight){
removeChild(displaySphere);
};
if (_arg1){
displaySphere = new Sphere(new WireframeMaterial(0xFFFF00), 10, 3, 2);
addChild(displaySphere);
};
_showLight = _arg1;
}
public function get showLight():Boolean{
return (_showLight);
}
}
}//package org.papervision3d.core.proto
Section 56
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.materials.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
public class MaterialObject3D extends EventDispatcher implements ITriangleDrawer {
public var widthOffset:Number;// = 0
public var name:String;
public var heightOffset:Number;// = 0
public var id:Number;
public var fillColor:Number;
public var fillAlpha:Number;// = 0
protected var objects:Dictionary;
public var baked:Boolean;// = false
public var invisible:Boolean;// = false
public var smooth:Boolean;// = false
public var bitmap:BitmapData;
public var lineAlpha:Number;// = 0
public var lineColor:Number;
public var oneSide:Boolean;// = true
public var lineThickness:Number;// = 1
public var interactive:Boolean;// = false
public var opposite:Boolean;// = false
public var maxU:Number;
public var tiled:Boolean;// = false
public var maxV:Number;
public static var DEFAULT_COLOR:int = 0;
public static var DEBUG_COLOR:int = 0xFF00FF;
private static var _totalMaterialObjects:Number = 0;
public function MaterialObject3D(){
smooth = false;
tiled = false;
baked = false;
lineColor = DEFAULT_COLOR;
lineAlpha = 0;
lineThickness = 1;
fillColor = DEFAULT_COLOR;
fillAlpha = 0;
oneSide = true;
invisible = false;
opposite = false;
widthOffset = 0;
heightOffset = 0;
interactive = false;
super();
this.id = _totalMaterialObjects++;
MaterialManager.registerMaterial(this);
objects = new Dictionary(true);
}
public function getObjectList():Dictionary{
return (objects);
}
public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
}
public function drawRT(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData):void{
}
public function get doubleSided():Boolean{
return (!(this.oneSide));
}
public function unregisterObject(_arg1:DisplayObject3D):void{
if (((objects) && (objects[_arg1]))){
objects[_arg1] = null;
};
}
public function set doubleSided(_arg1:Boolean):void{
this.oneSide = !(_arg1);
}
public function registerObject(_arg1:DisplayObject3D):void{
objects[_arg1] = true;
}
public function updateBitmap():void{
}
override public function toString():String{
return (((((("[MaterialObject3D] bitmap:" + this.bitmap) + " lineColor:") + this.lineColor) + " fillColor:") + fillColor));
}
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.name = _arg1.name;
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
public function destroy():void{
objects = null;
bitmap = null;
MaterialManager.unRegisterMaterial(this);
}
public function isUpdateable():Boolean{
return (!(baked));
}
public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new MaterialObject3D();
_local1.copy(this);
return (_local1);
}
public static function get DEFAULT():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = 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;
_local1 = 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.log.*;
import org.papervision3d.*;
public class SceneObject3D extends DisplayObjectContainer3D {
public var objects:Array;
public var materials:MaterialsList;
public function SceneObject3D(){
this.objects = new Array();
this.materials = new MaterialsList();
PaperLogger.info((((((Papervision3D.NAME + " ") + Papervision3D.VERSION) + " (") + Papervision3D.DATE) + ")\n"));
this.root = this;
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
var _local2:int;
super.removeChild(_arg1);
_local2 = 0;
while (_local2 < this.objects.length) {
if (this.objects[_local2] === _arg1){
this.objects.splice(_local2, 1);
return (_arg1);
};
_local2++;
};
return (_arg1);
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
var _local3:DisplayObject3D;
_local3 = super.addChild(_arg1, (_arg2) ? _arg2 : _arg1.name);
_arg1.scene = this;
_arg1.parent = null;
this.objects.push(_local3);
return (_local3);
}
}
}//package org.papervision3d.core.proto
Section 58
//AbstractRenderListItem (org.papervision3d.core.render.command.AbstractRenderListItem)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
public class AbstractRenderListItem implements IRenderListItem {
public var screenZ:Number;
public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
}
}
}//package org.papervision3d.core.render.command
Section 59
//IRenderListItem (org.papervision3d.core.render.command.IRenderListItem)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
public interface IRenderListItem {
function render(_arg1:RenderSessionData, _arg2:Graphics):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.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class RenderableListItem extends AbstractRenderListItem {
public var minX:Number;
public var minZ:Number;
public var area:Number;
public var instance:DisplayObject3D;
public var minY:Number;
public var renderableInstance:AbstractRenderable;
public var renderable:Class;
public var maxX:Number;
public var maxY:Number;
public var maxZ:Number;
public var quadrant:QuadTreeNode;
public function getZ(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (screenZ);
}
public function update():void{
}
public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
return (_arg2);
}
public function quarter(_arg1:Number):Array{
return ([]);
}
}
}//package org.papervision3d.core.render.command
Section 61
//RenderLine (org.papervision3d.core.render.command.RenderLine)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.special.*;
public class RenderLine extends RenderableListItem implements IRenderListItem {
private var fbz:Number;
private var v:Number2D;
public var size:Number;
private var byf:Number;
private var dx:Number;
private var yfocus:Number;
private var xfocus:Number;
private var dy:Number;
private var faz:Number;
public var line:Line3D;
private var det:Number;
private var axf:Number;
private var db:Number;
private var ayf:Number;
private var da:Number;
private var ax:Number;
private var ay:Number;
private var az:Number;
private var cp3d:Number3D;
public var renderer:LineMaterial;
private var l1:Number2D;
private var l2:Number2D;
private var bxf:Number;
public var cV:Vertex3DInstance;
private var azf:Number;
private var bx:Number;
private var by:Number;
private var bz:Number;
private var bzf:Number;
public var length:Number;
private var p:Number2D;
public var v0:Vertex3DInstance;
public var v1:Vertex3DInstance;
private static var mouseVector:Number3D = Number3D.ZERO;
private static var lineVector:Number3D = Number3D.ZERO;
public function RenderLine(_arg1:Line3D){
this.renderable = Line3D;
this.renderableInstance = _arg1;
this.line = _arg1;
this.instance = _arg1.instance;
v0 = _arg1.v0.vertex3DInstance;
v1 = _arg1.v1.vertex3DInstance;
cV = _arg1.cV.vertex3DInstance;
p = new Number2D();
l1 = new Number2D();
l2 = new Number2D();
v = new Number2D();
cp3d = new Number3D();
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
renderer.drawLine(this, _arg2, _arg1);
}
override public function getZ(_arg1:Number, _arg2:Number, _arg3:Number):Number{
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (az);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (bz);
};
dx = (bx - ax);
dy = (by - ay);
azf = (az / _arg3);
bzf = (bz / _arg3);
faz = (1 + azf);
fbz = (1 + bzf);
xfocus = _arg1;
yfocus = _arg2;
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
det = ((dx * (axf - bxf)) + (dy * (ayf - byf)));
db = ((dx * (axf - _arg1)) + (dy * (ayf - _arg2)));
da = ((dx * (_arg1 - bxf)) + (dy * (_arg2 - byf)));
return ((((da * az) + (db * bz)) / det));
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (renderer.interactive){
_local3 = line.size;
p.reset(_arg1.x, _arg1.y);
l1.reset(line.v0.vertex3DInstance.x, line.v0.vertex3DInstance.y);
l2.reset(line.v1.vertex3DInstance.x, line.v1.vertex3DInstance.y);
v.copyFrom(l2);
v.minusEq(l1);
_local4 = ((((p.x - l1.x) * (l2.x - l1.x)) + ((p.y - l1.y) * (l2.y - l1.y))) / ((v.x * v.x) + (v.y * v.y)));
if ((((_local4 > 0)) && ((_local4 < 1)))){
v.multiplyEq(_local4);
v.plusEq(l1);
v.minusEq(p);
_local5 = ((v.x * v.x) + (v.y * v.y));
if (_local5 < (_local3 * _local3)){
_arg2.displayObject3D = line.instance;
_arg2.material = renderer;
_arg2.renderable = line;
_arg2.hasHit = true;
cp3d.reset((line.v1.x - line.v0.x), (line.v1.y - line.v0.y), (line.v1.x - line.v0.x));
cp3d.x = (cp3d.x * _local4);
cp3d.y = (cp3d.y * _local4);
cp3d.z = (cp3d.z * _local4);
cp3d.x = (cp3d.x + line.v0.x);
cp3d.y = (cp3d.y + line.v0.y);
cp3d.z = (cp3d.z + line.v0.z);
_arg2.x = cp3d.x;
_arg2.y = cp3d.y;
_arg2.z = cp3d.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 flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
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;
this.renderableInstance = _arg1;
this.renderable = Particle;
this.instance = _arg1.instance;
}
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);
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
particle.material.drawParticle(particle, _arg2, _arg1);
}
}
}//package org.papervision3d.core.render.command
Section 63
//RenderTriangle (org.papervision3d.core.render.command.RenderTriangle)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.draw.*;
public class RenderTriangle extends RenderableListItem implements IRenderListItem {
public var create:Function;
public var triangle:Triangle3D;
private var bzf:Number;
private var det:Number;
private var axf:Number;
private var v12:Vertex3DInstance;
private var faz:Number;
private var position:Number3D;
private var ayf:Number;
private var au:Number;
private var av:Number;
private var ax:Number;
private var ay:Number;
private var v20:Vertex3DInstance;
private var fbz:Number;
private var az:Number;
private var azf:Number;
private var bu:Number;
private var bv:Number;
private var bx:Number;
private var by:Number;
private var bz:Number;
private var fcz:Number;
private var uv01:NumberUV;
private var cv:Number;
private var cx:Number;
private var cy:Number;
private var cz:Number;
private var cu:Number;
public var v0:Vertex3DInstance;
public var v1:Vertex3DInstance;
private var db:Number;
private var dc:Number;
private var uv12:NumberUV;
public var v2:Vertex3DInstance;
public var container:Sprite;
private var cxf:Number;
private var da:Number;
protected var vx0:Vertex3DInstance;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var uv2:NumberUV;
protected var vx1:Vertex3DInstance;
protected var vx2:Vertex3DInstance;
private var uv20:NumberUV;
public var renderer:ITriangleDrawer;
private var cyf:Number;
private var czf:Number;
private var bxf:Number;
protected var vPointL:Vertex3DInstance;
private var byf:Number;
public var renderMat:MaterialObject3D;
private var v01:Vertex3DInstance;
protected static var resPA:Vertex3DInstance = new Vertex3DInstance();
protected static var resBA:Vertex3DInstance = new Vertex3DInstance();
protected static var vPoint:Vertex3DInstance = new Vertex3DInstance();
protected static var resRA:Vertex3DInstance = new Vertex3DInstance();
public function RenderTriangle(_arg1:Triangle3D):void{
position = new Number3D();
super();
this.triangle = _arg1;
this.instance = _arg1.instance;
renderableInstance = _arg1;
renderable = Triangle3D;
this.v0 = _arg1.v0.vertex3DInstance;
this.v1 = _arg1.v1.vertex3DInstance;
this.v2 = _arg1.v2.vertex3DInstance;
this.uv0 = _arg1.uv0;
this.uv1 = _arg1.uv1;
this.uv2 = _arg1.uv2;
this.renderer = _arg1.material;
update();
}
private function deepHitTest(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:RenderHitData):RenderHitData{
var _local4:Vertex3DInstance;
var _local5:Vertex3DInstance;
var _local6:Vertex3DInstance;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Array;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:BitmapData;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:MovieMaterial;
var _local45:Rectangle;
_local4 = _arg1.v0.vertex3DInstance;
_local5 = _arg1.v1.vertex3DInstance;
_local6 = _arg1.v2.vertex3DInstance;
_local7 = (_local6.x - _local4.x);
_local8 = (_local6.y - _local4.y);
_local9 = (_local5.x - _local4.x);
_local10 = (_local5.y - _local4.y);
_local11 = (_arg2.x - _local4.x);
_local12 = (_arg2.y - _local4.y);
_local13 = ((_local7 * _local7) + (_local8 * _local8));
_local14 = ((_local7 * _local9) + (_local8 * _local10));
_local15 = ((_local7 * _local11) + (_local8 * _local12));
_local16 = ((_local9 * _local9) + (_local10 * _local10));
_local17 = ((_local9 * _local11) + (_local10 * _local12));
_local18 = (1 / ((_local13 * _local16) - (_local14 * _local14)));
_local19 = (((_local16 * _local15) - (_local14 * _local17)) * _local18);
_local20 = (((_local13 * _local17) - (_local14 * _local15)) * _local18);
_local21 = (_arg1.v2.x - _arg1.v0.x);
_local22 = (_arg1.v2.y - _arg1.v0.y);
_local23 = (_arg1.v2.z - _arg1.v0.z);
_local24 = (_arg1.v1.x - _arg1.v0.x);
_local25 = (_arg1.v1.y - _arg1.v0.y);
_local26 = (_arg1.v1.z - _arg1.v0.z);
_local27 = ((_arg1.v0.x + (_local21 * _local19)) + (_local24 * _local20));
_local28 = ((_arg1.v0.y + (_local22 * _local19)) + (_local25 * _local20));
_local29 = ((_arg1.v0.z + (_local23 * _local19)) + (_local26 * _local20));
_local30 = _arg1.uv;
_local31 = _local30[0].u;
_local32 = _local30[1].u;
_local33 = _local30[2].u;
_local34 = _local30[0].v;
_local35 = _local30[1].v;
_local36 = _local30[2].v;
_local37 = ((((_local32 - _local31) * _local20) + ((_local33 - _local31) * _local19)) + _local31);
_local38 = ((((_local35 - _local34) * _local20) + ((_local36 - _local34) * _local19)) + _local34);
if (triangle.material){
renderMat = _arg1.material;
} else {
renderMat = _arg1.instance.material;
};
_local39 = renderMat.bitmap;
_local40 = 1;
_local41 = 1;
_local42 = 0;
_local43 = 0;
if ((renderMat is MovieMaterial)){
_local44 = (renderMat as MovieMaterial);
_local45 = _local44.rect;
if (_local45){
_local42 = _local45.x;
_local43 = _local45.y;
_local40 = _local45.width;
_local41 = _local45.height;
};
} else {
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) + _local42);
_arg3.v = ((_local41 - (_local38 * _local41)) + _local43);
return (_arg3);
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
renderMat = triangle.material;
if (!renderMat){
renderMat = triangle.instance.material;
};
if (((renderMat) && (renderMat.interactive))){
vPointL = RenderTriangle.vPoint;
vPointL.x = _arg1.x;
vPointL.y = _arg1.y;
vx0 = triangle.v0.vertex3DInstance;
vx1 = triangle.v1.vertex3DInstance;
vx2 = triangle.v2.vertex3DInstance;
if (sameSide(vPointL, vx0, vx1, vx2)){
if (sameSide(vPointL, vx1, vx0, vx2)){
if (sameSide(vPointL, vx2, vx0, vx1)){
return (deepHitTest(triangle, vPointL, _arg2));
};
};
};
};
return (_arg2);
}
public function fivepointcut(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance, _arg5:Vertex3DInstance, _arg6:NumberUV, _arg7:NumberUV, _arg8:NumberUV, _arg9:NumberUV, _arg10:NumberUV):Array{
if (_arg1.distanceSqr(_arg4) < _arg2.distanceSqr(_arg5)){
return ([create(renderableInstance, instance.material, _arg1, _arg2, _arg4, _arg6, _arg7, _arg9), create(renderableInstance, instance.material, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9), create(renderableInstance, instance.material, _arg1, _arg4, _arg5, _arg6, _arg9, _arg10)]);
};
return ([create(renderableInstance, instance.material, _arg1, _arg2, _arg5, _arg6, _arg7, _arg10), create(renderableInstance, instance.material, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9), create(renderableInstance, instance.material, _arg2, _arg4, _arg5, _arg7, _arg9, _arg10)]);
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
renderer.drawTriangle(this, _arg2, _arg1);
}
final override public function quarter(_arg1:Number):Array{
if (area < 20){
return (null);
};
v01 = Vertex3DInstance.median(v0, v1, _arg1);
v12 = Vertex3DInstance.median(v1, v2, _arg1);
v20 = Vertex3DInstance.median(v2, v0, _arg1);
uv01 = NumberUV.median(uv0, uv1);
uv12 = NumberUV.median(uv1, uv2);
uv20 = NumberUV.median(uv2, uv0);
return ([create(renderableInstance, renderer, v0, v01, v20, uv0, uv01, uv20), create(renderableInstance, renderer, v1, v12, v01, uv1, uv12, uv01), create(renderableInstance, renderer, v2, v20, v12, uv2, uv20, uv12), create(renderableInstance, renderer, v01, v12, v20, uv01, uv12, uv20)]);
}
final override public function getZ(_arg1:Number, _arg2:Number, _arg3:Number):Number{
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
cx = v2.x;
cy = v2.y;
cz = v2.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (az);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (bz);
};
if ((((cx == _arg1)) && ((cy == _arg2)))){
return (cz);
};
azf = (az / _arg3);
bzf = (bz / _arg3);
czf = (cz / _arg3);
faz = (1 + azf);
fbz = (1 + bzf);
fcz = (1 + czf);
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
cxf = ((cx * fcz) - (_arg1 * czf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
cyf = ((cy * fcz) - (_arg2 * czf));
det = (((axf * (byf - cyf)) + (bxf * (cyf - ayf))) + (cxf * (ayf - byf)));
da = (((_arg1 * (byf - cyf)) + (bxf * (cyf - _arg2))) + (cxf * (_arg2 - byf)));
db = (((axf * (_arg2 - cyf)) + (_arg1 * (cyf - ayf))) + (cxf * (ayf - _arg2)));
dc = (((axf * (byf - _arg2)) + (bxf * (_arg2 - ayf))) + (_arg1 * (ayf - byf)));
return (((((da * az) + (db * bz)) + (dc * cz)) / det));
}
override public function update():void{
if (v0.x > v1.x){
if (v0.x > v2.x){
maxX = v0.x;
} else {
maxX = v2.x;
};
} else {
if (v1.x > v2.x){
maxX = v1.x;
} else {
maxX = v2.x;
};
};
if (v0.x < v1.x){
if (v0.x < v2.x){
minX = v0.x;
} else {
minX = v2.x;
};
} else {
if (v1.x < v2.x){
minX = v1.x;
} else {
minX = v2.x;
};
};
if (v0.y > v1.y){
if (v0.y > v2.y){
maxY = v0.y;
} else {
maxY = v2.y;
};
} else {
if (v1.y > v2.y){
maxY = v1.y;
} else {
maxY = v2.y;
};
};
if (v0.y < v1.y){
if (v0.y < v2.y){
minY = v0.y;
} else {
minY = v2.y;
};
} else {
if (v1.y < v2.y){
minY = v1.y;
} else {
minY = v2.y;
};
};
if (v0.z > v1.z){
if (v0.z > v2.z){
maxZ = v0.z;
} else {
maxZ = v2.z;
};
} else {
if (v1.z > v2.z){
maxZ = v1.z;
} else {
maxZ = v2.z;
};
};
if (v0.z < v1.z){
if (v0.z < v2.z){
minZ = v0.z;
} else {
minZ = v2.z;
};
} else {
if (v1.z < v2.z){
minZ = v1.z;
} else {
minZ = v2.z;
};
};
screenZ = (((v0.z + v1.z) + v2.z) / 3);
area = (0.5 * (((v0.x * (v2.y - v1.y)) + (v1.x * (v0.y - v2.y))) + (v2.x * (v1.y - v0.y))));
}
public function sameSide(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
Vertex3DInstance.subTo(_arg4, _arg3, resBA);
Vertex3DInstance.subTo(_arg1, _arg3, resPA);
Vertex3DInstance.subTo(_arg2, _arg3, resRA);
return (((Vertex3DInstance.cross(resBA, resPA) * Vertex3DInstance.cross(resBA, resRA)) >= 0));
}
}
}//package org.papervision3d.core.render.command
Section 64
//QuadTree (org.papervision3d.core.render.data.QuadTree)
package org.papervision3d.core.render.data {
import flash.display.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.clipping.draw.*;
public final class QuadTree {
private var _children:Array;
private var _root:QuadTreeNode;
private var _rect:RectangleClipping;
private var _maxlevel:uint;// = 4
private var _maxX:Number;
private var _maxY:Number;
private var _child:RenderableListItem;
private var _minX:Number;
private var _minY:Number;
private var i:int;
private var _center:Array;
private var _clip:Clipping;
private var _result:Array;
private var _except:DisplayObject3D;
public function QuadTree(){
_maxlevel = 4;
super();
}
public function remove(_arg1:RenderableListItem):void{
_center = _arg1.quadrant.center;
_center.splice(_center.indexOf(_arg1), 1);
}
public function getOverlaps(_arg1:RenderableListItem, _arg2:DisplayObject3D=null):Array{
_result = [];
_minX = _arg1.minX;
_minY = _arg1.minY;
_maxX = _arg1.maxX;
_maxY = _arg1.maxY;
_except = _arg2;
getList(_arg1.quadrant);
getParent(_arg1.quadrant);
return (_result);
}
public function get clip():Clipping{
return (_clip);
}
public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
_root.render(-(Infinity), _arg1, _arg2);
}
public function list():Array{
_result = [];
_minX = -1000000;
_minY = -1000000;
_maxX = 1000000;
_maxY = 1000000;
_except = null;
getList(_root);
return (_result);
}
public function get maxLevel():uint{
return (_maxlevel);
}
private function getList(_arg1:QuadTreeNode):void{
if (!_arg1){
return;
};
if (((_arg1.onlysourceFlag) && ((_except == _arg1.onlysource)))){
return;
};
if (_minX < _arg1.xdiv){
if (((_arg1.lefttopFlag) && ((_minY < _arg1.ydiv)))){
getList(_arg1.lefttop);
};
if (((_arg1.leftbottomFlag) && ((_maxY > _arg1.ydiv)))){
getList(_arg1.leftbottom);
};
};
if (_maxX > _arg1.xdiv){
if (((_arg1.righttopFlag) && ((_minY < _arg1.ydiv)))){
getList(_arg1.righttop);
};
if (((_arg1.rightbottomFlag) && ((_maxY > _arg1.ydiv)))){
getList(_arg1.rightbottom);
};
};
_children = _arg1.center;
if (_children != null){
i = _children.length;
while (i--) {
_child = _children[i];
if ((((((((((((_except == null)) || (!((_child.instance == _except))))) && ((_child.maxX > _minX)))) && ((_child.minX < _maxX)))) && ((_child.maxY > _minY)))) && ((_child.minY < _maxY)))){
_result.push(_child);
};
};
};
}
public function getRoot():QuadTreeNode{
return (_root);
}
private function getParent(_arg1:QuadTreeNode=null):void{
if (!_arg1){
return;
};
_arg1 = _arg1.parent;
if ((((_arg1 == null)) || (((_arg1.onlysourceFlag) && ((_except == _arg1.onlysource)))))){
return;
};
_children = _arg1.center;
if (_children != null){
i = _children.length;
while (i--) {
_child = _children[i];
if ((((((((((((_except == null)) || (!((_child.instance == _except))))) && ((_child.maxX > _minX)))) && ((_child.minX < _maxX)))) && ((_child.maxY > _minY)))) && ((_child.minY < _maxY)))){
_result.push(_child);
};
};
};
getParent(_arg1);
}
public function add(_arg1:RenderableListItem):void{
if (_clip.check(_arg1)){
_root.push(_arg1);
};
}
public function set maxLevel(_arg1:uint):void{
_maxlevel = _arg1;
if (_root){
_root.maxlevel = _maxlevel;
};
}
public function set clip(_arg1:Clipping):void{
_clip = _arg1;
_rect = _clip.asRectangleClipping();
if (!_root){
_root = new QuadTreeNode(((_rect.minX + _rect.maxX) / 2), ((_rect.minY + _rect.maxY) / 2), (_rect.maxX - _rect.minX), (_rect.maxY - _rect.minY), 0, null, _maxlevel);
} else {
_root.reset(((_rect.minX + _rect.maxX) / 2), ((_rect.minY + _rect.maxY) / 2), (_rect.maxX - _rect.minX), (_rect.maxY - _rect.minY), _maxlevel);
};
}
}
}//package org.papervision3d.core.render.data
Section 65
//QuadTreeNode (org.papervision3d.core.render.data.QuadTreeNode)
package org.papervision3d.core.render.data {
import flash.display.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.objects.*;
public final class QuadTreeNode {
private var level:int;
public var leftbottomFlag:Boolean;
public var xdiv:Number;
private var halfheight:Number;
public var maxlevel:int;// = 4
private var render_center_length:int;// = -1
public var parent:QuadTreeNode;
public var righttop:QuadTreeNode;
public var righttopFlag:Boolean;
public var rightbottom:QuadTreeNode;
public var rightbottomFlag:Boolean;
public var center:Array;
public var onlysource:DisplayObject3D;
public var onlysourceFlag:Boolean;// = true
public var lefttop:QuadTreeNode;
private var render_center_index:int;// = -1
private var halfwidth:Number;
public var ydiv:Number;
public var leftbottom:QuadTreeNode;
public var lefttopFlag:Boolean;
public var create:Function;
public var hasContent:Boolean;// = false
public function QuadTreeNode(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:QuadTreeNode=null, _arg7:uint=4){
render_center_length = -1;
render_center_index = -1;
maxlevel = 4;
onlysourceFlag = true;
hasContent = false;
super();
this.level = _arg5;
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
this.parent = _arg6;
this.maxlevel = _arg7;
}
public function render(_arg1:Number, _arg2:RenderSessionData, _arg3:Graphics):void{
var _local4:RenderableListItem;
if (render_center_length == -1){
if (center != null){
render_center_length = center.length;
if (render_center_length > 1){
center.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
};
} else {
render_center_length = 0;
};
render_center_index = 0;
};
while (render_center_index < render_center_length) {
_local4 = center[render_center_index];
if (_local4.screenZ < _arg1){
break;
};
render_other(_local4.screenZ, _arg2, _arg3);
_local4.render(_arg2, _arg3);
_arg2.viewPort.lastRenderList.push(_local4);
render_center_index++;
};
if (render_center_index == render_center_length){
center = null;
};
render_other(_arg1, _arg2, _arg3);
}
public function push(_arg1:RenderableListItem):void{
hasContent = true;
if (onlysourceFlag){
if (((!((onlysource == null))) && (!((onlysource == _arg1.instance))))){
onlysourceFlag = false;
};
onlysource = _arg1.instance;
};
if (level < maxlevel){
if (_arg1.maxX <= xdiv){
if (_arg1.maxY <= ydiv){
if (lefttop == null){
lefttopFlag = true;
lefttop = new QuadTreeNode((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!lefttopFlag){
lefttopFlag = true;
lefttop.reset((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
lefttop.push(_arg1);
return;
} else {
if (_arg1.minY >= ydiv){
if (leftbottom == null){
leftbottomFlag = true;
leftbottom = new QuadTreeNode((xdiv - (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!leftbottomFlag){
leftbottomFlag = true;
leftbottom.reset((xdiv - (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
leftbottom.push(_arg1);
return;
};
};
} else {
if (_arg1.minX >= xdiv){
if (_arg1.maxY <= ydiv){
if (righttop == null){
righttopFlag = true;
righttop = new QuadTreeNode((xdiv + (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!righttopFlag){
righttopFlag = true;
righttop.reset((xdiv + (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
righttop.push(_arg1);
return;
} else {
if (_arg1.minY >= ydiv){
if (rightbottom == null){
rightbottomFlag = true;
rightbottom = new QuadTreeNode((xdiv + (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!rightbottomFlag){
rightbottomFlag = true;
rightbottom.reset((xdiv + (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
rightbottom.push(_arg1);
return;
};
};
};
};
};
if (center == null){
center = new Array();
};
center.push(_arg1);
_arg1.quadrant = this;
}
private function render_other(_arg1:Number, _arg2:RenderSessionData, _arg3:Graphics):void{
if (lefttopFlag){
lefttop.render(_arg1, _arg2, _arg3);
};
if (leftbottomFlag){
leftbottom.render(_arg1, _arg2, _arg3);
};
if (righttopFlag){
righttop.render(_arg1, _arg2, _arg3);
};
if (rightbottomFlag){
rightbottom.render(_arg1, _arg2, _arg3);
};
}
public function reset(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint):void{
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
lefttopFlag = false;
leftbottomFlag = false;
righttopFlag = false;
rightbottomFlag = false;
onlysourceFlag = true;
onlysource = null;
render_center_length = -1;
render_center_index = -1;
hasContent = false;
maxlevel = _arg5;
}
public function getRect():Rectangle{
return (new Rectangle(xdiv, ydiv, (halfwidth * 2), (halfheight * 2)));
}
}
}//package org.papervision3d.core.render.data
Section 66
//RenderHitData (org.papervision3d.core.render.data.RenderHitData)
package org.papervision3d.core.render.data {
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class RenderHitData {
public var y:Number;
public var endTime:int;// = 0
public var displayObject3D:DisplayObject3D;
public var startTime:int;// = 0
public var hasHit:Boolean;// = false
public var material:MaterialObject3D;
public var renderable:IRenderable;
public var u:Number;
public var v:Number;
public var x:Number;
public var z:Number;
public function RenderHitData():void{
startTime = 0;
endTime = 0;
hasHit = false;
super();
}
public function clear():void{
startTime = 0;
endTime = 0;
hasHit = false;
displayObject3D = null;
material = null;
renderable = null;
u = 0;
v = 0;
x = 0;
y = 0;
z = 0;
}
public function clone():RenderHitData{
var _local1:RenderHitData;
_local1 = new RenderHitData();
_local1.startTime = startTime;
_local1.endTime = endTime;
_local1.hasHit = hasHit;
_local1.displayObject3D = displayObject3D;
_local1.material = material;
_local1.renderable = renderable;
_local1.u = u;
_local1.v = v;
_local1.x = x;
_local1.y = y;
_local1.z = z;
return (_local1);
}
public function toString():String{
return (((displayObject3D + " ") + renderable));
}
}
}//package org.papervision3d.core.render.data
Section 67
//RenderSessionData (org.papervision3d.core.render.data.RenderSessionData)
package org.papervision3d.core.render.data {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.clipping.*;
public class RenderSessionData {
public var renderer:IRenderEngine;
public var particleCuller:IParticleCuller;
public var viewPort:Viewport3D;
public var triangleCuller:ITriangleCuller;
public var container:Sprite;
public var clipping:DefaultClipping;
public var quadrantTree:QuadTree;
public var scene:SceneObject3D;
public var renderStatistics:RenderStatistics;
public var renderObjects:Array;
public var camera:CameraObject3D;
public var renderLayers:Array;
public var sorted:Boolean;
public function RenderSessionData():void{
this.renderStatistics = new RenderStatistics();
}
public function destroy():void{
triangleCuller = null;
particleCuller = null;
viewPort = null;
container = null;
scene = null;
camera = null;
renderer = null;
renderStatistics = null;
renderObjects = null;
renderLayers = null;
clipping = null;
quadrantTree = null;
}
public function clone():RenderSessionData{
var _local1:RenderSessionData;
_local1 = new RenderSessionData();
_local1.triangleCuller = triangleCuller;
_local1.particleCuller = particleCuller;
_local1.viewPort = viewPort;
_local1.container = container;
_local1.scene = scene;
_local1.camera = camera;
_local1.renderer = renderer;
_local1.renderStatistics = renderStatistics.clone();
_local1.clipping = clipping;
_local1.quadrantTree = quadrantTree;
return (_local1);
}
}
}//package org.papervision3d.core.render.data
Section 68
//RenderStatistics (org.papervision3d.core.render.data.RenderStatistics)
package org.papervision3d.core.render.data {
public class RenderStatistics {
public var renderTime:int;// = 0
public var culledObjects:int;// = 0
public var shadedTriangles:int;// = 0
public var culledParticles:int;// = 0
public var culledTriangles:int;// = 0
public var triangles:int;// = 0
public var particles:int;// = 0
public var rendered:int;// = 0
public var projectionTime:int;// = 0
public var filteredObjects:int;// = 0
public var lines:int;// = 0
public function RenderStatistics(){
projectionTime = 0;
renderTime = 0;
rendered = 0;
triangles = 0;
culledTriangles = 0;
particles = 0;
culledParticles = 0;
lines = 0;
shadedTriangles = 0;
filteredObjects = 0;
culledObjects = 0;
super();
}
public function clone():RenderStatistics{
var _local1:RenderStatistics;
_local1 = new RenderStatistics();
_local1.projectionTime = projectionTime;
_local1.renderTime = renderTime;
_local1.rendered = rendered;
_local1.particles = particles;
_local1.triangles = triangles;
_local1.culledTriangles = culledTriangles;
_local1.lines = lines;
_local1.shadedTriangles = shadedTriangles;
_local1.filteredObjects = filteredObjects;
_local1.culledObjects = culledObjects;
return (_local1);
}
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 69
//ILineDrawer (org.papervision3d.core.render.draw.ILineDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
public interface ILineDrawer {
function drawLine(_arg1:RenderLine, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 70
//IParticleDrawer (org.papervision3d.core.render.draw.IParticleDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.geom.renderables.*;
public interface IParticleDrawer {
function updateRenderRect(_arg1:Particle):void;
function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 71
//ITriangleDrawer (org.papervision3d.core.render.draw.ITriangleDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
public interface ITriangleDrawer {
function drawRT(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData):void;
function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void;
}
}//package org.papervision3d.core.render.draw
Section 72
//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 73
//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 74
//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 75
//IUpdateBeforeMaterial (org.papervision3d.core.render.material.IUpdateBeforeMaterial)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
public interface IUpdateBeforeMaterial {
function isUpdateable():Boolean;
function updateBeforeRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.material
Section 76
//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(true);
}
private function _unRegisterMaterial(_arg1:MaterialObject3D):void{
delete materials[_arg1];
}
public function updateMaterialsAfterRender(_arg1:RenderSessionData):void{
var _local2:IUpdateAfterMaterial;
var _local3:*;
for (_local3 in materials) {
if ((_local3 is IUpdateAfterMaterial)){
_local2 = (_local3 as IUpdateAfterMaterial);
_local2.updateAfterRender(_arg1);
};
};
}
private function _registerMaterial(_arg1:MaterialObject3D):void{
materials[_arg1] = true;
}
public function updateMaterialsBeforeRender(_arg1:RenderSessionData):void{
var _local2:IUpdateBeforeMaterial;
var _local3:*;
for (_local3 in materials) {
if ((_local3 is IUpdateBeforeMaterial)){
_local2 = (_local3 as IUpdateBeforeMaterial);
if (_local2.isUpdateable()){
_local2.updateBeforeRender(_arg1);
};
};
};
}
public static function getInstance():MaterialManager{
if (!instance){
instance = new (MaterialManager);
};
return (instance);
}
public static function unRegisterMaterial(_arg1:MaterialObject3D):void{
getInstance()._unRegisterMaterial(_arg1);
}
public static function registerMaterial(_arg1:MaterialObject3D):void{
getInstance()._registerMaterial(_arg1);
}
}
}//package org.papervision3d.core.render.material
Section 77
//BasicProjectionPipeline (org.papervision3d.core.render.project.BasicProjectionPipeline)
package org.papervision3d.core.render.project {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
public class BasicProjectionPipeline extends ProjectionPipeline {
public function BasicProjectionPipeline(){
init();
}
protected function init():void{
}
protected function projectObject(_arg1:DisplayObject3D, _arg2:RenderSessionData, _arg3:Number):void{
_arg1.cullTest = _arg3;
if (_arg1.parent){
_arg1.project((_arg1.parent as DisplayObject3D), _arg2);
} else {
_arg1.project(_arg2.camera, _arg2);
};
}
override public function project(_arg1:RenderSessionData):void{
var _local2:Array;
var _local3:DisplayObject3D;
var _local4:Number;
var _local5:Number;
_arg1.camera.transformView();
_local2 = _arg1.renderObjects;
_local4 = _local2.length;
if (_arg1.camera.useProjectionMatrix){
for each (_local3 in _local2) {
if (_local3.visible){
if (_arg1.viewPort.viewportObjectFilter){
_local5 = _arg1.viewPort.viewportObjectFilter.testObject(_local3);
if (_local5){
projectObject(_local3, _arg1, _local5);
} else {
_arg1.renderStatistics.filteredObjects++;
};
} else {
projectObject(_local3, _arg1, 1);
};
};
};
} else {
for each (_local3 in _local2) {
if (_local3.visible){
if (_arg1.viewPort.viewportObjectFilter){
_local5 = _arg1.viewPort.viewportObjectFilter.testObject(_local3);
if (_local5){
projectObject(_local3, _arg1, _local5);
} else {
_arg1.renderStatistics.filteredObjects++;
};
} else {
projectObject(_local3, _arg1, 1);
};
};
};
};
}
}
}//package org.papervision3d.core.render.project
Section 78
//ProjectionPipeline (org.papervision3d.core.render.project.ProjectionPipeline)
package org.papervision3d.core.render.project {
import org.papervision3d.core.render.data.*;
public class ProjectionPipeline {
public function project(_arg1:RenderSessionData):void{
}
}
}//package org.papervision3d.core.render.project
Section 79
//IShaderRenderer (org.papervision3d.core.render.shader.IShaderRenderer)
package org.papervision3d.core.render.shader {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.materials.shaders.*;
public interface IShaderRenderer {
function getLayerForShader(_arg1:Shader):Sprite;
function render(_arg1:RenderSessionData):void;
function destroy():void;
function clear():void;
}
}//package org.papervision3d.core.render.shader
Section 80
//ShaderObjectData (org.papervision3d.core.render.shader.ShaderObjectData)
package org.papervision3d.core.render.shader {
import flash.display.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.shaders.*;
import flash.utils.*;
public class ShaderObjectData {
public var shaderRenderer:ShaderRenderer;
public var triangleUVS:Dictionary;
public var renderTriangleUVS:Dictionary;
public var lightMatrices:Dictionary;
public var shadedMaterial:ShadedMaterial;
public var uvMatrices:Dictionary;
private var origin:Point;
public var triangleRects:Dictionary;
public var material:BitmapMaterial;
protected var triangleBitmaps:Dictionary;
public var object:DisplayObject3D;
public function ShaderObjectData(_arg1:DisplayObject3D, _arg2:BitmapMaterial, _arg3:ShadedMaterial):void{
origin = new Point(0, 0);
super();
shaderRenderer = new ShaderRenderer();
lightMatrices = new Dictionary();
uvMatrices = new Dictionary();
this.object = _arg1;
this.material = _arg2;
this.shadedMaterial = _arg3;
triangleUVS = new Dictionary();
renderTriangleUVS = new Dictionary();
triangleBitmaps = new Dictionary();
triangleRects = new Dictionary();
}
public function getRectFor(_arg1:Triangle3D):Rectangle{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (!triangleRects[_arg1]){
_local2 = material.bitmap.width;
_local3 = material.bitmap.height;
_local4 = (_arg1.uv[0].u * _local2);
_local5 = ((1 - _arg1.uv[0].v) * _local3);
_local6 = (_arg1.uv[1].u * _local2);
_local7 = ((1 - _arg1.uv[1].v) * _local3);
_local8 = (_arg1.uv[2].u * _local2);
_local9 = ((1 - _arg1.uv[2].v) * _local3);
_local10 = Math.min(Math.min(_local4, _local6), _local8);
_local11 = Math.min(Math.min(_local5, _local7), _local9);
_local12 = Math.max(Math.max(_local4, _local6), _local8);
_local13 = Math.max(Math.max(_local5, _local7), _local9);
_local14 = (_local12 - _local10);
_local15 = (_local13 - _local11);
if (_local14 <= 0){
_local14 = 1;
};
if (_local15 <= 0){
_local15 = 1;
};
return ((triangleRects[_arg1] = new Rectangle(_local10, _local11, _local14, _local15)));
};
return (triangleRects[_arg1]);
}
private function perturbUVMatrix(_arg1:Matrix, _arg2:Triangle3D, _arg3:Number=2):void{
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:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_local4 = material.bitmap.width;
_local5 = material.bitmap.height;
_local6 = _arg2.uv[0].u;
_local7 = (1 - _arg2.uv[0].v);
_local8 = _arg2.uv[1].u;
_local9 = (1 - _arg2.uv[1].v);
_local10 = _arg2.uv[2].u;
_local11 = (1 - _arg2.uv[2].v);
_local12 = (_local6 * _local4);
_local13 = (_local7 * _local5);
_local14 = (_local8 * _local4);
_local15 = (_local9 * _local5);
_local16 = (_local10 * _local4);
_local17 = (_local11 * _local5);
_local18 = (((_local10 + _local8) + _local6) / 3);
_local19 = (((_local11 + _local9) + _local7) / 3);
_local20 = (_local6 - _local18);
_local21 = (_local7 - _local19);
_local22 = (_local8 - _local18);
_local23 = (_local9 - _local19);
_local24 = (_local10 - _local18);
_local25 = (_local11 - _local19);
_local26 = ((_local20)<0) ? -(_local20) : _local20;
_local27 = ((_local21)<0) ? -(_local21) : _local21;
_local28 = ((_local22)<0) ? -(_local22) : _local22;
_local29 = ((_local23)<0) ? -(_local23) : _local23;
_local30 = ((_local24)<0) ? -(_local24) : _local24;
_local31 = ((_local25)<0) ? -(_local25) : _local25;
_local32 = ((_local26)>_local27) ? (1 / _local26) : (1 / _local27);
_local33 = ((_local28)>_local29) ? (1 / _local28) : (1 / _local29);
_local34 = ((_local30)>_local31) ? (1 / _local30) : (1 / _local31);
_local12 = (_local12 - ((-(_local20) * _local32) * _arg3));
_local13 = (_local13 - ((-(_local21) * _local32) * _arg3));
_local14 = (_local14 - ((-(_local22) * _local33) * _arg3));
_local15 = (_local15 - ((-(_local23) * _local33) * _arg3));
_local16 = (_local16 - ((-(_local24) * _local34) * _arg3));
_local17 = (_local17 - ((-(_local25) * _local34) * _arg3));
_arg1.tx = _local12;
_arg1.ty = _local13;
_arg1.a = (_local14 - _local12);
_arg1.b = (_local15 - _local13);
_arg1.c = (_local16 - _local12);
_arg1.d = (_local17 - _local13);
}
public function getOutputBitmapFor(_arg1:Triangle3D):BitmapData{
var _local2:Rectangle;
var _local3:BitmapData;
var _local4:Rectangle;
if (!triangleBitmaps[_arg1]){
_local2 = getRectFor(_arg1);
_local3 = (triangleBitmaps[_arg1] = new BitmapData(Math.ceil(_local2.width), Math.ceil(_local2.height), false, 0));
_local4 = new Rectangle(0, 0, _local3.width, _local3.height);
_local3.copyPixels(material.bitmap, _local4, origin);
} else {
_local2 = getRectFor(_arg1);
};
if (((material.bitmap) && (_local2))){
triangleBitmaps[_arg1].copyPixels(material.bitmap, _local2, origin);
};
return (triangleBitmaps[_arg1]);
}
public function updateBeforeRender():void{
}
public function getPerTriUVForShader(_arg1:Triangle3D):Matrix{
var _local2:Matrix;
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:Rectangle;
if (!renderTriangleUVS[_arg1]){
_local2 = (renderTriangleUVS[_arg1] = new Matrix());
_local3 = material.bitmap.width;
_local4 = material.bitmap.height;
_local5 = (_arg1.uv[0].u * _local3);
_local6 = ((1 - _arg1.uv[0].v) * _local4);
_local7 = (_arg1.uv[1].u * _local3);
_local8 = ((1 - _arg1.uv[1].v) * _local4);
_local9 = (_arg1.uv[2].u * _local3);
_local10 = ((1 - _arg1.uv[2].v) * _local4);
_local11 = getRectFor(_arg1);
_local2.tx = (_local5 - _local11.x);
_local2.ty = (_local6 - _local11.y);
_local2.a = (_local7 - _local5);
_local2.b = (_local8 - _local6);
_local2.c = (_local9 - _local5);
_local2.d = (_local10 - _local6);
};
return (renderTriangleUVS[_arg1]);
}
public function getPerTriUVForDraw(_arg1:Triangle3D):Matrix{
var _local2:Matrix;
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:Rectangle;
if (!triangleUVS[_arg1]){
_local2 = (triangleUVS[_arg1] = new Matrix());
_local3 = material.bitmap.width;
_local4 = material.bitmap.height;
_local5 = (_arg1.uv[0].u * _local3);
_local6 = ((1 - _arg1.uv[0].v) * _local4);
_local7 = (_arg1.uv[1].u * _local3);
_local8 = ((1 - _arg1.uv[1].v) * _local4);
_local9 = (_arg1.uv[2].u * _local3);
_local10 = ((1 - _arg1.uv[2].v) * _local4);
_local11 = getRectFor(_arg1);
_local2.tx = (_local5 - _local11.x);
_local2.ty = (_local6 - _local11.y);
_local2.a = (_local7 - _local5);
_local2.b = (_local8 - _local6);
_local2.c = (_local9 - _local5);
_local2.d = (_local10 - _local6);
_local2.invert();
};
return (triangleUVS[_arg1]);
}
public function getUVMatrixForTriangle(_arg1:Triangle3D, _arg2:Boolean=false):Matrix{
var _local3:Matrix;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local3 = uvMatrices[_arg1];
if (!_local3){
_local3 = new Matrix();
if (_arg2){
perturbUVMatrix(_local3, _arg1, 2);
} else {
if (material.bitmap){
_local4 = material.bitmap.width;
_local5 = material.bitmap.height;
_local6 = (_arg1.uv[0].u * _local4);
_local7 = ((1 - _arg1.uv[0].v) * _local5);
_local8 = (_arg1.uv[1].u * _local4);
_local9 = ((1 - _arg1.uv[1].v) * _local5);
_local10 = (_arg1.uv[2].u * _local4);
_local11 = ((1 - _arg1.uv[2].v) * _local5);
_local3.tx = _local6;
_local3.ty = _local7;
_local3.a = (_local8 - _local6);
_local3.b = (_local9 - _local7);
_local3.c = (_local10 - _local6);
_local3.d = (_local11 - _local7);
};
};
if (material.bitmap){
uvMatrices[_arg1] = _local3;
};
};
return (_local3);
}
public function destroy():void{
var _local1:Object;
for each (_local1 in uvMatrices) {
uvMatrices[_local1] = null;
};
uvMatrices = null;
shaderRenderer.destroy();
shaderRenderer = null;
lightMatrices = null;
}
}
}//package org.papervision3d.core.render.shader
Section 81
//ShaderRenderer (org.papervision3d.core.render.shader.ShaderRenderer)
package org.papervision3d.core.render.shader {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.materials.shaders.*;
import flash.utils.*;
public class ShaderRenderer extends EventDispatcher implements IShaderRenderer {
public var container:Sprite;
public var outputBitmap:BitmapData;
public var bitmapContainer:Bitmap;
public var shadeLayers:Dictionary;
public var bitmapLayer:Sprite;
private var _inputBitmapData:BitmapData;
public var resizedInput:Boolean;// = false
public function ShaderRenderer(){
resizedInput = false;
super();
container = new Sprite();
bitmapLayer = new Sprite();
bitmapContainer = new Bitmap();
bitmapLayer.addChild(bitmapContainer);
bitmapLayer.blendMode = BlendMode.NORMAL;
shadeLayers = new Dictionary();
container.addChild(bitmapLayer);
}
public function destroy():void{
bitmapLayer = null;
outputBitmap.dispose();
}
public function getLayerForShader(_arg1:Shader):Sprite{
var _local2:Sprite;
var _local3:Sprite;
_local2 = new Sprite();
shadeLayers[_arg1] = _local2;
_local3 = new Sprite();
_local2.addChild(_local3);
if (inputBitmap != null){
_local3.graphics.beginFill(0, 0);
_local3.graphics.drawRect(0, 0, inputBitmap.width, inputBitmap.height);
_local3.graphics.endFill();
};
container.addChild(_local2);
_local2.blendMode = _arg1.layerBlendMode;
return (_local2);
}
public function get inputBitmap():BitmapData{
return (_inputBitmapData);
}
public function clear():void{
var _local1:Sprite;
for each (_local1 in shadeLayers) {
if (((((inputBitmap) && ((inputBitmap.width > 0)))) && ((inputBitmap.height > 0)))){
_local1.graphics.clear();
_local1.graphics.beginFill(0, 1);
_local1.graphics.drawRect(0, 0, inputBitmap.width, inputBitmap.height);
_local1.graphics.endFill();
};
};
}
public function render(_arg1:RenderSessionData):void{
if (outputBitmap){
outputBitmap.fillRect(outputBitmap.rect, 0);
bitmapContainer.bitmapData = inputBitmap;
outputBitmap.draw(container, null, null, null, outputBitmap.rect, false);
if (outputBitmap.transparent){
outputBitmap.copyChannel(inputBitmap, outputBitmap.rect, new Point(0, 0), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
};
};
}
public function set inputBitmap(_arg1:BitmapData):void{
if (_arg1 != null){
if (_inputBitmapData != _arg1){
_inputBitmapData = _arg1;
if (outputBitmap){
if (((!((_inputBitmapData.width == outputBitmap.width))) || (!((_inputBitmapData.height == outputBitmap.height))))){
resizedInput = true;
outputBitmap.dispose();
outputBitmap = _inputBitmapData.clone();
};
} else {
resizedInput = true;
outputBitmap = _inputBitmapData.clone();
};
};
};
}
}
}//package org.papervision3d.core.render.shader
Section 82
//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("screenZ", Array.NUMERIC);
}
}
}//package org.papervision3d.core.render.sort
Section 83
//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 84
//AbstractRenderEngine (org.papervision3d.core.render.AbstractRenderEngine)
package org.papervision3d.core.render {
import flash.events.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
public class AbstractRenderEngine extends EventDispatcher implements IRenderEngine {
public function AbstractRenderEngine(_arg1:IEventDispatcher=null){
super(_arg1);
}
public function removeFromRenderList(_arg1:IRenderListItem):int{
return (0);
}
public function addToRenderList(_arg1:RenderableListItem):int{
return (0);
}
public function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D):RenderStatistics{
return (null);
}
}
}//package org.papervision3d.core.render
Section 85
//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 addToRenderList(_arg1:RenderableListItem):int;
function removeFromRenderList(_arg1:IRenderListItem):int;
function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D):RenderStatistics;
}
}//package org.papervision3d.core.render
Section 86
//IVirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.core.utils.virtualmouse
Section 87
//VirtualMouse (org.papervision3d.core.utils.virtualmouse.VirtualMouse)
package org.papervision3d.core.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
public class VirtualMouse extends EventDispatcher {
private var _container:Sprite;
private var lastDownTarget:DisplayObject;
private var target:InteractiveObject;
private var updateMouseDown:Boolean;// = false
private var eventEvent:Class;
private var _lastEvent:Event;
private var mouseEventEvent:Class;
private var location:Point;
private var delta:int;// = 0
private var disabledEvents:Object;
private var ignoredInstances:Dictionary;
private var isLocked:Boolean;// = false
private var lastWithinStage:Boolean;// = true
private var lastLocation:Point;
private var isDoubleClickEvent:Boolean;// = false
private var lastMouseDown:Boolean;// = false
private var altKey:Boolean;// = false
private var _useNativeEvents:Boolean;// = false
private var ctrlKey:Boolean;// = false
private var shiftKey:Boolean;// = false
private var _stage:Stage;
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){
altKey = false;
ctrlKey = false;
shiftKey = false;
delta = 0;
isLocked = false;
isDoubleClickEvent = false;
disabledEvents = new Object();
ignoredInstances = new Dictionary(true);
lastMouseDown = false;
updateMouseDown = false;
lastWithinStage = true;
_useNativeEvents = false;
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
super();
this.stage = _arg1;
this.container = _arg2;
location = new Point(_arg3, _arg4);
lastLocation = location.clone();
addEventListener(UPDATE, handleUpdate);
update();
}
public function get mouseIsDown():Boolean{
return (_mouseIsDown);
}
public function get stage():Stage{
return (_stage);
}
public function get container():Sprite{
return (_container);
}
public function exitContainer():void{
var _local1:Point;
if (!container){
return;
};
_local1 = 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 release():void{
updateMouseDown = true;
_mouseIsDown = false;
if (!isLocked){
update();
};
}
public function click():void{
press();
release();
}
public function disableEvent(_arg1:String):void{
disabledEvents[_arg1] = true;
}
public function set container(_arg1:Sprite):void{
_container = _arg1;
}
public function get y():Number{
return (location.y);
}
public function set x(_arg1:Number):void{
location.x = _arg1;
if (!isLocked){
update();
};
}
public function get lastEvent():Event{
return (_lastEvent);
}
private function handleUpdate(_arg1:Event):void{
var _local2:Point;
var _local3:Array;
var _local4:InteractiveObject;
var _local5:DisplayObject;
var _local6:int;
var _local7:Point;
var _local8:Point;
var _local9:Boolean;
if (!container){
return;
};
if (container.scrollRect){
PaperLogger.warning("The container that virtualMouse is trying to test against has a scrollRect defined, and may cause an issue with finding objects under a defined point. Use MovieMaterial.rect to set a rectangle area instead");
};
_local2 = new Point();
_local2.x = container.x;
_local2.y = container.y;
container.x = (container.y = 0);
_local3 = container.getObjectsUnderPoint(location);
container.x = _local2.x;
container.y = _local2.y;
_local6 = _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;
};
_local7 = target.globalToLocal(location);
_local8 = _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;
}
public function getLocation():Point{
return (location.clone());
}
public function get x():Number{
return (location.x);
}
public function lock():void{
isLocked = true;
}
public function get useNativeEvents():Boolean{
return (_useNativeEvents);
}
public function setLocation(_arg1, _arg2=null):void{
var _local3:Point;
if ((_arg1 is Point)){
_local3 = (_arg1 as Point);
location.x = _local3.x;
location.y = _local3.y;
} else {
location.x = Number(_arg1);
location.y = Number(_arg2);
};
if (!isLocked){
update();
};
}
private function keyHandler(_arg1:KeyboardEvent):void{
altKey = _arg1.altKey;
ctrlKey = _arg1.ctrlKey;
shiftKey = _arg1.shiftKey;
}
public function unignore(_arg1:DisplayObject):void{
if ((_arg1 in ignoredInstances)){
delete ignoredInstances[_arg1];
};
}
public function doubleClick():void{
if (isLocked){
release();
} else {
click();
press();
isDoubleClickEvent = true;
release();
isDoubleClickEvent = false;
};
}
public function update():void{
dispatchEvent(new Event(UPDATE, false, false));
}
public function unlock():void{
isLocked = false;
update();
}
public function ignore(_arg1:DisplayObject):void{
ignoredInstances[_arg1] = true;
}
public function enableEvent(_arg1:String):void{
if ((_arg1 in disabledEvents)){
delete disabledEvents[_arg1];
};
}
public function press():void{
updateMouseDown = true;
_mouseIsDown = true;
if (!isLocked){
update();
};
}
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 set y(_arg1:Number):void{
location.y = _arg1;
if (!isLocked){
update();
};
}
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();
};
};
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 88
//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 89
//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 90
//InteractiveSceneManager (org.papervision3d.core.utils.InteractiveSceneManager)
package org.papervision3d.core.utils {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.utils.virtualmouse.*;
import org.papervision3d.events.*;
public class InteractiveSceneManager extends EventDispatcher {
public var container:Sprite;
public var currentMousePos:Point;
public var currentDisplayObject3D:DisplayObject3D;
public var lastMousePos:Point;
public var viewport:Viewport3D;
public var currentMaterial:MaterialObject3D;
public var debug:Boolean;// = false
public var mouse3D:Mouse3D;
public var enableOverOut:Boolean;// = true
public var virtualMouse:VirtualMouse;
public var _viewportRendered:Boolean;// = false
public var renderHitData:RenderHitData;
public var currentMouseDO3D:DisplayObject3D;// = null
public static var MOUSE_IS_DOWN:Boolean = false;
public function InteractiveSceneManager(_arg1:Viewport3D){
virtualMouse = new VirtualMouse();
mouse3D = new Mouse3D();
enableOverOut = true;
currentMouseDO3D = null;
debug = false;
currentMousePos = new Point();
lastMousePos = new Point();
_viewportRendered = false;
super();
this.viewport = _arg1;
this.container = _arg1.containerSprite;
init();
}
public function updateAfterRender():void{
_viewportRendered = true;
}
protected function initVirtualMouse():void{
virtualMouse.stage = container.stage;
virtualMouse.container = container;
}
public function initListeners():void{
if (viewport.interactive){
container.addEventListener(MouseEvent.MOUSE_DOWN, handleMousePress, false, 0, true);
container.addEventListener(MouseEvent.MOUSE_UP, handleMouseRelease, false, 0, true);
container.addEventListener(MouseEvent.CLICK, handleMouseClick, false, 0, true);
container.addEventListener(MouseEvent.DOUBLE_CLICK, handleMouseDoubleClick, false, 0, true);
container.stage.addEventListener(Event.ENTER_FRAME, handleEnterFrame);
};
}
protected function handleMouseDoubleClick(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_DOUBLE_CLICK, currentDisplayObject3D);
};
}
public function updateRenderHitData():void{
resolveRenderHitData();
currentDisplayObject3D = renderHitData.displayObject3D;
currentMaterial = renderHitData.material;
manageOverOut();
}
public function init():void{
if (container){
if (container.stage){
initVirtualMouse();
initListeners();
} else {
container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
};
};
}
protected function handleMouseClick(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_CLICK, currentDisplayObject3D);
};
}
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 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 handleEnterFrame(_arg1:Event):void{
var _local2:Boolean;
var _local3:MovieMaterial;
currentMousePos.x = container.mouseX;
currentMousePos.y = container.mouseY;
_local2 = !(currentMousePos.equals(lastMousePos));
if (((_local2) || (_viewportRendered))){
updateRenderHitData();
_viewportRendered = false;
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((virtualMouse) && (renderHitData))){
_local3 = (currentMaterial as MovieMaterial);
if (_local3){
virtualMouse.container = (_local3.movie as Sprite);
};
if (virtualMouse.container){
virtualMouse.setLocation(renderHitData.u, renderHitData.v);
};
if (((((Mouse3D.enabled) && (renderHitData))) && (renderHitData.hasHit))){
mouse3D.updatePosition(renderHitData);
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
} else {
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
};
};
};
lastMousePos.x = currentMousePos.x;
lastMousePos.y = currentMousePos.y;
}
protected function dispatchObjectEvent(_arg1:String, _arg2:DisplayObject3D):void{
var _local3:Number;
var _local4:Number;
var _local5:InteractiveScene3DEvent;
if (((renderHitData) && (renderHitData.hasHit))){
_local3 = (renderHitData.u) ? renderHitData.u : 0;
_local4 = (renderHitData.v) ? renderHitData.v : 0;
_local5 = new InteractiveScene3DEvent(_arg1, _arg2, container, (renderHitData.renderable as Triangle3D), _local3, _local4, renderHitData);
_local5.renderHitData = renderHitData;
dispatchEvent(_local5);
_arg2.dispatchEvent(_local5);
} else {
dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container));
if (_arg2){
_arg2.dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container));
};
};
}
protected function handleMouseOver(_arg1:DisplayObject3D):void{
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OVER, _arg1);
}
protected function resolveRenderHitData():void{
renderHitData = (viewport.hitTestPoint2D(currentMousePos) 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 handleAddedToStage(_arg1:Event):void{
initVirtualMouse();
initListeners();
}
public function destroy():void{
viewport = null;
renderHitData = null;
currentDisplayObject3D = null;
currentMaterial = null;
currentMouseDO3D = null;
container.removeEventListener(MouseEvent.MOUSE_DOWN, handleMousePress);
container.removeEventListener(MouseEvent.MOUSE_UP, handleMouseRelease);
container.removeEventListener(MouseEvent.CLICK, handleMouseClick);
container.removeEventListener(MouseEvent.DOUBLE_CLICK, handleMouseDoubleClick);
if (container.stage){
container.stage.removeEventListener(Event.ENTER_FRAME, handleEnterFrame);
};
container = null;
}
}
}//package org.papervision3d.core.utils
Section 91
//Mouse3D (org.papervision3d.core.utils.Mouse3D)
package org.papervision3d.core.utils {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
public class Mouse3D extends DisplayObject3D {
private var target:Number3D;
public static var enabled:Boolean = false;
private static var UP:Number3D = new Number3D(0, 1, 0);
public function Mouse3D():void{
target = new Number3D();
super();
}
public function updatePosition(_arg1:RenderHitData):void{
var _local2:Triangle3D;
var _local3:Number3D;
var _local4:Matrix3D;
var _local5:Number3D;
var _local6:Number3D;
var _local7:Matrix3D;
_local2 = (_arg1.renderable as Triangle3D);
target.x = _local2.faceNormal.x;
target.y = _local2.faceNormal.y;
target.z = _local2.faceNormal.z;
_local3 = Number3D.sub(target, position);
_local3.normalize();
if (_local3.modulo > 0.1){
_local5 = Number3D.cross(_local3, UP);
_local5.normalize();
_local6 = Number3D.cross(_local3, _local5);
_local6.normalize();
_local7 = this.transform;
_local7.n11 = _local5.x;
_local7.n21 = _local5.y;
_local7.n31 = _local5.z;
_local7.n12 = -(_local6.x);
_local7.n22 = -(_local6.y);
_local7.n32 = -(_local6.z);
_local7.n13 = _local3.x;
_local7.n23 = _local3.y;
_local7.n33 = _local3.z;
};
_local4 = Matrix3D.IDENTITY;
this.transform = Matrix3D.multiply(_local2.instance.world, _local7);
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
}
}//package org.papervision3d.core.utils
Section 92
//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 elapsedTime:int;
private var stopTime:int;
private var isRunning:Boolean;
public function stop():int{
if (isRunning){
stopTime = getTimer();
elapsedTime = (stopTime - startTime);
isRunning = false;
return (elapsedTime);
};
return (0);
}
public function start():void{
if (!isRunning){
startTime = getTimer();
isRunning = true;
};
}
public function reset():void{
isRunning = false;
}
}
}//package org.papervision3d.core.utils
Section 93
//IViewport3D (org.papervision3d.core.view.IViewport3D)
package org.papervision3d.core.view {
import org.papervision3d.core.render.data.*;
public interface IViewport3D {
function updateAfterRender(_arg1:RenderSessionData):void;
function updateBeforeRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.view
Section 94
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class InteractiveScene3DEvent extends Event {
public var sprite:Sprite;// = null
public var displayObject3D:DisplayObject3D;// = null
public var face3d:Triangle3D;// = null
public var renderHitData:RenderHitData;
public var x:Number;// = 0
public var y:Number;// = 0
public static const OBJECT_ADDED:String = "objectAdded";
public static const OBJECT_PRESS:String = "mousePress";
public static const OBJECT_RELEASE:String = "mouseRelease";
public static const OBJECT_CLICK:String = "mouseClick";
public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
public static const OBJECT_OUT:String = "mouseOut";
public static const OBJECT_MOVE:String = "mouseMove";
public static const OBJECT_OVER:String = "mouseOver";
public static const OBJECT_DOUBLE_CLICK:String = "mouseDoubleClick";
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){
displayObject3D = null;
sprite = null;
face3d = null;
x = 0;
y = 0;
super(_arg1, _arg8, _arg9);
this.displayObject3D = _arg2;
this.sprite = _arg3;
this.face3d = _arg4;
this.x = _arg5;
this.y = _arg6;
this.renderHitData = _arg7;
}
override public function toString():String{
return (((((((("Type : " + type) + ", DO3D : ") + displayObject3D) + " Sprite : ") + sprite) + " Face : ") + face3d));
}
}
}//package org.papervision3d.events
Section 95
//RendererEvent (org.papervision3d.events.RendererEvent)
package org.papervision3d.events {
import flash.events.*;
import org.papervision3d.core.render.data.*;
public class RendererEvent extends Event {
public var renderSessionData:RenderSessionData;
public static const PROJECTION_DONE:String = "projectionDone";
public static const RENDER_DONE:String = "renderDone";
public function RendererEvent(_arg1:String, _arg2:RenderSessionData){
super(_arg1);
this.renderSessionData = _arg2;
}
public function clear():void{
renderSessionData = null;
}
override public function clone():Event{
return (new RendererEvent(type, renderSessionData));
}
}
}//package org.papervision3d.events
Section 96
//PointLight3D (org.papervision3d.lights.PointLight3D)
package org.papervision3d.lights {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
public class PointLight3D extends LightObject3D {
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
public function PointLight3D(_arg1:Boolean=false, _arg2:Boolean=false){
super(_arg1, _arg2);
x = DEFAULT_POS.x;
y = DEFAULT_POS.y;
z = DEFAULT_POS.z;
}
}
}//package org.papervision3d.lights
Section 97
//ILightShader (org.papervision3d.materials.shaders.ILightShader)
package org.papervision3d.materials.shaders {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.shader.*;
public interface ILightShader {
function updateLightMatrix(_arg1:ShaderObjectData, _arg2:RenderSessionData):void;
}
}//package org.papervision3d.materials.shaders
Section 98
//IShader (org.papervision3d.materials.shaders.IShader)
package org.papervision3d.materials.shaders {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.shader.*;
public interface IShader {
function renderTri(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData, _arg4:BitmapData):void;
function updateAfterRender(_arg1:RenderSessionData, _arg2:ShaderObjectData):void;
function destroy():void;
function renderLayer(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData):void;
}
}//package org.papervision3d.materials.shaders
Section 99
//ShadedMaterial (org.papervision3d.materials.shaders.ShadedMaterial)
package org.papervision3d.materials.shaders {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.shader.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class ShadedMaterial extends TriangleMaterial implements ITriangleDrawer, IUpdateBeforeMaterial, IUpdateAfterMaterial {
private var _shaderCompositeMode:int;
public var material:BitmapMaterial;
public var shader:Shader;
public var shaderObjectData:Dictionary;
private static var bmp:BitmapData;
public function ShadedMaterial(_arg1:BitmapMaterial, _arg2:Shader, _arg3:int=0){
this.shader = _arg2;
this.material = _arg1;
shaderCompositeMode = _arg3;
init();
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:ShaderObjectData;
_local6 = ShaderObjectData(shaderObjectData[_arg1.renderableInstance.instance]);
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
material.drawTriangle(_arg1, _arg2, _arg3, _local6.shaderRenderer.outputBitmap);
shader.renderLayer(_arg1.triangle, _arg3, _local6);
} else {
if (shaderCompositeMode == ShaderCompositeModes.PER_TRIANGLE_IN_BITMAP){
bmp = _local6.getOutputBitmapFor(_arg1.triangle);
material.drawTriangle(_arg1, _arg2, _arg3, bmp, (_local6.triangleUVS[_arg1.triangle]) ? _local6.triangleUVS[_arg1.triangle] : _local6.getPerTriUVForDraw(_arg1.triangle));
shader.renderTri(_arg1.triangle, _arg3, _local6, bmp);
};
};
}
override public function destroy():void{
var _local1:ShaderObjectData;
super.destroy();
for each (_local1 in shaderObjectData) {
_local1.destroy();
};
material = null;
shader = null;
}
private function init():void{
shaderObjectData = new Dictionary();
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:ShaderObjectData;
var _local3:ILightShader;
for each (_local2 in shaderObjectData) {
_local2.shaderRenderer.inputBitmap = material.bitmap;
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
if (_local2.shaderRenderer.resizedInput){
_local2.shaderRenderer.resizedInput = false;
_local2.uvMatrices = new Dictionary();
};
_local2.shaderRenderer.clear();
};
if ((shader is ILightShader)){
_local3 = (shader as ILightShader);
_local3.updateLightMatrix(_local2, _arg1);
};
};
}
public function updateAfterRender(_arg1:RenderSessionData):void{
var _local2:ShaderObjectData;
for each (_local2 in shaderObjectData) {
shader.updateAfterRender(_arg1, _local2);
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
_local2.shaderRenderer.render(_arg1);
};
};
}
override public function unregisterObject(_arg1:DisplayObject3D):void{
var _local2:ShaderObjectData;
super.unregisterObject(_arg1);
_local2 = shaderObjectData[_arg1];
_local2.destroy();
delete shaderObjectData[_arg1];
}
public function set shaderCompositeMode(_arg1:int):void{
_shaderCompositeMode = _arg1;
}
override public function registerObject(_arg1:DisplayObject3D):void{
var _local2:ShaderObjectData;
super.registerObject(_arg1);
_local2 = (shaderObjectData[_arg1] = new ShaderObjectData(_arg1, material, this));
_local2.shaderRenderer.inputBitmap = material.bitmap;
shader.setContainerForObject(_arg1, _local2.shaderRenderer.getLayerForShader(shader));
}
public function getOutputBitmapDataFor(_arg1:DisplayObject3D):BitmapData{
var _local2:ShaderObjectData;
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
if (shaderObjectData[_arg1]){
_local2 = ShaderObjectData(shaderObjectData[_arg1]);
return (_local2.shaderRenderer.outputBitmap);
};
PaperLogger.warning("object not registered with shaded material");
} else {
PaperLogger.warning("getOutputBitmapDataFor only works on per layer mode");
};
return (null);
}
public function get shaderCompositeMode():int{
return (_shaderCompositeMode);
}
}
}//package org.papervision3d.materials.shaders
Section 100
//Shader (org.papervision3d.materials.shaders.Shader)
package org.papervision3d.materials.shaders {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.shader.*;
import flash.utils.*;
import flash.filters.*;
public class Shader extends EventDispatcher implements IShader {
protected var layers:Dictionary;
protected var _filter:BitmapFilter;
protected var _blendMode:String;// = "multiply"
protected var _object:DisplayObject3D;
public function Shader(){
_blendMode = BlendMode.MULTIPLY;
super();
this.layers = new Dictionary(true);
}
public function get layerBlendMode():String{
return (_blendMode);
}
public function updateAfterRender(_arg1:RenderSessionData, _arg2:ShaderObjectData):void{
}
public function renderLayer(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData):void{
}
public function set layerBlendMode(_arg1:String):void{
_blendMode = _arg1;
}
public function setContainerForObject(_arg1:DisplayObject3D, _arg2:Sprite):void{
layers[_arg1] = _arg2;
}
public function set filter(_arg1:BitmapFilter):void{
_filter = _arg1;
}
public function renderTri(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData, _arg4:BitmapData):void{
}
public function get filter():BitmapFilter{
return (_filter);
}
public function destroy():void{
}
}
}//package org.papervision3d.materials.shaders
Section 101
//ShaderCompositeModes (org.papervision3d.materials.shaders.ShaderCompositeModes)
package org.papervision3d.materials.shaders {
public class ShaderCompositeModes {
public static var PER_TRIANGLE_IN_BITMAP:int = 1;
public static var PER_LAYER:int = 0;
}
}//package org.papervision3d.materials.shaders
Section 102
//CompositeMaterial (org.papervision3d.materials.special.CompositeMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class CompositeMaterial extends TriangleMaterial implements ITriangleDrawer {
public var materials:Array;
public function CompositeMaterial(){
init();
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:MaterialObject3D;
for each (_local6 in materials) {
if (!_local6.invisible){
_local6.drawTriangle(_arg1, _arg2, _arg3);
};
};
}
private function init():void{
materials = new Array();
}
override public function unregisterObject(_arg1:DisplayObject3D):void{
var _local2:MaterialObject3D;
super.unregisterObject(_arg1);
for each (_local2 in materials) {
_local2.unregisterObject(_arg1);
};
}
public function removeAllMaterials():void{
materials = new Array();
}
override public function registerObject(_arg1:DisplayObject3D):void{
var _local2:MaterialObject3D;
super.registerObject(_arg1);
for each (_local2 in materials) {
_local2.registerObject(_arg1);
};
}
public function removeMaterial(_arg1:MaterialObject3D):void{
materials.splice(materials.indexOf(_arg1), 1);
}
public function addMaterial(_arg1:MaterialObject3D):void{
var _local2:Object;
var _local3:DisplayObject3D;
materials.push(_arg1);
for (_local2 in objects) {
_local3 = (_local2 as DisplayObject3D);
_arg1.registerObject(_local3);
};
}
}
}//package org.papervision3d.materials.special
Section 103
//LineMaterial (org.papervision3d.materials.special.LineMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.render.draw.*;
public class LineMaterial extends MaterialObject3D implements ILineDrawer {
public function LineMaterial(_arg1:Number=0xFF0000, _arg2:Number=1){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
}
public function drawLine(_arg1:RenderLine, _arg2:Graphics, _arg3:RenderSessionData):void{
_arg2.lineStyle(_arg1.size, lineColor, lineAlpha);
_arg2.moveTo(_arg1.v0.x, _arg1.v0.y);
if (_arg1.cV){
_arg2.curveTo(_arg1.cV.x, _arg1.cV.y, _arg1.v1.x, _arg1.v1.y);
} else {
_arg2.lineTo(_arg1.v1.x, _arg1.v1.y);
};
_arg2.moveTo(0, 0);
_arg2.lineStyle();
}
}
}//package org.papervision3d.materials.special
Section 104
//ParticleMaterial (org.papervision3d.materials.special.ParticleMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.render.draw.*;
public class ParticleMaterial extends MaterialObject3D implements IParticleDrawer {
public var shape:int;
public static var SHAPE_SQUARE:int = 0;
public static var SHAPE_CIRCLE:int = 1;
public function ParticleMaterial(_arg1:Number, _arg2:Number, _arg3:int=0){
this.shape = _arg3;
this.fillAlpha = _arg2;
this.fillColor = _arg1;
}
public function updateRenderRect(_arg1:Particle):void{
var _local2:Rectangle;
_local2 = _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));
}
public function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void{
var _local4:Rectangle;
_arg2.beginFill(fillColor, fillAlpha);
_local4 = _arg1.renderRect;
if (shape == SHAPE_SQUARE){
_arg2.drawRect(_local4.x, _local4.y, _local4.width, _local4.height);
} else {
if (shape == SHAPE_CIRCLE){
_arg2.drawCircle((_local4.x + (_local4.width / 2)), (_local4.y + (_local4.width / 2)), (_local4.width / 2));
} else {
PaperLogger.warning("Particle material has no valid shape - Must be ParticleMaterial.SHAPE_SQUARE or ParticleMaterial.SHAPE_CIRCLE");
};
};
_arg2.endFill();
_arg3.renderStatistics.particles++;
}
}
}//package org.papervision3d.materials.special
Section 105
//LightMatrix (org.papervision3d.materials.utils.LightMatrix)
package org.papervision3d.materials.utils {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.*;
import org.papervision3d.lights.*;
public class LightMatrix {
private static var _targetPos:Number3D = new Number3D();
private static var _lightUp:Number3D = new Number3D();
private static var _lightSide:Number3D = new Number3D();
private static var _lightDir:Number3D = new Number3D();
private static var lightMatrix:Matrix3D = Matrix3D.IDENTITY;
private static var invMatrix:Matrix3D = Matrix3D.IDENTITY;
protected static var UP:Number3D = new Number3D(0, 1, 0);
private static var _lightPos:Number3D = new Number3D();
public static function getLightMatrix(_arg1:LightObject3D, _arg2:DisplayObject3D, _arg3:RenderSessionData, _arg4:Matrix3D):Matrix3D{
var _local5:Matrix3D;
var _local6:Matrix3D;
var _local7:Matrix3D;
_local5 = (_arg4) ? _arg4 : Matrix3D.IDENTITY;
if (_arg1 == null){
_arg1 = new PointLight3D();
_arg1.copyPosition(_arg3.camera);
};
_targetPos.reset();
_lightPos.reset();
_lightDir.reset();
_lightUp.reset();
_lightSide.reset();
_local6 = _arg1.transform;
_local7 = _arg2.world;
_lightPos.x = -(_local6.n14);
_lightPos.y = -(_local6.n24);
_lightPos.z = -(_local6.n34);
_targetPos.x = -(_local7.n14);
_targetPos.y = -(_local7.n24);
_targetPos.z = -(_local7.n34);
_lightDir.x = (_targetPos.x - _lightPos.x);
_lightDir.y = (_targetPos.y - _lightPos.y);
_lightDir.z = (_targetPos.z - _lightPos.z);
invMatrix.calculateInverse(_arg2.world);
Matrix3D.multiplyVector3x3(invMatrix, _lightDir);
_lightDir.normalize();
_lightSide.x = ((_lightDir.y * UP.z) - (_lightDir.z * UP.y));
_lightSide.y = ((_lightDir.z * UP.x) - (_lightDir.x * UP.z));
_lightSide.z = ((_lightDir.x * UP.y) - (_lightDir.y * UP.x));
_lightSide.normalize();
_lightUp.x = ((_lightSide.y * _lightDir.z) - (_lightSide.z * _lightDir.y));
_lightUp.y = ((_lightSide.z * _lightDir.x) - (_lightSide.x * _lightDir.z));
_lightUp.z = ((_lightSide.x * _lightDir.y) - (_lightSide.y * _lightDir.x));
_lightUp.normalize();
if (((Papervision3D.useRIGHTHANDED) || (_arg2.flipLightDirection))){
_lightDir.x = -(_lightDir.x);
_lightDir.y = -(_lightDir.y);
_lightDir.z = -(_lightDir.z);
};
_local5.n11 = _lightSide.x;
_local5.n12 = _lightSide.y;
_local5.n13 = _lightSide.z;
_local5.n21 = _lightUp.x;
_local5.n22 = _lightUp.y;
_local5.n23 = _lightUp.z;
_local5.n31 = _lightDir.x;
_local5.n32 = _lightDir.y;
_local5.n33 = _lightDir.z;
return (_local5);
}
}
}//package org.papervision3d.materials.utils
Section 106
//MaterialsList (org.papervision3d.materials.utils.MaterialsList)
package org.papervision3d.materials.utils {
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MaterialsList {
protected var _materials:Dictionary;
public var materialsByName: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 (_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{
if (this._materials[_arg1]){
delete this.materialsByName[this._materials[_arg1]];
delete this._materials[_arg1];
_materialsTotal--;
};
return (_arg1);
}
public function toString():String{
var _local1:String;
var _local2:MaterialObject3D;
_local1 = "";
for each (_local2 in this.materialsByName) {
_local1 = (_local1 + (this._materials[_local2] + "\n"));
};
return (_local1);
}
public function removeMaterialByName(_arg1:String):MaterialObject3D{
return (removeMaterial(getMaterialByName(_arg1)));
}
public function clone():MaterialsList{
var _local1:MaterialsList;
var _local2:MaterialObject3D;
_local1 = new MaterialsList();
for each (_local2 in this.materialsByName) {
_local1.addMaterial(_local2.clone(), this._materials[_local2]);
};
return (_local1);
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
return ((this.materialsByName[_arg1]) ? this.materialsByName[_arg1] : this.materialsByName["all"]);
}
}
}//package org.papervision3d.materials.utils
Section 107
//PrecisionMode (org.papervision3d.materials.utils.PrecisionMode)
package org.papervision3d.materials.utils {
public class PrecisionMode {
public static var ORIGINAL:int = 0;
public static var STABLE:int = 1;
}
}//package org.papervision3d.materials.utils
Section 108
//RenderRecStorage (org.papervision3d.materials.utils.RenderRecStorage)
package org.papervision3d.materials.utils {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
public class RenderRecStorage {
public var mat:Matrix;
public var v0:Vertex3DInstance;
public var v1:Vertex3DInstance;
public var v2:Vertex3DInstance;
public function RenderRecStorage(){
v0 = new Vertex3DInstance();
v1 = new Vertex3DInstance();
v2 = new Vertex3DInstance();
mat = new Matrix();
super();
}
}
}//package org.papervision3d.materials.utils
Section 109
//BitmapAssetMaterial (org.papervision3d.materials.BitmapAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
public class BitmapAssetMaterial extends BitmapMaterial implements ITriangleDrawer {
private static var _library:Object = new Object();
private static var _count:Object = new Object();
public function BitmapAssetMaterial(_arg1:String, _arg2:Boolean=false){
texture = _arg1;
this.precise = _arg2;
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is String) == false){
PaperLogger.error("BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmapFromLinkageID(String(_arg1));
_texture = _arg1;
}
protected function createBitmapFromLinkageID(_arg1:String):BitmapData{
var _local2:BitmapData;
var _local3:BitmapData;
var _local4:BitmapData;
var _local5:Class;
var _local6:XML;
if (this._texture != _arg1){
var _local7 = _count;
var _local8 = this._texture;
var _local9 = (_local7[_local8] - 1);
_local7[_local8] = _local9;
_local4 = _library[this._texture];
if (((_local4) && ((_count[this._texture] == 0)))){
_local4.dispose();
};
};
_local3 = _library[_arg1];
if (!_local3){
_local5 = (getDefinitionByName(_arg1) as Class);
_local6 = describeType(_local5);
if (_local6..constructor.length() == 0){
_local3 = (new (_local5) as BitmapData);
} else {
_local3 = (new _local5(0, 0) as BitmapData);
};
_local2 = createBitmap(_local3);
_library[_arg1] = _local2;
_count[_arg1] = 0;
} else {
_local2 = _local3;
maxU = (maxV = 1);
_local7 = _count;
_local8 = _arg1;
_local9 = (_local7[_local8] + 1);
_local7[_local8] = _local9;
};
return (_local2);
}
}
}//package org.papervision3d.materials
Section 110
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
import org.papervision3d.core.material.*;
public class BitmapMaterial extends TriangleMaterial implements ITriangleDrawer {
protected var renderRecStorage:Array;
private var b2:Number;
private var c2:Number;
protected var ax:Number;
protected var az:Number;
protected var ay:Number;
protected var tempPreGrp:Graphics;
protected var mcay:Number;
protected var mcaz:Number;
private var d2:Number;
protected var bx:Number;
protected var by:Number;
protected var bz:Number;
protected var mcax:Number;
protected var cx:Number;
protected var cy:Number;
protected var cz:Number;
protected var cullRect:Rectangle;
protected var dmax:Number;
private var dx:Number;
private var dy:Number;
protected var _perPixelPrecision:int;// = 8
private var x0:Number;
private var x1:Number;
private var x2:Number;
protected var mbcy:Number;
protected var mbcz:Number;
protected var mbcx:Number;
protected var tempPreBmp:BitmapData;
private var y0:Number;
private var y1:Number;
private var y2:Number;
protected var tempTriangleMatrix:Matrix;
protected var focus:Number;// = 200
protected var mabz:Number;
private var d2ab:Number;
protected var dsab:Number;
protected var mabx:Number;
protected var maby:Number;
protected var dcax:Number;
protected var dcay:Number;
protected var _precision:int;// = 8
protected var dsbc:Number;
protected var _precise:Boolean;
private var d2bc:Number;
protected var faz:Number;
public var uvMatrices:Dictionary;
protected var dsca:Number;
private var d2ca:Number;
protected var fbz:Number;
public var precisionMode:int;
protected var fcz:Number;
public var minimumRenderSize:Number;// = 4
protected var dbcx:Number;
protected var dbcy:Number;
protected var dabx:Number;
protected var daby:Number;
protected var tempPreRSD:RenderSessionData;
protected var _texture:Object;
private var a2:Number;
protected static const DEFAULT_FOCUS:Number = 200;
protected static var _triMatrix:Matrix = new Matrix();
protected static var _triMap:Matrix;
public static var AUTO_MIP_MAPPING:Boolean = false;
public static var MIP_MAP_DEPTH:Number = 8;
protected static var hitRect:Rectangle = new Rectangle();
protected static var _localMatrix:Matrix = new Matrix();
public function BitmapMaterial(_arg1:BitmapData=null, _arg2:Boolean=false){
focus = 200;
_precision = 8;
_perPixelPrecision = 8;
minimumRenderSize = 4;
precisionMode = PrecisionMode.ORIGINAL;
uvMatrices = new Dictionary();
tempTriangleMatrix = new Matrix();
super();
if (_arg1){
texture = _arg1;
};
this.precise = _arg2;
createRenderRecStorage();
}
public function transformUVRT(_arg1:RenderTriangle):Matrix{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Matrix;
var _local15:Matrix;
if (bitmap){
_local2 = (bitmap.width * maxU);
_local3 = (bitmap.height * maxV);
_local4 = (_local2 * _arg1.uv0.u);
_local5 = (_local3 * (1 - _arg1.uv0.v));
_local6 = (_local2 * _arg1.uv1.u);
_local7 = (_local3 * (1 - _arg1.uv1.v));
_local8 = (_local2 * _arg1.uv2.u);
_local9 = (_local3 * (1 - _arg1.uv2.v));
if ((((((_local4 == _local6)) && ((_local5 == _local7)))) || ((((_local4 == _local8)) && ((_local5 == _local9)))))){
_local4 = (_local4 - ((_local4)>0.05) ? 0.05 : -0.05);
_local5 = (_local5 - ((_local5)>0.07) ? 0.07 : -0.07);
};
if ((((_local8 == _local6)) && ((_local9 == _local7)))){
_local8 = (_local8 - ((_local8)>0.05) ? 0.04 : -0.04);
_local9 = (_local9 - ((_local9)>0.06) ? 0.06 : -0.06);
};
_local10 = (_local6 - _local4);
_local11 = (_local7 - _local5);
_local12 = (_local8 - _local4);
_local13 = (_local9 - _local5);
_local14 = new Matrix(_local10, _local11, _local12, _local13, _local4, _local5);
if (Papervision3D.useRIGHTHANDED){
_local14.scale(-1, 1);
_local14.translate(_local2, 0);
};
_local14.invert();
_local15 = (uvMatrices[_arg1] = _local14.clone());
_local15.a = _local14.a;
_local15.b = _local14.b;
_local15.c = _local14.c;
_local15.d = _local14.d;
_local15.tx = _local14.tx;
_local15.ty = _local14.ty;
} else {
PaperLogger.error("MaterialObject3D: transformUV() material.bitmap not found!");
};
return (_local15);
}
public function resetUVS():void{
uvMatrices = new Dictionary(false);
}
protected function correctBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
_local3 = (1 << MIP_MAP_DEPTH);
_local4 = (_arg1.width / _local3);
_local4 = ((_local4 == uint(_local4))) ? _local4 : (uint(_local4) + 1);
_local5 = (_arg1.height / _local3);
_local5 = ((_local5 == uint(_local5))) ? _local5 : (uint(_local5) + 1);
_local6 = (_local3 * _local4);
_local7 = (_local3 * _local5);
_local8 = true;
if (_local6 > 2880){
_local6 = _arg1.width;
_local8 = false;
};
if (_local7 > 2880){
_local7 = _arg1.height;
_local8 = false;
};
if (!_local8){
PaperLogger.warning((("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);
}
public function get precise():Boolean{
return (_precise);
}
public function set texture(_arg1:Object):void{
if ((_arg1 is BitmapData) == false){
PaperLogger.error("BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmap(BitmapData(_arg1));
_texture = _arg1;
}
override public function toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
public function get precision():int{
return (_precision);
}
public function resetMapping():void{
uvMatrices = new Dictionary();
}
public function get pixelPrecision():int{
return (_perPixelPrecision);
}
public function set precise(_arg1:Boolean):void{
_precise = _arg1;
}
protected function extendBitmapEdges(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local4:Rectangle;
var _local5:Point;
var _local6:int;
_local4 = new Rectangle();
_local5 = 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++;
};
};
}
public function set precision(_arg1:int):void{
_precision = _arg1;
}
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){
PaperLogger.error("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);
if (Papervision3D.useRIGHTHANDED){
_local15.scale(-1, 1);
_local15.translate(_local3, 0);
};
_local15.invert();
_local16 = (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 {
PaperLogger.error("MaterialObject3D: transformUV() material.bitmap not found!");
};
};
return (_local16);
}
protected function renderRec(_arg1:Matrix, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance, _arg5:Number):void{
var _local6:int;
var _local7:RenderRecStorage;
var _local8:Matrix;
az = _arg2.z;
bz = _arg3.z;
cz = _arg4.z;
if ((((((az <= 0)) && ((bz <= 0)))) && ((cz <= 0)))){
return;
};
cx = _arg4.x;
cy = _arg4.y;
bx = _arg3.x;
by = _arg3.y;
ax = _arg2.x;
ay = _arg2.y;
if (cullRect){
hitRect.x = ((bx < ax)) ? ((bx < cx)) ? bx : cx : ((ax < cx)) ? ax : cx;
hitRect.width = (((bx > ax)) ? ((bx > cx)) ? bx : cx : ((ax > cx)) ? ax : cx + ((hitRect.x < 0)) ? -(hitRect.x) : hitRect.x);
hitRect.y = ((by < ay)) ? ((by < cy)) ? by : cy : ((ay < cy)) ? ay : cy;
hitRect.height = (((by > ay)) ? ((by > cy)) ? by : cy : ((ay > cy)) ? ay : cy + ((hitRect.y < 0)) ? -(hitRect.y) : hitRect.y);
if (!(((hitRect.right < cullRect.left)) || ((hitRect.left > cullRect.right)))){
if (!(((hitRect.bottom < cullRect.top)) || ((hitRect.top > cullRect.bottom)))){
} else {
return;
};
} else {
return;
};
};
if ((((((((_arg5 >= 100)) || ((hitRect.width < minimumRenderSize)))) || ((hitRect.height < minimumRenderSize)))) || ((focus == Infinity)))){
a2 = (_arg3.x - _arg2.x);
b2 = (_arg3.y - _arg2.y);
c2 = (_arg4.x - _arg2.x);
d2 = (_arg4.y - _arg2.y);
tempTriangleMatrix.a = ((_arg1.a * a2) + (_arg1.b * c2));
tempTriangleMatrix.b = ((_arg1.a * b2) + (_arg1.b * d2));
tempTriangleMatrix.c = ((_arg1.c * a2) + (_arg1.d * c2));
tempTriangleMatrix.d = ((_arg1.c * b2) + (_arg1.d * d2));
tempTriangleMatrix.tx = (((_arg1.tx * a2) + (_arg1.ty * c2)) + _arg2.x);
tempTriangleMatrix.ty = (((_arg1.tx * b2) + (_arg1.ty * d2)) + _arg2.y);
if (lineAlpha){
tempPreGrp.lineStyle(lineThickness, lineColor, lineAlpha);
};
tempPreGrp.beginBitmapFill(tempPreBmp, tempTriangleMatrix, tiled, smooth);
tempPreGrp.moveTo(_arg2.x, _arg2.y);
tempPreGrp.lineTo(_arg3.x, _arg3.y);
tempPreGrp.lineTo(_arg4.x, _arg4.y);
tempPreGrp.endFill();
if (lineAlpha){
tempPreGrp.lineStyle();
};
tempPreRSD.renderStatistics.triangles++;
return;
};
faz = (focus + az);
fbz = (focus + bz);
fcz = (focus + cz);
mabz = (2 / (faz + fbz));
mbcz = (2 / (fbz + fcz));
mcaz = (2 / (fcz + faz));
mabx = (((ax * faz) + (bx * fbz)) * mabz);
maby = (((ay * faz) + (by * fbz)) * mabz);
mbcx = (((bx * fbz) + (cx * fcz)) * mbcz);
mbcy = (((by * fbz) + (cy * fcz)) * mbcz);
mcax = (((cx * fcz) + (ax * faz)) * mcaz);
mcay = (((cy * fcz) + (ay * faz)) * mcaz);
dabx = ((ax + bx) - mabx);
daby = ((ay + by) - maby);
dbcx = ((bx + cx) - mbcx);
dbcy = ((by + cy) - mbcy);
dcax = ((cx + ax) - mcax);
dcay = ((cy + ay) - mcay);
dsab = ((dabx * dabx) + (daby * daby));
dsbc = ((dbcx * dbcx) + (dbcy * dbcy));
dsca = ((dcax * dcax) + (dcay * dcay));
_local6 = (_arg5 + 1);
_local7 = RenderRecStorage(renderRecStorage[int(_arg5)]);
_local8 = _local7.mat;
if ((((((dsab <= _precision)) && ((dsca <= _precision)))) && ((dsbc <= _precision)))){
a2 = (_arg3.x - _arg2.x);
b2 = (_arg3.y - _arg2.y);
c2 = (_arg4.x - _arg2.x);
d2 = (_arg4.y - _arg2.y);
tempTriangleMatrix.a = ((_arg1.a * a2) + (_arg1.b * c2));
tempTriangleMatrix.b = ((_arg1.a * b2) + (_arg1.b * d2));
tempTriangleMatrix.c = ((_arg1.c * a2) + (_arg1.d * c2));
tempTriangleMatrix.d = ((_arg1.c * b2) + (_arg1.d * d2));
tempTriangleMatrix.tx = (((_arg1.tx * a2) + (_arg1.ty * c2)) + _arg2.x);
tempTriangleMatrix.ty = (((_arg1.tx * b2) + (_arg1.ty * d2)) + _arg2.y);
if (lineAlpha){
tempPreGrp.lineStyle(lineThickness, lineColor, lineAlpha);
};
tempPreGrp.beginBitmapFill(tempPreBmp, tempTriangleMatrix, tiled, smooth);
tempPreGrp.moveTo(_arg2.x, _arg2.y);
tempPreGrp.lineTo(_arg3.x, _arg3.y);
tempPreGrp.lineTo(_arg4.x, _arg4.y);
tempPreGrp.endFill();
if (lineAlpha){
tempPreGrp.lineStyle();
};
tempPreRSD.renderStatistics.triangles++;
return;
};
if ((((((dsab > _precision)) && ((dsca > _precision)))) && ((dsbc > _precision)))){
_local8.a = (_arg1.a * 2);
_local8.b = (_arg1.b * 2);
_local8.c = (_arg1.c * 2);
_local8.d = (_arg1.d * 2);
_local8.tx = (_arg1.tx * 2);
_local8.ty = (_arg1.ty * 2);
_local7.v0.x = (mabx * 0.5);
_local7.v0.y = (maby * 0.5);
_local7.v0.z = ((az + bz) * 0.5);
_local7.v1.x = (mbcx * 0.5);
_local7.v1.y = (mbcy * 0.5);
_local7.v1.z = ((bz + cz) * 0.5);
_local7.v2.x = (mcax * 0.5);
_local7.v2.y = (mcay * 0.5);
_local7.v2.z = ((cz + az) * 0.5);
renderRec(_local8, _arg2, _local7.v0, _local7.v2, _local6);
_local8.tx = (_local8.tx - 1);
renderRec(_local8, _local7.v0, _arg3, _local7.v1, _local6);
_local8.ty = (_local8.ty - 1);
_local8.tx = (_arg1.tx * 2);
renderRec(_local8, _local7.v2, _local7.v1, _arg4, _local6);
_local8.a = (-(_arg1.a) * 2);
_local8.b = (-(_arg1.b) * 2);
_local8.c = (-(_arg1.c) * 2);
_local8.d = (-(_arg1.d) * 2);
_local8.tx = ((-(_arg1.tx) * 2) + 1);
_local8.ty = ((-(_arg1.ty) * 2) + 1);
renderRec(_local8, _local7.v1, _local7.v2, _local7.v0, _local6);
return;
};
if (precisionMode == PrecisionMode.ORIGINAL){
d2ab = dsab;
d2bc = dsbc;
d2ca = dsca;
dmax = ((dsca > dsbc)) ? ((dsca > dsab)) ? dsca : dsab : ((dsbc > dsab)) ? dsbc : dsab;
} else {
dx = (_arg2.x - _arg3.x);
dy = (_arg2.y - _arg3.y);
d2ab = ((dx * dx) + (dy * dy));
dx = (_arg3.x - _arg4.x);
dy = (_arg3.y - _arg4.y);
d2bc = ((dx * dx) + (dy * dy));
dx = (_arg4.x - _arg2.x);
dy = (_arg4.y - _arg2.y);
d2ca = ((dx * dx) + (dy * dy));
dmax = ((d2ca > d2bc)) ? ((d2ca > d2ab)) ? d2ca : d2ab : ((d2bc > d2ab)) ? d2bc : d2ab;
};
if (d2ab == dmax){
_local8.a = (_arg1.a * 2);
_local8.b = _arg1.b;
_local8.c = (_arg1.c * 2);
_local8.d = _arg1.d;
_local8.tx = (_arg1.tx * 2);
_local8.ty = _arg1.ty;
_local7.v0.x = (mabx * 0.5);
_local7.v0.y = (maby * 0.5);
_local7.v0.z = ((az + bz) * 0.5);
renderRec(_local8, _arg2, _local7.v0, _arg4, _local6);
_local8.a = ((_arg1.a * 2) + _arg1.b);
_local8.c = ((2 * _arg1.c) + _arg1.d);
_local8.tx = (((_arg1.tx * 2) + _arg1.ty) - 1);
renderRec(_local8, _local7.v0, _arg3, _arg4, _local6);
return;
};
if (d2ca == dmax){
_local8.a = _arg1.a;
_local8.b = (_arg1.b * 2);
_local8.c = _arg1.c;
_local8.d = (_arg1.d * 2);
_local8.tx = _arg1.tx;
_local8.ty = (_arg1.ty * 2);
_local7.v2.x = (mcax * 0.5);
_local7.v2.y = (mcay * 0.5);
_local7.v2.z = ((cz + az) * 0.5);
renderRec(_local8, _arg2, _arg3, _local7.v2, _local6);
_local8.b = (_local8.b + _arg1.a);
_local8.d = (_local8.d + _arg1.c);
_local8.ty = (_local8.ty + (_arg1.tx - 1));
renderRec(_local8, _local7.v2, _arg3, _arg4, _local6);
return;
};
_local8.a = (_arg1.a - _arg1.b);
_local8.b = (_arg1.b * 2);
_local8.c = (_arg1.c - _arg1.d);
_local8.d = (_arg1.d * 2);
_local8.tx = (_arg1.tx - _arg1.ty);
_local8.ty = (_arg1.ty * 2);
_local7.v1.x = (mbcx * 0.5);
_local7.v1.y = (mbcy * 0.5);
_local7.v1.z = ((bz + cz) * 0.5);
renderRec(_local8, _arg2, _arg3, _local7.v1, _local6);
_local8.a = (_arg1.a * 2);
_local8.b = (_arg1.b - _arg1.a);
_local8.c = (_arg1.c * 2);
_local8.d = (_arg1.d - _arg1.c);
_local8.tx = (_arg1.tx * 2);
_local8.ty = (_arg1.ty - _arg1.tx);
renderRec(_local8, _arg2, _local7.v1, _arg4, _local6);
}
protected function createRenderRecStorage():void{
var _local1:int;
this.renderRecStorage = new Array();
_local1 = 0;
while (_local1 <= 100) {
this.renderRecStorage[_local1] = new RenderRecStorage();
_local1++;
};
}
public function set pixelPrecision(_arg1:int):void{
_precision = ((_arg1 * _arg1) * 1.4);
_perPixelPrecision = _arg1;
}
public function get texture():Object{
return (this._texture);
}
protected function createBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
resetMapping();
if (AUTO_MIP_MAPPING){
_local2 = correctBitmap(_arg1);
} else {
this.maxU = (this.maxV = 1);
_local2 = _arg1;
};
return (_local2);
}
override public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = super.clone();
_local1.maxU = this.maxU;
_local1.maxV = this.maxV;
return (_local1);
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
_triMap = (_arg5) ? _arg5 : ((uvMatrices[_arg1]) || (transformUVRT(_arg1)));
if (((!(_precise)) || (!(_triMap)))){
if (lineAlpha){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
};
if (bitmap){
x0 = _arg1.v0.x;
y0 = _arg1.v0.y;
x1 = _arg1.v1.x;
y1 = _arg1.v1.y;
x2 = _arg1.v2.x;
y2 = _arg1.v2.y;
_triMatrix.a = (x1 - x0);
_triMatrix.b = (y1 - y0);
_triMatrix.c = (x2 - x0);
_triMatrix.d = (y2 - y0);
_triMatrix.tx = x0;
_triMatrix.ty = y0;
_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(x0, y0);
_arg2.lineTo(x1, y1);
_arg2.lineTo(x2, y2);
_arg2.lineTo(x0, y0);
if (bitmap){
_arg2.endFill();
};
if (lineAlpha){
_arg2.lineStyle();
};
_arg3.renderStatistics.triangles++;
} else {
if (bitmap){
focus = _arg3.camera.focus;
tempPreBmp = (_arg4) ? _arg4 : bitmap;
tempPreRSD = _arg3;
tempPreGrp = _arg2;
cullRect = _arg3.viewPort.cullingRectangle;
renderRec(_triMap, _arg1.v0, _arg1.v1, _arg1.v2, 0);
};
};
}
override public function copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
override public function destroy():void{
super.destroy();
if (uvMatrices){
uvMatrices = null;
};
if (bitmap){
bitmap.dispose();
};
this.renderRecStorage = null;
}
}
}//package org.papervision3d.materials
Section 111
//ColorMaterial (org.papervision3d.materials.ColorMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class ColorMaterial extends TriangleMaterial implements ITriangleDrawer {
public function ColorMaterial(_arg1:Number=0xFF00FF, _arg2:Number=1, _arg3:Boolean=false){
this.fillColor = _arg1;
this.fillAlpha = _arg2;
this.interactive = _arg3;
}
override public function drawTriangle(_arg1:RenderTriangle, _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;
_local6 = _arg1.v0.x;
_local7 = _arg1.v0.y;
_local8 = _arg1.v1.x;
_local9 = _arg1.v1.y;
_local10 = _arg1.v2.x;
_local11 = _arg1.v2.y;
_arg2.beginFill(fillColor, fillAlpha);
_arg2.moveTo(_local6, _local7);
_arg2.lineTo(_local8, _local9);
_arg2.lineTo(_local10, _local11);
_arg2.lineTo(_local6, _local7);
_arg2.endFill();
_arg3.renderStatistics.triangles++;
}
override public function toString():String{
return (((("ColorMaterial - color:" + this.fillColor) + " alpha:") + this.fillAlpha));
}
override public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new ColorMaterial();
_local1.copy(this);
return (_local1);
}
}
}//package org.papervision3d.materials
Section 112
//MovieAssetMaterial (org.papervision3d.materials.MovieAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
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){
createUnique = false;
super();
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){
PaperLogger.error("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 _local2: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;
};
};
_local2 = _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);
}
}
}//package org.papervision3d.materials
Section 113
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.render.draw.*;
public class MovieMaterial extends BitmapMaterial implements ITriangleDrawer, IUpdateBeforeMaterial, IUpdateAfterMaterial {
public var movieTransparent:Boolean;
private var materialIsUsed:Boolean;// = false
private var autoClipRect:Rectangle;
private var userClipRect:Rectangle;
protected var recreateBitmapInSuper:Boolean;
private var movieAnimated:Boolean;
private var stage:Stage;
private var quality:String;
public var movie:DisplayObject;
public var allowAutoResize:Boolean;// = false
public function MovieMaterial(_arg1:DisplayObject=null, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Rectangle=null){
materialIsUsed = false;
allowAutoResize = false;
super();
movieTransparent = _arg2;
this.animated = _arg3;
this.precise = _arg4;
userClipRect = _arg5;
if (_arg1){
texture = _arg1;
};
}
public function updateAfterRender(_arg1:RenderSessionData):void{
if ((((movieAnimated == true)) && ((materialIsUsed == true)))){
drawBitmap();
if (recreateBitmapInSuper){
bitmap = super.createBitmap(bitmap);
recreateBitmapInSuper = false;
};
};
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is DisplayObject) == false){
PaperLogger.error("MovieMaterial.texture requires a Sprite to be passed as the object");
return;
};
bitmap = createBitmapFromSprite(DisplayObject(_arg1));
_texture = _arg1;
}
public function setQuality(_arg1:String, _arg2:Stage, _arg3:Boolean=true):void{
this.quality = _arg1;
this.stage = _arg2;
if (_arg3){
createBitmapFromSprite(movie);
};
}
protected function initBitmap(_arg1:DisplayObject):void{
if (bitmap){
bitmap.dispose();
};
if (userClipRect){
bitmap = new BitmapData(int((userClipRect.width + 0.5)), int((userClipRect.height + 0.5)), movieTransparent, fillColor);
} else {
if ((((_arg1.width == 0)) || ((_arg1.height == 0)))){
bitmap = new BitmapData(0x0100, 0x0100, movieTransparent, fillColor);
} else {
bitmap = new BitmapData(int((_arg1.width + 0.5)), int((_arg1.height + 0.5)), movieTransparent, fillColor);
};
};
}
protected function createBitmapFromSprite(_arg1:DisplayObject):BitmapData{
movie = _arg1;
initBitmap(movie);
drawBitmap();
bitmap = super.createBitmap(bitmap);
return (bitmap);
}
override public function get texture():Object{
return (this._texture);
}
public function set animated(_arg1:Boolean):void{
movieAnimated = _arg1;
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:int;
var _local3:int;
materialIsUsed = false;
if (movieAnimated){
if (userClipRect){
_local2 = int((userClipRect.width + 0.5));
_local3 = int((userClipRect.height + 0.5));
} else {
_local2 = int((movie.width + 0.5));
_local3 = int((movie.height + 0.5));
};
if (((allowAutoResize) && (((!((_local2 == bitmap.width))) || (!((_local3 == bitmap.height))))))){
initBitmap(movie);
recreateBitmapInSuper = true;
};
};
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
materialIsUsed = true;
super.drawTriangle(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function drawBitmap():void{
var _local1:Rectangle;
var _local2:Matrix;
var _local3:String;
bitmap.fillRect(bitmap.rect, fillColor);
if (((stage) && (quality))){
_local3 = stage.quality;
stage.quality = quality;
};
_local1 = rect;
_local2 = new Matrix(1, 0, 0, 1, -(_local1.x), -(_local1.y));
bitmap.draw(movie, _local2, movie.transform.colorTransform, null);
if (!userClipRect){
autoClipRect = movie.getBounds(movie);
};
if (((stage) && (quality))){
stage.quality = _local3;
};
}
public function get animated():Boolean{
return (movieAnimated);
}
public function set rect(_arg1:Rectangle):void{
userClipRect = _arg1;
createBitmapFromSprite(movie);
}
public function get rect():Rectangle{
var _local1:Rectangle;
_local1 = ((userClipRect) || (autoClipRect));
if (((!(_local1)) && (movie))){
_local1 = movie.getBounds(movie);
};
return (_local1);
}
}
}//package org.papervision3d.materials
Section 114
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
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:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:Number;
var _local7:Number;
_local6 = _arg1.v0.x;
_local7 = _arg1.v0.y;
if (lineAlpha){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
_arg2.moveTo(_local6, _local7);
_arg2.lineTo(_arg1.v1.x, _arg1.v1.y);
_arg2.lineTo(_arg1.v2.x, _arg1.v2.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 115
//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.log.*;
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 ALL:int = (((((FRONT + BACK) + RIGHT) + LEFT) + TOP) + BOTTOM);
public static var LEFT:int = 8;
public static var FRONT:int = 1;
public static var BOTTOM:int = 32;
public static var TOP:int = 16;
public static var BACK:int = 2;
public static var NONE:int = 0;
public static var RIGHT:int = 4;
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){
super(_arg1.getMaterialByName("all"), new Array(), new Array(), null);
this.materials = _arg1;
this.insideFaces = _arg8;
this.excludeFaces = _arg9;
segments = new Number3D(_arg5, _arg6, _arg7);
buildCube(_arg2, _arg4, _arg3);
}
protected 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 _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Array;
var _local16:Array;
var _local17:Array;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
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){
PaperLogger.warning("Required material not found in given materials list. Supported materials are: front, back, right, left, top, bottom & all.");
return;
};
};
_local8.registerObject(this);
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";
};
};
};
_local10 = (_arg7) ? -1 : 1;
_local11 = this.segments[_arg2];
_local12 = this.segments[_arg3];
_local13 = (_local11 + 1);
_local14 = (_local12 + 1);
_local15 = this.geometry.vertices;
_local16 = this.geometry.faces;
_local17 = new Array();
_local18 = (_arg4 / 2);
_local19 = (_arg5 / 2);
_local20 = (_arg4 / _local11);
_local21 = (_arg5 / _local12);
_local22 = 0;
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++;
};
}
protected function buildCube(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Triangle3D;
_local4 = (_arg1 / 2);
_local5 = (_arg2 / 2);
_local6 = (_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();
for each (_local7 in this.geometry.faces) {
_local7.renderCommand.create = createRenderTriangle;
};
this.geometry.ready = true;
if (Papervision3D.useRIGHTHANDED){
this.geometry.flipFaces();
};
}
public function destroy():void{
var _local1:MaterialObject3D;
for each (_local1 in materials) {
_local1.unregisterObject(this);
};
}
}
}//package org.papervision3d.objects.primitives
Section 116
//Cylinder (org.papervision3d.objects.primitives.Cylinder)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.*;
public class Cylinder extends TriangleMesh3D {
public var segmentsH:Number;
public var segmentsW:Number;
public static const DEFAULT_HEIGHT:Number = 100;
public static const DEFAULT_SEGMENTSH:Number = 6;
public static const DEFAULT_SCALE:Number = 1;
public static const DEFAULT_RADIUS:Number = 100;
public static const MIN_SEGMENTSH:Number = 1;
public static const MIN_SEGMENTSW:Number = 3;
public static const DEFAULT_SEGMENTSW:Number = 8;
public function Cylinder(_arg1:MaterialObject3D=null, _arg2:Number=100, _arg3:Number=100, _arg4:int=8, _arg5:int=6, _arg6:Number=-1, _arg7:Boolean=true, _arg8:Boolean=true){
var _local9:Number;
super(_arg1, new Array(), new Array(), null);
this.segmentsW = Math.max(MIN_SEGMENTSW, ((_arg4) || (DEFAULT_SEGMENTSW)));
this.segmentsH = Math.max(MIN_SEGMENTSH, ((_arg5) || (DEFAULT_SEGMENTSH)));
if (_arg2 == 0){
_arg2 = DEFAULT_RADIUS;
};
if (_arg3 == 0){
_arg3 = DEFAULT_HEIGHT;
};
if (_arg6 == -1){
_arg6 = _arg2;
};
_local9 = DEFAULT_SCALE;
buildCylinder(_arg2, _arg3, _arg6, _arg7, _arg8);
}
private function buildCylinder(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Boolean):void{
var _local6:MaterialObject3D;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Array;
var _local13:Array;
var _local14:Array;
var _local15:int;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:NumberUV;
var _local19:NumberUV;
var _local20:Vertex3D;
var _local21:Vertex3D;
var _local22:Vertex3D;
var _local23:Vertex3D;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Array;
var _local28:Vertex3D;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:int;
var _local33:Boolean;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:int;
var _local39:Boolean;
_local6 = material;
_local10 = Math.max(MIN_SEGMENTSW, this.segmentsW);
_local11 = Math.max(MIN_SEGMENTSH, this.segmentsH);
_local12 = this.geometry.vertices;
_local13 = this.geometry.faces;
_local14 = new Array();
_local8 = 0;
while (_local8 < (_local11 + 1)) {
_local24 = Number((_local8 / _local11));
_local25 = ((_arg2 * (_local8 / (_local11 + 0))) - (_arg2 / 2));
_local26 = (_arg3 + ((_arg1 - _arg3) * (1 - (_local8 / _local11))));
_local27 = new Array();
_local7 = 0;
while (_local7 < _local10) {
_local29 = Number(((2 * _local7) / _local10));
_local30 = (_local26 * Math.sin((_local29 * Math.PI)));
_local31 = (_local26 * Math.cos((_local29 * Math.PI)));
_local28 = new Vertex3D(_local31, _local25, _local30);
_local12.push(_local28);
_local27.push(_local28);
_local7++;
};
_local14.push(_local27);
_local8++;
};
_local15 = _local14.length;
_local8 = 0;
while (_local8 < _local15) {
_local32 = _local14[_local8].length;
_local7 = 0;
while (_local7 < _local32) {
if ((((_local8 > 0)) && ((_local7 >= 0)))){
_local33 = (_local7 == (_local32 - 0));
_local20 = _local14[_local8][(_local33) ? 0 : _local7];
_local21 = _local14[_local8][(((_local7 == 0)) ? _local32 : _local7 - 1)];
_local22 = _local14[(_local8 - 1)][(((_local7 == 0)) ? _local32 : _local7 - 1)];
_local23 = _local14[(_local8 - 1)][(_local33) ? 0 : _local7];
_local34 = (_local8 / _local15);
_local35 = ((_local8 - 1) / _local15);
_local36 = ((_local7 + 1) / _local32);
_local37 = (_local7 / _local32);
_local16 = new NumberUV(_local36, _local35);
_local17 = new NumberUV(_local36, _local34);
_local18 = new NumberUV(_local37, _local34);
_local19 = new NumberUV(_local37, _local35);
_local13.push(new Triangle3D(this, [_local20, _local21, _local22], _local6, [_local17, _local18, _local19]));
_local13.push(new Triangle3D(this, [_local20, _local22, _local23], _local6, [_local17, _local19, _local16]));
};
_local7++;
};
if ((((_local8 == 0)) || ((_local8 == (_local15 - 1))))){
_local7 = 0;
while (_local7 < (_local32 - 2)) {
_local38 = Math.floor((_local7 / 2));
_local20 = _local14[_local8][_local38];
_local21 = (((_local7 % 2))==0) ? _local14[_local8][((_local32 - 2) - _local38)] : _local14[_local8][(_local38 + 1)];
_local22 = (((_local7 % 2))==0) ? _local14[_local8][((_local32 - 1) - _local38)] : _local14[_local8][((_local32 - 2) - _local38)];
_local39 = (_local8 == 0);
_local17 = new NumberUV(((_local39) ? 1 : 0 + ((_local39) ? -1 : 1 * (((_local20.x / _arg1) / 2) + 0.5))), (((_local20.z / _arg1) / 2) + 0.5));
_local18 = new NumberUV(((_local39) ? 1 : 0 + ((_local39) ? -1 : 1 * (((_local21.x / _arg1) / 2) + 0.5))), (((_local21.z / _arg1) / 2) + 0.5));
_local19 = new NumberUV(((_local39) ? 1 : 0 + ((_local39) ? -1 : 1 * (((_local22.x / _arg1) / 2) + 0.5))), (((_local22.z / _arg1) / 2) + 0.5));
if (_local8 == 0){
if (_arg5){
_local13.push(new Triangle3D(this, [_local20, _local22, _local21], _local6, [_local17, _local19, _local18]));
};
} else {
if (_arg4){
_local13.push(new Triangle3D(this, [_local20, _local21, _local22], _local6, [_local17, _local18, _local19]));
};
};
_local7++;
};
};
_local8++;
};
this.geometry.ready = true;
if (Papervision3D.useRIGHTHANDED){
this.geometry.flipFaces();
};
}
}
}//package org.papervision3d.objects.primitives
Section 117
//Plane (org.papervision3d.objects.primitives.Plane)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.*;
public class Plane extends TriangleMesh3D {
public var segmentsH:Number;
public var segmentsW:Number;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_SEGMENTS:Number = 1;
public static var DEFAULT_SIZE:Number = 500;
public function Plane(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
var _local6:Number;
super(_arg1, new Array(), new Array(), null);
this.segmentsW = ((_arg4) || (DEFAULT_SEGMENTS));
this.segmentsH = ((_arg5) || (this.segmentsW));
_local6 = DEFAULT_SCALE;
if (!_arg3){
if (_arg2){
_local6 = _arg2;
};
if (((_arg1) && (_arg1.bitmap))){
_arg2 = (_arg1.bitmap.width * _local6);
_arg3 = (_arg1.bitmap.height * _local6);
} else {
_arg2 = (DEFAULT_SIZE * _local6);
_arg3 = (DEFAULT_SIZE * _local6);
};
};
buildPlane(_arg2, _arg3);
}
private function buildPlane(_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
var _local8:Array;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Vertex3D;
var _local21:Vertex3D;
var _local22:Vertex3D;
_local3 = this.segmentsW;
_local4 = this.segmentsH;
_local5 = (_local3 + 1);
_local6 = (_local4 + 1);
_local7 = this.geometry.vertices;
_local8 = this.geometry.faces;
_local9 = (_arg1 / 2);
_local10 = (_arg2 / 2);
_local11 = (_arg1 / _local3);
_local12 = (_arg2 / _local4);
_local13 = 0;
while (_local13 < (_local3 + 1)) {
_local17 = 0;
while (_local17 < _local6) {
_local18 = ((_local13 * _local11) - _local9);
_local19 = ((_local17 * _local12) - _local10);
_local7.push(new Vertex3D(_local18, _local19, 0));
_local17++;
};
_local13++;
};
_local13 = 0;
while (_local13 < _local3) {
_local17 = 0;
while (_local17 < _local4) {
_local20 = _local7[((_local13 * _local6) + _local17)];
_local21 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local22 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local14 = new NumberUV((_local13 / _local3), (_local17 / _local4));
_local15 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local16 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local8.push(new Triangle3D(this, [_local20, _local22, _local21], material, [_local14, _local16, _local15]));
_local20 = _local7[(((_local13 + 1) * _local6) + (_local17 + 1))];
_local21 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local22 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local14 = new NumberUV(((_local13 + 1) / _local3), ((_local17 + 1) / _local4));
_local15 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local16 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local8.push(new Triangle3D(this, [_local20, _local22, _local21], material, [_local14, _local16, _local15]));
_local17++;
};
_local13++;
};
this.geometry.ready = true;
if (Papervision3D.useRIGHTHANDED){
this.geometry.flipFaces();
};
}
}
}//package org.papervision3d.objects.primitives
Section 118
//Sphere (org.papervision3d.objects.primitives.Sphere)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.*;
public class Sphere extends TriangleMesh3D {
private var segmentsH:Number;
private var segmentsW:Number;
public static var MIN_SEGMENTSW:Number = 3;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_RADIUS:Number = 100;
public static var DEFAULT_SEGMENTSH:Number = 6;
public static var MIN_SEGMENTSH:Number = 2;
public static var DEFAULT_SEGMENTSW:Number = 8;
public function Sphere(_arg1:MaterialObject3D=null, _arg2:Number=100, _arg3:int=8, _arg4:int=6){
var _local5:Number;
super(_arg1, new Array(), new Array(), null);
this.segmentsW = Math.max(MIN_SEGMENTSW, ((_arg3) || (DEFAULT_SEGMENTSW)));
this.segmentsH = Math.max(MIN_SEGMENTSH, ((_arg4) || (DEFAULT_SEGMENTSH)));
if (_arg2 == 0){
_arg2 = DEFAULT_RADIUS;
};
_local5 = DEFAULT_SCALE;
buildSphere(_arg2);
}
private function buildSphere(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:Triangle3D;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Array;
var _local16:Vertex3D;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:int;
var _local21:Boolean;
var _local22:Vertex3D;
var _local23:Vertex3D;
var _local24:Vertex3D;
var _local25:Vertex3D;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:NumberUV;
var _local31:NumberUV;
var _local32:NumberUV;
var _local33:NumberUV;
_local5 = Math.max(3, this.segmentsW);
_local6 = Math.max(2, this.segmentsH);
_local7 = this.geometry.vertices;
_local8 = this.geometry.faces;
_local9 = new Array();
_local3 = 0;
while (_local3 < (_local6 + 1)) {
_local12 = Number((_local3 / _local6));
_local13 = (-(_arg1) * Math.cos((_local12 * Math.PI)));
_local14 = (_arg1 * Math.sin((_local12 * Math.PI)));
_local15 = new Array();
_local2 = 0;
while (_local2 < _local5) {
_local17 = Number(((2 * _local2) / _local5));
_local18 = (_local14 * Math.sin((_local17 * Math.PI)));
_local19 = (_local14 * Math.cos((_local17 * Math.PI)));
if (!(((((_local3 == 0)) || ((_local3 == _local6)))) && ((_local2 > 0)))){
_local16 = new Vertex3D(_local19, _local13, _local18);
_local7.push(_local16);
};
_local15.push(_local16);
_local2++;
};
_local9.push(_local15);
_local3++;
};
_local10 = _local9.length;
_local3 = 0;
while (_local3 < _local10) {
_local20 = _local9[_local3].length;
if (_local3 > 0){
_local2 = 0;
while (_local2 < _local20) {
_local21 = (_local2 == (_local20 - 1));
_local22 = _local9[_local3][(_local21) ? 0 : (_local2 + 1)];
_local23 = _local9[_local3][(_local21) ? (_local20 - 1) : _local2];
_local24 = _local9[(_local3 - 1)][(_local21) ? (_local20 - 1) : _local2];
_local25 = _local9[(_local3 - 1)][(_local21) ? 0 : (_local2 + 1)];
_local26 = (_local3 / (_local10 - 1));
_local27 = ((_local3 - 1) / (_local10 - 1));
_local28 = ((_local2 + 1) / _local20);
_local29 = (_local2 / _local20);
_local30 = new NumberUV(_local28, _local27);
_local31 = new NumberUV(_local28, _local26);
_local32 = new NumberUV(_local29, _local26);
_local33 = new NumberUV(_local29, _local27);
if (_local3 < (_local9.length - 1)){
_local8.push(new Triangle3D(this, new Array(_local22, _local23, _local24), material, new Array(_local31, _local32, _local33)));
};
if (_local3 > 1){
_local8.push(new Triangle3D(this, new Array(_local22, _local24, _local25), material, new Array(_local31, _local33, _local30)));
};
_local2++;
};
};
_local3++;
};
for each (_local11 in _local8) {
_local11.renderCommand.create = createRenderTriangle;
};
this.geometry.ready = true;
if (Papervision3D.useRIGHTHANDED){
this.geometry.flipFaces();
};
}
}
}//package org.papervision3d.objects.primitives
Section 119
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.shaders.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.data.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.*;
import org.papervision3d.core.material.*;
public class DisplayObject3D extends DisplayObjectContainer3D {
public var extra:Object;
public var materials:MaterialsList;
private var _zAxis:Number3D;
private var _scaleDirty:Boolean;// = false
private var _tempScale:Number3D;
private var _numClones:uint;// = 0
public var screen:Number3D;
private var _qPitch:Quaternion;
public var geometry:GeometryObject3D;
public var visible:Boolean;
protected var _useOwnContainer:Boolean;// = false
private var _material:MaterialObject3D;
public var name:String;
private var _position:Number3D;
public var container:ViewportLayer;
public var view:Matrix3D;
public var parent:DisplayObjectContainer3D;
private var _yAxis:Number3D;
public var flipLightDirection:Boolean;// = false
private var _rotation:Number3D;
private var _rotationDirty:Boolean;// = false
public var parentContainer:DisplayObject3D;
public var testQuad:Boolean;// = true
public var frustumTestMethod:int;// = 0
private var _rot:Quaternion;
public var id:int;
private var _rotationY:Number;
private var _rotationZ:Number;
private var _lookatTarget:Number3D;
private var _rotationX:Number;
public var meshSort:uint;// = 1
private var _qYaw:Quaternion;
public var cullTest:Number;// = 0
private var _xAxis:Number3D;
private var _autoCalcScreenCoords:Boolean;// = false
public var alpha:Number;// = 1
public var useClipping:Boolean;// = true
private var _scaleX:Number;
public var screenZ:Number;
private var _scaleZ:Number;
public var transform:Matrix3D;
protected var _userData:UserData;
private var _scaleY:Number;
private var _localRotationX:Number;// = 0
private var _qRoll:Quaternion;
private var _localRotationZ:Number;// = 0
public var culled:Boolean;
public var world:Matrix3D;
public var blendMode:String;// = "normal"
private var _localRotationY:Number;// = 0
protected var _scene:SceneObject3D;// = null
public var faces:Array;
protected var _sorted:Array;
protected var _transformDirty:Boolean;// = false
public var filters:Array;
public static const MESH_SORT_CENTER:uint = 1;
private static const LEFT:Number3D = new Number3D(-1, 0, 0);
public static const MESH_SORT_CLOSE:uint = 3;
private static const BACKWARD:Number3D = new Number3D(0, 0, -1);
private static const FORWARD:Number3D = new Number3D(0, 0, 1);
public static const MESH_SORT_FAR:uint = 2;
private static const DOWN:Number3D = new Number3D(0, -1, 0);
private static const UP:Number3D = new Number3D(0, 1, 0);
private static const RIGHT:Number3D = new Number3D(1, 0, 0);
private static var entry_count:uint = 0;
private static var _newID:int = 0;
private static var _tempMatrix:Matrix3D = Matrix3D.IDENTITY;
public static var sortedArray:Array = new Array();
public static var faceLevelMode:Boolean;
private static var _tempQuat:Quaternion = new Quaternion();
private static var toRADIANS:Number = 0.0174532925199433;
private static var toDEGREES:Number = 57.2957795130823;
public function DisplayObject3D(_arg1:String=null, _arg2:GeometryObject3D=null):void{
var _local3:Number;
faces = new Array();
meshSort = MESH_SORT_CENTER;
alpha = 1;
blendMode = BlendMode.NORMAL;
filters = [];
flipLightDirection = false;
frustumTestMethod = FrustumTestMethod.BOUNDING_SPHERE;
screen = new Number3D();
cullTest = 0;
useClipping = true;
testQuad = true;
_transformDirty = false;
_useOwnContainer = false;
_scene = null;
_position = Number3D.ZERO;
_lookatTarget = Number3D.ZERO;
_zAxis = Number3D.ZERO;
_xAxis = Number3D.ZERO;
_yAxis = Number3D.ZERO;
_rotation = Number3D.ZERO;
_rotationDirty = false;
_scaleDirty = false;
_numClones = 0;
_rot = new Quaternion();
_qPitch = new Quaternion();
_qYaw = new Quaternion();
_qRoll = new Quaternion();
_localRotationX = 0;
_localRotationY = 0;
_localRotationZ = 0;
_autoCalcScreenCoords = false;
super();
if (_arg1 != null){
PaperLogger.info(("DisplayObject3D: " + _arg1));
};
this.culled = false;
this.transform = Matrix3D.IDENTITY;
this.world = Matrix3D.IDENTITY;
this.view = Matrix3D.IDENTITY;
this.x = 0;
this.y = 0;
this.z = 0;
rotationX = 0;
rotationY = 0;
rotationZ = 0;
_localRotationX = (_localRotationY = (_localRotationZ = 0));
_local3 = (Papervision3D.usePERCENT) ? 100 : 1;
scaleX = _local3;
scaleY = _local3;
scaleZ = _local3;
_tempScale = new Number3D();
this.visible = true;
this.id = _newID++;
this.name = ((_arg1) || (String(this.id)));
_numClones = 0;
if (_arg2){
addGeometry(_arg2);
};
}
public function setChildMaterialByName(_arg1:String, _arg2:MaterialObject3D):void{
setChildMaterial(getChildByName(_arg1, true), _arg2);
}
public function moveDown(_arg1:Number):void{
translate(_arg1, DOWN);
}
public function get userData():UserData{
return (_userData);
}
public function set userData(_arg1:UserData):void{
_userData = _arg1;
}
protected function setParentContainer(_arg1:DisplayObject3D, _arg2:Boolean=true):void{
var _local3:DisplayObject3D;
if (((_arg2) && (!((_arg1 == this))))){
parentContainer = _arg1;
};
for each (_local3 in children) {
_local3.setParentContainer(_arg1, _arg2);
};
}
public function calculateScreenCoords(_arg1:CameraObject3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1.useProjectionMatrix){
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = ((((_local2 * view.n41) + (_local3 * view.n42)) + (_local4 * view.n43)) + view.n44);
_local6 = (_arg1.viewport.width / 2);
_local7 = (_arg1.viewport.height / 2);
screen.x = (((((_local2 * view.n11) + (_local3 * view.n12)) + (_local4 * view.n13)) + view.n14) / _local5);
screen.y = (((((_local2 * view.n21) + (_local3 * view.n22)) + (_local4 * view.n23)) + view.n24) / _local5);
screen.z = ((((_local2 * view.n31) + (_local3 * view.n32)) + (_local4 * view.n33)) + view.n34);
screen.x = (screen.x * _local6);
screen.y = (screen.y * _local7);
} else {
_local8 = ((_arg1.focus * _arg1.zoom) / (_arg1.focus + view.n34));
screen.x = (view.n14 * _local8);
screen.y = (view.n24 * _local8);
screen.z = view.n34;
};
}
public function addGeometry(_arg1:GeometryObject3D=null):void{
if (_arg1){
this.geometry = _arg1;
};
}
public function moveUp(_arg1:Number):void{
translate(_arg1, UP);
}
public function get scaleY():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleY * 100));
};
return (this._scaleY);
}
public function get scaleZ():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleZ * 100));
};
return (this._scaleZ);
}
public function set position(_arg1:Number3D):void{
this.x = _arg1.x;
this.y = _arg1.y;
this.z = _arg1.z;
}
public function get scaleX():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
}
public function hitTestObject(_arg1:DisplayObject3D, _arg2:Number=1):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = (this.x - _arg1.x);
_local4 = (this.y - _arg1.y);
_local5 = (this.z - _arg1.z);
_local6 = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5));
_local7 = (this.geometry) ? this.geometry.boundingSphere.maxDistance : 0;
_local8 = (_arg1.geometry) ? _arg1.geometry.boundingSphere.maxDistance : 0;
_local7 = (_local7 * _arg2);
return (((_local7 + _local8) > _local6));
}
public function set material(_arg1:MaterialObject3D):void{
if (_material){
_material.unregisterObject(this);
};
_material = _arg1;
if (_material){
_material.registerObject(this);
};
}
public function yaw(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qYaw.setFromAxisAngle(transform.n12, transform.n22, transform.n32, _arg1);
transform.calculateMultiply3x3(_qYaw.matrix, transform);
_localRotationY = (_localRotationY + _arg1);
_rotationDirty = true;
}
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 get autoCalcScreenCoords():Boolean{
return (_autoCalcScreenCoords);
}
public function get z():Number{
return (this.transform.n34);
}
public function roll(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qRoll.setFromAxisAngle(transform.n13, transform.n23, transform.n33, _arg1);
transform.calculateMultiply3x3(_qRoll.matrix, transform);
_localRotationZ = (_localRotationZ + _arg1);
_rotationDirty = true;
}
public function get x():Number{
return (this.transform.n14);
}
public function get scene():SceneObject3D{
return (_scene);
}
public function get y():Number{
return (this.transform.n24);
}
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 getMaterialByName(_arg1:String):MaterialObject3D{
var _local2:MaterialObject3D;
var _local3:DisplayObject3D;
_local2 = (this.materials) ? this.materials.getMaterialByName(_arg1) : null;
if (_local2){
return (_local2);
};
for each (_local3 in this._childrenByName) {
_local2 = _local3.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
};
return (null);
}
public function get rotationY():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (this._rotationY * toDEGREES) : this._rotationY);
}
public function get rotationZ():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (this._rotationZ * toDEGREES) : this._rotationZ);
}
public function set scaleY(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleY = (_arg1 / 100);
} else {
this._scaleY = _arg1;
};
this._transformDirty = true;
}
public function set scaleZ(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleZ = (_arg1 / 100);
} else {
this._scaleZ = _arg1;
};
this._transformDirty = true;
}
public function set scaleX(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleX = (_arg1 / 100);
} else {
this._scaleX = _arg1;
};
this._transformDirty = true;
}
public function get rotationX():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (this._rotationX * toDEGREES) : this._rotationX);
}
public function createViewportLayer(_arg1:Viewport3D, _arg2:Boolean=true):ViewportLayer{
var _local3:ViewportLayer;
_local3 = _arg1.getChildLayer(this, true);
if (_arg2){
addChildrenToLayer(this, _local3);
};
return (_local3);
}
public function updateTransform():void{
_rot.setFromEuler(_rotationY, _rotationZ, _rotationX);
this.transform.copy3x3(_rot.matrix);
_tempMatrix.reset();
_tempMatrix.n11 = this._scaleX;
_tempMatrix.n22 = this._scaleY;
_tempMatrix.n33 = this._scaleZ;
this.transform.calculateMultiply(this.transform, _tempMatrix);
_transformDirty = false;
}
public function get useOwnContainer():Boolean{
return (_useOwnContainer);
}
public function moveRight(_arg1:Number):void{
translate(_arg1, RIGHT);
}
public function moveBackward(_arg1:Number):void{
translate(_arg1, BACKWARD);
}
public function set localRotationX(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (this._transformDirty){
updateTransform();
};
_qPitch.setFromAxisAngle(transform.n11, transform.n21, transform.n31, (_localRotationX - _arg1));
this.transform.calculateMultiply3x3(_qPitch.matrix, transform);
_localRotationX = _arg1;
_rotationDirty = true;
}
public function set localRotationY(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qYaw.setFromAxisAngle(transform.n12, transform.n22, transform.n32, (_localRotationY - _arg1));
transform.calculateMultiply3x3(_qYaw.matrix, transform);
_localRotationY = _arg1;
_rotationDirty = true;
}
public function set autoCalcScreenCoords(_arg1:Boolean):void{
_autoCalcScreenCoords = _arg1;
}
public function set localRotationZ(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qRoll.setFromAxisAngle(transform.n13, transform.n23, transform.n33, (_localRotationZ - _arg1));
transform.calculateMultiply3x3(_qRoll.matrix, transform);
_localRotationZ = _arg1;
_rotationDirty = true;
}
public function materialsList():String{
var _local1:String;
var _local2:String;
var _local3:DisplayObject3D;
_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 set x(_arg1:Number):void{
this.transform.n14 = _arg1;
}
public function set y(_arg1:Number):void{
this.transform.n24 = _arg1;
}
public function set z(_arg1:Number):void{
this.transform.n34 = _arg1;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
if (_arg1.scene == null){
_arg1.scene = scene;
};
if (this.useOwnContainer){
_arg1.parentContainer = this;
};
return (_arg1);
}
public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local3:Number;
var _local4:Number;
var _local5:DisplayObject3D;
if (this._transformDirty){
updateTransform();
};
this.world.calculateMultiply(_arg1.world, this.transform);
if (_arg2.camera.culler){
if (this === _arg2.camera){
this.culled = true;
} else {
this.culled = (_arg2.camera.culler.testObject(this) < 0);
};
if (this.culled){
_arg2.renderStatistics.culledObjects++;
return (0);
};
} else {
this.culled = false;
};
if (_arg1 !== _arg2.camera){
if (_arg2.camera.useProjectionMatrix){
this.view.calculateMultiply4x4(_arg1.view, this.transform);
} else {
this.view.calculateMultiply(_arg1.view, this.transform);
};
} else {
if (_arg2.camera.useProjectionMatrix){
this.view.calculateMultiply4x4(_arg2.camera.eye, this.transform);
} else {
this.view.calculateMultiply(_arg2.camera.eye, this.transform);
};
};
if (_autoCalcScreenCoords){
calculateScreenCoords(_arg2.camera);
};
_local3 = 0;
_local4 = 0;
for each (_local5 in this._childrenByName) {
if (_local5.visible){
_local3 = (_local3 + _local5.project(this, _arg2));
_local4++;
};
};
return ((this.screenZ = (_local3 / _local4)));
}
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 setChildMaterial(_arg1:DisplayObject3D, _arg2:MaterialObject3D, _arg3:MaterialObject3D=null):void{
var _local4:Triangle3D;
if (!_arg1){
return;
};
if (((!(_arg3)) || ((_arg1.material === _arg3)))){
_arg1.material = _arg2;
};
if (((_arg1.geometry) && (_arg1.geometry.faces))){
for each (_local4 in _arg1.geometry.faces) {
if (((!(_arg3)) || ((_local4.material === _arg3)))){
_local4.material = _arg2;
};
};
};
}
public function get material():MaterialObject3D{
return (_material);
}
public function get position():Number3D{
_position.reset(this.x, this.y, this.z);
return (_position);
}
public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
var _local3:DisplayObject3D;
var _local4:Matrix3D;
if ((this is CameraObject3D)){
_position.reset(this.x, this.y, this.z);
} else {
_local3 = (this.parent as DisplayObject3D);
if (_local3){
world.calculateMultiply(_local3.world, transform);
} else {
world.copy(transform);
};
_position.reset(world.n14, world.n24, world.n34);
};
if ((_arg1 is CameraObject3D)){
_lookatTarget.reset(_arg1.x, _arg1.y, _arg1.z);
} else {
_local3 = (_arg1.parent as DisplayObject3D);
if (_local3){
_arg1.world.calculateMultiply(_local3.world, _arg1.transform);
} else {
_arg1.world.copy(_arg1.transform);
};
_lookatTarget.reset(_arg1.world.n14, _arg1.world.n24, _arg1.world.n34);
};
_zAxis.copyFrom(_lookatTarget);
_zAxis.minusEq(_position);
_zAxis.normalize();
if (_zAxis.modulo > 0.1){
_xAxis = Number3D.cross(_zAxis, ((_arg2) || (UP)), _xAxis);
_xAxis.normalize();
_yAxis = Number3D.cross(_zAxis, _xAxis, _yAxis);
_yAxis.normalize();
_local4 = this.transform;
_local4.n11 = (_xAxis.x * _scaleX);
_local4.n21 = (_xAxis.y * _scaleX);
_local4.n31 = (_xAxis.z * _scaleX);
_local4.n12 = (-(_yAxis.x) * _scaleY);
_local4.n22 = (-(_yAxis.y) * _scaleY);
_local4.n32 = (-(_yAxis.z) * _scaleY);
_local4.n13 = (_zAxis.x * _scaleZ);
_local4.n23 = (_zAxis.y * _scaleZ);
_local4.n33 = (_zAxis.z * _scaleZ);
_localRotationX = (_localRotationY = (_localRotationZ = 0));
this._transformDirty = false;
this._rotationDirty = true;
} else {
PaperLogger.error("lookAt error");
};
}
public function set rotationX(_arg1:Number):void{
this._rotationX = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
this._transformDirty = true;
}
public function set rotationY(_arg1:Number):void{
this._rotationY = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
this._transformDirty = true;
}
public function set rotationZ(_arg1:Number):void{
this._rotationZ = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
this._transformDirty = true;
}
public function pitch(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (this._transformDirty){
updateTransform();
};
_qPitch.setFromAxisAngle(transform.n11, transform.n21, transform.n31, _arg1);
this.transform.calculateMultiply3x3(_qPitch.matrix, transform);
_localRotationX = (_localRotationX + _arg1);
_rotationDirty = true;
}
public function get sceneX():Number{
return (this.world.n14);
}
public function translate(_arg1:Number, _arg2:Number3D):void{
var _local3:Number3D;
_local3 = _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 distanceTo(_arg1:DisplayObject3D):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (this.x - _arg1.x);
_local3 = (this.y - _arg1.y);
_local4 = (this.z - _arg1.z);
return (Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))));
}
public function get sceneZ():Number{
return (this.world.n34);
}
public function get sceneY():Number{
return (this.world.n24);
}
public function clone():DisplayObject3D{
var _local1:String;
var _local2:DisplayObject3D;
var _local3:DisplayObject3D;
_local1 = ((this.name + "_") + _numClones++);
_local2 = new DisplayObject3D(_local1);
if (this.material){
_local2.material = this.material;
};
if (this.materials){
_local2.materials = this.materials.clone();
};
if (this.geometry){
_local2.geometry = this.geometry.clone(_local2);
_local2.geometry.ready = true;
};
_local2.copyTransform(this.transform);
for each (_local3 in this.children) {
_local2.addChild(_local3.clone());
};
return (_local2);
}
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);
}
private function updateMaterials(_arg1:DisplayObject3D, _arg2:MaterialObject3D, _arg3:MaterialObject3D):void{
var _local4:DisplayObject3D;
var _local5:Triangle3D;
_arg2.unregisterObject(_arg1);
if ((((_arg3 is AbstractLightShadeMaterial)) || ((_arg3 is ShadedMaterial)))){
_arg3.registerObject(_arg1);
};
if (_arg1.material === _arg2){
_arg1.material = _arg3;
};
if (((((_arg1.geometry) && (_arg1.geometry.faces))) && (_arg1.geometry.faces.length))){
for each (_local5 in _arg1.geometry.faces) {
if (_local5.material === _arg2){
_local5.material = _arg3;
};
};
};
for each (_local4 in _arg1.children) {
updateMaterials(_local4, _arg2, _arg3);
};
}
public function replaceMaterialByName(_arg1:MaterialObject3D, _arg2:String):void{
var _local3:MaterialObject3D;
if (!this.materials){
return;
};
_local3 = this.materials.getMaterialByName(_arg2);
if (!_local3){
return;
};
if (this.material === _local3){
this.material = _arg1;
};
_local3 = this.materials.removeMaterial(_local3);
_arg1 = this.materials.addMaterial(_arg1, _arg2);
updateMaterials(this, _local3, _arg1);
}
private function updateRotation():void{
_tempScale.x = (Papervision3D.usePERCENT) ? (_scaleX * 100) : _scaleX;
_tempScale.y = (Papervision3D.usePERCENT) ? (_scaleY * 100) : _scaleY;
_tempScale.z = (Papervision3D.usePERCENT) ? (_scaleZ * 100) : _scaleZ;
_rotation = Matrix3D.matrix2euler(this.transform, _rotation, _tempScale);
this._rotationX = (_rotation.x * toRADIANS);
this._rotationY = (_rotation.y * toRADIANS);
this._rotationZ = (_rotation.z * toRADIANS);
this._rotationDirty = false;
}
public function get localRotationY():Number{
return ((Papervision3D.useDEGREES) ? (_localRotationY * toDEGREES) : _localRotationY);
}
public function get localRotationZ():Number{
return ((Papervision3D.useDEGREES) ? (_localRotationZ * toDEGREES) : _localRotationZ);
}
public function copyTransform(_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
var _local4:DisplayObject3D;
if ((_arg1 is DisplayObject3D)){
_local4 = DisplayObject3D(_arg1);
if (_local4._transformDirty){
_local4.updateTransform();
};
};
_local2 = this.transform;
_local3 = ((_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;
}
public function moveLeft(_arg1:Number):void{
translate(_arg1, LEFT);
}
public function get localRotationX():Number{
return ((Papervision3D.useDEGREES) ? (_localRotationX * toDEGREES) : _localRotationX);
}
public function set useOwnContainer(_arg1:Boolean):void{
_useOwnContainer = _arg1;
setParentContainer(this, true);
}
public function moveForward(_arg1:Number):void{
translate(_arg1, FORWARD);
}
public function addChildrenToLayer(_arg1:DisplayObject3D, _arg2:ViewportLayer):void{
var _local3:DisplayObject3D;
for each (_local3 in _arg1.children) {
_arg2.addDisplayObject3D(_local3);
_local3.addChildrenToLayer(_local3, _arg2);
};
}
public function copyPosition(_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
_local2 = this.transform;
_local3 = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
}
public function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = (this.x - _arg1);
_local5 = (this.y - _arg2);
_local6 = (this.z - _arg3);
_local7 = (((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6));
_local8 = (this.geometry) ? this.geometry.boundingSphere.maxDistance : 0;
return ((_local8 > _local7));
}
public static function get ZERO():DisplayObject3D{
return (new (DisplayObject3D));
}
}
}//package org.papervision3d.objects
Section 120
//BasicRenderEngine (org.papervision3d.render.BasicRenderEngine)
package org.papervision3d.render {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.clipping.*;
import org.papervision3d.core.render.project.*;
import org.papervision3d.core.render.sort.*;
import org.papervision3d.core.render.filter.*;
import org.papervision3d.events.*;
import org.papervision3d.core.utils.*;
public class BasicRenderEngine extends AbstractRenderEngine implements IRenderEngine {
public var clipping:DefaultClipping;
public var sorter:IRenderSorter;
public var projectionPipeline:ProjectionPipeline;
protected var renderDoneEvent:RendererEvent;
protected var renderList:Array;
protected var renderStatistics:RenderStatistics;
protected var renderSessionData:RenderSessionData;
protected var stopWatch:StopWatch;
protected var projectionDoneEvent:RendererEvent;
public var filter:IRenderFilter;
protected var cleanRHD:RenderHitData;
public function BasicRenderEngine():void{
cleanRHD = new RenderHitData();
super();
init();
}
override public function removeFromRenderList(_arg1:IRenderListItem):int{
return (renderList.splice(renderList.indexOf(_arg1), 1));
}
protected function doRender(_arg1:RenderSessionData, _arg2:Array=null):RenderStatistics{
var _local3:RenderableListItem;
var _local4:Viewport3D;
var _local5:ViewportLayer;
stopWatch.reset();
stopWatch.start();
MaterialManager.getInstance().updateMaterialsBeforeRender(_arg1);
filter.filter(renderList);
sorter.sort(renderList);
_local4 = _arg1.viewPort;
while ((_local3 = renderList.pop())) {
_local5 = _local4.accessLayerFor(_local3, true);
_local3.render(_arg1, _local5.graphicsChannel);
_local4.lastRenderList.push(_local3);
_local5.processRenderItem(_local3);
};
MaterialManager.getInstance().updateMaterialsAfterRender(_arg1);
_arg1.renderStatistics.renderTime = stopWatch.stop();
_arg1.viewPort.updateAfterRender(_arg1);
return (renderStatistics);
}
protected function init():void{
renderStatistics = new RenderStatistics();
projectionPipeline = new BasicProjectionPipeline();
stopWatch = new StopWatch();
sorter = new BasicRenderSorter();
filter = new BasicRenderFilter();
renderList = new Array();
clipping = null;
renderSessionData = new RenderSessionData();
renderSessionData.renderer = this;
projectionDoneEvent = new RendererEvent(RendererEvent.PROJECTION_DONE, renderSessionData);
renderDoneEvent = new RendererEvent(RendererEvent.RENDER_DONE, renderSessionData);
}
override public function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D):RenderStatistics{
_arg2.viewport = _arg3.sizeRectangle;
renderSessionData.scene = _arg1;
renderSessionData.camera = _arg2;
renderSessionData.viewPort = _arg3;
renderSessionData.container = _arg3.containerSprite;
renderSessionData.triangleCuller = _arg3.triangleCuller;
renderSessionData.particleCuller = _arg3.particleCuller;
renderSessionData.renderObjects = _arg1.objects;
renderSessionData.renderLayers = null;
renderSessionData.renderStatistics.clear();
renderSessionData.clipping = clipping;
if (clipping){
clipping.reset(renderSessionData);
};
_arg3.updateBeforeRender(renderSessionData);
projectionPipeline.project(renderSessionData);
if (hasEventListener(RendererEvent.PROJECTION_DONE)){
dispatchEvent(projectionDoneEvent);
};
doRender(renderSessionData, null);
if (hasEventListener(RendererEvent.RENDER_DONE)){
dispatchEvent(renderDoneEvent);
};
return (renderSessionData.renderStatistics);
}
public function hitTestPoint2D(_arg1:Point, _arg2:Viewport3D):RenderHitData{
return (_arg2.hitTestPoint2D(_arg1));
}
override public function addToRenderList(_arg1:RenderableListItem):int{
return (renderList.push(_arg1));
}
public function renderLayers(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D, _arg4:Array=null):RenderStatistics{
renderSessionData.scene = _arg1;
renderSessionData.camera = _arg2;
renderSessionData.viewPort = _arg3;
renderSessionData.container = _arg3.containerSprite;
renderSessionData.triangleCuller = _arg3.triangleCuller;
renderSessionData.particleCuller = _arg3.particleCuller;
renderSessionData.renderObjects = getLayerObjects(_arg4);
renderSessionData.renderLayers = _arg4;
renderSessionData.renderStatistics.clear();
renderSessionData.clipping = clipping;
_arg3.updateBeforeRender(renderSessionData);
projectionPipeline.project(renderSessionData);
if (hasEventListener(RendererEvent.PROJECTION_DONE)){
dispatchEvent(projectionDoneEvent);
};
doRender(renderSessionData);
if (hasEventListener(RendererEvent.RENDER_DONE)){
dispatchEvent(renderDoneEvent);
};
return (renderSessionData.renderStatistics);
}
private function getLayerObjects(_arg1:Array):Array{
var _local2:Array;
var _local3:ViewportLayer;
_local2 = new Array();
for each (_local3 in _arg1) {
_local2 = _local2.concat(_local3.getLayerObjects());
};
return (_local2);
}
public function destroy():void{
renderDoneEvent = null;
projectionDoneEvent = null;
projectionPipeline = null;
sorter = null;
filter = null;
renderStatistics = null;
renderList = null;
renderSessionData.destroy();
renderSessionData = null;
cleanRHD = null;
stopWatch = null;
clipping = null;
}
}
}//package org.papervision3d.render
Section 121
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import org.papervision3d.core.proto.*;
public class Scene3D extends SceneObject3D {
}
}//package org.papervision3d.scenes
Section 122
//ViewportLayerSortMode (org.papervision3d.view.layer.util.ViewportLayerSortMode)
package org.papervision3d.view.layer.util {
public class ViewportLayerSortMode {
public static var Z_SORT:String = "z";
public static var ORIGIN_SORT:String = "origin";
public static var INDEX_SORT:String = "index";
}
}//package org.papervision3d.view.layer.util
Section 123
//ViewportBaseLayer (org.papervision3d.view.layer.ViewportBaseLayer)
package org.papervision3d.view.layer {
import org.papervision3d.view.*;
import org.papervision3d.objects.*;
public class ViewportBaseLayer extends ViewportLayer {
public function ViewportBaseLayer(_arg1:Viewport3D){
super(_arg1, null);
}
override public function updateBeforeRender():void{
var _local1:int;
clear();
_local1 = (childLayers.length - 1);
while (_local1 >= 0) {
if (childLayers[_local1].dynamicLayer){
removeLayerAt(_local1);
};
_local1--;
};
super.updateBeforeRender();
}
override public function getChildLayer(_arg1:DisplayObject3D, _arg2:Boolean=true, _arg3:Boolean=false):ViewportLayer{
if (layers[_arg1]){
return (layers[_arg1]);
};
if (((_arg2) || (_arg1.useOwnContainer))){
return (getChildLayerFor(_arg1, _arg3));
};
return (this);
}
}
}//package org.papervision3d.view.layer
Section 124
//ViewportLayer (org.papervision3d.view.layer.ViewportLayer)
package org.papervision3d.view.layer {
import flash.display.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
import org.papervision3d.view.layer.util.*;
public class ViewportLayer extends Sprite {
public var layerIndex:Number;
public var originDepth:Number;// = 0
public var layers:Dictionary;
public var dynamicLayer:Boolean;// = false
public var sortMode:String;
public var weight:Number;// = 0
public var childLayers:Array;
public var forceDepth:Boolean;// = false
protected var viewport:Viewport3D;
public var screenDepth:Number;// = 0
public var displayObject3D:DisplayObject3D;
public var displayObjects:Dictionary;
public var graphicsChannel:Graphics;
public function ViewportLayer(_arg1:Viewport3D, _arg2:DisplayObject3D, _arg3:Boolean=false){
layers = new Dictionary(true);
displayObjects = new Dictionary(true);
forceDepth = false;
screenDepth = 0;
originDepth = 0;
weight = 0;
sortMode = ViewportLayerSortMode.Z_SORT;
dynamicLayer = false;
super();
this.viewport = _arg1;
this.displayObject3D = _arg2;
this.dynamicLayer = _arg3;
this.graphicsChannel = this.graphics;
if (_arg3){
this.filters = _arg2.filters;
this.blendMode = _arg2.blendMode;
this.alpha = _arg2.alpha;
};
if (_arg2){
addDisplayObject3D(_arg2);
_arg2.container = this;
};
init();
}
public function getLayerObjects(_arg1:Array=null):Array{
var _local2:DisplayObject3D;
var _local3:ViewportLayer;
if (!_arg1){
_arg1 = new Array();
};
for each (_local2 in this.displayObjects) {
if (_local2){
_arg1.push(_local2);
};
};
for each (_local3 in childLayers) {
_local3.getLayerObjects(_arg1);
};
return (_arg1);
}
protected function init():void{
childLayers = new Array();
}
public function updateInfo():void{
var _local1:ViewportLayer;
for each (_local1 in childLayers) {
_local1.updateInfo();
if (!forceDepth){
if (!isNaN(_local1.screenDepth)){
this.weight = (this.weight + _local1.weight);
this.screenDepth = (this.screenDepth + (_local1.screenDepth * _local1.weight));
this.originDepth = (this.originDepth + (_local1.originDepth * _local1.weight));
};
};
};
if (!forceDepth){
this.screenDepth = (this.screenDepth / this.weight);
this.originDepth = (this.originDepth / this.weight);
};
}
public function sortChildLayers():void{
switch (sortMode){
case ViewportLayerSortMode.Z_SORT:
childLayers.sortOn("screenDepth", (Array.DESCENDING | Array.NUMERIC));
break;
case ViewportLayerSortMode.INDEX_SORT:
childLayers.sortOn("layerIndex", Array.NUMERIC);
break;
case ViewportLayerSortMode.ORIGIN_SORT:
childLayers.sortOn(["originDepth", "screenDepth"], [(Array.DESCENDING | Array.NUMERIC), (Array.DESCENDING | Array.NUMERIC)]);
break;
};
orderLayers();
}
private function onChildRemoved(_arg1:ViewportLayerEvent):void{
if (_arg1.do3d){
unlinkChild(_arg1.do3d, _arg1);
};
}
public function removeAllLayers():void{
var _local1:int;
_local1 = (childLayers.length - 1);
while (_local1 >= 0) {
removeLayerAt(_local1);
_local1--;
};
}
public function updateAfterRender():void{
var _local1:ViewportLayer;
for each (_local1 in childLayers) {
_local1.updateAfterRender();
};
}
public function removeLayer(_arg1:ViewportLayer):void{
var _local2:int;
_local2 = getChildIndex(_arg1);
if (_local2 > -1){
removeLayerAt(_local2);
} else {
PaperLogger.error("Layer not found for removal.");
};
}
protected function getChildLayerFor(_arg1:DisplayObject3D, _arg2:Boolean=false):ViewportLayer{
var _local3:ViewportLayer;
if (_arg1){
_local3 = new ViewportLayer(viewport, _arg1, _arg1.useOwnContainer);
addLayer(_local3);
if (_arg2){
_arg1.addChildrenToLayer(_arg1, _local3);
};
return (_local3);
} else {
PaperLogger.warning("Needs to be a do3d");
};
return (null);
}
public function addLayer(_arg1:ViewportLayer):void{
var _local2:DisplayObject3D;
var _local3:ViewportLayer;
if (childLayers.indexOf(_arg1) != -1){
PaperLogger.warning("Child layer already exists in ViewportLayer");
return;
};
childLayers.push(_arg1);
addChild(_arg1);
_arg1.addEventListener(ViewportLayerEvent.CHILD_ADDED, onChildAdded);
_arg1.addEventListener(ViewportLayerEvent.CHILD_REMOVED, onChildRemoved);
for each (_local2 in _arg1.displayObjects) {
linkChild(_local2, _arg1);
};
for each (_local3 in _arg1.layers) {
for each (_local2 in _local3.displayObjects) {
linkChild(_local2, _local3);
};
};
}
protected function orderLayers():void{
var _local1:int;
var _local2:ViewportLayer;
_local1 = 0;
while (_local1 < childLayers.length) {
_local2 = childLayers[_local1];
if (this.getChildIndex(_local2) != _local1){
this.setChildIndex(_local2, _local1);
};
_local2.sortChildLayers();
_local1++;
};
}
public function childLayerIndex(_arg1:DisplayObject3D):Number{
var _local2:int;
_arg1 = (_arg1.parentContainer) ? _arg1.parentContainer : _arg1;
_local2 = 0;
while (_local2 < childLayers.length) {
if (childLayers[_local2].hasDisplayObject3D(_arg1)){
return (_local2);
};
_local2++;
};
return (-1);
}
public function removeLayerAt(_arg1:Number):void{
var _local2:DisplayObject3D;
for each (_local2 in childLayers[_arg1].displayObjects) {
unlinkChild(_local2);
};
removeChild(childLayers[_arg1]);
childLayers.splice(_arg1, 1);
}
protected function reset():void{
if (!forceDepth){
screenDepth = 0;
originDepth = 0;
};
this.weight = 0;
}
private function linkChild(_arg1:DisplayObject3D, _arg2:ViewportLayer, _arg3:ViewportLayerEvent=null):void{
layers[_arg1] = _arg2;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_ADDED, _arg1, _arg2));
}
public function updateBeforeRender():void{
var _local1:ViewportLayer;
clear();
for each (_local1 in childLayers) {
_local1.updateBeforeRender();
};
}
private function onChildAdded(_arg1:ViewportLayerEvent):void{
if (_arg1.do3d){
linkChild(_arg1.do3d, _arg1.layer, _arg1);
};
}
public function getChildLayer(_arg1:DisplayObject3D, _arg2:Boolean=true, _arg3:Boolean=false):ViewportLayer{
_arg1 = (_arg1.parentContainer) ? _arg1.parentContainer : _arg1;
if (layers[_arg1]){
return (layers[_arg1]);
};
if (_arg2){
return (getChildLayerFor(_arg1, _arg3));
};
return (null);
}
public function processRenderItem(_arg1:RenderableListItem):void{
if (!forceDepth){
if (!isNaN(_arg1.screenZ)){
this.screenDepth = (this.screenDepth + _arg1.screenZ);
if (_arg1.instance){
this.originDepth = (this.originDepth + _arg1.instance.world.n34);
this.originDepth = (this.originDepth + _arg1.instance.screen.z);
};
this.weight++;
};
};
}
public function clear():void{
graphicsChannel.clear();
reset();
}
public function removeDisplayObject3D(_arg1:DisplayObject3D):void{
displayObjects[_arg1] = null;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_REMOVED, _arg1, this));
}
private function unlinkChild(_arg1:DisplayObject3D, _arg2:ViewportLayerEvent=null):void{
layers[_arg1] = null;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_REMOVED, _arg1));
}
public function addDisplayObject3D(_arg1:DisplayObject3D, _arg2:Boolean=false):void{
if (!_arg1){
return;
};
displayObjects[_arg1] = _arg1;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_ADDED, _arg1, this));
if (_arg2){
_arg1.addChildrenToLayer(_arg1, this);
};
}
public function hasDisplayObject3D(_arg1:DisplayObject3D):Boolean{
return (!((displayObjects[_arg1] == null)));
}
}
}//package org.papervision3d.view.layer
Section 125
//ViewportLayerEvent (org.papervision3d.view.layer.ViewportLayerEvent)
package org.papervision3d.view.layer {
import flash.events.*;
import org.papervision3d.objects.*;
public class ViewportLayerEvent extends Event {
public var layer:ViewportLayer;
public var do3d:DisplayObject3D;
public static const CHILD_REMOVED:String = "childRemoved";
public static const CHILD_ADDED:String = "childAdded";
public function ViewportLayerEvent(_arg1:String, _arg2:DisplayObject3D=null, _arg3:ViewportLayer=null){
super(_arg1, false, false);
this.do3d = _arg2;
this.layer = _arg3;
}
}
}//package org.papervision3d.view.layer
Section 126
//Viewport3D (org.papervision3d.view.Viewport3D)
package org.papervision3d.view {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.log.*;
import flash.utils.*;
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 _interactive:Boolean;
public var cullingRectangle:Rectangle;
private var stageScaleModeSet:Boolean;// = false
protected var _viewportObjectFilter:ViewportObjectFilter;
protected var _layerInstances:Dictionary;
protected var _hWidth:Number;
protected var _autoScaleToStage:Boolean;
protected var _lastRenderer:IRenderEngine;
protected var _containerSprite:ViewportBaseLayer;
protected var _hHeight:Number;
public var sizeRectangle:Rectangle;
protected var renderHitData:RenderHitData;
protected var _autoClipping:Boolean;
protected var _height:Number;
public var interactiveSceneManager:InteractiveSceneManager;
public var lastRenderList:Array;
public var lineCuller:ILineCuller;
protected var _autoCulling:Boolean;
public var particleCuller:IParticleCuller;
protected var _width:Number;
public var triangleCuller:ITriangleCuller;
public function Viewport3D(_arg1:Number=640, _arg2:Number=480, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Boolean=true, _arg6:Boolean=true){
stageScaleModeSet = false;
super();
init();
this.interactive = _arg4;
this.viewportWidth = _arg1;
this.viewportHeight = _arg2;
this.autoClipping = _arg5;
this.autoCulling = _arg6;
this.autoScaleToStage = _arg3;
this._layerInstances = new Dictionary(true);
}
public function set autoCulling(_arg1:Boolean):void{
if (_arg1){
triangleCuller = new RectangleTriangleCuller(cullingRectangle);
particleCuller = new RectangleParticleCuller(cullingRectangle);
lineCuller = new RectangleLineCuller(cullingRectangle);
} else {
if (!_arg1){
triangleCuller = new DefaultTriangleCuller();
particleCuller = new DefaultParticleCuller();
lineCuller = new DefaultLineCuller();
};
};
_autoCulling = _arg1;
}
protected function onRemovedFromStage(_arg1:Event):void{
stage.removeEventListener(Event.RESIZE, onStageResize);
}
public function hitTestMouse():RenderHitData{
var _local1:Point;
_local1 = new Point(containerSprite.mouseX, containerSprite.mouseY);
return (hitTestPoint2D(_local1));
}
protected function init():void{
this.renderHitData = new RenderHitData();
lastRenderList = new Array();
sizeRectangle = new Rectangle();
cullingRectangle = new Rectangle();
_containerSprite = new ViewportBaseLayer(this);
_containerSprite.doubleClickEnabled = true;
addChild(_containerSprite);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
protected function onStageResize(_arg1:Event=null):void{
if (_autoScaleToStage){
viewportWidth = stage.stageWidth;
viewportHeight = stage.stageHeight;
};
}
public function set autoClipping(_arg1:Boolean):void{
if (_arg1){
scrollRect = sizeRectangle;
} else {
scrollRect = null;
};
_autoClipping = _arg1;
}
public function updateAfterRender(_arg1:RenderSessionData):void{
var _local2:ViewportLayer;
if (interactive){
interactiveSceneManager.updateAfterRender();
};
if (_arg1.renderLayers){
for each (_local2 in _arg1.renderLayers) {
_local2.updateInfo();
_local2.sortChildLayers();
_local2.updateAfterRender();
};
} else {
containerSprite.updateInfo();
containerSprite.updateAfterRender();
};
containerSprite.sortChildLayers();
}
public function accessLayerFor(_arg1:RenderableListItem, _arg2:Boolean=false):ViewportLayer{
var _local3:DisplayObject3D;
if (_arg1.renderableInstance){
_local3 = _arg1.renderableInstance.instance;
_local3 = (_local3.parentContainer) ? _local3.parentContainer : _local3;
if (containerSprite.layers[_local3]){
if (_arg2){
_local3.container = containerSprite.layers[_local3];
};
return (containerSprite.layers[_local3]);
} else {
if (_local3.useOwnContainer){
return (containerSprite.getChildLayer(_local3, true, true));
};
};
};
return (containerSprite);
}
public function get viewportHeight():Number{
return (_height);
}
public function get autoCulling():Boolean{
return (_autoCulling);
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:ViewportLayer;
lastRenderList.length = 0;
if (_arg1.renderLayers){
for each (_local2 in _arg1.renderLayers) {
_local2.updateBeforeRender();
};
} else {
_containerSprite.updateBeforeRender();
};
_layerInstances = new Dictionary(true);
}
protected function onAddedToStage(_arg1:Event):void{
if (_autoScaleToStage){
setStageScaleMode();
};
stage.addEventListener(Event.RESIZE, onStageResize);
onStageResize();
}
public function getChildLayer(_arg1:DisplayObject3D, _arg2:Boolean=true, _arg3:Boolean=true):ViewportLayer{
return (containerSprite.getChildLayer(_arg1, _arg2, _arg3));
}
public function hitTestPoint2D(_arg1:Point):RenderHitData{
var _local2:RenderableListItem;
var _local3:RenderHitData;
var _local4:IRenderListItem;
var _local5:uint;
renderHitData.clear();
if (interactive){
_local3 = 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 (renderHitData);
}
public function get containerSprite():ViewportLayer{
return (_containerSprite);
}
public function set viewportWidth(_arg1:Number):void{
_width = _arg1;
_hWidth = (_arg1 / 2);
containerSprite.x = _hWidth;
cullingRectangle.x = -(_hWidth);
cullingRectangle.width = _arg1;
sizeRectangle.width = _arg1;
if (_autoClipping){
scrollRect = sizeRectangle;
};
}
public function get autoClipping():Boolean{
return (_autoClipping);
}
protected function setStageScaleMode():void{
if (!stageScaleModeSet){
PaperLogger.info("Viewport autoScaleToStage : Papervision has changed the Stage scale mode.");
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stageScaleModeSet = true;
};
}
public function get viewportWidth():Number{
return (_width);
}
public function set autoScaleToStage(_arg1:Boolean):void{
_autoScaleToStage = _arg1;
if (((_arg1) && (!((stage == null))))){
setStageScaleMode();
onStageResize();
};
}
public function set viewportObjectFilter(_arg1:ViewportObjectFilter):void{
_viewportObjectFilter = _arg1;
}
public function set interactive(_arg1:Boolean):void{
if (_arg1 != _interactive){
if (((_interactive) && (interactiveSceneManager))){
interactiveSceneManager.destroy();
interactiveSceneManager = null;
};
_interactive = _arg1;
if (_arg1){
interactiveSceneManager = new InteractiveSceneManager(this);
};
};
}
public function set viewportHeight(_arg1:Number):void{
_height = _arg1;
_hHeight = (_arg1 / 2);
containerSprite.y = _hHeight;
cullingRectangle.y = -(_hHeight);
cullingRectangle.height = _arg1;
sizeRectangle.height = _arg1;
if (_autoClipping){
scrollRect = sizeRectangle;
};
}
public function get viewportObjectFilter():ViewportObjectFilter{
return (_viewportObjectFilter);
}
public function get autoScaleToStage():Boolean{
return (_autoScaleToStage);
}
public function get interactive():Boolean{
return (_interactive);
}
public function hitTestPointObject(_arg1:Point, _arg2:DisplayObject3D):RenderHitData{
var _local3:RenderableListItem;
var _local4:RenderHitData;
var _local5:IRenderListItem;
var _local6:uint;
if (interactive){
_local4 = new RenderHitData();
_local6 = lastRenderList.length;
while ((_local5 = lastRenderList[--_local6])) {
if ((_local5 is RenderableListItem)){
_local3 = (_local5 as RenderableListItem);
if ((_local3.renderableInstance is Triangle3D)){
if (Triangle3D(_local3.renderableInstance).instance != _arg2){
continue;
};
} else {
continue;
};
_local4 = _local3.hitTestPoint2D(_arg1, _local4);
if (_local4.hasHit){
return (_local4);
};
};
};
};
return (new RenderHitData());
}
public function destroy():void{
if (interactiveSceneManager){
interactiveSceneManager.destroy();
interactiveSceneManager = null;
};
lastRenderList = null;
}
}
}//package org.papervision3d.view
Section 127
//Papervision3D (org.papervision3d.Papervision3D)
package org.papervision3d {
import org.papervision3d.core.log.*;
public class Papervision3D {
public static var useDEGREES:Boolean = true;
public static var useRIGHTHANDED:Boolean = false;
public static var PAPERLOGGER:PaperLogger = PaperLogger.getInstance();
public static var NAME:String = "Papervision3D";
public static var DATE:String = "December 3rd, 2008";
public static var AUTHOR:String = "(c) 2006-2008 Copyright by Carlos Ulloa | John Grden | Ralph Hauwert | Tim Knip | Andy Zupko";
public static var VERSION:String = "Public Beta 2.0 - Great White";
public static var usePERCENT:Boolean = false;
}
}//package org.papervision3d
Section 128
//comp_entry_133 (powershots_fla.comp_entry_133)
package powershots_fla {
import flash.display.*;
public dynamic class comp_entry_133 extends MovieClip {
public var buttonBack:button_comp_back;
public var buttonCancel:button_comp_cancel;
public var sending:MovieClip;
public var terms:MovieClip;
public var sent:MovieClip;
public var form:MovieClip;
public var buttonSubmit:button_comp_submit;
}
}//package powershots_fla
Section 129
//comp_terms_text_135 (powershots_fla.comp_terms_text_135)
package powershots_fla {
import flash.display.*;
public dynamic class comp_terms_text_135 extends MovieClip {
public var win:MovieClip;
public var handle:MovieClip;
public var rail:MovieClip;
public var page:MovieClip;
}
}//package powershots_fla
Section 130
//competition_sent_147 (powershots_fla.competition_sent_147)
package powershots_fla {
import flash.display.*;
import flash.events.*;
public dynamic class competition_sent_147 extends MovieClip {
public function competition_sent_147(){
addFrameScript(0, frame1, 19, frame20);
}
function frame1(){
stop();
}
function frame20(){
dispatchEvent(new Event("competition_send_done"));
}
}
}//package powershots_fla
Section 131
//fill1_110 (powershots_fla.fill1_110)
package powershots_fla {
import flash.display.*;
public dynamic class fill1_110 extends MovieClip {
public var down:MovieClip;
public var up:MovieClip;
public var fillUp:MovieClip;
public var fillDown:MovieClip;
}
}//package powershots_fla
Section 132
//fill2_112 (powershots_fla.fill2_112)
package powershots_fla {
import flash.display.*;
public dynamic class fill2_112 extends MovieClip {
public var slice2:MovieClip;
public var slice3:MovieClip;
public var slice1:MovieClip;
}
}//package powershots_fla
Section 133
//final_score_clip_75 (powershots_fla.final_score_clip_75)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class final_score_clip_75 extends MovieClip {
public var txtScore:TextField;
}
}//package powershots_fla
Section 134
//form_140 (powershots_fla.form_140)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class form_140 extends MovieClip {
public var noName:MovieClip;
public var noEmail:MovieClip;
public var buttonTerms:button_terms;
public var inputName:TextField;
public var inputEmail:TextField;
}
}//package powershots_fla
Section 135
//hud_round_clip_46 (powershots_fla.hud_round_clip_46)
package powershots_fla {
import flash.display.*;
public dynamic class hud_round_clip_46 extends MovieClip {
public function hud_round_clip_46(){
addFrameScript(0, frame1, 54, frame55, 108, frame109, 162, frame163);
}
function frame163(){
gotoAndStop("off");
}
function frame1(){
stop();
}
function frame109(){
gotoAndStop("off");
}
function frame55(){
gotoAndStop("off");
}
}
}//package powershots_fla
Section 136
//hud_score_1_40 (powershots_fla.hud_score_1_40)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class hud_score_1_40 extends MovieClip {
public var txtScore:TextField;
}
}//package powershots_fla
Section 137
//hud_score_2_41 (powershots_fla.hud_score_2_41)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class hud_score_2_41 extends MovieClip {
public var txtScore:TextField;
}
}//package powershots_fla
Section 138
//hud_score_3_42 (powershots_fla.hud_score_3_42)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class hud_score_3_42 extends MovieClip {
public var txtScore:TextField;
}
}//package powershots_fla
Section 139
//hud_score_43 (powershots_fla.hud_score_43)
package powershots_fla {
import flash.display.*;
import flash.events.*;
public dynamic class hud_score_43 extends MovieClip {
public var score:MovieClip;
public function hud_score_43(){
addFrameScript(0, frame1, 30, frame31, 99, frame100);
}
function frame1(){
stop();
}
function frame100(){
dispatchEvent(new Event("score_display_complete"));
}
function frame31(){
dispatchEvent(new Event("score_display_started"));
}
}
}//package powershots_fla
Section 140
//hud_score_clip_44 (powershots_fla.hud_score_clip_44)
package powershots_fla {
import flash.display.*;
public dynamic class hud_score_clip_44 extends MovieClip {
public var scoreText:MovieClip;
}
}//package powershots_fla
Section 141
//invalid_field_anim_146 (powershots_fla.invalid_field_anim_146)
package powershots_fla {
import flash.display.*;
public dynamic class invalid_field_anim_146 extends MovieClip {
public function invalid_field_anim_146(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package powershots_fla
Section 142
//lensflareClip_32 (powershots_fla.lensflareClip_32)
package powershots_fla {
import flash.display.*;
public dynamic class lensflareClip_32 extends MovieClip {
public function lensflareClip_32(){
addFrameScript(42, frame43);
}
function frame43(){
stop();
}
}
}//package powershots_fla
Section 143
//loading_bar_1 (powershots_fla.loading_bar_1)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class loading_bar_1 extends MovieClip {
public var txtPercLoaded:TextField;
}
}//package powershots_fla
Section 144
//popQuitClip_57 (powershots_fla.popQuitClip_57)
package powershots_fla {
import flash.display.*;
public dynamic class popQuitClip_57 extends MovieClip {
public var buttonYes:button_quit_yes;
public var buttonNo:button_quit_no;
}
}//package powershots_fla
Section 145
//quit_menu_56 (powershots_fla.quit_menu_56)
package powershots_fla {
import flash.display.*;
public dynamic class quit_menu_56 extends MovieClip {
public var box:MovieClip;
public function quit_menu_56(){
addFrameScript(0, frame1, 6, frame7);
}
function frame7(){
stop();
}
function frame1(){
stop();
}
}
}//package powershots_fla
Section 146
//resultsClip_70 (powershots_fla.resultsClip_70)
package powershots_fla {
import flash.display.*;
import flash.events.*;
public dynamic class resultsClip_70 extends MovieClip {
public var sentBox:MovieClip;
public var waitBox:MovieClip;
public var total:MovieClip;
public var submitBox:MovieClip;
public var sportResults:MovieClip;
public function resultsClip_70(){
addFrameScript(56, frame57, 74, frame75, 99, frame100, 117, frame118, 142, frame143, 175, frame176);
}
function frame143(){
dispatchEvent(new Event("round3_scores"));
}
function frame75(){
dispatchEvent(new Event("round1_scores_complete"));
}
function frame176(){
stop();
dispatchEvent(new Event("results_complete"));
}
function frame100(){
dispatchEvent(new Event("round2_scores"));
}
function frame118(){
dispatchEvent(new Event("round2_scores_complete"));
}
function frame57(){
dispatchEvent(new Event("round1_scores"));
}
}
}//package powershots_fla
Section 147
//resultsGroup1_96 (powershots_fla.resultsGroup1_96)
package powershots_fla {
import flash.display.*;
public dynamic class resultsGroup1_96 extends MovieClip {
public var roundName:MovieClip;
public var shot1:MovieClip;
public var shot2:MovieClip;
public var shot3:MovieClip;
}
}//package powershots_fla
Section 148
//resultsRound1_103 (powershots_fla.resultsRound1_103)
package powershots_fla {
import flash.display.*;
public dynamic class resultsRound1_103 extends MovieClip {
public var nameClip:MovieClip;
}
}//package powershots_fla
Section 149
//resultsScore_97 (powershots_fla.resultsScore_97)
package powershots_fla {
import flash.display.*;
public dynamic class resultsScore_97 extends MovieClip {
public var score:MovieClip;
}
}//package powershots_fla
Section 150
//resultsSubmit_88 (powershots_fla.resultsSubmit_88)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class resultsSubmit_88 extends MovieClip {
public var playerName:TextField;
public var buttonPlayAgain:button_play_again;
public var buttonSubmitScore:button_submit_score;
}
}//package powershots_fla
Section 151
//resultsTotal_74 (powershots_fla.resultsTotal_74)
package powershots_fla {
import flash.display.*;
public dynamic class resultsTotal_74 extends MovieClip {
public var score:MovieClip;
}
}//package powershots_fla
Section 152
//resultsTotalGroup_71 (powershots_fla.resultsTotalGroup_71)
package powershots_fla {
import flash.display.*;
public dynamic class resultsTotalGroup_71 extends MovieClip {
public var scoreGlow:MovieClip;
public var score:MovieClip;
public function resultsTotalGroup_71(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package powershots_fla
Section 153
//score_done_81 (powershots_fla.score_done_81)
package powershots_fla {
import flash.display.*;
public dynamic class score_done_81 extends MovieClip {
public var buttonPlayAgain:button_no;
public var buttonViewScores:button_yes;
}
}//package powershots_fla
Section 154
//score_round_104 (powershots_fla.score_round_104)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class score_round_104 extends MovieClip {
public var txtRound:TextField;
}
}//package powershots_fla
Section 155
//score_text_45 (powershots_fla.score_text_45)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class score_text_45 extends MovieClip {
public var txtScore:TextField;
}
}//package powershots_fla
Section 156
//shot_score_98 (powershots_fla.shot_score_98)
package powershots_fla {
import flash.display.*;
import flash.text.*;
public dynamic class shot_score_98 extends MovieClip {
public var txtScore:TextField;
}
}//package powershots_fla
Section 157
//soccer_arrow_bar_8 (powershots_fla.soccer_arrow_bar_8)
package powershots_fla {
import flash.display.*;
import flash.events.*;
public dynamic class soccer_arrow_bar_8 extends MovieClip {
public function soccer_arrow_bar_8(){
addFrameScript(0, frame1, 34, frame35);
}
function frame1(){
stop();
}
function frame35(){
dispatchEvent(new Event("powerbar_full"));
}
}
}//package powershots_fla
Section 158
//tennis_hud_bars_120 (powershots_fla.tennis_hud_bars_120)
package powershots_fla {
import flash.display.*;
public dynamic class tennis_hud_bars_120 extends MovieClip {
public var fill:MovieClip;
public var down:MovieClip;
public var up:MovieClip;
}
}//package powershots_fla
Section 159
//tennis_hud_fill2_126 (powershots_fla.tennis_hud_fill2_126)
package powershots_fla {
import flash.display.*;
public dynamic class tennis_hud_fill2_126 extends MovieClip {
public var mask1:MovieClip;
}
}//package powershots_fla
Section 160
//Ball (Ball)
package {
import org.papervision3d.materials.*;
import org.papervision3d.objects.primitives.*;
public class Ball extends Sphere {
public var radius:Number;
public function Ball(_arg1:String, _arg2:Number, _arg3:int, _arg4:int):void{
var _local5:BitmapAssetMaterial;
_local5 = new BitmapAssetMaterial(_arg1);
radius = _arg2;
super(_local5, radius, _arg3, _arg4);
y = radius;
}
}
}//package
Section 161
//BasicButton (BasicButton)
package {
import flash.display.*;
import flash.events.*;
class BasicButton extends MovieClip {
public var id:int;// = 0
function BasicButton():void{
id = 0;
super();
stop();
buttonMode = true;
mouseChildren = false;
addEventListener(MouseEvent.MOUSE_OVER, onOver);
addEventListener(MouseEvent.MOUSE_OUT, onOut);
}
private function onOver(_arg1:MouseEvent):void{
gotoAndStop("over");
}
private function onOut(_arg1:MouseEvent):void{
gotoAndStop("out");
}
}
}//package
Section 162
//Block (Block)
package {
import org.papervision3d.materials.utils.*;
import org.papervision3d.objects.primitives.*;
public class Block extends Cube {
public var height:Number;
public var width:Number;
public var depth:Number;
public function Block(_arg1:MaterialsList, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:int=1, _arg6:int=1, _arg7:int=1, _arg8:int=0):void{
width = _arg2;
height = _arg4;
depth = _arg3;
super(_arg1, width, depth, height, _arg5, _arg7, _arg6, Cube.NONE, _arg8);
}
}
}//package
Section 163
//button_comp_back (button_comp_back)
package {
public dynamic class button_comp_back extends BasicButton {
}
}//package
Section 164
//button_comp_cancel (button_comp_cancel)
package {
public dynamic class button_comp_cancel extends BasicButton {
}
}//package
Section 165
//button_comp_submit (button_comp_submit)
package {
public dynamic class button_comp_submit extends BasicButton {
}
}//package
Section 166
//button_competition (button_competition)
package {
public dynamic class button_competition extends BasicButton {
}
}//package
Section 167
//button_help_off (button_help_off)
package {
public dynamic class button_help_off extends BasicButton {
}
}//package
Section 168
//button_help_on (button_help_on)
package {
public dynamic class button_help_on extends BasicButton {
}
}//package
Section 169
//button_hiscores (button_hiscores)
package {
public dynamic class button_hiscores extends BasicButton {
public function button_hiscores(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 170
//button_no (button_no)
package {
public dynamic class button_no extends BasicButton {
}
}//package
Section 171
//button_play (button_play)
package {
public dynamic class button_play extends BasicButton {
public function button_play(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 172
//button_play_again (button_play_again)
package {
public dynamic class button_play_again extends BasicButton {
}
}//package
Section 173
//button_quit (button_quit)
package {
public dynamic class button_quit extends BasicButton {
}
}//package
Section 174
//button_quit_no (button_quit_no)
package {
public dynamic class button_quit_no extends BasicButton {
public function button_quit_no(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 175
//button_quit_yes (button_quit_yes)
package {
public dynamic class button_quit_yes extends BasicButton {
public function button_quit_yes(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 176
//button_sound_off (button_sound_off)
package {
public dynamic class button_sound_off extends BasicButton {
}
}//package
Section 177
//button_sound_on (button_sound_on)
package {
public dynamic class button_sound_on extends BasicButton {
}
}//package
Section 178
//button_submit_score (button_submit_score)
package {
public dynamic class button_submit_score extends BasicButton {
}
}//package
Section 179
//button_terms (button_terms)
package {
public dynamic class button_terms extends BasicButton {
}
}//package
Section 180
//button_url (button_url)
package {
public dynamic class button_url extends BasicButton {
}
}//package
Section 181
//button_yes (button_yes)
package {
public dynamic class button_yes extends BasicButton {
}
}//package
Section 182
//Collisions (Collisions)
package {
public class Collisions {
public static function pointAABBTest(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number){
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local10 = (_arg1 - (0.5 * _arg4));
_local11 = (_arg1 + (0.5 * _arg4));
_local12 = (_arg2 - (0.5 * _arg5));
_local13 = (_arg2 + (0.5 * _arg5));
_local14 = (_arg3 - (0.5 * _arg6));
_local15 = (_arg3 + (0.5 * _arg6));
if ((((((((((((_local10 > _arg7)) || ((_local11 < _arg7)))) || ((_local12 > _arg8)))) || ((_local13 < _arg8)))) || ((_local14 > _arg9)))) || ((_local15 < _arg9)))){
return (false);
};
return (true);
}
public static function sphereAABBTest(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number):Boolean{
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local11 = (_arg5 - (0.5 * _arg8));
_local12 = (_arg5 + (0.5 * _arg8));
_local13 = (_arg6 - (0.5 * _arg9));
_local14 = (_arg6 + (0.5 * _arg9));
_local15 = (_arg7 - (0.5 * _arg10));
_local16 = (_arg7 + (0.5 * _arg10));
if ((((((((((((_local11 > (_arg1 + _arg4))) || ((_local12 < (_arg1 - _arg4))))) || ((_local13 > (_arg2 + _arg4))))) || ((_local14 < (_arg2 - _arg4))))) || ((_local15 > (_arg3 + _arg4))))) || ((_local16 < (_arg3 - _arg4))))){
return (false);
};
return (true);
}
}
}//package
Section 183
//CompetitionScreen (CompetitionScreen)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import com.memecounter.*;
public class CompetitionScreen extends MovieClip {
private const PAGE_DONE:int = 2;
private const PAGE_FORM:int = 0;
private const DATA_CAPTURE_URL:String = "http://service.fishinabottle.com/datacapture/powershots/submitdata.php";
private const PAGE_TERMS:int = 1;
private var scrollbar:Scrollbar;
public var stageRef:Stage;
public var competition:MovieClip;
private var currPage:int;
public var back:MovieClip;
public function CompetitionScreen(_arg1:Stage):void{
addFrameScript(0, frame1, 10, frame11, 20, frame21);
competition.terms.visible = false;
competition.sending.visible = false;
competition.sent.visible = false;
competition.buttonBack.visible = false;
stageRef = _arg1;
scrollbar = new Scrollbar(stageRef, competition.terms.page, competition.terms.win, competition.terms.handle, competition.terms.rail);
competition.buttonSubmit.addEventListener(MouseEvent.CLICK, onSubmitClicked);
competition.buttonCancel.addEventListener(MouseEvent.CLICK, onCancelClicked);
competition.buttonBack.addEventListener(MouseEvent.CLICK, onBackClicked);
competition.form.buttonTerms.addEventListener(MouseEvent.CLICK, onTermsClicked);
addEventListener("competition_closed", onCompetitionClosed);
}
private function onCompetitionClosed(_arg1:Event):void{
visible = false;
}
private function hideDone():void{
competition.sent.visible = false;
competition.sending.visible = false;
}
private function onCompetitionEntryReceived(_arg1:Event):Boolean{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, onCompetitionEntryReceived);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, onCompetitionIOError);
if (_local2.data.res == "0"){
trace("Error posting data");
competition.sending.visible = false;
competition.sent.visible = true;
competition.sent.addEventListener("competition_send_done", sendComplete);
competition.sent.play();
return (false);
};
Tracker.kvEvent(2676);
competition.sending.visible = false;
competition.sent.visible = true;
competition.sent.addEventListener("competition_send_done", sendComplete);
competition.sent.play();
return (true);
}
private function onBackClicked(_arg1:MouseEvent):void{
if (currPage == PAGE_DONE){
quit();
} else {
hideTerms();
showEntryForm();
};
}
private function onCompetitionIOError(_arg1:IOErrorEvent):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
trace("Error posting data 1");
competition.sending.visible = false;
competition.sent.visible = true;
competition.sent.addEventListener("competition_send_done", sendComplete);
competition.sent.play();
_local2.removeEventListener(Event.COMPLETE, onCompetitionEntryReceived);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, onCompetitionIOError);
}
private function showDone():void{
competition.sending.visible = true;
currPage = PAGE_DONE;
}
private function validateEmail(_arg1:String):Boolean{
var _local2:Number;
var _local3:Number;
if (_arg1.length < 9){
return (false);
};
_local2 = _arg1.indexOf("@");
if (_local2 == -1){
return (false);
};
if (_local2 < 2){
return (false);
};
_local3 = _arg1.lastIndexOf(".");
if (_local3 == -1){
return (false);
};
if (((!((_local3 == (_arg1.length - 3)))) && (!((_local3 == (_arg1.length - 4)))))){
return (false);
};
if (Math.abs((_local3 - _local2)) < 2){
return (false);
};
return (true);
}
private function hideEntryForm():void{
competition.form.visible = false;
competition.buttonSubmit.visible = false;
competition.buttonCancel.visible = false;
}
private function onSubmitClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("enter_competition"));
enterCompetition();
}
private function quit():void{
competition.form.inputName.text = "";
competition.form.inputEmail.text = "";
gotoAndPlay("off");
}
function frame1(){
stop();
}
function frame21(){
dispatchEvent(new Event("competition_closed"));
}
private function hideTerms():void{
competition.terms.visible = false;
competition.buttonBack.visible = false;
}
private function showTerms():void{
competition.terms.visible = true;
competition.buttonBack.visible = true;
currPage = PAGE_TERMS;
}
function frame11(){
stop();
}
private function onCancelClicked(_arg1:MouseEvent):void{
quit();
}
private function enterCompetition():Boolean{
var _local1:URLVariables;
var _local2:URLRequest;
var _local3:URLLoader;
if (competition.form.inputName.text == ""){
competition.form.noName.play();
return (false);
};
if (!validateEmail(competition.form.inputEmail.text)){
competition.form.noEmail.play();
return (false);
};
_local1 = new URLVariables();
_local1.name = competition.form.inputName.text;
_local1.email = competition.form.inputEmail.text;
_local2 = new URLRequest(DATA_CAPTURE_URL);
_local3 = new URLLoader();
_local3.dataFormat = URLLoaderDataFormat.VARIABLES;
_local2.data = _local1;
_local2.method = URLRequestMethod.GET;
_local3.addEventListener(Event.COMPLETE, onCompetitionEntryReceived);
_local3.addEventListener(IOErrorEvent.IO_ERROR, onCompetitionIOError);
_local3.load(_local2);
hideEntryForm();
showDone();
return (true);
}
public function showEntryForm():void{
hideDone();
competition.form.visible = true;
competition.buttonSubmit.visible = true;
competition.buttonCancel.visible = true;
currPage = PAGE_FORM;
}
private function onTermsClicked(_arg1:MouseEvent):void{
hideEntryForm();
showTerms();
}
private function sendComplete(_arg1:Event):void{
competition.sent.removeEventListener("competition_send_done", sendComplete);
quit();
}
}
}//package
Section 184
//FlashAnims (FlashAnims)
package {
import flash.display.*;
public dynamic class FlashAnims extends MovieClip {
public function FlashAnims(){
addFrameScript(0, frame1, 27, frame28, 48, frame49, 69, frame70, 90, frame91);
}
function frame70(){
gotoAndPlay("off");
}
function frame91(){
gotoAndPlay("off");
}
function frame1(){
stop();
}
function frame28(){
gotoAndStop("off");
}
function frame49(){
gotoAndPlay("off");
}
}
}//package
Section 185
//Floor (Floor)
package {
import flash.display.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.primitives.*;
public class Floor extends Plane {
public var height:Number;
public var width:Number;
public var depth:Number;
public function Floor(_arg1:BitmapData, _arg2:Number=1, _arg3:Number=1, _arg4:int=1, _arg5:int=1, _arg6:Boolean=false):void{
var _local7:BitmapMaterial;
width = _arg2;
depth = _arg3;
_local7 = new BitmapMaterial(_arg1, _arg6);
_local7.name = "mat";
super(_local7, width, depth, _arg4, _arg5);
rotationX = 90;
}
}
}//package
Section 186
//FPS (FPS)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
public dynamic class FPS extends MovieClip {
public var prevSecondTime:Number;
public var secondTime:Number;
public var tf:TextField;
public var frames:Number;
public var time:Number;
public var frameTime:Number;
public var fps:String;
public var prevFrameTime:Number;
public function FPS(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
prevFrameTime = getTimer();
prevSecondTime = getTimer();
frames = 0;
fps = "...";
}
function frame2(){
stop();
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(_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) + " MS");
}
}
}//package
Section 187
//GameHUD (GameHUD)
package {
import flash.display.*;
import flash.events.*;
public class GameHUD extends MovieClip {
public var buttonHelpOff:MovieClip;
public var buttonSoundOff:MovieClip;
public var roundDisplay:MovieClip;
public var quitMenu:MovieClip;
public var hit:MovieClip;
public var buttonQuit:MovieClip;
public var buttonSoundOn:MovieClip;
public var buttonHelpOn:MovieClip;
public var scoreDisplay:MovieClip;
public var score2:MovieClip;
public var score3:MovieClip;
public var score1:MovieClip;
public function GameHUD():void{
quitMenu.visible = false;
hit.buttonMode = true;
hit.mouseEnabled = true;
hit.useHandCursor = false;
buttonSoundOn.visible = false;
buttonSoundOff.addEventListener(MouseEvent.CLICK, onSoundOffClicked);
buttonSoundOn.addEventListener(MouseEvent.CLICK, onSoundOnClicked);
buttonHelpOff.visible = false;
buttonHelpOff.addEventListener(MouseEvent.CLICK, onHelpOffClicked);
buttonHelpOn.addEventListener(MouseEvent.CLICK, onHelpOnClicked);
buttonQuit.addEventListener(MouseEvent.CLICK, onQuitClicked);
quitMenu.box.buttonYes.mouseEnabled = false;
quitMenu.box.buttonNo.mouseEnabled = false;
quitMenu.box.buttonYes.addEventListener(MouseEvent.CLICK, onQuitConfirm);
quitMenu.box.buttonNo.addEventListener(MouseEvent.CLICK, onQuitCancel);
}
private function onQuitConfirm(_arg1:MouseEvent):void{
dispatchEvent(new Event("quit_game"));
quitMenu.box.buttonYes.mouseEnabled = false;
quitMenu.box.buttonNo.mouseEnabled = false;
quitMenu.gotoAndPlay("off");
}
private function onSoundOffClicked(_arg1:Event):void{
buttonSoundOn.visible = true;
buttonSoundOff.visible = false;
dispatchEvent(new Event("sound_off"));
}
private function onHelpOnClicked(_arg1:Event):void{
dispatchEvent(new Event("help_on"));
}
private function onQuitClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("quit_game"));
}
private function onHelpOffClicked(_arg1:Event):void{
dispatchEvent(new Event("help_off"));
}
private function onSoundOnClicked(_arg1:Event):void{
buttonSoundOn.visible = false;
buttonSoundOff.visible = true;
dispatchEvent(new Event("sound_on"));
}
private function onQuitCancel(_arg1:MouseEvent):void{
dispatchEvent(new Event("resume_game"));
quitMenu.box.buttonYes.mouseEnabled = false;
quitMenu.box.buttonNo.mouseEnabled = false;
quitMenu.gotoAndPlay("off");
}
}
}//package
Section 188
//GolfInterface (GolfInterface)
package {
import flash.display.*;
import flash.events.*;
public class GolfInterface extends MovieClip {
private const STATE_GOING_UP:int = 2;
private const STATE_WAITING:int = 1;
private const STATE_GOING_DOWN:int = 3;
public var power:MovieClip;
public var help:MovieClip;
public var speed:Number;
private var currState:int;
public var isReady:Boolean;
public var powVal:Number;
public var rot:Number;
public var angVal:Number;
public function GolfInterface():void{
init();
}
public function init():void{
isReady = false;
visible = false;
speed = 5;
rot = -16;
currState = STATE_WAITING;
power.down.visible = false;
power.down.mask = power.fillDown;
power.up.mask = power.fillUp;
power.fillUp.rotation = (power.fillUp.slice1.rotation = (power.fillUp.slice2.rotation = -16));
power.fillDown.rotation = (power.fillDown.slice1.rotation = (power.fillDown.slice2.rotation = -16));
}
public function onReleased():void{
}
public function onPressed():void{
if (!isReady){
return;
};
switch (currState){
case STATE_WAITING:
currState = STATE_GOING_UP;
break;
case STATE_GOING_UP:
if (rot < 30){
return;
};
speed = 5;
power.fillDown.rotation = power.fillUp.rotation;
power.fillDown.slice1.rotation = power.fillUp.slice1.rotation;
power.fillDown.slice2.rotation = power.fillUp.slice2.rotation;
power.down.visible = true;
setPower();
currState = STATE_GOING_DOWN;
break;
case STATE_GOING_DOWN:
if (rot > 200){
return;
};
setAccuracy();
dispatchEvent(new Event("input_complete"));
isReady = false;
break;
};
}
public function start():void{
isReady = true;
visible = true;
currState = STATE_WAITING;
}
private function setAccuracy():void{
angVal = ((rot - 32) * -1);
if (angVal > 16){
angVal = 16;
};
if (angVal < -16){
angVal = -16;
};
}
private function setPower():void{
if (rot > 220){
powVal = (220 + ((rot - 220) * 2));
} else {
powVal = rot;
};
}
public function update():void{
if (!isReady){
return;
};
switch (currState){
case STATE_WAITING:
break;
case STATE_GOING_UP:
power.fillUp.rotation = (power.fillUp.rotation + speed);
power.fillUp.slice1.rotation = (power.fillUp.slice1.rotation - (0.35 * speed));
power.fillUp.slice2.rotation = (power.fillUp.slice2.rotation - (0.7 * speed));
rot = (rot + speed);
speed = (speed + (rot * 0.001));
if (rot >= 240){
power.fillUp.rotation = (power.fillUp.rotation - (rot - 240));
power.fillUp.slice1.rotation = (power.fillUp.slice1.rotation + (0.35 * (rot - 240)));
power.fillUp.slice2.rotation = (power.fillUp.slice2.rotation + (0.7 * (rot - 240)));
rot = 240;
speed = 5;
power.fillDown.rotation = power.fillUp.rotation;
power.fillDown.slice1.rotation = power.fillUp.slice1.rotation;
power.fillDown.slice2.rotation = power.fillUp.slice2.rotation;
power.down.visible = true;
setPower();
currState = STATE_GOING_DOWN;
};
break;
case STATE_GOING_DOWN:
power.fillUp.rotation = (power.fillUp.rotation - speed);
power.fillUp.slice1.rotation = (power.fillUp.slice1.rotation + (0.35 * speed));
power.fillUp.slice2.rotation = (power.fillUp.slice2.rotation + (0.7 * speed));
rot = (rot - speed);
speed = (speed + (rot * 0.001));
if (rot <= -16){
power.fillUp.rotation = -16;
power.fillUp.slice1.rotation = -16;
power.fillUp.slice2.rotation = -16;
rot = -16;
setAccuracy();
isReady = false;
dispatchEvent(new Event("input_complete"));
};
break;
};
}
}
}//package
Section 189
//Highscores (Highscores)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Highscores extends MovieClip {
private var isConfigured:Boolean;
private var scoresPerPage:Number;
private var leaguesOn:Boolean;
public var fiab_league_player;
private var playerName:String;
private var scoreID:Number;
public var buttonNext:MovieClip;
public var buttonPrevious:MovieClip;
public var fiab_league_action;
private var attemptCount:int;
private var leagueName:String;
private var leagueID:int;
private var maxScore:Number;
private var gameName:String;
private var minScore:Number;
public var serviceURL:String;
public var gameID:int;
private var globalScores:Boolean;
private var scoresAsTime:Boolean;
private var currTable:String;
public var table:MovieClip;
public var fiab_league_id;
private var leaguePlayer:int;
public function Highscores():void{
stop();
visible = false;
attemptCount = 0;
isConfigured = false;
leagueID = 0;
leaguePlayer = 0;
}
private function submitReceived(_arg1:Event):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
dispatchEvent(new Event("submit_complete"));
_local2.removeEventListener(Event.COMPLETE, submitReceived);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
}
public function sendData(_arg1:String, _arg2:URLVariables, _arg3:Function):void{
var _local4:URLRequest;
var _local5:URLLoader;
_local4 = new URLRequest(_arg1);
_local5 = new URLLoader();
_local5.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4.data = _arg2;
_local4.method = URLRequestMethod.GET;
_local5.addEventListener(Event.COMPLETE, _arg3);
_local5.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_local5.load(_local4);
}
public function setLeagueInfo(_arg1:int, _arg2:int):void{
leagueID = _arg1;
leaguePlayer = _arg2;
}
public function submit(_arg1:String, _arg2:Number, _arg3:int=0):void{
var _local4:URLVariables;
var _local5:Date;
trace(("Submitting Score to " + serviceURL));
_local4 = new URLVariables();
_local5 = new Date();
scoreID = 0;
_local4.fiab_viral_id = gameID;
_local4.rnd = _local5.getTime();
_local4.fiab_score_action = "SUBMIT";
_local4.scorerName = _arg1;
_local4.score = _arg2;
_local4.score_id = scoreID;
_local4.league_id = leagueID;
_local4.league_player = leaguePlayer;
_local4.globalScore = _arg3;
trace(("Player set as " + _local4.league_player));
sendData(serviceURL, _local4, submitReceived);
}
private function onIOError(_arg1:IOErrorEvent):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
trace("Error loading URL");
_local2.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
}
public function configure(_arg1:String, _arg2:int):void{
var _local3:Date;
var _local4:URLVariables;
serviceURL = _arg1;
gameID = _arg2;
_local3 = new Date();
_local4 = new URLVariables();
_local4.fiab_viral_id = gameID;
_local4.rnd = _local3.getTime();
_local4.fiab_score_action = "CONFIGURE";
_local4.league_id = leagueID;
_local4.fiab_league_player = leaguePlayer;
sendData(serviceURL, _local4, configureReceived);
}
private function configureReceived(_arg1:Event):void{
var _local2:URLLoader;
var _local3:String;
_local2 = URLLoader(_arg1.target);
for (_local3 in _local2.data) {
trace((">" + _local2.data[_local3]));
};
attemptCount = 0;
if (_local2.data.fiab_league_player == 0){
leaguePlayer = 0;
};
if (_local2.data.league_id == 0){
leagueID = 0;
};
leagueName = _local2.data.league_name;
if (_local2.data.leaguesOn == "true"){
leaguesOn = true;
} else {
leaguesOn = false;
};
if (_local2.data.global_scores == "true"){
globalScores = true;
} else {
globalScores = false;
};
if (_local2.data.scoresAsTime == "false"){
scoresAsTime = false;
} else {
scoresAsTime = true;
};
maxScore = Number(_local2.data.max_score);
minScore = Number(_local2.data.min_score);
scoresPerPage = Number(_local2.data.scoresPerPage);
gameName = _local2.data.game_name;
if (((((!((leagueID == 0))) && (!((leaguePlayer == 0))))) && ((leaguesOn == true)))){
currTable = "LEAGUE";
if (_local2.data.player_name != undefined){
playerName = _local2.data.player_name;
};
};
isConfigured = true;
dispatchEvent(new Event("configure_complete"));
_local2.removeEventListener(Event.COMPLETE, configureReceived);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
}
}
}//package
Section 190
//HitAnim (HitAnim)
package {
import flash.display.*;
public dynamic class HitAnim extends MovieClip {
public function HitAnim(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 191
//MainMenu (MainMenu)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
public class MainMenu extends MovieClip {
public var compText:MovieClip;
public var buttonScores:MovieClip;
public var buttonCompetition:MovieClip;
public var highscoreURL:String;// = "http://www.worldsport.tv/#highscores"
public var highscoreRequest:URLRequest;
public var buttonLink:MovieClip;
public var debug:TextField;
public var buttonPlay:MovieClip;
public var compLine:MovieClip;
public var compItem:MovieClip;
public function MainMenu():void{
var _local1:Date;
highscoreURL = "http://www.worldsport.tv/#highscores";
highscoreRequest = new URLRequest(highscoreURL);
super();
addFrameScript(12, frame13, 82, frame83);
buttonPlay.addEventListener(MouseEvent.CLICK, onPlayClicked);
buttonScores.addEventListener(MouseEvent.MOUSE_UP, onScoresClicked);
_local1 = new Date();
if (_local1.getTime() < 1255046400000){
buttonCompetition.addEventListener(MouseEvent.CLICK, onCompetitionClicked);
} else {
buttonCompetition.visible = false;
compText.visible = false;
compItem.visible = false;
compLine.visible = false;
};
}
private function onScoresClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("scores_clicked"));
}
private function onPlayClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("play_clicked"));
}
function frame13(){
dispatchEvent(new Event("title_ready"));
}
private function onLinkClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("link_clicked"));
}
function frame83(){
stop();
}
private function onCompetitionClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("competition_clicked"));
}
}
}//package
Section 192
//misc_button (misc_button)
package {
public dynamic class misc_button extends BasicButton {
}
}//package
Section 193
//Powershots (Powershots)
package {
import flash.display.*;
import flash.events.*;
import org.papervision3d.materials.utils.*;
import gs.*;
import org.papervision3d.view.*;
import org.papervision3d.materials.*;
import org.papervision3d.view.layer.*;
import flash.utils.*;
import flash.filters.*;
import flash.net.*;
import com.memecounter.*;
import gs.easing.*;
import org.papervision3d.view.layer.util.*;
import flash.media.*;
import org.papervision3d.render.*;
import org.papervision3d.scenes.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.cameras.*;
import flash.ui.*;
public class Powershots extends MovieClip {
private const SPORT_TENNIS:int = 2;
private const SPORT_GOLF:int = 3;
private const HIGHSCORE_URL:String = "http://service.fishinabottle.com/hiscores2/hiscores_general_2.php";
private const SPORT_SOCCER:int = 1;
private const LEAGUE_URL:String = "http://service.fishinabottle.com/hiscores2/league_return_2.php";
private const GAME_URL:String = "http://powershots.worldsport.tv/index.html";
private const HIGHSCORE_TABLE_URL:String = "http://www.worldsport.tv/#highscores";
private var firstPlay:Number;
private var floor:Floor;
private var bgLayer:ViewportLayer;
private var sfxTitleLoop:Sound;
private var distClip:MovieClip;
private var flashAnim:MovieClip;
private var scores:Array;
private var effectChannel:SoundChannel;
public var highscores:MovieClip;
public var bg:MovieClip;
private var boxLayer:ViewportLayer;
private var rightClickMenu:ContextMenu;
private var targetLayer:ViewportLayer;
private var currShot:int;
private var isScoring:Boolean;// = false
private var isGoalMissed:Boolean;// = false
private var currSport:int;
private var sfxSoccerHit:Sound;
private var sfxTennisBounce:Sound;
public var shared:SharedObject;
private var sfxSoccerBounce:Sound;
private var scene:Scene3D;
private var bounce:Number;// = 0.5
private var renderLayers:Array;
private var viewportSnapshot:Bitmap;
private var dx:Number;
private var dy:Number;
private var dz:Number;
private var ballLayer:ViewportLayer;
private var percLoaded:Number;
private var objLayer:ViewportLayer;
private var sfxGameStart:Sound;
private var viewport:Viewport3D;
public var isQuit:Boolean;// = false
private var isBallHit:Boolean;// = false
private var sfxTarget:Sound;
private var isLineCrossed:Boolean;// = false
private var renderer:BasicRenderEngine;
private var isHelpOn:Boolean;// = false
private var finalScore:int;
private var sfxScoresLoop:Sound;
private var powerbar:MovieClip;
private var fiab_league_query:String;
private var credit:ContextMenuItem;
public var isPaused:Boolean;// = false
private var hud:MovieClip;
public var competitionScreen:MovieClip;
private var billboards:Array;
private var musicChannel:SoundChannel;
private var camera:Camera3D;
private var shad:Plane;
public var loading:MovieClip;
private var disc2:Cylinder;
private var targetAnim:MovieClip;
private var disc1:Cylinder;
public var transition:MovieClip;
private var sfxGameLoop:Sound;
public var menu:MovieClip;
private var fiab_league_action:String;
private var sfxBounce:Sound;
private var sfxWhoosh:Sound;
private var colObjects:Array;
private var distMarker:Plane;
private var isFollow:Boolean;// = false
private var currScore:int;
private var target:Plane;
private var sfxGolfHit:Sound;
private var floor2:Floor;
private var floor1:Floor;
public var scoreScreen:MovieClip;
private var sfxTennisHit:Sound;
private var isFirstBounce:Boolean;// = false
private var box:Cylinder;
private var sfxGolfBounce:Sound;
private var isBallThrown:Boolean;// = false
private var ball:Ball;
private static var oldTime:int = 0;
public static var deltaTime:Number = 0;
public static var fpsTxt:uint = 0;
public static var fps:uint = 0;
public static var secs:int = getTimer();
public function Powershots():void{
bounce = 0.5;
isBallHit = false;
isLineCrossed = false;
isGoalMissed = false;
isScoring = false;
isFirstBounce = false;
isFollow = false;
isBallThrown = false;
isHelpOn = false;
rightClickMenu = new ContextMenu();
credit = new ContextMenuItem("Created by fish in a bottle");
isPaused = false;
isQuit = false;
addFrameScript(0, frame1, 10, frame11);
super();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
function throwBall(_arg1:Event):void{
dy = 16;
isBallThrown = true;
}
private function getDeltaTime():void{
var _local1:int;
_local1 = getTimer();
deltaTime = (((_local1 - oldTime) / 1000) * 1.1);
fps++;
if ((_local1 - secs) > 1000){
secs = _local1;
fpsTxt = fps;
fps = 0;
};
oldTime = _local1;
}
public function powerbarPress(_arg1:MouseEvent):void{
powerbar.onPressed();
}
private function getSavedData():void{
shared = SharedObject.getLocal("powershots_help");
if (shared.data.help == undefined){
firstPlay = 1;
} else {
firstPlay = int(shared.data.help);
};
shared.close();
}
public function mute(_arg1:Event):Boolean{
var _local2:SoundTransform;
_local2 = new SoundTransform();
_local2.volume = 0;
SoundMixer.soundTransform = _local2;
return (true);
}
private function addRound3Scores(_arg1:Event):void{
var _local2:int;
scoreScreen.results.removeEventListener("round3_scores", addRound3Scores);
_local2 = ((scores[6] + scores[7]) + scores[8]);
finalScore = (finalScore + _local2);
scoreScreen.results.total.score.score.txtScore.text = finalScore;
scoreScreen.results.total.scoreGlow.score.txtScore.text = finalScore;
scoreScreen.results.total.gotoAndPlay("start");
}
private function onCameraReady():void{
if (isQuit){
return;
};
grabViewport();
powerbar.start();
if (firstPlay){
showHelp(new Event("blank"));
hud.buttonHelpOn.visible = false;
hud.buttonHelpOff.visible = false;
};
}
private function initSport():void{
var _local1:MovieClip;
var _local2:*;
var _local3:Cylinder;
var _local4:*;
var _local5:Cylinder;
var _local6:*;
var _local7:Cylinder;
var _local8:MovieAssetMaterial;
currShot = 0;
isPaused = false;
hud.visible = true;
switch (currSport){
case SPORT_SOCCER:
hud.roundDisplay.gotoAndPlay("round1");
bounce = 0.5;
sfxBounce = sfxSoccerBounce;
powerbar = new SoccerArrow();
addChild(powerbar);
createSkyBox(5000, 0, -2000);
floor1 = new Floor(new TEXFloor(995, 995), 3600, 3600, 16, 16);
scene.addChild(floor1);
floor = floor1;
bgLayer.addDisplayObject3D(floor1);
_local5 = new Cylinder(new BitmapAssetMaterial("TEXDisc"), 1800, 400, 32, 2, -1, false, false);
_local5.y = -200;
scene.addChild(_local5);
boxLayer.addDisplayObject3D(_local5);
buildGoal();
ball = new Ball("TEXBall", 32, 16, 12);
scene.addChild(ball);
shad = new Plane(new BitmapAssetMaterial("TEXShadow"), 32, 32, 1, 1);
shad.rotationX = 90;
scene.addChild(shad);
ballLayer.addDisplayObject3D(ball);
ballLayer.addDisplayObject3D(shad);
resetTarget();
break;
case SPORT_TENNIS:
hud.roundDisplay.gotoAndPlay("round2");
bounce = 0.5;
sfxBounce = sfxTennisBounce;
powerbar = new TennisInterface();
addChild(powerbar);
createSkyBox(5000, 0, 0);
_local2 = new Floor(new TEXTennisFloor(995, 995), 3600, 3600, 16, 16, true);
scene.addChild(_local2);
floor = _local2;
bgLayer.addDisplayObject3D(_local2);
_local3 = new Cylinder(new BitmapAssetMaterial("TEXDisc"), 1800, 400, 32, 2, -1, false, false);
_local3.y = -200;
scene.addChild(_local3);
boxLayer.addDisplayObject3D(_local3);
buildNet();
ball = new Ball("TEXTennisBall", 12, 16, 12);
scene.addChild(ball);
shad = new Plane(new BitmapAssetMaterial("TEXShadow"), 12, 12, 1, 1);
shad.rotationX = 90;
scene.addChild(shad);
ballLayer.addDisplayObject3D(ball);
ballLayer.addDisplayObject3D(shad);
break;
case SPORT_GOLF:
hud.roundDisplay.gotoAndPlay("round3");
bounce = 0.25;
sfxBounce = sfxGolfBounce;
powerbar = new GolfInterface();
addChild(powerbar);
createSkyBox(5000, 0, -1200);
_local4 = new Floor(new TEXGolfFloor1(407, 407), 1200, 1200, 16, 16);
_local4.z = -1200;
scene.addChild(_local4);
_local5 = new Cylinder(new BitmapAssetMaterial("TEXDisc"), 600, 400, 32, 2, -1, false, false);
_local5.z = -1200;
_local5.y = -200;
scene.addChild(_local5);
boxLayer.addDisplayObject3D(_local5);
_local6 = new Floor(new TEXGolfFloor2(995, 995), 5000, 5000, 20, 20);
_local6.z = 3400;
scene.addChild(_local6);
_local7 = new Cylinder(new BitmapAssetMaterial("TEXDisc"), 2500, 400, 32, 2, -1, false, false);
_local7.y = -200;
_local7.z = 3400;
scene.addChild(_local7);
boxLayer.addDisplayObject3D(_local7);
floor = _local6;
bgLayer.addDisplayObject3D(_local4);
bgLayer.addDisplayObject3D(_local6);
ball = new Ball("TEXGolfBall", 8, 12, 9);
scene.addChild(ball);
shad = new Plane(new BitmapAssetMaterial("TEXShadow"), 8, 8, 1, 1);
shad.rotationX = 90;
scene.addChild(shad);
ballLayer.addDisplayObject3D(ball);
ballLayer.addDisplayObject3D(shad);
_local8 = new MovieAssetMaterial("TEXDistance", true, true, true);
distClip = MovieClip(_local8.movie);
_local8.smooth = true;
distMarker = new Plane(_local8, 300, 60, 1, 1);
distMarker.visible = false;
ballLayer.addDisplayObject3D(distMarker);
billboards.push(distMarker);
break;
};
swapChildren(powerbar, transition);
swapChildren(powerbar, hud);
hud.hit.addEventListener(MouseEvent.MOUSE_DOWN, powerbarPress);
hud.hit.addEventListener(MouseEvent.MOUSE_UP, powerbarRelease);
powerbar.addEventListener("ball_throw", throwBall);
powerbar.addEventListener("input_complete", inputComplete);
if (!isHelpOn){
powerbar.help.visible = false;
powerbar.help.alpha = 0;
};
if (firstPlay){
hud.buttonHelpOn.visible = false;
hud.buttonHelpOff.visible = false;
};
resetBall();
resetCamera();
flashAnim = new FlashAnims();
addChild(flashAnim);
_local1 = new FPS();
_local1.x = 10;
_local1.y = 10;
addEventListener(Event.ENTER_FRAME, onFrameUpdate);
}
private function backToMenu(_arg1:Event):void{
quit();
}
private function nextSport():void{
var _local1:BitmapData;
var _local2:Bitmap;
_local1 = new BitmapData(700, 500);
_local1.draw(this);
_local2 = new Bitmap(_local1);
transition.image.addChild(_local2);
clearSport();
transition.visible = true;
transition.gotoAndPlay("start");
effectChannel = sfxWhoosh.play();
}
private function quit():void{
var _local1:BitmapData;
var _local2:Bitmap;
isQuit = true;
_local1 = new BitmapData(700, 500);
_local1.draw(this);
_local2 = new Bitmap(_local1);
transition.image.addChild(_local2);
transition.visible = true;
transition.gotoAndPlay("start");
effectChannel = sfxWhoosh.play();
menu.visible = true;
hud.visible = false;
if (powerbar != null){
removeChild(powerbar);
powerbar = null;
};
musicChannel.stop();
musicChannel = sfxTitleLoop.play(0, 99999);
scoreScreen.visible = false;
viewport.visible = false;
}
private function onRound1ScoresComplete(_arg1:Event):void{
scoreScreen.results.removeEventListener("round1_scores_complete", onRound1ScoresComplete);
scoreScreen.results.sportResults.roundName.nameClip.txtRound.text = "SMASH SERVE";
scoreScreen.results.sportResults.shot1.score.txtScore.text = scores[3];
scoreScreen.results.sportResults.shot2.score.txtScore.text = scores[4];
scoreScreen.results.sportResults.shot3.score.txtScore.text = scores[5];
}
private function buildNet():void{
var _local1:ColorMaterial;
var _local2:Block;
var _local3:Block;
var _local4:BitmapAssetMaterial;
var _local5:Block;
var _local6:MovieAssetMaterial;
_local1 = new ColorMaterial(4473941);
_local2 = new Block(new MaterialsList({all:_local1}), 30, 30, 150, 1, 1, 1, Cube.BOTTOM);
_local2.x = 715;
_local2.y = 75;
scene.addChild(_local2);
colObjects.push(_local2);
_local3 = new Block(new MaterialsList({all:_local1}), 30, 30, 150, 1, 1, 1, Cube.BOTTOM);
_local3.x = -715;
_local3.y = 75;
scene.addChild(_local3);
colObjects.push(_local3);
_local4 = new BitmapAssetMaterial("TEXTennisNet");
_local4.doubleSided = true;
_local4.smooth = true;
_local5 = new Block(new MaterialsList({all:_local4}), 1400, 80, 140, 6, 1, 2, ((((Cube.BOTTOM + Cube.TOP) + Cube.LEFT) + Cube.RIGHT) + Cube.FRONT));
_local5.y = 70;
_local5.z = 40;
scene.addChild(_local5);
colObjects.push(_local5);
_local6 = new MovieAssetMaterial("TEXTarget", true, true);
_local6.smooth = true;
targetAnim = MovieClip(_local6.movie);
targetAnim.gotoAndStop(1);
target = new Plane(_local6, 1200, 1200, 4, 4);
target.x = -300;
target.y = 1;
target.rotationX = 90;
target.z = 1000;
scene.addChild(target);
objLayer.addDisplayObject3D(_local2);
objLayer.addDisplayObject3D(_local3);
objLayer.addDisplayObject3D(_local5);
targetLayer.addDisplayObject3D(target);
}
function frame1(){
stop();
}
public function frameReadyCheck(_arg1:Event):void{
if (bg != null){
removeEventListener(Event.ENTER_FRAME, frameReadyCheck);
startApplication();
};
}
private function nextShot():void{
var _local1:BitmapData;
var _local2:Bitmap;
_local1 = new BitmapData(700, 500);
_local1.draw(this);
_local2 = new Bitmap(_local1);
transition.image.addChild(_local2);
transition.visible = true;
transition.gotoAndPlay("start");
effectChannel = sfxWhoosh.play();
if (((firstPlay) && ((currShot == 1)))){
hud.buttonHelpOn.visible = true;
hud.buttonHelpOff.visible = true;
hideHelp(new Event("blank"));
};
if (currSport == SPORT_SOCCER){
resetTarget();
} else {
if (currSport == SPORT_TENNIS){
targetAnim.gotoAndStop(1);
};
};
resetBall();
resetCamera();
}
private function onHighscoreSubmit(_arg1:Event):void{
Tracker.kvEvent(2675);
scoreScreen.results.waitBox.visible = false;
scoreScreen.results.sentBox.visible = true;
}
private function getLeagueData():void{
var _local1:String;
_local1 = "";
fiab_league_query = "";
highscores.configure(HIGHSCORE_URL, 11);
}
private function buildGoal():void{
var _local1:ColorMaterial;
var _local2:Block;
var _local3:Block;
var _local4:Block;
var _local5:BitmapAssetMaterial;
var _local6:BitmapAssetMaterial;
var _local7:BitmapAssetMaterial;
var _local8:Cube;
var _local9:MovieAssetMaterial;
_local1 = new ColorMaterial(0xEEEEEE);
_local2 = new Block(new MaterialsList({all:_local1}), 1030, 30, 30, 1, 1, 1, Cube.FRONT);
_local2.y = 315;
_local2.z = 1050;
scene.addChild(_local2);
colObjects.push(_local2);
_local3 = new Block(new MaterialsList({all:_local1}), 30, 30, 300, 1, 1, 1, ((Cube.BOTTOM + Cube.TOP) + Cube.FRONT));
_local3.x = 500;
_local3.y = 150;
_local3.z = 1050;
scene.addChild(_local3);
colObjects.push(_local3);
_local4 = new Block(new MaterialsList({all:_local1}), 30, 30, 300, 1, 1, 1, ((Cube.BOTTOM + Cube.TOP) + Cube.FRONT));
_local4.x = -500;
_local4.y = 150;
_local4.z = 1050;
scene.addChild(_local4);
colObjects.push(_local4);
_local5 = new BitmapAssetMaterial("TEXNetTop");
_local5.doubleSided = true;
_local6 = new BitmapAssetMaterial("TEXNetBack");
_local6.doubleSided = true;
_local7 = new BitmapAssetMaterial("TEXNetSide");
_local7.doubleSided = true;
_local8 = new Cube(new MaterialsList({top:_local5, front:_local5, left:_local7, right:_local7}), 1030, 200, 300, 2, 1, 1, Cube.NONE, (Cube.BACK + Cube.BOTTOM));
_local8.y = 150;
_local8.z = 1165;
scene.addChild(_local8);
_local9 = new MovieAssetMaterial("TEXTarget", true, true);
_local9.smooth = true;
targetAnim = MovieClip(_local9.movie);
targetAnim.stop();
target = new Plane(_local9, 500, 500, 4, 4);
target.z = 1000;
scene.addChild(target);
objLayer.addDisplayObject3D(_local2);
objLayer.addDisplayObject3D(_local3);
objLayer.addDisplayObject3D(_local4);
objLayer.addDisplayObject3D(_local8);
targetLayer.addDisplayObject3D(target);
}
function setFollow():void{
isFollow = true;
}
private function updateBillboards():void{
var _local1:String;
for (_local1 in billboards) {
billboards[_local1].rotationY = camera.rotationY;
billboards[_local1].rotationX = camera.rotationX;
};
}
private function loaderUpdate(_arg1:Event):void{
percLoaded = (percLoaded - ((percLoaded - (this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal)) * 0.2));
loading.txtPercLoaded.text = (Math.floor((percLoaded * 100)) + "%");
if ((((this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal)) && ((percLoaded > 0.99)))){
removeEventListener(Event.ENTER_FRAME, loaderUpdate);
onApplicationLoaded();
};
}
private function setSavedData():void{
shared = SharedObject.getLocal("powershots_help");
firstPlay = 0;
shared.data.help = 0;
shared.flush();
shared.close();
}
private function onScoreDisplayStarted(_arg1:Event):void{
hud[("score" + currShot)].txtScore.text = currScore;
}
private function onRound2ScoresComplete(_arg1:Event):void{
scoreScreen.results.removeEventListener("round2_scores_complete", onRound2ScoresComplete);
scoreScreen.results.sportResults.roundName.nameClip.txtRound.text = "TURBO DRIVE";
scoreScreen.results.sportResults.shot1.score.txtScore.text = scores[6];
scoreScreen.results.sportResults.shot2.score.txtScore.text = scores[7];
scoreScreen.results.sportResults.shot3.score.txtScore.text = scores[8];
}
private function addRound2Scores(_arg1:Event):void{
var _local2:int;
scoreScreen.results.removeEventListener("round2_scores", addRound2Scores);
_local2 = ((scores[3] + scores[4]) + scores[5]);
finalScore = (finalScore + _local2);
scoreScreen.results.total.score.score.txtScore.text = finalScore;
scoreScreen.results.total.scoreGlow.score.txtScore.text = finalScore;
scoreScreen.results.total.gotoAndPlay("start");
}
private function onHighscoreConfigure(_arg1:Event):void{
highscores.removeEventListener("configure_complete", onHighscoreConfigure);
}
public function unmute(_arg1:Event):Boolean{
var _local2:SoundTransform;
_local2 = new SoundTransform();
_local2.volume = 1;
SoundMixer.soundTransform = _local2;
return (false);
}
private function pauseGame(_arg1:Event):void{
isPaused = true;
grabViewport();
}
private function createSkyBox(_arg1:Number, _arg2:Number=0, _arg3:Number=0):void{
var _local4:BitmapAssetMaterial;
_local4 = new BitmapAssetMaterial("TEXBox");
_local4.opposite = true;
_local4.tiled = true;
_local4.maxU = 10;
box = new Cylinder(_local4, (_arg1 * 2), 8000, 16, 4, -1, false, false);
box.y = _arg3;
box.rotationY = -3.5;
scene.addChild(box);
boxLayer.addDisplayObject3D(box);
}
private function grabViewport():void{
var _local1:BitmapData;
ballLayer.visible = false;
render();
_local1 = new BitmapData(700, 500);
_local1.draw(viewport);
viewportSnapshot.bitmapData = _local1;
viewportSnapshot.visible = true;
boxLayer.visible = false;
bgLayer.visible = false;
objLayer.visible = false;
targetLayer.visible = false;
ballLayer.visible = true;
}
private function init():void{
stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.HIGH;
stage.showDefaultContextMenu = false;
credit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onCreditLinkClicked);
rightClickMenu.hideBuiltInItems();
percLoaded = 0;
addEventListener(Event.ENTER_FRAME, loaderUpdate);
}
private function quitGame(_arg1:Event):void{
viewportSnapshot.visible = false;
boxLayer.visible = true;
bgLayer.visible = true;
objLayer.visible = true;
targetLayer.visible = true;
clearSport(true);
quit();
}
private function onVideoComplete(_arg1:Event):void{
var _local2:BitmapData;
var _local3:Bitmap;
_local2 = new BitmapData(700, 500);
_local2.draw(this);
_local3 = new Bitmap(_local2);
transition.image.addChild(_local3);
transition.visible = true;
transition.gotoAndPlay("start");
effectChannel = sfxWhoosh.play();
musicChannel = sfxScoresLoop.play(0, 99999);
scoreScreen.vid.buttonLink.removeEventListener(MouseEvent.CLICK, onLinkClicked);
scoreScreen.vid.removeEventListener("video_complete", onVideoComplete);
scoreScreen.removeChild(scoreScreen.vid);
scoreScreen.results.total.score.score.txtScore.text = "00000";
scoreScreen.results.total.scoreGlow.score.txtScore.text = "00000";
scoreScreen.results.sportResults.roundName.nameClip.txtRound.text = "POWER KICK";
scoreScreen.results.sportResults.shot1.score.txtScore.text = scores[0];
scoreScreen.results.sportResults.shot2.score.txtScore.text = scores[1];
scoreScreen.results.sportResults.shot3.score.txtScore.text = scores[2];
scoreScreen.results.addEventListener("round1_scores", addRound1Scores);
scoreScreen.results.addEventListener("round2_scores", addRound2Scores);
scoreScreen.results.addEventListener("round3_scores", addRound3Scores);
scoreScreen.results.addEventListener("round1_scores_complete", onRound1ScoresComplete);
scoreScreen.results.addEventListener("round2_scores_complete", onRound2ScoresComplete);
scoreScreen.results.waitBox.visible = false;
scoreScreen.results.sentBox.visible = false;
scoreScreen.results.submitBox.visible = true;
scoreScreen.results.gotoAndPlay("start");
}
private function onScoresClicked(_arg1:Event):void{
var _local2:URLRequest;
Tracker.kvEvent(2673);
_local2 = new URLRequest(HIGHSCORE_TABLE_URL);
navigateToURL(_local2, "_blank");
}
public function powerbarRelease(_arg1:MouseEvent):void{
powerbar.onReleased();
}
private function onFrameUpdate(_arg1:Event):void{
var _local2:String;
var _local3:Vector3D;
var _local4:Number;
var _local5:Vector3D;
var _local6:Number;
var _local7:Number;
var _local8:Number;
getDeltaTime();
if (((isPaused) || (isQuit))){
return;
};
if (isBallHit){
ball.x = (ball.x + (dx * (deltaTime * 30)));
ball.y = (ball.y + (dy * (deltaTime * 30)));
ball.z = (ball.z + (dz * (deltaTime * 30)));
ball.rotationX = (ball.rotationX + (dz * (deltaTime * 30)));
dy = (dy - (10 * deltaTime));
_local5 = new Vector3D((floor.x - ball.x), (floor.y - ball.y), (floor.z - ball.z));
if (_local5.magnitude() < (floor.width / 2)){
if (ball.y < ball.radius){
ball.y = ball.radius;
dy = (dy * -(bounce));
if (Math.abs(dy) > 2){
effectChannel = sfxBounce.play();
};
if (!isFirstBounce){
isFirstBounce = true;
if (currSport == SPORT_GOLF){
TweenLite.to(camera, 3, {x:(ball.x + 500), y:400, z:(ball.z - 500), rotationX:20, rotationY:-30, ease:Cubic.easeIn, onComplete:setFollow});
} else {
if (currSport == SPORT_TENNIS){
if (((isLineCrossed) && (!(isScoring)))){
_local3 = new Vector3D((target.x - ball.x), 0, (target.z - ball.z));
if (_local3.magnitude() < 300){
targetAnim.play();
effectChannel = sfxTarget.play();
};
_local4 = Math.floor(((300 - _local3.magnitude()) * 26.6));
if (_local4 < 0){
_local4 = 0;
};
setScore(_local4);
};
};
};
};
if (Math.abs(dy) < 2){
dy = 0;
};
_local6 = (-(dx) * 1.5);
_local7 = (-(dz) * 1.5);
dx = (dx + (_local6 * deltaTime));
dz = (dz + (_local7 * deltaTime));
if ((((Math.abs(dz) < 1)) && ((Math.abs(dy) < 1)))){
dx = 0;
dy = 0;
dz = 0;
if (!isScoring){
switch (currSport){
case SPORT_SOCCER:
setScore(0);
break;
case SPORT_GOLF:
_local3 = new Vector3D((0 - ball.x), 0, (4400 - ball.z));
_local4 = ((780 - _local3.magnitude()) * 10.25);
if (_local4 < 100){
_local4 = 0;
};
setScore(_local4);
break;
case SPORT_TENNIS:
setScore(0);
break;
};
};
};
};
} else {
if (ball.z > floor.z){
ballLayer.layerIndex = 2;
bgLayer.layerIndex = 3;
objLayer.layerIndex = 4;
targetLayer.layerIndex = 5;
shad.visible = false;
};
if (ball.y < -5000){
if (!isScoring){
setScore(0);
};
};
};
switch (currSport){
case SPORT_SOCCER:
if (!isLineCrossed){
for (_local2 in colObjects) {
if (Collisions.sphereAABBTest(ball.x, ball.y, ball.z, ball.radius, colObjects[_local2].x, colObjects[_local2].y, colObjects[_local2].z, colObjects[_local2].width, colObjects[_local2].height, colObjects[_local2].depth)){
if (dz > 0){
dz = (dz * -0.75);
};
};
};
} else {
if ((ball.y - ball.radius) > colObjects[0].y){
isGoalMissed = true;
};
if ((ball.z + ball.radius) > (colObjects[0].z + 200)){
if (!isGoalMissed){
if ((((((ball.y < colObjects[0].y)) && ((ball.x < colObjects[1].x)))) && ((ball.x > colObjects[2].x)))){
if (dz > 0){
dx = 0;
dy = 0;
dz = (dz * -0.2);
};
ballLayer.layerIndex = 4;
targetLayer.layerIndex = 5;
};
} else {
ballLayer.layerIndex = 2;
bgLayer.layerIndex = 3;
objLayer.layerIndex = 4;
targetLayer.layerIndex = 5;
};
};
};
if ((((ball.z > target.z)) && (!(isLineCrossed)))){
_local3 = new Vector3D((target.x - ball.x), (target.y - ball.y), 0);
if (_local3.magnitude() < 125){
targetAnim.play();
effectChannel = sfxTarget.play();
};
_local4 = (Math.floor((125 - _local3.magnitude())) * 64);
if (_local4 < 0){
_local4 = 0;
};
setScore(_local4);
isLineCrossed = true;
};
break;
case SPORT_GOLF:
if (isFirstBounce){
if (isFollow){
TweenLite.to(camera, 3, {x:(ball.x + 1000), y:1000, z:(ball.z - 1000), rotationX:35, rotationY:-45, ease:Cubic.easeOut});
};
} else {
_local8 = (14 + (Math.atan2((ball.y - camera.y), (ball.z - camera.z)) * (180 / Math.PI)));
_local8 = (10 - (_local8 / 2));
if (_local8 < -10){
_local8 = -10;
};
TweenLite.to(camera, 1, {rotationX:_local8, ease:Cubic.easeOut});
};
break;
case SPORT_TENNIS:
if (!isLineCrossed){
if (ball.z > 0){
if ((((((ball.y < 140)) && ((ball.x < 730)))) && ((ball.x > -730)))){
ball.z = 0;
dz = (dz * -0.1);
dx = (dx * 0.2);
} else {
bgLayer.layerIndex = 2;
targetLayer.layerIndex = 3;
ballLayer.layerIndex = 4;
objLayer.layerIndex = 5;
isLineCrossed = true;
};
};
};
break;
};
} else {
if (isBallThrown){
ball.y = (ball.y + (dy * (deltaTime * 30)));
dy = (dy - (10 * deltaTime));
};
};
powerbar.update();
updateShadow();
updateBillboards();
render();
}
private function inputComplete(_arg1:Event):void{
switch (currSport){
case SPORT_SOCCER:
dx = (Math.sin((powerbar.angVal * (Math.PI / 180))) * powerbar.powVal);
dz = (Math.cos((powerbar.angVal * (Math.PI / 180))) * powerbar.powVal);
dy = (powerbar.powVal * 0.28);
flashAnim.gotoAndPlay("kick");
effectChannel = sfxSoccerHit.play();
break;
case SPORT_GOLF:
dx = (powerbar.angVal / 5);
dy = (20 + ((powerbar.powVal + Math.random()) / 40));
dz = (20 + ((powerbar.powVal + Math.random()) / 40));
flashAnim.gotoAndPlay("swing");
effectChannel = sfxGolfHit.play();
break;
case SPORT_TENNIS:
ball.y = 500;
dx = (-5 + powerbar.angVal);
dz = (42 - powerbar.powVal);
dy = 0;
flashAnim.gotoAndPlay("smash");
effectChannel = sfxTennisHit.play();
break;
};
isBallHit = true;
powerbar.init();
viewportSnapshot.visible = false;
boxLayer.visible = true;
bgLayer.visible = true;
objLayer.visible = true;
targetLayer.visible = true;
}
private function onPlayClicked(_arg1:Event):void{
var _local2:BitmapData;
var _local3:Bitmap;
Tracker.kvEvent(2672);
isQuit = false;
_local2 = new BitmapData(700, 500);
_local2.draw(this);
_local3 = new Bitmap(_local2);
transition.image.addChild(_local3);
transition.visible = true;
transition.gotoAndPlay("start");
effectChannel = sfxWhoosh.play();
musicChannel.stop();
musicChannel = sfxGameLoop.play(0, 99999);
menu.visible = false;
viewport.visible = true;
finalScore = 0;
scores.splice(0);
currSport = SPORT_SOCCER;
initSport();
}
private function clearSport(_arg1:Boolean=false):void{
var _local2:String;
colObjects.splice(0);
scene.removeChild(box);
boxLayer.removeDisplayObject3D(box);
box = null;
for (_local2 in scene.children) {
scene.removeChild(scene.children[_local2]);
};
hud.score1.txtScore.text = "";
hud.score2.txtScore.text = "";
hud.score3.txtScore.text = "";
hud.hit.removeEventListener(MouseEvent.MOUSE_DOWN, powerbarPress);
hud.hit.removeEventListener(MouseEvent.MOUSE_UP, powerbarRelease);
powerbar.removeEventListener("ball_throw", throwBall);
powerbar.removeEventListener("input_complete", inputComplete);
if (_arg1){
return;
};
switch (currSport){
case SPORT_SOCCER:
currSport = SPORT_TENNIS;
initSport();
break;
case SPORT_TENNIS:
currSport = SPORT_GOLF;
initSport();
break;
case SPORT_GOLF:
gameComplete();
break;
};
}
private function setScore(_arg1:int):void{
currScore = _arg1;
hud.scoreDisplay.score.scoreText.txtScore.text = currScore;
hud.scoreDisplay.gotoAndPlay("on");
isScoring = true;
scores.push(currScore);
}
private function gameComplete():void{
var _local1:BitmapData;
var _local2:Bitmap;
setSavedData();
_local1 = new BitmapData(700, 500);
_local1.draw(this);
_local2 = new Bitmap(_local1);
transition.image.addChild(_local2);
transition.visible = true;
transition.gotoAndPlay("start");
effectChannel = sfxWhoosh.play();
viewport.visible = false;
hud.visible = false;
musicChannel.stop();
scoreScreen.vid = new VideoClip();
scoreScreen.addChild(scoreScreen.vid);
scoreScreen.vid.buttonLink.addEventListener(MouseEvent.MOUSE_UP, onLinkClicked);
scoreScreen.visible = true;
scoreScreen.vid.gotoAndPlay("start");
scoreScreen.vid.addEventListener("video_complete", onVideoComplete);
}
private function onApplicationLoaded():void{
gotoAndPlay("main");
addEventListener(Event.ENTER_FRAME, frameReadyCheck);
}
private function updateShadow():void{
var _local1:Number;
shad.x = ball.x;
shad.z = ball.z;
_local1 = ((500 - ball.y) / 250);
if (_local1 < 0.5){
_local1 = 0.5;
};
shad.scaleX = _local1;
shad.scaleY = _local1;
}
private function submitScore(_arg1:Event):void{
highscores.submit(_arg1.target.playerName, finalScore);
}
private function resetCamera():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
isFollow = false;
TweenLite.killTweensOf(camera);
boxLayer.layerIndex = 1;
bgLayer.layerIndex = 2;
objLayer.layerIndex = 3;
targetLayer.layerIndex = 4;
ballLayer.layerIndex = 5;
camera.x = 5000;
camera.z = -5000;
camera.y = 4000;
camera.rotationX = 30;
camera.rotationY = -45;
_local1 = 0;
_local2 = 0;
_local3 = 0;
_local4 = 10;
switch (currSport){
case SPORT_SOCCER:
_local1 = 0;
_local2 = 450;
_local3 = -2400;
break;
case SPORT_GOLF:
_local1 = 0;
_local2 = 300;
_local3 = -2350;
distMarker.visible = false;
break;
case SPORT_TENNIS:
_local1 = 0;
_local2 = 800;
_local3 = -2950;
_local4 = 20;
break;
};
if (currShot == 1){
TweenLite.to(camera, 6, {x:_local1, y:_local2, z:_local3, rotationX:_local4, rotationY:0, ease:Cubic.easeOut, onComplete:onCameraReady});
} else {
camera.x = _local1;
camera.z = _local3;
camera.y = _local2;
camera.rotationX = _local4;
camera.rotationY = 0;
grabViewport();
powerbar.start();
};
}
function frame11(){
stop();
}
private function onTitleReady(_arg1:Event):void{
musicChannel = sfxTitleLoop.play(0, 99999);
}
private function onLinkClicked(_arg1:Event):void{
var _local2:URLRequest;
Tracker.kvEvent(2677);
_local2 = new URLRequest("http://www.worldsport.tv");
navigateToURL(_local2, "_blank");
}
private function initHighscores():void{
highscores = new Highscores();
addChild(highscores);
highscores.addEventListener("configure_complete", onHighscoreConfigure);
highscores.addEventListener("submit_complete", onHighscoreSubmit);
getLeagueData();
}
private function init3D():void{
viewportSnapshot = new Bitmap();
addChild(viewportSnapshot);
viewport = new Viewport3D(700, 500, false, true);
viewport.interactive = true;
viewport.filters = [new BlurFilter(1, 1, 1)];
addChild(viewport);
renderer = new BasicRenderEngine();
scene = new Scene3D();
camera = new Camera3D();
camera.focus = 100;
camera.zoom = 10;
boxLayer = new ViewportLayer(viewport, null);
bgLayer = new ViewportLayer(viewport, null);
objLayer = new ViewportLayer(viewport, null);
targetLayer = new ViewportLayer(viewport, null);
ballLayer = new ViewportLayer(viewport, null);
viewport.containerSprite.addLayer(boxLayer);
viewport.containerSprite.addLayer(bgLayer);
viewport.containerSprite.addLayer(objLayer);
viewport.containerSprite.addLayer(targetLayer);
viewport.containerSprite.addLayer(ballLayer);
viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;
boxLayer.layerIndex = 1;
bgLayer.layerIndex = 2;
objLayer.layerIndex = 3;
targetLayer.layerIndex = 4;
ballLayer.layerIndex = 5;
renderLayers = new Array(boxLayer, bgLayer, objLayer, ballLayer, targetLayer);
}
private function startApplication():void{
getSavedData();
initHighscores();
Tracker.init(631, root);
menu = new MainMenu();
menu.addEventListener("title_ready", onTitleReady);
addChild(menu);
scoreScreen = new ScoreScreen();
scoreScreen.visible = false;
addChild(scoreScreen);
competitionScreen = new CompetitionScreen(stage);
competitionScreen.visible = false;
addChild(competitionScreen);
menu.addEventListener("play_clicked", onPlayClicked);
menu.addEventListener("competition_clicked", onCompetitionClicked);
menu.addEventListener("scores_clicked", onScoresClicked);
menu.addEventListener("link_clicked", onLinkClicked);
scoreScreen.addEventListener("play_again_clicked", backToMenu);
scoreScreen.addEventListener("submit_score_clicked", submitScore);
scoreScreen.addEventListener("view_scores_clicked", onScoresClicked);
sfxTitleLoop = new SFXTitleLoop();
sfxGameStart = new SFXGameStart();
sfxGameLoop = new SFXGameLoop();
sfxScoresLoop = new SFXScoresLoop();
musicChannel = new SoundChannel();
sfxSoccerHit = new SFXSoccerHit();
sfxSoccerBounce = new SFXSoccerBounce();
sfxTennisHit = new SFXTennisHit();
sfxTennisBounce = new SFXTennisBounce();
sfxGolfHit = new SFXGolfHit();
sfxGolfBounce = new SFXGolfBounce();
sfxWhoosh = new SFXWhoosh();
sfxTarget = new SFXTarget();
effectChannel = new SoundChannel();
init3D();
hud = new GameHUD();
hud.visible = false;
addChild(hud);
hud.addEventListener("pause_game", pauseGame);
hud.addEventListener("resume_game", resumeGame);
hud.addEventListener("quit_game", quitGame);
hud.addEventListener("sound_on", unmute);
hud.addEventListener("sound_off", mute);
hud.addEventListener("help_on", showHelp);
hud.addEventListener("help_off", hideHelp);
hud.scoreDisplay.addEventListener("score_display_complete", onScoreDisplayComplete);
hud.scoreDisplay.addEventListener("score_display_started", onScoreDisplayStarted);
transition = new ScreenTransition();
transition.visible = false;
transition.addEventListener("transition_complete", onTransitionComplete);
addChild(transition);
billboards = new Array();
colObjects = new Array();
scores = new Array();
}
private function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
init();
}
private function onCompetitionClicked(_arg1:Event):void{
competitionScreen.showEntryForm();
competitionScreen.visible = true;
competitionScreen.gotoAndPlay("on");
}
private function onScoreDisplayComplete(_arg1:Event):void{
if (isQuit){
return;
};
if (currShot < 3){
nextShot();
} else {
nextSport();
};
}
private function hideHelp(_arg1:Event):void{
hud.buttonHelpOn.visible = true;
hud.buttonHelpOff.visible = false;
TweenLite.to(powerbar.help, 0.5, {autoAlpha:0});
isHelpOn = false;
}
private function onFlashComplete(_arg1:Event):void{
flashAnim.stop();
}
private function addRound1Scores(_arg1:Event):void{
var _local2:int;
scoreScreen.results.removeEventListener("round1_scores", addRound1Scores);
_local2 = ((scores[0] + scores[1]) + scores[2]);
finalScore = (finalScore + _local2);
scoreScreen.results.total.score.score.txtScore.text = finalScore;
scoreScreen.results.total.scoreGlow.score.txtScore.text = finalScore;
scoreScreen.results.total.gotoAndPlay("start");
}
private function onLeagueDataReceived(_arg1:Event):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
fiab_league_action = _local2.data.fiab_league_action;
highscores.setLeagueInfo(Number(_local2.data.fiab_league_id), Number(_local2.data.fiab_league_player));
highscores.configure(HIGHSCORE_URL, 11);
}
private function setDecimalPlaces(_arg1:Number, _arg2:int){
var _local3:Number;
var _local4:String;
var _local5:String;
if (_arg2 <= 0){
return (String(Math.round(_arg1)));
};
_local3 = Math.pow(10, _arg2);
_local4 = String(Math.round((_arg1 * _local3)));
if (_arg1 < 1){
while (_local4.length < (_arg2 + 1)) {
_local4 = ("0" + _local4);
};
};
_local5 = ((_local4.slice(0, -(_arg2)) + ".") + _local4.slice(-(_arg2)));
return (_local5);
}
private function resetTarget():void{
var _local1:Number;
var _local2:Number;
targetAnim.gotoAndStop(1);
_local1 = (Math.floor((Math.random() * 5)) - 2);
_local2 = Math.floor((Math.random() * 3));
target.x = (_local1 * 150);
target.y = (150 + (_local2 * 10));
}
private function render():void{
renderer.renderScene(scene, camera, viewport);
}
private function onLeagueIOError(_arg1:IOErrorEvent):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, onLeagueDataReceived);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, onLeagueIOError);
highscores.configure(HIGHSCORE_URL, 11);
}
private function resumeGame(_arg1:Event):void{
isPaused = false;
viewportSnapshot.visible = false;
boxLayer.visible = true;
bgLayer.visible = true;
objLayer.visible = true;
targetLayer.visible = true;
}
private function showHelp(_arg1:Event):void{
hud.buttonHelpOn.visible = false;
hud.buttonHelpOff.visible = true;
TweenLite.to(powerbar.help, 0.5, {autoAlpha:1});
isHelpOn = true;
}
private function onTransitionComplete(_arg1:Event):void{
var _local2:uint;
_local2 = 0;
while (_local2 < transition.image.numChildren) {
transition.image.removeChildAt(_local2);
_local2++;
};
transition.visible = false;
}
private function onCreditLinkClicked(_arg1:Event):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.fishinabottle.com");
navigateToURL(_local2, "_blank");
}
private function resetBall():void{
switch (currSport){
case SPORT_TENNIS:
ball.x = 0;
ball.y = ball.radius;
ball.z = -1400;
break;
default:
ball.x = 0;
ball.y = ball.radius;
ball.z = -1200;
break;
};
shad.visible = true;
updateShadow();
isBallHit = false;
isLineCrossed = false;
isGoalMissed = false;
isScoring = false;
isFirstBounce = false;
isBallThrown = false;
if (currShot < 3){
currShot++;
};
}
}
}//package
Section 194
//ScoreScreen (ScoreScreen)
package {
import flash.display.*;
import flash.events.*;
public class ScoreScreen extends MovieClip {
public var playerName:String;
public var vid:MovieClip;
public var results:MovieClip;
public function ScoreScreen():void{
results.stop();
results.total.stop();
results.submitBox.buttonPlayAgain.addEventListener(MouseEvent.CLICK, onPlayAgainClicked);
results.submitBox.buttonSubmitScore.addEventListener(MouseEvent.CLICK, onSubmitClicked);
results.sentBox.buttonPlayAgain.addEventListener(MouseEvent.CLICK, onPlayAgainClicked);
results.sentBox.buttonViewScores.addEventListener(MouseEvent.MOUSE_UP, onViewClicked);
}
private function onPlayAgainClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("play_again_clicked"));
}
private function onSubmitClicked(_arg1:MouseEvent):void{
playerName = results.submitBox.playerName.text;
results.submitBox.visible = false;
results.waitBox.visible = true;
dispatchEvent(new Event("submit_score_clicked"));
}
private function onViewClicked(_arg1:MouseEvent):void{
dispatchEvent(new Event("view_scores_clicked"));
dispatchEvent(new Event("play_again_clicked"));
}
}
}//package
Section 195
//ScreenTransition (ScreenTransition)
package {
import flash.display.*;
import flash.events.*;
public dynamic class ScreenTransition extends MovieClip {
public var image:MovieClip;
public var imageMask:MovieClip;
public function ScreenTransition(){
addFrameScript(0, frame1, 25, frame26);
}
function frame1(){
stop();
}
function frame26(){
dispatchEvent(new Event("transition_complete"));
}
}
}//package
Section 196
//Scrollbar (Scrollbar)
package {
import flash.display.*;
import flash.events.*;
import gs.*;
import flash.geom.*;
import gs.easing.*;
public class Scrollbar extends MovieClip {
private var contentStart:Number;
private var _dragger:MovieClip;
private var _content:MovieClip;
private var _scrollbar:MovieClip;
private var draggerStart:Number;
private var _contMask:MovieClip;
private var stageRef:Stage;
private var scrollPercent:Number;
private var _padding:uint;
public function Scrollbar(_arg1:Stage, _arg2:MovieClip, _arg3:MovieClip, _arg4:MovieClip, _arg5:MovieClip, _arg6:uint=5):void{
stageRef = _arg1;
scrollPercent = 0;
_content = _arg2;
_contMask = _arg3;
_dragger = _arg4;
_scrollbar = _arg5;
_padding = _arg6;
_dragger.buttonMode = true;
_dragger.addEventListener(MouseEvent.MOUSE_DOWN, moveDrag);
stageRef.addEventListener(MouseEvent.MOUSE_UP, releaseDrag);
_scrollbar.addEventListener(MouseEvent.MOUSE_DOWN, jumpTo);
contentStart = _content.y;
draggerStart = _dragger.y;
verifyHeight();
}
public function verifyHeight():void{
if (_contMask.height > _content.height){
_dragger.visible = false;
_scrollbar.visible = false;
} else {
_dragger.visible = true;
_scrollbar.visible = true;
};
}
private function jumpTo(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = 0;
if (_arg1.localY > (_scrollbar.height - _dragger.height)){
_local2 = (_dragger.height - (_scrollbar.height - _arg1.localY));
};
_dragger.y = ((_scrollbar.y + _arg1.localY) - _local2);
moveContent();
}
public function reset():void{
_content.y = contentStart;
_dragger.y = draggerStart;
verifyHeight();
}
public function stepUp(_arg1:Number):void{
_dragger.y = (_dragger.y - _arg1);
if (_dragger.y < _scrollbar.y){
_dragger.y = _scrollbar.y;
};
moveContent();
}
private function moveContent():void{
scrollPercent = ((100 / (_scrollbar.height - _dragger.height)) * (_dragger.y - _scrollbar.y));
TweenLite.to(_content, 0.25, {y:(_contMask.y + ((((_contMask.height - _content.height) - _padding) / 100) * scrollPercent)), ease:Cubic.easeOut});
}
public function stepDown(_arg1:Number):void{
_dragger.y = (_dragger.y + _arg1);
if (_dragger.y > ((_scrollbar.y + _scrollbar.height) - _dragger.height)){
_dragger.y = ((_scrollbar.y + _scrollbar.height) - _dragger.height);
};
moveContent();
}
private function moveDrag(_arg1:MouseEvent):void{
var _local2:Rectangle;
_local2 = new Rectangle(_scrollbar.x, _scrollbar.y, 0, (_scrollbar.height - _dragger.height));
_dragger.startDrag(false, _local2);
_dragger.parent.stage.addEventListener(Event.ENTER_FRAME, update);
}
private function update(_arg1:Event):void{
moveContent();
}
private function releaseDrag(_arg1:MouseEvent):void{
_dragger.stopDrag();
_dragger.parent.stage.removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package
Section 197
//SFXGameLoop (SFXGameLoop)
package {
import flash.media.*;
public dynamic class SFXGameLoop extends Sound {
}
}//package
Section 198
//SFXGameStart (SFXGameStart)
package {
import flash.media.*;
public dynamic class SFXGameStart extends Sound {
}
}//package
Section 199
//SFXGolfBounce (SFXGolfBounce)
package {
import flash.media.*;
public dynamic class SFXGolfBounce extends Sound {
}
}//package
Section 200
//SFXGolfHit (SFXGolfHit)
package {
import flash.media.*;
public dynamic class SFXGolfHit extends Sound {
}
}//package
Section 201
//SFXScoresLoop (SFXScoresLoop)
package {
import flash.media.*;
public dynamic class SFXScoresLoop extends Sound {
}
}//package
Section 202
//SFXSoccerBounce (SFXSoccerBounce)
package {
import flash.media.*;
public dynamic class SFXSoccerBounce extends Sound {
}
}//package
Section 203
//SFXSoccerHit (SFXSoccerHit)
package {
import flash.media.*;
public dynamic class SFXSoccerHit extends Sound {
}
}//package
Section 204
//SFXTarget (SFXTarget)
package {
import flash.media.*;
public dynamic class SFXTarget extends Sound {
}
}//package
Section 205
//SFXTennisBounce (SFXTennisBounce)
package {
import flash.media.*;
public dynamic class SFXTennisBounce extends Sound {
}
}//package
Section 206
//SFXTennisHit (SFXTennisHit)
package {
import flash.media.*;
public dynamic class SFXTennisHit extends Sound {
}
}//package
Section 207
//SFXTitleLoop (SFXTitleLoop)
package {
import flash.media.*;
public dynamic class SFXTitleLoop extends Sound {
}
}//package
Section 208
//SFXWhoosh (SFXWhoosh)
package {
import flash.media.*;
public dynamic class SFXWhoosh extends Sound {
}
}//package
Section 209
//SoccerArrow (SoccerArrow)
package {
import flash.display.*;
import flash.events.*;
public class SoccerArrow extends MovieClip {
private const STATE_SELECT_ANGLE:int = 1;
private const STATE_SELECT_POWER:int = 2;
public var power:MovieClip;
public var help:MovieClip;
private var currState:int;
public var isReady:Boolean;
public var powVal:Number;
public var angVal:Number;
public function SoccerArrow():void{
init();
}
public function init():void{
isReady = false;
visible = false;
currState = STATE_SELECT_ANGLE;
power.gotoAndStop("off");
}
private function onPowerFull(_arg1:Event):void{
power.stop();
setPower();
isReady = false;
dispatchEvent(new Event("input_complete"));
}
public function onReleased():void{
if (!isReady){
return;
};
switch (currState){
case STATE_SELECT_ANGLE:
break;
case STATE_SELECT_POWER:
power.stop();
setPower();
isReady = false;
dispatchEvent(new Event("input_complete"));
break;
default:
break;
};
}
public function onPressed():void{
if (!isReady){
return;
};
switch (currState){
case STATE_SELECT_ANGLE:
stop();
setAngle();
power.gotoAndPlay("start");
currState = STATE_SELECT_POWER;
power.addEventListener("powerbar_full", onPowerFull);
break;
case STATE_SELECT_POWER:
break;
default:
break;
};
}
public function start():void{
isReady = true;
visible = true;
gotoAndPlay(1);
}
private function setAngle():void{
var _local1:Number;
_local1 = currentFrame;
if (_local1 > 30){
_local1 = (_local1 - ((_local1 - 30) * 2));
};
_local1 = (_local1 - 15);
_local1 = (_local1 * 1.25);
angVal = _local1;
}
private function setPower():void{
var _local1:Number;
_local1 = (power.currentFrame - 5);
_local1 = (_local1 + 20);
powVal = _local1;
}
public function update():void{
}
}
}//package
Section 210
//TennisInterface (TennisInterface)
package {
import flash.display.*;
import flash.events.*;
public class TennisInterface extends MovieClip {
private const STATE_GOING_UP:int = 2;
private const STATE_WAITING:int = 1;
private const STATE_GOING_DOWN:int = 3;
public var power:MovieClip;
public var help:MovieClip;
public var speed:Number;
public var frame:Number;
private var currState:int;
public var isReady:Boolean;
public var powVal:Number;
public var angVal:Number;
public function TennisInterface():void{
init();
}
public function init():void{
isReady = false;
visible = false;
power.up.gotoAndStop(1);
power.down.gotoAndStop(1);
power.fill.mask1.gotoAndStop(1);
speed = 2;
frame = 1;
currState = STATE_WAITING;
}
public function onReleased():void{
if (!isReady){
return;
};
switch (currState){
case STATE_WAITING:
break;
case STATE_GOING_UP:
speed = 2;
frame = (101 - frame);
setPower();
currState = STATE_GOING_DOWN;
dispatchEvent(new Event("ball_throw"));
break;
case STATE_GOING_DOWN:
break;
};
}
public function onPressed():void{
if (!isReady){
return;
};
switch (currState){
case STATE_WAITING:
currState = STATE_GOING_UP;
break;
case STATE_GOING_UP:
break;
case STATE_GOING_DOWN:
setAccuracy();
dispatchEvent(new Event("input_complete"));
isReady = false;
break;
};
}
public function start():void{
isReady = true;
visible = true;
currState = STATE_WAITING;
}
private function setAccuracy():void{
angVal = (frame - 265);
if (angVal < -35){
angVal = -35;
};
angVal = (angVal / 8);
}
private function setPower():void{
powVal = ((frame - 25) / 4);
}
public function update():void{
if (!isReady){
return;
};
switch (currState){
case STATE_WAITING:
break;
case STATE_GOING_UP:
speed = (speed * 1.05);
frame = (frame + Math.floor(speed));
if (frame > 100){
frame = 100;
};
power.down.gotoAndStop(frame);
power.fill.mask1.gotoAndStop(frame);
if (frame == 100){
speed = 2;
frame = (101 - frame);
setPower();
currState = STATE_GOING_DOWN;
dispatchEvent(new Event("ball_throw"));
};
break;
case STATE_GOING_DOWN:
speed = (speed * 1.075);
frame = (frame + Math.floor(speed));
if (frame > 300){
frame = 300;
};
power.up.gotoAndStop(frame);
if (frame == 300){
setAccuracy();
isReady = false;
dispatchEvent(new Event("input_complete"));
};
break;
};
}
}
}//package
Section 211
//TEXBall (TEXBall)
package {
import flash.display.*;
public dynamic class TEXBall extends BitmapData {
public function TEXBall(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 212
//TEXBox (TEXBox)
package {
import flash.display.*;
public dynamic class TEXBox extends BitmapData {
public function TEXBox(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 213
//TEXDisc (TEXDisc)
package {
import flash.display.*;
public dynamic class TEXDisc extends BitmapData {
public function TEXDisc(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 214
//TEXDistance (TEXDistance)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TEXDistance extends MovieClip {
public var txtDist:TextField;
}
}//package
Section 215
//TEXFloor (TEXFloor)
package {
import flash.display.*;
public dynamic class TEXFloor extends BitmapData {
public function TEXFloor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 216
//TEXGolfBall (TEXGolfBall)
package {
import flash.display.*;
public dynamic class TEXGolfBall extends BitmapData {
public function TEXGolfBall(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 217
//TEXGolfFloor1 (TEXGolfFloor1)
package {
import flash.display.*;
public dynamic class TEXGolfFloor1 extends BitmapData {
public function TEXGolfFloor1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 218
//TEXGolfFloor2 (TEXGolfFloor2)
package {
import flash.display.*;
public dynamic class TEXGolfFloor2 extends BitmapData {
public function TEXGolfFloor2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 219
//TEXNetBack (TEXNetBack)
package {
import flash.display.*;
public dynamic class TEXNetBack extends BitmapData {
public function TEXNetBack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 220
//TEXNetSide (TEXNetSide)
package {
import flash.display.*;
public dynamic class TEXNetSide extends BitmapData {
public function TEXNetSide(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 221
//TEXNetTop (TEXNetTop)
package {
import flash.display.*;
public dynamic class TEXNetTop extends BitmapData {
public function TEXNetTop(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 222
//TEXShadow (TEXShadow)
package {
import flash.display.*;
public dynamic class TEXShadow extends BitmapData {
public function TEXShadow(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 223
//TEXTarget (TEXTarget)
package {
import flash.display.*;
public dynamic class TEXTarget extends MovieClip {
public function TEXTarget(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package
Section 224
//TEXTennisBall (TEXTennisBall)
package {
import flash.display.*;
public dynamic class TEXTennisBall extends BitmapData {
public function TEXTennisBall(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 225
//TEXTennisFloor (TEXTennisFloor)
package {
import flash.display.*;
public dynamic class TEXTennisFloor extends BitmapData {
public function TEXTennisFloor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 226
//TEXTennisNet (TEXTennisNet)
package {
import flash.display.*;
public dynamic class TEXTennisNet extends BitmapData {
public function TEXTennisNet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 227
//Vector3D (Vector3D)
package {
class Vector3D {
private const PI_OVER_D180:Number;
private const D180_OVER_PI:Number;
public var x:Number;
public var y:Number;
public var z:Number;
function Vector3D(_arg1:Number, _arg2:Number, _arg3:Number){
D180_OVER_PI = (180 / Math.PI);
PI_OVER_D180 = (Math.PI / 180);
super();
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function scale(_arg1:Number):void{
this.x = (this.x * _arg1);
this.y = (this.y * _arg1);
this.z = (this.z * _arg1);
}
public function add(_arg1:Vector3D):void{
this.x = (this.x + _arg1.x);
this.y = (this.y + _arg1.y);
this.z = (this.z + _arg1.z);
}
public function dot(_arg1:Vector3D):Number{
var _local2:Number;
_local2 = (((this.x * _arg1.x) + (this.y * _arg1.y)) + (this.z * _arg1.z));
return (_local2);
}
public function angle(_arg1:Vector3D):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = this.dot(_arg1);
_local3 = magnitude();
_local4 = _arg1.magnitude();
return (0);
}
public function normalise():void{
var _local1:Number;
_local1 = magnitude();
this.x = (this.x / _local1);
this.y = (this.y / _local1);
this.z = (this.z / _local1);
}
public function magnitude():Number{
return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z))));
}
}
}//package
Section 228
//VideoClip (VideoClip)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public dynamic class VideoClip extends MovieClip {
public var vid:Video;
public var buttonLink:button_url;
public function VideoClip(){
addFrameScript(0, frame1, 283, frame284);
}
function frame284(){
stop();
dispatchEvent(new Event("video_complete"));
}
function frame1(){
stop();
}
}
}//package