Section 1
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import flash.utils.*;
import com.adobe.utils.*;
public class MD5 {
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int;
_local9 = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((IntUtil.rol(_local9, _arg7) + _arg3));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function createBlocks(_arg1:ByteArray):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = new Array();
_local3 = (_arg1.length * 8);
_local4 = 0xFF;
_local5 = 0;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
public static function hash(_arg1:String):String{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
public static function hashBinary(_arg1:ByteArray):String{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:int;
_local2 = 1732584193;
_local3 = -271733879;
_local4 = -1732584194;
_local5 = 271733878;
_local10 = createBlocks(_arg1);
_local11 = _local10.length;
_local12 = 0;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
return ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
}
}//package com.adobe.crypto
Section 2
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local3:String;
var _local4:int;
var _local5:int;
_local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int;
_local3 = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
}
}//package com.adobe.utils
Section 3
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 4
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 5
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 6
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.ui.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 7
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 8
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 9
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 10
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 11
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 12
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 13
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 14
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 15
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 16
//PreloaderEvent (gamework.events.PreloaderEvent)
package gamework.events {
import flash.events.*;
public class PreloaderEvent extends Event {
private var _url:String;
public static const ITEM_COMPLETE:String = "itemComplete";
public static const ERROR:String = "error";
public static const COMPLETE:String = "complete";
public static const PROGRESS:String = "progress";
public function PreloaderEvent(_arg1:String, _arg2:String=null){
super(_arg1);
_url = _arg2;
}
override public function toString():String{
return (formatToString("PreloaderEvent", "type", "target", "url"));
}
public function get url():String{
return (_url);
}
}
}//package gamework.events
Section 17
//URLCaller (gamework.net.URLCaller)
package gamework.net {
import flash.net.*;
import com.adobe.crypto.*;
public class URLCaller {
public static const GAME_ID:int = 1743;
public static function submitScore(_arg1:Number):void{
var _local2:String;
_local2 = MD5.hash((((("gameid=" + GAME_ID) + "&hiscore=") + _arg1) + "2DPlay.com/"));
navigateToURL(new URLRequest(((((("http://www.2DPlay.com/highscores.php?gameid=" + GAME_ID) + "&hiscore=") + _arg1) + "&hash=") + _local2)), "_blank");
}
public static function mainLink(_arg1=null):void{
navigateToURL(new URLRequest(("http://www.2DPlay.com/index.php?gameid=" + GAME_ID)), "_blank");
}
public static function viewScores(_arg1=null):void{
navigateToURL(new URLRequest(("http://www.2Dplay.com/showscores.php?gameid=" + GAME_ID)), "_blank");
}
public static function getGameForSite(_arg1=null):void{
navigateToURL(new URLRequest("http://www.2DPlay.com/freecontent.htm"), "_blank");
}
public static function downloadGame(_arg1=null):void{
navigateToURL(new URLRequest(("http://www.2DPlay.com/downloadgame.php?gameid=" + GAME_ID)), "_blank");
}
public static function playMoreGames(_arg1=null):void{
navigateToURL(new URLRequest(("http://www.2DPlay.com/index.php?gameid=" + GAME_ID)), "_blank");
}
}
}//package gamework.net
Section 18
//ApplicationPreloader (gamework.preloaders.ApplicationPreloader)
package gamework.preloaders {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import gamework.events.*;
import gamework.net.*;
import flash.text.*;
public class ApplicationPreloader extends MovieClip {
public var progress_bar_at:MovieClip;
private var logoAnimationCompleted:Boolean;// = false
private var timer:Timer;
private var _skip:Boolean;// = false
private var barCompleted:Boolean;// = false
private var progressBar:MovieClip;
private var progressBarMask:MovieClip;
public var animated_logo_at:MovieClip;
private var global:Global;
private var animatedLogo:MovieClip;
public function ApplicationPreloader(){
global = Global.getInstance();
logoAnimationCompleted = false;
barCompleted = false;
_skip = false;
super();
addFrameScript(0, frame1);
animatedLogo = MovieClip(getChildByName("animated_logo_at"));
progressBar = MovieClip(getChildByName("progress_bar_at"));
progressBarMask = progressBar.progress_bar_mask_at;
progressBar.alpha = 0;
timer = new Timer(33);
timer.addEventListener(TimerEvent.TIMER, onTimerEventHandler);
timer.start();
animatedLogo.stop();
animatedLogo.buttonMode = true;
animatedLogo.addEventListener(MouseEvent.CLICK, URLCaller.mainLink);
}
public function set skip(_arg1:Boolean):void{
_skip = _arg1;
}
private function onTimerEventHandler(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:Number;
_local2 = stage.loaderInfo.bytesLoaded;
_local3 = stage.loaderInfo.bytesTotal;
_local4 = (_local2 / _local3);
progressBarMask.scaleX = _local4;
if (_skip){
logoAnimationCompleted = (barCompleted = true);
};
if (!logoAnimationCompleted){
if (animatedLogo.currentFrame == animatedLogo.totalFrames){
logoAnimationCompleted = true;
} else {
animatedLogo.nextFrame();
};
} else {
if (!barCompleted){
if (_local4 == 1){
barCompleted = true;
} else {
progressBar.alpha = (progressBar.alpha + 0.1);
if (progressBar.alpha >= 1){
barCompleted = true;
progressBar.alpha = 1;
};
};
} else {
if (_local4 == 1){
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, onTimerEventHandler);
timer = null;
animatedLogo.removeEventListener(MouseEvent.CLICK, URLCaller.mainLink);
dispatchEvent(new PreloaderEvent(PreloaderEvent.COMPLETE));
};
};
};
_arg1.updateAfterEvent();
}
function frame1(){
stop();
}
}
}//package gamework.preloaders
Section 19
//ApplicationContextMenu (gamework.ui.ApplicationContextMenu)
package gamework.ui {
import flash.events.*;
import flash.ui.*;
import gamework.net.*;
public class ApplicationContextMenu {
private static var moreGamesItem:ContextMenuItem = new ContextMenuItem("Play more games");
private static var getGameItem:ContextMenuItem = new ContextMenuItem("Get game for your site");
private static var scoresItem:ContextMenuItem = new ContextMenuItem("High scores");
private static var downloadItem:ContextMenuItem = new ContextMenuItem("Download this game");
private static var menu:ContextMenu;
private static function onMenuItemSelect(_arg1:ContextMenuEvent):void{
switch (_arg1.target){
case scoresItem:
URLCaller.viewScores();
break;
case moreGamesItem:
URLCaller.playMoreGames();
break;
case getGameItem:
URLCaller.getGameForSite();
break;
case downloadItem:
URLCaller.downloadGame();
break;
};
}
public static function getMenu():ContextMenu{
if (!menu){
menu = new ContextMenu();
menu.hideBuiltInItems();
scoresItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onMenuItemSelect);
moreGamesItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onMenuItemSelect);
getGameItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onMenuItemSelect);
downloadItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onMenuItemSelect);
menu.customItems.push(scoresItem);
menu.customItems.push(moreGamesItem);
menu.customItems.push(getGameItem);
menu.customItems.push(downloadItem);
};
return (menu);
}
}
}//package gamework.ui
Section 20
//archievement (jet.archievement)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import flash.filters.*;
import flash.text.*;
public class archievement extends MovieClip {
private var Description:TextField;
public var description:TextField;
private var Title:TextField;
public var title:TextField;
private var archieved:Boolean;
private var myTexts:Array;
private var hidden:Boolean;
private var global:Global;
private var fltHighlight:GlowFilter;
public function archievement(_arg1:String=null){
global = Global.getInstance();
fltHighlight = new GlowFilter(0, 3, 10, 15, 2, 1, false, false);
super();
addFrameScript(0, frame1);
if (!_arg1){
initarchievement();
} else {
name = _arg1;
initBlendin();
};
}
private function initBlendin():void{
Title = (getChildByName("title") as TextField);
Description = (getChildByName("description") as TextField);
myTexts = archievements.aText(name);
Title.text = myTexts[0];
Description.text = myTexts[1];
gotoAndStop(3);
this.alpha = 1;
this.x = 155;
this.y = 56;
global.sounds.archieve();
global.main.addChild(this);
setTimeout(fadeOut, 5000);
}
private function fadeInArchie(_arg1:Event):void{
if (this.alpha < 1){
this.alpha = (this.alpha + 0.03);
} else {
fadeOut();
};
}
public function initarchievement():void{
global.dictArchchievementObjects[name] = this;
Title = (getChildByName("title") as TextField);
Description = (getChildByName("description") as TextField);
myTexts = archievements.aText(name);
Title.text = myTexts[0];
Description.text = myTexts[1];
if (global.dictArchchievements){
archieved = global.dictArchchievements[name];
};
if (archieved){
showArchieved();
} else {
resetArchievement();
};
addEventListener(MouseEvent.MOUSE_OVER, highLight);
addEventListener(MouseEvent.MOUSE_OUT, lowLight);
}
private function lowLight(_arg1):void{
filters = [];
}
public function setArchieved():void{
var _local1:archievement;
if (archieved == true){
return;
};
this.archieved = true;
global.dictArchchievements[name] = true;
global.loadsave.saveProgress();
showArchieved();
_local1 = new archievement(name);
}
private function fadeOut():void{
global.main.removeEventListener(Event.ENTER_FRAME, fadeInArchie);
if (this.alpha > 0){
this.alpha = (this.alpha - 0.05);
setTimeout(fadeOut, 30);
} else {
global.main.removeAndKill(this);
};
}
function frame1(){
stop();
}
private function highLight(_arg1):void{
filters = [fltHighlight];
}
private function showArchieved(_arg1=null):void{
gotoAndStop(2);
this.alpha = 1;
}
public function resetArchievement(_arg1=null):void{
gotoAndStop(1);
this.alpha = 0.5;
this.archieved = false;
}
}
}//package jet
Section 21
//archievements (jet.archievements)
package jet {
import flash.display.*;
import flash.utils.*;
import lt.uza.utils.*;
public class archievements extends Sprite {
public var archie1:archievement;
public var archie4:archievement;
public var archie5:archievement;
public var archie6:archievement;
public var archie9:archievement;
public var archie3:archievement;
public var archie10:archievement;
public var archie8:archievement;
public var archie15:archievement;
public var archie16:archievement;
public var archie17:archievement;
public var archie11:archievement;
public var archie12:archievement;
public var archie7:archievement;
public var archie19:archievement;
public var archie14:archievement;
public var archie18:archievement;
public var archie13:archievement;
public var archie2:archievement;
public var archie20:archievement;
public var archie21:archievement;
private var global:Global;
public var OKarchie:MovieClip;
public static var dictArchchievements:Dictionary;
public static var dictArchtexts:Dictionary = new Dictionary();
public function archievements(){
global = Global.getInstance();
super();
global.archievements = this;
initarchievements();
}
public function testArchiesNinecombo(_arg1:String):void{
if (_arg1 == "sco"){
global.dictArchchievementObjects["archie1"].setArchieved();
};
if (_arg1 == "spd"){
global.dictArchchievementObjects["archie2"].setArchieved();
};
if (_arg1 == "alt"){
global.dictArchchievementObjects["archie3"].setArchieved();
};
}
public function testArchiesScore():void{
if (scoreMan.scoScoreCurrent < 500000){
return;
};
if (scoreMan.scoScoreCurrent < 1000000){
global.dictArchchievementObjects["archie14"].setArchieved();
return;
};
if (scoreMan.scoScoreCurrent < 10000000){
global.dictArchchievementObjects["archie15"].setArchieved();
return;
};
if (scoreMan.scoScoreCurrent < 100000000){
global.dictArchchievementObjects["archie16"].setArchieved();
return;
};
if (scoreMan.scoScoreCurrent < 999999999){
global.dictArchchievementObjects["archie17"].setArchieved();
return;
};
global.dictArchchievementObjects["archie18"].setArchieved();
}
public function initarchievements():void{
}
public function setKamikazeArchie():void{
global.dictArchchievementObjects["archie19"].setArchieved();
}
public function testArchiesHeightlevel(_arg1:int):void{
switch (_arg1){
case 10:
global.dictArchchievementObjects["archie9"].setArchieved();
break;
case 25:
global.dictArchchievementObjects["archie10"].setArchieved();
break;
case 50:
global.dictArchchievementObjects["archie11"].setArchieved();
break;
case 75:
global.dictArchchievementObjects["archie12"].setArchieved();
break;
case 100:
global.dictArchchievementObjects["archie13"].setArchieved();
break;
};
}
public function resetarchievements():void{
var _local1:Object;
for each (_local1 in global.dictArchchievementObjects) {
_local1.resetArchievement();
};
}
public function testArchieMulti(_arg1:int):void{
if (_arg1 > 49){
global.dictArchchievementObjects["archie20"].setArchieved();
};
if (_arg1 > 99){
global.dictArchchievementObjects["archie21"].setArchieved();
};
}
public function testArchiesSpeedlevel(_arg1:int):void{
switch (_arg1){
case 10:
global.dictArchchievementObjects["archie4"].setArchieved();
break;
case 25:
global.dictArchchievementObjects["archie5"].setArchieved();
break;
case 50:
global.dictArchchievementObjects["archie6"].setArchieved();
break;
case 75:
global.dictArchchievementObjects["archie7"].setArchieved();
break;
case 100:
global.dictArchchievementObjects["archie8"].setArchieved();
break;
};
}
public static function getAState(_arg1:String):Boolean{
if (dictArchchievements[_arg1] == true){
return (true);
};
return (true);
}
public static function aText(_arg1:String):Array{
if (dictArchtexts[_arg1]){
return (dictArchtexts[_arg1]);
};
return (["?", "?"]);
}
dictArchtexts["archie1"] = ["Green Dragoner", "Get a combo of nine green orbs"];
dictArchtexts["archie2"] = ["Orange Dragoner", "Get a combo of nine orange orbs"];
dictArchtexts["archie3"] = ["Blue Dragoner", "Get a combo of nine blue orbs"];
dictArchtexts["archie4"] = ["Fast Eddie", "Reach a speed level of 10"];
dictArchtexts["archie5"] = ["Speedy Gonzalez", "Reach a speed level of 25"];
dictArchtexts["archie6"] = ["Thunderbolt", "Reach a speed level of 50"];
dictArchtexts["archie7"] = ["Lightning", "Reach a speed level of 75"];
dictArchtexts["archie8"] = ["Warp 9", "Reach a speed level of 100"];
dictArchtexts["archie9"] = ["Learning to fly", "Reach a height level of 10"];
dictArchtexts["archie10"] = ["Rising high", "Reach a height level of 25"];
dictArchtexts["archie11"] = ["Shoot for the Moon", "Reach a height level of 50"];
dictArchtexts["archie12"] = ["Sundancer", "Reach a height level of 75"];
dictArchtexts["archie13"] = ["Alien Lifeform", "Reach a height level of 100"];
dictArchtexts["archie14"] = ["Halfling", "Reach a score of half a million"];
dictArchtexts["archie15"] = ["Million Dollar Baby", "Reach a score of 1.000.000"];
dictArchtexts["archie16"] = ["Patient Picker", "Reach a score of 10.000.000"];
dictArchtexts["archie17"] = ["EAT ME", "Reach a score of a 100.000.000"];
dictArchtexts["archie18"] = ["Orb Eater", "Reach a score of a 999.999.999"];
dictArchtexts["archie19"] = ["Kamikaze", "Collect 10 red Xes in a row"];
dictArchtexts["archie20"] = ["The Multiplicator", "Get a multiplicator of 50"];
dictArchtexts["archie21"] = ["Violator", "Get a multiplicator of 100"];
dictArchtexts["archie22"] = ["High Roller", "Only eat blue orbs for ten levels"];
dictArchtexts["archie23"] = ["Greenhorn", "Only eat green orbs for ten levels"];
}
}//package jet
Section 22
//BillBoard (jet.BillBoard)
package jet {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import lt.uza.utils.*;
import org.papervision3d.objects.primitives.*;
public class BillBoard extends Plane {
private var global:Global;
public function BillBoard(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
global = Global.getInstance();
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
MathUtils.copyAndTranspose(_arg1.world, transform, true);
transform.calculateMultiply3x3(transform, _arg2.camera.transform);
return (super.project(_arg1, _arg2));
}
}
}//package jet
Section 23
//cargobay (jet.cargobay)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class cargobay extends MovieClip {
public var blendinFinishFunc2:Function;
public var redlight:MovieClip;
private var finishY:Number;// = -420
private var blendoutFinishFunc:Function;
private var Redlight:MovieClip;
public var jetopen:MovieClip;
private var JetOpen:MovieClip;
private var blendspeed:int;// = 30
private var baseX:Number;
private var baseY:Number;
private var global:Global;
private var blendinFinishFunc:Function;
public function cargobay(){
global = Global.getInstance();
finishY = -420;
blendspeed = 30;
super();
global.cargobay = this;
baseY = this.y;
baseX = this.x;
blendinFinishFunc2 = doNothing;
JetOpen = (getChildByName("jetopen") as MovieClip);
JetOpen.visible = false;
Redlight = (getChildByName("redlight") as MovieClip);
startShake();
}
private function blendinStep(_arg1:Event):void{
if (this.y < baseY){
this.y = (this.y + (((baseY - this.y) * 0.1) + 1));
} else {
this.y = baseY;
global.main.removeEventListener(Event.ENTER_FRAME, blendinStep);
if (global.screenblur){
global.screenblur.dounblurScreen();
};
JetOpen.play();
startShake();
if (blendinFinishFunc != null){
setTimeout(blendinFinishFunc, 2000);
} else {
setTimeout(blendinFinishFunc2, 2000);
};
};
}
private function stopShake():void{
removeEventListener(Event.ENTER_FRAME, shakeStep);
}
public function blendin(_arg1:Function=null):void{
global.sounds.dotitlesounds();
blendinFinishFunc = _arg1;
this.y = finishY;
visible = true;
global.main.addEventListener(Event.ENTER_FRAME, blendinStep);
}
private function initblendout():void{
Redlight.visible = false;
stopShake();
global.main.addEventListener(Event.ENTER_FRAME, blendoutStep);
}
public function blendout(_arg1:Function=null):void{
blendoutFinishFunc = _arg1;
JetOpen.visible = true;
JetOpen.gotoAndStop(2);
JetOpen.play();
global.sounds.altLevelup();
setTimeout(initblendout, 3000);
}
private function doNothing():void{
}
private function blendoutStep(_arg1:Event):void{
if (this.y > finishY){
this.y = (this.y + (((finishY - this.y) * 0.1) - 1));
} else {
global.main.removeEventListener(Event.ENTER_FRAME, blendoutStep);
visible = false;
global.whitefade.gotoAndPlay(1);
if (blendoutFinishFunc != null){
blendoutFinishFunc();
};
};
}
private function startShake():void{
addEventListener(Event.ENTER_FRAME, shakeStep);
}
private function shakeStep(_arg1):void{
this.x = (baseX + (Math.random() * 10));
this.y = (baseY + (Math.random() * 10));
}
}
}//package jet
Section 24
//crosshair (jet.crosshair)
package jet {
import flash.display.*;
import flash.utils.*;
import lt.uza.utils.*;
public class crosshair extends Sprite {
private var scene_renderheight:int;
private var halfheight:int;
private var padding:int;// = 20
private var camera;
private var aMousey:int;
var MtopBDist:int;
private var aMousex:int;
var MdistToBorder:int;
private var help;
var fadeinTreshold:int;// = 100
private var crosshairSpeed:Number;// = 100
private var crosshairScale:Number;// = 0.3
private var crosshair_1:crosshair1;
private var crosshair_3:crosshair3;
private var mouseAmplifyer:Number;// = 1
private var crosshair_2;
private var halfwidth:int;
private var cross_earth;
var MrightBDist:int;
private var global:Global;
private var scene_renderwidth:int;
var MleftBDist:int;
var MbotBDist:int;
public function crosshair(){
crosshairSpeed = 100;
crosshairScale = 0.3;
global = Global.getInstance();
scene_renderwidth = definitions.scene_renderwidth;
scene_renderheight = definitions.scene_renderheight;
halfwidth = (scene_renderwidth / 2);
halfheight = (scene_renderheight / 2);
mouseAmplifyer = 1;
padding = 20;
fadeinTreshold = 100;
super();
camera = global.camera;
initcrosshair();
}
public function initcrosshair():void{
var _local1:*;
crosshair_1 = new crosshair1();
global.crosshair_1 = crosshair_1;
global.crosshair = this;
_local1 = crosshair_1.getChildByName("crossMain");
help = crosshair_1.getChildByName("Help");
crosshair_2 = _local1.getChildByName("crossSpinner");
cross_earth = _local1.getChildByName("crossearth");
crosshair_3 = new crosshair3();
global.main.stage.addChild(crosshair_3);
global.main.stage.addChildAt(crosshair_1, 1);
global.crosshairScale = crosshairScale;
crosshair_1.scaleX = (crosshair_1.scaleY = crosshairScale);
help.scaleX = (help.scaleY = (1 / crosshairScale));
setTimeout(help.initBaseHelp, 5000);
}
public function makeChaos():void{
global.chaos = true;
crosshair_1.blendMode = "multiply";
}
public function makeBig():void{
if (crosshair_1.scaleX < (crosshairScale * 2)){
global.orbCatchradius = (global.orbCatchradius * 1.4);
global.crosshairScale = (global.crosshairScale * 1.4);
crosshair_1.scaleX = (crosshair_1.scaleY = (crosshair_1.scaleY * 1.4));
help.scaleX = (help.scaleY = (help.scaleY / 1.4));
help.y = (help.y - 25);
if (crosshair_1.scaleX > (crosshairScale * 2)){
global.tetris.addFeedback(14);
} else {
global.tetris.addFeedback(13);
};
};
}
public function movement():void{
crosshair_2.rotation = (crosshair_2.rotation + (camera.camRollstep * 50));
cross_earth.rotation = -(camera.camRolloffset);
crosshair_1.x = mouseX;
crosshair_1.y = mouseY;
crosshair_3.x = mouseX;
crosshair_3.y = mouseY;
global.game.hideMouse();
setMouseAlpha();
}
public function makeSmall():void{
if (crosshair_1.scaleX > (crosshairScale / 1.7)){
global.orbCatchradius = (global.orbCatchradius / 1.4);
global.crosshairScale = (global.crosshairScale / 1.4);
crosshair_1.scaleX = (crosshair_1.scaleY = (crosshair_1.scaleY / 1.4));
help.scaleX = (help.scaleY = (help.scaleY * 1.4));
help.y = (help.y + 25);
if (crosshair_1.scaleX > (crosshairScale / 1.7)){
global.tetris.addFeedback(12);
} else {
global.tetris.addFeedback(15);
};
};
}
private function setMouseAlpha():void{
MleftBDist = crosshair_3.x;
MtopBDist = crosshair_3.y;
MrightBDist = (scene_renderwidth - crosshair_3.x);
MbotBDist = (scene_renderheight - crosshair_3.y);
MdistToBorder = Math.min(MleftBDist, MtopBDist, MrightBDist, MbotBDist);
if (MdistToBorder < fadeinTreshold){
crosshair_3.alpha = ((fadeinTreshold - MdistToBorder) / fadeinTreshold);
} else {
crosshair_3.alpha = 0;
};
}
public function destroy():void{
global.main.stage.removeChild(crosshair_1);
}
}
}//package jet
Section 25
//debug (jet.debug)
package jet {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import lt.uza.utils.*;
import flash.filters.*;
import flash.text.*;
import flash.system.*;
public class debug {
var statString:String;// = ""
private var Mainhandle:Object;
private var scene_renderheight;
private var statsAreBehind:Boolean;// = true
var totalmem:Number;
private var statsField:TextField;
private var global:Global;
public var Progressbar:MovieClip;
private var consoleField:TextField;
private var consoleFormat:TextFormat;
private var FPSField:TextField;
private var scene_renderwidth;
private static var allowInstantiation:Boolean;
private static var instance:debug;
public function debug():void{
global = Global.getInstance();
FPSField = new TextField();
statsField = new TextField();
consoleFormat = new TextFormat();
statsAreBehind = true;
scene_renderwidth = definitions.scene_renderwidth;
scene_renderheight = definitions.scene_renderheight;
statString = "";
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use debug.getInstance() instead of new."));
};
}
public function writeStats(_arg1:RenderStatistics):void{
if (statsField.visible){
statsField.htmlText = ((((((((((((((("MB: " + calculateUsedBytes()) + "\n") + "Tris: ") + _arg1.triangles) + "\n") + "tTris: ") + _arg1.transparentTriangles) + "\n") + "culledTris: ") + _arg1.culledTriangles) + "\n") + "culledObjs: ") + _arg1.culledObjects) + "\n") + statString);
statString = "";
};
}
public function writeToConsole(_arg1:String="", _arg2="#FFCC00", _arg3:int=10, _arg4:Boolean=false, _arg5:int=0):void{
var _local6:*;
if (((!(consoleField.visible)) && (!(_arg4)))){
return;
};
consoleField.visible = true;
consoleField.htmlText = ((((((("<FONT FACE=\"Lucida Console\" COLOR=\"" + _arg2) + "\" SIZE=\"") + _arg3) + "\">") + _arg1) + "</FONT>\n") + consoleField.htmlText);
_local6 = consoleField.numLines;
consoleField.y = Math.max(((scene_renderheight - (_local6 * 11)) - 2), (scene_renderheight - 300));
}
public function hideLoadbutton():void{
global.hud.hud_debugfield.visible = !(global.hud.hud_debugfield.visible);
}
public function writeFPS(_arg1:int, _arg2:RenderStatistics):void{
FPSField.text = ((((((((((((("mb: " + calculateUsedBytes()) + "\n") + "fps: ") + String(_arg1)) + "\n") + "tris: ") + _arg2.triangles) + "\n") + "speed: ") + global.speedscore) + "\n") + "height: ") + global.altscore);
}
public function writeError(_arg1:String):void{
consoleField.visible = true;
global.stage.addChild(consoleField);
writeToConsole(("ERROR: " + _arg1), "#FF3300", 12, true, 10000);
}
public function addStatsWarning(_arg1:String=""):void{
if (statsField.visible){
statString = (statString + (("<font color='#FF6600'>" + _arg1) + "</font>\n"));
};
}
private function calculateUsedBytes():String{
totalmem = Number((System.totalMemory / Math.pow(2, 20)));
return (totalmem.toFixed(2).toString());
}
public function toggleStats():void{
statsField.visible = !(statsField.visible);
consoleField.visible = !(consoleField.visible);
}
public function writeSimpleStats(_arg1):void{
if (statsField.visible){
statsField.htmlText = _arg1;
};
}
public function removeLastConsoleline():void{
if (consoleField.y < scene_renderheight){
consoleField.y = (consoleField.y + 11);
} else {
consoleField.htmlText = "";
};
}
public function createConsole():void{
var _local1:DropShadowFilter;
consoleFormat.color = 0x44FF00;
consoleFormat.size = 10;
consoleFormat.font = "Lucida Console";
consoleField = new TextField();
consoleField.defaultTextFormat = consoleFormat;
consoleField.width = definitions.scene_renderwidth;
consoleField.height = 600;
consoleField.multiline = true;
consoleField.selectable = false;
consoleField.mouseEnabled = false;
consoleField.x = 1;
consoleField.y = 11;
global.main.stage.addChild(consoleField);
FPSField.defaultTextFormat = consoleFormat;
FPSField.width = 170;
FPSField.height = 70;
FPSField.x = 630;
FPSField.y = 10;
statsField.defaultTextFormat = consoleFormat;
statsField.width = 400;
statsField.height = 300;
statsField.multiline = true;
statsField.selectable = false;
statsField.mouseEnabled = false;
statsField.x = 1;
statsField.y = 1;
statsField.htmlText = " ";
_local1 = new DropShadowFilter(1.5, 60, 0, 1, 0, 0, 1);
statsField.filters = [_local1];
consoleField.filters = [_local1];
FPSField.filters = [_local1];
global.main.stage.addChild(FPSField);
consoleField.visible = false;
statsField.visible = false;
}
public function addNumberStats(_arg1:String="", _arg2:Number=0, _arg3:Number=0, _arg4:Number=100000):void{
if (statsField.visible){
if ((((_arg2 >= _arg3)) && ((_arg2 <= _arg4)))){
statString = (statString + (((_arg1 + " ") + _arg2) + "\n"));
} else {
statString = (statString + (((("<font color='#FF6600'>" + _arg1) + " ") + _arg2) + "</font>\n"));
};
};
}
public function addStats(_arg1:String="-"):void{
if (statsField.visible){
statString = (statString + (_arg1 + "\n"));
};
}
public static function getInstance():debug{
if (instance == null){
allowInstantiation = true;
instance = new (debug);
if (definitions.allowDebug){
instance.createConsole();
};
allowInstantiation = false;
};
return (instance);
}
}
}//package jet
Section 26
//definitions (jet.definitions)
package jet {
public class definitions {
public static var flightradius = (measure_earthradius + flightheight);
public static var tick_checkActivateables:int = 10;
public static var flightspeedMultiplyer:Number = 0.5;
public static var minFlightheight:Number = 1000;
public static var numClouds:int = 270;
public static var curr_maxFlightheight:Number = start_maxFlightheight;
public static var scene_renderheight:int = 600;
public static var SITELOCKED:Boolean = false;
public static var numOrbs_score_curr:int = numOrbs_score;
public static var cloudmaxHeight:int = 4000;
public static var numOrbs_minus:int = 10;
public static var maxFlightheight:Number = 2000;
public static var sitelockURL:String = "jo-mei.com";
public static var start_minFlightheight:Number = 1000;
public static var cloudheightVariance:Number = 0.7;
public static var start_camMaxRoll:Number = 90;
public static var numOrbs_score:int = 100;
public static var curr_orbviewDist:Number = start_orbviewDist;
public static var start_maxFlightheight:Number = 2000;
public static var cloudsizeVariance:Number = 0.7;
public static var curr_flightspeed:Number = start_flightspeed;
public static var numOrbs_chaos:int = 10;
public static var orbHeightvariance:Number = 0.9;
public static var curr_camMaxRoll:Number = start_camMaxRoll;
public static var multiplyerDecay:Number = 0.1;
public static var start_orbviewDist:Number = 6000;
public static var numOrbs_speed_curr:int = numOrbs_speed;
public static var starSize:int = 3;
public static var start_Flightheight:Number = 1500;
public static var start_flightspeed:Number = (100000 / (3600 * base_fps));
public static var base_fps:int = 60;
public static var orbSize:int = 90;
public static var numStars:int = 200;
public static var cloudminHeight:int = 1000;
public static var worldsphereHeightsegments:int = 30;
public static var allowDebug:Boolean = false;
public static var flightheight:Number = 1500;
public static var start_camRollspeed:Number = 0.01;
public static var curr_camCurvespeed:Number = start_camCurvespeed;
public static var numOrbs_plus:int = 10;
public static var curr_Flightheight:Number = start_Flightheight;
public static var numOrbs_height_curr:int = numOrbs_height;
public static var saveName:String = "ver111";
public static var start_camHeightspeed:Number = 0.1;
public static var numOrbs_red_curr:int = numOrbs_red;
public static var curr_flightspeedMultiplyer:Number = start_flightspeedMultiplyer;
public static var scene_renderwidth:int = 700;
public static var worldsphereWidthsegments:int = 28;
public static var curr_camRollspeed:Number = start_camRollspeed;
public static var start_camCurvespeed:Number = 90;
public static var numOrbs_multi_curr:int = numOrbs_multi;
public static var currentmultiplyerDecay:Number = multiplyerDecay;
public static var numOrbs_multi:int = 20;
public static var flightspeed:Number = (100000 / (3600 * base_fps));
public static var cloudSize:int = 2000;
public static var curr_camHeightspeed:Number = start_camHeightspeed;
public static var numOrbs_plus_curr:int = numOrbs_minus;
public static var numOrbs_speed:int = 100;
public static var numOrbs_minus_curr:int = numOrbs_minus;
public static var orbCatchradius:Number = 100;
public static var currFlightheight:Number = 1500;
public static var start_flightspeedMultiplyer:Number = 0.5;
public static var numOrbs_red:int = 10;
public static var orbHeight:Number = (measure_earthradius + 1800);
public static var numOrbs_chaos_curr:int = numOrbs_chaos;
public static var numOrbs_height:int = 100;
public static var measure_earthradius:Number = 6371;
public static var curr_minFlightheight:Number = start_minFlightheight;
}
}//package jet
Section 27
//Game (jet.Game)
package jet {
import flash.display.*;
import org.papervision3d.core.math.*;
import flash.media.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import org.papervision3d.view.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import lt.uza.utils.*;
import flash.filters.*;
import org.papervision3d.core.geom.*;
import flash.net.*;
import org.papervision3d.*;
import org.papervision3d.view.layer.util.*;
import org.papervision3d.events.*;
import org.papervision3d.render.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.core.*;
public class Game extends MovieClip {
private var numClouds:int;// = 200
private var Crosshair;
private var camAxis:Sphere;
private var avgFPSarray:Array;
public var helpTips;
private var cloudheightVariance:Number;// = 0.1
private var Debug:debug;
private var _frameTime:int;// = 0
private var camHelper:DisplayObject3D;
private var cloudsizeVariance:Number;// = 0.5
var so:SharedObject;
private var CO2Size:int;// = 80
private var p:DisplayObject3D;
private var numCO2s:int;// = 180
private var playerON:Boolean;// = false
private var fpsSlot:int;// = 0
private var scene:Scene3D;
private var container:Sprite;
public var helpBalloons;
private var spartipTimerON:Boolean;
private var uiDigits;
private var allowBalloons:Boolean;// = true
private var viewport;
private var balloonheightVariance:Number;// = 0.4
public var helpFramesize;
var avgFPS:Number;
private var spartipTimer;
private var lockedSpinfactor:int;// = 0
private var scene_renderwidth:int;
private var myNewscore:int;
private var renderer:BasicRenderEngine;
private var _beforeTime:int;// = 0
private var idleSpartiptimer;
public var helpRenderQuality;
private var balloonSize:int;// = 3000
private var aFPS:int;
private var upAxis:Number3D;
private var balloonsON:Boolean;// = false
private var totalFPS:Number;
public var helpCrosshairspeed;
private var screenScalefactor:Number;// = 0.8
private var scene_renderheight:int;
private var tipsON:Boolean;// = true
private var Tipslider;
private var disp_kmh;
private var earthCenter:DisplayObject3D;
private var lockedTarget:Plane;
private var crosshairSpeed:Number;// = 5
public var help;
private var cloudSphereUmfang:Number;
private var myframe:MovieClip;
private var crosshair_1;
private var crosshair_3;
private var crosshair_2;
private var mat:BitmapFileMaterial;
private var balloonSizeVariance:Number;// = 0.6
private var helpIsON:Boolean;// = false
private var CO2heightVariance:Number;// = 0.3
private var gamecamera:GameCamera;
private var tex_de;
private var disp_alt;
private var flightheight:Number;
private var global:Global;
public var helpBgvol;
private var camAxisTotalRoll:Number;// = 0
private var disp_score;
private var cloudSphereRadius:Number;
private var flightSpeed:Number;
private var theProgress;
private var desiredMS:Number;// = 30
private var tex_en;
private var numBalloons:int;// = 5
private var idletimeToLogoff:int;// = 10000
private var _timeDiff:int;// = 0
private var cloudSize:int;// = 1200
private var skyplane:BillBoard;
private var mouseidleInterval:uint;
private var _afterTime:int;// = 0
private var hiddenTarget:Plane;
private var CO2islocked:Boolean;// = false
public function Game(){
global = Global.getInstance();
scene_renderwidth = definitions.scene_renderwidth;
scene_renderheight = definitions.scene_renderheight;
playerON = false;
idletimeToLogoff = 10000;
screenScalefactor = 0.8;
cloudSize = 1200;
numClouds = 200;
cloudsizeVariance = 0.5;
cloudheightVariance = 0.1;
cloudSphereRadius = definitions.measure_earthradius;
cloudSphereUmfang = (cloudSphereRadius * Math.PI);
balloonSize = 3000;
numBalloons = 5;
balloonSizeVariance = 0.6;
balloonheightVariance = 0.4;
balloonsON = false;
CO2Size = 80;
numCO2s = 180;
CO2heightVariance = 0.3;
flightSpeed = definitions.flightspeed;
flightheight = definitions.flightheight;
crosshairSpeed = 5;
upAxis = new Number3D(1, 0, 0);
p = new DisplayObject3D();
camAxisTotalRoll = 0;
CO2islocked = false;
helpIsON = false;
lockedSpinfactor = 0;
allowBalloons = true;
tipsON = true;
so = SharedObject.getLocal("co2score");
_beforeTime = 0;
_afterTime = 0;
_frameTime = 0;
_timeDiff = 0;
desiredMS = 30;
avgFPSarray = new Array(20);
fpsSlot = 0;
super();
init();
}
public function destroy():void{
global.world.destroyWorld();
Crosshair.destroy();
global.sounds.destroyMusic();
}
private function setVolume(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
var _local4:Number;
_local3 = _arg1.soundTransform;
_local4 = Math.min(Math.max(_arg2, 0), 1);
_local3.volume = _local4;
_arg1.soundTransform = _local3;
}
public function hideMouse():void{
Mouse.hide();
}
private function panSound(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
_local3 = _arg1.soundTransform;
_local3.pan = _arg2;
_arg1.soundTransform = _local3;
}
private function loop(_arg1:Event=null):void{
var _local2:*;
var _local3:Object;
fpsmod();
if (global.scenefrozen){
return;
};
global.suckCenter.copyTransform(gamecamera);
global.suckCenter.moveDown(150);
global.suckCenter.moveForward(300);
global.tetris.frameAction();
Crosshair.movement();
gamecamera.movement();
global.skybox.copyPosition(gamecamera);
_local2 = renderer.renderScene(scene, gamecamera, viewport);
Debug.writeFPS(avgFPS, _local2);
for (_local3 in global.orbdict) {
_local3.startSuckIn();
};
}
private function changeVolume(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
var _local4:Number;
_local3 = _arg1.soundTransform;
_local4 = Math.min(Math.max((_local3.volume + _arg2), 0), 1);
_local3.volume = _local4;
_arg1.soundTransform = _local3;
}
private function init():void{
var _local1:Dictionary;
var _local2:*;
global.game = this;
Debug = debug.getInstance();
_local1 = new Dictionary(true);
global.orbdict = _local1;
global.numOrbs = 0;
renderer = new BasicRenderEngine();
viewport = new Viewport3D(scene_renderwidth, scene_renderheight);
global.viewport = viewport;
global.main.stage.addChildAt(viewport, 0);
gamecamera = new GameCamera();
Crosshair = new crosshair();
scene = new Scene3D();
global.stage = stage;
global.scene = scene;
global.world = new World();
global.scenefrozen = false;
global.screenblur = screenBlur.getInstance();
global.score = 0;
global.speedscore = 0;
global.altscore = 0;
_local2 = new mouse();
hideMouse();
setTimeout(global.sounds.startMusic, 5000);
loop();
}
public function startFlight():void{
global.main.addEventListener(Event.ENTER_FRAME, loop);
}
private function fpsmod():void{
_timeDiff = (getTimer() - _frameTime);
avgFPS = averageFPS((1000 / _timeDiff));
global.FPSMOD = Math.max(0.5, Math.min((avgFPS / 30), 2));
_frameTime = getTimer();
}
function streamSound():void{
var _local1:URLRequest;
var _local2:String;
var _local3:Sound;
_local1 = new URLRequest("http://213.251.141.62:8006/;stream.nsv&type=mp3");
_local2 = "http://213.251.141.62:8006/;stream.nsv&type=mp3";
_local3 = new Sound();
_local3.load(_local1);
}
private function averageFPS(_arg1:Number):int{
var _local2:*;
avgFPSarray[fpsSlot] = _arg1;
totalFPS = 0;
for (_local2 in avgFPSarray) {
totalFPS = (totalFPS + avgFPSarray[_local2]);
};
aFPS = (totalFPS / 20);
fpsSlot++;
if (fpsSlot > 19){
fpsSlot = 0;
};
return (aFPS);
}
public function showMouse():void{
Mouse.show();
}
}
}//package jet
Section 28
//GameCamera (jet.GameCamera)
package jet {
import flash.geom.*;
import lt.uza.utils.*;
import org.papervision3d.cameras.*;
public class GameCamera extends Camera3D {
private var lookTargetPitch:Number;// = 30
private var camMaxHeightoffset:Number;// = 400
private var camZoom:int;// = 12
private var camFocus:int;// = 90
private var camHeightspeed:Number;// = 1
var camYaw:Number;
public var camRolloffset:Number;// = 0
private var oldcamPitchoffset:Number;// = 0
private var camPitchoffset:Number;// = 0
private var localPitch:Number;// = 0
private var scene_renderwidth:int;
private var camTargetroll:Number;
private var camTargetHeightoffset:Number;
private var camDefaultPitch:int;// = 20
private var camCurveoffset:Number;// = 0
private var heightEdgeBuffer:Number;
private var camRollspeed:Number;// = 0.01
private var currFlightheight:Number;
private var minFlightheight:Number;
private var scene_renderheight:int;
private var maxFlightheight:Number;
private var camCurvestep:Number;// = 0
private var camMaxRoll:Number;// = 3600
private var camTargetHeight:Number;
private var beforeHeight:Number;
private var camHeightstep:Number;
private var global:Global;
public var camRollstep:Number;// = 0
private var lookPitch:Number;// = 30
private var camCurvespeed:Number;// = 90
public var camHeightoffset:Number;// = 0
private var heightDifference:Number;
public function GameCamera(_arg1:Number=60, _arg2:Number=10, _arg3:Number=50000, _arg4:Boolean=true, _arg5:Boolean=false){
global = Global.getInstance();
scene_renderwidth = definitions.scene_renderwidth;
scene_renderheight = definitions.scene_renderheight;
camDefaultPitch = 20;
camZoom = 12;
camFocus = 90;
camRolloffset = 0;
camRollstep = 0;
camCurveoffset = 0;
camCurvestep = 0;
camRollspeed = 0.01;
camMaxRoll = 3600;
camCurvespeed = 90;
camMaxHeightoffset = 400;
camHeightoffset = 0;
camPitchoffset = 0;
oldcamPitchoffset = 0;
camHeightspeed = 1;
minFlightheight = definitions.minFlightheight;
maxFlightheight = definitions.maxFlightheight;
currFlightheight = definitions.currFlightheight;
lookPitch = 30;
lookTargetPitch = 30;
localPitch = 0;
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.zoom = 12;
this.focus = 54;
x = (y = (z = 0));
global.camera = this;
rotationX = (rotationX + 180);
moveUp(((definitions.measure_earthradius + definitions.curr_minFlightheight) + (definitions.curr_maxFlightheight / 2)));
pitch(30);
global.pushmodifyer = 1;
global.altmodifyer = 0;
}
public function initcamera(_arg1, _arg2):void{
}
public function movement():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
localRotationX = 0;
_local1 = ((camRolloffset * Math.PI) / 180);
global.rotMousecoords.x = ((global.mouseCoords.x * Math.cos(_local1)) - (global.mouseCoords.y * Math.sin(_local1)));
global.rotMousecoords.y = ((global.mouseCoords.y * Math.cos(_local1)) + (global.mouseCoords.x * Math.sin(_local1)));
_local2 = global.rotMousecoords.x;
_local3 = global.rotMousecoords.y;
camTargetroll = ((_local2 / 350) * definitions.curr_camMaxRoll);
camRollstep = (((camTargetroll - camRolloffset) * definitions.curr_camRollspeed) * 0.011);
beforeHeight = currFlightheight;
currFlightheight = (currFlightheight - ((_local3 * definitions.curr_camHeightspeed) / global.FPSMOD));
heightDifference = (beforeHeight - currFlightheight);
currFlightheight = Math.min((definitions.curr_maxFlightheight - 50), Math.max(currFlightheight, (definitions.curr_minFlightheight + 50)));
roll(camRolloffset);
camRolloffset = (camRolloffset + camRollstep);
rotationX = (rotationX - lookPitch);
copyPosition(global.earthCenter);
rotationX = (rotationX + (((((0.1 * definitions.curr_flightspeedMultiplyer) / global.FPSMOD) * 4000) / currFlightheight) * global.pushmodifyer));
camYaw = (_local2 / 600);
yaw(camYaw);
moveUp((definitions.measure_earthradius + currFlightheight));
rotationX = (rotationX + lookPitch);
roll(-(camRolloffset));
lookTargetPitch = (-(heightDifference) - (currFlightheight / 500));
localPitch = (localPitch + ((lookTargetPitch - localPitch) / 50));
localRotationX = localPitch;
oldcamPitchoffset = camPitchoffset;
updateFigures();
definitions.curr_orbviewDist = (6000 + ((currFlightheight - 1500) / 5));
if (global.pushmodifyer > 1){
global.pushmodifyer = (global.pushmodifyer - 0.05);
};
}
private function updateFigures():void{
global.mini_roll.text = camRolloffset;
global.mini_alt.text = Math.round(currFlightheight);
global.mini_pit.text = localRotationX;
global.mini_yaw.text = camYaw;
}
}
}//package jet
Section 29
//gauge (jet.gauge)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class gauge extends MovieClip {
public var lvlupGlow:MovieClip;
public var Red:MovieClip;
private var global:Global;
public var Fill:MovieClip;
public var Adder:MovieClip;
public function gauge(){
global = Global.getInstance();
super();
Fill = (getChildByName("fill") as MovieClip);
Adder = (getChildByName("adder") as MovieClip);
Red = (getChildByName("red") as MovieClip);
lvlupGlow = (getChildByName("levelupGlow") as MovieClip);
lvlupGlow.visible = false;
Red.visible = false;
Fill.scaleY = 0.001;
Adder.scaleY = 0.001;
}
public function checkLevelActions(){
setTimeout(global.world.createOrbs, 5000);
}
public function initLvlupGlow():void{
lvlupGlow.gotoAndPlay(1);
lvlupGlow.visible = true;
lvlupGlow.alpha = 1;
global.main.addEventListener(Event.ENTER_FRAME, fadeoutGlow);
}
public function shakeViewport(_arg1:Number):void{
if (_arg1 > 1){
global.viewport.x = ((Math.random() * _arg1) - (_arg1 / 2));
global.viewport.y = ((Math.random() * _arg1) - (_arg1 / 2));
_arg1 = (_arg1 * 0.95);
setTimeout(shakeViewport, 30, _arg1);
} else {
global.viewport.x = 0;
global.viewport.y = 0;
};
}
private function fadeoutGlow(_arg1:Event):void{
if (lvlupGlow.alpha > 0){
lvlupGlow.alpha = (lvlupGlow.alpha - 0.02);
} else {
global.main.removeEventListener(Event.ENTER_FRAME, fadeoutGlow);
lvlupGlow.visible = false;
};
}
}
}//package jet
Section 30
//gauge_height (jet.gauge_height)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class gauge_height extends gauge {
public var adder:MovieClip;
public var levelupGlow:MovieClip;
private var NeededPointsForLevelup:int;
public var fill:MovieClip;
public var red:MovieClip;
private var global:Global;
public function gauge_height(){
global = Global.getInstance();
super();
global.Gauge_Height = this;
}
public function setFill(){
NeededPointsForLevelup = scoreMan.getNeededPointsForLevelup(scoreMan.altLvlCurrent);
Adder.scaleY = (scoreMan.altScoreCurrent / NeededPointsForLevelup);
if (scoreMan.altScoreCurrent >= NeededPointsForLevelup){
levelUp();
} else {
setTimeout(fillFill, 300);
};
}
private function levelUp(){
while (scoreMan.altScoreCurrent >= scoreMan.getNeededPointsForLevelup(scoreMan.altLvlCurrent)) {
scoreMan.altScoreCurrent = (scoreMan.altScoreCurrent - scoreMan.getNeededPointsForLevelup(scoreMan.altLvlCurrent));
scoreMan.altLvlCurrent++;
};
initLvlupGlow();
global.archievements.testArchiesHeightlevel(scoreMan.altLvlCurrent);
Adder.scaleY = (Fill.scaleY = (scoreMan.altScoreCurrent / scoreMan.getNeededPointsForLevelup(scoreMan.altLvlCurrent)));
global.disp_alt.text = scoreMan.altLvlCurrent;
global.loadsave.saveProgress();
global.sounds.altLevelup();
global.altmodifyer = 0.01;
checkLevelActions();
}
public function debuglevelup(){
scoreMan.altScoreCurrent = scoreMan.getNeededPointsForLevelup(scoreMan.altLvlCurrent);
levelUp();
}
private function fillFill(){
Fill.scaleY = Adder.scaleY;
}
public function killScore(){
scoreMan.altScoreCurrent = 0;
Red.gotoAndPlay(1);
Red.visible = true;
setFill();
}
}
}//package jet
Section 31
//gauge_speed (jet.gauge_speed)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class gauge_speed extends gauge {
public var adder:MovieClip;
public var levelupGlow:MovieClip;
private var NeededPointsForLevelup:int;
public var fill:MovieClip;
public var red:MovieClip;
private var global:Global;
public function gauge_speed(){
global = Global.getInstance();
super();
global.Gauge_Speed = this;
}
public function setFill(){
NeededPointsForLevelup = scoreMan.getNeededPointsForLevelup(scoreMan.spdLvlCurrent);
Adder.scaleY = (scoreMan.spdScoreCurrent / NeededPointsForLevelup);
if (scoreMan.spdScoreCurrent >= NeededPointsForLevelup){
levelUp();
} else {
setTimeout(fillFill, 300);
};
}
private function levelUp(){
while (scoreMan.spdScoreCurrent >= scoreMan.getNeededPointsForLevelup(scoreMan.spdLvlCurrent)) {
scoreMan.spdScoreCurrent = (scoreMan.spdScoreCurrent - scoreMan.getNeededPointsForLevelup(scoreMan.spdLvlCurrent));
scoreMan.spdLvlCurrent++;
};
initLvlupGlow();
global.archievements.testArchiesSpeedlevel(scoreMan.spdLvlCurrent);
Adder.scaleY = (Fill.scaleY = (scoreMan.spdScoreCurrent / scoreMan.getNeededPointsForLevelup(scoreMan.spdLvlCurrent)));
global.disp_kmh.text = scoreMan.spdLvlCurrent;
global.loadsave.saveProgress();
global.sounds.speedLevelup();
global.pushmodifyer = 3;
checkLevelActions();
}
public function debuglevelup(){
scoreMan.spdScoreCurrent = scoreMan.getNeededPointsForLevelup(scoreMan.spdLvlCurrent);
levelUp();
}
private function fillFill(){
Fill.scaleY = Adder.scaleY;
}
public function killScore(){
scoreMan.spdScoreCurrent = 0;
Red.gotoAndPlay(1);
Red.visible = true;
setFill();
}
}
}//package jet
Section 32
//help (jet.help)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class help extends MovieClip {
private var fadingIn:Boolean;
private var isBusy:Boolean;
private var startframe:int;// = 1
private var endframe:int;// = 1
private var helptime:int;// = 5000
private var global:Global;
private var betweentime:int;// = 1000
public function help(){
global = Global.getInstance();
helptime = 5000;
betweentime = 1000;
startframe = 1;
endframe = 1;
super();
visible = false;
alpha = 0;
gotoAndStop(1);
global.help = this;
}
private function tryNextHint(_arg1:Event=null):void{
if (currentFrame < endframe){
nextFrame();
initfadein();
} else {
isBusy = false;
};
}
private function fadeout(_arg1:Event=null):void{
if (alpha > 0){
alpha = (alpha - 0.04);
} else {
global.main.removeEventListener(Event.ENTER_FRAME, fadeout);
visible = false;
setTimeout(tryNextHint, betweentime);
};
}
private function initfadeout(_arg1:Event=null){
global.main.addEventListener(Event.ENTER_FRAME, fadeout);
}
private function introduceXes(_arg1:Event=null){
showHelp(7, 7);
global.world.showRedorbs();
}
private function fadein(_arg1:Event=null):void{
if (alpha < 1){
alpha = (alpha + 0.04);
} else {
global.main.removeEventListener(Event.ENTER_FRAME, fadein);
setTimeout(initfadeout, helptime);
};
}
private function initfadein(_arg1:Event=null){
alpha = 0;
visible = true;
global.main.addEventListener(Event.ENTER_FRAME, fadein);
}
public function showHelp(_arg1:int, _arg2:int):void{
if (isBusy){
setTimeout(showHelp, 1000, _arg1, _arg2);
return;
};
isBusy = true;
visible = false;
startframe = _arg1;
endframe = _arg2;
gotoAndStop(startframe);
initfadein();
}
public function initBaseHelp():void{
setTimeout(showHelp, 5000, 1, 7);
}
}
}//package jet
Section 33
//keyboard (jet.keyboard)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import lt.uza.utils.*;
public class keyboard extends MovieClip {
public var catchKeys:Boolean;// = true
private var global:Global;
public function keyboard(){
global = Global.getInstance();
catchKeys = true;
super();
initKeyboard();
}
private function handleKeyUp(_arg1){
switch (_arg1.keyCode){
case 13:
break;
case 27:
break;
case 32:
global.menu.menuToggle(_arg1);
break;
case 67:
break;
case 68:
break;
case 70:
enterFullscreen();
break;
case 80:
break;
case 9:
break;
case 72:
break;
case 87:
break;
case 82:
break;
case 84:
break;
case 78:
break;
case 89:
break;
case 90:
break;
case 37:
break;
case 39:
break;
case 17:
break;
case 40:
break;
case 49:
break;
case 50:
break;
case 51:
break;
case 52:
break;
case 53:
break;
case 54:
break;
case 83:
break;
case 55:
break;
};
}
public function initKeyboard(){
global.main.stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
global.main.stage.addEventListener(KeyboardEvent.KEY_UP, handleKeyUp);
}
private function handleKeyDown(_arg1){
switch (_arg1.keyCode){
case 37:
break;
case 39:
if (definitions.allowDebug){
global.Gauge_Speed.debuglevelup();
};
break;
case 38:
if (definitions.allowDebug){
global.Gauge_Height.debuglevelup();
};
break;
case 40:
if (definitions.allowDebug){
scoreMan.scoScoreCurrent = (scoreMan.scoScoreCurrent + 1000000);
};
break;
case 32:
break;
case 67:
break;
case 17:
break;
};
}
function enterFullscreen(){
global.main.stage.fullScreenSourceRect = new Rectangle(0, 0, definitions.scene_renderwidth, definitions.scene_renderheight);
global.main.stage.displayState = StageDisplayState.FULL_SCREEN;
}
}
}//package jet
Section 34
//loadsave (jet.loadsave)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import flash.net.*;
public class loadsave {
private var global:Global;
private var savename:String;
private var SO:SharedObject;
public function loadsave(){
global = Global.getInstance();
savename = definitions.saveName;
super();
global.loadsave = this;
SO = SharedObject.getLocal(savename);
loadProgress();
}
public function setDisplay(){
if (SO.size == 0){
return;
};
if (scoreMan.scoScoreCurrent > 0){
global.menu.enableContinue();
};
global.disp_kmh.text = SO.data.speedlvl.toString();
global.disp_score.text = SO.data.score.toString();
global.disp_alt.text = SO.data.altlvl.toString();
global.Gauge_Speed.setFill();
global.Gauge_Height.setFill();
}
public function saveProgress(){
SO.data.score = scoreMan.scoScoreCurrent;
SO.data.speedlvl = scoreMan.spdLvlCurrent;
SO.data.altlvl = scoreMan.altLvlCurrent;
SO.data.altscore = scoreMan.altScoreCurrent;
SO.data.speedscore = scoreMan.spdScoreCurrent;
SO.data.dictarchievements = global.dictArchchievements;
SO.flush();
setValuesFromLevels();
}
public function resetProgress(){
SO.data.score = (scoreMan.scoScoreCurrent = 0);
SO.data.speedlvl = (scoreMan.spdLvlCurrent = 1);
SO.data.altlvl = (scoreMan.altLvlCurrent = 1);
SO.data.altscore = (scoreMan.altScoreCurrent = 0);
SO.data.speedscore = (scoreMan.spdScoreCurrent = 0);
SO.data.dictarchievements = (global.dictArchchievements = new Dictionary());
SO.flush();
setDisplay();
global.archievements.resetarchievements();
setValuesFromLevels();
}
public function loadProgress(){
var _local1:Dictionary;
if (SO.size != 0){
scoreMan.scoScoreCurrent = SO.data.score;
scoreMan.spdLvlCurrent = SO.data.speedlvl;
scoreMan.altLvlCurrent = SO.data.altlvl;
scoreMan.spdScoreCurrent = SO.data.speedscore;
scoreMan.altScoreCurrent = SO.data.altscore;
if (SO.data.dictarchievements){
global.dictArchchievements = SO.data.dictarchievements;
} else {
_local1 = new Dictionary();
global.dictArchchievements = _local1;
};
};
}
private function setValuesFromLevels():void{
definitions.curr_maxFlightheight = (definitions.start_maxFlightheight + ((scoreMan.altLvlCurrent - 1) * 200));
definitions.curr_flightspeedMultiplyer = (definitions.start_flightspeedMultiplyer + ((scoreMan.spdLvlCurrent - 1) * 0.1));
definitions.curr_camMaxRoll = (definitions.start_camMaxRoll + ((scoreMan.spdLvlCurrent - 1) * 20));
definitions.curr_camRollspeed = (definitions.start_camRollspeed + ((scoreMan.spdLvlCurrent - 1) * 0.0001));
definitions.curr_camHeightspeed = (definitions.start_camHeightspeed + ((scoreMan.altLvlCurrent - 1) * 0.001));
definitions.numOrbs_score_curr = (definitions.numOrbs_score + ((scoreMan.altLvlCurrent - 1) * 3));
definitions.numOrbs_speed_curr = (definitions.numOrbs_speed + ((scoreMan.altLvlCurrent - 1) * 3));
definitions.numOrbs_height_curr = (definitions.numOrbs_height + ((scoreMan.altLvlCurrent - 1) * 3));
definitions.numOrbs_multi_curr = (definitions.numOrbs_multi + ((scoreMan.altLvlCurrent - 1) * 0.5));
definitions.numOrbs_red_curr = (definitions.numOrbs_red + ((scoreMan.altLvlCurrent - 1) * 0.7));
definitions.numOrbs_minus_curr = (definitions.numOrbs_minus + ((scoreMan.altLvlCurrent - 1) * 0.7));
definitions.numOrbs_plus_curr = (definitions.numOrbs_plus + ((scoreMan.altLvlCurrent - 1) * 0.7));
}
}
}//package jet
Section 35
//LODBillBoard (jet.LODBillBoard)
package jet {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import lt.uza.utils.*;
public class LODBillBoard extends BillBoard {
public var minViewdist:Number;// = 1500
public var maxViewdist:Number;// = 4000
private var blendDist:Number;// = 1000
private var distToCam:Number;
private var global:Global;
public function LODBillBoard(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
maxViewdist = 4000;
minViewdist = 1500;
blendDist = 1000;
global = Global.getInstance();
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.useOwnContainer = true;
this.alpha = 1;
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
distToCam = distanceTo(_arg2.camera);
if ((((distToCam > maxViewdist)) || ((distToCam < minViewdist)))){
return (0);
};
if (distToCam > (maxViewdist - blendDist)){
this.alpha = ((maxViewdist - distToCam) / blendDist);
} else {
if (distToCam < (minViewdist + blendDist)){
this.alpha = ((distToCam - minViewdist) / blendDist);
};
};
return (super.project(_arg1, _arg2));
}
}
}//package jet
Section 36
//MathUtils (jet.MathUtils)
package jet {
import org.papervision3d.core.math.*;
import org.papervision3d.objects.*;
public final class MathUtils {
public static function distanceToSquaredNumber3D(_arg1:Number3D, _arg2:Number3D):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
_local5 = (_arg1.z - _arg2.z);
return ((((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5)));
}
public static function randomNumber(_arg1:Number, _arg2:Number):Number{
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public static function number3DMultiply(_arg1:Number3D, _arg2:Number):Number3D{
var _local3:Number3D;
_local3 = new Number3D(_arg1.x, _arg1.y, _arg1.z);
_local3.multiplyEq(_arg2);
return (_local3);
}
public static function copyAndTranspose(_arg1:Matrix3D, _arg2:Matrix3D, _arg3:Boolean=false):void{
_arg2.n11 = _arg1.n11;
_arg2.n12 = _arg1.n21;
_arg2.n13 = _arg1.n31;
_arg2.n21 = _arg1.n12;
_arg2.n22 = _arg1.n22;
_arg2.n23 = _arg1.n32;
_arg2.n31 = _arg1.n13;
_arg2.n32 = _arg1.n23;
_arg2.n33 = _arg1.n33;
_arg2.n41 = _arg1.n14;
_arg2.n42 = _arg1.n24;
_arg2.n43 = _arg1.n34;
if (!_arg3){
_arg2.n14 = _arg1.n41;
_arg2.n24 = _arg1.n42;
_arg2.n34 = _arg1.n43;
_arg2.n44 = _arg1.n44;
};
}
public static function distanceToMatrix3D(_arg1:Matrix3D, _arg2:Matrix3D):Number{
return (distanceToNumber3D(matrix3DPosition(_arg1), matrix3DPosition(_arg2)));
}
public static function distanceToNumber3D(_arg1:Number3D, _arg2:Number3D):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
_local5 = (_arg1.z - _arg2.z);
return (Math.sqrt((((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5))));
}
public static function matrix3DPosition(_arg1:Matrix3D):Number3D{
return (new Number3D(_arg1.n14, _arg1.n24, _arg1.n34));
}
public static function randomInt(_arg1:int, _arg2:int):int{
return (int(Math.round(((Math.random() * (_arg2 - _arg1)) + _arg1))));
}
public static function setPosition(_arg1:Number3D, _arg2:DisplayObject3D):void{
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
_arg2.z = _arg1.z;
}
public static function translate(_arg1:Matrix3D, _arg2:Number, _arg3:Number3D):Number3D{
var _local4:Number3D;
_local4 = _arg3.clone();
Matrix3D.rotateAxis(_arg1, _local4);
return (new Number3D((_arg1.n14 + (_arg2 * _local4.x)), (_arg1.n24 + (_arg2 * _local4.y)), (_arg1.n34 + (_arg2 * _local4.z))));
}
public static function getPosition(_arg1:DisplayObject3D):Number3D{
return (new Number3D(_arg1.x, _arg1.y, _arg1.z));
}
}
}//package jet
Section 37
//menu (jet.menu)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import flash.filters.*;
import flash.net.*;
import gamework.net.*;
public class menu extends MovieClip {
private var butt_okcredits:Sprite;
public var music:volumeControl;
private var finishY:Number;// = -120
private var butt_cancel:Sprite;
public var butt_Credits:MovieClip;
private var bigwig_viewScores_btn:Sprite;
private var butt_credits:Sprite;
private var bigwig_submitScore_btn:Sprite;
private var blendspeed:int;// = 30
private var credits:Sprite;
public var Archies:archievements;
public var Credits:menu_credits;
private var continueEnabled:Boolean;
private var Confirm:Sprite;
private var JomeilinkOrb:Sprite;
public var sitelockBanner:MovieClip;
public var jolink:MovieClip;
private var archies:Sprite;
public var confirm:MovieClip;
public var fx:volumeControl;
public var quality:qualityControl;
private var butt_arch:Sprite;
public var butt_High_submit:MovieClip;
public var butt_Arch:MovieClip;
private var blendoutFinishFunc:Function;
private var butt_continue:Sprite;
public var butt_New:MovieClip;
public var butt_Continue:MovieClip;
private var jomeilinkbutt:Sprite;
private var butt_new:Sprite;
private var baseY:Number;
private var global:Global;
public var butt_Space:MovieClip;
private var butt_okay:Sprite;
public var logo_btn:SimpleButton;
private var blendinFinishFunc:Function;
public var butt_High_view:MovieClip;
private var butt_space:Sprite;
private var butt_okarch:Sprite;
private var fltHighlight:GlowFilter;
private var bigwig_logo_btn;
public function menu(){
global = Global.getInstance();
finishY = -120;
blendspeed = 30;
fltHighlight = new GlowFilter(0xFF00, 1, 45, 5, 2, 1, false, false);
super();
global.menu = this;
baseY = this.y;
init();
}
function onViewScoresBtnClick(_arg1:MouseEvent):void{
global.sounds.buttonUp();
URLCaller.viewScores();
}
private function lowLight(_arg1):void{
_arg1.target.filters = [];
}
private function goJomei(_arg1):void{
global.sounds.buttonUp();
navigateToURL(new URLRequest("http://www.jo-mei.com"), "_blank");
}
private function highLight(_arg1):void{
_arg1.target.filters = [fltHighlight];
}
function onLogoBtnClick(_arg1:MouseEvent):void{
global.sounds.buttonUp();
URLCaller.mainLink();
}
private function showCredits(_arg1):void{
credits.visible = true;
global.sounds.buttonUp();
}
private function startNewGame(_arg1):void{
global.sounds.buttonUp();
global.isNewGame = true;
global.loadsave.resetProgress();
global.main.launchNewFlight();
Confirm.visible = false;
}
private function showArchies(_arg1):void{
archies.visible = true;
global.sounds.buttonUp();
global.sounds.archieve();
}
private function init():void{
global.isNewGame = false;
credits = (getChildByName("Credits") as Sprite);
butt_okcredits = (credits.getChildByName("OKcredits") as Sprite);
bigwig_submitScore_btn = (getChildByName("butt_High_submit") as Sprite);
bigwig_viewScores_btn = (getChildByName("butt_High_view") as Sprite);
bigwig_logo_btn = getChildByName("logo_btn");
bigwig_submitScore_btn.buttonMode = true;
bigwig_viewScores_btn.buttonMode = true;
bigwig_submitScore_btn.addEventListener(MouseEvent.MOUSE_OVER, highLight);
bigwig_submitScore_btn.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
bigwig_viewScores_btn.addEventListener(MouseEvent.MOUSE_OVER, highLight);
bigwig_viewScores_btn.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
bigwig_submitScore_btn.addEventListener(MouseEvent.CLICK, onSubmitScoreBtnClick);
bigwig_viewScores_btn.addEventListener(MouseEvent.CLICK, onViewScoresBtnClick);
bigwig_logo_btn.addEventListener(MouseEvent.CLICK, onLogoBtnClick);
archies = (getChildByName("Archies") as Sprite);
butt_okarch = (archies.getChildByName("OKarchie") as Sprite);
credits.visible = false;
archies.visible = false;
butt_continue = (getChildByName("butt_Continue") as Sprite);
butt_space = (getChildByName("butt_Space") as Sprite);
butt_new = (getChildByName("butt_New") as Sprite);
butt_credits = (getChildByName("butt_Credits") as Sprite);
butt_arch = (getChildByName("butt_Arch") as Sprite);
securityCheck();
butt_arch.buttonMode = true;
butt_arch.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_arch.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_arch.addEventListener(MouseEvent.MOUSE_UP, showArchies);
butt_okarch.buttonMode = true;
butt_okarch.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_okarch.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_okarch.addEventListener(MouseEvent.MOUSE_UP, hideArchies);
butt_okcredits.buttonMode = true;
butt_okcredits.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_okcredits.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_okcredits.addEventListener(MouseEvent.MOUSE_UP, hideCredits);
butt_credits.buttonMode = true;
butt_credits.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_credits.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_credits.addEventListener(MouseEvent.MOUSE_UP, showCredits);
butt_space.buttonMode = true;
butt_space.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_space.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_space.addEventListener(MouseEvent.MOUSE_UP, menuToggle);
butt_new.buttonMode = true;
butt_new.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_new.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_new.addEventListener(MouseEvent.MOUSE_UP, checkNew);
butt_continue.alpha = 0.3;
Confirm = (getChildByName("confirm") as Sprite);
Confirm.visible = false;
butt_okay = (Confirm.getChildByName("OK") as Sprite);
butt_okay.buttonMode = true;
butt_okay.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_okay.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_okay.addEventListener(MouseEvent.MOUSE_UP, startNewGame);
butt_cancel = (Confirm.getChildByName("CANCEL") as Sprite);
butt_cancel.buttonMode = true;
butt_cancel.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_cancel.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_cancel.addEventListener(MouseEvent.MOUSE_UP, hideConfirm);
}
private function showConfirm(_arg1):void{
Confirm.visible = true;
global.sounds.buttonUp();
}
private function hideConfirm(_arg1):void{
Confirm.visible = false;
global.sounds.buttonUp();
}
private function hideCredits(_arg1):void{
credits.visible = false;
global.sounds.buttonUp();
}
private function hideArchies(_arg1):void{
archies.visible = false;
global.sounds.buttonUp();
}
private function blendinStep(_arg1:Event):void{
if (this.y < baseY){
this.y = (this.y + (((baseY - this.y) * 0.2) + 1));
} else {
this.y = baseY;
global.main.removeEventListener(Event.ENTER_FRAME, blendinStep);
if (blendinFinishFunc != null){
blendinFinishFunc();
};
enableContinue();
};
}
public function blendin(_arg1:Function=null):void{
blendinFinishFunc = _arg1;
this.y = finishY;
global.main.addEventListener(Event.ENTER_FRAME, blendinStep);
}
private function continueGame(_arg1):void{
global.sounds.buttonUp();
if (global.crosshair_1){
global.crosshair_1.visible = true;
};
if (global.scenefrozen){
global.screenblur.unblurScreen();
} else {
global.main.launchNewFlight();
};
}
public function blendout(_arg1:Function=null):void{
blendoutFinishFunc = _arg1;
this.y = baseY;
global.main.addEventListener(Event.ENTER_FRAME, blendoutStep);
}
public function enableContinue():void{
if (!continueEnabled){
butt_continue.alpha = 1;
butt_continue.buttonMode = true;
butt_continue.addEventListener(MouseEvent.MOUSE_OVER, highLight);
butt_continue.addEventListener(MouseEvent.MOUSE_OUT, lowLight);
butt_continue.addEventListener(MouseEvent.MOUSE_UP, continueGame);
continueEnabled = true;
};
}
private function checkNew(_arg1):void{
global.sounds.buttonUp();
if (continueEnabled){
Confirm.visible = true;
} else {
startNewGame(null);
};
}
public function menuToggle(_arg1):void{
global.sounds.buttonUp();
hideConfirm(_arg1);
hideCredits(_arg1);
hideArchies(_arg1);
if (!global.screenblur){
return;
};
global.loadsave.saveProgress();
if (global.scenefrozen){
global.screenblur.unblurScreen();
global.crosshair_1.visible = true;
} else {
global.screenblur.blurScreen();
global.crosshair_1.visible = false;
};
}
function onSubmitScoreBtnClick(_arg1:MouseEvent):void{
global.sounds.buttonUp();
URLCaller.submitScore(scoreMan.scoScoreCurrent);
}
private function securityCheck():void{
var _local1:String;
var _local2:String;
getChildByName("sitelockBanner").visible = false;
if (definitions.SITELOCKED){
_local1 = definitions.sitelockURL;
_local2 = global.URL.split("/")[2];
if (_local2.indexOf(_local1) == (_local2.length - _local1.length)){
} else {
getChildByName("sitelockBanner").visible = true;
butt_continue.visible = false;
butt_new.visible = false;
};
};
}
private function blendoutStep(_arg1:Event):void{
if (this.y > finishY){
this.y = (this.y + (((finishY - this.y) * 0.3) - 1));
} else {
global.main.removeEventListener(Event.ENTER_FRAME, blendoutStep);
if (blendoutFinishFunc != null){
blendoutFinishFunc();
};
};
}
}
}//package jet
Section 38
//mouse (jet.mouse)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import lt.uza.utils.*;
public class mouse extends MovieClip {
private var Debug:debug;
public var oldMouseY:int;// = 0
var targetspeed:Number;
public var oldMouseX:int;// = 0
public var screenY:int;// = 0
public var screenX:int;// = 0
private var scene_halfwidth:int;
private var scene_halfheight:int;
private var global:Global;
var isdoubleclick:Boolean;// = false
public function mouse(){
global = Global.getInstance();
oldMouseX = 0;
oldMouseY = 0;
screenX = 0;
screenY = 0;
scene_halfwidth = (definitions.scene_renderwidth / 2);
scene_halfheight = (definitions.scene_renderheight / 2);
isdoubleclick = false;
super();
initMouse();
}
public function handleMouseUp(_arg1){
if (!global.scenefrozen){
global.game.hideMouse();
};
}
public function handleMousewheel(_arg1){
if (!definitions.allowDebug){
return;
};
targetspeed = (definitions.flightspeedMultiplyer - (_arg1.delta / 30));
definitions.flightspeedMultiplyer = targetspeed;
}
public function initMouse(){
var _local1:Point;
var _local2:Point;
Debug = debug.getInstance();
_local1 = new Point(0, 0);
_local2 = new Point(0, 0);
global.mouseCoords = _local1;
global.rotMousecoords = _local2;
global.main.stage.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
global.main.stage.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp, true);
global.main.stage.addEventListener(MouseEvent.MOUSE_WHEEL, handleMousewheel);
global.main.stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMousemove);
}
public function handleMouseDown(_arg1){
var _local2:Object;
for (_local2 in global.orbdict) {
_local2.startSuckIn();
};
}
public function handleMousemove(_arg1){
global.mouseCoords.x = (_arg1.stageX - scene_halfwidth);
global.mouseCoords.y = (_arg1.stageY - scene_halfheight);
}
private function setTargetspeed():void{
definitions.flightspeedMultiplyer = targetspeed;
}
function cleardoubleclick(){
isdoubleclick = false;
}
}
}//package jet
Section 39
//orb (jet.orb)
package jet {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import lt.uza.utils.*;
import flash.filters.*;
public class orb extends BillBoard {
private var inSuckprogress:Boolean;
private var minViewdist:Number;// = 500
private var screenHalfwidth:Number;
private var screenHalfheight:Number;
private var orbCatchradius:Number;
private var suckstepsLeft:int;
private var isHighlighted:Boolean;
private var suckstepDist:Number;
private var maxViewdist:Number;// = 6000
private var distToCam:Number;
private var blendDist:Number;// = 1000
private var global:Global;
private var fltHighlight:GlowFilter;
public function orb(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
global = Global.getInstance();
maxViewdist = 6000;
minViewdist = 500;
blendDist = 1000;
orbCatchradius = definitions.orbCatchradius;
screenHalfwidth = (definitions.scene_renderwidth / 2);
screenHalfheight = (definitions.scene_renderheight / 2);
fltHighlight = new GlowFilter(0xFFFFFF, 1, 5, 5, 5, 1, false, false);
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.useOwnContainer = true;
this.alpha = 1;
this.autoCalcScreenCoords = true;
global.orbCatchradius = orbCatchradius;
}
public function startSuckIn():void{
if (inSuckprogress){
return;
};
this.filters = [];
inSuckprogress = true;
suckstepsLeft = ((distToCam / 500) * global.FPSMOD);
suckstepDist = (distToCam / suckstepsLeft);
this.alpha = 1;
global.sounds.catchOrb(name.slice(0, 3), screen);
}
private function testHighlight():void{
var _local1:Number;
var _local2:Number;
if (screen.z < 1){
return;
};
_local1 = Math.abs((screen.x - (global.crosshair_1.x - screenHalfwidth)));
_local2 = Math.abs((screen.y - (global.crosshair_1.y - screenHalfheight)));
if (!isHighlighted){
this.filters = [fltHighlight];
isHighlighted = true;
this.alpha = 1;
};
if ((((_local1 < (orbCatchradius * global.crosshairScale))) && ((_local2 < (orbCatchradius * global.crosshairScale))))){
global.orbdict[this] = true;
};
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
distToCam = distanceTo(_arg2.camera);
if (inSuckprogress){
stepSuckIn(_arg1, _arg2);
} else {
if ((((distToCam > definitions.curr_orbviewDist)) || ((distToCam < minViewdist)))){
return (0);
};
if (((!(isHighlighted)) && ((distToCam > (definitions.curr_orbviewDist - blendDist))))){
this.alpha = ((definitions.curr_orbviewDist - distToCam) / blendDist);
} else {
testHighlight();
};
};
return (super.project(_arg1, _arg2));
}
public function stepSuckIn(_arg1:DisplayObject3D, _arg2:RenderSessionData):void{
var _local3:Number;
_local3 = distanceTo(global.suckCenter);
if (suckstepsLeft < 1){
endSuckIn();
} else {
suckstepsLeft--;
lookAt(global.suckCenter);
moveForward((_local3 / 3));
};
}
public function endSuckIn():void{
inSuckprogress = false;
global.world.setOppositeposition(this);
delete global.orbdict[this];
global.tetris.addOrb(name);
isHighlighted = false;
}
}
}//package jet
Section 40
//qualityControl (jet.qualityControl)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import flash.filters.*;
import flash.text.*;
public class qualityControl extends MovieClip {
var quali:int;// = 36
private var qualtex:TextField;
public var volbar:MovieClip;
private var VolBar:Sprite;
private var global:Global;
public var qualitytex:TextField;
private var mouseIsDown:Boolean;
public function qualityControl(){
global = Global.getInstance();
quali = 36;
super();
init();
}
private function init():void{
qualtex = (getChildByName("qualitytex") as TextField);
VolBar = (getChildByName("volbar") as Sprite);
this.buttonMode = true;
addEventListener(MouseEvent.MOUSE_DOWN, setQuality);
setMediumquality();
}
private function setFastestquality():void{
VolBar.x = quali;
global.renderquality = 1;
global.main.stage.quality = StageQuality.LOW;
if (global.clouds){
global.clouds.visible = false;
};
qualtex.text = "Fastest";
}
private function setQuality(_arg1):void{
quali = (Math.round(((mouseX - 5) / 18)) * 18);
quali = Math.min(Math.max(0, quali), 54);
if (quali == 54){
setHighquality();
};
if (quali == 36){
setMediumquality();
};
if (quali == 18){
setFastquality();
};
if (quali == 0){
setFastestquality();
};
}
private function setHighquality():void{
VolBar.x = quali;
global.renderquality = 4;
global.main.stage.quality = StageQuality.HIGH;
if (global.clouds){
global.clouds.visible = true;
};
qualtex.text = "Best";
}
private function setFastquality():void{
VolBar.x = quali;
global.renderquality = 2;
global.main.stage.quality = StageQuality.LOW;
if (global.clouds){
global.clouds.visible = true;
};
qualtex.text = "Fast";
}
private function setMediumquality():void{
VolBar.x = quali;
global.renderquality = 3;
global.main.stage.quality = StageQuality.MEDIUM;
if (global.clouds){
global.clouds.visible = true;
};
qualtex.text = "Balanced";
}
}
}//package jet
Section 41
//scorefeedback (jet.scorefeedback)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class scorefeedback extends MovieClip {
private var NeededPointsForLevelup:int;
private var global:Global;
public function scorefeedback(_arg1:int=0){
global = Global.getInstance();
super();
global.scorefeedback = this;
this.alpha = 1;
this.blendMode = "add";
this.x = 350;
this.y = 470;
if (_arg1 == 10){
x = 500;
y = 538;
};
gotoAndStop(_arg1);
global.main.addChild(this);
blendout();
}
private function blendout(){
if (alpha > 0){
alpha = (alpha - 0.03);
y = (y - 2);
scaleX = (scaleY = (scaleY + 0.01));
setTimeout(blendout, 33);
} else {
global.main.removeAndKill(this);
};
}
}
}//package jet
Section 42
//scoreMan (jet.scoreMan)
package jet {
public class scoreMan {
public static var scoScoreCurrent:int = 0;
public static var altLvlCurrent:int = 1;
public static var spdScoreCurrent:int = 0;
public static var altScoreCurrent:int = 0;
public static var spdScoreTotal:int = 0;
public static var altScoreTotal:int = 0;
public static var spdLvlCurrent:int = 1;
public static function getNeededPointsForLevelup(_arg1:int):int{
return ((_arg1 * 5000));
}
public static function checkScoreActions(){
}
}
}//package jet
Section 43
//screenBlur (jet.screenBlur)
package jet {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import lt.uza.utils.*;
import flash.filters.*;
public class screenBlur extends MovieClip {
private var blurredbitmap:Bitmap;
private var myBlurF:BlurFilter;
private var global:Global;
private var mystage:Stage;
private static var allowInstantiation:Boolean;
private static var instance:screenBlur;
private static var gotBitmap:Boolean;
public function screenBlur(){
global = Global.getInstance();
myBlurF = new BlurFilter(1, 20, 3);
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use screenBlur.getInstance() instead of new."));
};
mystage = global.main.stage;
}
public function dounblurScreen():void{
mystage.removeChild(blurredbitmap);
blurredbitmap.bitmapData.dispose();
global.scenefrozen = false;
global.game.hideMouse();
global.gotBitmap = false;
definitions.currentmultiplyerDecay = definitions.multiplyerDecay;
}
public function unblurScreen():void{
global.menu.blendout(dounblurScreen);
}
public function blurScreen():void{
var _local1:BitmapData;
var _local2:Matrix;
var _local3:ColorTransform;
var _local4:Rectangle;
definitions.currentmultiplyerDecay = 0;
global.scenefrozen = true;
_local1 = new BitmapData(definitions.scene_renderwidth, definitions.scene_renderheight, false, 0);
blurredbitmap = new Bitmap(_local1);
_local2 = new Matrix();
_local2.translate((definitions.scene_renderwidth * 0.5), (definitions.scene_renderheight * 0.5));
_local1.draw(global.viewport.containerSprite, _local2, null, null, _local1.rect, false);
_local1.applyFilter(_local1, new Rectangle(0, 0, definitions.scene_renderwidth, definitions.scene_renderheight), new Point(0, 0), myBlurF);
_local3 = new ColorTransform();
_local3.redMultiplier = 0.4;
_local3.blueMultiplier = 0.5;
_local3.greenMultiplier = 0.4;
_local4 = new Rectangle(0, 0, definitions.scene_renderwidth, definitions.scene_renderheight);
_local1.colorTransform(_local4, _local3);
mystage.addChildAt(blurredbitmap, 1);
global.gotBitmap = true;
global.menu.blendin();
global.game.showMouse();
}
public static function getInstance():screenBlur{
if (instance == null){
allowInstantiation = true;
instance = new (screenBlur);
allowInstantiation = false;
};
return (instance);
}
}
}//package jet
Section 44
//sounds (jet.sounds)
package jet {
import flash.display.*;
import org.papervision3d.core.math.*;
import flash.media.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
public class sounds {
private var FXVolume:Number;// = 1
private var titleMusicChannel:SoundChannel;
private var sndSpeedUp:snd_spdlevelup;
private var musicVolume:Number;// = 1
private var global:Global;
private var titleMusic:sound_nostromo;
private var sndCatchA:sound_catchA;
private var gameMusicChannel:SoundChannel;
private var sndPlusminus:snd_plusminus;
private var sndRedcdross:snd_redcross;
private var sndCatchC:sound_catchC;
private var sndCatchE:sound_catchE;
private var sndAltUp:snd_altlevelup;
private var sndCash:snd_cash;
private var sndCatchTransform:SoundTransform;
private var sndMulti:snd_multi;
private var sndCatchChannel:SoundChannel;
private var gameMusic:sound_drone;
var currSndindex:int;// = 0
private var levelupChannel:SoundChannel;
private var sndButton:snd_buttonblip;
private var sndMultiout:snd_multiout;
public function sounds(){
global = Global.getInstance();
sndCatchChannel = new SoundChannel();
levelupChannel = new SoundChannel();
gameMusicChannel = new SoundChannel();
FXVolume = 1;
musicVolume = 1;
currSndindex = 0;
super();
init();
}
public function init(){
sndCatchA = new sound_catchA();
sndCatchC = new sound_catchC();
sndCatchE = new sound_catchE();
sndSpeedUp = new snd_spdlevelup();
sndAltUp = new snd_altlevelup();
sndButton = new snd_buttonblip();
sndMulti = new snd_multi();
sndMultiout = new snd_multiout();
sndPlusminus = new snd_plusminus();
sndRedcdross = new snd_redcross();
sndCash = new snd_cash();
sndCatchTransform = sndCatchChannel.soundTransform;
}
private function fadeTo(_arg1:SoundChannel, _arg2, _arg3:Function=null):void{
var _local4:SoundTransform;
_local4 = _arg1.soundTransform;
if (_local4.volume > _arg2){
_local4.volume = (_local4.volume - 0.05);
} else {
_local4.volume = (_local4.volume + 0.05);
};
_arg1.soundTransform = _local4;
if (Math.abs((_local4.volume - _arg2)) > 0.1){
setTimeout(fadeTo, 100, _arg1, _arg2, _arg3);
} else {
_local4.volume = _arg2;
if (_arg3 != null){
_arg3();
};
_arg1.soundTransform = _local4;
};
}
private function setVolume(_arg1:Number):void{
sndCatchTransform = sndCatchChannel.soundTransform;
sndCatchTransform.volume = _arg1;
sndCatchChannel.soundTransform = sndCatchTransform;
}
public function archieve():void{
var _local1:SoundTransform;
levelupChannel = sndCash.play();
_local1 = levelupChannel.soundTransform;
_local1.volume = FXVolume;
levelupChannel.soundTransform = _local1;
}
public function catchOrb(_arg1:String, _arg2:Number3D){
switch (_arg1){
case "spd":
sndCatchChannel = sndCatchA.play();
break;
case "alt":
sndCatchChannel = sndCatchC.play();
break;
case "sco":
sndCatchChannel = sndCatchE.play();
break;
case "mul":
sndCatchChannel = sndMulti.play();
break;
case "red":
sndCatchChannel = sndRedcdross.play();
break;
case "crb":
sndCatchChannel = sndPlusminus.play();
break;
case "crs":
sndCatchChannel = sndPlusminus.play();
break;
};
sndCatchTransform = sndCatchChannel.soundTransform;
sndCatchTransform.pan = (_arg2.x / 350);
sndCatchTransform.volume = FXVolume;
sndCatchChannel.soundTransform = sndCatchTransform;
}
public function dotitlesounds(){
var _local1:SoundTransform;
titleMusic = new sound_nostromo();
titleMusicChannel = titleMusic.play(0, 999999);
_local1 = titleMusicChannel.soundTransform;
_local1.volume = 0;
titleMusicChannel.soundTransform = _local1;
fadeTo(titleMusicChannel, 1);
}
public function altLevelup():void{
var _local1:SoundTransform;
levelupChannel = sndAltUp.play();
_local1 = levelupChannel.soundTransform;
_local1.volume = FXVolume;
levelupChannel.soundTransform = _local1;
}
public function multiUp():void{
var _local1:SoundTransform;
levelupChannel = sndMulti.play();
_local1 = levelupChannel.soundTransform;
_local1.volume = FXVolume;
levelupChannel.soundTransform = _local1;
}
public function destroyMusic(){
fadeTo(gameMusicChannel, 0);
}
public function multiOut():void{
var _local1:SoundTransform;
levelupChannel = sndMultiout.play();
_local1 = levelupChannel.soundTransform;
_local1.volume = FXVolume;
levelupChannel.soundTransform = _local1;
}
public function speedLevelup():void{
var _local1:SoundTransform;
levelupChannel = sndSpeedUp.play();
_local1 = levelupChannel.soundTransform;
_local1.volume = FXVolume;
levelupChannel.soundTransform = _local1;
}
public function setMusicVolume(_arg1:Number){
var _local2:SoundTransform;
_local2 = gameMusicChannel.soundTransform;
_local2.volume = _arg1;
fadeTo(gameMusicChannel, _arg1);
musicVolume = _arg1;
}
public function startMusic(){
var _local1:SoundTransform;
fadeTo(titleMusicChannel, 0);
gameMusic = new sound_drone();
gameMusicChannel = gameMusic.play(0, 999999);
_local1 = gameMusicChannel.soundTransform;
_local1.volume = 0;
gameMusicChannel.soundTransform = _local1;
fadeTo(gameMusicChannel, musicVolume);
}
public function buttonUp():void{
var _local1:SoundTransform;
levelupChannel = sndButton.play();
_local1 = levelupChannel.soundTransform;
_local1.volume = (FXVolume * 0.3);
levelupChannel.soundTransform = _local1;
}
public function setFXVolume(_arg1:Number){
FXVolume = _arg1;
if (!global.isIngame){
fadeTo(titleMusicChannel, FXVolume);
};
}
}
}//package jet
Section 45
//tetris (jet.tetris)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import flash.text.*;
public class tetris extends MovieClip {
private var slot0:DisplayObject;
private var centerscoretext:TextField;
private var slot4:DisplayObject;
private var slot9:DisplayObject;
private var aSwitchoffSlots:Array;
private var waitingScore:Number;// = 0
private var lastOrbcount:int;
private var centerupdateWaitframes:int;// = 0
private var multiplyerCurrent:Number;// = 1
private var multi_text:TextField;
public var T_slots:MovieClip;
private var feedbackQueue:Array;
private var Aslots:Array;
private var multi_gauge:MovieClip;
var flasher:MovieClip;
private var bScoreNextTick:Boolean;
private var addCurrTick:int;// = 0
private var t_slots:MovieClip;
private var rotSpeed:int;// = 3
private var currAddslotNum:int;// = 0
private var multi_orb:MovieClip;
private var scoreType:String;
public var multiOrb:MovieClip;
private var scoreOrb:MovieClip;
private var numScoreslots:int;// = 0
private var scoreStartSlot:int;// = 0
private var scoreScore:Number;// = 0
private var lastscoreType:String;
private var rotAngle:Number;// = 0
public var centerScore:MovieClip;
private var rotStep:int;// = 0
private var scorepipe:MovieClip;
private var scoreTick:int;// = 10
private var centerscore:MovieClip;
private var multi_flash:MovieClip;
public var scorePipe:MovieClip;
private var slotorbQueue:Array;
private var killingRow:int;// = 0
private var orbQueue:Array;
private var currAddslot:DisplayObject;
private var scoreQueue:Array;
private var scoreCurrTick:int;// = 0
private var global:Global;
private var iOrbsInSlots:int;// = 0
private var addTick:int;// = 0
private var slot1:DisplayObject;
private var slot2:DisplayObject;
private var slot3:DisplayObject;
private var slot5:DisplayObject;
private var slot6:DisplayObject;
private var slot7:DisplayObject;
private var slot8:DisplayObject;
public function tetris(){
global = Global.getInstance();
multiplyerCurrent = 1;
currAddslotNum = 0;
addTick = 0;
addCurrTick = 0;
scoreTick = 10;
scoreCurrTick = 0;
scoreStartSlot = 0;
rotAngle = 0;
rotStep = 0;
rotSpeed = 3;
numScoreslots = 0;
iOrbsInSlots = 0;
waitingScore = 0;
scoreScore = 0;
centerupdateWaitframes = 0;
killingRow = 0;
super();
global.tetris = this;
initTetris();
}
private function multiDecay(_arg1:Event):void{
if (multi_gauge.y < 0){
multi_gauge.y = (multi_gauge.y + definitions.currentmultiplyerDecay);
} else {
killmultiplyer();
};
}
public function slotaddOrb():void{
var _local1:String;
if (iOrbsInSlots > 8){
return;
};
_local1 = orbQueue.shift();
if (_local1 == "mul"){
addScoreMultiplyer();
return;
};
if (_local1 == "red"){
killCurrentscore();
killmultiplyer();
killTetris();
return;
};
if (_local1 == "crs"){
global.crosshair.makeSmall();
return;
};
if (_local1 == "crb"){
global.crosshair.makeBig();
return;
};
if (_local1 == "cha"){
global.crosshair.makeChaos();
return;
};
iOrbsInSlots++;
Aslots[(currAddslotNum % 10)].gotoAndStop(_local1);
slotorbQueue.push(_local1);
currAddslotNum++;
checkScore();
killingRow = 0;
}
public function frameAction():void{
if (rotAngle > 0){
t_slots.rotation = (t_slots.rotation - rotSpeed);
rotAngle = (rotAngle - rotSpeed);
rotStep++;
if (rotStep == (36 / rotSpeed)){
aSwitchoffSlots.shift().gotoAndStop(1);
iOrbsInSlots--;
rotStep = 0;
if (rotAngle == 0){
checkScore();
};
};
};
if ((rotAngle % 36) == 0){
rotSpeed = 6;
if (iOrbsInSlots > 4){
rotSpeed = 9;
};
if (iOrbsInSlots > 5){
rotSpeed = 12;
};
if (iOrbsInSlots > 6){
rotSpeed = 18;
};
if (iOrbsInSlots > 7){
rotSpeed = 36;
};
};
if (addCurrTick == addTick){
addCurrTick = 0;
doScore();
if (bScoreNextTick){
score(numScoreslots, slotorbQueue[0]);
};
if (orbQueue.length > 0){
slotaddOrb();
};
return;
};
addCurrTick++;
}
private function adjustCenterScore():void{
scoreType = slotorbQueue[0];
scoreOrb.gotoAndStop(scoreType);
scorepipe.gotoAndStop(scoreType);
if (scoreType == "sco"){
flasher = global.flash_green;
};
if (scoreType == "spd"){
flasher = global.flash_orange;
};
if (scoreType == "alt"){
flasher = global.flash_blue;
};
flasher.gotoAndPlay(1);
scoreOrb.scaleX = (scoreOrb.scaleY = (0.5 + ((numScoreslots + 1) / 20)));
waitingScore = getScorePoints(numScoreslots);
centerscoretext.text = String(waitingScore);
if (waitingScore == 0){
centerscoretext.text = "";
};
if (numScoreslots == 9){
global.archievements.testArchiesNinecombo(scoreType);
};
addFeedback(numScoreslots);
}
private function checkScore():void{
var _local1:*;
numScoreslots = 1;
_local1 = 1;
while (_local1 < slotorbQueue.length) {
if (slotorbQueue[_local1] != slotorbQueue[(_local1 - 1)]){
break;
} else {
numScoreslots++;
};
_local1++;
};
if (slotorbQueue.length > 0){
if ((((numScoreslots < slotorbQueue.length)) || ((numScoreslots == 9)))){
bScoreNextTick = true;
};
} else {
numScoreslots = 0;
};
if ((rotAngle % 36) == 0){
adjustCenterScore();
};
}
public function addOrb(_arg1:String=""):void{
orbQueue.push(_arg1.slice(0, 3));
global.numOrbs++;
}
private function score(_arg1:int, _arg2:String):void{
var _local3:*;
addCurrTick = 0;
_local3 = 0;
while (_local3 < _arg1) {
aSwitchoffSlots.push(Aslots[(scoreStartSlot % 10)]);
scoreStartSlot++;
slotorbQueue.shift();
rotAngle = (rotAngle + 36);
_local3++;
};
numScoreslots = (numScoreslots - _arg1);
bScoreNextTick = false;
scoreScore = waitingScore;
}
private function doScore():void{
if (scoreScore == 0){
return;
};
scoreMan.scoScoreCurrent = (scoreMan.scoScoreCurrent + (scoreScore * multiplyerCurrent));
global.archievements.testArchiesScore();
switch (scoreType){
case "spd":
scoreMan.spdScoreTotal = (scoreMan.spdScoreTotal + (scoreScore * multiplyerCurrent));
scoreMan.spdScoreCurrent = (scoreMan.spdScoreCurrent + (scoreScore * multiplyerCurrent));
global.Gauge_Speed.setFill();
break;
case "alt":
scoreMan.altScoreTotal = (scoreMan.altScoreTotal + (scoreScore * multiplyerCurrent));
scoreMan.altScoreCurrent = (scoreMan.altScoreCurrent + (scoreScore * multiplyerCurrent));
global.Gauge_Height.setFill();
break;
};
scoreScore = 0;
setDigits();
}
private function getScorePoints(_arg1:int):int{
switch (_arg1){
case 0:
return (0);
case 1:
return (10);
case 2:
return (50);
case 3:
return (100);
case 4:
return (250);
case 5:
return (500);
case 6:
return (750);
case 7:
return (1000);
case 8:
return (2000);
case 9:
return (5000);
};
return (0);
}
private function killTetris():void{
}
private function addScoreMultiplyer():void{
if (multiplyerCurrent == 1){
multiplyerCurrent = 5;
} else {
multiplyerCurrent = (multiplyerCurrent + 5);
};
multi_text.text = String(multiplyerCurrent);
multi_orb.visible = true;
startMultiplyerDecay();
global.multi_flash.visible = true;
global.multi_flash.gotoAndPlay(2);
addFeedback(10);
global.archievements.testArchieMulti(multiplyerCurrent);
}
public function initTetris():void{
multi_orb = (getChildByName("multiOrb") as MovieClip);
multi_text = (multi_orb.getChildByName("multiText") as TextField);
multi_gauge = (multi_orb.getChildByName("multiGauge") as MovieClip);
multi_text.text = "5";
multi_orb.visible = false;
centerscore = (getChildByName("centerScore") as MovieClip);
scorepipe = (getChildByName("scorePipe") as MovieClip);
centerscoretext = (centerscore.getChildByName("centerScoretext") as TextField);
scoreOrb = (centerscore.getChildByName("scoreorb") as MovieClip);
t_slots = (getChildByName("T_slots") as MovieClip);
slot0 = t_slots.getChildByName("Slot0");
slot1 = t_slots.getChildByName("Slot1");
slot2 = t_slots.getChildByName("Slot2");
slot3 = t_slots.getChildByName("Slot3");
slot4 = t_slots.getChildByName("Slot4");
slot5 = t_slots.getChildByName("Slot5");
slot6 = t_slots.getChildByName("Slot6");
slot7 = t_slots.getChildByName("Slot7");
slot8 = t_slots.getChildByName("Slot8");
slot9 = t_slots.getChildByName("Slot9");
Aslots = new Array(slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9);
orbQueue = new Array();
slotorbQueue = new Array();
scoreQueue = new Array();
aSwitchoffSlots = new Array();
feedbackQueue = new Array();
setInterval(showFeedback, 300);
centerscoretext.text = "";
}
public function addFeedback(_arg1:int):void{
if ((((_arg1 > 1)) && ((_arg1 == lastOrbcount)))){
return;
};
if ((((_arg1 == 1)) && ((scoreType == lastscoreType)))){
return;
};
lastOrbcount = _arg1;
lastscoreType = scoreType;
feedbackQueue.push(_arg1);
}
private function killCurrentscore():void{
killingRow++;
if (killingRow == 10){
killingRow = 0;
global.archievements.setKamikazeArchie();
};
global.Gauge_Speed.killScore();
global.Gauge_Height.killScore();
addFeedback(11);
}
private function showFeedback():void{
var _local1:scorefeedback;
if (feedbackQueue.length == 0){
return;
};
_local1 = new scorefeedback(feedbackQueue.shift());
}
private function startMultiplyerDecay():void{
removeEventListener(Event.ENTER_FRAME, multiDecay);
multi_gauge.y = -37;
addEventListener(Event.ENTER_FRAME, multiDecay);
}
private function killmultiplyer():void{
removeEventListener(Event.ENTER_FRAME, multiDecay);
multi_orb.visible = false;
multiplyerCurrent = 1;
global.multi_flash.visible = false;
global.sounds.multiOut();
}
private function setDigits():void{
global.disp_score.text = scoreMan.scoScoreCurrent;
scoreMan.checkScoreActions();
}
}
}//package jet
Section 46
//volumeControl (jet.volumeControl)
package jet {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import lt.uza.utils.*;
import flash.filters.*;
public class volumeControl extends MovieClip {
public var volbar:MovieClip;
private var VolBar:Sprite;
private var global:Global;
private var mouseIsDown:Boolean;
public function volumeControl(){
global = Global.getInstance();
super();
init();
}
private function mouseup(_arg1):void{
mouseIsDown = false;
}
private function init():void{
VolBar = (getChildByName("volbar") as Sprite);
this.buttonMode = true;
addEventListener(MouseEvent.MOUSE_DOWN, mousedown);
addEventListener(MouseEvent.MOUSE_UP, mouseup);
addEventListener(MouseEvent.ROLL_OVER, mouseup);
addEventListener(MouseEvent.MOUSE_MOVE, mousemove);
}
private function setVolume(_arg1):void{
var _local2:Number;
VolBar.x = mouseX;
_local2 = ((50 - mouseX) / 50);
if (_local2 > 0.9){
_local2 = 1;
};
if (_local2 < 0.1){
_local2 = 0;
};
if (name == "music"){
global.sounds.setMusicVolume(_local2);
} else {
global.sounds.setFXVolume(_local2);
};
}
private function mousedown(_arg1):void{
mouseIsDown = true;
setVolume(_arg1);
}
private function mousemove(_arg1):void{
if (mouseIsDown){
setVolume(_arg1);
};
}
}
}//package jet
Section 47
//World (jet.World)
package jet {
import flash.display.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.materials.*;
import lt.uza.utils.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.cameras.*;
public class World extends Camera3D {
private var numClouds:int;
private var currMultiorbs:int;// = 0
private var currSpeedorbs:int;// = 0
private var cloudheightVariance:Number;
private var skyboxmaterial:BitmapAssetMaterial;
private var currPlusorbs:int;// = 0
private var cloudsizeVariance:Number;
private var aMinusorbs:Array;
private var scene_renderwidth:int;
private var cloud4material:BitmapAssetMaterial;
private var cloud6material:BitmapAssetMaterial;
private var aMultiorbs:Array;
private var earthsphere:Sphere;
private var worldmaterial:BitmapAssetMaterial;
private var currHeightorbs:int;// = 0
private var currChaosorbs:int;// = 0
private var currRedorbs:int;// = 0
private var currFlightheight:Number;
private var minFlightheight:Number;
private var currScoreorbs:int;// = 0
private var scene_renderheight:int;
private var maxFlightheight:Number;
private var earthCenter:DisplayObject3D;
private var orbHeightvariance:int;
private var earthradius:Number;
private var lvlSpeedmaterial:MovieAssetMaterial;
private var orbSize:int;
private var haloMaterial:BitmapAssetMaterial;
private var aPlusorbs:Array;
private var haloA:BillBoard;
private var global:Global;
private var cloud1material:BitmapAssetMaterial;
private var cloud3material:BitmapAssetMaterial;
private var cloud5material:BitmapAssetMaterial;
private var orbMaterial4:MovieAssetMaterial;
private var orbMaterial5:MovieAssetMaterial;
private var orbMaterial6:MovieAssetMaterial;
private var cloudSize:int;
private var currMinusorbs:int;// = 0
private var cloudContainer:DisplayObject3D;
private var orbMaterial7:MovieAssetMaterial;
private var orbMaterial8:MovieAssetMaterial;
private var aRedorbs:Array;
private var orbMaterial1:MovieAssetMaterial;
private var orbMaterial3:MovieAssetMaterial;
private var orbMaterial2:MovieAssetMaterial;
public function World(){
global = Global.getInstance();
scene_renderwidth = definitions.scene_renderwidth;
scene_renderheight = definitions.scene_renderheight;
minFlightheight = definitions.minFlightheight;
maxFlightheight = definitions.maxFlightheight;
currFlightheight = definitions.currFlightheight;
aMultiorbs = new Array();
aPlusorbs = new Array();
aMinusorbs = new Array();
aRedorbs = new Array();
currScoreorbs = 0;
currSpeedorbs = 0;
currHeightorbs = 0;
currRedorbs = 0;
currMultiorbs = 0;
currMinusorbs = 0;
currPlusorbs = 0;
currChaosorbs = 0;
haloMaterial = new BitmapAssetMaterial("halo", true);
earthradius = definitions.measure_earthradius;
cloudSize = definitions.cloudSize;
numClouds = definitions.numClouds;
cloudsizeVariance = definitions.cloudsizeVariance;
cloudheightVariance = definitions.cloudheightVariance;
orbSize = definitions.orbSize;
orbHeightvariance = definitions.orbHeightvariance;
super();
createWorld();
global.world = this;
}
public function setRandomposition(_arg1:Object):void{
var _local2:Number;
if (global.world){
setOppositeposition(_arg1);
return;
};
_arg1.x = 0;
_arg1.y = 0;
_arg1.z = 0;
_arg1.rotationX = (Math.random() * 340);
_arg1.rotationY = (Math.random() * 340);
_arg1.rotationZ = 0;
_local2 = ((definitions.measure_earthradius + minFlightheight) + (Math.random() * (definitions.curr_maxFlightheight - minFlightheight)));
_arg1.moveBackward(_local2);
}
private function createMultiorbs():void{
var _local1:int;
var _local2:*;
_local1 = currMultiorbs;
while (_local1 < definitions.numOrbs_multi_curr) {
_local2 = global.scene.addChild(new orb(orbMaterial4, (orbSize * 2), (orbSize * 2), 0, 0));
setRandomposition(_local2);
_local2.name = ("mul5" + _local1);
_local2.meshSortModifyer = 5000;
currMultiorbs++;
_local1++;
};
}
public function createOrbs():void{
createBaseorbs();
createRedorbs();
createMultiorbs();
createSmallcrossOrbs();
createBigcrossOrbs();
}
private function createBaseorbs():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:*;
_local1 = currScoreorbs;
while (_local1 < definitions.numOrbs_score_curr) {
_local4 = global.scene.addChild(new orb(orbMaterial1, orbSize, orbSize, 0, 0));
setRandomposition(_local4);
_local4.name = ("sco" + _local1);
_local4.meshSortModifyer = 5000;
currScoreorbs++;
_local1++;
};
_local2 = currSpeedorbs;
while (_local2 < definitions.numOrbs_speed_curr) {
_local4 = global.scene.addChild(new orb(orbMaterial2, orbSize, orbSize, 0, 0));
setRandomposition(_local4);
_local4.name = ("spd" + _local2);
_local4.meshSortModifyer = 5000;
currSpeedorbs++;
_local2++;
};
_local3 = currHeightorbs;
while (_local3 < definitions.numOrbs_height_curr) {
_local4 = global.scene.addChild(new orb(orbMaterial3, orbSize, orbSize, 0, 0));
setRandomposition(_local4);
_local4.name = ("alt" + _local3);
_local4.meshSortModifyer = 5000;
currHeightorbs++;
_local3++;
};
}
private function createSmallcrossOrbs():void{
var _local1:int;
var _local2:*;
_local1 = currMinusorbs;
while (_local1 < definitions.numOrbs_minus_curr) {
_local2 = global.scene.addChild(new orb(orbMaterial7, 120, 30, 0, 0));
setRandomposition(_local2);
_local2.name = ("crs" + _local1);
_local2.meshSortModifyer = 5000;
currMinusorbs++;
_local1++;
};
}
private function createRedorbs():void{
var _local1:int;
var _local2:*;
_local1 = currRedorbs;
while (_local1 < definitions.numOrbs_red_curr) {
_local2 = global.scene.addChild(new orb(orbMaterial6, (orbSize * 1.5), (orbSize * 1.5), 0, 0));
setRandomposition(_local2);
_local2.name = ("red" + _local1);
_local2.meshSortModifyer = 5000;
currRedorbs++;
_local1++;
};
}
private function getRandomCloudMaterial():BitmapAssetMaterial{
var _local1:*;
_local1 = (Math.random() * 20);
if (_local1 < 4){
return (cloud1material);
};
if ((((_local1 < 8)) && ((_local1 >= 4)))){
return (cloud3material);
};
if ((((_local1 < 12)) && ((_local1 >= 8)))){
return (cloud4material);
};
if ((((_local1 < 16)) && ((_local1 >= 12)))){
return (cloud5material);
};
if (_local1 >= 16){
return (cloud6material);
};
return (cloud1material);
}
private function createChaosOrbs():void{
var _local1:int;
var _local2:*;
_local1 = currChaosorbs;
while (_local1 < definitions.numOrbs_chaos_curr) {
_local2 = global.scene.addChild(new orb(orbMaterial5, 120, 120, 0, 0));
setRandomposition(_local2);
_local2.name = ("cha" + _local1);
_local2.meshSortModifyer = 5000;
currChaosorbs++;
_local1++;
};
}
public function setOppositeposition(_arg1:Object):void{
var _local2:Number;
_arg1.copyPosition(global.camera);
_arg1.lookAt(earthsphere);
_arg1.copyPosition(earthsphere);
_arg1.yaw(((Math.random() * 220) - 110));
_arg1.pitch(((Math.random() * 220) - 110));
_local2 = ((definitions.measure_earthradius + minFlightheight) + (Math.random() * (definitions.curr_maxFlightheight - minFlightheight)));
_arg1.moveForward(_local2);
}
public function showRedorbs():void{
var _local1:orb;
for each (_local1 in aRedorbs) {
_local1.visible = true;
};
}
private function createBigcrossOrbs():void{
var _local1:int;
var _local2:*;
_local1 = currPlusorbs;
while (_local1 < definitions.numOrbs_plus_curr) {
_local2 = global.scene.addChild(new orb(orbMaterial8, 120, 120, 0, 0));
setRandomposition(_local2);
_local2.name = ("crb" + _local1);
_local2.meshSortModifyer = 5000;
currPlusorbs++;
_local1++;
};
}
public function createWorld():void{
var _local1:Number;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:DisplayObject3D;
var _local6:MovieAssetMaterial;
var _local7:BitmapAssetMaterial;
var _local8:*;
var _local9:BitmapAssetMaterial;
var _local10:*;
var _local11:Number;
var _local12:DisplayObject3D;
var _local13:Number;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:Number;
orbMaterial1 = new MovieAssetMaterial("orb1", true);
orbMaterial2 = new MovieAssetMaterial("orb2", true);
orbMaterial3 = new MovieAssetMaterial("orb3", true);
orbMaterial4 = new MovieAssetMaterial("orb4", true);
orbMaterial5 = new MovieAssetMaterial("orb5", true);
orbMaterial6 = new MovieAssetMaterial("orb6", true);
orbMaterial7 = new MovieAssetMaterial("orb7", true);
orbMaterial8 = new MovieAssetMaterial("orb8", true);
lvlSpeedmaterial = new MovieAssetMaterial("tex_levelup", true);
earthCenter = global.scene.addChild(new DisplayObject3D("root"));
global.earthCenter = earthCenter;
cloudContainer = global.scene.addChild(new DisplayObject3D("clouds"));
global.clouds = cloudContainer;
if (global.renderquality == 1){
cloudContainer.visible = false;
};
worldmaterial = new BitmapAssetMaterial("world2048");
earthsphere = new Sphere(worldmaterial, earthradius, definitions.worldsphereWidthsegments, definitions.worldsphereHeightsegments);
global.scene.addChild(earthsphere);
_local1 = (earthradius * 3.1);
haloA = new BillBoard(haloMaterial, _local1, _local1, 0, 0);
global.scene.addChild(haloA);
haloA.meshSortModifyer = 6000;
cloud1material = new BitmapAssetMaterial("cloud01");
cloud3material = new BitmapAssetMaterial("cloud3");
cloud4material = new BitmapAssetMaterial("cloud4");
cloud5material = new BitmapAssetMaterial("cloud5");
cloud6material = new BitmapAssetMaterial("cloud6");
_local2 = earthsphere.geometry.vertices.length;
_local3 = Math.round((_local2 / numClouds));
_local3 = 6;
_local4 = 0;
while (_local4 < numClouds) {
if (!earthsphere.geometry.vertices[(_local4 * _local3)]){
break;
};
_local13 = (((Math.random() - 0.5) * 2) * (cloudSize * cloudsizeVariance));
_local14 = (cloudSize + (((Math.random() - 0.5) * 2) * (cloudSize * cloudsizeVariance)));
_local15 = getRandomCloudMaterial();
_local16 = cloudContainer.addChild(new LODBillBoard(_local15, _local14, _local14, 0, 0), ("cloudplane" + _local4));
_local16.x = earthsphere.geometry.vertices[(_local4 * _local3)].x;
_local16.y = earthsphere.geometry.vertices[(_local4 * _local3)].y;
_local16.z = earthsphere.geometry.vertices[(_local4 * _local3)].z;
_local16.lookAt(earthsphere);
_local16.moveBackward(((definitions.cloudminHeight + ((definitions.cloudmaxHeight - definitions.cloudminHeight) * Math.random())) + (_local14 / 2)));
_local4++;
};
_local5 = new DisplayObject3D();
_local6 = new MovieAssetMaterial("star");
_local7 = new BitmapAssetMaterial("moon");
_local8 = _local5.addChild(new BillBoard(_local7, 150, 150, 0, 0), "moon");
_local8.moveBackward(900);
_local8.meshSortModifyer = -50000;
_local9 = new BitmapAssetMaterial("sun");
_local10 = _local5.addChild(new BillBoard(_local9, 300, 300, 0, 0), "sun");
_local10.moveForward(900);
_local10.meshSortModifyer = -50000;
_local11 = 0;
while (_local11 < definitions.numStars) {
_local17 = ((Math.random() + 0.5) * definitions.starSize);
_local16 = _local5.addChild(new BillBoard(_local6, _local17, _local17, 0, 0), ("star" + _local11));
_local16.x = 0;
_local16.y = 0;
_local16.z = 0;
_local16.rotationX = (Math.random() * 350);
_local16.rotationY = (Math.random() * 350);
_local16.rotationZ = 0;
_local16.moveBackward(1000);
_local16.meshSortModifyer = -50000;
_local11++;
};
createOrbs();
global.scene.addChild(_local5);
global.skybox = _local5;
_local12 = new DisplayObject3D();
global.scene.addChild(_local12);
global.suckCenter = _local12;
}
public function destroyWorld():void{
var _local1:*;
var _local2:*;
for each (_local1 in global.scene.children) {
global.scene.removeChild(_local1);
};
_local2 = MaterialManager.getInstance();
_local2.destroyAllMaterials();
}
}
}//package jet
Section 48
//Global (lt.uza.utils.Global)
package lt.uza.utils {
import flash.events.*;
import flash.utils.*;
public dynamic class Global extends Proxy implements IEventDispatcher {
private var globalRepository:HashMap;
private var dispatcher:EventDispatcher;
private static var allowInstantiation:Boolean = false;
private static var instance:Global = null;
public function Global(){
if (getQualifiedClassName(this) == "lt.uza.utils::Global"){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use Global.getInstance() instead of new Global()."));
};
globalRepository = new HashMap();
dispatcher = new EventDispatcher(this);
};
}
public function containsKey(_arg1:String):Boolean{
var _local2:Boolean;
_local2 = globalRepository.containsKey(_arg1);
return (_local2);
}
public function remove(_arg1:String):void{
globalRepository.remove(_arg1);
}
public function willTrigger(_arg1:String):Boolean{
return (dispatcher.willTrigger(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (globalRepository.getValue(_arg1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
var _local3:*;
switch (_arg1.toString()){
default:
_local3 = globalRepository.getValue(_arg1).apply(globalRepository, _args);
break;
};
return (_local3);
}
public function put(_arg1:String, _arg2):void{
globalRepository.put(_arg1, _arg2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:*;
_local3 = globalRepository.getValue(_arg1);
globalRepository.put(_arg1, _arg2);
if (_local3 !== _arg2){
dispatchEvent(new GlobalEvent(GlobalEvent.PROPERTY_CHANGED, _arg1));
};
}
public function dispatchEvent(_arg1:Event):Boolean{
return (dispatcher.dispatchEvent(_arg1));
}
public function containsValue(_arg1):Boolean{
var _local2:Boolean;
_local2 = globalRepository.containsValue(_arg1);
return (_local2);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
public function take(_arg1){
return (globalRepository.getValue(_arg1));
}
public function get length():int{
var _local1:int;
_local1 = globalRepository.size();
return (_local1);
}
public function toString():String{
var _local1:Array;
var _local2:*;
_local1 = new Array();
for (_local2 in globalRepository) {
_local1.push((((("{" + _local2) + ":") + globalRepository[_local2]) + "}"));
};
return (_local1.join(","));
}
public function hasEventListener(_arg1:String):Boolean{
return (dispatcher.hasEventListener(_arg1));
}
public static function getInstance():Global{
if (Global.instance == null){
Global.allowInstantiation = true;
Global.instance = new (Global);
Global.allowInstantiation = false;
};
return (Global.instance);
}
}
}//package lt.uza.utils
Section 49
//GlobalEvent (lt.uza.utils.GlobalEvent)
package lt.uza.utils {
import flash.events.*;
public class GlobalEvent extends Event {
public var property;
public static const PROPERTY_CHANGED:String = "globalPropertyChanged";
public function GlobalEvent(_arg1:String, _arg2, _arg3:Boolean=false, _arg4:Boolean=false){
this.property = _arg2;
super(_arg1, _arg3, _arg4);
}
override public function clone():Event{
return (new GlobalEvent(type, property, bubbles, cancelable));
}
}
}//package lt.uza.utils
Section 50
//HashMap (lt.uza.utils.HashMap)
package lt.uza.utils {
import flash.utils.*;
public dynamic class HashMap extends Dictionary implements IMap {
public function HashMap(_arg1:Boolean=true){
super(_arg1);
}
public function containsKey(_arg1:String):Boolean{
return (!((this[_arg1] == null)));
}
public function remove(_arg1:String):void{
this[_arg1] = null;
}
public function size():int{
var _local1:int;
var _local2:String;
_local1 = 0;
for (_local2 in this) {
if (this[_local2] != null){
_local1++;
};
};
return (_local1);
}
public function getKey(_arg1):String{
var _local2:String;
for (_local2 in this) {
if (this[_local2] == _arg1){
return (_local2);
};
};
return (null);
}
public function isEmpty():Boolean{
var _local1:int;
var _local2:String;
_local1 = 0;
for (_local2 in this) {
if (this[_local2] != null){
_local1++;
};
};
return ((_local1 <= 0));
}
public function clear():void{
var _local1:String;
for (_local1 in this) {
this[_local1] = null;
};
}
public function put(_arg1:String, _arg2):void{
this[_arg1] = _arg2;
}
public function containsValue(_arg1):Boolean{
var _local2:String;
for (_local2 in this) {
if (this[_local2] == _arg1){
return (true);
};
};
return (false);
}
public function getValue(_arg1:String){
if (this[_arg1] != null){
return (this[_arg1]);
};
}
}
}//package lt.uza.utils
Section 51
//IMap (lt.uza.utils.IMap)
package lt.uza.utils {
public interface IMap {
function containsKey(_arg1:String):Boolean;
function isEmpty():Boolean;
function remove(_arg1:String):void;
function size():int;
function getKey(_arg1):String;
function clear():void;
function containsValue(_arg1):Boolean;
function put(_arg1:String, _arg2):void;
function getValue(_arg1:String);
}
}//package lt.uza.utils
Section 52
//center_score_21 (orbeater_fla.center_score_21)
package orbeater_fla {
import flash.display.*;
import flash.text.*;
public dynamic class center_score_21 extends MovieClip {
public var scoreorb:MovieClip;
public var centerScoretext:TextField;
}
}//package orbeater_fla
Section 53
//confirmNew_51 (orbeater_fla.confirmNew_51)
package orbeater_fla {
import flash.display.*;
public dynamic class confirmNew_51 extends MovieClip {
public var OK:MovieClip;
public var CANCEL:MovieClip;
}
}//package orbeater_fla
Section 54
//crosgraphic_64 (orbeater_fla.crosgraphic_64)
package orbeater_fla {
import flash.display.*;
public dynamic class crosgraphic_64 extends MovieClip {
public var crossearth:MovieClip;
public var crossSpinner:MovieClip;
}
}//package orbeater_fla
Section 55
//flash_blue_29 (orbeater_fla.flash_blue_29)
package orbeater_fla {
import flash.display.*;
public dynamic class flash_blue_29 extends MovieClip {
public function flash_blue_29(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package orbeater_fla
Section 56
//flash_green_27 (orbeater_fla.flash_green_27)
package orbeater_fla {
import flash.display.*;
public dynamic class flash_green_27 extends MovieClip {
public function flash_green_27(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package orbeater_fla
Section 57
//flash_orange_28 (orbeater_fla.flash_orange_28)
package orbeater_fla {
import flash.display.*;
public dynamic class flash_orange_28 extends MovieClip {
public function flash_orange_28(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package orbeater_fla
Section 58
//gaugefill_red_34 (orbeater_fla.gaugefill_red_34)
package orbeater_fla {
import flash.display.*;
public dynamic class gaugefill_red_34 extends MovieClip {
public function gaugefill_red_34(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package orbeater_fla
Section 59
//jetOpen_10 (orbeater_fla.jetOpen_10)
package orbeater_fla {
import flash.display.*;
public dynamic class jetOpen_10 extends MovieClip {
public function jetOpen_10(){
addFrameScript(0, frame1, 92, frame93, 150, frame151);
}
function frame151(){
stop();
}
function frame93(){
stop();
}
function frame1(){
stop();
}
}
}//package orbeater_fla
Section 60
//levelupGaugeAlt_38 (orbeater_fla.levelupGaugeAlt_38)
package orbeater_fla {
import flash.display.*;
public dynamic class levelupGaugeAlt_38 extends MovieClip {
public function levelupGaugeAlt_38(){
addFrameScript(27, frame28);
}
function frame28(){
stop();
}
}
}//package orbeater_fla
Section 61
//levelupGaugeSpd_35 (orbeater_fla.levelupGaugeSpd_35)
package orbeater_fla {
import flash.display.*;
public dynamic class levelupGaugeSpd_35 extends MovieClip {
public function levelupGaugeSpd_35(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package orbeater_fla
Section 62
//orbgauge_19 (orbeater_fla.orbgauge_19)
package orbeater_fla {
import flash.display.*;
public dynamic class orbgauge_19 extends MovieClip {
public function orbgauge_19(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package orbeater_fla
Section 63
//preloader_progress_bar_4 (orbeater_fla.preloader_progress_bar_4)
package orbeater_fla {
import flash.display.*;
public dynamic class preloader_progress_bar_4 extends MovieClip {
public var progress_bar_mask_at:MovieClip;
}
}//package orbeater_fla
Section 64
//scoreOrb_22 (orbeater_fla.scoreOrb_22)
package orbeater_fla {
import flash.display.*;
public dynamic class scoreOrb_22 extends MovieClip {
public function scoreOrb_22(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package orbeater_fla
Section 65
//scorepipe_20 (orbeater_fla.scorepipe_20)
package orbeater_fla {
import flash.display.*;
public dynamic class scorepipe_20 extends MovieClip {
public function scorepipe_20(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package orbeater_fla
Section 66
//tetrisMultiplyer_15 (orbeater_fla.tetrisMultiplyer_15)
package orbeater_fla {
import flash.display.*;
import flash.text.*;
public dynamic class tetrisMultiplyer_15 extends MovieClip {
public var multiText:TextField;
public var multiGauge:MovieClip;
}
}//package orbeater_fla
Section 67
//Tslots_18 (orbeater_fla.Tslots_18)
package orbeater_fla {
import flash.display.*;
public dynamic class Tslots_18 extends MovieClip {
public var Slot6:MovieClip;
public var Slot0:MovieClip;
public var Slot1:MovieClip;
public var Slot2:MovieClip;
public var Slot3:MovieClip;
public var Slot4:MovieClip;
public var Slot5:MovieClip;
public var Slot7:MovieClip;
public var Slot8:MovieClip;
public var Slot9:MovieClip;
}
}//package orbeater_fla
Section 68
//whitefade_8 (orbeater_fla.whitefade_8)
package orbeater_fla {
import flash.display.*;
public dynamic class whitefade_8 extends MovieClip {
public function whitefade_8(){
addFrameScript(0, frame1, 59, frame60);
}
function frame1(){
stop();
}
function frame60(){
stop();
}
}
}//package orbeater_fla
Section 69
//Camera3D (org.papervision3d.cameras.Camera3D)
package org.papervision3d.cameras {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
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 70
//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 71
//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 72
//DefaultClipping (org.papervision3d.core.clipping.DefaultClipping)
package org.papervision3d.core.clipping {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 73
//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 74
//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 75
//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 76
//FrustumCuller (org.papervision3d.core.culling.FrustumCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.math.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class FrustumCuller implements IObjectCuller {
private var _ratio:Number;
private var _fov:Number;
var bboxExpander:int;// = 500
private var _near:Number;
var minVert:Number3D;
var cullTick:int;// = 0
public var Debug;
var maxVert:Number3D;
private var _tang:Number;
private var _nh:Number;
private var _far:Number;
private var _fh:Number;
private var _nw:Number;
public var transform:Matrix3D;
private var _sphereY:Number;
private var _fw:Number;
private var _sphereX:Number;
public static const OUTSIDE:int = -1;
public static const INSIDE:int = 1;
public static const INTERSECT:int = 0;
public function FrustumCuller(){
cullTick = 0;
bboxExpander = 500;
super();
this.transform = Matrix3D.IDENTITY;
this.initialize();
}
public function sphereInFrustum2(_arg1:DisplayObject3D, _arg2:BoundingSphere):int{
var _local3:*;
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:int;
var _local13:Matrix3D;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = _arg1.geometry.aabb;
_local4 = (_local3.minX + ((_local3.maxX - _local3.minX) * 0.5));
_local5 = (_local3.minY + ((_local3.maxY - _local3.minY) * 0.5));
_local6 = (_local3.minZ + ((_local3.maxZ - _local3.minZ) * 0.5));
_local7 = (_local3.aabbradius * Math.max(_arg1.scaleX, Math.max(_arg1.scaleY, _arg1.scaleZ)));
_local12 = INSIDE;
_local13 = this.transform;
_local14 = (_local4 - _local13.n14);
_local15 = (_local5 - _local13.n24);
_local16 = (_local6 - _local13.n34);
if ((((((_local14 < _local7)) && ((_local15 < _local7)))) && ((_local16 < _local7)))){
return (INSIDE);
};
_local11 = (((_local14 * _local13.n13) + (_local15 * _local13.n23)) + (_local16 * _local13.n33));
if ((((_local11 > (_far + _local7))) || ((_local11 < (_near - _local7))))){
return (OUTSIDE);
};
if ((((_local11 > (_far - _local7))) || ((_local11 < (_near + _local7))))){
_local12 = INTERSECT;
};
_local10 = (((_local14 * _local13.n12) + (_local15 * _local13.n22)) + (_local16 * _local13.n32));
_local8 = (_sphereY * _local7);
_local11 = (_local11 * _tang);
if ((((_local10 > (_local11 + _local8))) || ((_local10 < (-(_local11) - _local8))))){
return (OUTSIDE);
};
if ((((_local10 > (_local11 - _local8))) || ((_local10 < (-(_local11) + _local8))))){
_local12 = INTERSECT;
};
_local9 = (((_local14 * _local13.n11) + (_local15 * _local13.n21)) + (_local16 * _local13.n31));
_local11 = (_local11 * _ratio);
_local8 = (_sphereX * _local7);
if ((((_local9 > (_local11 + _local8))) || ((_local9 < (-(_local11) - _local8))))){
return (OUTSIDE);
};
if ((((_local9 > (_local11 - _local8))) || ((_local9 < (-(_local11) + _local8))))){
_local12 = INTERSECT;
};
return (_local12);
}
private function camInBBox(_arg1:Array, _arg2:DisplayObject3D):Boolean{
var _local3:Matrix3D;
_local3 = this.transform;
minVert = _arg1[0].toNumber3D();
maxVert = _arg1[1].toNumber3D();
Matrix3D.multiplyVector(_arg2.world, minVert);
Matrix3D.multiplyVector(_arg2.world, maxVert);
if (((((((((minVert.x - bboxExpander) < _local3.n14)) && (((maxVert.x + bboxExpander) > _local3.n14)))) && (((minVert.z - bboxExpander) < _local3.n34)))) && (((maxVert.z + bboxExpander) > _local3.n34)))){
return (true);
};
return (false);
}
public function get ratio():Number{
return (_ratio);
}
public function initialize(_arg1:Number=60, _arg2:Number=1.333, _arg3:Number=1, _arg4:Number=5000, _arg5:Object=null):void{
var _local6:Number;
var _local7:Number;
Debug = _arg5;
_fov = _arg1;
_ratio = _arg2;
_near = _arg3;
_far = _arg4;
_local6 = (((Math.PI / 180) * _fov) * 0.5);
_tang = Math.tan(_local6);
_nh = (_near * _tang);
_nw = (_nh * _ratio);
_fh = (_far * _tang);
_fw = (_fh * _ratio);
_local7 = Math.atan((_tang * _ratio));
_sphereX = (1 / Math.cos(_local7));
_sphereY = (1 / Math.cos(_local6));
}
public function set ratio(_arg1:Number):void{
this.initialize(_fov, _arg1, _near, _far);
}
public function set fov(_arg1:Number):void{
this.initialize(_arg1, _ratio, _near, _far);
}
public function get far():Number{
return (_far);
}
public function get near():Number{
return (_near);
}
public function set far(_arg1:Number):void{
this.initialize(_fov, _ratio, _near, _arg1);
}
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 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 set near(_arg1:Number):void{
this.initialize(_fov, _ratio, _arg1, _far);
}
public function get fov():Number{
return (_fov);
}
public function aabbInFrustum2(_arg1:DisplayObject3D, _arg2:AxisAlignedBoundingBox, _arg3:Boolean=true):int{
var _local4:Vertex3D;
var _local5:Number3D;
var _local6:int;
var _local7:int;
var _local8:Array;
cullTick = 0;
_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 (camInBBox(_local8, _arg1)){
return (INSIDE);
};
if (_local6){
return (((_local6 < 8)) ? INTERSECT : INSIDE);
//unresolved jump
};
return (OUTSIDE);
}
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 3:
_local2 = aabbInFrustum2(_arg1, _arg1.geometry.aabb);
if (_local2 != -1){
Debug.addStats(("visible geom: " + _arg1.name));
};
break;
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 77
//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 78
//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 79
//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 80
//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 81
//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 82
//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 83
//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 84
//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 85
//ViewportObjectFilter (org.papervision3d.core.culling.ViewportObjectFilter)
package org.papervision3d.core.culling {
import flash.utils.*;
import org.papervision3d.objects.*;
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 86
//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 87
//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 88
//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 89
//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 90
//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 91
//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 92
//Triangle3D (org.papervision3d.core.geom.renderables.Triangle3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.math.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
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 zsortStyle:int;// = 2
public var visible:Boolean;// = false
private var _adjacentFaces:Dictionary;
public var id:Number;
public var material:MaterialObject3D;
public var renderCommand:RenderTriangle;
public var faceNormal:Number3D;
public var screenZ:Number;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var uv2:NumberUV;
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){
visible = false;
zsortStyle = 2;
super();
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]);
};
}
public function get position():Number3D{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = (((v0.x + v1.x) + v2.x) / 3);
_local2 = (((v0.y + v1.y) + v2.y) / 3);
_local3 = (((v0.z + v1.z) + v2.z) / 3);
return (new Number3D(_local1, _local2, _local3));
}
private function getAdjacentTriangle(_arg1:Vertex3D, _arg2:Vertex3D):Triangle3D{
var _local3:Object;
var _local4:Object;
for (_local3 in _arg1.connectedFaces) {
for (_local4 in _arg2.connectedFaces) {
if ((((((_local4 === _local3)) && (!((_local3 == this))))) && (!((_local4 == this))))){
return ((_local3 as Triangle3D));
};
};
};
return (null);
}
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 (new Array(uv0, uv1, uv2));
}
public function get adjacentFaces():Dictionary{
var _local1:Triangle3D;
var _local2:Triangle3D;
var _local3:Triangle3D;
if (_adjacentFaces){
return (_adjacentFaces);
};
_adjacentFaces = new Dictionary();
_local1 = getAdjacentTriangle(v0, v1);
if (_local1){
_adjacentFaces[_local1] = _local1.position;
};
_local2 = getAdjacentTriangle(v1, v2);
if (_local2){
_adjacentFaces[_local2] = _local2.position;
};
_local3 = getAdjacentTriangle(v2, v0);
if (_local3){
_adjacentFaces[_local3] = _local3.position;
};
return (_adjacentFaces);
}
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 93
//Triangle3DInstance (org.papervision3d.core.geom.renderables.Triangle3DInstance)
package org.papervision3d.core.geom.renderables {
import flash.display.*;
import org.papervision3d.core.math.*;
import org.papervision3d.objects.*;
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 94
//Vertex3D (org.papervision3d.core.geom.renderables.Vertex3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.math.*;
import flash.utils.*;
import org.papervision3d.core.render.command.*;
public class Vertex3D extends AbstractRenderable implements IRenderable {
private var _edgeFaces:Dictionary;
public var vertex3DInstance:Vertex3DInstance;
public var extra:Object;
private var persp:Number;// = 0
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.connectedFaces = new Dictionary();
}
public function get edgeFaces():Dictionary{
if (_edgeFaces){
return (_edgeFaces);
};
_edgeFaces = new Dictionary();
return (_edgeFaces);
}
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;
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 set edgeFaces(_arg1:Dictionary):void{
_edgeFaces = _arg1;
}
public function calculateNormal():void{
}
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 95
//Vertex3DInstance (org.papervision3d.core.geom.renderables.Vertex3DInstance)
package org.papervision3d.core.geom.renderables {
public class Vertex3DInstance {
private var persp:Number;// = 0
public var visible:Boolean;
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;
}
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 96
//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 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 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 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 97
//TriangleMesh3D (org.papervision3d.core.geom.TriangleMesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMesh3D extends Vertices3D {
private var _dtStore:Array;
var ps:Array;
private var _dtActive:Array;
public var meshSortModifyer:int;// = 0
private var _tri:RenderTriangle;
public function TriangleMesh3D(_arg1:MaterialObject3D, _arg2:Array, _arg3:Array, _arg4:String=null){
meshSortModifyer = 0;
_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:Number;
var _local4:Number;
var _local5:ITriangleCuller;
var _local6:Vertex3DInstance;
var _local7:Vertex3DInstance;
var _local8:Vertex3DInstance;
var _local9:Triangle3DInstance;
var _local10:Triangle3D;
var _local11:MaterialObject3D;
var _local12:RenderTriangle;
ps = [];
super.project(_arg1, _arg2);
ps = this.geometry.faces;
if (!this.culled){
_local3 = 0;
_local4 = 0;
_local5 = _arg2.triangleCuller;
for each (_local10 in ps) {
_local11 = (_local10.material) ? _local10.material : material;
_local6 = _local10.v0.vertex3DInstance;
_local7 = _local10.v1.vertex3DInstance;
_local8 = _local10.v2.vertex3DInstance;
if (_local5.testFace(_local10, _local6, _local7, _local8)){
_local12 = _local10.renderCommand;
_local3 = (_local3 + (_local12.screenZ = setScreenZ2(_local10.zsortStyle, _local6, _local7, _local8)));
_local4++;
_local12.renderer = (_local11 as ITriangleDrawer);
_local12.v0 = _local6;
_local12.v1 = _local7;
_local12.v2 = _local8;
_local12.uv0 = _local10.uv0;
_local12.uv1 = _local10.uv1;
_local12.uv2 = _local10.uv2;
_local10.visible = true;
_arg2.renderer.addToRenderList(_local12);
} else {
_arg2.renderStatistics.culledTriangles++;
_local10.visible = false;
};
};
return ((this.screenZ = (_local3 / _local4)));
} else {
_arg2.renderStatistics.culledObjects++;
};
return (0);
}
protected function setScreenZ2(_arg1:uint, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Number{
switch (_arg1){
case 2:
return (((((_arg2.z + _arg3.z) + _arg4.z) * 0.33) - meshSortModifyer));
case 1:
return ((Math.max(_arg2.z, _arg3.z, _arg4.z) - meshSortModifyer));
case 3:
return ((Math.min(_arg2.z, _arg3.z, _arg4.z) - meshSortModifyer));
case 0:
return (((Math.max(_arg2.z, _arg3.z, _arg4.z) * 500) - meshSortModifyer));
case 5:
return (((Math.max(_arg2.z, _arg3.z, _arg4.z) * 50) - meshSortModifyer));
case 4:
return (((Math.min(_arg2.z, _arg3.z, _arg4.z) * 0.01) - meshSortModifyer));
};
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);
}
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 98
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
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 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 transformVertices(_arg1:Matrix3D):void{
geometry.transformVertices(_arg1);
}
public function projectEmpty(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
return (super.project(_arg1, _arg2));
}
}
}//package org.papervision3d.core.geom
Section 99
//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 100
//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 101
//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 102
//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 103
//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 104
//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 105
//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{
}
override public function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
override public function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
override public function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
override public function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
override public function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
}
}//package org.papervision3d.core.log
Section 106
//AbstractLightShadeMaterial (org.papervision3d.core.material.AbstractLightShadeMaterial)
package org.papervision3d.core.material {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.material.*;
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 107
//TriangleMaterial (org.papervision3d.core.material.TriangleMaterial)
package org.papervision3d.core.material {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 108
//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 109
//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 aabbradius:Number;// = 0
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, _arg7:String=""){
aabbradius = 0;
super();
this.minX = _arg1;
this.minY = _arg2;
this.minZ = _arg3;
this.maxX = _arg4;
this.maxY = _arg5;
this.maxZ = _arg6;
if (_arg7 == "groundplane"){
createGroundplaneVertices();
} else {
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 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();
}
protected function createGroundplaneVertices():void{
_vertices = new Array();
_vertices.push(new Vertex3D(minX, minY, minZ));
_vertices.push(new Vertex3D(maxX, maxY, minZ));
_vertices.push(new Vertex3D(minX, maxY, minZ));
_vertices.push(new Vertex3D(maxX, minY, minZ));
_vertices.push(new Vertex3D(minX, (minY + ((maxY - minY) * 0.5)), minZ));
_vertices.push(new Vertex3D(maxX, (minY + ((maxY - minY) * 0.5)), minZ));
_vertices.push(new Vertex3D((minX + ((maxX - minX) * 0.5)), minY, minZ));
_vertices.push(new Vertex3D((minX + ((maxX - minX) * 0.5)), maxY, minZ));
_vertices.push(new Vertex3D((minX + ((maxX - minX) * 0.25)), (minY + ((maxY - minY) * 0.25)), minZ));
_vertices.push(new Vertex3D((minX + ((maxX - minX) * 0.25)), (minY + ((maxY - minY) * 0.75)), minZ));
_vertices.push(new Vertex3D((minX + ((maxX - minX) * 0.75)), (minY + ((maxY - minY) * 0.25)), minZ));
_vertices.push(new Vertex3D((minX + ((maxX - minX) * 0.75)), (minY + ((maxY - minY) * 0.75)), minZ));
}
public function getBoxVertices():Array{
return (_vertices);
}
private function calculateRadius():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
this.aabbradius = Math.max((minX + ((maxX - minX) * 0.5)), (minY + ((maxY - minY) * 0.5)), (minY + ((maxY - minY) * 0.5)));
_local1 = (minX + ((maxX - minX) * 0.5));
_local2 = (minY + ((maxY - minY) * 0.5));
_local3 = (minZ + ((maxZ - minZ) * 0.5));
}
public static function createGroundplaneFromVertices(_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, "groundplane"));
}
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 110
//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 111
//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 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 112
//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 113
//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 114
//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 115
//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 116
//pv3dview (org.papervision3d.core.ns.pv3dview)
package org.papervision3d.core.ns {
public namespace pv3dview;
}//package org.papervision3d.core.ns
Section 117
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
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 118
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D)
package org.papervision3d.core.proto {
import flash.events.*;
import flash.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.log.*;
public class DisplayObjectContainer3D extends EventDispatcher {
private var _childrenTotal:int;
public var root:DisplayObjectContainer3D;
protected var _children:Dictionary;
protected var _childrenByName:Object;
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 addChildren(_arg1:DisplayObject3D):DisplayObjectContainer3D{
var _local2:DisplayObject3D;
for each (_local2 in _arg1.children) {
_arg1.removeChild(_local2);
this.addChild(_local2);
};
return (this);
}
public function removeChildByName(_arg1:String):DisplayObject3D{
return (removeChild(getChildByName(_arg1)));
}
override public function toString():String{
return (childrenList());
}
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 119
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.math.*;
import flash.events.*;
import flash.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
public class GeometryObject3D extends EventDispatcher {
protected var _boundingSphereDirty:Boolean;// = true
public var dirty:Boolean;
protected var _aabbDirty:Boolean;// = true
public var _ready:Boolean;// = false
private var debugmat;
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{
debugmat = new ColorMaterial(0xFFFFFF, 1);
_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] = true;
_local2.v1.connectedFaces[_local2] = true;
_local2.v2.connectedFaces[_local2] = true;
_local1[_local2.v0] = _local2.v0;
_local1[_local2.v1] = _local2.v1;
_local1[_local2.v2] = _local2.v2;
};
for each (_local3 in _local1) {
_local3.calculateNormal();
};
}
public function get boundingSphere():BoundingSphere{
if (_boundingSphereDirty){
_boundingSphere = BoundingSphere.getFromVertices(vertices);
_boundingSphereDirty = false;
};
return (_boundingSphere);
}
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) {
_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){
if (faces[0].instance.frustumTestMethod == 3){
_aabb = AxisAlignedBoundingBox.createGroundplaneFromVertices(vertices);
} else {
_aabb = AxisAlignedBoundingBox.createFromVertices(vertices);
};
_aabbDirty = false;
};
return (_aabb);
}
public function recalcAABB():void{
_aabbDirty = true;
}
}
}//package org.papervision3d.core.proto
Section 120
//LightObject3D (org.papervision3d.core.proto.LightObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.math.*;
import org.papervision3d.objects.*;
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 121
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
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.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 lineColor:Number;
public var lineAlpha:Number;// = 0
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 122
//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 123
//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 124
//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 125
//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 126
//RenderLine (org.papervision3d.core.render.command.RenderLine)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
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 127
//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 128
//RenderTriangle (org.papervision3d.core.render.command.RenderTriangle)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.draw.*;
public class RenderTriangle extends RenderableListItem implements IRenderListItem {
public var create:Function;
public var triangle:Triangle3D;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var uv2:NumberUV;
public var renderer:ITriangleDrawer;
public var v0:Vertex3DInstance;
public var v1:Vertex3DInstance;
public var v2:Vertex3DInstance;
public function RenderTriangle(_arg1:Triangle3D):void{
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;
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
renderer.drawTriangle(this, _arg2, _arg1);
}
}
}//package org.papervision3d.core.render.command
Section 129
//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 130
//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 131
//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 132
//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 133
//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 transparentTriangles: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;
transparentTriangles = 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.transparentTriangles = transparentTriangles;
_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;
transparentTriangles = 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 134
//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 135
//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 136
//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 137
//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 138
//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 139
//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 140
//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 141
//MaterialManager (org.papervision3d.core.render.material.MaterialManager)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
public class MaterialManager {
private static var instance:MaterialManager;
public static var materials:Dictionary;
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 destroyAllMaterials():void{
var _local1:Object;
for (_local1 in Mats) {
_local1.destroy();
};
}
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);
};
};
}
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);
};
};
};
}
private function _registerMaterial(_arg1:MaterialObject3D):void{
materials[_arg1] = true;
}
public static function get Mats():Dictionary{
return (materials);
}
public static function registerMaterial(_arg1:MaterialObject3D):void{
getInstance()._registerMaterial(_arg1);
}
public static function unRegisterMaterial(_arg1:MaterialObject3D):void{
getInstance()._unRegisterMaterial(_arg1);
}
public static function getInstance():MaterialManager{
if (!instance){
instance = new (MaterialManager);
};
return (instance);
}
}
}//package org.papervision3d.core.render.material
Section 142
//BasicProjectionPipeline (org.papervision3d.core.render.project.BasicProjectionPipeline)
package org.papervision3d.core.render.project {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import lt.uza.utils.*;
public class BasicProjectionPipeline extends ProjectionPipeline {
private var global:Global;
var objects:Array;
var p:DisplayObject3D;
public function BasicProjectionPipeline(){
global = Global.getInstance();
super();
init();
}
protected function init():void{
}
protected function projectObject(_arg1:DisplayObject3D, _arg2:RenderSessionData, _arg3:Number):void{
if (_arg1.parent){
_arg1.project((_arg1.parent as DisplayObject3D), _arg2);
} else {
_arg1.project(_arg2.camera, _arg2);
};
}
override public function project(_arg1:RenderSessionData):void{
_arg1.camera.transformView();
for each (p in _arg1.renderObjects) {
if (p.visible){
p.project(_arg1.camera, _arg1);
};
};
}
}
}//package org.papervision3d.core.render.project
Section 143
//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 144
//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 145
//ShaderObjectData (org.papervision3d.core.render.shader.ShaderObjectData)
package org.papervision3d.core.render.shader {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.shaders.*;
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 146
//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.utils.*;
import flash.geom.*;
import org.papervision3d.materials.shaders.*;
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 147
//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 148
//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 149
//AbstractRenderEngine (org.papervision3d.core.render.AbstractRenderEngine)
package org.papervision3d.core.render {
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 150
//IRenderEngine (org.papervision3d.core.render.IRenderEngine)
package org.papervision3d.core.render {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 151
//IVirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.core.utils.virtualmouse
Section 152
//VirtualMouse (org.papervision3d.core.utils.virtualmouse.VirtualMouse)
package org.papervision3d.core.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import org.papervision3d.core.log.*;
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 153
//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 154
//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 155
//InteractiveSceneManager (org.papervision3d.core.utils.InteractiveSceneManager)
package org.papervision3d.core.utils {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 156
//Mouse3D (org.papervision3d.core.utils.Mouse3D)
package org.papervision3d.core.utils {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
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 157
//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 158
//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 159
//FileLoadEvent (org.papervision3d.events.FileLoadEvent)
package org.papervision3d.events {
import flash.events.*;
public class FileLoadEvent extends Event {
public var bytesLoaded:Number;// = -1
public var message:String;// = ""
public var bytesTotal:Number;// = -1
public var dataObj:Object;// = null
public var file:String;// = ""
public static const COLLADA_MATERIALS_DONE:String = "colladaMaterialsDone";
public static const LOAD_PROGRESS:String = "loadProgress";
public static const ANIMATIONS_COMPLETE:String = "animationsComplete";
public static const SECURITY_LOAD_ERROR:String = "securityLoadError";
public static const LOAD_ERROR:String = "loadError";
public static const LOAD_COMPLETE:String = "loadComplete";
public static const ANIMATIONS_PROGRESS:String = "animationsProgress";
public function FileLoadEvent(_arg1:String, _arg2:String="", _arg3:Number=-1, _arg4:Number=-1, _arg5:String="", _arg6:Object=null, _arg7:Boolean=false, _arg8:Boolean=false){
file = "";
bytesLoaded = -1;
bytesTotal = -1;
message = "";
dataObj = null;
super(_arg1, _arg7, _arg8);
this.file = _arg2;
this.bytesLoaded = _arg3;
this.bytesTotal = _arg4;
this.message = _arg5;
this.dataObj = _arg6;
}
override public function clone():Event{
return (new FileLoadEvent(type, file, bytesLoaded, bytesTotal, message, dataObj, bubbles, cancelable));
}
}
}//package org.papervision3d.events
Section 160
//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 161
//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 162
//PointLight3D (org.papervision3d.lights.PointLight3D)
package org.papervision3d.lights {
import org.papervision3d.core.math.*;
import org.papervision3d.core.proto.*;
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 163
//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 164
//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 165
//ShadedMaterial (org.papervision3d.materials.shaders.ShadedMaterial)
package org.papervision3d.materials.shaders {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.core.render.shader.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.log.*;
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 166
//Shader (org.papervision3d.materials.shaders.Shader)
package org.papervision3d.materials.shaders {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.shader.*;
import flash.filters.*;
public class Shader extends EventDispatcher implements IShader {
protected var layers:Dictionary;
protected var _blendMode:String;// = "multiply"
protected var _filter:BitmapFilter;
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 167
//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 168
//CompositeMaterial (org.papervision3d.materials.special.CompositeMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 169
//LineMaterial (org.papervision3d.materials.special.LineMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 170
//ParticleMaterial (org.papervision3d.materials.special.ParticleMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 171
//LightMatrix (org.papervision3d.materials.utils.LightMatrix)
package org.papervision3d.materials.utils {
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
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 172
//MaterialsList (org.papervision3d.materials.utils.MaterialsList)
package org.papervision3d.materials.utils {
import flash.utils.*;
import org.papervision3d.core.proto.*;
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 173
//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 174
//BitmapAssetMaterial (org.papervision3d.materials.BitmapAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
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 175
//BitmapFileMaterial (org.papervision3d.materials.BitmapFileMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.core.log.*;
import lt.uza.utils.*;
import flash.net.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.events.*;
import flash.system.*;
public class BitmapFileMaterial extends BitmapMaterial implements ITriangleDrawer {
public var loaded:Boolean;
protected var bitmapLoader:Loader;
private var Debug;
public var url:String;// = ""
var file:String;
protected var errorLoading:Boolean;// = false
private var global:Global;
public var checkPolicyFile:Boolean;// = false
public static var LOADING_COLOR:int = MaterialObject3D.DEFAULT_COLOR;
public static var callback:Function;
protected static var _loadingIdle:Boolean = true;
protected static var _waitingBitmaps:Array = new Array();
protected static var _subscribedMaterials:Object = new Object();
public static var ERROR_COLOR:int = MaterialObject3D.DEBUG_COLOR;
protected static var _loaderUrls:Dictionary = new Dictionary(true);
protected static var _bitmapMaterials:Dictionary = new Dictionary(true);
public function BitmapFileMaterial(_arg1:String="", _arg2:Boolean=false){
global = Global.getInstance();
url = "";
checkPolicyFile = false;
errorLoading = false;
Debug = global.debug;
super(null, _arg2);
this.url = _arg1;
this.loaded = false;
this.fillAlpha = 1;
this.fillColor = LOADING_COLOR;
if (_arg1.length > 0){
texture = _arg1;
};
}
public function get subscribedMaterials():Object{
return (_subscribedMaterials);
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is String) == false){
PaperLogger.error("BitmapFileMaterial.texture requires a String for the texture");
return;
};
bitmap = createBitmapFromURL(String(_arg1));
_texture = _arg1;
}
protected function setupAsyncLoadCompleteCallback():void{
var _local1:Timer;
_local1 = new Timer(1, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, dispatchAsyncLoadCompleteEvent);
_local1.start();
}
protected function removeLoaderListeners():void{
bitmapLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadBitmapProgressHandler);
bitmapLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadBitmapCompleteHandler);
bitmapLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, loadBitmapErrorHandler);
}
protected function loadComplete():void{
var _local1:FileLoadEvent;
this.fillAlpha = 0;
this.fillColor = 0;
this.loaded = true;
_local1 = new FileLoadEvent(FileLoadEvent.LOAD_COMPLETE, this.url);
this.dispatchEvent(_local1);
}
protected function loadBitmapCompleteHandler(_arg1:Event):void{
var _local2:Bitmap;
var _local3:String;
var _local4:BitmapData;
var _local5:BitmapFileMaterial;
_local2 = Bitmap(bitmapLoader.content);
removeLoaderListeners();
_local3 = _loaderUrls[bitmapLoader];
_local4 = super.createBitmap(_local2.bitmapData);
for each (_local5 in _subscribedMaterials[_local3]) {
_local5.bitmap = _local4;
_local5.maxU = this.maxU;
_local5.maxV = this.maxV;
_local5.resetMapping();
_local5.loadComplete();
};
_subscribedMaterials[_local3] = null;
_bitmapMaterials[this] = true;
_waitingBitmaps.shift();
if (_waitingBitmaps.length > 0){
loadNextBitmap();
} else {
_loadingIdle = true;
bitmapLoader.unload();
if (Boolean(callback)){
callback();
};
};
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
if ((((bitmap == null)) || (errorLoading))){
if (errorLoading){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
};
_arg2.beginFill(fillColor, fillAlpha);
_arg2.moveTo(_arg1.v0.x, _arg1.v0.y);
_arg2.lineTo(_arg1.v1.x, _arg1.v1.y);
_arg2.lineTo(_arg1.v2.x, _arg1.v2.y);
_arg2.lineTo(_arg1.v0.x, _arg1.v0.y);
_arg2.endFill();
if (errorLoading){
_arg2.lineStyle();
};
_arg3.renderStatistics.triangles++;
};
super.drawTriangle(_arg1, _arg2, _arg3);
}
protected function loadNextBitmap():void{
var request:URLRequest;
var loaderContext:LoaderContext;
file = _waitingBitmaps[0];
request = new URLRequest(file);
bitmapLoader = new Loader();
bitmapLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadBitmapProgressHandler);
bitmapLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadBitmapCompleteHandler);
bitmapLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadBitmapErrorHandler);
try {
loaderContext = new LoaderContext();
loaderContext.checkPolicyFile = checkPolicyFile;
bitmapLoader.load(request, loaderContext);
_loaderUrls[bitmapLoader] = file;
_loadingIdle = false;
PaperLogger.info(("BitmapFileMaterial: Loading bitmap from " + file));
} catch(error:Error) {
_waitingBitmaps.shift();
_loadingIdle = true;
PaperLogger.info(("[ERROR] BitmapFileMaterial: Unable to load file " + error.message));
};
}
protected function getBitmapForFilename(_arg1:String):BitmapData{
var _local2:*;
var _local3:BitmapFileMaterial;
for (_local2 in _bitmapMaterials) {
_local3 = (_local2 as BitmapFileMaterial);
if (_local3.url == _arg1){
return (_local3.bitmap);
};
};
return (null);
}
protected function loadBitmapErrorHandler(_arg1:IOErrorEvent):void{
var _local2:String;
var _local3:FileLoadEvent;
_local2 = String(_waitingBitmaps.shift());
_subscribedMaterials[_local2] = null;
this.errorLoading = true;
this.lineColor = ERROR_COLOR;
this.lineAlpha = 1;
this.lineThickness = 1;
Debug.writeError(("could not find Bitmap: " + _local2));
removeLoaderListeners();
if (_waitingBitmaps.length > 0){
loadNextBitmap();
} else {
_loadingIdle = true;
if (Boolean(callback)){
callback();
};
};
_local3 = new FileLoadEvent(FileLoadEvent.LOAD_ERROR, _local2, -1, -1, _arg1.text);
dispatchEvent(_local3);
}
protected function createBitmapFromURL(_arg1:String):BitmapData{
var _local2:BitmapData;
if (_arg1 == ""){
return (null);
};
_local2 = getBitmapForFilename(_arg1);
if (_local2){
bitmap = super.createBitmap(_local2);
setupAsyncLoadCompleteCallback();
return (_local2);
};
queueBitmap(_arg1);
return (null);
}
private function queueBitmap(_arg1:String):void{
if (!_subscribedMaterials[_arg1]){
_waitingBitmaps.push(_arg1);
_subscribedMaterials[_arg1] = new Array();
};
_subscribedMaterials[_arg1].push(this);
if (_loadingIdle){
loadNextBitmap();
};
}
protected function dispatchAsyncLoadCompleteEvent(_arg1:TimerEvent):void{
loadComplete();
}
public function get bitmapMaterials():Dictionary{
return (_bitmapMaterials);
}
protected function loadBitmapProgressHandler(_arg1:ProgressEvent):void{
var _local2:FileLoadEvent;
_local2 = new FileLoadEvent(FileLoadEvent.LOAD_PROGRESS, url, _arg1.bytesLoaded, _arg1.bytesTotal);
global.progressbar.progressChange(((_local2.bytesLoaded / _local2.bytesTotal) * 100), file, _local2.bytesTotal);
dispatchEvent(_local2);
}
}
}//package org.papervision3d.materials
Section 176
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.command.*;
import flash.geom.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
import lt.uza.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
import org.papervision3d.core.material.*;
public class BitmapMaterial extends TriangleMaterial implements ITriangleDrawer {
protected var _precise:Boolean;
public var uvMatrices:Dictionary;
var at:Number;
public var precisionMode:int;
var bt:Number;
var u0:Number;
var u1:Number;
var u2:Number;
public var minimumRenderSize:Number;// = 4
var h:Number;
var w:Number;
var ct:Number;
var v2:Number;
var m:Matrix;
var v0:Number;
var v1:Number;
var dt:Number;
protected var _perPixelPrecision:int;// = 8
private var global:Global;
private var x0:Number;
private var x1:Number;
private var x2:Number;
var mapping:Matrix;
private var y0:Number;
private var y1:Number;
private var y2:Number;
protected var _texture:Object;
protected var focus:Number;// = 200
protected var _precision:int;// = 8
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){
global = Global.getInstance();
focus = 200;
_precision = 8;
_perPixelPrecision = 8;
minimumRenderSize = 4;
precisionMode = PrecisionMode.ORIGINAL;
uvMatrices = new Dictionary();
super();
if (_arg1){
texture = _arg1;
};
this.precise = _arg2;
}
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{
}
protected function createRenderRecStorage():void{
}
public function transformUVRT(_arg1:RenderTriangle):Matrix{
if (bitmap){
w = (bitmap.width * maxU);
h = (bitmap.height * maxV);
u0 = (w * _arg1.uv0.u);
v0 = (h * (1 - _arg1.uv0.v));
u1 = (w * _arg1.uv1.u);
v1 = (h * (1 - _arg1.uv1.v));
u2 = (w * _arg1.uv2.u);
v2 = (h * (1 - _arg1.uv2.v));
if ((((((u0 == u1)) && ((v0 == v1)))) || ((((u0 == u2)) && ((v0 == v2)))))){
u0 = (u0 - ((u0)>0.05) ? 0.05 : -0.05);
v0 = (v0 - ((v0)>0.07) ? 0.07 : -0.07);
};
if ((((u2 == u1)) && ((v2 == v1)))){
u2 = (u2 - ((u2)>0.05) ? 0.04 : -0.04);
v2 = (v2 - ((v2)>0.06) ? 0.06 : -0.06);
};
at = (u1 - u0);
bt = (v1 - v0);
ct = (u2 - u0);
dt = (v2 - v0);
m = new Matrix(at, bt, ct, dt, u0, v0);
if (Papervision3D.useRIGHTHANDED){
m.scale(-1, 1);
m.translate(w, 0);
};
m.invert();
mapping = (uvMatrices[_arg1] = m.clone());
mapping.a = m.a;
mapping.b = m.b;
mapping.c = m.c;
mapping.d = m.d;
mapping.tx = m.tx;
mapping.ty = m.ty;
} else {
PaperLogger.error("MaterialObject3D: transformUV() material.bitmap not found!");
};
return (mapping);
}
public function resetUVS():void{
uvMatrices = new Dictionary(false);
}
public function get texture():Object{
return (this._texture);
}
public function set pixelPrecision(_arg1:int):void{
_precision = ((_arg1 * _arg1) * 1.4);
_perPixelPrecision = _arg1;
}
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);
}
protected function createBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
resetMapping();
this.maxU = (this.maxV = 1);
_local2 = _arg1;
return (_local2);
}
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 clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = super.clone();
_local1.maxU = this.maxU;
_local1.maxV = this.maxV;
return (_local1);
}
public function get precise():Boolean{
return (_precise);
}
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 (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(bitmap, _localMatrix, tiled, smooth);
_arg2.moveTo(x0, y0);
_arg2.lineTo(x1, y1);
_arg2.lineTo(x2, y2);
_arg2.lineTo(x0, y0);
_arg2.endFill();
};
_arg3.renderStatistics.triangles++;
}
override public function toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
override public function copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
public function get precision():int{
return (_precision);
}
public function resetMapping(_arg1=null):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++;
};
};
}
override public function destroy():void{
super.destroy();
if (uvMatrices){
uvMatrices = null;
};
if (bitmap){
bitmap.dispose();
};
}
public function set precision(_arg1:int):void{
_precision = _arg1;
}
}
}//package org.papervision3d.materials
Section 177
//ColorMaterial (org.papervision3d.materials.ColorMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 178
//MovieAssetMaterial (org.papervision3d.materials.MovieAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
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 179
//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 quality:String;
private var materialIsUsed:Boolean;// = false
private var autoClipRect:Rectangle;
public var movie:DisplayObject;
private var stage:Stage;
private var userClipRect:Rectangle;
protected var recreateBitmapInSuper:Boolean;
public var allowAutoResize:Boolean;// = false
private var movieAnimated:Boolean;
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 get texture():Object{
return (this._texture);
}
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 set animated(_arg1:Boolean):void{
movieAnimated = _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);
};
};
}
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);
}
protected function createBitmapFromSprite(_arg1:DisplayObject):BitmapData{
movie = _arg1;
initBitmap(movie);
drawBitmap();
bitmap = super.createBitmap(bitmap);
return (bitmap);
}
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 180
//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 181
//Plane (org.papervision3d.objects.primitives.Plane)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.math.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
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 182
//Sphere (org.papervision3d.objects.primitives.Sphere)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.math.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
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 - 0));
_local22 = _local9[_local3][(_local21) ? 0 : _local2];
_local23 = _local9[_local3][(((_local2 == 0)) ? _local20 : _local2 - 1)];
_local24 = _local9[(_local3 - 1)][(((_local2 == 0)) ? _local20 : _local2 - 1)];
_local25 = _local9[(_local3 - 1)][(_local21) ? 0 : _local2];
_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 183
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import flash.display.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.shaders.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.log.*;
import lt.uza.utils.*;
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 _target:Number3D;
private var _yAxis:Number3D;
var screenZs:Number;// = 0
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 _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;
var numchildren:Number;// = 0
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
private var global:Global;
public var faces:Array;
protected var _sorted:Array;
public var enableProfiling:Boolean;// = false
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;
global = Global.getInstance();
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;
_target = 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;
enableProfiling = false;
screenZs = 0;
numchildren = 0;
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: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){
this.view.calculateMultiply(_arg1.view, this.transform);
} else {
this.view.calculateMultiply(_arg2.camera.eye, this.transform);
};
if (_autoCalcScreenCoords){
calculateScreenCoords(_arg2.camera);
};
screenZs = 0;
numchildren = 0;
for each (_local3 in this._childrenByName) {
if (_local3.visible){
screenZs = (screenZs + _local3.project(this, _arg2));
numchildren++;
};
};
return ((this.screenZ = (screenZs / numchildren)));
}
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)){
_target.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);
};
_target.reset(_arg1.world.n14, _arg1.world.n24, _arg1.world.n34);
};
_zAxis.copyFrom(_target);
_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: " + name) + " at ") + _arg1.name));
};
}
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 get sceneZ():Number{
return (this.world.n34);
}
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 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 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 184
//BasicRenderEngine (org.papervision3d.render.BasicRenderEngine)
package org.papervision3d.render {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
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 lt.uza.utils.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.clipping.*;
import org.papervision3d.core.render.filter.*;
import org.papervision3d.core.render.project.*;
import org.papervision3d.core.render.sort.*;
import org.papervision3d.events.*;
import org.papervision3d.core.utils.*;
public class BasicRenderEngine extends AbstractRenderEngine implements IRenderEngine {
public var projectionPipeline:ProjectionPipeline;
private var global:Global;
var viewport:Viewport3D;
protected var projectionDoneEvent:RendererEvent;
var rc:RenderableListItem;
public var sorter:IRenderSorter;
protected var renderList:Array;
public var clipping:DefaultClipping;
protected var renderStatistics:RenderStatistics;
protected var renderDoneEvent:RendererEvent;
protected var cleanRHD:RenderHitData;
protected var renderSessionData:RenderSessionData;
protected var stopWatch:StopWatch;
var vpl:ViewportLayer;
public var filter:IRenderFilter;
public function BasicRenderEngine():void{
global = Global.getInstance();
cleanRHD = new RenderHitData();
super();
init();
}
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;
_arg3.updateBeforeRender(renderSessionData);
projectionPipeline.project(renderSessionData);
doRender(renderSessionData, null);
return (renderSessionData.renderStatistics);
}
protected function doRender(_arg1:RenderSessionData, _arg2:Array=null):RenderStatistics{
MaterialManager.getInstance().updateMaterialsBeforeRender(_arg1);
sorter.sort(renderList);
viewport = _arg1.viewPort;
vpl = viewport.containerSprite;
while ((rc = renderList.pop())) {
vpl = viewport.accessLayerFor(rc, false);
rc.render(_arg1, vpl.graphicsChannel);
viewport.lastRenderList.push(rc);
vpl.processRenderItem(rc);
};
MaterialManager.getInstance().updateMaterialsAfterRender(_arg1);
_arg1.viewPort.updateAfterRender(_arg1);
return (renderStatistics);
}
override public function removeFromRenderList(_arg1:IRenderListItem):int{
return (renderList.splice(renderList.indexOf(_arg1), 1));
}
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 185
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import org.papervision3d.core.proto.*;
public class Scene3D extends SceneObject3D {
}
}//package org.papervision3d.scenes
Section 186
//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 187
//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 188
//ViewportLayer (org.papervision3d.view.layer.ViewportLayer)
package org.papervision3d.view.layer {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.log.*;
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){
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;
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){
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 189
//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 190
//Viewport3D (org.papervision3d.view.Viewport3D)
package org.papervision3d.view {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import flash.utils.*;
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 org.papervision3d.core.culling.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.view.*;
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 191
//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 192
//assetHolder (assetHolder)
package {
import flash.display.*;
public dynamic class assetHolder extends MovieClip {
public function assetHolder(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 193
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
}
}//package
Section 194
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
}
}//package
Section 195
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
}
}//package
Section 196
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
}
}//package
Section 197
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
}
}//package
Section 198
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
}
}//package
Section 199
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
}
}//package
Section 200
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
}
}//package
Section 201
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
}
}//package
Section 202
//cloud01 (cloud01)
package {
import flash.display.*;
public dynamic class cloud01 extends BitmapData {
public function cloud01(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 203
//cloud3 (cloud3)
package {
import flash.display.*;
public dynamic class cloud3 extends BitmapData {
public function cloud3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 204
//cloud4 (cloud4)
package {
import flash.display.*;
public dynamic class cloud4 extends BitmapData {
public function cloud4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 205
//cloud5 (cloud5)
package {
import flash.display.*;
public dynamic class cloud5 extends BitmapData {
public function cloud5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 206
//cloud6 (cloud6)
package {
import flash.display.*;
public dynamic class cloud6 extends BitmapData {
public function cloud6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 207
//crosshair1 (crosshair1)
package {
import flash.display.*;
import jet.*;
public dynamic class crosshair1 extends MovieClip {
public var crossMain:MovieClip;
public var Help:help;
}
}//package
Section 208
//crosshair2 (crosshair2)
package {
import flash.display.*;
public dynamic class crosshair2 extends MovieClip {
}
}//package
Section 209
//crosshair3 (crosshair3)
package {
import flash.display.*;
public dynamic class crosshair3 extends MovieClip {
}
}//package
Section 210
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 211
//halo (halo)
package {
import flash.display.*;
public dynamic class halo extends BitmapData {
public function halo(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 212
//Main (Main)
package {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.ui.*;
import jet.*;
import flash.utils.*;
import lt.uza.utils.*;
import gamework.events.*;
import flash.net.*;
import gamework.ui.*;
import flash.text.*;
import gamework.preloaders.*;
import flash.system.*;
public class Main extends MovieClip {
public var app_preloader:ApplicationPreloader;
private var titleScreen;
private var titleStarted:Boolean;// = false
public var ad:MovieClip;
public var adLoader:Loader;
private var STATE_SYSTEM_TITLE:int;// = 1
private var Sounds;
private var isIngame:Boolean;
public var BigWigGameData:Object;
private var global:Global;
public var assetholder:assetHolder;
private var percentLoaded:int;
private var gameState:int;
private var STATE_SYSTEM_LOADER:int;// = 0
private var loaderStarted:Boolean;// = false
private var loadingBox;
public function Main():void{
var _local1:keyboard;
global = Global.getInstance();
STATE_SYSTEM_LOADER = 0;
STATE_SYSTEM_TITLE = 1;
gameState = STATE_SYSTEM_LOADER;
loaderStarted = false;
titleStarted = false;
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
global.main = this;
global.URL = this.loaderInfo.url;
_local1 = new keyboard();
}
private function initgame():void{
var _local1:*;
var _local2:*;
var _local3:Dictionary;
_local1 = getChildByName("assetholder");
removeChild(_local1);
stage.quality = StageQuality.MEDIUM;
_local2 = new loadsave();
_local3 = new Dictionary();
global.dictArchchievementObjects = _local3;
titleScreen = new TitleScreen();
global.uiDigits = titleScreen.getChildByName("uidigits");
global.disp_kmh = global.uiDigits.getChildByName("kmh");
global.disp_alt = global.uiDigits.getChildByName("altitude");
global.disp_score = global.uiDigits.getChildByName("disp_Score");
global.hud_horizon = titleScreen.getChildByName("hud_horizon");
global.tetris = titleScreen.getChildByName("Tetris");
global.cargoBay = titleScreen.getChildByName("cargoBay");
global.multi_flash = titleScreen.getChildByName("mulflash");
global.flash_green = titleScreen.getChildByName("flashGreen");
global.flash_orange = titleScreen.getChildByName("flashOrange");
global.flash_blue = titleScreen.getChildByName("flashBlue");
global.mini_roll = global.uiDigits.getChildByName("mini_roll");
global.mini_alt = global.uiDigits.getChildByName("mini_alt");
global.mini_pit = global.uiDigits.getChildByName("mini_pit");
global.mini_yaw = global.uiDigits.getChildByName("mini_yaw");
global.whitefade = titleScreen.getChildByName("whitefade");
global.sounds = new sounds();
global.sounds.dotitlesounds();
addChildAt(titleScreen, 0);
global.loadsave.setDisplay();
}
public function onAdCompleteHandler(_arg1:Event):void{
var e = _arg1;
adLoader.contentLoaderInfo.sharedEvents.removeEventListener("BigwigInGameAdComplete", onAdCompleteHandler);
try {
adLoader.unload();
} catch(error:Error) {
};
try {
ad.removeChild(adLoader);
} catch(error:Error) {
};
adLoader = null;
play();
}
public function getBigWigWrappedGameData():Object{
return (BigWigGameData);
}
function frame3(){
stop();
initgame();
}
function frame1(){
this.contextMenu = ApplicationContextMenu.getMenu();
BigWigGameData = {};
Security.allowDomain("adserver.bigwigmedia.com");
if (Security.sandboxType != Security.LOCAL_WITH_FILE){
stop();
adLoader = new Loader();
ad.addChild(adLoader);
adLoader.contentLoaderInfo.sharedEvents.addEventListener("BigwigInGameAdComplete", onAdCompleteHandler);
adLoader.load(new URLRequest("http://adserver.bigwigmedia.com/ingamead3.swf"));
};
showBigWigAd(1743);
}
function frame2(){
app_preloader.addEventListener(PreloaderEvent.COMPLETE, onPreloaderComplete);
stop();
}
private function openCargo():void{
var _local1:Game;
_local1 = new Game();
global.cargobay.blendout(global.game.startFlight);
}
public function onPreloaderComplete(_arg1:PreloaderEvent):void{
app_preloader.removeEventListener(PreloaderEvent.COMPLETE, onPreloaderComplete);
gotoAndPlay("gamestart");
}
public function launchNewFlight():void{
global.isNewGame = true;
if (global.isIngame){
global.whitefade.play();
global.game.destroy();
global.cargobay.blendinFinishFunc2 = openCargo;
global.menu.blendout(global.cargobay.blendin);
} else {
global.loadsave.saveProgress();
global.menu.blendout(openCargo);
global.isIngame = true;
};
}
public function removeAndKill(_arg1:DisplayObject):void{
removeChild(_arg1);
_arg1 = null;
}
public function showBigWigAd(_arg1:int):void{
BigWigGameData.url = this.loaderInfo.url;
BigWigGameData.gameid = _arg1;
BigWigGameData.affid = this.loaderInfo.parameters.affid;
}
}
}//package
Section 213
//menu_credits (menu_credits)
package {
import flash.display.*;
public dynamic class menu_credits extends MovieClip {
public var OKcredits:MovieClip;
public var Jomeilinkbutt:MovieClip;
}
}//package
Section 214
//moon (moon)
package {
import flash.display.*;
public dynamic class moon extends BitmapData {
public function moon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 215
//mulFlash (mulFlash)
package {
import flash.display.*;
public dynamic class mulFlash extends MovieClip {
public function mulFlash(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 216
//orb1 (orb1)
package {
import flash.display.*;
public dynamic class orb1 extends MovieClip {
public function orb1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 217
//orb2 (orb2)
package {
import flash.display.*;
public dynamic class orb2 extends MovieClip {
public function orb2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 218
//orb3 (orb3)
package {
import flash.display.*;
public dynamic class orb3 extends MovieClip {
public function orb3(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 219
//orb4 (orb4)
package {
import flash.display.*;
public dynamic class orb4 extends MovieClip {
}
}//package
Section 220
//orb5 (orb5)
package {
import flash.display.*;
public dynamic class orb5 extends MovieClip {
}
}//package
Section 221
//orb6 (orb6)
package {
import flash.display.*;
public dynamic class orb6 extends MovieClip {
}
}//package
Section 222
//orb7 (orb7)
package {
import flash.display.*;
public dynamic class orb7 extends MovieClip {
}
}//package
Section 223
//orb8 (orb8)
package {
import flash.display.*;
public dynamic class orb8 extends MovieClip {
}
}//package
Section 224
//snd_altlevelup (snd_altlevelup)
package {
import flash.media.*;
public dynamic class snd_altlevelup extends Sound {
}
}//package
Section 225
//snd_buttonblip (snd_buttonblip)
package {
import flash.media.*;
public dynamic class snd_buttonblip extends Sound {
}
}//package
Section 226
//snd_cash (snd_cash)
package {
import flash.media.*;
public dynamic class snd_cash extends Sound {
}
}//package
Section 227
//snd_multi (snd_multi)
package {
import flash.media.*;
public dynamic class snd_multi extends Sound {
}
}//package
Section 228
//snd_multiout (snd_multiout)
package {
import flash.media.*;
public dynamic class snd_multiout extends Sound {
}
}//package
Section 229
//snd_plusminus (snd_plusminus)
package {
import flash.media.*;
public dynamic class snd_plusminus extends Sound {
}
}//package
Section 230
//snd_redcross (snd_redcross)
package {
import flash.media.*;
public dynamic class snd_redcross extends Sound {
}
}//package
Section 231
//snd_spdlevelup (snd_spdlevelup)
package {
import flash.media.*;
public dynamic class snd_spdlevelup extends Sound {
}
}//package
Section 232
//sound_catchA (sound_catchA)
package {
import flash.media.*;
public dynamic class sound_catchA extends Sound {
}
}//package
Section 233
//sound_catchC (sound_catchC)
package {
import flash.media.*;
public dynamic class sound_catchC extends Sound {
}
}//package
Section 234
//sound_catchE (sound_catchE)
package {
import flash.media.*;
public dynamic class sound_catchE extends Sound {
}
}//package
Section 235
//sound_drone (sound_drone)
package {
import flash.media.*;
public dynamic class sound_drone extends Sound {
}
}//package
Section 236
//sound_nostromo (sound_nostromo)
package {
import flash.media.*;
public dynamic class sound_nostromo extends Sound {
}
}//package
Section 237
//star (star)
package {
import flash.display.*;
public dynamic class star extends MovieClip {
}
}//package
Section 238
//sun (sun)
package {
import flash.display.*;
public dynamic class sun extends BitmapData {
public function sun(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 239
//tex_levelup (tex_levelup)
package {
import flash.display.*;
public dynamic class tex_levelup extends MovieClip {
}
}//package
Section 240
//TitleScreen (TitleScreen)
package {
import flash.display.*;
import jet.*;
public dynamic class TitleScreen extends MovieClip {
public var flashGreen:MovieClip;
public var whitefade:MovieClip;
public var flashOrange:MovieClip;
public var Tetris:tetris;
public var menu:menu;
public var flashBlue:MovieClip;
public var uidigits:ui_digits;
public var mulflash:mulFlash;
public var cargoBay:cargobay;
}
}//package
Section 241
//ui_digits (ui_digits)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ui_digits extends MovieClip {
public var kmh:TextField;
public var mini_yaw:TextField;
public var disp_Score:TextField;
public var altitude:TextField;
public var mini_pit:TextField;
public var mini_alt:TextField;
public var mini_roll:TextField;
}
}//package
Section 242
//world2048 (world2048)
package {
import flash.display.*;
public dynamic class world2048 extends BitmapData {
public function world2048(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package