diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..9f88788
Binary files /dev/null and b/.DS_Store differ
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..37f326a
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "as3mxml.sdk.framework": "/Users/tubix/Documents/AIR_SDKs/sdk4.9.1"
+}
\ No newline at end of file
diff --git a/AlternativaEditor-app.xml b/AlternativaEditor-app.xml
new file mode 100644
index 0000000..9f0d215
--- /dev/null
+++ b/AlternativaEditor-app.xml
@@ -0,0 +1,410 @@
+
+
+
+
+
+
+ AlternativaEditor
+
+
+ AlternativaEditor
+
+
+
+
+
+
+
+
+ 1.0.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AlternativaEditor.swf
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1280
+
+
+ 720
+
+
+
+
+
+
+
+
+ 800 600
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ direct
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/asconfig.json b/asconfig.json
new file mode 100644
index 0000000..35ebac7
--- /dev/null
+++ b/asconfig.json
@@ -0,0 +1,10 @@
+{
+ "config": "air",
+ "compilerOptions": {
+ "source-path": ["src"],
+ "library-path": ["libs"],
+ "output": "bin/AlternativaEditor.swf"
+ },
+ "mainClass": "AlternativaEditor",
+ "application": "AlternativaEditor-app.xml"
+}
\ No newline at end of file
diff --git a/bin/AlternativaEditor-app.xml b/bin/AlternativaEditor-app.xml
new file mode 100644
index 0000000..9f0d215
--- /dev/null
+++ b/bin/AlternativaEditor-app.xml
@@ -0,0 +1,410 @@
+
+
+
+
+
+
+ AlternativaEditor
+
+
+ AlternativaEditor
+
+
+
+
+
+
+
+
+ 1.0.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AlternativaEditor.swf
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1280
+
+
+ 720
+
+
+
+
+
+
+
+
+ 800 600
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ direct
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bin/AlternativaEditor.swf b/bin/AlternativaEditor.swf
new file mode 100644
index 0000000..6634f96
Binary files /dev/null and b/bin/AlternativaEditor.swf differ
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 0000000..d8d844a
Binary files /dev/null and b/src/.DS_Store differ
diff --git a/.gitattributes b/src/.gitattributes
similarity index 100%
rename from .gitattributes
rename to src/.gitattributes
diff --git a/src/AlternativaEditor.mxml b/src/AlternativaEditor.mxml
new file mode 100644
index 0000000..342000c
--- /dev/null
+++ b/src/AlternativaEditor.mxml
@@ -0,0 +1,816 @@
+
+
+
+
+ 0)
+ {
+ this.onImportStart(null);
+ this.importManager.clearScene();
+ this.importManager.startImport(File(loc2[0]));
+ }
+ else
+ {
+ this.libraryManager.loadGivenLibraries(loc2);
+ }
+ }
+
+ private function onBatchProcessingComplete(param1:Event):void
+ {
+ this.hideProgressBar();
+ }
+
+ private function onBatchProcessingProgress(param1:EditorProgressEvent):void
+ {
+ this.progressBar.setProgress(param1.progress, 1);
+ }
+
+ private function initFunctionalLibrary():void
+ {
+ this.libraryManager.addLibrary(FunctionalProps.getFunctionalLibrary());
+ this.cbPropLibNames.selectedItem = "Functional";
+ this.onComboBoxChange(null);
+ }
+
+ private function initMenuItems():void
+ {
+ this.miVisulaGeometry = this.getMenuItem(2, 0);
+ this.miCollisionGeometry = this.getMenuItem(2, 1);
+ this.miShowGrid = this.getMenuItem(2, 4);
+ this.miSnap = this.getMenuItem(4, 1);
+ this.miUnlock = this.getMenuItemByLabel("All intersections allowed");
+ this.miLockGroup = this.getMenuItemByLabel("Same props intersections denied");
+ this.miLock = this.getMenuItemByLabel("All intersections denied");
+ this.miShowLayers = this.getMenuItem(2, 5);
+ }
+
+ private function getMenuItem(...rest):NativeMenuItem
+ {
+ var loc2:NativeMenuItem = menu.nativeMenu.getItemAt(rest[0]);
+ var loc3:int = 1;
+ while (loc3 < rest.length)
+ {
+ loc2 = loc2.submenu.getItemAt(rest[loc3]);
+ loc3++;
+ }
+ return loc2;
+ }
+
+ private function getMenuItemByLabel(param1:String, param2:NativeMenu = null):NativeMenuItem
+ {
+ var loc4:NativeMenuItem = null;
+ if (!param2)
+ {
+ param2 = this.menu.nativeMenu;
+ }
+ var loc3:int = 0;
+ while (loc3 < param2.numItems)
+ {
+ loc4 = param2.getItemAt(loc3);
+ if (loc4.label == param1)
+ {
+ return loc4;
+ }
+ if (Boolean(loc4.submenu) && Boolean(this.getMenuItemByLabel(param1, loc4.submenu)))
+ {
+ return this.getMenuItemByLabel(param1, loc4.submenu);
+ }
+ loc3++;
+ }
+ return null;
+ }
+
+ private function onPropSelect(param1:PropListEvent):void
+ {
+ preview.showProp(param1.selectedItem);
+ this.workspace.setFocus();
+ this.cursorScene.object = param1.selectedItem.clone();
+ }
+
+ private function onPropListClick(param1:MouseEvent):void
+ {
+ this.workspace.setFocus();
+ }
+
+ private function onLibraryManagerChange(param1:Event):void
+ {
+ this.cursorScene.clear();
+ var loc2:Array = this.libraryManager.libraryNames;
+ this.cbPropLibNames.selectedItem = loc2[loc2.length - 1];
+ this.onComboBoxChange(null);
+ this.hideProgressBar();
+ }
+
+ private function onKeyDown(param1:KeyboardEvent):void
+ {
+ var loc2:Prop = null;
+ switch (param1.keyCode)
+ {
+ case KeyboardUtils.SPACE:
+ if (!this.showCollisionGeometry)
+ {
+ if (this.cursorScene.visible)
+ {
+ loc2 = this.cursorScene.object;
+ if (loc2)
+ {
+ this.sceneContainer.addProp(loc2);
+ break;
+ }
+ Alert.show("Select prop for pasting!");
+ break;
+ }
+ if (this.propertyPanel.enabled && this.showPropertyButton.down && this.mainScene.isTexturePanel)
+ {
+ this.mainScene.onTexturePanelSelect();
+ }
+ break;
+ }
+ }
+ this.workspace.setFocus();
+ }
+
+ private function toggleSnapMode():void
+ {
+ this.setSnapping(!this.snappingEnabled);
+ }
+
+ private function setSnapping(param1:Boolean):void
+ {
+ this.snappingEnabled = param1;
+ this.sceneContainer.snapMode = param1;
+ this.miSnap.checked = param1;
+ this.snapButton.down = param1;
+ }
+
+ private function toggleGrid():void
+ {
+ this.showGrid = !this.showGrid;
+ this.btnToggleGrid.down = this.showGrid;
+ this.miShowGrid.checked = this.showGrid;
+ if (this.showGrid)
+ {
+ this.mainScene.showGrid();
+ }
+ else
+ {
+ this.mainScene.hideGrid();
+ }
+ }
+
+ private function showPropertyPanel():void
+ {
+ if (this.showPropertyButton.down)
+ {
+ this.vbox.addChild(this.propertyPanel);
+ }
+ else
+ {
+ this.vbox.removeChild(this.propertyPanel);
+ }
+ }
+
+ private function toggleGeometryViewMode():void
+ {
+ this.showCollisionGeometry = !this.showCollisionGeometry;
+ this.viewButton.down = this.showCollisionGeometry;
+ this.miVisulaGeometry.checked = !this.showCollisionGeometry;
+ this.miCollisionGeometry.checked = this.showCollisionGeometry;
+ if (this.showCollisionGeometry)
+ {
+ this.mainScene.showCollisionBoxes();
+ }
+ else
+ {
+ this.mainScene.hideCollisionBoxes();
+ }
+ }
+
+ private function onComboBoxChange(param1:Event):void
+ {
+ var loc2:Array = null;
+ var loc3:int = 0;
+ var loc4:Prop = null;
+ this.proplistPanel.deleteAllProps();
+ if (this.cbPropLibNames.selectedLabel)
+ {
+ loc2 = this.libraryManager.getPropsByLibName(this.cbPropLibNames.selectedLabel);
+ loc3 = 0;
+ while (loc3 < loc2.length)
+ {
+ loc4 = loc2[loc3];
+ this.proplistPanel.addProp(loc4.groupName, loc4.name, loc4.icon, loc4);
+ loc3++;
+ }
+ }
+ }
+
+ private function onSelectionTypeChange(param1:Event):void
+ {
+ switch (this.typeSelecting.selectedIndex)
+ {
+ case 0:
+ this.mainScene.selectablePropTypes = DEFAULT_SELECTABLE_TYPES;
+ break;
+ case 1:
+ this.mainScene.selectablePropTypes = [MeshProp];
+ break;
+ case 2:
+ this.mainScene.selectablePropTypes = [Sprite3DProp];
+ break;
+ case 3:
+ this.mainScene.selectablePropTypes = [SpawnPoint, BonusRegion, CTFFlagBase, ControlPoint, FreeBonusRegion];
+ }
+ this.workspace.setFocus();
+ }
+
+ private function hideSelectedProps():void
+ {
+ this.mainScene.hideSelectedProps();
+ }
+
+ private function showAll():void
+ {
+ this.mainScene.showAll();
+ }
+
+ private function onBatchFileSelect(param1:Event):void
+ {
+ this.showProgressBar("Batch processing");
+ this.progressBar.setProgress(0, 1);
+ this.batchProcessor.run(this.batchSelector.getDirectoryListing());
+ }
+
+ private function menuHandler(param1:FlexNativeMenuEvent):void
+ {
+ var handlerName:String = param1.item.@click;
+
+ var loc2:Function = this[handlerName];
+ //var loc2:Function = param1.item.@click;
+ if (loc2 != null)
+ {
+ loc2.call(this, param1.nativeMenuItem);
+ }
+ this.workspace.setFocus();
+ }
+
+ private function onNewLevelClick(param1:NativeMenuItem):void
+ {
+ var item:NativeMenuItem = param1;
+ if (this.mainScene.changed)
+ {
+ Alert.show("Discard changes?", "Scene has been changed", Alert.YES | Alert.CANCEL, null, function(param1:CloseEvent):void
+ {
+ if (param1.detail == Alert.YES)
+ {
+ newLevel();
+ }
+ });
+ }
+ else
+ {
+ this.newLevel();
+ }
+ }
+
+ private function newLevel():void
+ {
+ this.mainScene.clear();
+ this.cursorScene.updateMaterial();
+ }
+
+ private function onImportFromTanksClick(param1:NativeMenuItem):void
+ {
+ var item:NativeMenuItem = param1;
+ if (this.mainScene.changed)
+ {
+ Alert.show("Discard changes?", "Scene has been changed", Alert.YES | Alert.CANCEL, null, function(param1:CloseEvent):void
+ {
+ if (param1.detail == Alert.YES)
+ {
+ importFromXML();
+ }
+ });
+ }
+ else
+ {
+ this.importFromXML();
+ }
+ }
+
+ private function importFromXML():void
+ {
+ this.importManager.clearScene();
+ this.importManager.importFromXML();
+ }
+
+ private function appendFromXMLClick(param1:NativeMenuItem):void
+ {
+ this.importManager.importFromXML();
+ }
+
+ private function specialAppendFromXMLClick(param1:Event):void
+ {
+ this.importManager.importFromXML(true);
+ }
+
+ private function onImportStart(param1:Event):void
+ {
+ this.showProgressBar("Importing level");
+ }
+
+ private function onImportProgress(param1:EditorProgressEvent):void
+ {
+ this.progressBar.setProgress(param1.progress, 1);
+ }
+
+ private function onImportComplete(param1:Event):void
+ {
+ this.hideProgressBar();
+ }
+
+ private function onExportToTanksV1Click(param1:NativeMenuItem):void
+ {
+ this.exportManager.exportMap(FileType.MAP_XML_VERSION_1_LITE);
+ }
+
+ private function onExportToTanksV1FullClick(param1:Event):void
+ {
+ this.exportManager.exportMap(FileType.MAP_XML_VERSION_1_FULL);
+ }
+
+ private function onExportToTanksV3Click(param1:NativeMenuItem):void
+ {
+ this.exportManager.exportMap(FileType.MAP_XML_VERSION_3);
+ }
+
+ private function onBatchProcessingClick(param1:NativeMenuItem):void
+ {
+ this.batchSelector.browseForDirectory("Levels");
+ }
+
+ private function onUndoClick(param1:NativeMenuItem):void
+ {
+ this.sceneContainer.undo();
+ }
+
+ private function onRedoClick(param1:NativeMenuItem):void
+ {
+ this.sceneContainer.redo();
+ }
+
+ private function onClearLevelClick(param1:NativeMenuItem):void
+ {
+ this.mainScene.clear();
+ this.mainScene.changed = true;
+ this.cursorScene.updateMaterial();
+ }
+
+ private function onSelectAll(param1:NativeMenuItem):void
+ {
+ this.mainScene.selectAll();
+ }
+
+ private function onClearAndLoadLibClick(param1:NativeMenuItem):void
+ {
+ this.libraryManager.clearAndLoadLibrary();
+ }
+
+ private function onLoadLibClick(param1:NativeMenuItem):void
+ {
+ this.libraryManager.loadLibrary();
+ }
+
+ private function onStartLibLoading(param1:Event):void
+ {
+ this.showProgressBar("Loading libraries");
+ }
+
+ private function onLibraryLoadingProgress(param1:EditorProgressEvent):void
+ {
+ this.progressBar.setProgress(param1.progress, 1);
+ }
+
+ public function onToggleIntersectionCheckMode(param1:NativeMenuItem):void
+ {
+ this.getMenuItemByLabel("All intersections allowed").checked = false;
+ this.getMenuItemByLabel("Same props intersections denied").checked = false;
+ this.getMenuItemByLabel("All intersections denied").checked = false;
+ switch (param1)
+ {
+ case this.getMenuItemByLabel("All intersections allowed"):
+ this.sceneContainer.multiplePropMode = MultiPropMode.ANY;
+ break;
+ case this.getMenuItemByLabel("Same props intersections denied"):
+ this.sceneContainer.multiplePropMode = MultiPropMode.GROUP;
+ break;
+ case this.getMenuItemByLabel("All intersections denied"):
+ this.sceneContainer.multiplePropMode = MultiPropMode.NONE;
+ }
+ param1.checked = true;
+ }
+
+ private function onToggleGeometryClick(param1:NativeMenuItem):void
+ {
+ if (param1 == this.miCollisionGeometry && !this.showCollisionGeometry || param1 == this.miVisulaGeometry && this.showCollisionGeometry)
+ {
+ this.toggleGeometryViewMode();
+ }
+ else
+ {
+ param1.checked = true;
+ }
+ }
+
+ private function onSnapClick(param1:NativeMenuItem):void
+ {
+ this.toggleSnapMode();
+ }
+
+ private function onShowBoundBoxesClick(param1:NativeMenuItem):void
+ {
+ this.sceneContainer.showBoundBoxes = !this.sceneContainer.showBoundBoxes;
+ param1.checked = this.sceneContainer.showBoundBoxes;
+ }
+
+ private function onShowGridClick(param1:NativeMenuItem):void
+ {
+ this.toggleGrid();
+ }
+
+ private function onHelpClick(param1:NativeMenuItem):void
+ {
+ Alert.show(helpText, "Help");
+ }
+
+ private function showProgressBar(param1:String):void
+ {
+ if (this.progressBar == null)
+ {
+ this.progressBar = PopUpProgressBar(PopUpManager.createPopUp(this, PopUpProgressBar, true));
+ }
+ this.progressBar.setLabel(param1);
+ }
+
+ private function hideProgressBar():void
+ {
+ if (this.progressBar != null)
+ {
+ PopUpManager.removePopUp(this.progressBar);
+ this.progressBar = null;
+ }
+ }
+
+ private function onObjectGroupCheckboxChange(param1:Event):void
+ {
+ }
+
+ private function createPropPreview():void
+ {
+ preview = new Preview();
+ this.previewPanel.addChild(preview);
+ this.previewPanel.addEventListener(Event.RESIZE, onPreviewPanelResize);
+ }
+
+ private function initPropList():void
+ {
+ this.proplistPanel.addEventListener(PropListEvent.SELECT, this.onPropSelect);
+ this.proplistPanel.addEventListener(MouseEvent.CLICK, this.onPropListClick);
+ }
+
+ private function createPropertyPanel():void
+ {
+ this.propertyPanel = new Panel();
+ this.propertyPanel.title = "Properties";
+ this.propertyPanel.percentWidth = 100;
+ this.propertyPanel.height = 200;
+ this.mainScene.setPropertyPanel(this.propertyPanel);
+ }
+
+ private function createLibraryManager():void
+ {
+ this.libraryManager = new LibraryManager();
+ this.libraryManager.addEventListener(Event.OPEN, this.onStartLibLoading);
+ this.libraryManager.addEventListener(Event.COMPLETE, this.onLibraryManagerChange);
+ this.libraryManager.addEventListener(EditorProgressEvent.PROGRESS, this.onLibraryLoadingProgress);
+ this.cbPropLibNames.dataProvider = this.libraryManager.libraryNames;
+ }
+
+ private function createImportManager():void
+ {
+ this.importManager = new ImportManager(this.mainScene, this.libraryManager);
+ this.importManager.addEventListener(Event.COMPLETE, this.onImportComplete);
+ this.importManager.addEventListener(EditorProgressEvent.PROGRESS, this.onImportProgress);
+ this.importManager.addEventListener(Event.OPEN, this.onImportStart);
+ }
+
+ private function onShowLayersWindow(param1:NativeMenuItem):void
+ {
+ if (param1.checked)
+ {
+ this.showLayersWindow();
+ }
+ else
+ {
+ this.closeLayersWindow();
+ }
+ }
+
+ private function showLayersWindow():void
+ {
+ if (this.layersWindow == null)
+ {
+ this.layersWindow = LayersWindowBase(PopUpManager.createPopUp(this, LayersWindow));
+ this.layersWindow.addEventListener(Event.CLOSE, this.closeLayersWindow);
+ PopUpManager.centerPopUp(this.layersWindow);
+ }
+ this.layersWindow.visible = true;
+ }
+
+ private function closeLayersWindow(param1:Event = null):void
+ {
+ this.layersWindow.visible = false;
+ this.miShowLayers.checked = false;
+ }
+
+ private function onClearLibClick(param1:NativeMenuItem):void
+ {
+ this.libraryManager.clearLibraries();
+ }
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AlternativaEditor_helpDataClass.as b/src/AlternativaEditor_helpDataClass.as
new file mode 100644
index 0000000..1b1bab7
--- /dev/null
+++ b/src/AlternativaEditor_helpDataClass.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.ByteArrayAsset;
+
+ [Embed(source="/_assets/74_AlternativaEditor_helpDataClass.bin", mimeType="application/octet-stream")]
+ public class AlternativaEditor_helpDataClass extends ByteArrayAsset
+ {
+ public function AlternativaEditor_helpDataClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/BatchProcessor.as b/src/BatchProcessor.as
new file mode 100644
index 0000000..e3ddd6d
--- /dev/null
+++ b/src/BatchProcessor.as
@@ -0,0 +1,101 @@
+package
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.mapexport.FileType;
+ import alternativa.editor.mapimport.TanksXmlImporter;
+ import alternativa.editor.scene.MainScene;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.filesystem.File;
+ import flash.filesystem.FileMode;
+ import flash.filesystem.FileStream;
+
+ public class BatchProcessor extends EventDispatcher
+ {
+ private var files:Vector.;
+
+ private var currentFileIndex:int;
+
+ private var importer:TanksXmlImporter;
+
+ private var mainScene:MainScene;
+
+ public function BatchProcessor(param1:MainScene, param2:LibraryManager)
+ {
+ super();
+ this.mainScene = param1;
+ this.importer = new TanksXmlImporter(param1,param2);
+ this.importer.addEventListener(Event.COMPLETE,this.onImportComplete);
+ this.importer.addEventListener(EditorProgressEvent.PROGRESS,this.onProgress);
+ }
+
+ private static function selectXMLFiles(param1:Array) : Vector.
+ {
+ var loc3:File = null;
+ var loc2:Vector. = new Vector.();
+ for each(loc3 in param1)
+ {
+ if(loc3.extension.toLowerCase() == "xml")
+ {
+ loc2.push(loc3);
+ }
+ }
+ return loc2;
+ }
+
+ private function onProgress(param1:EditorProgressEvent) : void
+ {
+ var loc2:Number = 1 / this.files.length;
+ dispatchEvent(new EditorProgressEvent((this.currentFileIndex + param1.progress) * loc2));
+ }
+
+ public function run(param1:Array) : void
+ {
+ this.files = selectXMLFiles(param1);
+ this.currentFileIndex = -1;
+ this.processNextFile();
+ }
+
+ private function processNextFile() : void
+ {
+ ++this.currentFileIndex;
+ if(this.currentFileIndex < this.files.length)
+ {
+ this.importFile();
+ }
+ else
+ {
+ this.complete();
+ }
+ }
+
+ private function importFile() : void
+ {
+ this.mainScene.clear();
+ var loc1:FileStream = new FileStream();
+ loc1.open(this.getCurrentFile(),FileMode.READ);
+ this.importer.importFromFileStream(loc1);
+ }
+
+ private function onImportComplete(param1:Event) : void
+ {
+ var loc2:FileStream = new FileStream();
+ loc2.open(this.getCurrentFile(),FileMode.WRITE);
+ this.mainScene.exportScene(FileType.MAP_XML_VERSION_1_FULL,loc2);
+ this.processNextFile();
+ }
+
+ private function getCurrentFile() : File
+ {
+ return this.files[this.currentFileIndex];
+ }
+
+ private function complete() : void
+ {
+ this.files = null;
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+}
+
diff --git a/src/BonusTypes.as b/src/BonusTypes.as
new file mode 100644
index 0000000..f8eb6e8
--- /dev/null
+++ b/src/BonusTypes.as
@@ -0,0 +1,13 @@
+package
+{
+ public class BonusTypes
+ {
+ public static const types:Array = ["damageup","armorup","nitro","medkit","crystal","crystal_100"];
+
+ public function BonusTypes()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/ErrorHandler.as b/src/ErrorHandler.as
new file mode 100644
index 0000000..525d61f
--- /dev/null
+++ b/src/ErrorHandler.as
@@ -0,0 +1,54 @@
+package
+{
+ import flash.display.DisplayObject;
+ import mx.core.FlexGlobals;
+ import mx.managers.PopUpManager;
+
+ public class ErrorHandler
+ {
+ private static var windowMessage:String = "";
+
+ private static var content:String = "";
+
+ private static var window:ErrorWindow = new ErrorWindow();
+
+ public function ErrorHandler()
+ {
+ super();
+ }
+
+ public static function addText(param1:String) : void
+ {
+ content += param1 + "\r";
+ updateContent();
+ }
+
+ public static function setMessage(param1:String) : void
+ {
+ windowMessage = param1;
+ updateContent();
+ }
+
+ private static function updateContent() : void
+ {
+ if(window.text)
+ {
+ window.text.text = content;
+ window.message.text = windowMessage;
+ }
+ }
+
+ public static function clearMessages() : void
+ {
+ content = "";
+ }
+
+ public static function showWindow() : void
+ {
+ PopUpManager.addPopUp(window,DisplayObject(FlexGlobals.topLevelApplication));
+ PopUpManager.centerPopUp(window);
+ updateContent();
+ }
+ }
+}
+
diff --git a/src/ErrorWindow.mxml b/src/ErrorWindow.mxml
new file mode 100644
index 0000000..cac06e9
--- /dev/null
+++ b/src/ErrorWindow.mxml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/GameModes.as b/src/GameModes.as
new file mode 100644
index 0000000..f65a80a
--- /dev/null
+++ b/src/GameModes.as
@@ -0,0 +1,13 @@
+package
+{
+ public class GameModes
+ {
+ public static const modes:Array = ["dm","tdm","ctf","dom"];
+
+ public function GameModes()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/GlobalEventDispatcher.as b/src/GlobalEventDispatcher.as
new file mode 100644
index 0000000..757e722
--- /dev/null
+++ b/src/GlobalEventDispatcher.as
@@ -0,0 +1,31 @@
+package
+{
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+
+ public class GlobalEventDispatcher
+ {
+ private static var eventDispatcher:EventDispatcher = new EventDispatcher();
+
+ public function GlobalEventDispatcher()
+ {
+ super();
+ }
+
+ public static function addListener(param1:String, param2:Function) : void
+ {
+ eventDispatcher.addEventListener(param1,param2);
+ }
+
+ public static function removeListener(param1:String, param2:Function) : void
+ {
+ eventDispatcher.removeEventListener(param1,param2);
+ }
+
+ public static function dispatch(param1:Event) : void
+ {
+ eventDispatcher.dispatchEvent(param1);
+ }
+ }
+}
+
diff --git a/src/LayersWindowBase.mxml b/src/LayersWindowBase.mxml
new file mode 100644
index 0000000..4e8f4b0
--- /dev/null
+++ b/src/LayersWindowBase.mxml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/src/ModeButton.as b/src/ModeButton.as
new file mode 100644
index 0000000..609e0ef
--- /dev/null
+++ b/src/ModeButton.as
@@ -0,0 +1,136 @@
+package
+{
+ import flash.events.MouseEvent;
+ import mx.binding.BindingManager;
+ import mx.controls.Button;
+ import mx.core.IFlexModuleFactory;
+ import mx.events.FlexEvent;
+ import mx.events.PropertyChangeEvent;
+
+ public class ModeButton extends Button
+ {
+ private var _1023233823downToolTip:String;
+
+ private var _1427000520upToolTip:String;
+
+ private var __moduleFactoryInitialized:Boolean = false;
+
+ private var _down:Boolean = false;
+
+ public var downModeIcon:Class;
+
+ public var upModeIcon:Class;
+
+ public function ModeButton()
+ {
+ super();
+ this._ModeButton_String2_i();
+ this._ModeButton_String1_i();
+ this.addEventListener("creationComplete",this.___ModeButton_Button1_creationComplete);
+ }
+
+ override public function set moduleFactory(param1:IFlexModuleFactory) : void
+ {
+ super.moduleFactory = param1;
+ if(this.__moduleFactoryInitialized)
+ {
+ return;
+ }
+ this.__moduleFactoryInitialized = true;
+ }
+
+ override public function initialize() : void
+ {
+ super.initialize();
+ }
+
+ public function get down() : Boolean
+ {
+ return this._down;
+ }
+
+ public function set down(param1:Boolean) : void
+ {
+ this._down = param1;
+ this.update();
+ }
+
+ override protected function clickHandler(param1:MouseEvent) : void
+ {
+ this.down = !this.down;
+ super.clickHandler(param1);
+ }
+
+ private function update() : void
+ {
+ if(this._down)
+ {
+ setStyle("icon",this.downModeIcon);
+ toolTip = this.downToolTip;
+ }
+ else
+ {
+ setStyle("icon",this.upModeIcon);
+ toolTip = this.upToolTip;
+ }
+ }
+
+ private function _ModeButton_String2_i() : String
+ {
+ this.downToolTip = "null";
+ BindingManager.executeBindings(this,"downToolTip",this.downToolTip);
+ return "null";
+ }
+
+ private function _ModeButton_String1_i() : String
+ {
+ this.upToolTip = "null";
+ BindingManager.executeBindings(this,"upToolTip",this.upToolTip);
+ return "null";
+ }
+
+ public function ___ModeButton_Button1_creationComplete(param1:FlexEvent) : void
+ {
+ this.update();
+ }
+
+ [Bindable(event="propertyChange")]
+ public function get downToolTip() : String
+ {
+ return this._1023233823downToolTip;
+ }
+
+ public function set downToolTip(param1:String) : void
+ {
+ var loc2:Object = this._1023233823downToolTip;
+ if(loc2 !== param1)
+ {
+ this._1023233823downToolTip = param1;
+ if(this.hasEventListener("propertyChange"))
+ {
+ this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"downToolTip",loc2,param1));
+ }
+ }
+ }
+
+ [Bindable(event="propertyChange")]
+ public function get upToolTip() : String
+ {
+ return this._1427000520upToolTip;
+ }
+
+ public function set upToolTip(param1:String) : void
+ {
+ var loc2:Object = this._1427000520upToolTip;
+ if(loc2 !== param1)
+ {
+ this._1427000520upToolTip = param1;
+ if(this.hasEventListener("propertyChange"))
+ {
+ this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"upToolTip",loc2,param1));
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/PopUpProgressBar.mxml b/src/PopUpProgressBar.mxml
new file mode 100644
index 0000000..dc7aac6
--- /dev/null
+++ b/src/PopUpProgressBar.mxml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PropListPanel.mxml b/src/PropListPanel.mxml
new file mode 100644
index 0000000..e475f8d
--- /dev/null
+++ b/src/PropListPanel.mxml
@@ -0,0 +1,87 @@
+
+
+
+
+ = 0) {
+ dataProvider = dataProviders[groupIndex];
+ } else {
+ canvas = new Canvas();
+ canvas.label = groupName;
+ canvas.autoLayout = true;
+ canvas.percentHeight = canvas.percentWidth = 100;
+ canvas.horizontalScrollPolicy = ScrollPolicy.OFF;
+ accordion.addChild(canvas);
+
+ tileList = new TileList();
+ tileList.percentHeight = tileList.percentWidth = 100;
+ tileList.focusEnabled = false;
+ dataProvider = new ArrayCollection();
+ dataProviders.push(dataProvider);
+ tileList.dataProvider = dataProvider;
+ tileList.itemRenderer = new ClassFactory(ImageItemRenderer);
+ tileList.addEventListener(ListEvent.ITEM_CLICK, changeSelected);
+ _group.push(tileList);
+ _groupName.push(groupName);
+ canvas.addChild(tileList);
+ }
+
+ var sprite:Sprite = new Sprite();
+ sprite.addChild(image);
+ dataProvider.addItem({
+ "label": label,
+ "image": sprite,
+ "obj": obj
+ });
+ }
+
+ public function deleteAllProps():void {
+ var tileList:TileList;
+ for (var i:int = 0; i < _group.length; i++) {
+ tileList = _group[i] as TileList;
+ tileList.removeEventListener(ListEvent.ITEM_CLICK, changeSelected);
+ }
+ while (accordion.numChildren > 0) {
+ accordion.removeChildAt(0);
+ }
+ dataProviders = [];
+ _group = [];
+ _groupName = [];
+ }
+
+ private function changeSelected(event:ListEvent):void {
+ dispatchEvent(new PropListEvent(0, event.itemRenderer.data.obj));
+ selectedItem = event.itemRenderer.data.obj;
+ }
+ ]]>
+
+
+
+
+
+
diff --git a/src/ResizableTitleWindowX.mxml b/src/ResizableTitleWindowX.mxml
new file mode 100644
index 0000000..70447ba
--- /dev/null
+++ b/src/ResizableTitleWindowX.mxml
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/_AlternativaEditorWatcherSetupUtil.as b/src/_AlternativaEditorWatcherSetupUtil.as
new file mode 100644
index 0000000..0fd34b0
--- /dev/null
+++ b/src/_AlternativaEditorWatcherSetupUtil.as
@@ -0,0 +1,26 @@
+package
+{
+ import mx.binding.IWatcherSetupUtil2;
+ import mx.binding.PropertyWatcher;
+ import mx.core.IFlexModuleFactory;
+
+ public class _AlternativaEditorWatcherSetupUtil implements IWatcherSetupUtil2
+ {
+ public function _AlternativaEditorWatcherSetupUtil()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ AlternativaEditor.watcherSetupUtil = new _AlternativaEditorWatcherSetupUtil();
+ }
+
+ public function setup(param1:Object, param2:Function, param3:Function, param4:Array, param5:Array) : void
+ {
+ param5[0] = new PropertyWatcher("menuData",{"propertyChange":true},[param4[0]],param2);
+ param5[0].updateParent(param1);
+ }
+ }
+}
+
diff --git a/src/_AlternativaEditor_FlexInit.as b/src/_AlternativaEditor_FlexInit.as
new file mode 100644
index 0000000..7068a8f
--- /dev/null
+++ b/src/_AlternativaEditor_FlexInit.as
@@ -0,0 +1,140 @@
+package
+{
+ import flash.net.getClassByAlias;
+ import flash.net.registerClassAlias;
+ import flash.system.*;
+ import flash.utils.*;
+ import mx.accessibility.AccordionHeaderAccImpl;
+ import mx.accessibility.AlertAccImpl;
+ import mx.accessibility.ButtonAccImpl;
+ import mx.accessibility.CheckBoxAccImpl;
+ import mx.accessibility.ComboBaseAccImpl;
+ import mx.accessibility.ComboBoxAccImpl;
+ import mx.accessibility.LabelAccImpl;
+ import mx.accessibility.ListAccImpl;
+ import mx.accessibility.ListBaseAccImpl;
+ import mx.accessibility.PanelAccImpl;
+ import mx.accessibility.TitleWindowAccImpl;
+ import mx.accessibility.UIComponentAccProps;
+ import mx.collections.ArrayCollection;
+ import mx.collections.ArrayList;
+ import mx.core.IFlexModuleFactory;
+ import mx.core.mx_internal;
+ import mx.effects.EffectManager;
+ import mx.managers.systemClasses.ChildManager;
+ import mx.styles.IStyleManager2;
+ import mx.styles.StyleManagerImpl;
+ import mx.utils.ObjectProxy;
+ import spark.accessibility.ButtonBaseAccImpl;
+ import spark.accessibility.CheckBoxAccImpl;
+ import spark.accessibility.PanelAccImpl;
+ import spark.accessibility.RichEditableTextAccImpl;
+ import spark.accessibility.TextBaseAccImpl;
+ import spark.accessibility.TitleWindowAccImpl;
+ import spark.accessibility.ToggleButtonAccImpl;
+
+ public class _AlternativaEditor_FlexInit
+ {
+ public function _AlternativaEditor_FlexInit()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ var styleNames:Array;
+ var i:int;
+ var styleManager:IStyleManager2 = null;
+ var fbs:IFlexModuleFactory = param1;
+ new ChildManager(fbs);
+ styleManager = new StyleManagerImpl(fbs);
+ EffectManager.mx_internal::registerEffectTrigger("addedEffect","added");
+ EffectManager.mx_internal::registerEffectTrigger("closeEffect","windowClose");
+ EffectManager.mx_internal::registerEffectTrigger("completeEffect","complete");
+ EffectManager.mx_internal::registerEffectTrigger("creationCompleteEffect","creationComplete");
+ EffectManager.mx_internal::registerEffectTrigger("focusInEffect","focusIn");
+ EffectManager.mx_internal::registerEffectTrigger("focusOutEffect","focusOut");
+ EffectManager.mx_internal::registerEffectTrigger("hideEffect","hide");
+ EffectManager.mx_internal::registerEffectTrigger("itemsChangeEffect","itemsChange");
+ EffectManager.mx_internal::registerEffectTrigger("minimizeEffect","windowMinimize");
+ EffectManager.mx_internal::registerEffectTrigger("mouseDownEffect","mouseDown");
+ EffectManager.mx_internal::registerEffectTrigger("mouseUpEffect","mouseUp");
+ EffectManager.mx_internal::registerEffectTrigger("moveEffect","move");
+ EffectManager.mx_internal::registerEffectTrigger("removedEffect","removed");
+ EffectManager.mx_internal::registerEffectTrigger("resizeEffect","resize");
+ EffectManager.mx_internal::registerEffectTrigger("resizeEndEffect","resizeEnd");
+ EffectManager.mx_internal::registerEffectTrigger("resizeStartEffect","resizeStart");
+ EffectManager.mx_internal::registerEffectTrigger("rollOutEffect","rollOut");
+ EffectManager.mx_internal::registerEffectTrigger("rollOverEffect","rollOver");
+ EffectManager.mx_internal::registerEffectTrigger("showEffect","show");
+ EffectManager.mx_internal::registerEffectTrigger("unminimizeEffect","windowUnminimize");
+ if(Capabilities.hasAccessibility)
+ {
+ ComboBoxAccImpl.enableAccessibility();
+ mx.accessibility.PanelAccImpl.enableAccessibility();
+ ListBaseAccImpl.enableAccessibility();
+ mx.accessibility.TitleWindowAccImpl.enableAccessibility();
+ AccordionHeaderAccImpl.enableAccessibility();
+ ButtonBaseAccImpl.enableAccessibility();
+ ToggleButtonAccImpl.enableAccessibility();
+ ListAccImpl.enableAccessibility();
+ AlertAccImpl.enableAccessibility();
+ RichEditableTextAccImpl.enableAccessibility();
+ LabelAccImpl.enableAccessibility();
+ TextBaseAccImpl.enableAccessibility();
+ spark.accessibility.TitleWindowAccImpl.enableAccessibility();
+ spark.accessibility.PanelAccImpl.enableAccessibility();
+ spark.accessibility.CheckBoxAccImpl.enableAccessibility();
+ mx.accessibility.CheckBoxAccImpl.enableAccessibility();
+ ButtonAccImpl.enableAccessibility();
+ UIComponentAccProps.enableAccessibility();
+ ComboBaseAccImpl.enableAccessibility();
+ }
+ try
+ {
+ if(getClassByAlias("flex.messaging.io.ArrayCollection") != ArrayCollection)
+ {
+ registerClassAlias("flex.messaging.io.ArrayCollection",ArrayCollection);
+ }
+ }
+ catch(e:Error)
+ {
+ registerClassAlias("flex.messaging.io.ArrayCollection",ArrayCollection);
+ }
+ try
+ {
+ if(getClassByAlias("flex.messaging.io.ArrayList") != ArrayList)
+ {
+ registerClassAlias("flex.messaging.io.ArrayList",ArrayList);
+ }
+ }
+ catch(e:Error)
+ {
+ registerClassAlias("flex.messaging.io.ArrayList",ArrayList);
+ }
+ try
+ {
+ if(getClassByAlias("flex.messaging.io.ObjectProxy") != ObjectProxy)
+ {
+ registerClassAlias("flex.messaging.io.ObjectProxy",ObjectProxy);
+ }
+ }
+ catch(e:Error)
+ {
+ registerClassAlias("flex.messaging.io.ObjectProxy",ObjectProxy);
+ }
+ styleNames = ["lineHeight","unfocusedTextSelectionColor","kerning","iconColor","listAutoPadding","showErrorTip","textDecoration","dominantBaseline","buttonPadding","fontThickness","textShadowColor","blockProgression","textAlignLast","listStylePosition","buttonAlignment","textShadowAlpha","textAlpha","chromeColor","rollOverColor","fontSize","paragraphEndIndent","fontWeight","breakOpportunity","leading","symbolColor","renderingMode","paragraphStartIndent","layoutDirection","footerColors","contentBackgroundColor","statusTextStyleName","paragraphSpaceAfter","titleTextStyleName","digitWidth","touchDelay","ligatureLevel","firstBaselineOffset","fontLookup","paragraphSpaceBefore","fontFamily","lineThrough","alignmentBaseline","trackingLeft","fontStyle","dropShadowColor","accentColor","selectionColor","titleBarBackgroundSkin","dropdownBorderColor","disabledIconColor","textJustify","focusColor","alternatingItemColors","typographicCase","textRollOverColor","showErrorSkin","digitCase","inactiveTextSelectionColor","justificationRule","statusBarBackgroundColor","dividerColor","titleAlignment","trackingRight","leadingModel","selectionDisabledColor","letterSpacing","focusedTextSelectionColor","baselineShift","titleBarColors","fontSharpness","barColor","modalTransparencyDuration","justificationStyle","wordSpacing","listStyleType","contentBackgroundAlpha","fontAntiAliasType","textRotation","errorColor","direction","cffHinting","locale","backgroundDisabledColor","modalTransparencyColor","showPromptWhenFocused","textIndent","themeColor","clearFloats","modalTransparency","tabStops","textAlign","headerColors","textSelectedColor","interactionMode","labelWidth","whiteSpaceCollapse","fontGridFitType","statusBarBackgroundSkin","disabledColor","modalTransparencyBlur","downColor","color"];
+ i = 0;
+ while(i < styleNames.length)
+ {
+ styleManager.registerInheritingStyle(styleNames[i]);
+ i++;
+ }
+ }
+ }
+}
+
+import mx.core.TextFieldFactory;
+
+TextFieldFactory;
+
diff --git a/src/_AlternativaEditor_Styles.as b/src/_AlternativaEditor_Styles.as
new file mode 100644
index 0000000..09e365a
--- /dev/null
+++ b/src/_AlternativaEditor_Styles.as
@@ -0,0 +1,1796 @@
+package
+{
+ import mx.core.IFlexModuleFactory;
+ import mx.core.UIComponent;
+ import mx.core.UITextField;
+ import mx.core.mx_internal;
+ import mx.skins.halo.ApplicationTitleBarBackgroundSkin;
+ import mx.skins.halo.BrokenImageBorderSkin;
+ import mx.skins.halo.BusyCursor;
+ import mx.skins.halo.DefaultDragImage;
+ import mx.skins.halo.HaloFocusRect;
+ import mx.skins.halo.ListDropIndicator;
+ import mx.skins.halo.StatusBarBackgroundSkin;
+ import mx.skins.halo.ToolTipBorder;
+ import mx.skins.halo.WindowCloseButtonSkin;
+ import mx.skins.halo.WindowMaximizeButtonSkin;
+ import mx.skins.halo.WindowMinimizeButtonSkin;
+ import mx.skins.halo.WindowRestoreButtonSkin;
+ import mx.skins.spark.AccordionHeaderSkin;
+ import mx.skins.spark.BorderSkin;
+ import mx.skins.spark.ButtonSkin;
+ import mx.skins.spark.CheckBoxSkin;
+ import mx.skins.spark.ComboBoxSkin;
+ import mx.skins.spark.ContainerBorderSkin;
+ import mx.skins.spark.DefaultButtonSkin;
+ import mx.skins.spark.EditableComboBoxSkin;
+ import mx.skins.spark.PanelBorderSkin;
+ import mx.skins.spark.ProgressBarSkin;
+ import mx.skins.spark.ProgressBarTrackSkin;
+ import mx.skins.spark.ProgressIndeterminateSkin;
+ import mx.skins.spark.ProgressMaskSkin;
+ import mx.skins.spark.ScrollBarDownButtonSkin;
+ import mx.skins.spark.ScrollBarThumbSkin;
+ import mx.skins.spark.ScrollBarTrackSkin;
+ import mx.skins.spark.ScrollBarUpButtonSkin;
+ import mx.skins.spark.StepperDecrButtonSkin;
+ import mx.skins.spark.StepperIncrButtonSkin;
+ import mx.skins.spark.TextInputBorderSkin;
+ import mx.styles.CSSCondition;
+ import mx.styles.CSSSelector;
+ import mx.styles.CSSStyleDeclaration;
+ import mx.styles.IStyleManager2;
+ import mx.utils.ObjectUtil;
+ import spark.skins.spark.ApplicationSkin;
+ import spark.skins.spark.ButtonSkin;
+ import spark.skins.spark.CheckBoxSkin;
+ import spark.skins.spark.DefaultButtonSkin;
+ import spark.skins.spark.ErrorSkin;
+ import spark.skins.spark.FocusSkin;
+ import spark.skins.spark.HScrollBarSkin;
+ import spark.skins.spark.PanelSkin;
+ import spark.skins.spark.ScrollerSkin;
+ import spark.skins.spark.SkinnableContainerSkin;
+ import spark.skins.spark.TextAreaSkin;
+ import spark.skins.spark.TitleWindowSkin;
+ import spark.skins.spark.VScrollBarSkin;
+
+ public class _AlternativaEditor_Styles
+ {
+ private static var _embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805:Class = _class_embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805;
+
+ private static var _embed_css_win_restore_up_png__736761895_2120219528:Class = _class_embed_css_win_restore_up_png__736761895_2120219528;
+
+ private static var _embed_css_win_min_over_png_1352175246_2117214847:Class = _class_embed_css_win_min_over_png_1352175246_2117214847;
+
+ private static var _embed_css_Assets_swf_728414423_CloseButtonDown_1138829611:Class = _class_embed_css_Assets_swf_728414423_CloseButtonDown_1138829611;
+
+ private static var _embed_css_win_close_up_png__1750166097_309569150:Class = _class_embed_css_win_close_up_png__1750166097_309569150;
+
+ private static var _embed_css_mac_close_down_png__476573661_30699662:Class = _class_embed_css_mac_close_down_png__476573661_30699662;
+
+ private static var _embed_css_mac_max_up_png_2014335472_887462691:Class = _class_embed_css_mac_max_up_png_2014335472_887462691;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178;
+
+ private static var _embed_css_mac_max_over_png__516178647_1898496680:Class = _class_embed_css_mac_max_over_png__516178647_1898496680;
+
+ private static var _embed_css_win_min_down_png__2044797092_465343185:Class = _class_embed_css_win_min_down_png__2044797092_465343185;
+
+ private static var _embed_css_win_max_down_png_1775744138_402971533:Class = _class_embed_css_win_max_down_png_1775744138_402971533;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261;
+
+ private static var _embed_css_win_max_over_png_877749180_1787411313:Class = _class_embed_css_win_max_over_png_877749180_1787411313;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310;
+
+ private static var _embed_css_Assets_swf_728414423___brokenImage_1187203851:Class = _class_embed_css_Assets_swf_728414423___brokenImage_1187203851;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361;
+
+ private static var _embed_css_Assets_swf_728414423_CloseButtonOver_974659645:Class = _class_embed_css_Assets_swf_728414423_CloseButtonOver_974659645;
+
+ private static var _embed_css_mac_close_up_png_1150873372_2050114321:Class = _class_embed_css_mac_close_up_png_1150873372_2050114321;
+
+ private static var _embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753:Class = _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753;
+
+ private static var _embed_css_mac_min_over_png__41752581_1023914202:Class = _class_embed_css_mac_min_over_png__41752581_1023914202;
+
+ private static var _embed_css_mac_min_dis_png__703880867_400936850:Class = _class_embed_css_mac_min_dis_png__703880867_400936850;
+
+ private static var _embed_css_mac_min_down_png_856242377_1625405496:Class = _class_embed_css_mac_min_down_png_856242377_1625405496;
+
+ private static var _embed_css_win_max_dis_png__812766852_512792721:Class = _class_embed_css_win_max_dis_png__812766852_512792721;
+
+ private static var _embed_css_mac_close_over_png__1374568619_1213522700:Class = _class_embed_css_mac_close_over_png__1374568619_1213522700;
+
+ private static var _embed_css_win_min_dis_png__1490199446_689239761:Class = _class_embed_css_win_min_dis_png__1490199446_689239761;
+
+ private static var _embed_css_win_restore_over_png_1379106002_420516677:Class = _class_embed_css_win_restore_over_png_1379106002_420516677;
+
+ private static var _embed_css_win_min_up_png__1496565611_1904338868:Class = _class_embed_css_win_min_up_png__1496565611_1904338868;
+
+ private static var _embed_css_mac_max_down_png_381816311_1824039210:Class = _class_embed_css_mac_max_down_png_381816311_1824039210;
+
+ private static var _embed_css_mac_min_up_png_191367490_1536362603:Class = _class_embed_css_mac_min_up_png_191367490_1536362603;
+
+ private static var _embed_css_win_max_up_png_326402371_1936093294:Class = _class_embed_css_win_max_up_png_326402371_1936093294;
+
+ private static var _embed_css_Assets_swf_728414423_CloseButtonUp_98224972:Class = _class_embed_css_Assets_swf_728414423_CloseButtonUp_98224972;
+
+ private static var _embed_css_win_close_down_png__941728266_1862517095:Class = _class_embed_css_win_close_down_png__941728266_1862517095;
+
+ private static var _embed_css_win_restore_down_png__2017866336_395125171:Class = _class_embed_css_win_restore_down_png__2017866336_395125171;
+
+ private static var _embed_css_mac_max_dis_png__26448273_1865306912:Class = _class_embed_css_mac_max_dis_png__26448273_1865306912;
+
+ private static var _embed_css_win_close_over_png__1839723224_1256956523:Class = _class_embed_css_win_close_over_png__1839723224_1256956523;
+
+ private static var _embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819:Class = _class_embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819;
+
+ private static var _embed_css_gripper_up_png__745420807_1298477336:Class = _class_embed_css_gripper_up_png__745420807_1298477336;
+
+ public function _AlternativaEditor_Styles()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ var style:CSSStyleDeclaration = null;
+ var effects:Array = null;
+ var mergedStyle:CSSStyleDeclaration = null;
+ var fbs:IFlexModuleFactory = param1;
+ var styleManager:IStyleManager2 = fbs.getImplementation("mx.styles::IStyleManager2") as IStyleManager2;
+ var conditions:Array = null;
+ var condition:CSSCondition = null;
+ var selector:CSSSelector = null;
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","gripperSkin");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".gripperSkin");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_gripper_up_png__745420807_1298477336;
+ this.overSkin = _embed_css_gripper_up_png__745420807_1298477336;
+ this.downSkin = _embed_css_gripper_up_png__745420807_1298477336;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","macCloseButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".macCloseButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_mac_close_up_png_1150873372_2050114321;
+ this.overSkin = _embed_css_mac_close_over_png__1374568619_1213522700;
+ this.downSkin = _embed_css_mac_close_down_png__476573661_30699662;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","macMaxButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".macMaxButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_mac_max_up_png_2014335472_887462691;
+ this.overSkin = _embed_css_mac_max_over_png__516178647_1898496680;
+ this.downSkin = _embed_css_mac_max_down_png_381816311_1824039210;
+ this.disabledSkin = _embed_css_mac_max_dis_png__26448273_1865306912;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","macMinButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".macMinButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_mac_min_up_png_191367490_1536362603;
+ this.overSkin = _embed_css_mac_min_over_png__41752581_1023914202;
+ this.downSkin = _embed_css_mac_min_down_png_856242377_1625405496;
+ this.alpha = 0.5;
+ this.disabledSkin = _embed_css_mac_min_dis_png__703880867_400936850;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","statusTextStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".statusTextStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.color = 5789784;
+ this.alpha = 0.6;
+ this.fontSize = 10;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","titleTextStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".titleTextStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.color = 5789784;
+ this.alpha = 0.6;
+ this.fontSize = 9;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","winCloseButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".winCloseButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_win_close_up_png__1750166097_309569150;
+ this.overSkin = _embed_css_win_close_over_png__1839723224_1256956523;
+ this.downSkin = _embed_css_win_close_down_png__941728266_1862517095;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","winMaxButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".winMaxButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_win_max_up_png_326402371_1936093294;
+ this.downSkin = _embed_css_win_max_down_png_1775744138_402971533;
+ this.overSkin = _embed_css_win_max_over_png_877749180_1787411313;
+ this.disabledSkin = _embed_css_win_max_dis_png__812766852_512792721;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","winMinButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".winMinButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_win_min_up_png__1496565611_1904338868;
+ this.downSkin = _embed_css_win_min_down_png__2044797092_465343185;
+ this.overSkin = _embed_css_win_min_over_png_1352175246_2117214847;
+ this.disabledSkin = _embed_css_win_min_dis_png__1490199446_689239761;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","winRestoreButton");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".winRestoreButton");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.upSkin = _embed_css_win_restore_up_png__736761895_2120219528;
+ this.downSkin = _embed_css_win_restore_down_png__2017866336_395125171;
+ this.overSkin = _embed_css_win_restore_over_png_1379106002_420516677;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("global",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("global");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.lineHeight = "120%";
+ this.unfocusedTextSelectionColor = 15263976;
+ this.kerning = "default";
+ this.caretColor = 92159;
+ this.iconColor = 1118481;
+ this.verticalScrollPolicy = "auto";
+ this.horizontalAlign = "left";
+ this.filled = true;
+ this.showErrorTip = true;
+ this.textDecoration = "none";
+ this.columnCount = "auto";
+ this.liveDragging = true;
+ this.dominantBaseline = "auto";
+ this.fontThickness = 0;
+ this.focusBlendMode = "normal";
+ this.blockProgression = "tb";
+ this.buttonColor = 7305079;
+ this.indentation = 17;
+ this.autoThumbVisibility = true;
+ this.textAlignLast = "start";
+ this.paddingTop = 0;
+ this.textAlpha = 1;
+ this.chromeColor = 13421772;
+ this.rollOverColor = 13556719;
+ this.bevel = true;
+ this.fontSize = 12;
+ this.shadowColor = 15658734;
+ this.columnGap = 20;
+ this.paddingLeft = 0;
+ this.paragraphEndIndent = 0;
+ this.fontWeight = "normal";
+ this.indicatorGap = 14;
+ this.focusSkin = HaloFocusRect;
+ this.breakOpportunity = "auto";
+ this.leading = 2;
+ this.symbolColor = 0;
+ this.renderingMode = "cff";
+ this.iconPlacement = "left";
+ this.borderThickness = 1;
+ this.paragraphStartIndent = 0;
+ this.layoutDirection = "ltr";
+ this.contentBackgroundColor = 16777215;
+ this.backgroundSize = "auto";
+ this.paragraphSpaceAfter = 0;
+ this.borderColor = 6908265;
+ this.shadowDistance = 2;
+ this.stroked = false;
+ this.digitWidth = "default";
+ this.verticalAlign = "top";
+ this.ligatureLevel = "common";
+ this.firstBaselineOffset = "auto";
+ this.fillAlphas = [0.6,0.4,0.75,0.65];
+ this.version = "4.0.0";
+ this.shadowDirection = "center";
+ this.fontLookup = "embeddedCFF";
+ this.lineBreak = "toFit";
+ this.repeatInterval = 35;
+ this.openDuration = 1;
+ this.paragraphSpaceBefore = 0;
+ this.fontFamily = "Arial";
+ this.paddingBottom = 0;
+ this.strokeWidth = 1;
+ this.lineThrough = false;
+ this.textFieldClass = UITextField;
+ this.alignmentBaseline = "useDominantBaseline";
+ this.trackingLeft = 0;
+ this.verticalGridLines = true;
+ this.fontStyle = "normal";
+ this.dropShadowColor = 0;
+ this.accentColor = 39423;
+ this.backgroundImageFillMode = "scale";
+ this.selectionColor = 11060974;
+ this.borderWeight = 1;
+ this.focusRoundedCorners = "tl tr bl br";
+ this.paddingRight = 0;
+ this.borderSides = "left top right bottom";
+ this.disabledIconColor = 10066329;
+ this.textJustify = "interWord";
+ this.focusColor = 7385838;
+ this.borderVisible = true;
+ this.selectionDuration = 250;
+ this.typographicCase = "default";
+ this.highlightAlphas = [0.3,0];
+ this.fillColor = 16777215;
+ this.showErrorSkin = true;
+ this.textRollOverColor = 0;
+ this.rollOverOpenDelay = 200;
+ this.digitCase = "default";
+ this.shadowCapColor = 14015965;
+ this.inactiveTextSelectionColor = 15263976;
+ this.backgroundAlpha = 1;
+ this.justificationRule = "auto";
+ this.roundedBottomCorners = true;
+ this.dropShadowVisible = false;
+ this.softKeyboardEffectDuration = 150;
+ this.trackingRight = 0;
+ this.fillColors = [16777215,13421772,16777215,15658734];
+ this.horizontalGap = 8;
+ this.borderCapColor = 9542041;
+ this.leadingModel = "auto";
+ this.selectionDisabledColor = 14540253;
+ this.closeDuration = 50;
+ this.embedFonts = false;
+ this.letterSpacing = 0;
+ this.focusAlpha = 0.55;
+ this.borderAlpha = 1;
+ this.baselineShift = 0;
+ this.focusedTextSelectionColor = 11060974;
+ this.fontSharpness = 0;
+ this.modalTransparencyDuration = 100;
+ this.justificationStyle = "auto";
+ this.contentBackgroundAlpha = 1;
+ this.borderStyle = "inset";
+ this.textRotation = "auto";
+ this.fontAntiAliasType = "advanced";
+ this.errorColor = 16646144;
+ this.direction = "ltr";
+ this.cffHinting = "horizontalStem";
+ this.horizontalGridLineColor = 16250871;
+ this.locale = "en";
+ this.cornerRadius = 2;
+ this.modalTransparencyColor = 14540253;
+ this.disabledAlpha = 0.5;
+ this.textIndent = 0;
+ this.verticalGridLineColor = 14015965;
+ this.themeColor = 7385838;
+ this.tabStops = null;
+ this.modalTransparency = 0.5;
+ this.smoothScrolling = true;
+ this.columnWidth = "auto";
+ this.textAlign = "start";
+ this.horizontalScrollPolicy = "auto";
+ this.textSelectedColor = 0;
+ this.interactionMode = "mouse";
+ this.whiteSpaceCollapse = "collapse";
+ this.fontGridFitType = "pixel";
+ this.horizontalGridLines = false;
+ this.fullScreenHideControlsDelay = 3000;
+ this.useRollOver = true;
+ this.repeatDelay = 500;
+ this.focusThickness = 2;
+ this.verticalGap = 6;
+ this.disabledColor = 11187123;
+ this.modalTransparencyBlur = 3;
+ this.slideDuration = 300;
+ this.color = 0;
+ this.fixedThumbSize = false;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","errorTip");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".errorTip");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.fontWeight = "bold";
+ this.borderStyle = "errorTipRight";
+ this.paddingTop = 4;
+ this.borderColor = 13510953;
+ this.color = 16777215;
+ this.fontSize = 10;
+ this.shadowColor = 0;
+ this.paddingLeft = 4;
+ this.paddingBottom = 4;
+ this.paddingRight = 4;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","headerDragProxyStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".headerDragProxyStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.fontWeight = "bold";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","dateFieldPopup");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".dateFieldPopup");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.backgroundColor = 16777215;
+ this.dropShadowVisible = true;
+ this.borderThickness = 1;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","swatchPanelTextField");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".swatchPanelTextField");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderStyle = "inset";
+ this.borderColor = 14015965;
+ this.highlightColor = 12897484;
+ this.backgroundColor = 16777215;
+ this.shadowCapColor = 14015965;
+ this.shadowColor = 14015965;
+ this.paddingLeft = 5;
+ this.buttonColor = 7305079;
+ this.borderCapColor = 9542041;
+ this.paddingRight = 5;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","todayStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".todayStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.color = 0;
+ this.textAlign = "center";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","weekDayStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".weekDayStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.fontWeight = "bold";
+ this.textAlign = "center";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","windowStatus");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".windowStatus");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.color = 6710886;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","windowStyles");
+ conditions.push(condition);
+ selector = new CSSSelector("",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration(".windowStyles");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.fontWeight = "bold";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.HTML",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.HTML");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderStyle = "none";
+ this.layoutDirection = "ltr";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.core.Window",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.core.Window");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.statusTextStyleName = "statusTextStyle";
+ this.borderStyle = "solid";
+ this.closeButtonSkin = WindowCloseButtonSkin;
+ this.buttonAlignment = "auto";
+ this.restoreButtonSkin = WindowRestoreButtonSkin;
+ this.borderColor = 10921638;
+ this.titleTextStyleName = "titleTextStyle";
+ this.backgroundColor = 16777215;
+ this.statusBarBackgroundSkin = StatusBarBackgroundSkin;
+ this.cornerRadius = 0;
+ this.gripperPadding = 3;
+ this.titleBarBackgroundSkin = ApplicationTitleBarBackgroundSkin;
+ this.backgroundAlpha = 1;
+ this.titleBarColors = [16777215,12237498];
+ this.titleBarButtonPadding = 5;
+ this.showFlexChrome = true;
+ this.roundedBottomCorners = false;
+ this.minimizeButtonSkin = WindowMinimizeButtonSkin;
+ this.statusBarBackgroundColor = 14540253;
+ this.maximizeButtonSkin = WindowMaximizeButtonSkin;
+ this.buttonPadding = 2;
+ this.highlightAlphas = [1,1];
+ this.titleAlignment = "auto";
+ this.gripperStyleName = "gripperSkin";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.core.WindowedApplication",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.core.WindowedApplication");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.statusTextStyleName = "statusTextStyle";
+ this.borderStyle = "solid";
+ this.closeButtonSkin = WindowCloseButtonSkin;
+ this.buttonAlignment = "auto";
+ this.restoreButtonSkin = WindowRestoreButtonSkin;
+ this.borderColor = 10921638;
+ this.titleTextStyleName = "titleTextStyle";
+ this.backgroundColor = 16777215;
+ this.statusBarBackgroundSkin = StatusBarBackgroundSkin;
+ this.cornerRadius = 0;
+ this.gripperPadding = 3;
+ this.titleBarBackgroundSkin = ApplicationTitleBarBackgroundSkin;
+ this.backgroundAlpha = 1;
+ this.titleBarColors = [16777215,12237498];
+ this.titleBarButtonPadding = 5;
+ this.showFlexChrome = true;
+ this.roundedBottomCorners = false;
+ this.minimizeButtonSkin = WindowMinimizeButtonSkin;
+ this.statusBarBackgroundColor = 14540253;
+ this.maximizeButtonSkin = WindowMaximizeButtonSkin;
+ this.buttonPadding = 2;
+ this.highlightAlphas = [1,1];
+ this.titleAlignment = "auto";
+ this.gripperStyleName = "gripperSkin";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.managers.CursorManager",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.managers.CursorManager");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.busyCursor = BusyCursor;
+ this.busyCursorBackground = _embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.managers.DragManager",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.managers.DragManager");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.copyCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173;
+ this.moveCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753;
+ this.rejectCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361;
+ this.linkCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178;
+ this.defaultDragImageSkin = DefaultDragImage;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.SWFLoader",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.SWFLoader");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.brokenImageSkin = _embed_css_Assets_swf_728414423___brokenImage_1187203851;
+ this.brokenImageBorderSkin = BrokenImageBorderSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.ToolTip",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.ToolTip");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderStyle = "toolTip";
+ this.paddingTop = 2;
+ this.borderColor = 9542041;
+ this.backgroundColor = 16777164;
+ this.borderSkin = ToolTipBorder;
+ this.cornerRadius = 2;
+ this.fontSize = 10;
+ this.paddingLeft = 4;
+ this.paddingBottom = 2;
+ this.backgroundAlpha = 0.95;
+ this.paddingRight = 4;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.Application",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.Application");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.backgroundColor = 16777215;
+ this.skinClass = ApplicationSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.Button",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.Button");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = spark.skins.spark.ButtonSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","emphasized");
+ conditions.push(condition);
+ selector = new CSSSelector("spark.components.Button",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.Button.emphasized");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = spark.skins.spark.DefaultButtonSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.CheckBox",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.CheckBox");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = spark.skins.spark.CheckBoxSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.HScrollBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.HScrollBar");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = HScrollBarSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.Panel",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.Panel");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderColor = 0;
+ this.backgroundColor = 16777215;
+ this.dropShadowVisible = true;
+ this.skinClass = PanelSkin;
+ this.cornerRadius = 0;
+ this.borderAlpha = 0.5;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.RichEditableText",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.RichEditableText");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.layoutDirection = "ltr";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.Scroller",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.Scroller");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = ScrollerSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.supportClasses.SkinnableComponent",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.supportClasses.SkinnableComponent");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.focusSkin = FocusSkin;
+ this.errorSkin = ErrorSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.SkinnableContainer",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.SkinnableContainer");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = SkinnableContainerSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("pseudo","normalWithPrompt");
+ conditions.push(condition);
+ selector = new CSSSelector("spark.components.supportClasses.SkinnableTextBase",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.supportClasses.SkinnableTextBase:normalWithPrompt");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.color = 12237498;
+ this.fontStyle = "italic";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("pseudo","disabledWithPrompt");
+ conditions.push(condition);
+ selector = new CSSSelector("spark.components.supportClasses.SkinnableTextBase",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.supportClasses.SkinnableTextBase:disabledWithPrompt");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.color = 12237498;
+ this.fontStyle = "italic";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.supportClasses.TextBase",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.supportClasses.TextBase");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.layoutDirection = "ltr";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.TextArea",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.TextArea");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.paddingTop = 5;
+ this.skinClass = TextAreaSkin;
+ this.paddingLeft = 3;
+ this.paddingBottom = 3;
+ this.paddingRight = 3;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.TitleWindow",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.TitleWindow");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderColor = 0;
+ this.dropShadowVisible = true;
+ this.skinClass = TitleWindowSkin;
+ this.cornerRadius = 0;
+ this.borderAlpha = 0.8;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("spark.components.VScrollBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("spark.components.VScrollBar");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.skinClass = VScrollBarSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.Accordion",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.Accordion");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderStyle = "solid";
+ this.paddingTop = -1;
+ this.backgroundColor = 16777215;
+ this.borderSkin = BorderSkin;
+ this.verticalGap = -1;
+ this.paddingLeft = -1;
+ this.paddingBottom = -1;
+ this.paddingRight = -1;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.accordionClasses.AccordionHeader",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.accordionClasses.AccordionHeader");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.downSkin = null;
+ this.overSkin = null;
+ this.paddingTop = 0;
+ this.selectedDisabledSkin = null;
+ this.selectedUpSkin = null;
+ this.skin = AccordionHeaderSkin;
+ this.paddingLeft = 5;
+ this.paddingRight = 5;
+ this.upSkin = null;
+ this.selectedDownSkin = null;
+ this.textAlign = "start";
+ this.disabledSkin = null;
+ this.horizontalGap = 2;
+ this.paddingBottom = 0;
+ this.selectedOverSkin = null;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.Alert",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.Alert");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.paddingTop = 2;
+ this.paddingLeft = 10;
+ this.paddingBottom = 10;
+ this.paddingRight = 10;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.core.Application",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.core.Application");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.paddingTop = 24;
+ this.backgroundColor = 16777215;
+ this.horizontalAlign = "center";
+ this.paddingLeft = 24;
+ this.paddingBottom = 24;
+ this.paddingRight = 24;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.Button",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.Button");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.textAlign = "center";
+ this.labelVerticalOffset = 1;
+ this.emphasizedSkin = mx.skins.spark.DefaultButtonSkin;
+ this.verticalGap = 2;
+ this.horizontalGap = 2;
+ this.skin = mx.skins.spark.ButtonSkin;
+ this.paddingLeft = 6;
+ this.paddingRight = 6;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.CheckBox",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.CheckBox");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.icon = mx.skins.spark.CheckBoxSkin;
+ this.downSkin = null;
+ this.overSkin = null;
+ this.selectedDisabledSkin = null;
+ this.paddingTop = -1;
+ this.disabledIcon = null;
+ this.upIcon = null;
+ this.selectedDownIcon = null;
+ this.selectedUpSkin = null;
+ this.overIcon = null;
+ this.skin = null;
+ this.paddingLeft = 0;
+ this.paddingRight = 0;
+ this.upSkin = null;
+ this.fontWeight = "normal";
+ this.selectedDownSkin = null;
+ this.selectedUpIcon = null;
+ this.selectedOverIcon = null;
+ this.selectedDisabledIcon = null;
+ this.textAlign = "start";
+ this.labelVerticalOffset = 1;
+ this.disabledSkin = null;
+ this.horizontalGap = 3;
+ this.paddingBottom = -1;
+ this.selectedOverSkin = null;
+ this.downIcon = null;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.ComboBase",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.ComboBase");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderSkin = BorderSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.ComboBox",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.ComboBox");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.paddingTop = -1;
+ this.dropdownStyleName = "comboDropdown";
+ this.leading = 0;
+ this.arrowButtonWidth = 18;
+ this.editableSkin = EditableComboBoxSkin;
+ this.skin = ComboBoxSkin;
+ this.paddingLeft = 5;
+ this.paddingBottom = -2;
+ this.paddingRight = 5;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","comboDropdown");
+ conditions.push(condition);
+ selector = new CSSSelector("mx.controls.List",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.List.comboDropdown");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.fontWeight = "normal";
+ this.leading = 0;
+ this.dropShadowVisible = true;
+ this.paddingLeft = 5;
+ this.paddingRight = 5;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.core.Container",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.core.Container");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderStyle = "none";
+ this.borderSkin = ContainerBorderSkin;
+ this.cornerRadius = 0;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.ControlBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.ControlBar");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.disabledOverlayAlpha = 0;
+ this.borderStyle = "none";
+ this.paddingTop = 11;
+ this.verticalAlign = "middle";
+ this.paddingLeft = 11;
+ this.paddingBottom = 11;
+ this.paddingRight = 11;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.DividedBox",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.DividedBox");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.dividerThickness = 3;
+ this.dividerColor = 7305079;
+ this.dividerAffordance = 6;
+ this.verticalDividerCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310;
+ this.dividerSkin = _embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805;
+ this.horizontalDividerCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792;
+ this.dividerAlpha = 0.75;
+ this.verticalGap = 10;
+ this.horizontalGap = 10;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.HDividedBox",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.HDividedBox");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.dividerThickness = 3;
+ this.dividerColor = 7305079;
+ this.dividerAffordance = 6;
+ this.verticalDividerCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310;
+ this.dividerSkin = _embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805;
+ this.horizontalDividerCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792;
+ this.dividerAlpha = 0.75;
+ this.verticalGap = 10;
+ this.horizontalGap = 10;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.Image",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.Image");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.layoutDirection = "ltr";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.listClasses.ListBase",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.listClasses.ListBase");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderStyle = "solid";
+ this.paddingTop = 2;
+ this.dropIndicatorSkin = ListDropIndicator;
+ this._creationPolicy = "auto";
+ this.paddingLeft = 2;
+ this.paddingBottom = 2;
+ this.paddingRight = 0;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.NumericStepper",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.NumericStepper");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.downArrowSkin = StepperDecrButtonSkin;
+ this.upArrowSkin = StepperIncrButtonSkin;
+ this.focusRoundedCorners = "tr br";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.Panel",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.Panel");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.statusStyleName = "windowStatus";
+ this.borderStyle = "default";
+ this.borderColor = 0;
+ this.paddingTop = 0;
+ this.backgroundColor = 16777215;
+ this.cornerRadius = 0;
+ this.titleBackgroundSkin = UIComponent;
+ this.borderAlpha = 0.5;
+ this.paddingLeft = 0;
+ this.paddingRight = 0;
+ this.resizeEndEffect = "Dissolve";
+ this.titleStyleName = "windowStyles";
+ this.resizeStartEffect = "Dissolve";
+ this.dropShadowVisible = true;
+ this.borderSkin = PanelBorderSkin;
+ this.paddingBottom = 0;
+ };
+ }
+ effects = style.mx_internal::effects;
+ if(!effects)
+ {
+ effects = style.mx_internal::effects = [];
+ }
+ effects.push("resizeEndEffect");
+ effects.push("resizeStartEffect");
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.ProgressBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.ProgressBar");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.fontWeight = "bold";
+ this.leading = 0;
+ this.barSkin = ProgressBarSkin;
+ this.trackSkin = ProgressBarTrackSkin;
+ this.indeterminateMoveInterval = 14;
+ this.maskSkin = ProgressMaskSkin;
+ this.indeterminateSkin = ProgressIndeterminateSkin;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.scrollClasses.ScrollBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.scrollClasses.ScrollBar");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.thumbOffset = 0;
+ this.paddingTop = 0;
+ this.trackSkin = ScrollBarTrackSkin;
+ this.downArrowSkin = ScrollBarDownButtonSkin;
+ this.upArrowSkin = ScrollBarUpButtonSkin;
+ this.paddingLeft = 0;
+ this.paddingBottom = 0;
+ this.thumbSkin = ScrollBarThumbSkin;
+ this.paddingRight = 0;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.core.ScrollControlBase",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.core.ScrollControlBase");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.borderSkin = BorderSkin;
+ this.focusRoundedCorners = " ";
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","textAreaVScrollBarStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("mx.controls.HScrollBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.HScrollBar.textAreaVScrollBarStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = [];
+ condition = new CSSCondition("class","textAreaHScrollBarStyle");
+ conditions.push(condition);
+ selector = new CSSSelector("mx.controls.VScrollBar",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.VScrollBar.textAreaHScrollBarStyle");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.TextInput",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.TextInput");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.paddingTop = 2;
+ this.borderSkin = TextInputBorderSkin;
+ this.paddingLeft = 2;
+ this.paddingRight = 2;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.controls.TileList",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.controls.TileList");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.textAlign = "center";
+ this.verticalAlign = "middle";
+ this.paddingLeft = 2;
+ this.paddingRight = 2;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.TitleWindow",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.TitleWindow");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.closeButtonDisabledSkin = _embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819;
+ this.paddingTop = 4;
+ this.backgroundColor = 16777215;
+ this.dropShadowVisible = true;
+ this.closeButtonOverSkin = _embed_css_Assets_swf_728414423_CloseButtonOver_974659645;
+ this.closeButtonUpSkin = _embed_css_Assets_swf_728414423_CloseButtonUp_98224972;
+ this.closeButtonDownSkin = _embed_css_Assets_swf_728414423_CloseButtonDown_1138829611;
+ this.paddingLeft = 4;
+ this.paddingBottom = 4;
+ this.paddingRight = 4;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ selector = null;
+ conditions = null;
+ conditions = null;
+ selector = new CSSSelector("mx.containers.VDividedBox",conditions,selector);
+ mergedStyle = styleManager.getMergedStyleDeclaration("mx.containers.VDividedBox");
+ style = new CSSStyleDeclaration(selector,styleManager,mergedStyle == null);
+ if(style.defaultFactory == null)
+ {
+ style.defaultFactory = function():void
+ {
+ this.dividerThickness = 3;
+ this.dividerColor = 7305079;
+ this.dividerAffordance = 6;
+ this.verticalDividerCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310;
+ this.dividerSkin = _embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805;
+ this.horizontalDividerCursor = _embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792;
+ this.dividerAlpha = 0.75;
+ this.verticalGap = 10;
+ this.horizontalGap = 10;
+ };
+ }
+ if(mergedStyle != null && (mergedStyle.defaultFactory == null || ObjectUtil.compare(new style.defaultFactory(),new mergedStyle.defaultFactory())))
+ {
+ styleManager.setStyleDeclaration(style.mx_internal::selectorString,style,false);
+ }
+ }
+ }
+}
+
diff --git a/src/_AlternativaEditor_mx_managers_SystemManager.as b/src/_AlternativaEditor_mx_managers_SystemManager.as
new file mode 100644
index 0000000..8567cdf
--- /dev/null
+++ b/src/_AlternativaEditor_mx_managers_SystemManager.as
@@ -0,0 +1,154 @@
+package
+{
+ import flash.display.LoaderInfo;
+ import flash.system.ApplicationDomain;
+ import flash.system.Security;
+ import flash.utils.Dictionary;
+ import flashx.textLayout.compose.ISWFContext;
+ import mx.core.IFlexModule;
+ import mx.core.IFlexModuleFactory;
+ import mx.events.RSLEvent;
+ import mx.managers.SystemManager;
+ import mx.preloaders.SparkDownloadProgressBar;
+
+ public class _AlternativaEditor_mx_managers_SystemManager extends SystemManager implements IFlexModuleFactory, ISWFContext
+ {
+ private var _info:Object;
+
+ private var _preloadedRSLs:Dictionary;
+
+ private var _allowDomainParameters:Vector.;
+
+ private var _allowInsecureDomainParameters:Vector.;
+
+ public function _AlternativaEditor_mx_managers_SystemManager()
+ {
+ super();
+ }
+
+ override public function callInContext(param1:Function, param2:Object, param3:Array, param4:Boolean = true) : *
+ {
+ if(param4)
+ {
+ return param1.apply(param2,param3);
+ }
+ param1.apply(param2,param3);
+ }
+
+ override public function create(... rest) : Object
+ {
+ if(rest.length > 0 && !(rest[0] is String))
+ {
+ return super.create.apply(this,rest);
+ }
+ var loc2:String = rest.length == 0 ? "AlternativaEditor" : String(rest[0]);
+ var loc3:Class = Class(getDefinitionByName(loc2));
+ if(!loc3)
+ {
+ return null;
+ }
+ var loc4:Object = new loc3();
+ if(loc4 is IFlexModule)
+ {
+ IFlexModule(loc4).moduleFactory = this;
+ }
+ return loc4;
+ }
+
+ override public function info() : Object
+ {
+ if(!this._info)
+ {
+ this._info = {
+ "applicationComplete":"onApplicationComplete();",
+ "compiledLocales":["en_US"],
+ "compiledResourceBundleNames":["collections","components","containers","controls","core","effects","layout","skins","sparkEffects","styles","textLayout"],
+ "currentDomain":ApplicationDomain.currentDomain,
+ "layout":"absolute",
+ "mainClassName":"AlternativaEditor",
+ "mixins":["_AlternativaEditor_FlexInit","_AlternativaEditor_Styles","mx.managers.systemClasses.ActiveWindowManager","mx.messaging.config.LoaderConfig"],
+ "preloader":SparkDownloadProgressBar
+ };
+ }
+ return this._info;
+ }
+
+ override public function get preloadedRSLs() : Dictionary
+ {
+ if(this._preloadedRSLs == null)
+ {
+ this._preloadedRSLs = new Dictionary(true);
+ }
+ return this._preloadedRSLs;
+ }
+
+ override public function allowDomain(... rest) : void
+ {
+ var loc2:Object = null;
+ Security.allowDomain.apply(null,rest);
+ for(loc2 in this._preloadedRSLs)
+ {
+ if(Boolean(loc2.content) && "allowDomainInRSL" in loc2.content)
+ {
+ loc2.content["allowDomainInRSL"].apply(null,rest);
+ }
+ }
+ if(!this._allowDomainParameters)
+ {
+ this._allowDomainParameters = new Vector.();
+ }
+ this._allowDomainParameters.push(rest);
+ addEventListener(RSLEvent.RSL_ADD_PRELOADED,this.addPreloadedRSLHandler,false,50);
+ }
+
+ override public function allowInsecureDomain(... rest) : void
+ {
+ var loc2:Object = null;
+ Security.allowInsecureDomain.apply(null,rest);
+ for(loc2 in this._preloadedRSLs)
+ {
+ if(Boolean(loc2.content) && "allowInsecureDomainInRSL" in loc2.content)
+ {
+ loc2.content["allowInsecureDomainInRSL"].apply(null,rest);
+ }
+ }
+ if(!this._allowInsecureDomainParameters)
+ {
+ this._allowInsecureDomainParameters = new Vector.();
+ }
+ this._allowInsecureDomainParameters.push(rest);
+ addEventListener(RSLEvent.RSL_ADD_PRELOADED,this.addPreloadedRSLHandler,false,50);
+ }
+
+ private function addPreloadedRSLHandler(param1:RSLEvent) : void
+ {
+ var loc3:Array = null;
+ var loc2:LoaderInfo = param1.loaderInfo;
+ if(!loc2 || !loc2.content)
+ {
+ return;
+ }
+ if(allowDomainsInNewRSLs && Boolean(this._allowDomainParameters))
+ {
+ for each(loc3 in this._allowDomainParameters)
+ {
+ if("allowDomainInRSL" in loc2.content)
+ {
+ loc2.content["allowDomainInRSL"].apply(null,loc3);
+ }
+ }
+ }
+ if(allowInsecureDomainsInNewRSLs && Boolean(this._allowInsecureDomainParameters))
+ {
+ for each(loc3 in this._allowInsecureDomainParameters)
+ {
+ if("allowInsecureDomainInRSL" in loc2.content)
+ {
+ loc2.content["allowInsecureDomainInRSL"].apply(null,loc3);
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/_alternativa_editor_KillZonePropertiesPanelWatcherSetupUtil.as b/src/_alternativa_editor_KillZonePropertiesPanelWatcherSetupUtil.as
new file mode 100644
index 0000000..f9a8939
--- /dev/null
+++ b/src/_alternativa_editor_KillZonePropertiesPanelWatcherSetupUtil.as
@@ -0,0 +1,24 @@
+package
+{
+ import alternativa.editor.KillZonePropertiesPanel;
+ import mx.binding.IWatcherSetupUtil2;
+ import mx.core.IFlexModuleFactory;
+
+ public class _alternativa_editor_KillZonePropertiesPanelWatcherSetupUtil implements IWatcherSetupUtil2
+ {
+ public function _alternativa_editor_KillZonePropertiesPanelWatcherSetupUtil()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ KillZonePropertiesPanel.watcherSetupUtil = new _alternativa_editor_KillZonePropertiesPanelWatcherSetupUtil();
+ }
+
+ public function setup(param1:Object, param2:Function, param3:Function, param4:Array, param5:Array) : void
+ {
+ }
+ }
+}
+
diff --git a/src/_assets/100__class_embed_css_mac_min_down_png_856242377_1625405496.png b/src/_assets/100__class_embed_css_mac_min_down_png_856242377_1625405496.png
new file mode 100644
index 0000000..313d055
Binary files /dev/null and b/src/_assets/100__class_embed_css_mac_min_down_png_856242377_1625405496.png differ
diff --git a/src/_assets/101__class_embed_css_mac_close_up_png_1150873372_2050114321.png b/src/_assets/101__class_embed_css_mac_close_up_png_1150873372_2050114321.png
new file mode 100644
index 0000000..9f6d777
Binary files /dev/null and b/src/_assets/101__class_embed_css_mac_close_up_png_1150873372_2050114321.png differ
diff --git a/src/_assets/102__class_embed_css_mac_max_dis_png__26448273_1865306912.png b/src/_assets/102__class_embed_css_mac_max_dis_png__26448273_1865306912.png
new file mode 100644
index 0000000..256b9e3
Binary files /dev/null and b/src/_assets/102__class_embed_css_mac_max_dis_png__26448273_1865306912.png differ
diff --git a/src/_assets/103_AlternativaEditor__embed_mxml_icons_editor_textures_icon_on_png_1337944485.png b/src/_assets/103_AlternativaEditor__embed_mxml_icons_editor_textures_icon_on_png_1337944485.png
new file mode 100644
index 0000000..5df7aa1
Binary files /dev/null and b/src/_assets/103_AlternativaEditor__embed_mxml_icons_editor_textures_icon_on_png_1337944485.png differ
diff --git a/src/_assets/104_AlternativaEditor__embed_mxml_icons_editor_snap_icon_on_png_1937502153.png b/src/_assets/104_AlternativaEditor__embed_mxml_icons_editor_snap_icon_on_png_1937502153.png
new file mode 100644
index 0000000..a63a303
Binary files /dev/null and b/src/_assets/104_AlternativaEditor__embed_mxml_icons_editor_snap_icon_on_png_1937502153.png differ
diff --git a/src/_assets/105__class_embed_css_mac_max_down_png_381816311_1824039210.png b/src/_assets/105__class_embed_css_mac_max_down_png_381816311_1824039210.png
new file mode 100644
index 0000000..8245ab6
Binary files /dev/null and b/src/_assets/105__class_embed_css_mac_max_down_png_381816311_1824039210.png differ
diff --git a/src/_assets/106__class_embed_css_mac_max_up_png_2014335472_887462691.png b/src/_assets/106__class_embed_css_mac_max_up_png_2014335472_887462691.png
new file mode 100644
index 0000000..e9b3000
Binary files /dev/null and b/src/_assets/106__class_embed_css_mac_max_up_png_2014335472_887462691.png differ
diff --git a/src/_assets/107__class_embed_css_win_min_down_png__2044797092_465343185.png b/src/_assets/107__class_embed_css_win_min_down_png__2044797092_465343185.png
new file mode 100644
index 0000000..6a457f4
Binary files /dev/null and b/src/_assets/107__class_embed_css_win_min_down_png__2044797092_465343185.png differ
diff --git a/src/_assets/108__class_embed_css_win_min_over_png_1352175246_2117214847.png b/src/_assets/108__class_embed_css_win_min_over_png_1352175246_2117214847.png
new file mode 100644
index 0000000..1bafa4c
Binary files /dev/null and b/src/_assets/108__class_embed_css_win_min_over_png_1352175246_2117214847.png differ
diff --git a/src/_assets/109__class_embed_css_mac_min_over_png__41752581_1023914202.png b/src/_assets/109__class_embed_css_mac_min_over_png__41752581_1023914202.png
new file mode 100644
index 0000000..75da449
Binary files /dev/null and b/src/_assets/109__class_embed_css_mac_min_over_png__41752581_1023914202.png differ
diff --git a/src/_assets/110__class_embed_css_win_min_dis_png__1490199446_689239761.png b/src/_assets/110__class_embed_css_win_min_dis_png__1490199446_689239761.png
new file mode 100644
index 0000000..fb7eb6a
Binary files /dev/null and b/src/_assets/110__class_embed_css_win_min_dis_png__1490199446_689239761.png differ
diff --git a/src/_assets/111_AlternativaEditor__embed_mxml_icons_editor_snap_icon_png_1223024147.png b/src/_assets/111_AlternativaEditor__embed_mxml_icons_editor_snap_icon_png_1223024147.png
new file mode 100644
index 0000000..b4c3b6d
Binary files /dev/null and b/src/_assets/111_AlternativaEditor__embed_mxml_icons_editor_snap_icon_png_1223024147.png differ
diff --git a/src/_assets/112__class_embed_css_win_min_up_png__1496565611_1904338868.png b/src/_assets/112__class_embed_css_win_min_up_png__1496565611_1904338868.png
new file mode 100644
index 0000000..9047de4
Binary files /dev/null and b/src/_assets/112__class_embed_css_win_min_up_png__1496565611_1904338868.png differ
diff --git a/src/_assets/32_mx.graphics.shaderClasses.LuminosityShader_ShaderClass_mx.graphics.shaderClasses.LuminosityShader_ShaderClass.bin b/src/_assets/32_mx.graphics.shaderClasses.LuminosityShader_ShaderClass_mx.graphics.shaderClasses.LuminosityShader_ShaderClass.bin
new file mode 100644
index 0000000..701aee0
Binary files /dev/null and b/src/_assets/32_mx.graphics.shaderClasses.LuminosityShader_ShaderClass_mx.graphics.shaderClasses.LuminosityShader_ShaderClass.bin differ
diff --git a/src/_assets/33_mx.graphics.shaderClasses.ColorDodgeShader_ShaderClass_mx.graphics.shaderClasses.ColorDodgeShader_ShaderClass.bin b/src/_assets/33_mx.graphics.shaderClasses.ColorDodgeShader_ShaderClass_mx.graphics.shaderClasses.ColorDodgeShader_ShaderClass.bin
new file mode 100644
index 0000000..17f456a
Binary files /dev/null and b/src/_assets/33_mx.graphics.shaderClasses.ColorDodgeShader_ShaderClass_mx.graphics.shaderClasses.ColorDodgeShader_ShaderClass.bin differ
diff --git a/src/_assets/34_mx.graphics.shaderClasses.ColorShader_ShaderClass_mx.graphics.shaderClasses.ColorShader_ShaderClass.bin b/src/_assets/34_mx.graphics.shaderClasses.ColorShader_ShaderClass_mx.graphics.shaderClasses.ColorShader_ShaderClass.bin
new file mode 100644
index 0000000..d5288f2
Binary files /dev/null and b/src/_assets/34_mx.graphics.shaderClasses.ColorShader_ShaderClass_mx.graphics.shaderClasses.ColorShader_ShaderClass.bin differ
diff --git a/src/_assets/35_mx.graphics.shaderClasses.HueShader_ShaderClass_mx.graphics.shaderClasses.HueShader_ShaderClass.bin b/src/_assets/35_mx.graphics.shaderClasses.HueShader_ShaderClass_mx.graphics.shaderClasses.HueShader_ShaderClass.bin
new file mode 100644
index 0000000..b688cbf
Binary files /dev/null and b/src/_assets/35_mx.graphics.shaderClasses.HueShader_ShaderClass_mx.graphics.shaderClasses.HueShader_ShaderClass.bin differ
diff --git a/src/_assets/36_mx.graphics.shaderClasses.ColorBurnShader_ShaderClass_mx.graphics.shaderClasses.ColorBurnShader_ShaderClass.bin b/src/_assets/36_mx.graphics.shaderClasses.ColorBurnShader_ShaderClass_mx.graphics.shaderClasses.ColorBurnShader_ShaderClass.bin
new file mode 100644
index 0000000..c51072f
Binary files /dev/null and b/src/_assets/36_mx.graphics.shaderClasses.ColorBurnShader_ShaderClass_mx.graphics.shaderClasses.ColorBurnShader_ShaderClass.bin differ
diff --git a/src/_assets/37_mx.graphics.shaderClasses.ExclusionShader_ShaderClass_mx.graphics.shaderClasses.ExclusionShader_ShaderClass.bin b/src/_assets/37_mx.graphics.shaderClasses.ExclusionShader_ShaderClass_mx.graphics.shaderClasses.ExclusionShader_ShaderClass.bin
new file mode 100644
index 0000000..ede2d6e
Binary files /dev/null and b/src/_assets/37_mx.graphics.shaderClasses.ExclusionShader_ShaderClass_mx.graphics.shaderClasses.ExclusionShader_ShaderClass.bin differ
diff --git a/src/_assets/38_mx.graphics.shaderClasses.SoftLightShader_ShaderClass_mx.graphics.shaderClasses.SoftLightShader_ShaderClass.bin b/src/_assets/38_mx.graphics.shaderClasses.SoftLightShader_ShaderClass_mx.graphics.shaderClasses.SoftLightShader_ShaderClass.bin
new file mode 100644
index 0000000..cfb7a4d
Binary files /dev/null and b/src/_assets/38_mx.graphics.shaderClasses.SoftLightShader_ShaderClass_mx.graphics.shaderClasses.SoftLightShader_ShaderClass.bin differ
diff --git a/src/_assets/39_mx.graphics.shaderClasses.SaturationShader_ShaderClass_mx.graphics.shaderClasses.SaturationShader_ShaderClass.bin b/src/_assets/39_mx.graphics.shaderClasses.SaturationShader_ShaderClass_mx.graphics.shaderClasses.SaturationShader_ShaderClass.bin
new file mode 100644
index 0000000..0939d85
Binary files /dev/null and b/src/_assets/39_mx.graphics.shaderClasses.SaturationShader_ShaderClass_mx.graphics.shaderClasses.SaturationShader_ShaderClass.bin differ
diff --git a/src/_assets/40_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDisabledSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDisabledSkin.png b/src/_assets/40_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDisabledSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDisabledSkin.png
new file mode 100644
index 0000000..256b9e3
Binary files /dev/null and b/src/_assets/40_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDisabledSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDisabledSkin.png differ
diff --git a/src/_assets/41_mx.skins.halo.WindowMaximizeButtonSkin_macMaxOverSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxOverSkin.png b/src/_assets/41_mx.skins.halo.WindowMaximizeButtonSkin_macMaxOverSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxOverSkin.png
new file mode 100644
index 0000000..2e67359
Binary files /dev/null and b/src/_assets/41_mx.skins.halo.WindowMaximizeButtonSkin_macMaxOverSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxOverSkin.png differ
diff --git a/src/_assets/42_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDownSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDownSkin.png b/src/_assets/42_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDownSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDownSkin.png
new file mode 100644
index 0000000..acf1a88
Binary files /dev/null and b/src/_assets/42_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDownSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDownSkin.png differ
diff --git a/src/_assets/43_mx.skins.halo.WindowMaximizeButtonSkin_winMaxOverSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxOverSkin.png b/src/_assets/43_mx.skins.halo.WindowMaximizeButtonSkin_winMaxOverSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxOverSkin.png
new file mode 100644
index 0000000..df1ea42
Binary files /dev/null and b/src/_assets/43_mx.skins.halo.WindowMaximizeButtonSkin_winMaxOverSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxOverSkin.png differ
diff --git a/src/_assets/44_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDownSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDownSkin.png b/src/_assets/44_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDownSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDownSkin.png
new file mode 100644
index 0000000..8245ab6
Binary files /dev/null and b/src/_assets/44_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDownSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxDownSkin.png differ
diff --git a/src/_assets/45_mx.skins.halo.WindowMaximizeButtonSkin_macMaxUpSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxUpSkin.png b/src/_assets/45_mx.skins.halo.WindowMaximizeButtonSkin_macMaxUpSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxUpSkin.png
new file mode 100644
index 0000000..e9b3000
Binary files /dev/null and b/src/_assets/45_mx.skins.halo.WindowMaximizeButtonSkin_macMaxUpSkin_mx.skins.halo.WindowMaximizeButtonSkin_macMaxUpSkin.png differ
diff --git a/src/_assets/46_mx.skins.halo.WindowMaximizeButtonSkin_winMaxUpSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxUpSkin.png b/src/_assets/46_mx.skins.halo.WindowMaximizeButtonSkin_winMaxUpSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxUpSkin.png
new file mode 100644
index 0000000..14a446c
Binary files /dev/null and b/src/_assets/46_mx.skins.halo.WindowMaximizeButtonSkin_winMaxUpSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxUpSkin.png differ
diff --git a/src/_assets/47_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDisabledSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDisabledSkin.png b/src/_assets/47_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDisabledSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDisabledSkin.png
new file mode 100644
index 0000000..ca137d3
Binary files /dev/null and b/src/_assets/47_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDisabledSkin_mx.skins.halo.WindowMaximizeButtonSkin_winMaxDisabledSkin.png differ
diff --git a/src/_assets/48_mx.skins.halo.WindowMinimizeButtonSkin_macMinDisabledSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinDisabledSkin.png b/src/_assets/48_mx.skins.halo.WindowMinimizeButtonSkin_macMinDisabledSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinDisabledSkin.png
new file mode 100644
index 0000000..ac75d08
Binary files /dev/null and b/src/_assets/48_mx.skins.halo.WindowMinimizeButtonSkin_macMinDisabledSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinDisabledSkin.png differ
diff --git a/src/_assets/49_mx.skins.halo.WindowMinimizeButtonSkin_winMinUpSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinUpSkin.png b/src/_assets/49_mx.skins.halo.WindowMinimizeButtonSkin_winMinUpSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinUpSkin.png
new file mode 100644
index 0000000..9047de4
Binary files /dev/null and b/src/_assets/49_mx.skins.halo.WindowMinimizeButtonSkin_winMinUpSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinUpSkin.png differ
diff --git a/src/_assets/50_mx.skins.halo.WindowMinimizeButtonSkin_macMinOverSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinOverSkin.png b/src/_assets/50_mx.skins.halo.WindowMinimizeButtonSkin_macMinOverSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinOverSkin.png
new file mode 100644
index 0000000..75da449
Binary files /dev/null and b/src/_assets/50_mx.skins.halo.WindowMinimizeButtonSkin_macMinOverSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinOverSkin.png differ
diff --git a/src/_assets/51_mx.skins.halo.WindowMinimizeButtonSkin_winMinOverSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinOverSkin.png b/src/_assets/51_mx.skins.halo.WindowMinimizeButtonSkin_winMinOverSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinOverSkin.png
new file mode 100644
index 0000000..1bafa4c
Binary files /dev/null and b/src/_assets/51_mx.skins.halo.WindowMinimizeButtonSkin_winMinOverSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinOverSkin.png differ
diff --git a/src/_assets/52_mx.skins.halo.WindowMinimizeButtonSkin_winMinDownSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinDownSkin.png b/src/_assets/52_mx.skins.halo.WindowMinimizeButtonSkin_winMinDownSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinDownSkin.png
new file mode 100644
index 0000000..6a457f4
Binary files /dev/null and b/src/_assets/52_mx.skins.halo.WindowMinimizeButtonSkin_winMinDownSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinDownSkin.png differ
diff --git a/src/_assets/53_mx.skins.halo.WindowMinimizeButtonSkin_macMinUpSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinUpSkin.png b/src/_assets/53_mx.skins.halo.WindowMinimizeButtonSkin_macMinUpSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinUpSkin.png
new file mode 100644
index 0000000..2933f51
Binary files /dev/null and b/src/_assets/53_mx.skins.halo.WindowMinimizeButtonSkin_macMinUpSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinUpSkin.png differ
diff --git a/src/_assets/54_mx.skins.halo.WindowMinimizeButtonSkin_winMinDisabledSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinDisabledSkin.png b/src/_assets/54_mx.skins.halo.WindowMinimizeButtonSkin_winMinDisabledSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinDisabledSkin.png
new file mode 100644
index 0000000..fb7eb6a
Binary files /dev/null and b/src/_assets/54_mx.skins.halo.WindowMinimizeButtonSkin_winMinDisabledSkin_mx.skins.halo.WindowMinimizeButtonSkin_winMinDisabledSkin.png differ
diff --git a/src/_assets/55_mx.skins.halo.WindowMinimizeButtonSkin_macMinDownSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinDownSkin.png b/src/_assets/55_mx.skins.halo.WindowMinimizeButtonSkin_macMinDownSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinDownSkin.png
new file mode 100644
index 0000000..313d055
Binary files /dev/null and b/src/_assets/55_mx.skins.halo.WindowMinimizeButtonSkin_macMinDownSkin_mx.skins.halo.WindowMinimizeButtonSkin_macMinDownSkin.png differ
diff --git a/src/_assets/56_mx.skins.halo.WindowCloseButtonSkin_winCloseDownSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseDownSkin.png b/src/_assets/56_mx.skins.halo.WindowCloseButtonSkin_winCloseDownSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseDownSkin.png
new file mode 100644
index 0000000..18f85f8
Binary files /dev/null and b/src/_assets/56_mx.skins.halo.WindowCloseButtonSkin_winCloseDownSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseDownSkin.png differ
diff --git a/src/_assets/57_mx.skins.halo.WindowCloseButtonSkin_macCloseOverSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseOverSkin.png b/src/_assets/57_mx.skins.halo.WindowCloseButtonSkin_macCloseOverSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseOverSkin.png
new file mode 100644
index 0000000..439baae
Binary files /dev/null and b/src/_assets/57_mx.skins.halo.WindowCloseButtonSkin_macCloseOverSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseOverSkin.png differ
diff --git a/src/_assets/58_mx.skins.halo.WindowCloseButtonSkin_macCloseDownSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseDownSkin.png b/src/_assets/58_mx.skins.halo.WindowCloseButtonSkin_macCloseDownSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseDownSkin.png
new file mode 100644
index 0000000..513212d
Binary files /dev/null and b/src/_assets/58_mx.skins.halo.WindowCloseButtonSkin_macCloseDownSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseDownSkin.png differ
diff --git a/src/_assets/59_mx.skins.halo.WindowCloseButtonSkin_winCloseUpSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseUpSkin.png b/src/_assets/59_mx.skins.halo.WindowCloseButtonSkin_winCloseUpSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseUpSkin.png
new file mode 100644
index 0000000..c3f98df
Binary files /dev/null and b/src/_assets/59_mx.skins.halo.WindowCloseButtonSkin_winCloseUpSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseUpSkin.png differ
diff --git a/src/_assets/60_mx.skins.halo.WindowCloseButtonSkin_macCloseUpSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseUpSkin.png b/src/_assets/60_mx.skins.halo.WindowCloseButtonSkin_macCloseUpSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseUpSkin.png
new file mode 100644
index 0000000..9f6d777
Binary files /dev/null and b/src/_assets/60_mx.skins.halo.WindowCloseButtonSkin_macCloseUpSkin_mx.skins.halo.WindowCloseButtonSkin_macCloseUpSkin.png differ
diff --git a/src/_assets/61_mx.skins.halo.WindowCloseButtonSkin_winCloseOverSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseOverSkin.png b/src/_assets/61_mx.skins.halo.WindowCloseButtonSkin_winCloseOverSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseOverSkin.png
new file mode 100644
index 0000000..180f6e6
Binary files /dev/null and b/src/_assets/61_mx.skins.halo.WindowCloseButtonSkin_winCloseOverSkin_mx.skins.halo.WindowCloseButtonSkin_winCloseOverSkin.png differ
diff --git a/src/_assets/62_mx.skins.halo.WindowRestoreButtonSkin_winRestoreDownSkin.png b/src/_assets/62_mx.skins.halo.WindowRestoreButtonSkin_winRestoreDownSkin.png
new file mode 100644
index 0000000..525dd5d
Binary files /dev/null and b/src/_assets/62_mx.skins.halo.WindowRestoreButtonSkin_winRestoreDownSkin.png differ
diff --git a/src/_assets/63_mx.skins.halo.WindowRestoreButtonSkin_winRestoreUpSkin.png b/src/_assets/63_mx.skins.halo.WindowRestoreButtonSkin_winRestoreUpSkin.png
new file mode 100644
index 0000000..dcd601d
Binary files /dev/null and b/src/_assets/63_mx.skins.halo.WindowRestoreButtonSkin_winRestoreUpSkin.png differ
diff --git a/src/_assets/64_mx.skins.halo.WindowRestoreButtonSkin_winRestoreOverSkin.png b/src/_assets/64_mx.skins.halo.WindowRestoreButtonSkin_winRestoreOverSkin.png
new file mode 100644
index 0000000..22ee35d
Binary files /dev/null and b/src/_assets/64_mx.skins.halo.WindowRestoreButtonSkin_winRestoreOverSkin.png differ
diff --git a/src/_assets/65_mx.graphics.shaderClasses.LuminosityMaskShader_ShaderClass_mx.graphics.shaderClasses.LuminosityMaskShader_ShaderClass.bin b/src/_assets/65_mx.graphics.shaderClasses.LuminosityMaskShader_ShaderClass_mx.graphics.shaderClasses.LuminosityMaskShader_ShaderClass.bin
new file mode 100644
index 0000000..96c83c4
Binary files /dev/null and b/src/_assets/65_mx.graphics.shaderClasses.LuminosityMaskShader_ShaderClass_mx.graphics.shaderClasses.LuminosityMaskShader_ShaderClass.bin differ
diff --git a/src/_assets/66__class_embed_css_win_restore_down_png__2017866336_395125171.png b/src/_assets/66__class_embed_css_win_restore_down_png__2017866336_395125171.png
new file mode 100644
index 0000000..525dd5d
Binary files /dev/null and b/src/_assets/66__class_embed_css_win_restore_down_png__2017866336_395125171.png differ
diff --git a/src/_assets/67__class_embed_css_win_close_over_png__1839723224_1256956523.png b/src/_assets/67__class_embed_css_win_close_over_png__1839723224_1256956523.png
new file mode 100644
index 0000000..180f6e6
Binary files /dev/null and b/src/_assets/67__class_embed_css_win_close_over_png__1839723224_1256956523.png differ
diff --git a/src/_assets/68__class_embed_css_win_restore_up_png__736761895_2120219528.png b/src/_assets/68__class_embed_css_win_restore_up_png__736761895_2120219528.png
new file mode 100644
index 0000000..dcd601d
Binary files /dev/null and b/src/_assets/68__class_embed_css_win_restore_up_png__736761895_2120219528.png differ
diff --git a/src/_assets/69__class_embed_css_win_close_up_png__1750166097_309569150.png b/src/_assets/69__class_embed_css_win_close_up_png__1750166097_309569150.png
new file mode 100644
index 0000000..c3f98df
Binary files /dev/null and b/src/_assets/69__class_embed_css_win_close_up_png__1750166097_309569150.png differ
diff --git a/src/_assets/70_alternativa.editor.FunctionalProps_flag3DSClass.bin b/src/_assets/70_alternativa.editor.FunctionalProps_flag3DSClass.bin
new file mode 100644
index 0000000..5b5b5b7
Binary files /dev/null and b/src/_assets/70_alternativa.editor.FunctionalProps_flag3DSClass.bin differ
diff --git a/src/_assets/71_alternativa.editor.FunctionalProps_ctfFlagBaseRedClass.jpg b/src/_assets/71_alternativa.editor.FunctionalProps_ctfFlagBaseRedClass.jpg
new file mode 100644
index 0000000..2178d36
Binary files /dev/null and b/src/_assets/71_alternativa.editor.FunctionalProps_ctfFlagBaseRedClass.jpg differ
diff --git a/src/_assets/72__class_embed_css_mac_close_down_png__476573661_30699662.png b/src/_assets/72__class_embed_css_mac_close_down_png__476573661_30699662.png
new file mode 100644
index 0000000..513212d
Binary files /dev/null and b/src/_assets/72__class_embed_css_mac_close_down_png__476573661_30699662.png differ
diff --git a/src/_assets/73.jpg b/src/_assets/73.jpg
new file mode 100644
index 0000000..87c61e5
Binary files /dev/null and b/src/_assets/73.jpg differ
diff --git a/src/_assets/74_AlternativaEditor_helpDataClass.bin b/src/_assets/74_AlternativaEditor_helpDataClass.bin
new file mode 100644
index 0000000..7949b2f
--- /dev/null
+++ b/src/_assets/74_AlternativaEditor_helpDataClass.bin
@@ -0,0 +1,18 @@
+Esc — clear selection
+Delete, C — delete selected prop
+X, Z — rotate selected prop or cursor
+K – switch half cell snapping
+Ctrl + = – zoom in
+Ctrl + - – zoom out
+Ctrl + 0 – reset camera direction
+Drag, arrows — moving selected prop or cursor
+Shift + drag — copy and moving selected prop
+V + drag, W, S — vertical moving
+Space — paste prop
+F — mirror texture
+Q — select conflict props
+Middle mouse button + drag — panning
+Alt + middle — rotate camera
+Link domination spawn point: Ctrl+Click on spawn point, then Ctrl+Click on check point
+Drag&Drop folder on editor window – load prop libs from all subfolders
+Drag&Drop map.xml – load map
\ No newline at end of file
diff --git a/src/_assets/75_alternativa.editor.FunctionalProps_bonus23DSClass.bin b/src/_assets/75_alternativa.editor.FunctionalProps_bonus23DSClass.bin
new file mode 100644
index 0000000..241f51c
Binary files /dev/null and b/src/_assets/75_alternativa.editor.FunctionalProps_bonus23DSClass.bin differ
diff --git a/src/_assets/76__class_embed_css_win_max_down_png_1775744138_402971533.png b/src/_assets/76__class_embed_css_win_max_down_png_1775744138_402971533.png
new file mode 100644
index 0000000..acf1a88
Binary files /dev/null and b/src/_assets/76__class_embed_css_win_max_down_png_1775744138_402971533.png differ
diff --git a/src/_assets/77_AlternativaEditor__embed_mxml_icons_editor_boxes_icon_on_png_1183323661.png b/src/_assets/77_AlternativaEditor__embed_mxml_icons_editor_boxes_icon_on_png_1183323661.png
new file mode 100644
index 0000000..3879f71
Binary files /dev/null and b/src/_assets/77_AlternativaEditor__embed_mxml_icons_editor_boxes_icon_on_png_1183323661.png differ
diff --git a/src/_assets/78_alternativa.editor.FunctionalProps_bonus13DSClass.bin b/src/_assets/78_alternativa.editor.FunctionalProps_bonus13DSClass.bin
new file mode 100644
index 0000000..037ded4
Binary files /dev/null and b/src/_assets/78_alternativa.editor.FunctionalProps_bonus13DSClass.bin differ
diff --git a/src/_assets/79__class_embed_css_win_max_over_png_877749180_1787411313.png b/src/_assets/79__class_embed_css_win_max_over_png_877749180_1787411313.png
new file mode 100644
index 0000000..df1ea42
Binary files /dev/null and b/src/_assets/79__class_embed_css_win_max_over_png_877749180_1787411313.png differ
diff --git a/src/_assets/80__class_embed_css_mac_min_dis_png__703880867_400936850.png b/src/_assets/80__class_embed_css_mac_min_dis_png__703880867_400936850.png
new file mode 100644
index 0000000..ac75d08
Binary files /dev/null and b/src/_assets/80__class_embed_css_mac_min_dis_png__703880867_400936850.png differ
diff --git a/src/_assets/81_alternativa.editor.InvisibleTexture_InvisibleTextureClass.png b/src/_assets/81_alternativa.editor.InvisibleTexture_InvisibleTextureClass.png
new file mode 100644
index 0000000..d10976c
Binary files /dev/null and b/src/_assets/81_alternativa.editor.InvisibleTexture_InvisibleTextureClass.png differ
diff --git a/src/_assets/82__class_embed_css_mac_min_up_png_191367490_1536362603.png b/src/_assets/82__class_embed_css_mac_min_up_png_191367490_1536362603.png
new file mode 100644
index 0000000..2933f51
Binary files /dev/null and b/src/_assets/82__class_embed_css_mac_min_up_png_191367490_1536362603.png differ
diff --git a/src/_assets/83_AlternativaEditor__embed_mxml_icons_editor_textures_icon_png_1183319561.png b/src/_assets/83_AlternativaEditor__embed_mxml_icons_editor_textures_icon_png_1183319561.png
new file mode 100644
index 0000000..a545a3e
Binary files /dev/null and b/src/_assets/83_AlternativaEditor__embed_mxml_icons_editor_textures_icon_png_1183319561.png differ
diff --git a/src/_assets/84_AlternativaEditor__embed_mxml_icons_editor_grid_icon_on_png_498725065.png b/src/_assets/84_AlternativaEditor__embed_mxml_icons_editor_grid_icon_on_png_498725065.png
new file mode 100644
index 0000000..7cbe1f6
Binary files /dev/null and b/src/_assets/84_AlternativaEditor__embed_mxml_icons_editor_grid_icon_on_png_498725065.png differ
diff --git a/src/_assets/85__class_embed_css_mac_close_over_png__1374568619_1213522700.png b/src/_assets/85__class_embed_css_mac_close_over_png__1374568619_1213522700.png
new file mode 100644
index 0000000..439baae
Binary files /dev/null and b/src/_assets/85__class_embed_css_mac_close_over_png__1374568619_1213522700.png differ
diff --git a/src/_assets/86_alternativa.editor.FunctionalProps_bonus33DSClass.bin b/src/_assets/86_alternativa.editor.FunctionalProps_bonus33DSClass.bin
new file mode 100644
index 0000000..68abaf7
Binary files /dev/null and b/src/_assets/86_alternativa.editor.FunctionalProps_bonus33DSClass.bin differ
diff --git a/src/_assets/87__class_embed_css_gripper_up_png__745420807_1298477336.png b/src/_assets/87__class_embed_css_gripper_up_png__745420807_1298477336.png
new file mode 100644
index 0000000..f97327a
Binary files /dev/null and b/src/_assets/87__class_embed_css_gripper_up_png__745420807_1298477336.png differ
diff --git a/src/_assets/88__class_embed_css_win_max_dis_png__812766852_512792721.png b/src/_assets/88__class_embed_css_win_max_dis_png__812766852_512792721.png
new file mode 100644
index 0000000..ca137d3
Binary files /dev/null and b/src/_assets/88__class_embed_css_win_max_dis_png__812766852_512792721.png differ
diff --git a/src/_assets/89_AlternativaEditor__embed_mxml_icons_editor_grid_icon_png_2082873845.png b/src/_assets/89_AlternativaEditor__embed_mxml_icons_editor_grid_icon_png_2082873845.png
new file mode 100644
index 0000000..e92a6ce
Binary files /dev/null and b/src/_assets/89_AlternativaEditor__embed_mxml_icons_editor_grid_icon_png_2082873845.png differ
diff --git a/src/_assets/90__class_embed_css_win_close_down_png__941728266_1862517095.png b/src/_assets/90__class_embed_css_win_close_down_png__941728266_1862517095.png
new file mode 100644
index 0000000..18f85f8
Binary files /dev/null and b/src/_assets/90__class_embed_css_win_close_down_png__941728266_1862517095.png differ
diff --git a/src/_assets/91_AlternativaEditor__embed_mxml_icons_editor_boxes_icon_png_1975719269.png b/src/_assets/91_AlternativaEditor__embed_mxml_icons_editor_boxes_icon_png_1975719269.png
new file mode 100644
index 0000000..9a66ad0
Binary files /dev/null and b/src/_assets/91_AlternativaEditor__embed_mxml_icons_editor_boxes_icon_png_1975719269.png differ
diff --git a/src/_assets/92_alternativa.editor.FunctionalProps_spawnPoint3DSClass.bin b/src/_assets/92_alternativa.editor.FunctionalProps_spawnPoint3DSClass.bin
new file mode 100644
index 0000000..74e3166
Binary files /dev/null and b/src/_assets/92_alternativa.editor.FunctionalProps_spawnPoint3DSClass.bin differ
diff --git a/src/_assets/93_alternativa.editor.scene.CursorScene_greenClass.jpg b/src/_assets/93_alternativa.editor.scene.CursorScene_greenClass.jpg
new file mode 100644
index 0000000..6089636
Binary files /dev/null and b/src/_assets/93_alternativa.editor.scene.CursorScene_greenClass.jpg differ
diff --git a/src/_assets/94__class_embed_css_win_max_up_png_326402371_1936093294.png b/src/_assets/94__class_embed_css_win_max_up_png_326402371_1936093294.png
new file mode 100644
index 0000000..14a446c
Binary files /dev/null and b/src/_assets/94__class_embed_css_win_max_up_png_326402371_1936093294.png differ
diff --git a/src/_assets/95_alternativa.editor.FunctionalProps_ctfFlagBaseBlueClass.jpg b/src/_assets/95_alternativa.editor.FunctionalProps_ctfFlagBaseBlueClass.jpg
new file mode 100644
index 0000000..c1ab3b3
Binary files /dev/null and b/src/_assets/95_alternativa.editor.FunctionalProps_ctfFlagBaseBlueClass.jpg differ
diff --git a/src/_assets/96__class_embed_css_win_restore_over_png_1379106002_420516677.png b/src/_assets/96__class_embed_css_win_restore_over_png_1379106002_420516677.png
new file mode 100644
index 0000000..22ee35d
Binary files /dev/null and b/src/_assets/96__class_embed_css_win_restore_over_png_1379106002_420516677.png differ
diff --git a/src/_assets/97_AlternativaEditor__embed_mxml_icons_icon_hide_selected_png_174643863.png b/src/_assets/97_AlternativaEditor__embed_mxml_icons_icon_hide_selected_png_174643863.png
new file mode 100644
index 0000000..aa6d1cc
Binary files /dev/null and b/src/_assets/97_AlternativaEditor__embed_mxml_icons_icon_hide_selected_png_174643863.png differ
diff --git a/src/_assets/98__class_embed_css_mac_max_over_png__516178647_1898496680.png b/src/_assets/98__class_embed_css_mac_max_over_png__516178647_1898496680.png
new file mode 100644
index 0000000..2e67359
Binary files /dev/null and b/src/_assets/98__class_embed_css_mac_max_over_png__516178647_1898496680.png differ
diff --git a/src/_assets/99_AlternativaEditor__embed_mxml_icons_icon_show_all_png_1675348557.png b/src/_assets/99_AlternativaEditor__embed_mxml_icons_icon_show_all_png_1675348557.png
new file mode 100644
index 0000000..4bd3b8e
Binary files /dev/null and b/src/_assets/99_AlternativaEditor__embed_mxml_icons_icon_show_all_png_1675348557.png differ
diff --git a/src/_assets/assets.swf b/src/_assets/assets.swf
new file mode 100644
index 0000000..de194c6
Binary files /dev/null and b/src/_assets/assets.swf differ
diff --git a/src/_class_embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819.as b/src/_class_embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819.as
new file mode 100644
index 0000000..fa309ee
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol21")]
+ public class _class_embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_CloseButtonDisabled_1455011819()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_CloseButtonDown_1138829611.as b/src/_class_embed_css_Assets_swf_728414423_CloseButtonDown_1138829611.as
new file mode 100644
index 0000000..3acc8dc
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_CloseButtonDown_1138829611.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol16")]
+ public class _class_embed_css_Assets_swf_728414423_CloseButtonDown_1138829611 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_CloseButtonDown_1138829611()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_CloseButtonOver_974659645.as b/src/_class_embed_css_Assets_swf_728414423_CloseButtonOver_974659645.as
new file mode 100644
index 0000000..c103330
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_CloseButtonOver_974659645.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol13")]
+ public class _class_embed_css_Assets_swf_728414423_CloseButtonOver_974659645 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_CloseButtonOver_974659645()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_CloseButtonUp_98224972.as b/src/_class_embed_css_Assets_swf_728414423_CloseButtonUp_98224972.as
new file mode 100644
index 0000000..aa55c54
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_CloseButtonUp_98224972.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol22")]
+ public class _class_embed_css_Assets_swf_728414423_CloseButtonUp_98224972 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_CloseButtonUp_98224972()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423___brokenImage_1187203851.as b/src/_class_embed_css_Assets_swf_728414423___brokenImage_1187203851.as
new file mode 100644
index 0000000..c7c65dc
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423___brokenImage_1187203851.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol25")]
+ public class _class_embed_css_Assets_swf_728414423___brokenImage_1187203851 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423___brokenImage_1187203851()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805.as
new file mode 100644
index 0000000..062d67a
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol18")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_BoxDividerSkin_1000230805()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261.as
new file mode 100644
index 0000000..29fd9db
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol8")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_BusyCursor_41142261()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173.as
new file mode 100644
index 0000000..b32e244
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol30")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragCopy_277037173()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178.as
new file mode 100644
index 0000000..fa69c72
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol6")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragLink_277299178()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753.as
new file mode 100644
index 0000000..abee9c1
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol31")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragMove_277324753()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361.as
new file mode 100644
index 0000000..a58fdc2
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol28")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_DragReject_1210215361()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792.as
new file mode 100644
index 0000000..490e2aa
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol20")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_HBoxDivider_1844812792()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310.as b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310.as
new file mode 100644
index 0000000..64575d0
--- /dev/null
+++ b/src/_class_embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.SpriteAsset;
+
+ [Embed(source="/_assets/assets.swf", symbol="symbol2")]
+ public class _class_embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310 extends SpriteAsset
+ {
+ public function _class_embed_css_Assets_swf_728414423_mx_skins_cursor_VBoxDivider_544720310()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_gripper_up_png__745420807_1298477336.as b/src/_class_embed_css_gripper_up_png__745420807_1298477336.as
new file mode 100644
index 0000000..17dd083
--- /dev/null
+++ b/src/_class_embed_css_gripper_up_png__745420807_1298477336.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/87__class_embed_css_gripper_up_png__745420807_1298477336.png")]
+ public class _class_embed_css_gripper_up_png__745420807_1298477336 extends BitmapAsset
+ {
+ public function _class_embed_css_gripper_up_png__745420807_1298477336()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_close_down_png__476573661_30699662.as b/src/_class_embed_css_mac_close_down_png__476573661_30699662.as
new file mode 100644
index 0000000..1df029a
--- /dev/null
+++ b/src/_class_embed_css_mac_close_down_png__476573661_30699662.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/72__class_embed_css_mac_close_down_png__476573661_30699662.png")]
+ public class _class_embed_css_mac_close_down_png__476573661_30699662 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_close_down_png__476573661_30699662()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_close_over_png__1374568619_1213522700.as b/src/_class_embed_css_mac_close_over_png__1374568619_1213522700.as
new file mode 100644
index 0000000..841ee82
--- /dev/null
+++ b/src/_class_embed_css_mac_close_over_png__1374568619_1213522700.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/85__class_embed_css_mac_close_over_png__1374568619_1213522700.png")]
+ public class _class_embed_css_mac_close_over_png__1374568619_1213522700 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_close_over_png__1374568619_1213522700()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_close_up_png_1150873372_2050114321.as b/src/_class_embed_css_mac_close_up_png_1150873372_2050114321.as
new file mode 100644
index 0000000..01f602d
--- /dev/null
+++ b/src/_class_embed_css_mac_close_up_png_1150873372_2050114321.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/101__class_embed_css_mac_close_up_png_1150873372_2050114321.png")]
+ public class _class_embed_css_mac_close_up_png_1150873372_2050114321 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_close_up_png_1150873372_2050114321()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_max_dis_png__26448273_1865306912.as b/src/_class_embed_css_mac_max_dis_png__26448273_1865306912.as
new file mode 100644
index 0000000..e518b0d
--- /dev/null
+++ b/src/_class_embed_css_mac_max_dis_png__26448273_1865306912.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/102__class_embed_css_mac_max_dis_png__26448273_1865306912.png")]
+ public class _class_embed_css_mac_max_dis_png__26448273_1865306912 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_max_dis_png__26448273_1865306912()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_max_down_png_381816311_1824039210.as b/src/_class_embed_css_mac_max_down_png_381816311_1824039210.as
new file mode 100644
index 0000000..310e0d7
--- /dev/null
+++ b/src/_class_embed_css_mac_max_down_png_381816311_1824039210.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/105__class_embed_css_mac_max_down_png_381816311_1824039210.png")]
+ public class _class_embed_css_mac_max_down_png_381816311_1824039210 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_max_down_png_381816311_1824039210()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_max_over_png__516178647_1898496680.as b/src/_class_embed_css_mac_max_over_png__516178647_1898496680.as
new file mode 100644
index 0000000..c7d1f6a
--- /dev/null
+++ b/src/_class_embed_css_mac_max_over_png__516178647_1898496680.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/98__class_embed_css_mac_max_over_png__516178647_1898496680.png")]
+ public class _class_embed_css_mac_max_over_png__516178647_1898496680 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_max_over_png__516178647_1898496680()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_max_up_png_2014335472_887462691.as b/src/_class_embed_css_mac_max_up_png_2014335472_887462691.as
new file mode 100644
index 0000000..3e6f639
--- /dev/null
+++ b/src/_class_embed_css_mac_max_up_png_2014335472_887462691.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/106__class_embed_css_mac_max_up_png_2014335472_887462691.png")]
+ public class _class_embed_css_mac_max_up_png_2014335472_887462691 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_max_up_png_2014335472_887462691()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_min_dis_png__703880867_400936850.as b/src/_class_embed_css_mac_min_dis_png__703880867_400936850.as
new file mode 100644
index 0000000..c4a20a3
--- /dev/null
+++ b/src/_class_embed_css_mac_min_dis_png__703880867_400936850.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/80__class_embed_css_mac_min_dis_png__703880867_400936850.png")]
+ public class _class_embed_css_mac_min_dis_png__703880867_400936850 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_min_dis_png__703880867_400936850()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_min_down_png_856242377_1625405496.as b/src/_class_embed_css_mac_min_down_png_856242377_1625405496.as
new file mode 100644
index 0000000..abbbc4b
--- /dev/null
+++ b/src/_class_embed_css_mac_min_down_png_856242377_1625405496.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/100__class_embed_css_mac_min_down_png_856242377_1625405496.png")]
+ public class _class_embed_css_mac_min_down_png_856242377_1625405496 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_min_down_png_856242377_1625405496()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_min_over_png__41752581_1023914202.as b/src/_class_embed_css_mac_min_over_png__41752581_1023914202.as
new file mode 100644
index 0000000..28dcab3
--- /dev/null
+++ b/src/_class_embed_css_mac_min_over_png__41752581_1023914202.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/109__class_embed_css_mac_min_over_png__41752581_1023914202.png")]
+ public class _class_embed_css_mac_min_over_png__41752581_1023914202 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_min_over_png__41752581_1023914202()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_mac_min_up_png_191367490_1536362603.as b/src/_class_embed_css_mac_min_up_png_191367490_1536362603.as
new file mode 100644
index 0000000..d9fdf73
--- /dev/null
+++ b/src/_class_embed_css_mac_min_up_png_191367490_1536362603.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/82__class_embed_css_mac_min_up_png_191367490_1536362603.png")]
+ public class _class_embed_css_mac_min_up_png_191367490_1536362603 extends BitmapAsset
+ {
+ public function _class_embed_css_mac_min_up_png_191367490_1536362603()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_close_down_png__941728266_1862517095.as b/src/_class_embed_css_win_close_down_png__941728266_1862517095.as
new file mode 100644
index 0000000..e5dffcd
--- /dev/null
+++ b/src/_class_embed_css_win_close_down_png__941728266_1862517095.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/90__class_embed_css_win_close_down_png__941728266_1862517095.png")]
+ public class _class_embed_css_win_close_down_png__941728266_1862517095 extends BitmapAsset
+ {
+ public function _class_embed_css_win_close_down_png__941728266_1862517095()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_close_over_png__1839723224_1256956523.as b/src/_class_embed_css_win_close_over_png__1839723224_1256956523.as
new file mode 100644
index 0000000..6f2129a
--- /dev/null
+++ b/src/_class_embed_css_win_close_over_png__1839723224_1256956523.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/67__class_embed_css_win_close_over_png__1839723224_1256956523.png")]
+ public class _class_embed_css_win_close_over_png__1839723224_1256956523 extends BitmapAsset
+ {
+ public function _class_embed_css_win_close_over_png__1839723224_1256956523()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_close_up_png__1750166097_309569150.as b/src/_class_embed_css_win_close_up_png__1750166097_309569150.as
new file mode 100644
index 0000000..81c6a58
--- /dev/null
+++ b/src/_class_embed_css_win_close_up_png__1750166097_309569150.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/69__class_embed_css_win_close_up_png__1750166097_309569150.png")]
+ public class _class_embed_css_win_close_up_png__1750166097_309569150 extends BitmapAsset
+ {
+ public function _class_embed_css_win_close_up_png__1750166097_309569150()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_max_dis_png__812766852_512792721.as b/src/_class_embed_css_win_max_dis_png__812766852_512792721.as
new file mode 100644
index 0000000..1e64cdf
--- /dev/null
+++ b/src/_class_embed_css_win_max_dis_png__812766852_512792721.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/88__class_embed_css_win_max_dis_png__812766852_512792721.png")]
+ public class _class_embed_css_win_max_dis_png__812766852_512792721 extends BitmapAsset
+ {
+ public function _class_embed_css_win_max_dis_png__812766852_512792721()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_max_down_png_1775744138_402971533.as b/src/_class_embed_css_win_max_down_png_1775744138_402971533.as
new file mode 100644
index 0000000..5198796
--- /dev/null
+++ b/src/_class_embed_css_win_max_down_png_1775744138_402971533.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/76__class_embed_css_win_max_down_png_1775744138_402971533.png")]
+ public class _class_embed_css_win_max_down_png_1775744138_402971533 extends BitmapAsset
+ {
+ public function _class_embed_css_win_max_down_png_1775744138_402971533()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_max_over_png_877749180_1787411313.as b/src/_class_embed_css_win_max_over_png_877749180_1787411313.as
new file mode 100644
index 0000000..69ce013
--- /dev/null
+++ b/src/_class_embed_css_win_max_over_png_877749180_1787411313.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/79__class_embed_css_win_max_over_png_877749180_1787411313.png")]
+ public class _class_embed_css_win_max_over_png_877749180_1787411313 extends BitmapAsset
+ {
+ public function _class_embed_css_win_max_over_png_877749180_1787411313()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_max_up_png_326402371_1936093294.as b/src/_class_embed_css_win_max_up_png_326402371_1936093294.as
new file mode 100644
index 0000000..c4cad0b
--- /dev/null
+++ b/src/_class_embed_css_win_max_up_png_326402371_1936093294.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/94__class_embed_css_win_max_up_png_326402371_1936093294.png")]
+ public class _class_embed_css_win_max_up_png_326402371_1936093294 extends BitmapAsset
+ {
+ public function _class_embed_css_win_max_up_png_326402371_1936093294()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_min_dis_png__1490199446_689239761.as b/src/_class_embed_css_win_min_dis_png__1490199446_689239761.as
new file mode 100644
index 0000000..211342b
--- /dev/null
+++ b/src/_class_embed_css_win_min_dis_png__1490199446_689239761.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/110__class_embed_css_win_min_dis_png__1490199446_689239761.png")]
+ public class _class_embed_css_win_min_dis_png__1490199446_689239761 extends BitmapAsset
+ {
+ public function _class_embed_css_win_min_dis_png__1490199446_689239761()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_min_down_png__2044797092_465343185.as b/src/_class_embed_css_win_min_down_png__2044797092_465343185.as
new file mode 100644
index 0000000..8281bc3
--- /dev/null
+++ b/src/_class_embed_css_win_min_down_png__2044797092_465343185.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/107__class_embed_css_win_min_down_png__2044797092_465343185.png")]
+ public class _class_embed_css_win_min_down_png__2044797092_465343185 extends BitmapAsset
+ {
+ public function _class_embed_css_win_min_down_png__2044797092_465343185()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_min_over_png_1352175246_2117214847.as b/src/_class_embed_css_win_min_over_png_1352175246_2117214847.as
new file mode 100644
index 0000000..a6f86e3
--- /dev/null
+++ b/src/_class_embed_css_win_min_over_png_1352175246_2117214847.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/108__class_embed_css_win_min_over_png_1352175246_2117214847.png")]
+ public class _class_embed_css_win_min_over_png_1352175246_2117214847 extends BitmapAsset
+ {
+ public function _class_embed_css_win_min_over_png_1352175246_2117214847()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_min_up_png__1496565611_1904338868.as b/src/_class_embed_css_win_min_up_png__1496565611_1904338868.as
new file mode 100644
index 0000000..b79fc3f
--- /dev/null
+++ b/src/_class_embed_css_win_min_up_png__1496565611_1904338868.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/112__class_embed_css_win_min_up_png__1496565611_1904338868.png")]
+ public class _class_embed_css_win_min_up_png__1496565611_1904338868 extends BitmapAsset
+ {
+ public function _class_embed_css_win_min_up_png__1496565611_1904338868()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_restore_down_png__2017866336_395125171.as b/src/_class_embed_css_win_restore_down_png__2017866336_395125171.as
new file mode 100644
index 0000000..c5bd7af
--- /dev/null
+++ b/src/_class_embed_css_win_restore_down_png__2017866336_395125171.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/66__class_embed_css_win_restore_down_png__2017866336_395125171.png")]
+ public class _class_embed_css_win_restore_down_png__2017866336_395125171 extends BitmapAsset
+ {
+ public function _class_embed_css_win_restore_down_png__2017866336_395125171()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_restore_over_png_1379106002_420516677.as b/src/_class_embed_css_win_restore_over_png_1379106002_420516677.as
new file mode 100644
index 0000000..881ed49
--- /dev/null
+++ b/src/_class_embed_css_win_restore_over_png_1379106002_420516677.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/96__class_embed_css_win_restore_over_png_1379106002_420516677.png")]
+ public class _class_embed_css_win_restore_over_png_1379106002_420516677 extends BitmapAsset
+ {
+ public function _class_embed_css_win_restore_over_png_1379106002_420516677()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_class_embed_css_win_restore_up_png__736761895_2120219528.as b/src/_class_embed_css_win_restore_up_png__736761895_2120219528.as
new file mode 100644
index 0000000..1b8de07
--- /dev/null
+++ b/src/_class_embed_css_win_restore_up_png__736761895_2120219528.as
@@ -0,0 +1,14 @@
+package
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/68__class_embed_css_win_restore_up_png__736761895_2120219528.png")]
+ public class _class_embed_css_win_restore_up_png__736761895_2120219528 extends BitmapAsset
+ {
+ public function _class_embed_css_win_restore_up_png__736761895_2120219528()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/_mx_skins_spark_PanelBorderSkinWatcherSetupUtil.as b/src/_mx_skins_spark_PanelBorderSkinWatcherSetupUtil.as
new file mode 100644
index 0000000..f8445f1
--- /dev/null
+++ b/src/_mx_skins_spark_PanelBorderSkinWatcherSetupUtil.as
@@ -0,0 +1,27 @@
+package
+{
+ import mx.binding.IWatcherSetupUtil2;
+ import mx.binding.PropertyWatcher;
+ import mx.core.IFlexModuleFactory;
+ import mx.skins.spark.PanelBorderSkin;
+
+ public class _mx_skins_spark_PanelBorderSkinWatcherSetupUtil implements IWatcherSetupUtil2
+ {
+ public function _mx_skins_spark_PanelBorderSkinWatcherSetupUtil()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ PanelBorderSkin.watcherSetupUtil = new _mx_skins_spark_PanelBorderSkinWatcherSetupUtil();
+ }
+
+ public function setup(param1:Object, param2:Function, param3:Function, param4:Array, param5:Array) : void
+ {
+ param5[0] = new PropertyWatcher("contentMask",{"propertyChange":true},[param4[0]],param2);
+ param5[0].updateParent(param1);
+ }
+ }
+}
+
diff --git a/src/_spark_skins_spark_PanelSkinWatcherSetupUtil.as b/src/_spark_skins_spark_PanelSkinWatcherSetupUtil.as
new file mode 100644
index 0000000..f960ab8
--- /dev/null
+++ b/src/_spark_skins_spark_PanelSkinWatcherSetupUtil.as
@@ -0,0 +1,29 @@
+package
+{
+ import mx.binding.IWatcherSetupUtil2;
+ import mx.binding.PropertyWatcher;
+ import mx.core.IFlexModuleFactory;
+ import spark.skins.spark.PanelSkin;
+
+ public class _spark_skins_spark_PanelSkinWatcherSetupUtil implements IWatcherSetupUtil2
+ {
+ public function _spark_skins_spark_PanelSkinWatcherSetupUtil()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ PanelSkin.watcherSetupUtil = new _spark_skins_spark_PanelSkinWatcherSetupUtil();
+ }
+
+ public function setup(param1:Object, param2:Function, param3:Function, param4:Array, param5:Array) : void
+ {
+ param5[0] = new PropertyWatcher("topGroupMask",{"propertyChange":true},[param4[0]],param2);
+ param5[1] = new PropertyWatcher("bottomGroupMask",{"propertyChange":true},[param4[1]],param2);
+ param5[0].updateParent(param1);
+ param5[1].updateParent(param1);
+ }
+ }
+}
+
diff --git a/src/_spark_skins_spark_TitleWindowSkinWatcherSetupUtil.as b/src/_spark_skins_spark_TitleWindowSkinWatcherSetupUtil.as
new file mode 100644
index 0000000..008d5ce
--- /dev/null
+++ b/src/_spark_skins_spark_TitleWindowSkinWatcherSetupUtil.as
@@ -0,0 +1,29 @@
+package
+{
+ import mx.binding.IWatcherSetupUtil2;
+ import mx.binding.PropertyWatcher;
+ import mx.core.IFlexModuleFactory;
+ import spark.skins.spark.TitleWindowSkin;
+
+ public class _spark_skins_spark_TitleWindowSkinWatcherSetupUtil implements IWatcherSetupUtil2
+ {
+ public function _spark_skins_spark_TitleWindowSkinWatcherSetupUtil()
+ {
+ super();
+ }
+
+ public static function init(param1:IFlexModuleFactory) : void
+ {
+ TitleWindowSkin.watcherSetupUtil = new _spark_skins_spark_TitleWindowSkinWatcherSetupUtil();
+ }
+
+ public function setup(param1:Object, param2:Function, param3:Function, param4:Array, param5:Array) : void
+ {
+ param5[0] = new PropertyWatcher("topGroupMask",{"propertyChange":true},[param4[0]],param2);
+ param5[1] = new PropertyWatcher("bottomGroupMask",{"propertyChange":true},[param4[1]],param2);
+ param5[0].updateParent(param1);
+ param5[1].updateParent(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/BonusRegionPropertiesPanel.mxml b/src/alternativa/editor/BonusRegionPropertiesPanel.mxml
new file mode 100644
index 0000000..f8ead7c
--- /dev/null
+++ b/src/alternativa/editor/BonusRegionPropertiesPanel.mxml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/alternativa/editor/FunctionalProps.as b/src/alternativa/editor/FunctionalProps.as
new file mode 100644
index 0000000..b9510a3
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps.as
@@ -0,0 +1,240 @@
+package alternativa.editor
+{
+ import alternativa.editor.prop.FreeBonusRegion;
+ import alternativa.editor.prop.KillBox;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.propslib.PropGroup;
+ import alternativa.editor.propslib.PropLibObject;
+ import alternativa.editor.propslib.PropsLibrary;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.engine3d.loaders.Parser3DS;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.types.Texture;
+ import flash.display.BitmapData;
+ import flash.geom.Point;
+ import flash.utils.ByteArray;
+ import flash.utils.Dictionary;
+
+ public class FunctionalProps
+ {
+ public static const LIBRARY_NAME:String = "Functional";
+
+ public static const GRP_SPAWN_POINTS:String = "Spawn Points";
+
+ public static const GRP_BONUS_REGIONS:String = "Bonus Regions";
+
+ public static const GRP_FLAGS:String = "Flags";
+
+ public static const GRP_DOMINATION:String = "Domination";
+
+ public static const BLUE_SPAWN:String = "blue";
+
+ public static const RED_SPAWN:String = "red";
+
+ public static const FREE_BONUS_NAME:String = "free-bonus";
+
+ public static const DOMINATION_POINT:String = "dom-keypoint";
+
+ public static const DOMINATION_BLUE_SPAWN:String = "dom-blue";
+
+ public static const DOMINATION_RED_SPAWN:String = "dom-red";
+
+ public static const DOMINATION_SPAWN:String = "dom";
+
+ private static const BLUE_FLAG:String = "blue_flag";
+
+ private static const RED_FLAG:String = "red_flag";
+
+ private static const DM_SPAWN:String = "dm";
+
+ private static const RED:uint = 14960384;
+
+ private static const BLUE:uint = 786943;
+
+ private static const YELLOW:uint = 14860033;
+
+ private static const flag3DSClass:Class = FunctionalProps_flag3DSClass;
+
+ private static const ctfFlagBaseBlueClass:Class = FunctionalProps_ctfFlagBaseBlueClass;
+
+ private static const ctfFlagBaseRedClass:Class = FunctionalProps_ctfFlagBaseRedClass;
+
+ private static const spawnPoint3DSClass:Class = FunctionalProps_spawnPoint3DSClass;
+
+ private static const bonus13DSClass:Class = FunctionalProps_bonus13DSClass;
+
+ private static const bonus23DSClass:Class = FunctionalProps_bonus23DSClass;
+
+ private static const bonus33DSClass:Class = FunctionalProps_bonus33DSClass;
+
+ private static const textures:Dictionary = new Dictionary();
+
+ public static const KILL_GEOMETRY:String = "special-geometry";
+
+ public static const KILL_BOX_NAME:String = "special-box";
+
+ public function FunctionalProps()
+ {
+ super();
+ }
+
+ public static function getPropLayer(param1:Prop) : String
+ {
+ if(param1.libraryName == LIBRARY_NAME)
+ {
+ if(param1.groupName == GRP_SPAWN_POINTS)
+ {
+ if(param1.name == DM_SPAWN)
+ {
+ return LayerNames.DM;
+ }
+ return LayerNames.TDM;
+ }
+ if(param1.groupName == GRP_FLAGS)
+ {
+ return LayerNames.TDM;
+ }
+ if(param1.groupName == GRP_DOMINATION)
+ {
+ return LayerNames.DOMINATION;
+ }
+ if(param1.groupName == GRP_BONUS_REGIONS)
+ {
+ return LayerNames.BONUSES;
+ }
+ if(param1.groupName == KILL_GEOMETRY)
+ {
+ return LayerNames.SPECIAL_GEOMETRY;
+ }
+ }
+ return null;
+ }
+
+ public static function getFunctionalLibrary() : PropsLibrary
+ {
+ var loc1:PropsLibrary = new PropsLibrary();
+ loc1.name = LIBRARY_NAME;
+ loc1.rootGroup = new PropGroup("root");
+ loc1.rootGroup.addGroup(createFlags());
+ loc1.rootGroup.addGroup(createKillBoxes());
+ loc1.rootGroup.addGroup(createSpawnMarkers());
+ loc1.rootGroup.addGroup(getBonusRegions());
+ loc1.rootGroup.addGroup(createDominationGroup());
+ return loc1;
+ }
+
+ private static function createFlags() : PropGroup
+ {
+ var loc1:PropGroup = new PropGroup(GRP_FLAGS);
+ loc1.addProp(getBlueFlag());
+ loc1.addProp(getRedFlag());
+ return loc1;
+ }
+
+ private static function getBlueFlag() : PropLibObject
+ {
+ return getTexturedPropObject(BLUE_FLAG,new flag3DSClass(),new ctfFlagBaseBlueClass().bitmapData);
+ }
+
+ private static function getRedFlag() : PropLibObject
+ {
+ return getTexturedPropObject(RED_FLAG,new flag3DSClass(),new ctfFlagBaseRedClass().bitmapData);
+ }
+
+ private static function createSpawnMarkers() : PropGroup
+ {
+ var loc1:PropGroup = new PropGroup(GRP_SPAWN_POINTS);
+ loc1.addProp(getColoredPropObject(DM_SPAWN,new spawnPoint3DSClass(),YELLOW));
+ loc1.addProp(getColoredPropObject(BLUE_SPAWN,new spawnPoint3DSClass(),BLUE));
+ loc1.addProp(getColoredPropObject(RED_SPAWN,new spawnPoint3DSClass(),RED));
+ return loc1;
+ }
+
+ private static function getBonusRegions() : PropGroup
+ {
+ var loc1:PropGroup = new PropGroup(GRP_BONUS_REGIONS);
+ var loc2:FreeBonusRegion = new FreeBonusRegion(FREE_BONUS_NAME,"Functional",GRP_BONUS_REGIONS,true);
+ loc1.addProp(new PropLibObject(FREE_BONUS_NAME,loc2));
+ return loc1;
+ }
+
+ private static function getColoredPropObject(param1:String, param2:ByteArray, param3:uint) : PropLibObject
+ {
+ var loc4:Mesh = parse3DS(param2);
+ loc4.cloneMaterialToAllSurfaces(new TextureMaterial(getMonochromeTexture(param3)));
+ return new PropLibObject(param1,loc4);
+ }
+
+ private static function getTexturedPropObject(param1:String, param2:ByteArray, param3:BitmapData) : PropLibObject
+ {
+ var loc4:Mesh = parse3DS(param2);
+ loc4.cloneMaterialToAllSurfaces(new TextureMaterial(new Texture(param3)));
+ return new PropLibObject(param1,loc4);
+ }
+
+ private static function parse3DS(param1:ByteArray) : Mesh
+ {
+ var loc2:Parser3DS = new Parser3DS();
+ loc2.parse(param1);
+ var loc3:Mesh = loc2.content.children.peek() as Mesh;
+ loc3.x = 0;
+ loc3.y = 0;
+ loc3.z = 0;
+ return loc3;
+ }
+
+ private static function getMonochromeTexture(param1:uint) : Texture
+ {
+ var loc2:Texture = textures[param1];
+ if(loc2 == null)
+ {
+ loc2 = new Texture(new BitmapData(1,1,false,param1));
+ textures[param1] = loc2;
+ }
+ return loc2;
+ }
+
+ private static function createDominationGroup() : PropGroup
+ {
+ var loc1:PropGroup = new PropGroup(GRP_DOMINATION);
+ loc1.addProp(new PropLibObject(DOMINATION_POINT,createDominationPoint()));
+ loc1.addProp(getColoredPropObject(DOMINATION_SPAWN,new spawnPoint3DSClass(),YELLOW));
+ loc1.addProp(getColoredPropObject(DOMINATION_RED_SPAWN,new spawnPoint3DSClass(),RED));
+ loc1.addProp(getColoredPropObject(DOMINATION_BLUE_SPAWN,new spawnPoint3DSClass(),BLUE));
+ return loc1;
+ }
+
+ private static function createDominationPoint() : Object3D
+ {
+ var loc1:Mesh = new Mesh();
+ var loc4:Vertex = loc1.createVertex(-50,-50,0);
+ var loc5:Vertex = loc1.createVertex(50,-50,0);
+ var loc6:Vertex = loc1.createVertex(50,50,0);
+ var loc7:Vertex = loc1.createVertex(-50,50,0);
+ var loc8:Vertex = loc1.createVertex(-50,-50,400);
+ var loc9:Vertex = loc1.createVertex(50,-50,400);
+ var loc10:Vertex = loc1.createVertex(50,50,400);
+ var loc11:Vertex = loc1.createVertex(-50,50,400);
+ loc1.setUVsToFace(new Point(0,0),new Point(1,0),new Point(1,1),loc1.createFace([loc7,loc6,loc5,loc4]));
+ loc1.setUVsToFace(new Point(0,0),new Point(1,0),new Point(1,1),loc1.createFace([loc8,loc9,loc10,loc11]));
+ loc1.setUVsToFace(new Point(0,0),new Point(1,0),new Point(1,1),loc1.createFace([loc4,loc5,loc9,loc8]));
+ loc1.setUVsToFace(new Point(0,0),new Point(1,0),new Point(1,1),loc1.createFace([loc5,loc6,loc10,loc9]));
+ loc1.setUVsToFace(new Point(0,0),new Point(1,0),new Point(1,1),loc1.createFace([loc6,loc7,loc11,loc10]));
+ loc1.setUVsToFace(new Point(0,0),new Point(1,0),new Point(1,1),loc1.createFace([loc4,loc8,loc11,loc7]));
+ loc1.moveAllFacesToSurface();
+ loc1.cloneMaterialToAllSurfaces(new TextureMaterial(getMonochromeTexture(16711935)));
+ return loc1;
+ }
+
+ private static function createKillBoxes() : PropGroup
+ {
+ var loc1:PropGroup = new PropGroup(KILL_GEOMETRY);
+ var loc2:KillBox = new KillBox(KILL_BOX_NAME,"Functional",FunctionalProps.KILL_GEOMETRY,true);
+ loc1.addProp(new PropLibObject(KILL_GEOMETRY,loc2));
+ return loc1;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_bonus13DSClass.as b/src/alternativa/editor/FunctionalProps_bonus13DSClass.as
new file mode 100644
index 0000000..4db2501
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_bonus13DSClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.ByteArrayAsset;
+
+ [Embed(source="/_assets/78_alternativa.editor.FunctionalProps_bonus13DSClass.bin", mimeType="application/octet-stream")]
+ public class FunctionalProps_bonus13DSClass extends ByteArrayAsset
+ {
+ public function FunctionalProps_bonus13DSClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_bonus23DSClass.as b/src/alternativa/editor/FunctionalProps_bonus23DSClass.as
new file mode 100644
index 0000000..f7df801
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_bonus23DSClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.ByteArrayAsset;
+
+ [Embed(source="/_assets/75_alternativa.editor.FunctionalProps_bonus23DSClass.bin", mimeType="application/octet-stream")]
+ public class FunctionalProps_bonus23DSClass extends ByteArrayAsset
+ {
+ public function FunctionalProps_bonus23DSClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_bonus33DSClass.as b/src/alternativa/editor/FunctionalProps_bonus33DSClass.as
new file mode 100644
index 0000000..effd4d9
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_bonus33DSClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.ByteArrayAsset;
+
+ [Embed(source="/_assets/86_alternativa.editor.FunctionalProps_bonus33DSClass.bin", mimeType="application/octet-stream")]
+ public class FunctionalProps_bonus33DSClass extends ByteArrayAsset
+ {
+ public function FunctionalProps_bonus33DSClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_ctfFlagBaseBlueClass.as b/src/alternativa/editor/FunctionalProps_ctfFlagBaseBlueClass.as
new file mode 100644
index 0000000..361276b
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_ctfFlagBaseBlueClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/95_alternativa.editor.FunctionalProps_ctfFlagBaseBlueClass.jpg")]
+ public class FunctionalProps_ctfFlagBaseBlueClass extends BitmapAsset
+ {
+ public function FunctionalProps_ctfFlagBaseBlueClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_ctfFlagBaseRedClass.as b/src/alternativa/editor/FunctionalProps_ctfFlagBaseRedClass.as
new file mode 100644
index 0000000..2843fa2
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_ctfFlagBaseRedClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/71_alternativa.editor.FunctionalProps_ctfFlagBaseRedClass.jpg")]
+ public class FunctionalProps_ctfFlagBaseRedClass extends BitmapAsset
+ {
+ public function FunctionalProps_ctfFlagBaseRedClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_flag3DSClass.as b/src/alternativa/editor/FunctionalProps_flag3DSClass.as
new file mode 100644
index 0000000..da83494
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_flag3DSClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.ByteArrayAsset;
+
+ [Embed(source="/_assets/70_alternativa.editor.FunctionalProps_flag3DSClass.bin", mimeType="application/octet-stream")]
+ public class FunctionalProps_flag3DSClass extends ByteArrayAsset
+ {
+ public function FunctionalProps_flag3DSClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/FunctionalProps_spawnPoint3DSClass.as b/src/alternativa/editor/FunctionalProps_spawnPoint3DSClass.as
new file mode 100644
index 0000000..ba459df
--- /dev/null
+++ b/src/alternativa/editor/FunctionalProps_spawnPoint3DSClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.ByteArrayAsset;
+
+ [Embed(source="/_assets/92_alternativa.editor.FunctionalProps_spawnPoint3DSClass.bin", mimeType="application/octet-stream")]
+ public class FunctionalProps_spawnPoint3DSClass extends ByteArrayAsset
+ {
+ public function FunctionalProps_spawnPoint3DSClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/GraphicUtils.as b/src/alternativa/editor/GraphicUtils.as
new file mode 100644
index 0000000..27ae42b
--- /dev/null
+++ b/src/alternativa/editor/GraphicUtils.as
@@ -0,0 +1,20 @@
+package alternativa.editor
+{
+ import alternativa.types.Point3D;
+ import flash.display.Graphics;
+
+ public class GraphicUtils
+ {
+ public function GraphicUtils()
+ {
+ super();
+ }
+
+ public static function drawLine(param1:Graphics, param2:Point3D, param3:Point3D) : void
+ {
+ param1.moveTo(param2.x,param2.y);
+ param1.lineTo(param3.x,param3.y);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/ImageItemRenderer.as b/src/alternativa/editor/ImageItemRenderer.as
new file mode 100644
index 0000000..9f271e1
--- /dev/null
+++ b/src/alternativa/editor/ImageItemRenderer.as
@@ -0,0 +1,41 @@
+package alternativa.editor
+{
+ import mx.containers.VBox;
+ import mx.controls.Image;
+ import mx.controls.Label;
+ import mx.core.ScrollPolicy;
+ import mx.events.FlexEvent;
+
+ public class ImageItemRenderer extends VBox
+ {
+ private var img:Image;
+
+ private var lbl:Label;
+
+ public function ImageItemRenderer()
+ {
+ this.img = new Image();
+ this.lbl = new Label();
+ super();
+ this.width = 52;
+ this.height = 82;
+ setStyle("horizontalAlign","center");
+ setStyle("verticalGap","0");
+ addChild(this.img);
+ addChild(this.lbl);
+ this.img.height = 50;
+ this.img.width = 50;
+ verticalScrollPolicy = ScrollPolicy.OFF;
+ horizontalScrollPolicy = ScrollPolicy.OFF;
+ updateDisplayList(52,82);
+ addEventListener(FlexEvent.DATA_CHANGE,this.dataChangeHandler);
+ }
+
+ private function dataChangeHandler(param1:FlexEvent) : void
+ {
+ this.img.source = data["image"];
+ this.lbl.text = data["label"];
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/InvisibleTexture.as b/src/alternativa/editor/InvisibleTexture.as
new file mode 100644
index 0000000..456d564
--- /dev/null
+++ b/src/alternativa/editor/InvisibleTexture.as
@@ -0,0 +1,19 @@
+package alternativa.editor
+{
+ import flash.display.Bitmap;
+
+ public class InvisibleTexture
+ {
+ private static const InvisibleTextureClass:Class = InvisibleTexture_InvisibleTextureClass;
+
+ public static const invisibleTexture:Bitmap = new InvisibleTextureClass();
+
+ public static const TEXTURE_NAME:String = "invisible";
+
+ public function InvisibleTexture()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/InvisibleTexture_InvisibleTextureClass.as b/src/alternativa/editor/InvisibleTexture_InvisibleTextureClass.as
new file mode 100644
index 0000000..8a5cfeb
--- /dev/null
+++ b/src/alternativa/editor/InvisibleTexture_InvisibleTextureClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/81_alternativa.editor.InvisibleTexture_InvisibleTextureClass.png")]
+ public class InvisibleTexture_InvisibleTextureClass extends BitmapAsset
+ {
+ public function InvisibleTexture_InvisibleTextureClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/KeyMapper.as b/src/alternativa/editor/KeyMapper.as
new file mode 100644
index 0000000..3304780
--- /dev/null
+++ b/src/alternativa/editor/KeyMapper.as
@@ -0,0 +1,118 @@
+package alternativa.editor
+{
+ import flash.events.IEventDispatcher;
+ import flash.events.KeyboardEvent;
+
+ public class KeyMapper
+ {
+ private const MAX_KEYS:int = 31;
+
+ private var keys:int;
+
+ private var map:Vector.;
+
+ private var _dispatcher:IEventDispatcher;
+
+ public function KeyMapper(param1:IEventDispatcher = null)
+ {
+ this.map = new Vector.(this.MAX_KEYS);
+ super();
+ if(param1 != null)
+ {
+ this.startListening(param1);
+ }
+ }
+
+ private function checkKey(param1:int) : void
+ {
+ if(param1 < 0 || param1 > this.MAX_KEYS - 1)
+ {
+ throw new ArgumentError("keyNum is out of range");
+ }
+ }
+
+ public function mapKey(param1:int, param2:int) : void
+ {
+ this.checkKey(param1);
+ this.map[param1] = param2;
+ }
+
+ public function unmapKey(param1:int) : void
+ {
+ this.checkKey(param1);
+ this.map[param1] = 0;
+ this.keys &= ~(1 << param1);
+ }
+
+ public function checkEvent(param1:KeyboardEvent) : void
+ {
+ var loc2:int = int(this.map.indexOf(param1.keyCode));
+ if(loc2 > -1)
+ {
+ if(param1.type == KeyboardEvent.KEY_DOWN)
+ {
+ this.keys |= 1 << loc2;
+ }
+ else
+ {
+ this.keys &= ~(1 << loc2);
+ }
+ }
+ }
+
+ public function getKeyState(param1:int) : int
+ {
+ return this.keys >> param1 & 1;
+ }
+
+ public function keyPressed(param1:int) : Boolean
+ {
+ return this.getKeyState(param1) == 1;
+ }
+
+ public function startListening(param1:IEventDispatcher) : void
+ {
+ if(this._dispatcher == param1)
+ {
+ return;
+ }
+ if(this._dispatcher != null)
+ {
+ this.unregisterListeners();
+ }
+ this._dispatcher = param1;
+ if(this._dispatcher != null)
+ {
+ this.registerListeners();
+ }
+ }
+
+ public function stopListening() : void
+ {
+ if(this._dispatcher != null)
+ {
+ this.unregisterListeners();
+ }
+ this._dispatcher = null;
+ this.keys = 0;
+ }
+
+ private function registerListeners() : void
+ {
+ this._dispatcher.addEventListener(KeyboardEvent.KEY_DOWN,this.onKey);
+ this._dispatcher.addEventListener(KeyboardEvent.KEY_UP,this.onKey);
+ }
+
+ private function unregisterListeners() : void
+ {
+ this._dispatcher.removeEventListener(KeyboardEvent.KEY_DOWN,this.onKey);
+ this._dispatcher.removeEventListener(KeyboardEvent.KEY_UP,this.onKey);
+ }
+
+ private function onKey(param1:KeyboardEvent) : void
+ {
+ this.checkEvent(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/KillZonePropertiesPanel.mxml b/src/alternativa/editor/KillZonePropertiesPanel.mxml
new file mode 100644
index 0000000..ca415fa
--- /dev/null
+++ b/src/alternativa/editor/KillZonePropertiesPanel.mxml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/alternativa/editor/LayerNames.as b/src/alternativa/editor/LayerNames.as
new file mode 100644
index 0000000..a9f6e3e
--- /dev/null
+++ b/src/alternativa/editor/LayerNames.as
@@ -0,0 +1,23 @@
+package alternativa.editor
+{
+ public class LayerNames
+ {
+ public static const CTF:String = "ctf";
+
+ public static const DM:String = "dm";
+
+ public static const TDM:String = "tdm";
+
+ public static const BONUSES:String = "bonuses";
+
+ public static const DOMINATION:String = "dom";
+
+ public static const SPECIAL_GEOMETRY:String = "special";
+
+ public function LayerNames()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/LayersWindow.as b/src/alternativa/editor/LayersWindow.as
new file mode 100644
index 0000000..600dd19
--- /dev/null
+++ b/src/alternativa/editor/LayersWindow.as
@@ -0,0 +1,43 @@
+package alternativa.editor
+{
+ import alternativa.editor.events.LayerVisibilityChangeEvent;
+ import flash.events.Event;
+ import mx.controls.CheckBox;
+ import mx.events.FlexEvent;
+
+ public class LayersWindow extends LayersWindowBase
+ {
+ public function LayersWindow()
+ {
+ super();
+ addEventListener(FlexEvent.CREATION_COMPLETE,this.onCreationComplete);
+ }
+
+ private static function onChange(param1:Event) : void
+ {
+ var loc2:CheckBox = CheckBox(param1.target);
+ GlobalEventDispatcher.dispatch(new LayerVisibilityChangeEvent(loc2.data.toString(),loc2.selected));
+ }
+
+ private function onCreationComplete(param1:FlexEvent) : void
+ {
+ this.addLayerCheckBox(LayerNames.DM,"DM");
+ this.addLayerCheckBox(LayerNames.TDM,"TDM");
+ this.addLayerCheckBox(LayerNames.CTF,"CTF");
+ this.addLayerCheckBox(LayerNames.DOMINATION,"Domination");
+ this.addLayerCheckBox(LayerNames.BONUSES,"Bonuses");
+ this.addLayerCheckBox(LayerNames.SPECIAL_GEOMETRY,"Special geometry");
+ }
+
+ private function addLayerCheckBox(param1:String, param2:String) : void
+ {
+ var loc3:CheckBox = new CheckBox();
+ loc3.label = param2;
+ loc3.data = param1;
+ loc3.selected = true;
+ loc3.addEventListener(Event.CHANGE,onChange);
+ mainBox.addChild(loc3);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/LibraryManager.as b/src/alternativa/editor/LibraryManager.as
new file mode 100644
index 0000000..7dd2c34
--- /dev/null
+++ b/src/alternativa/editor/LibraryManager.as
@@ -0,0 +1,336 @@
+package alternativa.editor
+{
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.prop.CTFFlagBase;
+ import alternativa.editor.prop.ControlPoint;
+ import alternativa.editor.prop.FreeBonusRegion;
+ import alternativa.editor.prop.KillBox;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.SpawnPoint;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.editor.propslib.PropGroup;
+ import alternativa.editor.propslib.PropLibMesh;
+ import alternativa.editor.propslib.PropLibObject;
+ import alternativa.editor.propslib.PropsLibrary;
+ import alternativa.editor.propslib.events.PropLibProgressEvent;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Sprite3D;
+ import alternativa.types.Map;
+ import alternativa.types.Point3D;
+ import flash.events.ErrorEvent;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.filesystem.File;
+
+ public class LibraryManager extends EventDispatcher
+ {
+ private static var funcIsNotLoadedYet:Boolean = true;
+
+ private var file:File;
+
+ private var clearLibrariesBeforeLoad:Boolean = false;
+
+ public var libraryNames:Array;
+
+ private var propsByLibraryName:Map;
+
+ public var propByKey:Map;
+
+ private var libUrls:Array;
+
+ private var currentLib:PropsLibrary;
+
+ private var totalLibs:int;
+
+ private var loadedLibs:int;
+
+ public function LibraryManager()
+ {
+ this.file = new File();
+ this.libraryNames = [];
+ this.propsByLibraryName = new Map();
+ this.propByKey = new Map();
+ super();
+ this.file.addEventListener(Event.SELECT,this.onFileSelect);
+ }
+
+ private static function createFunctionalProp(param1:PropLibObject, param2:String) : Prop
+ {
+ var loc3:Object3D = param1.object3d;
+ switch(param2)
+ {
+ case FunctionalProps.GRP_SPAWN_POINTS:
+ return new SpawnPoint(loc3,param1.name,FunctionalProps.LIBRARY_NAME,param2);
+ case FunctionalProps.GRP_BONUS_REGIONS:
+ return new FreeBonusRegion(param1.name,FunctionalProps.LIBRARY_NAME,param2);
+ case FunctionalProps.GRP_FLAGS:
+ return new CTFFlagBase(loc3,param1.name,FunctionalProps.LIBRARY_NAME,param2);
+ case FunctionalProps.GRP_DOMINATION:
+ return createDominationProp(param2,param1);
+ default:
+ if(param2 == FunctionalProps.KILL_GEOMETRY)
+ {
+ return createKillProp(param2,param1);
+ }
+ throw new Error("Unknown functional group name: " + param2);
+ }
+ }
+
+ private static function createDominationProp(param1:String, param2:PropLibObject) : Prop
+ {
+ switch(param2.name)
+ {
+ case FunctionalProps.DOMINATION_BLUE_SPAWN:
+ case FunctionalProps.DOMINATION_RED_SPAWN:
+ case FunctionalProps.DOMINATION_SPAWN:
+ return new SpawnPoint(param2.object3d,param2.name,FunctionalProps.LIBRARY_NAME,param1);
+ case FunctionalProps.DOMINATION_POINT:
+ return new ControlPoint(param2.object3d,param2.name,FunctionalProps.LIBRARY_NAME,param1);
+ default:
+ throw new Error("Unsupported prop type: " + param2.name);
+ }
+ }
+
+ private static function createRegularProp(param1:PropLibObject, param2:String, param3:String) : Prop
+ {
+ var loc5:MeshProp = null;
+ var loc6:String = null;
+ var loc4:Object3D = param1.object3d;
+ loc4.coords = new Point3D();
+ if(loc4 is Mesh)
+ {
+ loc5 = new MeshProp(loc4,param1.name,param2,param3);
+ loc5.bitmaps = (param1 as PropLibMesh).bitmaps;
+ if(loc5.bitmaps != null)
+ {
+ var loc7:int = 0;
+ var loc8:* = loc5.bitmaps;
+ for(loc6 in loc8)
+ {
+ loc5.textureName = loc6;
+ }
+ }
+ return loc5;
+ }
+ if(loc4 is Sprite3D)
+ {
+ return new Sprite3DProp(loc4 as Sprite3D,param1.name,param2,param3);
+ }
+ throw new Error("Unknown object type: " + loc4);
+ }
+
+ private static function createKillProp(param1:String, param2:PropLibObject) : Prop
+ {
+ switch(param2.name)
+ {
+ case FunctionalProps.KILL_GEOMETRY:
+ return new KillBox(param2.name,FunctionalProps.LIBRARY_NAME,param1);
+ default:
+ throw new Error("Unsupported prop type: " + param2.name);
+ }
+ }
+
+ public function clearAndLoadLibrary() : void
+ {
+ this.clearLibrariesBeforeLoad = true;
+ this.load();
+ }
+
+ private function load() : void
+ {
+ this.file.browseForDirectory("Load library");
+ }
+
+ public function loadLibrary() : void
+ {
+ this.clearLibrariesBeforeLoad = false;
+ this.load();
+ }
+
+ public function getPropsByLibName(param1:String) : Array
+ {
+ return this.propsByLibraryName[param1];
+ }
+
+ private function searchForLibrariesInDir(param1:File) : void
+ {
+ var loc2:File = null;
+ var loc3:Array = null;
+ if(param1.isDirectory)
+ {
+ loc2 = param1.resolvePath("library.xml");
+ if(loc2.exists)
+ {
+ this.libUrls.push(param1.url);
+ }
+ loc3 = param1.getDirectoryListing();
+ for each(loc2 in loc3)
+ {
+ if(loc2.isDirectory)
+ {
+ this.searchForLibrariesInDir(loc2);
+ }
+ }
+ }
+ }
+
+ public function loadGivenLibraries(param1:Array) : void
+ {
+ var loc2:* = undefined;
+ this.libUrls = [];
+ for each(loc2 in param1)
+ {
+ this.searchForLibrariesInDir(loc2);
+ }
+ this.startLoadingLibs();
+ }
+
+ private function onFileSelect(param1:Event) : void
+ {
+ this.libUrls = [];
+ this.searchForLibrariesInDir(this.file);
+ if(this.clearLibrariesBeforeLoad)
+ {
+ this.clearLibrariesBeforeLoad = false;
+ this.clearLibraries();
+ }
+ this.startLoadingLibs();
+ }
+
+ private function startLoadingLibs() : void
+ {
+ ErrorHandler.clearMessages();
+ this.totalLibs = this.libUrls.length;
+ this.loadedLibs = 0;
+ if(this.libUrls.length > 0)
+ {
+ dispatchEvent(new Event("open"));
+ this.loadNextLib();
+ }
+ }
+
+ public function clearLibraries() : void
+ {
+ var loc1:* = this.propsByLibraryName[FunctionalProps.LIBRARY_NAME];
+ this.libraryNames.length = 0;
+ this.libraryNames.push(FunctionalProps.LIBRARY_NAME);
+ this.propsByLibraryName.clear();
+ this.propsByLibraryName.add(FunctionalProps.LIBRARY_NAME,loc1);
+ }
+
+ private function loadNextLib() : void
+ {
+ var loc1:String = this.libUrls.pop();
+ ErrorHandler.addText("Start loading " + loc1 + "---------------------------------");
+ this.currentLib = new PropsLibrary();
+ this.currentLib.addEventListener(Event.COMPLETE,this.onLoadingComplete);
+ this.currentLib.addEventListener(IOErrorEvent.IO_ERROR,this.onLoadingError);
+ this.currentLib.addEventListener(PropLibProgressEvent.PROGRESS,this.onProgress);
+ this.currentLib.load(loc1);
+ }
+
+ private function onProgress(param1:PropLibProgressEvent) : void
+ {
+ if(hasEventListener(EditorProgressEvent.PROGRESS))
+ {
+ dispatchEvent(new EditorProgressEvent((this.loadedLibs + param1.propsLoaded / param1.propsTotal) / this.totalLibs));
+ }
+ }
+
+ private function onLoadingComplete(param1:Event) : void
+ {
+ ++this.loadedLibs;
+ this.currentLib.removeEventListener(PropLibProgressEvent.PROGRESS,this.onProgress);
+ this.currentLib.removeEventListener(Event.COMPLETE,this.onLoadingComplete);
+ ErrorHandler.addText("Complete loading" + this.currentLib.name);
+ this.addLibrary(this.currentLib);
+ if(this.libUrls.length == 0)
+ {
+ this.currentLib = null;
+ this.libUrls = null;
+ dispatchEvent(new Event("complete"));
+ }
+ else
+ {
+ this.loadNextLib();
+ }
+ }
+
+ public function addLibrary(param1:PropsLibrary) : void
+ {
+ var loc7:PropGroup = null;
+ var loc8:String = null;
+ var loc9:Vector. = null;
+ var loc10:int = 0;
+ var loc11:int = 0;
+ var loc12:PropLibObject = null;
+ var loc13:Prop = null;
+ var loc2:String = param1.name;
+ var loc3:Array = [];
+ var loc4:Vector. = param1.rootGroup.groups;
+ var loc5:int = int(loc4.length);
+ var loc6:int = 0;
+ while(loc6 < loc5)
+ {
+ loc7 = loc4[loc6];
+ loc8 = loc7.name;
+ loc9 = loc7.props;
+ loc10 = int(loc9.length);
+ loc11 = 0;
+ while(loc11 < loc10)
+ {
+ loc12 = loc9[loc11];
+ if(loc12)
+ {
+ if(loc2 == FunctionalProps.LIBRARY_NAME)
+ {
+ if(funcIsNotLoadedYet)
+ {
+ loc13 = createFunctionalProp(loc12,loc8);
+ loc13.name = loc12.name;
+ loc13.icon = AlternativaEditor.preview.getPropIcon(loc13);
+ loc3.push(loc13);
+ this.propByKey.add(loc2 + loc8 + loc13.name,loc13);
+ }
+ }
+ else
+ {
+ loc13 = createRegularProp(loc12,loc2,loc8);
+ loc13.name = loc12.name;
+ loc13.icon = AlternativaEditor.preview.getPropIcon(loc13);
+ loc3.push(loc13);
+ this.propByKey.add(loc2 + loc8 + loc13.name,loc13);
+ }
+ }
+ loc11++;
+ }
+ loc6++;
+ }
+ if(loc2 == FunctionalProps.LIBRARY_NAME)
+ {
+ if(funcIsNotLoadedYet)
+ {
+ this.propsByLibraryName.add(loc2,loc3);
+ this.libraryNames.push(loc2);
+ funcIsNotLoadedYet = false;
+ }
+ }
+ else
+ {
+ this.propsByLibraryName.add(loc2,loc3);
+ this.libraryNames.push(loc2);
+ }
+ }
+
+ private function onLoadingError(param1:ErrorEvent) : void
+ {
+ ErrorHandler.setMessage("Loadind error");
+ ErrorHandler.addText(param1.text);
+ ErrorHandler.showWindow();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/MultiPropMode.as b/src/alternativa/editor/MultiPropMode.as
new file mode 100644
index 0000000..89f85f5
--- /dev/null
+++ b/src/alternativa/editor/MultiPropMode.as
@@ -0,0 +1,17 @@
+package alternativa.editor
+{
+ public class MultiPropMode
+ {
+ public static const ANY:MultiPropMode = new MultiPropMode();
+
+ public static const GROUP:MultiPropMode = new MultiPropMode();
+
+ public static const NONE:MultiPropMode = new MultiPropMode();
+
+ public function MultiPropMode()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/Preview.as b/src/alternativa/editor/Preview.as
new file mode 100644
index 0000000..9482227
--- /dev/null
+++ b/src/alternativa/editor/Preview.as
@@ -0,0 +1,181 @@
+package alternativa.editor
+{
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.engine3d.display.View;
+ import alternativa.types.Map;
+ import alternativa.types.Point3D;
+ import alternativa.utils.MathUtils;
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.events.Event;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+ import mx.core.UIComponent;
+
+ public class Preview extends UIComponent
+ {
+ private static const ICON_SIZE:Number = 50;
+
+ private var scene:Scene3D;
+
+ private var view:View;
+
+ private var camera:Camera3D;
+
+ private var cameraContainer:Object3D;
+
+ private var propDistance:Map;
+
+ public function Preview()
+ {
+ this.propDistance = new Map();
+ super();
+ addEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage);
+ }
+
+ private function onAddedToStage(param1:Event) : void
+ {
+ removeEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage);
+ this.initScene();
+ addEventListener(Event.ENTER_FRAME,this.onEnterFrame);
+ addEventListener(Event.RESIZE,this.onResize);
+ this.onResize();
+ }
+
+ private function initScene() : void
+ {
+ this.scene = new Scene3D();
+ this.scene.root = new Object3D();
+ this.camera = new Camera3D();
+ this.camera.rotationX = -MathUtils.DEG90 - MathUtils.DEG30;
+ this.cameraContainer = new Object3D();
+ this.cameraContainer.addChild(this.camera);
+ this.camera.coords = new Point3D(0,-100,40);
+ this.scene.root.addChild(this.cameraContainer);
+ this.view = new View(this.camera);
+ addChild(this.view);
+ this.view.graphics.beginFill(16777215);
+ this.view.graphics.drawRect(0,0,1,1);
+ this.view.graphics.endFill();
+ }
+
+ private function onEnterFrame(param1:Event) : void
+ {
+ this.cameraContainer.rotationZ += MathUtils.DEG1;
+ this.scene.calculate();
+ }
+
+ private function calculateOptimalCameraPosition(param1:Prop) : void
+ {
+ var loc7:BitmapData = null;
+ var loc8:Array = null;
+ var loc9:int = 0;
+ var loc10:int = 0;
+ var loc11:Point3D = null;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Number = NaN;
+ var loc2:Number = 0;
+ var loc3:Number = -Number.MAX_VALUE;
+ var loc4:Number = Number.MAX_VALUE;
+ var loc5:Sprite3DProp = param1 as Sprite3DProp;
+ if(loc5)
+ {
+ loc7 = param1.bitmapData;
+ loc2 = loc5.scale * 1.5 * Math.max(loc7.width,loc7.height);
+ loc3 = loc7.height;
+ loc4 = 0;
+ }
+ else
+ {
+ loc8 = param1.vertices.toArray(true);
+ loc9 = int(loc8.length);
+ loc10 = 0;
+ while(loc10 < loc9)
+ {
+ loc11 = Vertex(loc8[loc10]).coords;
+ loc12 = loc11.x - param1.x;
+ loc13 = loc11.y - param1.y;
+ loc14 = loc11.z - param1.z;
+ loc15 = loc12 * loc12 + loc13 * loc13 + loc14 * loc14;
+ if(loc15 > loc2)
+ {
+ loc2 = loc15;
+ }
+ if(loc11.z < loc4)
+ {
+ loc4 = loc11.z;
+ }
+ if(loc11.z > loc3)
+ {
+ loc3 = loc11.z;
+ }
+ loc10++;
+ }
+ loc2 = 2 * Math.sqrt(loc2);
+ }
+ var loc6:Number = loc2 * (Math.SQRT2 / (2 * Math.tan(this.camera.fov / 2)) + 0.5);
+ this.propDistance.add(param1,new Point(loc6,(loc3 - loc4) / 2));
+ }
+
+ public function getPropIcon(param1:Prop) : Bitmap
+ {
+ this.clearScene();
+ this.calculateOptimalCameraPosition(param1);
+ this.setCameraCoords(param1);
+ this.scene.root.addChild(param1);
+ this.scene.calculate();
+ var loc2:BitmapData = new BitmapData(ICON_SIZE,ICON_SIZE,false,0);
+ var loc3:Matrix = new Matrix();
+ loc3.a = ICON_SIZE / this.view.width;
+ loc3.d = loc3.a;
+ loc2.draw(this.view,loc3);
+ return new Bitmap(loc2);
+ }
+
+ private function setCameraCoords(param1:Object3D) : void
+ {
+ var loc2:Point = this.propDistance[param1];
+ if(loc2 != null)
+ {
+ this.camera.y = -loc2.x;
+ this.camera.z = loc2.y / 2 + loc2.x / Math.sqrt(3);
+ }
+ }
+
+ private function clearScene() : void
+ {
+ var loc1:* = undefined;
+ var loc2:Prop = null;
+ for(loc1 in this.scene.root.children)
+ {
+ loc2 = loc1 as Prop;
+ if(loc2 != null)
+ {
+ this.scene.root.removeChild(loc2);
+ }
+ }
+ }
+
+ public function showProp(param1:Prop) : void
+ {
+ this.clearScene();
+ this.setCameraCoords(param1);
+ this.scene.root.addChild(param1);
+ }
+
+ public function onResize(param1:Event = null) : void
+ {
+ this.view.width = parent.width;
+ this.view.height = parent.height;
+ this.scene.calculate();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/SceneContainer.as b/src/alternativa/editor/SceneContainer.as
new file mode 100644
index 0000000..7471f18
--- /dev/null
+++ b/src/alternativa/editor/SceneContainer.as
@@ -0,0 +1,921 @@
+package alternativa.editor
+{
+ import alternativa.editor.eventjournal.EventJournal;
+ import alternativa.editor.eventjournal.EventJournalItem;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.scene.CursorScene;
+ import alternativa.editor.scene.EditorScene;
+ import alternativa.editor.scene.MainScene;
+ import alternativa.editor.scene.OccupyMap;
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.engine3d.events.MouseEvent3D;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.utils.KeyboardUtils;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.events.Event;
+ import flash.events.KeyboardEvent;
+ import flash.events.MouseEvent;
+ import flash.geom.Point;
+ import flash.ui.Keyboard;
+ import flash.utils.setTimeout;
+ import mx.controls.Alert;
+ import mx.core.UIComponent;
+ import mx.events.CloseEvent;
+
+ use namespace alternativa3d;
+
+ public class SceneContainer extends UIComponent
+ {
+ private static const cameraPoint:Point3D = new Point3D(0,0,1000);
+
+ private static const cameraOffset:Point3D = new Point3D();
+
+ public var cursorScene:CursorScene;
+
+ public var mainScene:MainScene;
+
+ public var multiplePropMode:MultiPropMode;
+
+ private var verticalMoving:Boolean = false;
+
+ private var copy:Boolean = false;
+
+ private var mouseDown:Boolean;
+
+ private var eventJournal:EventJournal;
+
+ private var cameraTransformation:Matrix3D;
+
+ private var _snapMode:Boolean;
+
+ private var cameraDistance:Number;
+
+ private var selectionRectOverlay:Shape;
+
+ private var keyMapper:KeyMapper;
+
+ private var boundBoxesOverlay:Shape;
+
+ private var dominationOverlay:Shape;
+
+ private var _showBoundBoxes:Boolean;
+
+ private var mouseDownPoint:Point;
+
+ private var startSelectionCoords:Point3D;
+
+ private var prevMoveX:Number;
+
+ private var prevMoveY:Number;
+
+ private var rectProps:Set;
+
+ private var middleDown:Boolean = false;
+
+ private var mouseOX:Number = 0;
+
+ private var mouseOY:Number = 0;
+
+ private var leaveClickZone:Boolean;
+
+ private var cloneThreshold:Number = 20;
+
+ private var min:Point3D;
+
+ private var max:Point3D;
+
+ private var bbPoints:Array;
+
+ private var clickZ:Number;
+
+ private var propDown:Boolean = false;
+
+ public function SceneContainer()
+ {
+ this.multiplePropMode = MultiPropMode.NONE;
+ this.mouseDownPoint = new Point();
+ this.rectProps = new Set();
+ this.min = new Point3D();
+ this.max = new Point3D();
+ this.bbPoints = [new Point3D(),new Point3D(),new Point3D(),new Point3D(),new Point3D(),new Point3D(),new Point3D(),new Point3D()];
+ super();
+ addEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage);
+ this.initKeyMapper();
+ }
+
+ private static function getMeshBounds(param1:Mesh, param2:Point3D, param3:Point3D) : void
+ {
+ var loc4:Vertex = null;
+ var loc5:Point3D = null;
+ param2.reset(10000000000,10000000000,10000000000);
+ param3.reset(-10000000000,-10000000000,-10000000000);
+ for each(loc4 in param1.alternativa3d::_vertices)
+ {
+ loc5 = loc4.alternativa3d::globalCoords;
+ if(loc5.x < param2.x)
+ {
+ param2.x = loc5.x;
+ }
+ if(loc5.y < param2.y)
+ {
+ param2.y = loc5.y;
+ }
+ if(loc5.z < param2.z)
+ {
+ param2.z = loc5.z;
+ }
+ if(loc5.x > param3.x)
+ {
+ param3.x = loc5.x;
+ }
+ if(loc5.y > param3.y)
+ {
+ param3.y = loc5.y;
+ }
+ if(loc5.z > param3.z)
+ {
+ param3.z = loc5.z;
+ }
+ }
+ }
+
+ private static function fillBBPoints(param1:Point3D, param2:Point3D, param3:Array) : void
+ {
+ var loc4:Point3D = param3[0];
+ loc4.copy(param1);
+ loc4 = param3[1];
+ loc4.reset(param2.x,param1.y,param1.z);
+ loc4 = param3[2];
+ loc4.reset(param2.x,param1.y,param2.z);
+ loc4 = param3[3];
+ loc4.reset(param1.x,param1.y,param2.z);
+ loc4 = param3[4];
+ loc4.reset(param1.x,param2.y,param1.z);
+ loc4 = param3[5];
+ loc4.reset(param2.x,param2.y,param1.z);
+ loc4 = param3[6];
+ loc4.reset(param2.x,param2.y,param2.z);
+ loc4 = param3[7];
+ loc4.reset(param1.x,param2.y,param2.z);
+ }
+
+ public function get showBoundBoxes() : Boolean
+ {
+ return this._showBoundBoxes;
+ }
+
+ public function set showBoundBoxes(param1:Boolean) : void
+ {
+ this._showBoundBoxes = param1;
+ if(!this._showBoundBoxes)
+ {
+ this.boundBoxesOverlay.graphics.clear();
+ }
+ }
+
+ private function initKeyMapper() : void
+ {
+ this.keyMapper = new KeyMapper();
+ this.keyMapper.mapKey(0,KeyboardUtils.N);
+ this.keyMapper.mapKey(1,KeyboardUtils.M);
+ this.keyMapper.mapKey(2,Keyboard.NUMPAD_4);
+ this.keyMapper.mapKey(3,Keyboard.NUMPAD_6);
+ this.keyMapper.mapKey(4,Keyboard.NUMPAD_8);
+ this.keyMapper.mapKey(5,Keyboard.NUMPAD_2);
+ this.keyMapper.mapKey(6,Keyboard.NUMPAD_9);
+ this.keyMapper.mapKey(7,Keyboard.NUMPAD_3);
+ }
+
+ private function onAddedToStage(param1:Event) : void
+ {
+ removeEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage);
+ this.keyMapper.startListening(stage);
+ this.cursorScene = new CursorScene(stage);
+ this.mainScene = new MainScene();
+ this.cursorScene.occupyMap = this.mainScene.occupyMap;
+ addChild(this.mainScene.view);
+ addChild(this.cursorScene.view);
+ this.boundBoxesOverlay = new Shape();
+ addChild(this.boundBoxesOverlay);
+ this.dominationOverlay = new Shape();
+ addChild(this.dominationOverlay);
+ this.selectionRectOverlay = new Shape();
+ addChild(this.selectionRectOverlay);
+ this.initListeners();
+ this.eventJournal = new EventJournal();
+ var loc2:Point3D = this.cursorScene.camera.coords;
+ this.cameraDistance = Math.sqrt(loc2.x * loc2.x + loc2.y * loc2.y + loc2.z * loc2.z);
+ }
+
+ protected function initListeners() : void
+ {
+ addEventListener(Event.ENTER_FRAME,this.onEnterFrame);
+ stage.addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDown);
+ stage.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
+ parent.addEventListener(Event.RESIZE,this.onResize);
+ parent.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
+ parent.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
+ parent.addEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseWheel);
+ parent.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
+ parent.addEventListener(MouseEvent.MIDDLE_MOUSE_DOWN,this.onMiddleMouseDown);
+ parent.addEventListener(MouseEvent.RIGHT_MOUSE_DOWN,this.onMiddleMouseDown);
+ parent.addEventListener(MouseEvent.MIDDLE_MOUSE_UP,this.onMiddleMouseUp);
+ parent.addEventListener(MouseEvent.RIGHT_MOUSE_UP,this.onMiddleMouseUp);
+ parent.addEventListener(MouseEvent.ROLL_OUT,this.onMouseOut);
+ this.onResize();
+ }
+
+ private function onMouseDown(param1:MouseEvent) : void
+ {
+ this.leaveClickZone = false;
+ this.mouseOX = stage.mouseX;
+ this.mouseOY = stage.mouseY;
+ if(this.mainScene.propMouseDown)
+ {
+ if(this.mainScene.selectedProp != null)
+ {
+ this.startSelectionCoords = this.mainScene.selectedProp.coords;
+ this.cursorScene.visible = false;
+ }
+ }
+ this.mouseDown = true;
+ this.mouseDownPoint.x = this.mainScene.view.mouseX;
+ this.mouseDownPoint.y = this.mainScene.view.mouseY;
+ }
+
+ private function onMouseUp(param1:MouseEvent) : void
+ {
+ var loc4:Boolean = false;
+ var loc5:Point3D = null;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:* = undefined;
+ var loc9:Prop = null;
+ var loc2:Prop = this.mainScene.selectedProp;
+ var loc3:Set = this.mainScene.selectedProps;
+ if(this.mainScene.propMouseDown)
+ {
+ if(loc2)
+ {
+ loc4 = false;
+ if(this.copy)
+ {
+ this.eventJournal.addEvent(EventJournal.COPY,loc3.clone());
+ }
+ else if(!this.startSelectionCoords.equals(loc2.coords))
+ {
+ loc5 = loc2.coords;
+ loc5.difference(loc5,this.startSelectionCoords);
+ this.eventJournal.addEvent(EventJournal.MOVE,loc3.clone(),loc5);
+ loc4 = true;
+ }
+ if(this._snapMode && (this.copy || loc4))
+ {
+ this.checkConflict();
+ }
+ this.copy = false;
+ }
+ this.mainScene.propMouseDown = false;
+ }
+ else
+ {
+ loc6 = this.mouseDownPoint.x - this.mainScene.view.mouseX;
+ loc7 = this.mouseDownPoint.y - this.mainScene.view.mouseY;
+ loc6 = loc6 < 0 ? -loc6 : loc6;
+ loc7 = loc7 < 0 ? -loc7 : loc7;
+ if(loc6 < 3 && loc7 < 3)
+ {
+ if(this.propDown)
+ {
+ if(this.cursorScene.object)
+ {
+ this.cursorScene.object.z = this.clickZ;
+ }
+ this.propDown = false;
+ }
+ this.cursorScene.moveCursorByMouse();
+ if(!this.cursorScene.visible)
+ {
+ this.mainScene.deselectProps();
+ this.cursorScene.visible = true;
+ }
+ }
+ else if(param1.shiftKey)
+ {
+ for(loc8 in this.rectProps)
+ {
+ loc9 = loc8;
+ if(param1.altKey)
+ {
+ if(loc3.has(loc9))
+ {
+ this.mainScene.deselectProp(loc9);
+ }
+ }
+ else if(!loc3.has(loc9))
+ {
+ this.mainScene.selectProp(loc9);
+ }
+ }
+ }
+ }
+ this.mouseDown = false;
+ this.selectionRectOverlay.graphics.clear();
+ }
+
+ private function alertConflict(param1:CloseEvent) : void
+ {
+ if(param1.detail == Alert.NO)
+ {
+ this.mainScene.undo(this.eventJournal.undo(true));
+ }
+ setFocus();
+ }
+
+ private function checkConflict() : void
+ {
+ var loc1:Set = null;
+ var loc2:OccupyMap = null;
+ var loc3:* = undefined;
+ var loc4:Prop = null;
+ if(this.multiplePropMode != MultiPropMode.ANY)
+ {
+ loc1 = this.mainScene.selectedProps;
+ loc2 = this.mainScene.occupyMap;
+ for(loc3 in loc1)
+ {
+ loc4 = loc3;
+ if(this.multiplePropMode == MultiPropMode.NONE && loc2.isConflict(loc4) || this.multiplePropMode == MultiPropMode.GROUP && loc2.isConflictGroup(loc4))
+ {
+ Alert.show("This location is occupied. Continue?","",Alert.YES | Alert.NO,this,this.alertConflict,null,Alert.YES);
+ break;
+ }
+ }
+ }
+ }
+
+ private function onMouseMove(param1:MouseEvent) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Prop = null;
+ var loc6:Set = null;
+ var loc7:Point3D = null;
+ var loc8:Prop = null;
+ var loc9:Matrix3D = null;
+ var loc10:Point3D = null;
+ var loc11:Point3D = null;
+ var loc12:Point3D = null;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Point = null;
+ var loc16:Graphics = null;
+ var loc17:Set = null;
+ var loc4:Prop = this.mainScene.selectedProp;
+ var loc5:Set = this.mainScene.selectedProps;
+ if(Math.abs(this.mouseOX - stage.mouseX) + Math.abs(this.mouseOY - stage.mouseY) > this.cloneThreshold || this.leaveClickZone)
+ {
+ this.leaveClickZone = true;
+ if(this.mainScene.propMouseDown && Boolean(loc4))
+ {
+ if(param1.shiftKey && !this.copy)
+ {
+ if(!this.startSelectionCoords.equals(loc4.coords))
+ {
+ loc7 = loc4.coords;
+ loc7.difference(loc7,this.startSelectionCoords);
+ this.eventJournal.addEvent(EventJournal.MOVE,loc5.clone(),loc7);
+ }
+ loc6 = new Set();
+ for(loc2 in loc5)
+ {
+ loc3 = loc2 as Prop;
+ loc8 = this.mainScene.addProp(loc3,loc3.coords,loc3.rotationZ);
+ if(loc3 == loc4)
+ {
+ loc4 = loc8;
+ }
+ loc6.add(loc8);
+ }
+ this.mainScene.selectProps(loc6);
+ this.mainScene.selectedProp = loc4;
+ this.startSelectionCoords = loc4.coords;
+ this.copy = true;
+ }
+ this.mainScene.moveSelectedPropsByMouse(this.verticalMoving);
+ }
+ else if(this.middleDown)
+ {
+ loc9 = this.cursorScene.camera.transformation;
+ loc10 = new Point3D(loc9.a,loc9.e,loc9.i);
+ loc11 = new Point3D(loc9.b,loc9.f,loc9.j);
+ loc10.multiply(10 * (this.prevMoveX - param1.stageX));
+ loc11.multiply(10 * (this.prevMoveY - param1.stageY));
+ loc12 = new Point3D(loc9.d,loc9.h,loc9.l);
+ loc12.add(loc10);
+ loc12.add(loc11);
+ this.cursorScene.cameraController.coords = this.cursorScene.container.globalToLocal(loc12);
+ }
+ else if(this.mouseDown)
+ {
+ loc13 = this.mouseDownPoint.x - this.mainScene.view.mouseX;
+ loc13 = loc13 > 0 ? loc13 : -loc13;
+ loc14 = this.mouseDownPoint.y - this.mainScene.view.mouseY;
+ loc14 = loc14 > 0 ? loc14 : -loc14;
+ if(loc13 > 3 && loc14 > 3)
+ {
+ loc15 = new Point(Math.min(this.mainScene.view.mouseX,this.mouseDownPoint.x),Math.min(this.mainScene.view.mouseY,this.mouseDownPoint.y));
+ loc16 = this.selectionRectOverlay.graphics;
+ loc16.clear();
+ loc16.lineStyle(0,0);
+ loc16.moveTo(loc15.x,loc15.y);
+ loc16.lineTo(loc15.x + loc13,loc15.y);
+ loc16.lineTo(loc15.x + loc13,loc15.y + loc14);
+ loc16.lineTo(loc15.x,loc15.y + loc14);
+ loc16.lineTo(loc15.x,loc15.y);
+ if(param1.shiftKey)
+ {
+ loc17 = this.rectProps.clone();
+ if(param1.altKey)
+ {
+ this.rectProps = this.mainScene.getPropsUnderRect(loc15,loc13,loc14,false);
+ for(loc2 in loc17)
+ {
+ loc3 = loc2;
+ if(!this.rectProps.has(loc3) && loc5.has(loc3))
+ {
+ loc3.select();
+ }
+ }
+ }
+ else
+ {
+ this.rectProps = this.mainScene.getPropsUnderRect(loc15,loc13,loc14,true);
+ for(loc2 in loc17)
+ {
+ loc3 = loc2;
+ if(!this.rectProps.has(loc3) && !loc5.has(loc3))
+ {
+ loc3.deselect();
+ }
+ }
+ }
+ }
+ else
+ {
+ this.mainScene.selectProps(this.mainScene.getPropsUnderRect(loc15,loc13,loc14,true));
+ }
+ this.cursorScene.visible = false;
+ }
+ }
+ }
+ this.prevMoveX = param1.stageX;
+ this.prevMoveY = param1.stageY;
+ }
+
+ private function onMouseWheel(param1:MouseEvent) : void
+ {
+ var loc2:Number = param1.shiftKey ? 20 : 3;
+ if(param1.delta < 0)
+ {
+ loc2 *= -1;
+ }
+ this.zoom(loc2);
+ }
+
+ private function zoom(param1:int) : void
+ {
+ var loc2:Point3D = !!this.mainScene.selectedProp ? this.mainScene.selectedProp.coords : this.cursorScene.camera.localToGlobal(cameraPoint);
+ var loc3:Point3D = this.cursorScene.container.localToGlobal(this.cursorScene.cameraController.coords);
+ var loc4:Point3D = loc3.clone();
+ var loc5:Point3D = Point3D.difference(loc2,loc3);
+ if(loc5.length < 500)
+ {
+ loc5 = Point3D.difference(this.cursorScene.camera.localToGlobal(cameraPoint),loc3);
+ }
+ loc5.normalize();
+ loc5.multiply(param1 * 100);
+ loc3.add(loc5);
+ this.cursorScene.cameraController.coords = this.cursorScene.container.globalToLocal(loc3);
+ }
+
+ private function onMouseOut(param1:MouseEvent) : void
+ {
+ if(param1.buttonDown)
+ {
+ parent.addEventListener(MouseEvent.ROLL_OVER,this.onMouseOver);
+ this.cursorScene.containerController.setMouseLook(false);
+ }
+ }
+
+ private function onMouseOver(param1:MouseEvent) : void
+ {
+ parent.removeEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
+ if(!param1.buttonDown)
+ {
+ this.onMouseUp(param1);
+ }
+ else
+ {
+ this.onMouseDown(param1);
+ }
+ }
+
+ private function onMiddleMouseDown(param1:MouseEvent) : void
+ {
+ var loc2:Point3D = null;
+ var loc3:Prop = null;
+ var loc4:Point3D = null;
+ var loc5:Point3D = null;
+ var loc6:Point = null;
+ if(param1.altKey)
+ {
+ loc3 = this.mainScene.selectedProp;
+ if(loc3)
+ {
+ loc6 = this.mainScene.getPropsGroupCenter(this.mainScene.selectedProps);
+ loc2 = new Point3D(loc6.x,loc6.y,loc3.z);
+ }
+ else
+ {
+ loc2 = this.cursorScene.camera.localToGlobal(new Point3D(0,0,this.cameraDistance));
+ }
+ loc4 = this.cursorScene.containerController.coords.clone();
+ loc4.subtract(loc2);
+ loc5 = this.cursorScene.container.localToGlobal(this.cursorScene.cameraController.coords);
+ loc5.add(loc4);
+ this.cursorScene.cameraController.coords = this.cursorScene.container.globalToLocal(loc5);
+ this.cursorScene.containerController.coords = loc2;
+ this.cursorScene.containerController.setMouseLook(true);
+ }
+ else
+ {
+ this.middleDown = true;
+ }
+ }
+
+ private function onMiddleMouseUp(param1:MouseEvent) : void
+ {
+ this.middleDown = false;
+ this.cursorScene.containerController.setMouseLook(false);
+ }
+
+ private function onEnterFrame(param1:Event) : void
+ {
+ return;
+ this.cursorScene.containerController.yawLeft(this.keyMapper.keyPressed(0));
+ this.cursorScene.containerController.yawRight(this.keyMapper.keyPressed(1));
+ this.cursorScene.containerController.pitchDown(this.keyMapper.keyPressed(6));
+ this.cursorScene.containerController.pitchUp(this.keyMapper.keyPressed(7));
+ this.cursorScene.containerController.speed = 2000;
+ this.cursorScene.containerController.moveLeft(this.keyMapper.keyPressed(2));
+ this.cursorScene.containerController.moveRight(this.keyMapper.keyPressed(3));
+ this.cursorScene.containerController.moveForward(this.keyMapper.keyPressed(4));
+ this.cursorScene.containerController.moveBack(this.keyMapper.keyPressed(5));
+ this.cursorScene.cameraController.processInput();
+ this.cursorScene.containerController.processInput();
+ this.cursorScene.calculate();
+ this.cameraTransformation = this.cursorScene.camera.transformation;
+ cameraOffset.x = this.cameraTransformation.d;
+ cameraOffset.y = this.cameraTransformation.h;
+ cameraOffset.z = this.cameraTransformation.l;
+ this.cursorScene.drawAxis(this.cameraTransformation);
+ var loc2:Point3D = this.cameraTransformation.getRotations();
+ this.mainScene.setCameraPosition(cameraOffset,loc2.x,loc2.y,loc2.z);
+ this.mainScene.calculate();
+ if(this._showBoundBoxes)
+ {
+ this.drawBoundBoxes();
+ }
+ this.mainScene.drawDominationLinks(this.dominationOverlay.graphics);
+ }
+
+ private function drawBoundBoxes() : void
+ {
+ var loc1:* = undefined;
+ var loc2:MeshProp = null;
+ this.boundBoxesOverlay.graphics.clear();
+ for(loc1 in this.mainScene.root.alternativa3d::_children)
+ {
+ loc2 = loc1 as MeshProp;
+ if(loc2 != null && !loc2.hidden)
+ {
+ this.drawPropBoundBox(loc2);
+ }
+ }
+ }
+
+ private function drawPropBoundBox(param1:MeshProp) : void
+ {
+ var loc4:Point3D = null;
+ var loc5:int = 0;
+ var loc2:Mesh = param1.object as Mesh;
+ if(loc2 == null)
+ {
+ return;
+ }
+ getMeshBounds(loc2,this.min,this.max);
+ fillBBPoints(this.min,this.max,this.bbPoints);
+ var loc3:Number = this.cursorScene.camera.focalLength;
+ var loc6:Number = 0.5 * this.cursorScene.view.width;
+ var loc7:Number = 0.5 * this.cursorScene.view.height;
+ loc5 = 0;
+ while(loc5 < 8)
+ {
+ loc4 = this.bbPoints[loc5];
+ loc4.inverseTransform(this.cameraTransformation);
+ if(loc4.z <= 0)
+ {
+ return;
+ }
+ loc4.x = loc4.x * loc3 / loc4.z;
+ if(loc4.x < -loc6 || loc4.x > loc6)
+ {
+ return;
+ }
+ loc4.x += loc6;
+ loc4.y = loc4.y * loc3 / loc4.z;
+ if(loc4.y < -loc7 || loc4.y > loc7)
+ {
+ return;
+ }
+ loc4.y += loc7;
+ loc5++;
+ }
+ var loc8:Graphics = this.boundBoxesOverlay.graphics;
+ loc8.lineStyle(0,65280);
+ loc4 = this.bbPoints[0];
+ loc8.moveTo(loc4.x,loc4.y);
+ loc5 = 1;
+ while(loc5 < 4)
+ {
+ loc4 = this.bbPoints[loc5];
+ loc8.lineTo(loc4.x,loc4.y);
+ loc5++;
+ }
+ loc4 = this.bbPoints[0];
+ loc8.lineTo(loc4.x,loc4.y);
+ loc5 = 4;
+ while(loc5 < 8)
+ {
+ loc4 = this.bbPoints[loc5];
+ loc8.lineTo(loc4.x,loc4.y);
+ loc5++;
+ }
+ loc4 = this.bbPoints[4];
+ loc8.lineTo(loc4.x,loc4.y);
+ GraphicUtils.drawLine(loc8,this.bbPoints[1],this.bbPoints[5]);
+ GraphicUtils.drawLine(loc8,this.bbPoints[2],this.bbPoints[6]);
+ GraphicUtils.drawLine(loc8,this.bbPoints[3],this.bbPoints[7]);
+ }
+
+ private function onResize(param1:Event = null) : void
+ {
+ this.cursorScene.viewResize(parent.width - 20,parent.height - 40);
+ this.mainScene.viewResize(parent.width - 20,parent.height - 40);
+ }
+
+ private function onKeyDown(param1:KeyboardEvent) : void
+ {
+ var loc2:Prop = null;
+ var loc3:Point3D = null;
+ var loc4:Point3D = null;
+ var loc5:Point3D = null;
+ var loc6:Prop = null;
+ var loc7:Set = null;
+ switch(param1.keyCode)
+ {
+ case Keyboard.NUMBER_0:
+ if(param1.ctrlKey)
+ {
+ this.cursorScene.camera.rotationX = this.cursorScene.camera.rotationX = this.cursorScene.camera.rotationX = -2.0943951023931953;
+ this.cursorScene.cameraController.coords = new Point3D(250,-7800,4670);
+ loc5 = this.cursorScene.camera.coords;
+ this.cameraDistance = Math.sqrt(loc5.x * loc5.x + loc5.y * loc5.y + loc5.z * loc5.z);
+ }
+ break;
+ case KeyboardUtils.UP:
+ case KeyboardUtils.DOWN:
+ case KeyboardUtils.LEFT:
+ case KeyboardUtils.RIGHT:
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.moveByArrows(param1.keyCode);
+ break;
+ }
+ loc2 = this.mainScene.selectedProp;
+ loc4 = loc2.coords;
+ this.mainScene.moveByArrows(param1.keyCode);
+ loc3 = loc2.coords;
+ loc3.difference(loc3,loc4);
+ this.eventJournal.addEvent(EventJournal.MOVE,this.mainScene.selectedProps,loc3);
+ break;
+ case KeyboardUtils.V:
+ this.verticalMoving = true;
+ break;
+ case KeyboardUtils.W:
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.object.z += EditorScene.snapByHalf ? EditorScene.VERTICAL_GRID_RESOLUTION_2 : EditorScene.VERTICAL_GRID_RESOLUTION_1;
+ this.cursorScene.updateMaterial();
+ break;
+ }
+ loc2 = this.mainScene.selectedProp;
+ if(loc2)
+ {
+ loc4 = loc2.coords;
+ this.mainScene.verticalMove(false);
+ loc3 = loc2.coords;
+ loc3.difference(loc3,loc4);
+ this.eventJournal.addEvent(EventJournal.MOVE,this.mainScene.selectedProps,loc3);
+ }
+ break;
+ case KeyboardUtils.S:
+ if(!param1.ctrlKey)
+ {
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.object.z -= EditorScene.snapByHalf ? EditorScene.VERTICAL_GRID_RESOLUTION_2 : EditorScene.VERTICAL_GRID_RESOLUTION_1;
+ this.cursorScene.updateMaterial();
+ break;
+ }
+ loc2 = this.mainScene.selectedProp;
+ if(loc2)
+ {
+ loc4 = loc2.coords;
+ this.mainScene.verticalMove(true);
+ loc3 = loc2.coords;
+ loc3.difference(loc3,loc4);
+ this.eventJournal.addEvent(EventJournal.MOVE,this.mainScene.selectedProps,loc3);
+ }
+ }
+ break;
+ case KeyboardUtils.DELETE:
+ case KeyboardUtils.C:
+ loc2 = this.mainScene.selectedProp;
+ if(loc2)
+ {
+ loc6 = this.cursorScene.object;
+ if(loc6)
+ {
+ loc6.coords = loc2.coords;
+ if(this.snapMode)
+ {
+ loc6.snapToGrid();
+ }
+ }
+ loc7 = this.mainScene.deleteProps();
+ this.eventJournal.addEvent(EventJournal.DELETE,loc7);
+ this.cursorScene.visible = true;
+ }
+ break;
+ case KeyboardUtils.Z:
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.rotateCursorCounterClockwise();
+ this.cursorScene.updateMaterial();
+ break;
+ }
+ this.eventJournal.addEvent(EventJournal.ROTATE,this.mainScene.selectedProps.clone(),false);
+ this.mainScene.rotateCounterClockwise();
+ break;
+ case KeyboardUtils.X:
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.rotateCursorClockwise();
+ this.cursorScene.updateMaterial();
+ break;
+ }
+ this.eventJournal.addEvent(EventJournal.ROTATE,this.mainScene.selectedProps.clone(),true);
+ this.mainScene.rotateClockwise();
+ break;
+ case KeyboardUtils.ESCAPE:
+ loc2 = this.mainScene.selectedProp;
+ if(loc2)
+ {
+ if(this.cursorScene.object)
+ {
+ this.cursorScene.object.coords = loc2.coords;
+ this.cursorScene.object.snapToGrid();
+ }
+ this.mainScene.deselectProps();
+ this.cursorScene.visible = true;
+ }
+ break;
+ case Keyboard.NUMPAD_ADD:
+ this.zoom(3);
+ break;
+ case Keyboard.NUMPAD_SUBTRACT:
+ this.zoom(-3);
+ break;
+ case Keyboard.EQUAL:
+ if(param1.ctrlKey)
+ {
+ this.zoom(3);
+ }
+ break;
+ case Keyboard.MINUS:
+ if(param1.ctrlKey)
+ {
+ this.zoom(-3);
+ }
+ break;
+ case Keyboard.F:
+ this.mainScene.mirrorTextures();
+ break;
+ case Keyboard.Q:
+ this.mainScene.selectConflictingProps();
+ break;
+ case Keyboard.T:
+ if(param1.shiftKey)
+ {
+ this.mainScene.hidePlaneBounds();
+ break;
+ }
+ this.mainScene.showPlaneBounds();
+ break;
+ case Keyboard.K:
+ EditorScene.toggleGridResolution();
+ }
+ }
+
+ private function onKeyUp(param1:KeyboardEvent) : void
+ {
+ switch(param1.keyCode)
+ {
+ case KeyboardUtils.V:
+ this.verticalMoving = false;
+ }
+ }
+
+ public function clear() : void
+ {
+ this.mainScene.clear();
+ this.cursorScene.clear();
+ }
+
+ public function set snapMode(param1:Boolean) : void
+ {
+ this._snapMode = param1;
+ this.mainScene.snapMode = param1;
+ this.cursorScene.snapMode = param1;
+ }
+
+ public function get snapMode() : Boolean
+ {
+ return this._snapMode;
+ }
+
+ public function addProp(param1:Prop) : void
+ {
+ var loc2:Prop = this.mainScene.addProp(param1,this.cursorScene.object.coords,this.cursorScene.object.rotationZ);
+ var loc3:Set = new Set();
+ loc3.add(loc2);
+ this.eventJournal.addEvent(EventJournal.ADD,loc3);
+ setTimeout(this.cursorScene.updateMaterial,200);
+ loc2.addEventListener(MouseEvent3D.MOUSE_DOWN,this.onPropMouseDown);
+ if(this._snapMode && !this.cursorScene.freeState && (this.multiplePropMode == MultiPropMode.NONE && this.cursorScene.occupyMap.isConflict(loc2) || this.multiplePropMode == MultiPropMode.GROUP && this.cursorScene.occupyMap.isConflictGroup(loc2)))
+ {
+ Alert.show("This location is occupied. Continue?","",Alert.YES | Alert.NO,this,this.alertConflict,null,Alert.YES);
+ }
+ }
+
+ private function onPropMouseDown(param1:MouseEvent3D) : void
+ {
+ this.clickZ = param1.object.z;
+ this.propDown = true;
+ }
+
+ public function undo() : void
+ {
+ var loc1:EventJournalItem = this.eventJournal.undo();
+ if(loc1)
+ {
+ this.mainScene.undo(loc1);
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.updateMaterial();
+ }
+ }
+ }
+
+ public function redo() : void
+ {
+ var loc1:EventJournalItem = this.eventJournal.redo();
+ if(loc1)
+ {
+ this.mainScene.redo(loc1);
+ if(this.cursorScene.visible)
+ {
+ this.cursorScene.updateMaterial();
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/TexturePanel.as b/src/alternativa/editor/TexturePanel.as
new file mode 100644
index 0000000..8c63c9c
--- /dev/null
+++ b/src/alternativa/editor/TexturePanel.as
@@ -0,0 +1,103 @@
+package alternativa.editor
+{
+ import alternativa.types.Map;
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.display.Sprite;
+ import gui.events.PropListEvent;
+ import mx.containers.HBox;
+ import mx.containers.Panel;
+ import mx.controls.Image;
+ import mx.controls.TileList;
+ import mx.core.ClassFactory;
+ import mx.events.ListEvent;
+
+ public class TexturePanel extends Panel
+ {
+ public var selectedItem:* = null;
+
+ private var dataProvider:Array;
+
+ private var list:TileList;
+
+ private var texturePreview:Image;
+
+ public function TexturePanel()
+ {
+ this.list = new TileList();
+ this.texturePreview = new Image();
+ super();
+ percentWidth = 100;
+ percentHeight = 100;
+ this.title = "Textures";
+ var loc1:HBox = new HBox();
+ addChild(loc1);
+ loc1.addChild(this.list);
+ loc1.addChild(this.texturePreview);
+ loc1.percentHeight = loc1.percentWidth = 100;
+ loc1.setStyle("verticalAlign","middle");
+ this.texturePreview.width = this.texturePreview.height = 100;
+ this.list.percentWidth = 100;
+ this.list.height = 80;
+ this.list.setStyle("verticalAlign","middle");
+ this.dataProvider = new Array();
+ this.list.dataProvider = this.dataProvider;
+ this.list.rowHeight = 82;
+ this.list.columnWidth = 52;
+ this.list.itemRenderer = new ClassFactory(ImageItemRenderer);
+ this.list.addEventListener(ListEvent.ITEM_CLICK,this.onSelect);
+ }
+
+ private function onSelect(param1:ListEvent) : void
+ {
+ this.texturePreview.source = param1.itemRenderer.data.pr;
+ this.selectedItem = param1.itemRenderer.data.id;
+ dispatchEvent(new PropListEvent(0,param1.itemRenderer.data.id));
+ }
+
+ public function fill(param1:Map) : void
+ {
+ var loc2:* = undefined;
+ var loc3:BitmapData = null;
+ var loc4:Bitmap = null;
+ this.deleteAllProps();
+ for(loc2 in param1)
+ {
+ loc3 = param1[loc2];
+ loc4 = new Bitmap(loc3);
+ this.addItem(loc2,loc4,loc2);
+ }
+ this.addTransparentTexture();
+ this.selectedItem = null;
+ }
+
+ private function deleteAllProps() : void
+ {
+ this.dataProvider = new Array();
+ this.list.dataProvider = this.dataProvider;
+ this.texturePreview.source = null;
+ }
+
+ private function addItem(param1:Object, param2:Bitmap, param3:String) : void
+ {
+ var loc4:Sprite = new Sprite();
+ var loc5:Sprite = new Sprite();
+ loc4.addChild(param2);
+ loc5.addChild(new Bitmap(param2.bitmapData));
+ var loc6:Object = {
+ "id":param1,
+ "image":loc4,
+ "label":param3,
+ "pr":loc5
+ };
+ this.dataProvider.push(loc6);
+ this.dataProvider.sortOn("label");
+ }
+
+ private function addTransparentTexture() : void
+ {
+ this.addItem(InvisibleTexture.TEXTURE_NAME,InvisibleTexture.invisibleTexture,InvisibleTexture.TEXTURE_NAME);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/eventjournal/EventJournal.as b/src/alternativa/editor/eventjournal/EventJournal.as
new file mode 100644
index 0000000..f113318
--- /dev/null
+++ b/src/alternativa/editor/eventjournal/EventJournal.as
@@ -0,0 +1,68 @@
+package alternativa.editor.eventjournal
+{
+ import alternativa.types.Set;
+
+ public class EventJournal
+ {
+ public static const ADD:int = 0;
+
+ public static const DELETE:int = 1;
+
+ public static const ROTATE:int = 2;
+
+ public static const MOVE:int = 3;
+
+ public static const COPY:int = 4;
+
+ public static const CHANGE_TEXTURE:int = 5;
+
+ private var events:Array;
+
+ private var cancelEvents:Array;
+
+ public function EventJournal()
+ {
+ super();
+ this.events = [];
+ this.cancelEvents = [];
+ }
+
+ public function addEvent(param1:int, param2:Set, param3:* = null) : void
+ {
+ this.events.push(new EventJournalItem(param1,param2,param3));
+ this.cancelEvents.length = 0;
+ }
+
+ public function undo(param1:Boolean = false) : EventJournalItem
+ {
+ var loc3:EventJournalItem = null;
+ var loc2:int = int(this.events.length);
+ if(loc2 > 0)
+ {
+ loc3 = this.events[loc2 - 1];
+ this.events.pop();
+ if(!param1)
+ {
+ this.cancelEvents.push(loc3);
+ }
+ return loc3;
+ }
+ return null;
+ }
+
+ public function redo() : EventJournalItem
+ {
+ var loc2:EventJournalItem = null;
+ var loc1:int = int(this.cancelEvents.length);
+ if(loc1 > 0)
+ {
+ loc2 = this.cancelEvents[loc1 - 1];
+ this.cancelEvents.pop();
+ this.events.push(loc2);
+ return loc2;
+ }
+ return null;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/eventjournal/EventJournalItem.as b/src/alternativa/editor/eventjournal/EventJournalItem.as
new file mode 100644
index 0000000..b4f8f2d
--- /dev/null
+++ b/src/alternativa/editor/eventjournal/EventJournalItem.as
@@ -0,0 +1,22 @@
+package alternativa.editor.eventjournal
+{
+ import alternativa.types.Set;
+
+ public class EventJournalItem
+ {
+ public var operation:int;
+
+ public var props:Set;
+
+ public var oldState:*;
+
+ public function EventJournalItem(param1:int, param2:Set, param3:*)
+ {
+ super();
+ this.operation = param1;
+ this.props = param2;
+ this.oldState = param3;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/events/DominationSpawnLinkEndEvent.as b/src/alternativa/editor/events/DominationSpawnLinkEndEvent.as
new file mode 100644
index 0000000..a0005e6
--- /dev/null
+++ b/src/alternativa/editor/events/DominationSpawnLinkEndEvent.as
@@ -0,0 +1,24 @@
+package alternativa.editor.events
+{
+ import alternativa.editor.prop.ControlPoint;
+ import flash.events.Event;
+
+ public class DominationSpawnLinkEndEvent extends Event
+ {
+ public static const DOMINATION_SPAWN_LINK_END:String = "dominationSpawnLinkEnd";
+
+ public var checkPoint:ControlPoint;
+
+ public function DominationSpawnLinkEndEvent(param1:ControlPoint)
+ {
+ super(DOMINATION_SPAWN_LINK_END);
+ this.checkPoint = param1;
+ }
+
+ override public function clone() : Event
+ {
+ return new DominationSpawnLinkEndEvent(this.checkPoint);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/events/DominationSpawnLinkStartEvent.as b/src/alternativa/editor/events/DominationSpawnLinkStartEvent.as
new file mode 100644
index 0000000..fe656dd
--- /dev/null
+++ b/src/alternativa/editor/events/DominationSpawnLinkStartEvent.as
@@ -0,0 +1,24 @@
+package alternativa.editor.events
+{
+ import alternativa.editor.prop.SpawnPoint;
+ import flash.events.Event;
+
+ public class DominationSpawnLinkStartEvent extends Event
+ {
+ public static const DOMINATION_SPAWN_LINK_START:String = "dominationSpawnLinkStart";
+
+ public var spawnPoint:SpawnPoint;
+
+ public function DominationSpawnLinkStartEvent(param1:SpawnPoint)
+ {
+ super(DOMINATION_SPAWN_LINK_START);
+ this.spawnPoint = param1;
+ }
+
+ override public function clone() : Event
+ {
+ return new DominationSpawnLinkStartEvent(this.spawnPoint);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/events/EditorProgressEvent.as b/src/alternativa/editor/events/EditorProgressEvent.as
new file mode 100644
index 0000000..ef741f7
--- /dev/null
+++ b/src/alternativa/editor/events/EditorProgressEvent.as
@@ -0,0 +1,28 @@
+package alternativa.editor.events
+{
+ import flash.events.Event;
+
+ public class EditorProgressEvent extends Event
+ {
+ public static const PROGRESS:String = "progress";
+
+ public var progress:Number;
+
+ public function EditorProgressEvent(param1:Number)
+ {
+ super(PROGRESS);
+ this.progress = param1;
+ }
+
+ override public function clone() : Event
+ {
+ return new EditorProgressEvent(this.progress);
+ }
+
+ override public function toString() : String
+ {
+ return "EditorProgressEvent progress=" + this.progress;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/events/LayerContentChangeEvent.as b/src/alternativa/editor/events/LayerContentChangeEvent.as
new file mode 100644
index 0000000..da504ba
--- /dev/null
+++ b/src/alternativa/editor/events/LayerContentChangeEvent.as
@@ -0,0 +1,25 @@
+package alternativa.editor.events
+{
+ import alternativa.editor.prop.Prop;
+ import flash.events.Event;
+
+ public class LayerContentChangeEvent extends Event
+ {
+ public static const LAYER_CONTENT_CHANGED:String = "LAYER_CONTENT_CHANGED";
+
+ public var prop:Prop;
+
+ public var layerName:String;
+
+ public var layerContainsProp:Boolean;
+
+ public function LayerContentChangeEvent(param1:Prop, param2:String, param3:Boolean)
+ {
+ this.prop = param1;
+ this.layerName = param2;
+ this.layerContainsProp = param3;
+ super(LAYER_CONTENT_CHANGED,false,true);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/events/LayerVisibilityChangeEvent.as b/src/alternativa/editor/events/LayerVisibilityChangeEvent.as
new file mode 100644
index 0000000..52fcd2a
--- /dev/null
+++ b/src/alternativa/editor/events/LayerVisibilityChangeEvent.as
@@ -0,0 +1,26 @@
+package alternativa.editor.events
+{
+ import flash.events.Event;
+
+ public class LayerVisibilityChangeEvent extends Event
+ {
+ public static const VISIBILITY_CHANGED:String = "visibilityChanged";
+
+ public var layerName:String;
+
+ public var visible:Boolean;
+
+ public function LayerVisibilityChangeEvent(param1:String, param2:Boolean)
+ {
+ super(VISIBILITY_CHANGED,false,true);
+ this.layerName = param1;
+ this.visible = param2;
+ }
+
+ override public function clone() : Event
+ {
+ return new LayerVisibilityChangeEvent(this.layerName,this.visible);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/CollisionBox.as b/src/alternativa/editor/mapexport/CollisionBox.as
new file mode 100644
index 0000000..85b0358
--- /dev/null
+++ b/src/alternativa/editor/mapexport/CollisionBox.as
@@ -0,0 +1,114 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+
+ public class CollisionBox extends CollisionPrimitive
+ {
+ public var size:Point3D;
+
+ public function CollisionBox(param1:int, param2:Mesh = null)
+ {
+ this.size = new Point3D();
+ super(param1,param2);
+ }
+
+ override public function parse(param1:Mesh) : void
+ {
+ var loc8:Vertex = null;
+ var loc9:Point3D = null;
+ var loc10:Point3D = null;
+ var loc2:Number = Number.MAX_VALUE;
+ var loc3:Number = -Number.MAX_VALUE;
+ var loc4:Number = Number.MAX_VALUE;
+ var loc5:Number = -Number.MAX_VALUE;
+ var loc6:Number = Number.MAX_VALUE;
+ var loc7:Number = -Number.MAX_VALUE;
+ for each(loc8 in param1.alternativa3d::_vertices)
+ {
+ loc10 = loc8.alternativa3d::_coords;
+ if(loc10.x < loc2)
+ {
+ loc2 = loc10.x;
+ }
+ if(loc10.x > loc3)
+ {
+ loc3 = loc10.x;
+ }
+ if(loc10.y < loc4)
+ {
+ loc4 = loc10.y;
+ }
+ if(loc10.y > loc5)
+ {
+ loc5 = loc10.y;
+ }
+ if(loc10.z < loc6)
+ {
+ loc6 = loc10.z;
+ }
+ if(loc10.z > loc7)
+ {
+ loc7 = loc10.z;
+ }
+ }
+ this.size.x = loc3 - loc2;
+ this.size.y = loc5 - loc4;
+ this.size.z = loc7 - loc6;
+ loc9 = new Point3D(0.5 * (loc3 + loc2),0.5 * (loc5 + loc4),0.5 * (loc7 + loc6));
+ transform.toIdentity();
+ transform.rotate(param1.alternativa3d::_rotationX,param1.alternativa3d::_rotationY,param1.alternativa3d::_rotationZ);
+ transform.translate(param1.alternativa3d::_coords.x,param1.alternativa3d::_coords.y,param1.alternativa3d::_coords.z);
+ loc9.transform(transform);
+ transform.d = loc9.x;
+ transform.h = loc9.y;
+ transform.l = loc9.z;
+ }
+
+ override public function getXml(param1:Matrix3D) : XML
+ {
+ var loc2:Matrix3D = null;
+ if(param1 == null)
+ {
+ loc2 = transform;
+ }
+ else
+ {
+ loc2 = transform.clone();
+ loc2.combine(param1);
+ }
+ var loc3:Point3D = loc2.getRotations();
+ return
+
+ {this.size.x.toFixed(PRECISION)}
+ {this.size.y.toFixed(PRECISION)}
+ {this.size.z.toFixed(PRECISION)}
+
+
+ {loc2.d.toFixed(PRECISION)}
+ {loc2.h.toFixed(PRECISION)}
+ {loc2.l.toFixed(PRECISION)}
+
+
+ {loc3.x.toFixed(ROT_PRECISION)}
+ {loc3.y.toFixed(ROT_PRECISION)}
+ {loc3.z.toFixed(ROT_PRECISION)}
+
+ ;
+ }
+
+ override public function getXml2() : XML
+ {
+ var loc1:Point3D = transform.getRotations();
+ var loc2:XML = ;
+ loc2.appendChild(getVector3DXML(,this.size.x,this.size.y,this.size.z,PRECISION));
+ loc2.appendChild(getVector3DXML(,transform.d,transform.h,transform.l,PRECISION));
+ loc2.appendChild(getVector3DXML(,loc1.x,loc1.y,loc1.z,ROT_PRECISION));
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/CollisionPrimitive.as b/src/alternativa/editor/mapexport/CollisionPrimitive.as
new file mode 100644
index 0000000..462e985
--- /dev/null
+++ b/src/alternativa/editor/mapexport/CollisionPrimitive.as
@@ -0,0 +1,50 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.types.Matrix3D;
+
+ public class CollisionPrimitive
+ {
+ public static const PRECISION:int = 3;
+
+ public static const ROT_PRECISION:int = 6;
+
+ public var id:int;
+
+ public var transform:Matrix3D;
+
+ public function CollisionPrimitive(param1:int, param2:Mesh = null)
+ {
+ this.transform = new Matrix3D();
+ super();
+ this.id = param1;
+ if(param2 != null)
+ {
+ this.parse(param2);
+ }
+ }
+
+ public function parse(param1:Mesh) : void
+ {
+ }
+
+ public function getXml(param1:Matrix3D) : XML
+ {
+ return new XML();
+ }
+
+ public function getXml2() : XML
+ {
+ return new XML();
+ }
+
+ protected function getVector3DXML(param1:XML, param2:Number, param3:Number, param4:Number, param5:int) : XML
+ {
+ param1.@x = param2.toFixed(param5);
+ param1.@y = param3.toFixed(param5);
+ param1.@z = param4.toFixed(param5);
+ return param1;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/CollisionPrimitivesCache.as b/src/alternativa/editor/mapexport/CollisionPrimitivesCache.as
new file mode 100644
index 0000000..34d306f
--- /dev/null
+++ b/src/alternativa/editor/mapexport/CollisionPrimitivesCache.as
@@ -0,0 +1,45 @@
+package alternativa.editor.mapexport
+{
+ public class CollisionPrimitivesCache
+ {
+ private var cache:Object;
+
+ public function CollisionPrimitivesCache()
+ {
+ this.cache = {};
+ super();
+ }
+
+ public function addPrimitives(param1:String, param2:String, param3:String, param4:Vector.) : void
+ {
+ var loc5:Object = this.cache[param1];
+ if(loc5 == null)
+ {
+ this.cache[param1] = loc5 = {};
+ }
+ var loc6:Object = loc5[param2];
+ if(loc6 == null)
+ {
+ loc5[param2] = loc6 = {};
+ }
+ loc6[param3] = param4;
+ }
+
+ public function getPrimitives(param1:String, param2:String, param3:String) : Vector.
+ {
+ var loc4:Object = this.cache[param1];
+ if(loc4 == null)
+ {
+ return null;
+ }
+ loc4 = loc4[param2];
+ return loc4 != null ? loc4[param3] : null;
+ }
+
+ public function clear() : void
+ {
+ this.cache = {};
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/CollisionRect.as b/src/alternativa/editor/mapexport/CollisionRect.as
new file mode 100644
index 0000000..d991b88
--- /dev/null
+++ b/src/alternativa/editor/mapexport/CollisionRect.as
@@ -0,0 +1,103 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+
+ public class CollisionRect extends CollisionPrimitive
+ {
+ public var width:Number = 0;
+
+ public var length:Number = 0;
+
+ public function CollisionRect(param1:int, param2:Mesh = null)
+ {
+ super(param1,param2);
+ }
+
+ override public function parse(param1:Mesh) : void
+ {
+ var loc2:int = 0;
+ var loc14:Point3D = null;
+ var loc15:Number = NaN;
+ var loc3:Face = param1.alternativa3d::_faces.peek() as Face;
+ var loc4:Number = -1;
+ var loc5:int = 0;
+ var loc6:Vector. = Vector.([new Point3D(),new Point3D(),new Point3D()]);
+ var loc7:Vector. = new Vector.(3);
+ loc2 = 0;
+ while(loc2 < 3)
+ {
+ loc14 = loc6[loc2];
+ loc14.difference(loc3.vertices[(loc2 + 1) % 3].alternativa3d::_coords,loc3.vertices[loc2].alternativa3d::_coords);
+ loc15 = loc7[loc2] = loc14.length;
+ if(loc15 > loc4)
+ {
+ loc4 = loc15;
+ loc5 = loc2;
+ }
+ loc2++;
+ }
+ var loc8:int = (loc5 + 2) % 3;
+ var loc9:int = (loc5 + 1) % 3;
+ var loc10:Point3D = loc6[loc8];
+ var loc11:Point3D = loc6[loc9];
+ loc11.invert();
+ this.width = loc7[loc8];
+ this.length = loc7[loc9];
+ var loc12:Point3D = loc3.vertices[(loc5 + 2) % 3].alternativa3d::_coords.clone();
+ loc12.x += 0.5 * (loc10.x + loc11.x);
+ loc12.y += 0.5 * (loc10.y + loc11.y);
+ loc12.z += 0.5 * (loc10.z + loc11.z);
+ loc10.normalize();
+ loc11.normalize();
+ var loc13:Point3D = Point3D.cross(loc10,loc11);
+ transform.setVectors(loc10,loc11,loc13,loc12);
+ transform.rotate(param1.alternativa3d::_rotationX,param1.alternativa3d::_rotationY,param1.alternativa3d::_rotationZ);
+ transform.translate(param1.alternativa3d::_coords.x,param1.alternativa3d::_coords.y,param1.alternativa3d::_coords.z);
+ }
+
+ override public function getXml(param1:Matrix3D) : XML
+ {
+ var loc2:Matrix3D = null;
+ if(param1 == null)
+ {
+ loc2 = transform;
+ }
+ else
+ {
+ loc2 = transform.clone();
+ loc2.combine(param1);
+ }
+ var loc3:Point3D = loc2.getRotations();
+ return
+ {this.width.toFixed(PRECISION)}
+ {this.length.toFixed(PRECISION)}
+
+ {loc2.d.toFixed(PRECISION)}
+ {loc2.h.toFixed(PRECISION)}
+ {loc2.l.toFixed(PRECISION)}
+
+
+ {loc3.x.toFixed(ROT_PRECISION)}
+ {loc3.y.toFixed(ROT_PRECISION)}
+ {loc3.z.toFixed(ROT_PRECISION)}
+
+ ;
+ }
+
+ override public function getXml2() : XML
+ {
+ var loc1:Point3D = transform.getRotations();
+ var loc2:XML = ;
+ var loc3:XML = ;
+ loc2.appendChild(loc3);
+ loc2.appendChild(getVector3DXML(,transform.d,transform.h,transform.l,PRECISION));
+ loc2.appendChild(getVector3DXML(,loc1.x,loc1.y,loc1.z,ROT_PRECISION));
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/CollisionTriangle.as b/src/alternativa/editor/mapexport/CollisionTriangle.as
new file mode 100644
index 0000000..86d6671
--- /dev/null
+++ b/src/alternativa/editor/mapexport/CollisionTriangle.as
@@ -0,0 +1,124 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+
+ public class CollisionTriangle extends CollisionPrimitive
+ {
+ private var v0:Point3D;
+
+ private var v1:Point3D;
+
+ private var v2:Point3D;
+
+ public function CollisionTriangle(param1:int, param2:Mesh = null)
+ {
+ this.v0 = new Point3D();
+ this.v1 = new Point3D();
+ this.v2 = new Point3D();
+ super(param1,param2);
+ }
+
+ override public function parse(param1:Mesh) : void
+ {
+ var loc2:Array = Face(param1.alternativa3d::_faces.peek()).vertices;
+ this.v0.copy(Vertex(loc2[0]).alternativa3d::_coords);
+ this.v1.copy(Vertex(loc2[1]).alternativa3d::_coords);
+ this.v2.copy(Vertex(loc2[2]).alternativa3d::_coords);
+ var loc3:Point3D = new Point3D();
+ loc3.x = (this.v0.x + this.v1.x + this.v2.x) / 3;
+ loc3.y = (this.v0.y + this.v1.y + this.v2.y) / 3;
+ loc3.z = (this.v0.z + this.v1.z + this.v2.z) / 3;
+ var loc4:Point3D = new Point3D();
+ loc4.difference(this.v1,this.v0);
+ this.v1.reset(loc4.length,0,0);
+ loc4.normalize();
+ var loc5:Point3D = new Point3D();
+ loc5.difference(this.v2,this.v0);
+ var loc6:Number = loc5.dot(loc4);
+ var loc7:Number = Math.sqrt(loc5.lengthSqr - loc6 * loc6);
+ this.v2.reset(loc6,loc7,0);
+ var loc8:Point3D = new Point3D();
+ loc8.cross2(loc4,loc5);
+ loc8.normalize();
+ loc5.cross2(loc8,loc4);
+ loc5.normalize();
+ transform.setVectors(loc4,loc5,loc8,loc3);
+ transform.rotate(param1.alternativa3d::_rotationX,param1.alternativa3d::_rotationY,param1.alternativa3d::_rotationZ);
+ transform.translate(param1.alternativa3d::_coords.x,param1.alternativa3d::_coords.y,param1.alternativa3d::_coords.z);
+ loc6 = (this.v1.x + this.v2.x) / 3;
+ loc7 = (this.v1.y + this.v2.y) / 3;
+ this.v0.reset(-loc6,-loc7,0);
+ this.v1.x -= loc6;
+ this.v1.y -= loc7;
+ this.v2.x -= loc6;
+ this.v2.y -= loc7;
+ }
+
+ override public function getXml(param1:Matrix3D) : XML
+ {
+ var loc2:Matrix3D = null;
+ if(param1 == null)
+ {
+ loc2 = transform;
+ }
+ else
+ {
+ loc2 = transform.clone();
+ loc2.combine(param1);
+ }
+ var loc3:Point3D = loc2.getRotations();
+ return
+
+ {this.v0.x.toFixed(PRECISION)}
+ {this.v0.y.toFixed(PRECISION)}
+ {this.v0.z.toFixed(PRECISION)}
+
+
+ {this.v1.x.toFixed(PRECISION)}
+ {this.v1.y.toFixed(PRECISION)}
+ {this.v1.z.toFixed(PRECISION)}
+
+
+ {this.v2.x.toFixed(PRECISION)}
+ {this.v2.y.toFixed(PRECISION)}
+ {this.v2.z.toFixed(PRECISION)}
+
+
+ {loc2.d.toFixed(PRECISION)}
+ {loc2.h.toFixed(PRECISION)}
+ {loc2.l.toFixed(PRECISION)}
+
+
+ {loc3.x.toFixed(ROT_PRECISION)}
+ {loc3.y.toFixed(ROT_PRECISION)}
+ {loc3.z.toFixed(ROT_PRECISION)}
+
+ ;
+ }
+
+ override public function getXml2() : XML
+ {
+ var loc1:Point3D = transform.getRotations();
+ var loc2:XML = ;
+ loc2.appendChild(this.getVector2DXML(,this.v0,PRECISION));
+ loc2.appendChild(this.getVector2DXML(,this.v1,PRECISION));
+ loc2.appendChild(this.getVector2DXML(,this.v2,PRECISION));
+ loc2.appendChild(getVector3DXML(,transform.d,transform.h,transform.l,PRECISION));
+ loc2.appendChild(getVector3DXML(,loc1.x,loc1.y,loc1.z,ROT_PRECISION));
+ return loc2;
+ }
+
+ private function getVector2DXML(param1:XML, param2:Point3D, param3:int) : XML
+ {
+ param1.@x = param2.x.toFixed(param3);
+ param1.@y = param2.y.toFixed(param3);
+ return param1;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/ExportManager.as b/src/alternativa/editor/mapexport/ExportManager.as
new file mode 100644
index 0000000..5a2bec8
--- /dev/null
+++ b/src/alternativa/editor/mapexport/ExportManager.as
@@ -0,0 +1,40 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.editor.scene.MainScene;
+ import flash.events.Event;
+ import flash.filesystem.File;
+ import flash.filesystem.FileMode;
+ import flash.filesystem.FileStream;
+
+ public class ExportManager
+ {
+ private var mainScene:MainScene;
+
+ private var file:File;
+
+ private var fileType:FileType;
+
+ public function ExportManager(param1:MainScene)
+ {
+ super();
+ this.mainScene = param1;
+ this.file = new File();
+ this.file.addEventListener(Event.SELECT,this.onFileSelected);
+ }
+
+ public function exportMap(param1:FileType) : void
+ {
+ this.fileType = param1;
+ this.file.browseForSave("Save");
+ }
+
+ private function onFileSelected(param1:Event) : void
+ {
+ var loc2:FileStream = new FileStream();
+ loc2.open(this.file,FileMode.WRITE);
+ this.mainScene.exportScene(this.fileType,loc2);
+ loc2.close();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/FileExporter.as b/src/alternativa/editor/mapexport/FileExporter.as
new file mode 100644
index 0000000..ed22dd9
--- /dev/null
+++ b/src/alternativa/editor/mapexport/FileExporter.as
@@ -0,0 +1,21 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.engine3d.core.Object3D;
+ import flash.filesystem.FileStream;
+
+ public class FileExporter
+ {
+ public var sceneRoot:Object3D;
+
+ public function FileExporter(param1:Object3D)
+ {
+ super();
+ this.sceneRoot = param1;
+ }
+
+ public function exportToFileStream(param1:FileStream) : void
+ {
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/FileType.as b/src/alternativa/editor/mapexport/FileType.as
new file mode 100644
index 0000000..6c3b44d
--- /dev/null
+++ b/src/alternativa/editor/mapexport/FileType.as
@@ -0,0 +1,27 @@
+package alternativa.editor.mapexport
+{
+ public class FileType
+ {
+ public static const MAP_XML_VERSION_1_FULL:FileType = new FileType("MAP_XML_VERSION_1_FULL");
+
+ public static const MAP_XML_VERSION_1_LITE:FileType = new FileType("MAP_XML_VERSION_1_LITE");
+
+ public static const MAP_XML_VERSION_2:FileType = new FileType("MAP_XML_VERSION_2");
+
+ public static const MAP_XML_VERSION_3:FileType = new FileType("MAP_XML_VERSION_3");
+
+ private var value:String;
+
+ public function FileType(param1:String)
+ {
+ super();
+ this.value = param1;
+ }
+
+ public function toString() : String
+ {
+ return this.value;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/TanksXmlExporterV1Full.as b/src/alternativa/editor/mapexport/TanksXmlExporterV1Full.as
new file mode 100644
index 0000000..b75e97c
--- /dev/null
+++ b/src/alternativa/editor/mapexport/TanksXmlExporterV1Full.as
@@ -0,0 +1,91 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.editor.FunctionalProps;
+ import alternativa.editor.prop.CTFFlagBase;
+ import alternativa.editor.prop.ControlPoint;
+ import alternativa.editor.prop.FreeBonusRegion;
+ import alternativa.editor.prop.KillBox;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.SpawnPoint;
+ import alternativa.engine3d.core.Object3D;
+ import flash.filesystem.FileStream;
+
+ public class TanksXmlExporterV1Full extends TanksXmlExporterV1Lite
+ {
+ public function TanksXmlExporterV1Full(param1:Object3D)
+ {
+ super(param1);
+ }
+
+ private static function getKillXml(param1:KillBox) : XML
+ {
+ var loc2:XML = <{FunctionalProps.KILL_BOX_NAME} type={param1.name}>
+ {param1.minX}
+ {param1.minY}
+ {param1.minZ}
+
+ {param1.maxx}
+ {param1.maxy}
+ {param1.maxz}
+
+
+ {param1.action}
+ {FunctionalProps.KILL_BOX_NAME}>;
+ if(param1.free)
+ {
+ loc2.@free = "true";
+ }
+ return loc2;
+ }
+
+ override public function exportToFileStream(param1:FileStream) : void
+ {
+ var loc8:* = undefined;
+ var loc9:Prop = null;
+ var loc10:MeshProp = null;
+ var loc2:XML = new XML("");
+ var loc3:XML = loc2.child("static-geometry")[0];
+ var loc4:XML = loc2.child("collision-geometry")[0];
+ var loc5:XML = loc2.child("bonus-regions")[0];
+ var loc6:XML = loc2.child("spawn-points")[0];
+ var loc7:XML = loc2.child(FunctionalProps.KILL_GEOMETRY)[0];
+ for(loc8 in sceneRoot.children)
+ {
+ loc9 = loc8 as Prop;
+ if(!loc9)
+ {
+ continue;
+ }
+ switch(loc9.type)
+ {
+ case Prop.BONUS:
+ loc5.appendChild(getBonusXml(loc9 as FreeBonusRegion));
+ break;
+ case Prop.KILL_GEOMETRY:
+ loc7.appendChild(getKillXml(loc9 as KillBox));
+ break;
+ case Prop.SPAWN:
+ if(loc9.name != FunctionalProps.DOMINATION_SPAWN)
+ {
+ loc6.appendChild(getSpawnXml(loc9 as SpawnPoint));
+ }
+ break;
+ case Prop.FLAG:
+ addCtfFlag(loc2,loc9 as CTFFlagBase);
+ break;
+ case Prop.TILE:
+ loc10 = loc9 as MeshProp;
+ loc3.appendChild(getTileXml(loc10));
+ createTileCollisionXml(loc10,loc4);
+ break;
+ case Prop.DOMINATION_CONTROL_POINT:
+ addDominationControlPoint(loc2,loc9 as ControlPoint);
+ break;
+ }
+ }
+ param1.writeUTFBytes(loc2.toXMLString());
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as b/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as
new file mode 100644
index 0000000..c7b7381
--- /dev/null
+++ b/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as
@@ -0,0 +1,253 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.editor.FunctionalProps;
+ import alternativa.editor.prop.CTFFlagBase;
+ import alternativa.editor.prop.ControlPoint;
+ import alternativa.editor.prop.FreeBonusRegion;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.SpawnPoint;
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import flash.filesystem.FileStream;
+
+ public class TanksXmlExporterV1Lite extends FileExporter
+ {
+ private static const PRECISION:int = 3;
+
+ private var collPrimCache:CollisionPrimitivesCache;
+
+ public function TanksXmlExporterV1Lite(param1:Object3D)
+ {
+ super(param1);
+ this.collPrimCache = new CollisionPrimitivesCache();
+ }
+
+ protected static function addDominationControlPoint(param1:XML, param2:ControlPoint) : void
+ {
+ var loc4:XML = null;
+ var loc6:SpawnPoint = null;
+ var loc3:XMLList = param1.elements("dom-keypoints");
+ if(loc3.length() == 0)
+ {
+ loc4 = ;
+ param1.appendChild(loc4);
+ }
+ else
+ {
+ loc4 = loc3[0];
+ }
+ var loc5:XML = ;
+ loc5.appendChild(getPositionXML(param2));
+ for each(loc6 in param2.getSpawnPoints())
+ {
+ loc5.appendChild(getSpawnXml(loc6));
+ }
+ loc4.appendChild(loc5);
+ }
+
+ protected static function getPositionXML(param1:Prop) : XML
+ {
+ return
+ {param1.x.toFixed(PRECISION)}
+ {param1.y.toFixed(PRECISION)}
+ {param1.z.toFixed(PRECISION)}
+ ;
+ }
+
+ protected static function getTileXml(param1:MeshProp) : XML
+ {
+ var loc2:XML =
+
+ {param1.rotationZ.toFixed(6)}
+
+ {param1.textureName}
+ ;
+ loc2.appendChild(getPositionXML(param1));
+ if(param1.free)
+ {
+ loc2.@free = "true";
+ }
+ return loc2;
+ }
+
+ protected static function addCtfFlag(param1:XML, param2:CTFFlagBase) : void
+ {
+ var loc4:XML = null;
+ var loc5:XML = null;
+ var loc3:XMLList = param1.elements("ctf-flags");
+ if(loc3.length() == 0)
+ {
+ loc4 = ;
+ param1.appendChild(loc4);
+ }
+ else
+ {
+ loc4 = loc3[0];
+ }
+ switch(param2.name)
+ {
+ case "red_flag":
+ loc5 =
+ {param2.x.toFixed(PRECISION)}
+ {param2.y.toFixed(PRECISION)}
+ {param2.z.toFixed(PRECISION)}
+ ;
+ break;
+ case "blue_flag":
+ loc5 =
+ {param2.x.toFixed(PRECISION)}
+ {param2.y.toFixed(PRECISION)}
+ {param2.z.toFixed(PRECISION)}
+ ;
+ }
+ loc4.appendChild(loc5);
+ }
+
+ protected static function createPropCollisionPrimitives(param1:MeshProp) : Vector.
+ {
+ var loc3:* = undefined;
+ var loc4:Mesh = null;
+ var loc5:String = null;
+ var loc2:Vector. = new Vector.();
+ for(loc3 in param1.collisionGeometry)
+ {
+ loc4 = loc3;
+ loc5 = loc4.name.toLowerCase();
+ if(loc5.indexOf("plane") == 0)
+ {
+ loc2.push(new CollisionRect(0,loc4));
+ }
+ else if(loc5.indexOf("box") == 0)
+ {
+ loc2.push(new CollisionBox(0,loc4));
+ }
+ else if(loc5.indexOf("tri") == 0)
+ {
+ loc2.push(new CollisionTriangle(0,loc4));
+ }
+ }
+ return loc2;
+ }
+
+ protected static function getSpawnXml(param1:SpawnPoint) : XML
+ {
+ var loc2:XML =
+
+ {param1.rotationZ.toFixed(PRECISION)}
+
+ ;
+ loc2.appendChild(getPositionXML(param1));
+ if(param1.free)
+ {
+ loc2.@free = "true";
+ }
+ return loc2;
+ }
+
+ protected static function getBonusXml(param1:FreeBonusRegion) : XML
+ {
+ var loc3:* = undefined;
+ var loc4:* = undefined;
+ var loc2:XML =
+
+ {param1.rotationZ.toFixed(PRECISION)}
+
+
+ {param1.minX.toFixed(PRECISION)}
+ {param1.minY.toFixed(PRECISION)}
+ {param1.minZ.toFixed(PRECISION)}
+
+
+ {param1.maxx.toFixed(PRECISION)}
+ {param1.maxy.toFixed(PRECISION)}
+ {param1.maxz.toFixed(PRECISION)}
+
+ ;
+ loc2.appendChild(getPositionXML(param1));
+ if(param1.free)
+ {
+ loc2.@free = "true";
+ }
+ for(loc3 in param1.typeNames)
+ {
+ loc2.appendChild({loc3});
+ }
+ for(loc4 in param1.gameModes)
+ {
+ loc2.appendChild({loc4});
+ }
+ return loc2;
+ }
+
+ override public function exportToFileStream(param1:FileStream) : void
+ {
+ var loc7:* = undefined;
+ var loc8:Prop = null;
+ var loc9:MeshProp = null;
+ var loc2:XML = ;
+ var loc3:XML = loc2.child("static-geometry")[0];
+ var loc4:XML = loc2.child("collision-geometry")[0];
+ var loc5:XML = loc2.child("bonus-regions")[0];
+ var loc6:XML = loc2.child("spawn-points")[0];
+ for(loc7 in sceneRoot.children)
+ {
+ loc8 = loc7 as Prop;
+ if(!loc8)
+ {
+ continue;
+ }
+ switch(loc8.type)
+ {
+ case Prop.BONUS:
+ loc5.appendChild(getBonusXml(loc8 as FreeBonusRegion));
+ break;
+ case Prop.SPAWN:
+ if(loc8.name != FunctionalProps.DOMINATION_SPAWN)
+ {
+ loc6.appendChild(getSpawnXml(loc8 as SpawnPoint));
+ }
+ break;
+ case Prop.FLAG:
+ addCtfFlag(loc2,loc8 as CTFFlagBase);
+ break;
+ case Prop.TILE:
+ loc9 = loc8 as MeshProp;
+ loc3.appendChild(getTileXml(loc9));
+ this.createTileCollisionXml(loc9,loc4);
+ break;
+ case Prop.DOMINATION_CONTROL_POINT:
+ addDominationControlPoint(loc2,loc8 as ControlPoint);
+ break;
+ }
+ }
+ param1.writeUTFBytes(loc2.toXMLString());
+ }
+
+ protected function createTileCollisionXml(param1:MeshProp, param2:XML) : void
+ {
+ var loc4:CollisionPrimitive = null;
+ var loc3:Vector. = this.collPrimCache.getPrimitives(param1.libraryName,param1.groupName,param1.name);
+ if(loc3 == null)
+ {
+ loc3 = createPropCollisionPrimitives(param1);
+ this.collPrimCache.addPrimitives(param1.libraryName,param1.groupName,param1.name,loc3);
+ }
+ for each(loc4 in loc3)
+ {
+ param2.appendChild(loc4.getXml(param1.alternativa3d::_transformation));
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapexport/TanksXmlExporterV3.as b/src/alternativa/editor/mapexport/TanksXmlExporterV3.as
new file mode 100644
index 0000000..68e38b4
--- /dev/null
+++ b/src/alternativa/editor/mapexport/TanksXmlExporterV3.as
@@ -0,0 +1,311 @@
+package alternativa.editor.mapexport
+{
+ import alternativa.editor.prop.BonusRegion;
+ import alternativa.editor.prop.CTFFlagBase;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.SpawnPoint;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import flash.filesystem.FileStream;
+
+ use namespace alternativa3d;
+
+ public class TanksXmlExporterV3 extends FileExporter
+ {
+ private static const VERSION:String = "3.0";
+
+ private const PRECISION:int = 3;
+
+ private const ROT_PRECISION:int = 6;
+
+ private var propIndex:int;
+
+ private var mapObjectIndex:int;
+
+ private var collisionBoxIndex:int;
+
+ private var collisionRectIndex:int;
+
+ private var collisionTriIndex:int;
+
+ private var propRegistry:Object;
+
+ private var propsXML:XML;
+
+ private var meshesXML:XML;
+
+ private var spritesXML:XML;
+
+ public function TanksXmlExporterV3(param1:Object3D)
+ {
+ super(param1);
+ }
+
+ override public function exportToFileStream(param1:FileStream) : void
+ {
+ var loc6:* = undefined;
+ var loc7:XML = null;
+ var loc8:PropRegistryData = null;
+ var loc9:Prop = null;
+ this.propIndex = 0;
+ this.mapObjectIndex = 0;
+ this.collisionBoxIndex = 0;
+ this.collisionRectIndex = 0;
+ this.collisionTriIndex = 0;
+ this.propRegistry = {};
+ var loc2:XML = ;
+ this.propsXML = ;
+ this.meshesXML = ;
+ this.spritesXML = ;
+ var loc3:XML = ;
+ var loc4:XML = ;
+ var loc5:XML = ;
+ for(loc6 in sceneRoot.children)
+ {
+ loc9 = loc6 as Prop;
+ if(!loc9)
+ {
+ continue;
+ }
+ switch(loc9.type)
+ {
+ case Prop.BONUS:
+ break;
+ case Prop.SPAWN:
+ loc4.appendChild(this.getSpawnXml(SpawnPoint(loc9)));
+ break;
+ case Prop.FLAG:
+ this.addCtfFlag(loc5,CTFFlagBase(loc9));
+ break;
+ case Prop.TILE:
+ this.processTile(MeshProp(loc9));
+ break;
+ }
+ }
+ for each(loc7 in [this.propsXML,this.meshesXML,this.spritesXML,loc4,loc3])
+ {
+ loc2.appendChild(loc7.children());
+ }
+ if(loc5.children().length() > 0)
+ {
+ loc2.appendChild(loc5);
+ }
+ for each(loc8 in this.propRegistry)
+ {
+ loc8.createCollisionRecords();
+ }
+ param1.writeUTFBytes(loc2.toXMLString());
+ loc3 = null;
+ loc4 = null;
+ }
+
+ private function processTile(param1:MeshProp) : void
+ {
+ var loc4:XML = null;
+ var loc2:String = param1.libraryName + "/" + param1.groupName + "/" + param1.name;
+ var loc3:PropRegistryData = this.propRegistry[loc2];
+ if(loc3 == null)
+ {
+ loc4 = ;
+ this.propsXML.appendChild(loc4);
+ loc3 = new PropRegistryData(this.propIndex++,loc4);
+ this.createPropCollisionPrimitives(loc3,param1);
+ this.propRegistry[loc2] = loc3;
+ }
+ this.addReferences(this.mapObjectIndex,loc3,param1);
+ ++this.mapObjectIndex;
+ }
+
+ private function createPropCollisionPrimitives(param1:PropRegistryData, param2:MeshProp) : void
+ {
+ var loc6:* = undefined;
+ var loc7:Mesh = null;
+ var loc8:String = null;
+ var loc3:Vector. = new Vector.();
+ var loc4:Vector. = new Vector.();
+ var loc5:Vector. = new Vector.();
+ for(loc6 in param2.collisionGeometry)
+ {
+ loc7 = loc6;
+ loc8 = loc7.name.toLowerCase();
+ if(loc8.indexOf("plane") == 0)
+ {
+ loc4.push(new CollisionRect(this.collisionRectIndex++,loc7));
+ }
+ else if(loc8.indexOf("box") == 0)
+ {
+ loc3.push(new CollisionBox(this.collisionBoxIndex++,loc7));
+ }
+ else if(loc8.indexOf("tri") == 0)
+ {
+ loc5.push(new CollisionTriangle(this.collisionTriIndex++,loc7));
+ }
+ }
+ if(loc3.length > 0)
+ {
+ param1.collisionBoxes = loc3;
+ }
+ if(loc4.length > 0)
+ {
+ param1.collisionRects = loc4;
+ }
+ if(loc5.length > 0)
+ {
+ param1.collisionTriangles = loc5;
+ }
+ }
+
+ private function addCollisionRegistryPrimitives(param1:XML, param2:Vector.) : void
+ {
+ var loc3:CollisionPrimitive = null;
+ if(param2 == null)
+ {
+ return;
+ }
+ for each(loc3 in param2)
+ {
+ param1.appendChild(loc3.getXml2());
+ }
+ }
+
+ private function addReferences(param1:int, param2:PropRegistryData, param3:MeshProp) : void
+ {
+ var loc5:String = null;
+ var loc4:XML = ;
+ if(param3.free)
+ {
+ loc4.@free = "true";
+ }
+ loc4.appendChild(this.getVector3DXML(,param3.x,param3.y,param3.z,this.PRECISION));
+ if(param3 is Sprite3DProp)
+ {
+ loc4.setName("sprite");
+ this.spritesXML.appendChild(loc4);
+ }
+ else
+ {
+ loc4.setName("mesh");
+ loc4.appendChild({param3.rotationZ.toFixed(this.ROT_PRECISION)});
+ loc5 = param3.textureName;
+ if(loc5 != null && loc5 != "")
+ {
+ loc4.appendChild({param2.getTextureIndex(loc5)});
+ }
+ this.meshesXML.appendChild(loc4);
+ }
+ }
+
+ private function addCtfFlag(param1:XML, param2:CTFFlagBase) : void
+ {
+ var loc3:XML = null;
+ switch(param2.name)
+ {
+ case "red_flag":
+ loc3 = ;
+ break;
+ case "blue_flag":
+ loc3 = ;
+ }
+ param1.appendChild(this.getVector3DXML(loc3,param2.x,param2.y,param2.z,this.PRECISION));
+ }
+
+ private function getSpawnXml(param1:SpawnPoint) : XML
+ {
+ var loc2:XML = ;
+ loc2.appendChild(this.getVector3DXML(,param1.x,param1.y,param1.z,this.PRECISION));
+ loc2.appendChild({param1.rotationZ.toFixed(this.PRECISION)});
+ if(param1.free)
+ {
+ loc2.@free = "true";
+ }
+ return loc2;
+ }
+
+ private function getBonusXml(param1:BonusRegion) : XML
+ {
+ var loc3:* = undefined;
+ var loc2:XML = ;
+ if(param1.free)
+ {
+ loc2.@free = "true";
+ }
+ loc2.appendChild(this.getVector3DXML(,param1.x,param1.y,param1.z,this.PRECISION));
+ loc2.appendChild({param1.rotationZ.toFixed(this.ROT_PRECISION)});
+ loc2.appendChild(this.getVector3DXML(,param1.x + param1.distancesX.x,param1.y + param1.distancesY.x,param1.z + param1.distancesZ.x,this.PRECISION));
+ loc2.appendChild(this.getVector3DXML(,param1.x + param1.distancesX.y,param1.y + param1.distancesY.y,param1.z + param1.distancesZ.y,this.PRECISION));
+ for(loc3 in param1.typeNames)
+ {
+ loc2.appendChild({loc3});
+ }
+ return loc2;
+ }
+
+ private function getVector3DXML(param1:XML, param2:Number, param3:Number, param4:Number, param5:int) : XML
+ {
+ param1.@x = param2.toFixed(param5);
+ param1.@y = param3.toFixed(param5);
+ param1.@z = param4.toFixed(param5);
+ return param1;
+ }
+ }
+}
+
+import alternativa.editor.mapexport.CollisionPrimitive;
+
+class PropRegistryData
+{
+ public var propIndex:int;
+
+ public var collisionBoxes:Vector.;
+
+ public var collisionRects:Vector.;
+
+ public var collisionTriangles:Vector.;
+
+ private var textureNames:Array;
+
+ private var xml:XML;
+
+ public function PropRegistryData(param1:int, param2:XML)
+ {
+ this.textureNames = [];
+ super();
+ this.propIndex = param1;
+ this.xml = param2;
+ }
+
+ public function getTextureIndex(param1:String) : int
+ {
+ var loc2:int = int(this.textureNames.indexOf(param1));
+ if(loc2 < 0)
+ {
+ loc2 = int(this.textureNames.length);
+ this.textureNames.push(param1);
+ this.xml.appendChild({param1});
+ }
+ return loc2;
+ }
+
+ public function createCollisionRecords() : void
+ {
+ this.addCollisionPrimitives(this.collisionBoxes);
+ this.addCollisionPrimitives(this.collisionRects);
+ this.addCollisionPrimitives(this.collisionTriangles);
+ }
+
+ private function addCollisionPrimitives(param1:Vector.) : void
+ {
+ var loc2:CollisionPrimitive = null;
+ if(param1 == null)
+ {
+ return;
+ }
+ for each(loc2 in param1)
+ {
+ this.xml.appendChild(loc2.getXml2());
+ }
+ }
+}
diff --git a/src/alternativa/editor/mapimport/FileImporter.as b/src/alternativa/editor/mapimport/FileImporter.as
new file mode 100644
index 0000000..dd9c712
--- /dev/null
+++ b/src/alternativa/editor/mapimport/FileImporter.as
@@ -0,0 +1,50 @@
+package alternativa.editor.mapimport
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.scene.MainScene;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.filesystem.FileStream;
+ import mx.controls.Alert;
+ import mx.events.CloseEvent;
+
+ public class FileImporter extends EventDispatcher
+ {
+ protected var scene:MainScene;
+
+ protected var libraryManager:LibraryManager;
+
+ protected var libname:String = "";
+
+ public function FileImporter(param1:MainScene, param2:LibraryManager)
+ {
+ super();
+ this.scene = param1;
+ this.libraryManager = param2;
+ }
+
+ public function importFromFileStream(param1:FileStream) : void
+ {
+ }
+
+ protected function libAlertListener(param1:CloseEvent) : void
+ {
+ switch(param1.detail)
+ {
+ case Alert.YES:
+ break;
+ case Alert.NO:
+ this.scene.clear();
+ this.endLoadLevel();
+ }
+ }
+
+ protected function endLoadLevel() : void
+ {
+ this.scene.changed = false;
+ this.libname = null;
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/ImportManager.as b/src/alternativa/editor/mapimport/ImportManager.as
new file mode 100644
index 0000000..6b5c1fc
--- /dev/null
+++ b/src/alternativa/editor/mapimport/ImportManager.as
@@ -0,0 +1,97 @@
+package alternativa.editor.mapimport
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.scene.MainScene;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.filesystem.File;
+ import flash.filesystem.FileMode;
+ import flash.filesystem.FileStream;
+ import flash.net.FileFilter;
+ import flash.utils.setTimeout;
+
+ public class ImportManager extends EventDispatcher
+ {
+ private var mainScene:MainScene;
+
+ private var tanksXmlImporter:TanksXmlImporter;
+
+ private var file:File;
+
+ private var xmlFilter:FileFilter;
+
+ private var loadSpecials:Boolean;
+
+ public function ImportManager(param1:MainScene, param2:LibraryManager)
+ {
+ this.xmlFilter = new FileFilter("Tanks level (*.xml)","*.xml");
+ super();
+ this.mainScene = param1;
+ this.tanksXmlImporter = new TanksXmlImporter(param1,param2);
+ this.tanksXmlImporter.addEventListener(Event.COMPLETE,this.onLeveleLoadingComplete);
+ this.tanksXmlImporter.addEventListener(EditorProgressEvent.PROGRESS,this.onLeveleLoadingProgress);
+ this.file = new File();
+ this.file.addEventListener(Event.SELECT,this.onFileSelected);
+ }
+
+ public function importFromXML(param1:Boolean = false) : void
+ {
+ this.loadSpecials = param1;
+ this.file.browseForOpen("Open",[this.xmlFilter]);
+ }
+
+ private function onFileSelected(param1:Event) : void
+ {
+ if(hasEventListener(Event.OPEN))
+ {
+ dispatchEvent(new Event(Event.OPEN));
+ }
+ if(this.loadSpecials)
+ {
+ setTimeout(this.startSpecialImport,100);
+ }
+ else
+ {
+ setTimeout(this.startImport,100);
+ }
+ }
+
+ public function startImport(param1:File = null) : void
+ {
+ var loc2:FileStream = new FileStream();
+ loc2.open(!!param1 ? param1 : this.file,FileMode.READ);
+ this.tanksXmlImporter.importFromFileStream(loc2);
+ }
+
+ public function startSpecialImport(param1:File = null) : void
+ {
+ var loc2:FileStream = new FileStream();
+ loc2.open(!!param1 ? param1 : this.file,FileMode.READ);
+ this.tanksXmlImporter.specialImport(loc2);
+ }
+
+ public function clearScene() : void
+ {
+ this.mainScene.clear();
+ }
+
+ private function onLeveleLoadingComplete(param1:Event) : void
+ {
+ this.mainScene.changed = false;
+ if(hasEventListener(Event.COMPLETE))
+ {
+ dispatchEvent(param1);
+ }
+ }
+
+ private function onLeveleLoadingProgress(param1:EditorProgressEvent) : void
+ {
+ if(hasEventListener(EditorProgressEvent.PROGRESS))
+ {
+ dispatchEvent(param1);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/TanksXmlImporter.as b/src/alternativa/editor/mapimport/TanksXmlImporter.as
new file mode 100644
index 0000000..f80d7eb
--- /dev/null
+++ b/src/alternativa/editor/mapimport/TanksXmlImporter.as
@@ -0,0 +1,78 @@
+package alternativa.editor.mapimport
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.mapimport.xml.IXMLImporter;
+ import alternativa.editor.mapimport.xml.XMLImporterV1;
+ import alternativa.editor.mapimport.xml.XMLImporterV1Full;
+ import alternativa.editor.mapimport.xml.XMLImporterV2;
+ import alternativa.editor.mapimport.xml.XMLImporterV3;
+ import alternativa.editor.scene.MainScene;
+ import flash.events.Event;
+ import flash.filesystem.FileStream;
+ import mx.controls.Alert;
+
+ public class TanksXmlImporter extends FileImporter
+ {
+ private var importers:Object;
+
+ public function TanksXmlImporter(param1:MainScene, param2:LibraryManager)
+ {
+ super(param1,param2);
+ this.importers = {};
+ this.addImporter("1.0.Light",new XMLImporterV1());
+ this.addImporter("1.0",new XMLImporterV1Full());
+ this.addImporter("2.0",new XMLImporterV2());
+ this.addImporter("3.0",new XMLImporterV3());
+ }
+
+ override public function importFromFileStream(param1:FileStream) : void
+ {
+ var loc2:XML = new XML(param1.readUTFBytes(param1.bytesAvailable));
+ param1.close();
+ var loc3:String = loc2.attribute("version")[0];
+ var loc4:IXMLImporter = this.importers[loc3];
+ if(loc4 == null)
+ {
+ Alert.show("Unsupported version " + loc3);
+ return;
+ }
+ loc4.importMap(loc2,scene,libraryManager);
+ }
+
+ public function specialImport(param1:FileStream) : void
+ {
+ var loc2:XML = new XML(param1.readUTFBytes(param1.bytesAvailable));
+ param1.close();
+ var loc3:String = loc2.attribute("version")[0];
+ var loc4:IXMLImporter = this.importers[loc3];
+ if(loc4 == null)
+ {
+ Alert.show("Unsupported version " + loc3);
+ return;
+ }
+ loc4.addInternalObjectsToExistingScene(loc2,scene,libraryManager);
+ }
+
+ private function addImporter(param1:String, param2:IXMLImporter) : void
+ {
+ this.importers[param1] = param2;
+ param2.addEventListener(Event.COMPLETE,this.onImportComplete);
+ param2.addEventListener(EditorProgressEvent.PROGRESS,this.onImportProgress);
+ }
+
+ private function onImportComplete(param1:Event) : void
+ {
+ endLoadLevel();
+ }
+
+ private function onImportProgress(param1:EditorProgressEvent) : void
+ {
+ if(hasEventListener(EditorProgressEvent.PROGRESS))
+ {
+ dispatchEvent(param1);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/xml/IXMLImporter.as b/src/alternativa/editor/mapimport/xml/IXMLImporter.as
new file mode 100644
index 0000000..8176740
--- /dev/null
+++ b/src/alternativa/editor/mapimport/xml/IXMLImporter.as
@@ -0,0 +1,14 @@
+package alternativa.editor.mapimport.xml
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.scene.MainScene;
+ import flash.events.IEventDispatcher;
+
+ public interface IXMLImporter extends IEventDispatcher
+ {
+ function importMap(param1:XML, param2:MainScene, param3:LibraryManager) : void;
+
+ function addInternalObjectsToExistingScene(param1:XML, param2:MainScene, param3:LibraryManager) : void;
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/xml/XMLImporterBase.as b/src/alternativa/editor/mapimport/xml/XMLImporterBase.as
new file mode 100644
index 0000000..452d478
--- /dev/null
+++ b/src/alternativa/editor/mapimport/xml/XMLImporterBase.as
@@ -0,0 +1,74 @@
+package alternativa.editor.mapimport.xml
+{
+ import flash.events.EventDispatcher;
+ import flash.events.TimerEvent;
+ import flash.utils.Timer;
+
+ public class XMLImporterBase extends EventDispatcher
+ {
+ private var maxBatchSize:int;
+
+ private var items:XMLList;
+
+ private var firstIndex:int;
+
+ private var timer:Timer;
+
+ public function XMLImporterBase()
+ {
+ super();
+ }
+
+ protected function startBatchExecution(param1:int, param2:XMLList) : void
+ {
+ this.maxBatchSize = param1;
+ this.items = param2;
+ this.firstIndex = 0;
+ this.timer = new Timer(10,1);
+ this.timer.addEventListener(TimerEvent.TIMER_COMPLETE,this.onTimerComplete);
+ this.processBatch();
+ }
+
+ protected function processItem(param1:XML) : void
+ {
+ }
+
+ protected function batchComplete(param1:int) : void
+ {
+ }
+
+ protected function batchExecutionComplete() : void
+ {
+ }
+
+ private function processBatch() : void
+ {
+ if(this.firstIndex == this.items.length())
+ {
+ this.batchExecutionComplete();
+ return;
+ }
+ var loc1:int = this.firstIndex + this.maxBatchSize;
+ if(loc1 > this.items.length())
+ {
+ loc1 = int(this.items.length());
+ }
+ var loc2:int = this.firstIndex;
+ while(loc2 < loc1)
+ {
+ this.processItem(this.items[loc2]);
+ loc2++;
+ }
+ this.firstIndex = loc1;
+ this.batchComplete(this.firstIndex);
+ this.timer.reset();
+ this.timer.start();
+ }
+
+ private function onTimerComplete(param1:TimerEvent) : void
+ {
+ this.processBatch();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/xml/XMLImporterV1.as b/src/alternativa/editor/mapimport/xml/XMLImporterV1.as
new file mode 100644
index 0000000..8507607
--- /dev/null
+++ b/src/alternativa/editor/mapimport/xml/XMLImporterV1.as
@@ -0,0 +1,344 @@
+package alternativa.editor.mapimport.xml
+{
+ import alternativa.editor.FunctionalProps;
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.prop.ControlPoint;
+ import alternativa.editor.prop.FreeBonusRegion;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.SpawnPoint;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.editor.scene.MainScene;
+ import alternativa.types.Point3D;
+ import flash.events.Event;
+ import flash.utils.setTimeout;
+ import mx.controls.Alert;
+
+ public class XMLImporterV1 extends XMLImporterBase implements IXMLImporter
+ {
+ private static const BATCH_SIZE:int = 100;
+
+ protected var mapXML:XML;
+
+ protected var scene:MainScene;
+
+ protected var libraryManager:LibraryManager;
+
+ private var tiles:XMLList;
+
+ public function XMLImporterV1()
+ {
+ super();
+ }
+
+ protected static function getDominationKeyPointKey() : String
+ {
+ return FunctionalProps.LIBRARY_NAME + FunctionalProps.GRP_DOMINATION + FunctionalProps.DOMINATION_POINT;
+ }
+
+ protected static function getPoint3DFromXML(param1:XML) : Point3D
+ {
+ return new Point3D(Number(param1.x),Number(param1.y),Number(param1.z));
+ }
+
+ protected static function getSpawnPointKey(param1:String) : String
+ {
+ if(param1.indexOf("dom") == 0)
+ {
+ return FunctionalProps.LIBRARY_NAME + FunctionalProps.GRP_DOMINATION + param1;
+ }
+ return FunctionalProps.LIBRARY_NAME + FunctionalProps.GRP_SPAWN_POINTS + param1;
+ }
+
+ public function importMap(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ ErrorHandler.clearMessages();
+ this.mapXML = param1;
+ this.scene = param2;
+ this.libraryManager = param3;
+ param2.view.visible = false;
+ setTimeout(this.loadTiles,10);
+ }
+
+ public function addInternalObjectsToExistingScene(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ }
+
+ private function loadTiles() : void
+ {
+ var loc1:XML = this.mapXML.child("static-geometry")[0];
+ if(loc1)
+ {
+ this.tiles = loc1.elements("prop");
+ startBatchExecution(BATCH_SIZE,this.tiles);
+ }
+ else
+ {
+ this.complete();
+ }
+ }
+
+ protected function complete() : void
+ {
+ this.loadFunctionalElements();
+ this.scene.view.visible = true;
+ this.mapXML = null;
+ this.scene = null;
+ this.libraryManager = null;
+ this.tiles = null;
+ if(hasEventListener(Event.COMPLETE))
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+
+ protected function loadFunctionalElements() : void
+ {
+ try
+ {
+ this.loadBonuses();
+ this.loadSpawns();
+ this.loadFlags();
+ this.loadDominationControlPoints();
+ }
+ catch(e:Error)
+ {
+ Alert.show(e.message + " " + e.getStackTrace());
+ }
+ }
+
+ override protected function processItem(param1:XML) : void
+ {
+ var propKey:String = null;
+ var prop:Prop = null;
+ var position:Point3D = null;
+ var rotation:Number = NaN;
+ var free:Boolean = false;
+ var textureName:String = null;
+ var tile:MeshProp = null;
+ var tName:String = null;
+ var item:XML = param1;
+ try
+ {
+ propKey = item.attribute("library-name").toString() + item.attribute("group-name").toString() + item.attribute("name").toString();
+ prop = this.libraryManager.propByKey[propKey];
+ if(prop)
+ {
+ position = getPoint3DFromXML(item.position[0]);
+ rotation = Number(item.rotation.z);
+ if(prop is Sprite3DProp)
+ {
+ position.z += 0.1;
+ }
+ prop = this.scene.addProp(prop,position,rotation,true,false);
+ free = item.@free.toString() == "true";
+ if(!(free && prop is Sprite3DProp))
+ {
+ this.scene.occupyMap.occupy(prop);
+ }
+ textureName = item.elements("texture-name")[0];
+ tile = prop as MeshProp;
+ if(tile)
+ {
+ try
+ {
+ if(textureName != "")
+ {
+ tile.textureName = textureName;
+ }
+ }
+ catch(err:Error)
+ {
+ var loc4:int = 0;
+ var loc5:* = tile.bitmaps;
+ for(tName in loc5)
+ {
+ tile.textureName = tName;
+ }
+ Alert.show("Tile " + tile.name + ": texture " + textureName + " not found");
+ }
+ }
+ }
+ else
+ {
+ ErrorHandler.setMessage("Libraries are not loaded properly");
+ ErrorHandler.addText(propKey + " can\'t be loaded");
+ ErrorHandler.showWindow();
+ }
+ }
+ catch(e:Error)
+ {
+ Alert.show(e.message + " " + e.getStackTrace());
+ }
+ }
+
+ override protected function batchComplete(param1:int) : void
+ {
+ if(hasEventListener(EditorProgressEvent.PROGRESS))
+ {
+ dispatchEvent(new EditorProgressEvent(param1 / this.tiles.length()));
+ }
+ }
+
+ override protected function batchExecutionComplete() : void
+ {
+ this.complete();
+ }
+
+ protected function loadFlags() : void
+ {
+ var loc1:XML = this.mapXML.elements("ctf-flags")[0];
+ if(loc1)
+ {
+ this.addFlag(loc1.child("flag-red")[0],"red_flag");
+ this.addFlag(loc1.child("flag-blue")[0],"blue_flag");
+ }
+ }
+
+ protected function addFlag(param1:XML, param2:String) : void
+ {
+ var loc3:Prop = this.libraryManager.propByKey["FunctionalFlags" + param2];
+ if(loc3 != null)
+ {
+ this.scene.addProp(loc3,new Point3D(Number(param1.x),Number(param1.y),Number(param1.z)),0,true,false);
+ this.scene.calculate();
+ }
+ }
+
+ protected function loadBonuses() : void
+ {
+ var loc2:XMLList = null;
+ var loc3:int = 0;
+ var loc4:XML = null;
+ var loc5:String = null;
+ var loc6:FreeBonusRegion = null;
+ var loc7:XMLList = null;
+ var loc8:XML = null;
+ var loc9:XMLList = null;
+ var loc10:XML = null;
+ var loc11:* = false;
+ var loc1:XML = this.mapXML.elements("bonus-regions")[0];
+ if(loc1)
+ {
+ loc2 = loc1.child("bonus-region");
+ loc3 = 0;
+ while(loc3 < loc2.length())
+ {
+ loc4 = loc2[loc3];
+ loc5 = FunctionalProps.LIBRARY_NAME + FunctionalProps.GRP_BONUS_REGIONS + FunctionalProps.FREE_BONUS_NAME;
+ loc6 = this.libraryManager.propByKey[loc5];
+ if(loc6)
+ {
+ loc7 = loc4.child("bonus-type");
+ FreeBonusRegion(loc6).typeNames.clear();
+ for each(loc8 in loc7)
+ {
+ FreeBonusRegion(loc6).typeNames.add(loc8.toString());
+ }
+ loc9 = loc4.child("game-mode");
+ FreeBonusRegion(loc6).gameModes.clear();
+ for each(loc10 in loc9)
+ {
+ FreeBonusRegion(loc6).gameModes.add(loc10.toString());
+ }
+ loc6 = FreeBonusRegion(this.scene.addProp(loc6,new Point3D(Number(loc4.position.x),Number(loc4.position.y),Number(loc4.position.z)),0,true,false));
+ loc6.minX = Number(loc4.min.x);
+ loc6.minY = Number(loc4.min.y);
+ loc6.minZ = Number(loc4.min.z);
+ loc6.maxx = Number(loc4.max.x);
+ loc6.maxy = Number(loc4.max.y);
+ loc6.maxz = Number(loc4.max.z);
+ if(loc4.hasOwnProperty("@parachute"))
+ {
+ loc6.parachute = loc4.@parachute;
+ }
+ loc11 = loc4.attribute("free").toString() == "true";
+ if(!loc11)
+ {
+ this.scene.occupyMap.occupy(loc6);
+ }
+ this.scene.calculate();
+ }
+ loc3++;
+ }
+ }
+ }
+
+ protected function loadSpawns() : void
+ {
+ var loc2:XML = null;
+ var loc1:XML = this.mapXML.elements("spawn-points")[0];
+ if(loc1)
+ {
+ for each(loc2 in loc1.child("spawn-point"))
+ {
+ this.createSpawnPoint(loc2);
+ }
+ }
+ }
+
+ protected function createSpawnPoint(param1:XML) : SpawnPoint
+ {
+ var loc4:XML = null;
+ var loc5:XML = null;
+ var loc6:* = false;
+ var loc2:String = getSpawnPointKey(param1.attribute("type").toString());
+ var loc3:Prop = this.libraryManager.propByKey[loc2];
+ if(loc3)
+ {
+ loc4 = param1.child("position")[0];
+ loc5 = param1.child("rotation")[0];
+ loc3 = this.scene.addProp(loc3,new Point3D(Number(loc4.child("x")[0]),Number(loc4.child("y")[0]),Number(loc4.child("z")[0])),Number(loc5.child("z")[0]),true,false);
+ loc6 = param1.attribute("free").toString() == "true";
+ if(!loc6)
+ {
+ this.scene.occupyMap.occupy(loc3);
+ }
+ this.scene.calculate();
+ }
+ return SpawnPoint(loc3);
+ }
+
+ protected function loadDominationControlPoints() : void
+ {
+ var loc2:XMLList = null;
+ var loc3:Prop = null;
+ var loc4:XML = null;
+ var loc5:XML = null;
+ var loc6:Prop = null;
+ var loc7:* = false;
+ var loc1:XML = this.mapXML.elements("dom-keypoints")[0];
+ if(loc1)
+ {
+ loc2 = loc1.child("dom-keypoint");
+ loc3 = this.libraryManager.propByKey[getDominationKeyPointKey()];
+ for each(loc4 in loc2)
+ {
+ loc5 = loc4.child("position")[0];
+ loc6 = this.scene.addProp(loc3,new Point3D(Number(loc5.child("x")[0]),Number(loc5.child("y")[0]),Number(loc5.child("z")[0])),0,true,false);
+ loc7 = loc4.attribute("free").toString() == "true";
+ ControlPoint(loc6).controlPointName = loc4.@name;
+ if(!loc7)
+ {
+ this.scene.occupyMap.occupy(loc6);
+ }
+ this.loadDominationPointSpawns(loc4,ControlPoint(loc6));
+ this.scene.calculate();
+ }
+ }
+ }
+
+ protected function loadDominationPointSpawns(param1:XML, param2:ControlPoint) : void
+ {
+ var loc3:XML = null;
+ var loc4:SpawnPoint = null;
+ for each(loc3 in param1.elements("spawn-point"))
+ {
+ loc4 = this.createSpawnPoint(loc3);
+ param2.addSpawnPoint(loc4);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/xml/XMLImporterV1Full.as b/src/alternativa/editor/mapimport/xml/XMLImporterV1Full.as
new file mode 100644
index 0000000..383287f
--- /dev/null
+++ b/src/alternativa/editor/mapimport/xml/XMLImporterV1Full.as
@@ -0,0 +1,82 @@
+package alternativa.editor.mapimport.xml
+{
+ import alternativa.editor.FunctionalProps;
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.prop.KillBox;
+ import alternativa.editor.scene.MainScene;
+ import alternativa.types.Point3D;
+ import flash.events.Event;
+ import mx.controls.Alert;
+
+ public class XMLImporterV1Full extends XMLImporterV1
+ {
+ public function XMLImporterV1Full()
+ {
+ super();
+ }
+
+ override protected function loadFunctionalElements() : void
+ {
+ try
+ {
+ loadBonuses();
+ loadSpawns();
+ loadFlags();
+ this.loadKillZones();
+ loadDominationControlPoints();
+ }
+ catch(e:Error)
+ {
+ Alert.show(e.message + " " + e.getStackTrace());
+ }
+ }
+
+ override public function addInternalObjectsToExistingScene(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ ErrorHandler.clearMessages();
+ this.mapXML = param1;
+ this.scene = param2;
+ this.libraryManager = param3;
+ this.scene.view.visible = false;
+ this.loadKillZones();
+ this.scene.view.visible = true;
+ this.mapXML = null;
+ this.scene = null;
+ this.libraryManager = null;
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+
+ protected function loadKillZones() : void
+ {
+ var loc2:int = 0;
+ var loc1:XMLList = mapXML.*.elements(FunctionalProps.KILL_BOX_NAME);
+ if(loc1)
+ {
+ loc2 = 0;
+ while(loc2 < loc1.length())
+ {
+ this.addKillZone(loc1[loc2],FunctionalProps.KILL_GEOMETRY);
+ loc2++;
+ }
+ }
+ }
+
+ protected function addKillZone(param1:XML, param2:String) : void
+ {
+ var loc3:KillBox = KillBox(libraryManager.propByKey["Functional" + FunctionalProps.KILL_GEOMETRY + param2]);
+ if(loc3 != null)
+ {
+ loc3 = KillBox(scene.addProp(loc3,new Point3D(Number(param1.position.x),Number(param1.position.y),Number(param1.position.z)),0,true,false));
+ loc3.minX = Number(param1.minX);
+ loc3.minY = Number(param1.minY);
+ loc3.minZ = Number(param1.minZ);
+ loc3.maxx = Number(param1.maxX);
+ loc3.maxy = Number(param1.maxY);
+ loc3.maxz = Number(param1.maxZ);
+ loc3.action = param1.action;
+ scene.calculate();
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/mapimport/xml/XMLImporterV2.as b/src/alternativa/editor/mapimport/xml/XMLImporterV2.as
new file mode 100644
index 0000000..c434d05
--- /dev/null
+++ b/src/alternativa/editor/mapimport/xml/XMLImporterV2.as
@@ -0,0 +1,284 @@
+package alternativa.editor.mapimport.xml
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.prop.BonusRegion;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.editor.scene.MainScene;
+ import alternativa.types.Point3D;
+ import flash.events.Event;
+ import flash.utils.setTimeout;
+ import mx.controls.Alert;
+
+ public class XMLImporterV2 extends XMLImporterBase implements IXMLImporter
+ {
+ private var mapXML:XML;
+
+ private var scene:MainScene;
+
+ private var libraryManager:LibraryManager;
+
+ private var referencePopData:Array;
+
+ private var numProps:int;
+
+ public function XMLImporterV2()
+ {
+ super();
+ }
+
+ public function importMap(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ this.mapXML = param1;
+ this.scene = param2;
+ this.libraryManager = param3;
+ param2.view.visible = false;
+ setTimeout(this.loadTiles,10);
+ }
+
+ public function addInternalObjectsToExistingScene(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ }
+
+ private function loadTiles() : void
+ {
+ var loc1:Prop = null;
+ var loc5:XML = null;
+ var loc6:Array = null;
+ this.referencePopData = [];
+ var loc2:XMLList = this.mapXML.elements("prop");
+ var loc3:int = int(loc2.length());
+ var loc4:int = 0;
+ while(loc4 < loc3)
+ {
+ loc5 = loc2[loc4];
+ loc6 = [loc5.attribute("library-name").toString(),loc5.attribute("group-name").toString(),loc5.attribute("name").toString()];
+ loc1 = this.libraryManager.propByKey[loc6.join("")];
+ if(loc1 == null)
+ {
+ throw new Error("Prop " + loc6.join("/") + " not found");
+ }
+ this.referencePopData[loc4] = new PropData(loc1,loc5.elements("texture-name"));
+ loc4++;
+ }
+ this.numProps = this.mapXML.elements("map-object").length();
+ startBatchExecution(200,this.mapXML.elements("map-object"));
+ }
+
+ override protected function processItem(param1:XML) : void
+ {
+ var propData:PropData = null;
+ var prop:Prop = null;
+ var position:Point3D = null;
+ var rotation:Number = NaN;
+ var free:Boolean = false;
+ var textureName:String = null;
+ var tile:MeshProp = null;
+ var tName:String = null;
+ var mapObjectXML:XML = param1;
+ try
+ {
+ propData = this.referencePopData[int(mapObjectXML.attribute("prop-index"))];
+ prop = propData.prop;
+ position = this.getPoint3DFromXML(mapObjectXML.elements("position")[0]);
+ rotation = Number(mapObjectXML.elements("rotation-z"));
+ if(prop is Sprite3DProp)
+ {
+ position.z += 0.1;
+ }
+ prop = this.scene.addProp(prop,position,rotation,true,false);
+ free = mapObjectXML.@free == "true";
+ if(!(free && prop is Sprite3DProp))
+ {
+ this.scene.occupyMap.occupy(prop);
+ }
+ textureName = null;
+ if(mapObjectXML.elements("texture-index").length() > 0)
+ {
+ textureName = propData.textureNames[int(mapObjectXML.elements("texture-index")[0])];
+ }
+ tile = prop as MeshProp;
+ if(tile)
+ {
+ try
+ {
+ if(textureName != null)
+ {
+ tile.textureName = textureName;
+ }
+ }
+ catch(err:Error)
+ {
+ var loc4:int = 0;
+ var loc5:* = tile.bitmaps;
+ for(tName in loc5)
+ {
+ tile.textureName = tName;
+ }
+ Alert.show("Tile " + tile.name + ": texture " + textureName + " not found");
+ }
+ }
+ this.scene.calculate();
+ }
+ catch(e:Error)
+ {
+ Alert.show(e.message);
+ }
+ }
+
+ override protected function batchComplete(param1:int) : void
+ {
+ if(hasEventListener(EditorProgressEvent.PROGRESS))
+ {
+ dispatchEvent(new EditorProgressEvent(param1 / this.numProps));
+ }
+ }
+
+ override protected function batchExecutionComplete() : void
+ {
+ try
+ {
+ this.loadBonuses(this.mapXML.elements("bonus-region"));
+ this.loadSpawns(this.mapXML.elements("spawn-point"));
+ this.loadFlags(this.mapXML.elements("ctf-flags"));
+ }
+ catch(err:Error)
+ {
+ Alert.show(err.message);
+ }
+ this.scene.view.visible = true;
+ this.mapXML = null;
+ this.scene = null;
+ this.libraryManager = null;
+ this.referencePopData = null;
+ if(hasEventListener(Event.COMPLETE))
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+
+ private function loadBonuses(param1:XMLList) : void
+ {
+ var loc4:XML = null;
+ var loc5:String = null;
+ var loc6:Prop = null;
+ var loc7:Point3D = null;
+ var loc8:Number = NaN;
+ var loc9:* = false;
+ var loc10:XMLList = null;
+ var loc11:int = 0;
+ var loc2:int = int(param1.length());
+ var loc3:int = 0;
+ while(loc3 < loc2)
+ {
+ loc4 = param1[loc3];
+ loc5 = "FunctionalBonus Regions" + loc4.@name.toString();
+ loc6 = this.libraryManager.propByKey[loc5];
+ if(loc6)
+ {
+ loc7 = this.getPoint3DFromXML(loc4.elements("position")[0]);
+ loc8 = Number(loc4.elements("rotation")[0]);
+ loc6 = this.scene.addProp(loc6,loc7,loc8,true,false);
+ loc9 = loc4.@free == "true";
+ if(!loc9)
+ {
+ this.scene.occupyMap.occupy(loc6);
+ }
+ loc10 = loc4.child("bonus-type");
+ BonusRegion(loc6).typeNames.clear();
+ loc11 = 0;
+ while(loc11 < loc10.length())
+ {
+ BonusRegion(loc6).typeNames.add(loc10[loc11].toString());
+ loc11++;
+ }
+ this.scene.calculate();
+ }
+ loc3++;
+ }
+ }
+
+ private function loadSpawns(param1:XMLList) : void
+ {
+ var loc4:XML = null;
+ var loc5:String = null;
+ var loc6:Prop = null;
+ var loc7:Point3D = null;
+ var loc8:Number = NaN;
+ var loc9:* = false;
+ var loc2:int = int(param1.length());
+ var loc3:int = 0;
+ while(loc3 < loc2)
+ {
+ loc4 = param1[loc3];
+ loc5 = "FunctionalSpawn Points" + loc4.@type.toString();
+ loc6 = this.libraryManager.propByKey[loc5];
+ if(loc6)
+ {
+ loc7 = this.getPoint3DFromXML(loc4.elements("position")[0]);
+ loc8 = Number(loc4.elements("direction")[0]);
+ loc6 = this.scene.addProp(loc6,loc7,loc8,true,false);
+ loc9 = loc4.@free == "true";
+ if(!loc9)
+ {
+ this.scene.occupyMap.occupy(loc6);
+ }
+ this.scene.calculate();
+ }
+ loc3++;
+ }
+ }
+
+ private function loadFlags(param1:XMLList) : void
+ {
+ if(param1.length() == 0)
+ {
+ return;
+ }
+ var loc2:XML = param1[0];
+ this.addFlag(loc2.child("flag-red")[0],"red_flag");
+ this.addFlag(loc2.child("flag-blue")[0],"blue_flag");
+ }
+
+ private function addFlag(param1:XML, param2:String) : void
+ {
+ var loc3:Prop = this.libraryManager.propByKey["FunctionalFlags" + param2];
+ if(loc3 != null)
+ {
+ loc3 = this.scene.addProp(loc3,this.getPoint3DFromXML(param1),0,true,false);
+ this.scene.calculate();
+ }
+ }
+
+ private function getPoint3DFromXML(param1:XML) : Point3D
+ {
+ return new Point3D(Number(param1.@x),Number(param1.@y),Number(param1.@z));
+ }
+ }
+}
+
+import alternativa.editor.prop.Prop;
+
+class PropData
+{
+ public var prop:Prop;
+
+ public var textureNames:Array;
+
+ public function PropData(param1:Prop, param2:XMLList)
+ {
+ var loc3:XML = null;
+ super();
+ this.prop = param1;
+ if(param2.length() > 0)
+ {
+ this.textureNames = [];
+ for each(loc3 in param2)
+ {
+ this.textureNames.push(loc3.toString());
+ }
+ }
+ }
+}
diff --git a/src/alternativa/editor/mapimport/xml/XMLImporterV3.as b/src/alternativa/editor/mapimport/xml/XMLImporterV3.as
new file mode 100644
index 0000000..c81a982
--- /dev/null
+++ b/src/alternativa/editor/mapimport/xml/XMLImporterV3.as
@@ -0,0 +1,356 @@
+package alternativa.editor.mapimport.xml
+{
+ import alternativa.editor.LibraryManager;
+ import alternativa.editor.events.EditorProgressEvent;
+ import alternativa.editor.prop.BonusRegion;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.scene.MainScene;
+ import alternativa.types.Point3D;
+ import flash.events.Event;
+ import flash.utils.setTimeout;
+ import mx.controls.Alert;
+
+ public class XMLImporterV3 extends XMLImporterBase implements IXMLImporter
+ {
+ private static const STAGE_LOADING_MESHES:int = 1;
+
+ private static const STAGE_LOADING_SPRITES:int = 2;
+
+ private var mapXML:XML;
+
+ private var scene:MainScene;
+
+ private var libraryManager:LibraryManager;
+
+ private var propDatas:Array;
+
+ private var numMeshes:int;
+
+ private var numSprites:int;
+
+ private var loadingStage:int;
+
+ public function XMLImporterV3()
+ {
+ super();
+ }
+
+ public function importMap(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ this.mapXML = param1;
+ this.scene = param2;
+ this.libraryManager = param3;
+ param2.view.visible = false;
+ this.createPropRegistry();
+ setTimeout(this.loadMeshes,10);
+ }
+
+ public function addInternalObjectsToExistingScene(param1:XML, param2:MainScene, param3:LibraryManager) : void
+ {
+ }
+
+ private function createPropRegistry() : void
+ {
+ var loc4:XML = null;
+ var loc5:Array = null;
+ var loc6:Prop = null;
+ this.propDatas = [];
+ var loc1:XMLList = this.mapXML.elements("prop");
+ var loc2:int = int(loc1.length());
+ var loc3:int = 0;
+ while(loc3 < loc2)
+ {
+ loc4 = loc1[loc3];
+ loc5 = [loc4.attribute("library-name").toString(),loc4.attribute("group-name").toString(),loc4.attribute("name").toString()];
+ loc6 = this.libraryManager.propByKey[loc5.join("")];
+ if(loc6 == null)
+ {
+ throw new Error("Prop " + loc5.join("/") + " not found");
+ }
+ this.propDatas[loc3] = new PropData(loc6,loc4.elements("texture-name"));
+ loc3++;
+ }
+ }
+
+ private function loadMeshes() : void
+ {
+ var loc1:XMLList = this.mapXML.mesh;
+ this.numMeshes = loc1.length();
+ this.numSprites = this.mapXML.sprite.length();
+ if(this.numMeshes > 0)
+ {
+ this.loadingStage = STAGE_LOADING_MESHES;
+ startBatchExecution(200,loc1);
+ }
+ else
+ {
+ this.loadSprites();
+ }
+ }
+
+ private function loadSprites() : void
+ {
+ var loc1:XMLList = this.mapXML.sprite;
+ if(this.numSprites > 0)
+ {
+ this.loadingStage = STAGE_LOADING_SPRITES;
+ startBatchExecution(200,loc1);
+ }
+ else
+ {
+ this.completeLoading();
+ }
+ }
+
+ private function completeLoading() : void
+ {
+ try
+ {
+ this.loadBonuses(this.mapXML.elements("bonus-region"));
+ this.loadSpawns(this.mapXML.elements("spawn-point"));
+ this.loadFlags(this.mapXML.elements("ctf-flags"));
+ }
+ catch(err:Error)
+ {
+ Alert.show(err.message);
+ }
+ this.scene.view.visible = true;
+ this.mapXML = null;
+ this.scene = null;
+ this.libraryManager = null;
+ this.propDatas = null;
+ if(hasEventListener(Event.COMPLETE))
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+
+ override protected function processItem(param1:XML) : void
+ {
+ var item:XML = param1;
+ try
+ {
+ switch(this.loadingStage)
+ {
+ case STAGE_LOADING_MESHES:
+ this.processMesh(item);
+ break;
+ case STAGE_LOADING_SPRITES:
+ this.processSprite(item);
+ }
+ this.scene.calculate();
+ }
+ catch(e:Error)
+ {
+ Alert.show(e.message);
+ }
+ }
+
+ private function processMesh(param1:XML) : void
+ {
+ var textureName:String = null;
+ var tile:MeshProp = null;
+ var tName:String = null;
+ var meshXML:XML = param1;
+ var propData:PropData = this.propDatas[int(meshXML.attribute("prop-index"))];
+ var prop:Prop = propData.prop;
+ var position:Point3D = this.getPoint3DFromXML(meshXML.elements("position")[0]);
+ var rotation:Number = Number(meshXML.elements("rotation-z"));
+ prop = this.scene.addProp(prop,position,rotation,true,false);
+ var free:Boolean = meshXML.@free == "true";
+ this.scene.occupyMap.occupy(prop);
+ textureName = null;
+ if(meshXML.elements("texture-index").length() > 0)
+ {
+ textureName = propData.textureNames[int(meshXML.elements("texture-index")[0])];
+ }
+ tile = prop as MeshProp;
+ if(tile)
+ {
+ try
+ {
+ if(textureName != null)
+ {
+ tile.textureName = textureName;
+ }
+ }
+ catch(err:Error)
+ {
+ var loc4:int = 0;
+ var loc5:* = tile.bitmaps;
+ for(tName in loc5)
+ {
+ tile.textureName = tName;
+ }
+ Alert.show("Tile " + tile.name + ": texture " + textureName + " not found");
+ }
+ }
+ }
+
+ private function processSprite(param1:XML) : void
+ {
+ var loc2:PropData = this.propDatas[int(param1.attribute("prop-index"))];
+ var loc3:Prop = loc2.prop;
+ var loc4:Point3D = this.getPoint3DFromXML(param1.elements("position")[0]);
+ loc4.z += 0.1;
+ loc3 = this.scene.addProp(loc3,loc4,0,true,false);
+ var loc5:* = param1.@free == "true";
+ if(!loc5)
+ {
+ this.scene.occupyMap.occupy(loc3);
+ }
+ }
+
+ override protected function batchComplete(param1:int) : void
+ {
+ var loc2:Number = NaN;
+ switch(this.loadingStage)
+ {
+ case STAGE_LOADING_MESHES:
+ loc2 = param1 / (this.numMeshes + this.numSprites);
+ break;
+ case STAGE_LOADING_SPRITES:
+ loc2 = (this.numMeshes + param1) / (this.numMeshes + this.numSprites);
+ }
+ if(hasEventListener(EditorProgressEvent.PROGRESS))
+ {
+ dispatchEvent(new EditorProgressEvent(loc2));
+ }
+ }
+
+ override protected function batchExecutionComplete() : void
+ {
+ switch(this.loadingStage)
+ {
+ case STAGE_LOADING_MESHES:
+ this.loadSprites();
+ break;
+ case STAGE_LOADING_SPRITES:
+ this.completeLoading();
+ }
+ }
+
+ private function loadBonuses(param1:XMLList) : void
+ {
+ var loc4:XML = null;
+ var loc5:String = null;
+ var loc6:Prop = null;
+ var loc7:Point3D = null;
+ var loc8:Number = NaN;
+ var loc9:* = false;
+ var loc10:XMLList = null;
+ var loc11:int = 0;
+ var loc2:int = int(param1.length());
+ var loc3:int = 0;
+ while(loc3 < loc2)
+ {
+ loc4 = param1[loc3];
+ loc5 = "FunctionalBonus Regions" + loc4.@name.toString();
+ loc6 = this.libraryManager.propByKey[loc5];
+ if(loc6)
+ {
+ loc7 = this.getPoint3DFromXML(loc4.elements("position")[0]);
+ loc8 = Number(loc4.elements("rotation")[0]);
+ loc6 = this.scene.addProp(loc6,loc7,loc8,true,false);
+ loc9 = loc4.@free == "true";
+ if(!loc9)
+ {
+ this.scene.occupyMap.occupy(loc6);
+ }
+ loc10 = loc4.child("bonus-type");
+ BonusRegion(loc6).typeNames.clear();
+ loc11 = 0;
+ while(loc11 < loc10.length())
+ {
+ BonusRegion(loc6).typeNames.add(loc10[loc11].toString());
+ loc11++;
+ }
+ this.scene.calculate();
+ }
+ loc3++;
+ }
+ }
+
+ private function loadSpawns(param1:XMLList) : void
+ {
+ var loc4:XML = null;
+ var loc5:String = null;
+ var loc6:Prop = null;
+ var loc7:Point3D = null;
+ var loc8:Number = NaN;
+ var loc9:* = false;
+ var loc2:int = int(param1.length());
+ var loc3:int = 0;
+ while(loc3 < loc2)
+ {
+ loc4 = param1[loc3];
+ loc5 = "FunctionalSpawn Points" + loc4.@type.toString();
+ loc6 = this.libraryManager.propByKey[loc5];
+ if(loc6)
+ {
+ loc7 = this.getPoint3DFromXML(loc4.elements("position")[0]);
+ loc8 = Number(loc4.elements("direction")[0]);
+ loc6 = this.scene.addProp(loc6,loc7,loc8,true,false);
+ loc9 = loc4.@free == "true";
+ if(!loc9)
+ {
+ this.scene.occupyMap.occupy(loc6);
+ }
+ this.scene.calculate();
+ }
+ loc3++;
+ }
+ }
+
+ private function loadFlags(param1:XMLList) : void
+ {
+ if(param1.length() == 0)
+ {
+ return;
+ }
+ var loc2:XML = param1[0];
+ this.addFlag(loc2.child("flag-red")[0],"red_flag");
+ this.addFlag(loc2.child("flag-blue")[0],"blue_flag");
+ }
+
+ private function addFlag(param1:XML, param2:String) : void
+ {
+ var loc3:Prop = this.libraryManager.propByKey["FunctionalFlags" + param2];
+ if(loc3 != null)
+ {
+ loc3 = this.scene.addProp(loc3,this.getPoint3DFromXML(param1),0,true,false);
+ this.scene.calculate();
+ }
+ }
+
+ private function getPoint3DFromXML(param1:XML) : Point3D
+ {
+ return new Point3D(Number(param1.@x),Number(param1.@y),Number(param1.@z));
+ }
+ }
+}
+
+import alternativa.editor.prop.Prop;
+
+class PropData
+{
+ public var prop:Prop;
+
+ public var textureNames:Array;
+
+ public function PropData(param1:Prop, param2:XMLList)
+ {
+ var loc3:XML = null;
+ super();
+ this.prop = param1;
+ if(param2.length() > 0)
+ {
+ this.textureNames = [];
+ for each(loc3 in param2)
+ {
+ this.textureNames.push(loc3.toString());
+ }
+ }
+ }
+}
diff --git a/src/alternativa/editor/prop/BonusRegion.as b/src/alternativa/editor/prop/BonusRegion.as
new file mode 100644
index 0000000..e961d81
--- /dev/null
+++ b/src/alternativa/editor/prop/BonusRegion.as
@@ -0,0 +1,54 @@
+package alternativa.editor.prop
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.types.Set;
+
+ public class BonusRegion extends Prop
+ {
+ private var _typeNames:Set;
+
+ private var _gameModes:Set;
+
+ public function BonusRegion(param1:Object3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ this._typeNames = new Set();
+ this._gameModes = new Set();
+ super(param1,param2,param3,param4,param5);
+ this._typeNames.add(BonusTypes.types[0]);
+ this._gameModes.add(GameModes.modes[0]);
+ this._gameModes.add(GameModes.modes[1]);
+ this._gameModes.add(GameModes.modes[2]);
+ this._gameModes.add(GameModes.modes[3]);
+ }
+
+ public function get typeNames() : Set
+ {
+ return this._typeNames;
+ }
+
+ public function get gameModes() : Set
+ {
+ return this._gameModes;
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc2:BonusRegion = null;
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ loc2 = new BonusRegion(loc1,name,_libraryName,_groupName,false);
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2._multi = _multi;
+ loc2.name = name;
+ loc2._typeNames = this._typeNames.clone();
+ loc2._gameModes = this._gameModes.clone();
+ loc2.height = height;
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/CTFFlagBase.as b/src/alternativa/editor/prop/CTFFlagBase.as
new file mode 100644
index 0000000..cd970f7
--- /dev/null
+++ b/src/alternativa/editor/prop/CTFFlagBase.as
@@ -0,0 +1,40 @@
+package alternativa.editor.prop
+{
+ import alternativa.editor.scene.EditorScene;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import flash.geom.Point;
+
+ public class CTFFlagBase extends Prop
+ {
+ public function CTFFlagBase(param1:Object3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ super(param1,param2,param3,param4,param5);
+ type = Prop.FLAG;
+ }
+
+ override public function calculate() : void
+ {
+ distancesX = new Point(-EditorScene.hBase,EditorScene.hBase);
+ distancesY = new Point(-EditorScene.hBase,EditorScene.hBase);
+ distancesZ = new Point(0,EditorScene.vBase);
+ height = -1;
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ var loc2:CTFFlagBase = new CTFFlagBase(loc1,name,_libraryName,_groupName,false);
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2._multi = _multi;
+ loc2.name = name;
+ loc2.height = height;
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/ControlPoint.as b/src/alternativa/editor/prop/ControlPoint.as
new file mode 100644
index 0000000..3c06c07
--- /dev/null
+++ b/src/alternativa/editor/prop/ControlPoint.as
@@ -0,0 +1,96 @@
+package alternativa.editor.prop
+{
+ import alternativa.editor.events.DominationSpawnLinkEndEvent;
+ import alternativa.editor.scene.EditorScene;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.events.MouseEvent3D;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import flash.geom.Point;
+ import flash.utils.Dictionary;
+
+ public class ControlPoint extends Prop
+ {
+ public var controlPointName:String;
+
+ public var spawnPoints:Dictionary;
+
+ public function ControlPoint(param1:Object3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ this.spawnPoints = new Dictionary();
+ super(param1,param2,param3,param4,param5);
+ type = Prop.DOMINATION_CONTROL_POINT;
+ }
+
+ public function addSpawnPoint(param1:SpawnPoint) : void
+ {
+ this.spawnPoints[param1] = true;
+ param1.data = this;
+ }
+
+ public function removeSpawnPoint(param1:SpawnPoint) : void
+ {
+ if(this.spawnPoints[param1] != null)
+ {
+ delete this.spawnPoints[param1];
+ param1.data = null;
+ }
+ }
+
+ public function getSpawnPoints() : Vector.
+ {
+ var loc2:* = undefined;
+ var loc1:Vector. = new Vector.();
+ for(loc2 in this.spawnPoints)
+ {
+ loc1.push(loc2);
+ }
+ return loc1;
+ }
+
+ public function unlinkSpawnPoints() : void
+ {
+ var loc1:* = undefined;
+ for(loc1 in this.spawnPoints)
+ {
+ this.removeSpawnPoint(loc1);
+ }
+ }
+
+ override public function calculate() : void
+ {
+ distancesX = new Point(-EditorScene.hBase,EditorScene.hBase);
+ distancesY = new Point(-EditorScene.hBase,EditorScene.hBase);
+ distancesZ = new Point(0,EditorScene.vBase);
+ height = -1;
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ var loc2:ControlPoint = new ControlPoint(loc1,name,_libraryName,_groupName,false);
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2._multi = _multi;
+ loc2.name = name;
+ loc2.height = height;
+ return loc2;
+ }
+
+ override public function onAddedToScene() : void
+ {
+ addEventListener(MouseEvent3D.CLICK,this.onMouseClick);
+ }
+
+ private function onMouseClick(param1:MouseEvent3D) : void
+ {
+ if(param1.ctrlKey)
+ {
+ GlobalEventDispatcher.dispatch(new DominationSpawnLinkEndEvent(this));
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/CustomFillMaterial.as b/src/alternativa/editor/prop/CustomFillMaterial.as
new file mode 100644
index 0000000..7e12f94
--- /dev/null
+++ b/src/alternativa/editor/prop/CustomFillMaterial.as
@@ -0,0 +1,57 @@
+package alternativa.editor.prop
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.PolyPrimitive;
+ import alternativa.engine3d.display.Skin;
+ import alternativa.engine3d.materials.FillMaterial;
+ import alternativa.engine3d.materials.Material;
+ import alternativa.types.Point3D;
+ import alternativa.utils.ColorUtils;
+
+ use namespace alternativa3d;
+
+ public class CustomFillMaterial extends FillMaterial
+ {
+ private var center:Point3D;
+
+ private var lightPoint:Point3D;
+
+ private var normal:Point3D;
+
+ public function CustomFillMaterial(param1:Point3D, param2:uint, param3:Number = 1, param4:String = "normal", param5:Number = -1, param6:uint = 0)
+ {
+ this.center = new Point3D();
+ this.lightPoint = new Point3D();
+ this.normal = new Point3D();
+ super(param2,param3,param4,param5,param6);
+ this.lightPoint.copy(param1);
+ }
+
+ override alternativa3d function draw(param1:Camera3D, param2:Skin, param3:uint, param4:Array) : void
+ {
+ var loc5:PolyPrimitive = param2.alternativa3d::primitive;
+ this.center.reset();
+ var loc6:int = 0;
+ while(loc6 < loc5.alternativa3d::num)
+ {
+ this.center.add(loc5.alternativa3d::points[loc6]);
+ loc6++;
+ }
+ this.center.multiply(1 / loc5.alternativa3d::num);
+ this.normal.difference(this.lightPoint,this.center);
+ this.normal.normalize();
+ var loc7:uint = uint(alternativa3d::_color);
+ var loc8:Number = 0.5 * (1 + this.normal.dot(loc5.alternativa3d::face.alternativa3d::globalNormal));
+ alternativa3d::_color = ColorUtils.multiply(alternativa3d::_color,loc8);
+ super.alternativa3d::draw(param1,param2,param3,param4);
+ alternativa3d::_color = loc7;
+ }
+
+ override public function clone() : Material
+ {
+ return new CustomFillMaterial(this.lightPoint,color,alpha,blendMode,wireThickness,wireColor);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/FreeBonusRegion.as b/src/alternativa/editor/prop/FreeBonusRegion.as
new file mode 100644
index 0000000..e7103b3
--- /dev/null
+++ b/src/alternativa/editor/prop/FreeBonusRegion.as
@@ -0,0 +1,252 @@
+package alternativa.editor.prop
+{
+ import alternativa.editor.scene.MainScene;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.materials.Material;
+ import alternativa.engine3d.materials.SurfaceMaterial;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.engine3d.primitives.Box;
+ import alternativa.engine3d.primitives.Plane;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.types.Texture;
+ import flash.display.BitmapData;
+ import flash.display.BlendMode;
+
+ public class FreeBonusRegion extends Prop
+ {
+ private static const BASE_WIDTH:Number = 500;
+
+ private static const BASE_LENGTH:Number = 500;
+
+ private static const BASE_HEIGHT:Number = 300;
+
+ private static const texture:Texture = new Texture(new BitmapData(1,1,false,16756224));
+
+ private var _typeNames:Set;
+
+ private var _gameModes:Set;
+
+ public var parachute:Boolean = true;
+
+ private var BOX_SIZE:int = 0;
+
+ private var shadow:Plane;
+
+ public function FreeBonusRegion(param1:String, param2:String, param3:String, param4:Boolean = true)
+ {
+ this._typeNames = new Set();
+ this._gameModes = new Set();
+ this._typeNames.add(BonusTypes.types[0]);
+ this._gameModes.add(GameModes.modes[0]);
+ this._gameModes.add(GameModes.modes[1]);
+ this._gameModes.add(GameModes.modes[2]);
+ this._gameModes.add(GameModes.modes[3]);
+ var loc5:Box = new Box(BASE_WIDTH,BASE_LENGTH,BASE_HEIGHT);
+ loc5.x = BASE_WIDTH / 2;
+ loc5.y = BASE_LENGTH / 2;
+ loc5.z = BASE_HEIGHT / 2;
+ _material = new TextureMaterial(texture,0.5,true,false,BlendMode.MULTIPLY);
+ loc5.cloneMaterialToAllSurfaces(SurfaceMaterial(_material));
+ _object = loc5;
+ super(object,param1,param2,param3,param4);
+ type = Prop.BONUS;
+ this.showDestinationArea();
+ }
+
+ public function get typeNames() : Set
+ {
+ return this._typeNames;
+ }
+
+ public function get gameModes() : Set
+ {
+ return this._gameModes;
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ var loc2:FreeBonusRegion = new FreeBonusRegion(name,_libraryName,_groupName,false);
+ loc2.scaleX = scaleX;
+ loc2.scaleY = scaleY;
+ loc2.scaleZ = scaleZ;
+ loc2.z = z;
+ loc2._typeNames = this._typeNames.clone();
+ loc2._gameModes = this._gameModes.clone();
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2.name = name;
+ loc2.height = height;
+ return loc2;
+ }
+
+ public function showDestinationArea() : void
+ {
+ if(Boolean(this.shadow) && children.has(this.shadow))
+ {
+ removeChild(this.shadow);
+ }
+ var loc1:Point3D = MainScene.getProjectedPoint(new Point3D(x + scaleX * BASE_WIDTH / 2,y + scaleY * BASE_LENGTH / 2,z - 50));
+ globalToLocal(loc1,loc1);
+ var loc2:Number = BASE_WIDTH * scaleX + this.BOX_SIZE;
+ var loc3:Number = BASE_LENGTH * scaleY + this.BOX_SIZE;
+ this.shadow = new Plane(loc2,loc3);
+ this.shadow.mouseEnabled = false;
+ var loc4:TextureMaterial = new TextureMaterial(texture);
+ loc4.alpha = 0.5;
+ this.shadow.cloneMaterialToAllSurfaces(loc4);
+ this.shadow.scaleX /= scaleX;
+ this.shadow.scaleY /= scaleY;
+ this.shadow.x = BASE_WIDTH / 2;
+ this.shadow.y = BASE_LENGTH / 2;
+ this.shadow.z = loc1.z + 3;
+ addChild(this.shadow);
+ }
+
+ override public function setMaterial(param1:Material) : void
+ {
+ var loc2:SurfaceMaterial = param1 as SurfaceMaterial;
+ (_object as Mesh).cloneMaterialToAllSurfaces(loc2);
+ (this.shadow as Mesh).cloneMaterialToAllSurfaces(loc2);
+ }
+
+ override public function get rotationX() : Number
+ {
+ return super.rotationX;
+ }
+
+ override public function get rotationY() : Number
+ {
+ return super.rotationY;
+ }
+
+ override public function get rotationZ() : Number
+ {
+ return super.rotationZ;
+ }
+
+ override public function set rotationX(param1:Number) : void
+ {
+ }
+
+ override public function set rotationY(param1:Number) : void
+ {
+ }
+
+ override public function set rotationZ(param1:Number) : void
+ {
+ var loc2:Number = NaN;
+ if(Math.abs(param1 - this.rotationZ) < 0.0001)
+ {
+ return;
+ }
+ if(Math.abs(this.rotationZ - param1) % (Math.PI / 2) < 0.0001)
+ {
+ loc2 = scaleX;
+ this.scaleX = scaleY;
+ this.scaleY = loc2;
+ }
+ }
+
+ public function get minX() : Number
+ {
+ return x;
+ }
+
+ public function set minX(param1:Number) : void
+ {
+ this.x = param1;
+ }
+
+ public function get minY() : Number
+ {
+ return y;
+ }
+
+ public function set minY(param1:Number) : void
+ {
+ this.y = param1;
+ }
+
+ public function get minZ() : Number
+ {
+ return z;
+ }
+
+ public function set minZ(param1:Number) : void
+ {
+ this.z = param1;
+ }
+
+ override public function set x(param1:Number) : void
+ {
+ super.x = param1;
+ this.showDestinationArea();
+ }
+
+ override public function set y(param1:Number) : void
+ {
+ super.y = param1;
+ this.showDestinationArea();
+ }
+
+ override public function set z(param1:Number) : void
+ {
+ super.z = param1;
+ this.showDestinationArea();
+ }
+
+ public function get maxx() : Number
+ {
+ return x + BASE_WIDTH * scaleX;
+ }
+
+ public function set maxx(param1:Number) : void
+ {
+ this.scaleX = (param1 - x) / BASE_WIDTH;
+ }
+
+ public function get maxy() : Number
+ {
+ return y + BASE_LENGTH * scaleY;
+ }
+
+ public function set maxy(param1:Number) : void
+ {
+ this.scaleY = (param1 - y) / BASE_LENGTH;
+ }
+
+ public function get maxz() : Number
+ {
+ return z + BASE_HEIGHT * scaleZ;
+ }
+
+ public function set maxz(param1:Number) : void
+ {
+ this.scaleZ = (param1 - z) / BASE_HEIGHT;
+ }
+
+ override public function set scaleX(param1:Number) : void
+ {
+ super.scaleX = param1;
+ this.showDestinationArea();
+ }
+
+ override public function set scaleY(param1:Number) : void
+ {
+ super.scaleY = param1;
+ this.showDestinationArea();
+ }
+
+ override public function set scaleZ(param1:Number) : void
+ {
+ super.scaleZ = param1;
+ this.showDestinationArea();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/KillBox.as b/src/alternativa/editor/prop/KillBox.as
new file mode 100644
index 0000000..bd05427
--- /dev/null
+++ b/src/alternativa/editor/prop/KillBox.as
@@ -0,0 +1,162 @@
+package alternativa.editor.prop
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.engine3d.primitives.Box;
+ import alternativa.types.Texture;
+ import flash.display.BitmapData;
+ import mx.collections.ArrayCollection;
+
+ public class KillBox extends Prop
+ {
+ public static const KILL:String = "kill";
+
+ public static const KICK:String = "kick";
+
+ public static const BLOCK:String = "block";
+
+ private static const BASE_WIDTH:Number = 500;
+
+ private static const BASE_LENGTH:Number = 500;
+
+ private static const BASE_HEIGHT:Number = 300;
+
+ private static const texture:Texture = new Texture(new BitmapData(1,1,false,15732981));
+
+ public static const typesProvider:ArrayCollection = new ArrayCollection([KICK,KILL,BLOCK]);
+
+ public var action:String = "kill";
+
+ public function KillBox(param1:String, param2:String, param3:String, param4:Boolean = true)
+ {
+ var loc5:Box = new Box(BASE_WIDTH,BASE_LENGTH,BASE_HEIGHT);
+ loc5.x = BASE_WIDTH / 2;
+ loc5.y = BASE_LENGTH / 2;
+ loc5.z = BASE_HEIGHT / 2;
+ _object = loc5;
+ var loc6:TextureMaterial = new TextureMaterial(texture);
+ loc6.alpha = 0.5;
+ loc5.cloneMaterialToAllSurfaces(loc6);
+ super(object,param1,param2,param3,param4);
+ type = Prop.KILL_GEOMETRY;
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ var loc2:KillBox = new KillBox(name,_libraryName,_groupName,false);
+ loc2.action = this.action;
+ loc2.scaleX = scaleX;
+ loc2.scaleY = scaleY;
+ loc2.scaleZ = scaleZ;
+ loc2.z = z;
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2.name = name;
+ loc2.height = height;
+ return loc2;
+ }
+
+ override public function get rotationX() : Number
+ {
+ return super.rotationX;
+ }
+
+ override public function get rotationY() : Number
+ {
+ return super.rotationY;
+ }
+
+ override public function get rotationZ() : Number
+ {
+ return super.rotationZ;
+ }
+
+ override public function set rotationX(param1:Number) : void
+ {
+ }
+
+ override public function set rotationY(param1:Number) : void
+ {
+ }
+
+ override public function set rotationZ(param1:Number) : void
+ {
+ var loc2:Number = NaN;
+ if(Math.abs(param1 - this.rotationZ) < 0.0001)
+ {
+ return;
+ }
+ if(Math.abs(this.rotationZ - param1) % (Math.PI / 2) < 0.0001)
+ {
+ loc2 = scaleX;
+ scaleX = scaleY;
+ scaleY = loc2;
+ }
+ }
+
+ public function get minX() : Number
+ {
+ return x;
+ }
+
+ public function set minX(param1:Number) : void
+ {
+ x = param1;
+ }
+
+ public function get minY() : Number
+ {
+ return y;
+ }
+
+ public function set minY(param1:Number) : void
+ {
+ y = param1;
+ }
+
+ public function get minZ() : Number
+ {
+ return z;
+ }
+
+ public function set minZ(param1:Number) : void
+ {
+ z = param1;
+ }
+
+ public function get maxx() : Number
+ {
+ return x + BASE_WIDTH * scaleX;
+ }
+
+ public function set maxx(param1:Number) : void
+ {
+ scaleX = (param1 - x) / BASE_WIDTH;
+ }
+
+ public function get maxy() : Number
+ {
+ return y + BASE_LENGTH * scaleY;
+ }
+
+ public function set maxy(param1:Number) : void
+ {
+ scaleY = (param1 - y) / BASE_LENGTH;
+ }
+
+ public function get maxz() : Number
+ {
+ return z + BASE_HEIGHT * scaleZ;
+ }
+
+ public function set maxz(param1:Number) : void
+ {
+ scaleZ = (param1 - z) / BASE_HEIGHT;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/MeshProp.as b/src/alternativa/editor/prop/MeshProp.as
new file mode 100644
index 0000000..f4e9341
--- /dev/null
+++ b/src/alternativa/editor/prop/MeshProp.as
@@ -0,0 +1,207 @@
+package alternativa.editor.prop
+{
+ import alternativa.editor.InvisibleTexture;
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.engine3d.materials.WireMaterial;
+ import alternativa.types.Map;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.types.Texture;
+ import flash.display.BitmapData;
+ import flash.geom.Matrix;
+ import mx.controls.Alert;
+
+ use namespace alternativa3d;
+
+ public class MeshProp extends Prop
+ {
+ public var bitmaps:Map;
+
+ protected var _textureName:String = "";
+
+ private var collisionMaterial:CustomFillMaterial;
+
+ private var _isMirror:Boolean = false;
+
+ private var collisionBoxes:Set;
+
+ private var bound:Mesh;
+
+ public function MeshProp(param1:Object3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ super(param1,param2,param3,param4,param5);
+ type = Prop.TILE;
+ this.parseCollisionData(param1);
+ }
+
+ private static function getMirrorBitmapData(param1:BitmapData) : BitmapData
+ {
+ var loc2:BitmapData = new BitmapData(param1.width,param1.height);
+ loc2.draw(param1,new Matrix(-1,0,0,1,param1.width,0));
+ return loc2;
+ }
+
+ private function parseCollisionData(param1:Object3D) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Mesh = null;
+ this.collisionBoxes = new Set();
+ for(loc2 in param1.children)
+ {
+ loc3 = loc2 as Mesh;
+ if(loc3)
+ {
+ loc3.cloneMaterialToAllSurfaces(null);
+ if(loc3.name.substr(0,3) != "occ")
+ {
+ this.collisionBoxes.add(loc3);
+ }
+ }
+ else
+ {
+ Alert.show(param1.name + " include invalid collision mesh " + Object3D(loc2).name);
+ }
+ }
+ this.collisionMaterial = new CustomFillMaterial(new Point3D(-10000000000,-7000000000,4000000000),16744319);
+ }
+
+ public function showCollisionBoxes() : void
+ {
+ var loc1:* = undefined;
+ var loc2:Mesh = null;
+ for(loc1 in this.collisionBoxes)
+ {
+ loc2 = loc1 as Mesh;
+ loc2.cloneMaterialToAllSurfaces(this.collisionMaterial);
+ }
+ setMaterial(null);
+ }
+
+ public function hideCollisionBoxes() : void
+ {
+ var loc1:* = undefined;
+ var loc2:Mesh = null;
+ for(loc1 in this.collisionBoxes)
+ {
+ loc2 = loc1 as Mesh;
+ loc2.cloneMaterialToAllSurfaces(null);
+ }
+ setMaterial(_material);
+ }
+
+ public function get collisionGeometry() : Set
+ {
+ return this.collisionBoxes;
+ }
+
+ public function get textureName() : String
+ {
+ return this._textureName;
+ }
+
+ public function set textureName(param1:String) : void
+ {
+ this._textureName = param1;
+ if(this._textureName == InvisibleTexture.TEXTURE_NAME)
+ {
+ bitmapData = InvisibleTexture.invisibleTexture.bitmapData;
+ }
+ else
+ {
+ bitmapData = this._isMirror ? getMirrorBitmapData(this.bitmaps[param1]) : this.bitmaps[param1];
+ }
+ _material = new TextureMaterial(new Texture(bitmapData));
+ if(_selected)
+ {
+ _selectBitmapData.dispose();
+ select();
+ }
+ else
+ {
+ setMaterial(_material);
+ }
+ if(this._textureName == "DEFAULT")
+ {
+ this._textureName = "";
+ }
+ }
+
+ public function mirrorTexture() : void
+ {
+ this._isMirror = !this._isMirror;
+ bitmapData = getMirrorBitmapData(bitmapData);
+ (_material as TextureMaterial).texture = new Texture(bitmapData);
+ if(selected)
+ {
+ _selectBitmapData.dispose();
+ select();
+ }
+ else
+ {
+ setMaterial(_material);
+ }
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ var loc2:MeshProp = new MeshProp(loc1,name,_libraryName,_groupName,false);
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2._multi = _multi;
+ loc2.name = name;
+ loc2.bitmaps = this.bitmaps;
+ loc2._textureName = this._textureName;
+ loc2.height = height;
+ return loc2;
+ }
+
+ public function showBound() : void
+ {
+ var loc1:Matrix3D = null;
+ var loc2:Point3D = null;
+ var loc3:Point3D = null;
+ var loc4:Point3D = null;
+ var loc5:Point3D = null;
+ var loc6:Surface = null;
+ if(!this.bound)
+ {
+ this.bound = new Mesh();
+ loc1 = this.transformation;
+ loc1.invert();
+ loc2 = new Point3D(distancesX.y + x,distancesY.x + y,z);
+ loc3 = new Point3D(distancesX.y + x,distancesY.y + y,z);
+ loc4 = new Point3D(distancesX.x + x,distancesY.y + y,z);
+ loc5 = new Point3D(distancesX.x + x,distancesY.x + y,z);
+ loc5.transform(loc1);
+ loc4.transform(loc1);
+ loc3.transform(loc1);
+ loc2.transform(loc1);
+ this.bound.createFace([this.bound.createVertex(loc2.x,loc2.y,loc2.z,3),this.bound.createVertex(loc3.x,loc3.y,loc3.z,2),this.bound.createVertex(loc4.x,loc4.y,loc4.z,1),this.bound.createVertex(loc5.x,loc5.y,loc5.z,0)],0);
+ loc6 = this.bound.createSurface([0],0);
+ loc6.material = new WireMaterial(4,255);
+ addChild(this.bound);
+ this.bound.z = 0.1;
+ this.bound.mobility = -100;
+ this.bound.mouseEnabled = false;
+ }
+ }
+
+ public function hideBound() : void
+ {
+ if(this.bound)
+ {
+ removeChild(this.bound);
+ this.bound = null;
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/Prop.as b/src/alternativa/editor/prop/Prop.as
new file mode 100644
index 0000000..9468d8d
--- /dev/null
+++ b/src/alternativa/editor/prop/Prop.as
@@ -0,0 +1,418 @@
+package alternativa.editor.prop
+{
+ import alternativa.editor.scene.EditorScene;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.events.MouseEvent3D;
+ import alternativa.engine3d.materials.Material;
+ import alternativa.engine3d.materials.SurfaceMaterial;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.types.Map;
+ import alternativa.types.Point3D;
+ import alternativa.types.Texture;
+ import alternativa.utils.MathUtils;
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.display.BlendMode;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+
+ public class Prop extends Object3D
+ {
+ public static const TILE:int = 1;
+
+ public static const SPAWN:int = 2;
+
+ public static const BONUS:int = 3;
+
+ public static const FLAG:int = 4;
+
+ public static const DOMINATION_CONTROL_POINT:int = 5;
+
+ public static const KILL_GEOMETRY:int = 6;
+
+ private static const matrix:Matrix = new Matrix();
+
+ private static var redClass:Class = Prop_redClass;
+
+ private static const redBmp:BitmapData = new redClass().bitmapData;
+
+ public var type:int = 3;
+
+ protected var _object:Object3D;
+
+ protected var _groupName:String;
+
+ protected var _libraryName:String;
+
+ public var distancesX:Point;
+
+ public var distancesY:Point;
+
+ public var distancesZ:Point;
+
+ public var _multi:Boolean = false;
+
+ public var free:Boolean = true;
+
+ protected var _material:Material;
+
+ public var bitmapData:BitmapData;
+
+ protected var _selectBitmapData:BitmapData;
+
+ public var icon:Bitmap;
+
+ protected var _selected:Boolean = false;
+
+ private var _hidden:Boolean;
+
+ public var height:int;
+
+ public var data:*;
+
+ public function Prop(param1:Object3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ super(param2);
+ addChild(param1);
+ this._object = param1;
+ this._object.addEventListener(MouseEvent3D.MOUSE_DOWN,this.onMouseDown);
+ this._libraryName = param3;
+ this._groupName = param4;
+ this.initBitmapData();
+ if(param5)
+ {
+ this.calculate();
+ }
+ }
+
+ private static function calcDistance(param1:Number, param2:Number, param3:Number, param4:Number) : Point
+ {
+ var loc5:Point = new Point();
+ param3 = floorTo(param3,param4);
+ param2 = floorTo(param2,param4);
+ if(param3 == 0 && param2 == 0)
+ {
+ loc5.x = 0;
+ loc5.y = param4;
+ }
+ else if(param3 > param2)
+ {
+ if(param2 == 0)
+ {
+ loc5.x = 0;
+ loc5.y = int(param3 - param1);
+ }
+ else
+ {
+ loc5.x = int(param2 - param1);
+ loc5.y = int(param3 - param1);
+ }
+ }
+ else if(param3 == 0)
+ {
+ loc5.x = 0;
+ loc5.y = int(param2 - param1);
+ }
+ else
+ {
+ loc5.x = int(param3 - param1);
+ loc5.y = int(param2 - param1);
+ }
+ return loc5;
+ }
+
+ public static function floorTo(param1:Number, param2:Number) : Number
+ {
+ return Math.floor(param1 / param2) * param2;
+ }
+
+ public static function ceilTo(param1:Number, param2:Number) : Number
+ {
+ return Math.ceil(param1 / param2) * param2;
+ }
+
+ public static function roundTo(param1:Number, param2:Number) : Number
+ {
+ return Math.round((param1 + param2 / 2) / param2) * param2;
+ }
+
+ public function get object() : Object3D
+ {
+ return this._object;
+ }
+
+ private function onMouseDown(param1:MouseEvent3D) : void
+ {
+ param1.object = this;
+ }
+
+ protected function initBitmapData() : void
+ {
+ this._material = Mesh(this._object).surfaces.peek().material;
+ this.bitmapData = TextureMaterial(this._material).texture.bitmapData;
+ }
+
+ public function calculate() : void
+ {
+ var loc13:Point3D = null;
+ var loc14:int = 0;
+ var loc15:Point3D = null;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc1:Array = (this._object as Mesh).vertices.toArray(true);
+ var loc2:Number = 0;
+ var loc3:Number = 0;
+ var loc4:Number = 0;
+ var loc5:Number = 0;
+ var loc6:Number = 0;
+ var loc7:Number = 0;
+ var loc8:Number = 0;
+ var loc9:Number = 0;
+ var loc10:Number = 0;
+ var loc11:int = int(loc1.length);
+ var loc12:int = 0;
+ while(loc12 < loc11)
+ {
+ loc13 = loc1[loc12].coords;
+ if(scene)
+ {
+ loc13 = localToGlobal(loc13);
+ }
+ loc14 = loc12 + 1;
+ while(loc14 < loc11)
+ {
+ loc15 = loc1[loc14].coords;
+ if(scene)
+ {
+ loc15 = localToGlobal(loc15);
+ }
+ loc16 = loc13.x - loc15.x;
+ loc17 = loc13.y - loc15.y;
+ loc18 = loc13.z - loc15.z;
+ loc19 = loc16 * loc16;
+ loc20 = loc17 * loc17;
+ loc21 = loc18 * loc18;
+ if(loc19 > loc4)
+ {
+ loc4 = loc19;
+ loc9 = loc13.x;
+ loc10 = loc15.x;
+ }
+ if(loc20 > loc3)
+ {
+ loc3 = loc20;
+ loc7 = loc13.y;
+ loc8 = loc15.y;
+ }
+ if(loc21 > loc2)
+ {
+ loc2 = loc21;
+ loc5 = loc13.z;
+ loc6 = loc15.z;
+ }
+ loc14++;
+ }
+ loc12++;
+ }
+ this.height = Math.sqrt(loc2);
+ this.distancesX = calcDistance(x,int(loc9),int(loc10),EditorScene.hBase);
+ this.distancesY = calcDistance(y,int(loc7),int(loc8),EditorScene.hBase);
+ this.distancesZ = calcDistance(z,int(loc5),int(loc6),EditorScene.vBase);
+ if(Math.abs(int(loc10) - int(loc9)) / EditorScene.hBase2 > 1 || Math.abs(int(loc7) - int(loc8)) / EditorScene.hBase2 > 1)
+ {
+ this._multi = true;
+ }
+ if(!scene)
+ {
+ if(this._multi)
+ {
+ this.checkRemainder(loc9,"x",500);
+ this.checkRemainder(loc10,"x",500);
+ this.checkRemainder(loc7,"y",500);
+ this.checkRemainder(loc8,"y",500);
+ }
+ else
+ {
+ if(Math.abs(loc9) - 250 > 0.01)
+ {
+ ErrorHandler.addText("Prop" + this + "is out of size along x:" + loc9);
+ ErrorHandler.showWindow();
+ }
+ if(Math.abs(loc10) - 250 > 0.01)
+ {
+ ErrorHandler.addText("Prop" + this + "is out of size along x:" + loc10);
+ ErrorHandler.showWindow();
+ }
+ if(Math.abs(loc7) - 250 > 0.01)
+ {
+ ErrorHandler.addText("Prop" + this + "is out of size along y:" + loc7);
+ ErrorHandler.showWindow();
+ }
+ if(Math.abs(loc8) - 250 > 0.01)
+ {
+ ErrorHandler.addText("Prop" + this + "is out of size along y:" + loc8);
+ ErrorHandler.showWindow();
+ }
+ }
+ }
+ }
+
+ private function checkRemainder(param1:Number, param2:String, param3:Number) : void
+ {
+ var loc4:Number = Math.abs(param1 % 500);
+ if(loc4 > 0.01 && loc4 < 5)
+ {
+ ErrorHandler.addText(loc4 + "Prop" + this + "is out of size along " + param2 + " " + param1);
+ ErrorHandler.showWindow();
+ }
+ }
+
+ public function select() : void
+ {
+ this._selectBitmapData = this.bitmapData.clone();
+ matrix.a = this.bitmapData.width / redBmp.width;
+ matrix.d = matrix.a;
+ this._selectBitmapData.draw(redBmp,matrix,null,BlendMode.MULTIPLY);
+ this.setMaterial(this.newSelectedMaterial);
+ this._selected = true;
+ }
+
+ public function deselect() : void
+ {
+ this._selectBitmapData.dispose();
+ if(this._hidden)
+ {
+ this.setMaterial(null);
+ }
+ else
+ {
+ this.setMaterial(this._material);
+ }
+ this._selected = false;
+ }
+
+ protected function get newSelectedMaterial() : Material
+ {
+ return new TextureMaterial(new Texture(this._selectBitmapData));
+ }
+
+ public function setMaterial(param1:Material) : void
+ {
+ var loc2:SurfaceMaterial = param1 as SurfaceMaterial;
+ (this._object as Mesh).cloneMaterialToAllSurfaces(loc2);
+ }
+
+ public function hide() : void
+ {
+ this.setMaterial(null);
+ this._hidden = true;
+ }
+
+ public function show() : void
+ {
+ this.setMaterial(this._material);
+ this._hidden = false;
+ }
+
+ public function get hidden() : Boolean
+ {
+ return this._hidden;
+ }
+
+ public function get multi() : Boolean
+ {
+ return this._multi;
+ }
+
+ public function get libraryName() : String
+ {
+ return this._libraryName;
+ }
+
+ public function get selected() : Boolean
+ {
+ return this._selected;
+ }
+
+ public function get groupName() : String
+ {
+ return this._groupName;
+ }
+
+ public function get vertices() : Map
+ {
+ return (this._object as Mesh).vertices;
+ }
+
+ public function get material() : Material
+ {
+ return this._material;
+ }
+
+ public function rotateCounterClockwise() : void
+ {
+ var loc1:Point = new Point(this.distancesY.x,this.distancesY.y);
+ this.distancesY.x = this.distancesX.x;
+ this.distancesY.y = this.distancesX.y;
+ this.distancesX.x = -loc1.y;
+ this.distancesX.y = -loc1.x;
+ rotationZ += MathUtils.DEG90;
+ }
+
+ public function rotateClockwise() : void
+ {
+ var loc1:Point = new Point(this.distancesX.x,this.distancesX.y);
+ this.distancesX.x = this.distancesY.x;
+ this.distancesX.y = this.distancesY.y;
+ this.distancesY.x = -loc1.y;
+ this.distancesY.y = -loc1.x;
+ rotationZ -= MathUtils.DEG90;
+ }
+
+ override public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
+ {
+ this._object.addEventListener(param1,param2);
+ }
+
+ override public function clone() : Object3D
+ {
+ throw new Error("Abstract method");
+ }
+
+ public function snapToGrid() : void
+ {
+ if(EditorScene.snapByHalf)
+ {
+ x = floorTo(x,EditorScene.HORIZONTAL_GRID_RESOLUTION_2);
+ y = floorTo(y,EditorScene.HORIZONTAL_GRID_RESOLUTION_2);
+ z = floorTo(z,EditorScene.VERTICAL_GRID_RESOLUTION_2);
+ }
+ else
+ {
+ if(!this._multi)
+ {
+ x -= EditorScene.HORIZONTAL_GRID_RESOLUTION_2;
+ y -= EditorScene.HORIZONTAL_GRID_RESOLUTION_2;
+ }
+ x = ceilTo(x,EditorScene.HORIZONTAL_GRID_RESOLUTION_1);
+ y = ceilTo(y,EditorScene.HORIZONTAL_GRID_RESOLUTION_1);
+ z = floorTo(z,EditorScene.VERTICAL_GRID_RESOLUTION_1);
+ if(!this._multi)
+ {
+ x += EditorScene.HORIZONTAL_GRID_RESOLUTION_2;
+ y += EditorScene.HORIZONTAL_GRID_RESOLUTION_2;
+ }
+ }
+ }
+
+ public function onAddedToScene() : void
+ {
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/Prop_redClass.as b/src/alternativa/editor/prop/Prop_redClass.as
new file mode 100644
index 0000000..7f983a6
--- /dev/null
+++ b/src/alternativa/editor/prop/Prop_redClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor.prop
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/73.jpg")]
+ public class Prop_redClass extends BitmapAsset
+ {
+ public function Prop_redClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/SpawnPoint.as b/src/alternativa/editor/prop/SpawnPoint.as
new file mode 100644
index 0000000..60bab98
--- /dev/null
+++ b/src/alternativa/editor/prop/SpawnPoint.as
@@ -0,0 +1,71 @@
+package alternativa.editor.prop
+{
+ import alternativa.editor.FunctionalProps;
+ import alternativa.editor.events.DominationSpawnLinkStartEvent;
+ import alternativa.editor.scene.EditorScene;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.events.MouseEvent3D;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.utils.MathUtils;
+ import flash.geom.Point;
+
+ public class SpawnPoint extends Prop
+ {
+ public function SpawnPoint(param1:Object3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ super(param1,param2,param3,param4,param5);
+ type = Prop.SPAWN;
+ }
+
+ override public function calculate() : void
+ {
+ distancesX = new Point(-EditorScene.hBase,EditorScene.hBase);
+ distancesY = new Point(-EditorScene.hBase,EditorScene.hBase);
+ distancesZ = new Point(0,EditorScene.vBase);
+ height = -1;
+ }
+
+ override public function rotateCounterClockwise() : void
+ {
+ rotationZ += MathUtils.DEG5;
+ }
+
+ override public function rotateClockwise() : void
+ {
+ rotationZ -= MathUtils.DEG5;
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc2:SpawnPoint = null;
+ var loc1:Mesh = _object.clone() as Mesh;
+ loc1.cloneMaterialToAllSurfaces(_material as TextureMaterial);
+ loc2 = new SpawnPoint(loc1,name,_libraryName,_groupName,false);
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2._multi = _multi;
+ loc2.name = name;
+ loc2.height = height;
+ return loc2;
+ }
+
+ override public function onAddedToScene() : void
+ {
+ if(_groupName == FunctionalProps.GRP_DOMINATION)
+ {
+ addEventListener(MouseEvent3D.CLICK,this.onMouseClick);
+ }
+ }
+
+ private function onMouseClick(param1:MouseEvent3D) : void
+ {
+ if(param1.ctrlKey && name == FunctionalProps.DOMINATION_SPAWN)
+ {
+ GlobalEventDispatcher.dispatch(new DominationSpawnLinkStartEvent(this));
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/prop/Sprite3DProp.as b/src/alternativa/editor/prop/Sprite3DProp.as
new file mode 100644
index 0000000..2d4b20a
--- /dev/null
+++ b/src/alternativa/editor/prop/Sprite3DProp.as
@@ -0,0 +1,82 @@
+package alternativa.editor.prop
+{
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Sprite3D;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.engine3d.materials.Material;
+ import alternativa.engine3d.materials.SpriteTextureMaterial;
+ import alternativa.types.Map;
+ import alternativa.types.Texture;
+ import flash.geom.Point;
+
+ public class Sprite3DProp extends MeshProp
+ {
+ private var spriteTextureMaterial:SpriteTextureMaterial;
+
+ public function Sprite3DProp(param1:Sprite3D, param2:String, param3:String, param4:String, param5:Boolean = true)
+ {
+ super(param1,param2,param3,param4,param5);
+ }
+
+ public function get scale() : Number
+ {
+ return (_object as Sprite3D).scaleX;
+ }
+
+ override public function calculate() : void
+ {
+ distancesX = new Point();
+ distancesY = new Point();
+ distancesZ = new Point();
+ _multi = false;
+ height = -1;
+ }
+
+ override public function setMaterial(param1:Material) : void
+ {
+ var loc2:SpriteTextureMaterial = param1 as SpriteTextureMaterial;
+ if(loc2)
+ {
+ loc2.originX = this.spriteTextureMaterial.originX;
+ loc2.originY = this.spriteTextureMaterial.originY;
+ }
+ (_object as Sprite3D).material = loc2;
+ }
+
+ override protected function initBitmapData() : void
+ {
+ _material = (_object as Sprite3D).material;
+ this.spriteTextureMaterial = _material as SpriteTextureMaterial;
+ bitmapData = this.spriteTextureMaterial.texture.bitmapData;
+ }
+
+ override public function get vertices() : Map
+ {
+ var loc1:Vertex = new Vertex(0,0,0);
+ var loc2:Map = new Map();
+ loc2.add("1",loc1);
+ return loc2;
+ }
+
+ override protected function get newSelectedMaterial() : Material
+ {
+ return new SpriteTextureMaterial(new Texture(_selectBitmapData));
+ }
+
+ override public function clone() : Object3D
+ {
+ var loc1:Sprite3D = _object.clone() as Sprite3D;
+ loc1.material = _material.clone() as SpriteTextureMaterial;
+ var loc2:Sprite3DProp = new Sprite3DProp(loc1,name,_libraryName,_groupName,false);
+ loc2.distancesX = distancesX.clone();
+ loc2.distancesY = distancesY.clone();
+ loc2.distancesZ = distancesZ.clone();
+ loc2._multi = _multi;
+ loc2.name = name;
+ loc2.bitmaps = bitmaps;
+ loc2.height = height;
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/PropGroup.as b/src/alternativa/editor/propslib/PropGroup.as
new file mode 100644
index 0000000..8c8992b
--- /dev/null
+++ b/src/alternativa/editor/propslib/PropGroup.as
@@ -0,0 +1,68 @@
+package alternativa.editor.propslib
+{
+ public class PropGroup
+ {
+ public var name:String;
+
+ public var props:Vector.;
+
+ public var groups:Vector.;
+
+ public function PropGroup(param1:String)
+ {
+ super();
+ this.name = param1;
+ }
+
+ public function getPropByName(param1:String) : PropLibObject
+ {
+ var loc2:PropLibObject = null;
+ if(this.props != null)
+ {
+ for each(loc2 in this.props)
+ {
+ if(loc2.name == param1)
+ {
+ return loc2;
+ }
+ }
+ }
+ return null;
+ }
+
+ public function getGroupByName(param1:String) : PropGroup
+ {
+ var loc2:PropGroup = null;
+ if(this.groups != null)
+ {
+ for each(loc2 in this.groups)
+ {
+ if(loc2.name == param1)
+ {
+ return loc2;
+ }
+ }
+ }
+ return null;
+ }
+
+ public function addProp(param1:PropLibObject) : void
+ {
+ if(this.props == null)
+ {
+ this.props = new Vector.();
+ }
+ this.props.push(param1);
+ }
+
+ public function addGroup(param1:PropGroup) : void
+ {
+ if(this.groups == null)
+ {
+ this.groups = new Vector.();
+ }
+ this.groups.push(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/PropLibMesh.as b/src/alternativa/editor/propslib/PropLibMesh.as
new file mode 100644
index 0000000..18763b7
--- /dev/null
+++ b/src/alternativa/editor/propslib/PropLibMesh.as
@@ -0,0 +1,22 @@
+package alternativa.editor.propslib
+{
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.types.Map;
+
+ public class PropLibMesh extends PropLibObject
+ {
+ public var bitmaps:Map;
+
+ public function PropLibMesh(param1:String, param2:Object3D = null, param3:Map = null)
+ {
+ super(param1,param2);
+ this.bitmaps = param3;
+ }
+
+ public function toString() : String
+ {
+ return "[PropMesh object3d=" + object3d + ", bitmaps=" + this.bitmaps + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/PropLibObject.as b/src/alternativa/editor/propslib/PropLibObject.as
new file mode 100644
index 0000000..c7144c5
--- /dev/null
+++ b/src/alternativa/editor/propslib/PropLibObject.as
@@ -0,0 +1,19 @@
+package alternativa.editor.propslib
+{
+ import alternativa.engine3d.core.Object3D;
+
+ public class PropLibObject
+ {
+ public var name:String;
+
+ public var object3d:Object3D;
+
+ public function PropLibObject(param1:String, param2:Object3D = null)
+ {
+ super();
+ this.name = param1;
+ this.object3d = param2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/PropsLibrary.as b/src/alternativa/editor/propslib/PropsLibrary.as
new file mode 100644
index 0000000..21bb9c3
--- /dev/null
+++ b/src/alternativa/editor/propslib/PropsLibrary.as
@@ -0,0 +1,237 @@
+package alternativa.editor.propslib
+{
+ import alternativa.editor.propslib.events.PropLibProgressEvent;
+ import alternativa.editor.propslib.loaders.MeshLoader;
+ import alternativa.editor.propslib.loaders.SpriteLoader;
+ import alternativa.engine3d.loaders.TextureMapsInfo;
+ import alternativa.types.Map;
+ import flash.events.ErrorEvent;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.events.SecurityErrorEvent;
+ import flash.net.URLLoader;
+ import flash.net.URLRequest;
+ import flash.system.ApplicationDomain;
+ import flash.system.LoaderContext;
+
+ public class PropsLibrary extends EventDispatcher
+ {
+ public var name:String;
+
+ public var rootGroup:PropGroup;
+
+ private var url:String;
+
+ private var configLoader:URLLoader;
+
+ private var loaders:Vector.;
+
+ private var currLoader:ObjectLoaderPair;
+
+ private var propsLoaded:int;
+
+ private var propsTotal:int;
+
+ public function PropsLibrary(param1:String = null)
+ {
+ super();
+ if(param1 != null)
+ {
+ this.load(param1);
+ }
+ }
+
+ private static function xmlReadAttrString(param1:XML, param2:String, param3:String = null) : String
+ {
+ var loc4:XMLList = param1.attribute(param2);
+ if(loc4.length() > 0)
+ {
+ return loc4[0].toString();
+ }
+ return param3;
+ }
+
+ private static function xmlReadAttrNumber(param1:XML, param2:String, param3:Number) : Number
+ {
+ var loc4:XMLList = param1.attribute(param2);
+ if(loc4.length() > 0)
+ {
+ return Number(loc4[0]);
+ }
+ return param3;
+ }
+
+ public function load(param1:String) : void
+ {
+ if(param1 == null)
+ {
+ throw new ArgumentError();
+ }
+ this.url = param1.length > 0 && param1.charAt(param1.length - 1) != "/" ? param1 + "/" : param1;
+ this.configLoader = new URLLoader(new URLRequest(this.url + "library.xml"));
+ this.configLoader.addEventListener(Event.COMPLETE,this.onXMLLoadingComplete);
+ this.configLoader.addEventListener(IOErrorEvent.IO_ERROR,this.onErrorEvent);
+ this.configLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,this.onErrorEvent);
+ }
+
+ private function onErrorEvent(param1:ErrorEvent) : void
+ {
+ dispatchEvent(param1);
+ }
+
+ private function onXMLLoadingComplete(param1:Event) : void
+ {
+ var loc2:XML = XML(this.configLoader.data);
+ this.configLoader.removeEventListener(Event.COMPLETE,this.onXMLLoadingComplete);
+ this.configLoader.removeEventListener(IOErrorEvent.IO_ERROR,this.onErrorEvent);
+ this.configLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,this.onErrorEvent);
+ this.configLoader = null;
+ this.name = loc2.@name;
+ this.loaders = new Vector.();
+ this.rootGroup = this.parseGroup(loc2);
+ this.propsLoaded = 0;
+ this.propsTotal = this.loaders.length;
+ this.loadPropObject();
+ }
+
+ private function loadPropObject() : void
+ {
+ this.currLoader = this.loaders.pop();
+ this.currLoader.loader.addEventListener(Event.COMPLETE,this.onPropObjectLoadingComplete);
+ this.currLoader.loader.addEventListener(IOErrorEvent.IO_ERROR,this.onErrorEvent);
+ this.currLoader.loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,this.onErrorEvent);
+ var loc1:LoaderContext = new LoaderContext();
+ loc1.applicationDomain = ApplicationDomain.currentDomain;
+ this.currLoader.loader.load(loc1);
+ }
+
+ private function onPropObjectLoadingComplete(param1:Event) : void
+ {
+ var loc2:PropLibMesh = null;
+ var loc3:MeshLoader = null;
+ this.currLoader.loader.removeEventListener(Event.COMPLETE,this.onPropObjectLoadingComplete);
+ this.currLoader.loader.removeEventListener(IOErrorEvent.IO_ERROR,this.onErrorEvent);
+ this.currLoader.loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,this.onErrorEvent);
+ if(this.currLoader.propObject is PropLibMesh)
+ {
+ loc2 = this.currLoader.propObject as PropLibMesh;
+ loc3 = this.currLoader.loader as MeshLoader;
+ loc2.object3d = loc3.object;
+ loc2.bitmaps = loc3.bitmaps;
+ }
+ else
+ {
+ this.currLoader.propObject.object3d = (this.currLoader.loader as SpriteLoader).sprite;
+ }
+ ++this.propsLoaded;
+ if(hasEventListener(PropLibProgressEvent.PROGRESS))
+ {
+ dispatchEvent(new PropLibProgressEvent(this.propsLoaded,this.propsTotal));
+ }
+ if(this.loaders.length > 0)
+ {
+ this.loadPropObject();
+ }
+ else
+ {
+ this.currLoader = null;
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+
+ private function parseGroup(param1:XML) : PropGroup
+ {
+ var loc2:XML = null;
+ var loc3:PropGroup = new PropGroup(param1.@name);
+ for each(loc2 in param1.prop)
+ {
+ loc3.addProp(this.parseProp(loc2));
+ }
+ for each(loc2 in param1.elements("prop-group"))
+ {
+ loc3.addGroup(this.parseGroup(loc2));
+ }
+ return loc3;
+ }
+
+ private function parseProp(param1:XML) : PropLibObject
+ {
+ var loc2:ObjectLoaderPair = this.createObjectLoaderPair(param1);
+ this.loaders.push(loc2);
+ return loc2.propObject;
+ }
+
+ private function createObjectLoaderPair(param1:XML) : ObjectLoaderPair
+ {
+ if(param1.mesh.length() > 0)
+ {
+ return this.createMeshLoaderPair(param1);
+ }
+ if(param1.sprite.length() > 0)
+ {
+ return this.createSpriteLoaderPair(param1);
+ }
+ throw new Error("Unknown prop: " + param1);
+ }
+
+ private function createMeshLoaderPair(param1:XML) : ObjectLoaderPair
+ {
+ var loc3:Map = null;
+ var loc5:XML = null;
+ var loc6:String = null;
+ var loc7:String = null;
+ var loc2:XML = param1.mesh[0];
+ if(loc2.texture.length() > 0)
+ {
+ loc3 = new Map();
+ for each(loc5 in loc2.texture)
+ {
+ loc6 = loc5.attribute("diffuse-map").toString().toLowerCase();
+ loc7 = xmlReadAttrString(loc5,"opacity-map");
+ if(loc7 != null)
+ {
+ loc7 = this.url + loc7.toLowerCase();
+ }
+ loc3.add(loc5.@name.toString(),new TextureMapsInfo(this.url + loc6,loc7));
+ }
+ }
+ var loc4:ObjectLoaderPair = new ObjectLoaderPair();
+ loc4.propObject = new PropLibMesh(param1.@name);
+ loc4.loader = new MeshLoader(this.url + loc2.attribute("file").toString().toLowerCase(),xmlReadAttrString(loc2,"object"),loc3);
+ return loc4;
+ }
+
+ private function createSpriteLoaderPair(param1:XML) : ObjectLoaderPair
+ {
+ var loc2:XML = param1.sprite[0];
+ var loc3:String = xmlReadAttrString(loc2,"alpha");
+ if(loc3 != null)
+ {
+ loc3 = this.url + loc3.toLowerCase();
+ }
+ var loc4:Number = xmlReadAttrNumber(loc2,"origin-x",0.5);
+ var loc5:Number = xmlReadAttrNumber(loc2,"origin-y",1);
+ var loc6:Number = xmlReadAttrNumber(loc2,"scale",1);
+ var loc7:ObjectLoaderPair = new ObjectLoaderPair();
+ loc7.propObject = new PropLibObject(param1.@name);
+ loc7.loader = new SpriteLoader(this.url + loc2.attribute("file").toString().toLowerCase(),loc3,loc4,loc5,loc6);
+ return loc7;
+ }
+ }
+}
+
+import alternativa.editor.propslib.loaders.ObjectLoader;
+import alternativa.editor.propslib.PropLibObject;
+
+class ObjectLoaderPair
+{
+ public var propObject:PropLibObject;
+
+ public var loader:ObjectLoader;
+
+ public function ObjectLoaderPair()
+ {
+ super();
+ }
+}
diff --git a/src/alternativa/editor/propslib/events/PropLibProgressEvent.as b/src/alternativa/editor/propslib/events/PropLibProgressEvent.as
new file mode 100644
index 0000000..992fdb6
--- /dev/null
+++ b/src/alternativa/editor/propslib/events/PropLibProgressEvent.as
@@ -0,0 +1,26 @@
+package alternativa.editor.propslib.events
+{
+ import flash.events.Event;
+
+ public class PropLibProgressEvent extends Event
+ {
+ public static const PROGRESS:String = "progress";
+
+ public var propsLoaded:int;
+
+ public var propsTotal:int;
+
+ public function PropLibProgressEvent(param1:int, param2:int)
+ {
+ super(PROGRESS);
+ this.propsLoaded = param1;
+ this.propsTotal = param2;
+ }
+
+ override public function clone() : Event
+ {
+ return new PropLibProgressEvent(this.propsLoaded,this.propsTotal);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/loaders/MeshLoader.as b/src/alternativa/editor/propslib/loaders/MeshLoader.as
new file mode 100644
index 0000000..707fbb9
--- /dev/null
+++ b/src/alternativa/editor/propslib/loaders/MeshLoader.as
@@ -0,0 +1,107 @@
+package alternativa.editor.propslib.loaders
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.loaders.Loader3DS;
+ import alternativa.engine3d.loaders.TextureMapsBatchLoader;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.types.Map;
+ import flash.events.Event;
+ import flash.events.IOErrorEvent;
+ import flash.events.SecurityErrorEvent;
+ import flash.system.LoaderContext;
+
+ public class MeshLoader extends ObjectLoader
+ {
+ public var object:Mesh;
+
+ public var bitmaps:Map;
+
+ private var url:String;
+
+ private var objectName:String;
+
+ private var textures:Map;
+
+ private var loader3DS:Loader3DS;
+
+ private var texturesLoader:TextureMapsBatchLoader;
+
+ private var loaderContext:LoaderContext;
+
+ public function MeshLoader(param1:String, param2:String, param3:Map)
+ {
+ super();
+ this.url = param1;
+ this.objectName = param2;
+ this.textures = param3;
+ }
+
+ override public function load(param1:LoaderContext) : void
+ {
+ this.loaderContext = param1;
+ this.loader3DS = new Loader3DS();
+ this.loader3DS.addEventListener(Event.COMPLETE,this.on3DSLoadingComplete);
+ this.loader3DS.addEventListener(IOErrorEvent.IO_ERROR,onErrorEvent);
+ this.loader3DS.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onErrorEvent);
+ this.loader3DS.smooth = true;
+ this.loader3DS.repeat = false;
+ this.loader3DS.load(this.url,param1);
+ }
+
+ private function on3DSLoadingComplete(param1:Event) : void
+ {
+ if(this.objectName != null)
+ {
+ this.object = this.loader3DS.content.getChildByName(this.objectName,true) as Mesh;
+ }
+ else
+ {
+ this.object = this.loader3DS.content.children.peek() as Mesh;
+ }
+ this.loader3DS.removeEventListener(Event.COMPLETE,this.on3DSLoadingComplete);
+ this.loader3DS.removeEventListener(IOErrorEvent.IO_ERROR,onErrorEvent);
+ this.loader3DS.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,onErrorEvent);
+ this.loader3DS = null;
+ if(this.textures != null)
+ {
+ this.texturesLoader = new TextureMapsBatchLoader();
+ this.texturesLoader.addEventListener(Event.COMPLETE,this.onTexturesLoadingComplete);
+ this.texturesLoader.addEventListener(IOErrorEvent.IO_ERROR,onErrorEvent);
+ this.texturesLoader.load("",this.textures,this.loaderContext);
+ }
+ else
+ {
+ this.initDefaultTexture();
+ complete();
+ }
+ }
+
+ private function initDefaultTexture() : void
+ {
+ var loc1:Mesh = Mesh(this.object);
+ var loc2:Surface = loc1.surfaces.peek();
+ var loc3:TextureMaterial = loc2.material as TextureMaterial;
+ if(loc3 != null)
+ {
+ this.bitmaps = new Map();
+ this.bitmaps.add("DEFAULT",loc3.texture.bitmapData);
+ }
+ }
+
+ private function onTexturesLoadingComplete(param1:Event) : void
+ {
+ this.bitmaps = this.texturesLoader.textures;
+ this.texturesLoader.removeEventListener(Event.COMPLETE,this.onTexturesLoadingComplete);
+ this.texturesLoader.removeEventListener(IOErrorEvent.IO_ERROR,onErrorEvent);
+ this.texturesLoader = null;
+ complete();
+ }
+
+ override public function toString() : String
+ {
+ return "[MeshLoader url=" + this.url + ", objectName=" + this.objectName + ", textures=" + this.textures + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/loaders/ObjectLoader.as b/src/alternativa/editor/propslib/loaders/ObjectLoader.as
new file mode 100644
index 0000000..03c4e58
--- /dev/null
+++ b/src/alternativa/editor/propslib/loaders/ObjectLoader.as
@@ -0,0 +1,30 @@
+package alternativa.editor.propslib.loaders
+{
+ import flash.events.ErrorEvent;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.system.LoaderContext;
+
+ public class ObjectLoader extends EventDispatcher
+ {
+ public function ObjectLoader()
+ {
+ super();
+ }
+
+ public function load(param1:LoaderContext) : void
+ {
+ }
+
+ public function complete() : void
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+
+ protected function onErrorEvent(param1:ErrorEvent) : void
+ {
+ dispatchEvent(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/propslib/loaders/SpriteLoader.as b/src/alternativa/editor/propslib/loaders/SpriteLoader.as
new file mode 100644
index 0000000..b5eda3f
--- /dev/null
+++ b/src/alternativa/editor/propslib/loaders/SpriteLoader.as
@@ -0,0 +1,60 @@
+package alternativa.editor.propslib.loaders
+{
+ import alternativa.engine3d.core.Sprite3D;
+ import alternativa.engine3d.loaders.TextureMapsLoader;
+ import alternativa.engine3d.materials.SpriteTextureMaterial;
+ import alternativa.types.Texture;
+ import flash.display.BlendMode;
+ import flash.events.Event;
+ import flash.events.IOErrorEvent;
+ import flash.system.LoaderContext;
+
+ public class SpriteLoader extends ObjectLoader
+ {
+ private var file:String;
+
+ private var alpha:String;
+
+ private var originX:Number;
+
+ private var originY:Number;
+
+ private var scale:Number;
+
+ private var loader:TextureMapsLoader;
+
+ public var sprite:Sprite3D;
+
+ public function SpriteLoader(param1:String, param2:String, param3:Number, param4:Number, param5:Number)
+ {
+ super();
+ this.file = param1;
+ this.alpha = param2;
+ this.originX = param3;
+ this.originY = param4;
+ this.scale = param5;
+ }
+
+ override public function load(param1:LoaderContext) : void
+ {
+ this.loader = new TextureMapsLoader(this.file,this.alpha,param1);
+ this.loader.addEventListener(Event.COMPLETE,this.onLoadingComplete);
+ this.loader.addEventListener(IOErrorEvent.IO_ERROR,onErrorEvent);
+ }
+
+ private function onLoadingComplete(param1:Event) : void
+ {
+ this.sprite = new Sprite3D();
+ this.sprite.material = new SpriteTextureMaterial(new Texture(this.loader.bitmapData),1,true,BlendMode.NORMAL,this.originX,this.originY);
+ this.sprite.scaleX = this.scale;
+ this.sprite.scaleY = this.scale;
+ this.sprite.scaleZ = this.scale;
+ this.loader.unload();
+ this.loader.removeEventListener(Event.COMPLETE,this.onLoadingComplete);
+ this.loader.removeEventListener(IOErrorEvent.IO_ERROR,onErrorEvent);
+ this.loader = null;
+ complete();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/CameraFacing.as b/src/alternativa/editor/scene/CameraFacing.as
new file mode 100644
index 0000000..e20b0ae
--- /dev/null
+++ b/src/alternativa/editor/scene/CameraFacing.as
@@ -0,0 +1,35 @@
+package alternativa.editor.scene
+{
+ import flash.geom.Point;
+
+ public class CameraFacing
+ {
+ public static const X:CameraFacing = new CameraFacing(-1,0);
+
+ public static const Y:CameraFacing = new CameraFacing(0,1);
+
+ public static const NEGATIVE_X:CameraFacing = new CameraFacing(1,0);
+
+ public static const NEGATIVE_Y:CameraFacing = new CameraFacing(0,-1);
+
+ private var sin:Number;
+
+ private var cos:Number;
+
+ public function CameraFacing(param1:Number, param2:Number)
+ {
+ super();
+ this.sin = param1;
+ this.cos = param2;
+ }
+
+ public function getGlobalVector(param1:Point) : Point
+ {
+ var loc2:Point = new Point();
+ loc2.x = this.cos * param1.x - this.sin * param1.y;
+ loc2.y = this.sin * param1.x + this.cos * param1.y;
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/ControlPointNameField.as b/src/alternativa/editor/scene/ControlPointNameField.as
new file mode 100644
index 0000000..5fb8b2c
--- /dev/null
+++ b/src/alternativa/editor/scene/ControlPointNameField.as
@@ -0,0 +1,60 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.prop.ControlPoint;
+ import flash.events.Event;
+ import flash.events.KeyboardEvent;
+ import mx.controls.TextInput;
+
+ public class ControlPointNameField extends TextInput
+ {
+ public function ControlPointNameField()
+ {
+ super();
+ maxChars = 1;
+ restrict = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ width = 50;
+ addEventListener(KeyboardEvent.KEY_DOWN,onKey);
+ addEventListener(KeyboardEvent.KEY_UP,onKey);
+ }
+
+ private static function onKey(param1:KeyboardEvent) : void
+ {
+ param1.stopPropagation();
+ }
+
+ public function setControlPoint(param1:ControlPoint) : void
+ {
+ if(param1 == null)
+ {
+ throw new ArgumentError();
+ }
+ this.data = param1;
+ this.disableChangeListener();
+ text = param1.controlPointName;
+ this.enableChangeListener();
+ }
+
+ public function clearControlPoint() : void
+ {
+ this.disableChangeListener();
+ text = "";
+ data = null;
+ }
+
+ private function enableChangeListener() : void
+ {
+ addEventListener(Event.CHANGE,this.onChange);
+ }
+
+ private function disableChangeListener() : void
+ {
+ removeEventListener(Event.CHANGE,this.onChange);
+ }
+
+ private function onChange(param1:Event) : void
+ {
+ ControlPoint(data).controlPointName = text;
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/CursorScene.as b/src/alternativa/editor/scene/CursorScene.as
new file mode 100644
index 0000000..8984441
--- /dev/null
+++ b/src/alternativa/editor/scene/CursorScene.as
@@ -0,0 +1,318 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.prop.CustomFillMaterial;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.engine3d.controllers.WalkController;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.display.View;
+ import alternativa.engine3d.materials.Material;
+ import alternativa.engine3d.materials.SpriteTextureMaterial;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.types.Texture;
+ import alternativa.utils.MathUtils;
+ import flash.display.BitmapData;
+ import flash.display.BlendMode;
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+
+ public class CursorScene extends EditorScene
+ {
+ private static var redClass:Class = CursorScene_redClass;
+
+ private static const redBmp:BitmapData = new redClass().bitmapData;
+
+ private static var greenClass:Class = CursorScene_greenClass;
+
+ private static const greenBmp:BitmapData = new greenClass().bitmapData;
+
+ protected var _object:Prop;
+
+ private var redMaterial:Material;
+
+ private var greenMaterial:Material;
+
+ private var material:Material;
+
+ private var _freeState:Boolean = true;
+
+ public var cameraController:WalkController;
+
+ public var containerController:WalkController;
+
+ public var container:Object3D;
+
+ private var eventSourceObject:DisplayObject;
+
+ protected var _snapMode:Boolean = true;
+
+ private var axisIndicatorOverlay:Shape;
+
+ private var axisIndicatorSize:Number = 30;
+
+ private var _visible:Boolean = false;
+
+ public function CursorScene(param1:DisplayObject)
+ {
+ super();
+ this.eventSourceObject = param1;
+ this.initControllers();
+ view.addChild(this.axisIndicatorOverlay = new Shape());
+ }
+
+ private function initControllers() : void
+ {
+ this.cameraController = new WalkController(this.eventSourceObject);
+ this.cameraController.object = camera;
+ this.cameraController.speedMultiplier = 4;
+ this.cameraController.speedThreshold = 1;
+ this.cameraController.mouseEnabled = false;
+ this.cameraController.coords = new Point3D(250,-7800,4670);
+ this.container = new Object3D();
+ root.addChild(this.container);
+ this.containerController = new WalkController(this.eventSourceObject);
+ this.containerController.object = this.container;
+ this.containerController.mouseEnabled = false;
+ this.container.addChild(camera);
+ }
+
+ public function set object(param1:Prop) : void
+ {
+ var loc2:Point3D = null;
+ if(this._object)
+ {
+ loc2 = this._object.coords;
+ if(this._visible)
+ {
+ root.removeChild(this._object);
+ }
+ }
+ this._object = param1;
+ this.material = this._object.material.clone();
+ this.material.alpha = 0.5;
+ if(loc2)
+ {
+ this._object.coords = loc2;
+ }
+ if(this._visible)
+ {
+ root.addChild(this._object);
+ }
+ if(this._snapMode || this._object is MeshProp && !(this._object is Sprite3DProp))
+ {
+ this.snapObject();
+ }
+ this.updateMaterial();
+ }
+
+ public function get object() : Prop
+ {
+ return this._object;
+ }
+
+ public function set snapMode(param1:Boolean) : void
+ {
+ if(this._snapMode != param1 && Boolean(this._object))
+ {
+ this._snapMode = param1;
+ if(param1)
+ {
+ this.snapObject();
+ }
+ else
+ {
+ this._object.setMaterial(this.material);
+ }
+ }
+ }
+
+ private function snapObject() : void
+ {
+ this.createMaterials();
+ this._object.snapToGrid();
+ }
+
+ private function createMaterials() : void
+ {
+ var loc1:BitmapData = this._object.bitmapData.clone();
+ var loc2:BitmapData = loc1.clone();
+ var loc3:Matrix = new Matrix();
+ loc3.a = loc1.width / redBmp.width;
+ loc3.d = loc3.a;
+ loc1.draw(redBmp,loc3,null,BlendMode.HARDLIGHT);
+ loc2.draw(greenBmp,loc3,null,BlendMode.HARDLIGHT);
+ if(this._object is Sprite3DProp)
+ {
+ this.greenMaterial = new SpriteTextureMaterial(new Texture(loc2));
+ this.redMaterial = new SpriteTextureMaterial(new Texture(loc1));
+ }
+ else
+ {
+ this.greenMaterial = new CustomFillMaterial(new Point3D(-10000000000,-7000000000,4000000000),65280);
+ this.redMaterial = new CustomFillMaterial(new Point3D(-10000000000,-7000000000,4000000000),16711680);
+ }
+ this.greenMaterial.alpha = 0.8;
+ this.redMaterial.alpha = 0.8;
+ }
+
+ public function moveCursorByMouse() : void
+ {
+ var loc1:Point3D = null;
+ if(this._object)
+ {
+ loc1 = view.projectViewPointToPlane(new Point(view.mouseX,view.mouseY),znormal,this._object.z);
+ this._object.x = loc1.x;
+ this._object.y = loc1.y;
+ if(this._snapMode || this._object is MeshProp && !(this._object is Sprite3DProp))
+ {
+ this._object.snapToGrid();
+ }
+ this.updateMaterial();
+ }
+ }
+
+ public function get freeState() : Boolean
+ {
+ return this._freeState;
+ }
+
+ override protected function initScene() : void
+ {
+ root = new Object3D();
+ camera = new Camera3D();
+ camera.rotationX = -MathUtils.DEG90 - MathUtils.DEG30;
+ view = new View(camera);
+ view.interactive = false;
+ view.mouseEnabled = false;
+ view.mouseChildren = false;
+ view.graphics.beginFill(16777215);
+ view.graphics.drawRect(0,0,1,1);
+ view.graphics.endFill();
+ }
+
+ public function updateMaterial() : void
+ {
+ if(this._object)
+ {
+ if(this._snapMode)
+ {
+ if(occupyMap.isConflict(this._object))
+ {
+ this._freeState = false;
+ this._object.setMaterial(this.redMaterial);
+ }
+ else
+ {
+ this._freeState = true;
+ this._object.setMaterial(this.greenMaterial);
+ }
+ }
+ else
+ {
+ this._object.setMaterial(this.material);
+ }
+ }
+ }
+
+ public function clear() : void
+ {
+ if(this._object)
+ {
+ if(root.getChildByName(this._object.name))
+ {
+ root.removeChild(this._object);
+ }
+ this._object = null;
+ this._visible = false;
+ }
+ }
+
+ public function drawAxis(param1:Matrix3D) : void
+ {
+ var loc2:Graphics = this.axisIndicatorOverlay.graphics;
+ var loc3:Number = this.axisIndicatorSize;
+ loc2.clear();
+ loc2.lineStyle(2,16711680);
+ loc2.moveTo(loc3,0);
+ loc2.lineTo(param1.a * this.axisIndicatorSize + loc3,param1.b * this.axisIndicatorSize + 0);
+ loc2.lineStyle(2,65280);
+ loc2.moveTo(loc3,0);
+ loc2.lineTo(param1.e * this.axisIndicatorSize + loc3,param1.f * this.axisIndicatorSize + 0);
+ loc2.lineStyle(2,255);
+ loc2.moveTo(loc3,0);
+ loc2.lineTo(param1.i * this.axisIndicatorSize + loc3,param1.j * this.axisIndicatorSize + 0);
+ }
+
+ public function set visible(param1:Boolean) : void
+ {
+ if(param1 != this._visible)
+ {
+ this._visible = param1;
+ if(this._object)
+ {
+ if(this._visible)
+ {
+ root.addChild(this._object);
+ this.updateMaterial();
+ }
+ else
+ {
+ root.removeChild(this._object);
+ }
+ }
+ }
+ }
+
+ public function get visible() : Boolean
+ {
+ return this._visible;
+ }
+
+ public function moveByArrows(param1:uint) : void
+ {
+ move(this._object,param1);
+ this.updateMaterial();
+ }
+
+ override public function viewResize(param1:Number, param2:Number) : void
+ {
+ super.viewResize(param1,param2);
+ this.axisIndicatorOverlay.y = view.height - this.axisIndicatorSize;
+ }
+
+ public function rotateCursorCounterClockwise() : void
+ {
+ rotatePropsCounterClockwise(this.getCursorObjectSet());
+ this.snapCursorToGrid();
+ }
+
+ public function rotateCursorClockwise() : void
+ {
+ rotatePropsClockwise(this.getCursorObjectSet());
+ this.snapCursorToGrid();
+ }
+
+ private function getCursorObjectSet() : Set
+ {
+ var loc1:Set = new Set();
+ loc1.add(this._object);
+ return loc1;
+ }
+
+ private function snapCursorToGrid() : void
+ {
+ if(this._snapMode || this._object is MeshProp && !(this._object is Sprite3DProp))
+ {
+ this._object.snapToGrid();
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/CursorScene_greenClass.as b/src/alternativa/editor/scene/CursorScene_greenClass.as
new file mode 100644
index 0000000..6e18281
--- /dev/null
+++ b/src/alternativa/editor/scene/CursorScene_greenClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor.scene
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/93_alternativa.editor.scene.CursorScene_greenClass.jpg")]
+ public class CursorScene_greenClass extends BitmapAsset
+ {
+ public function CursorScene_greenClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/CursorScene_redClass.as b/src/alternativa/editor/scene/CursorScene_redClass.as
new file mode 100644
index 0000000..b4ab9fd
--- /dev/null
+++ b/src/alternativa/editor/scene/CursorScene_redClass.as
@@ -0,0 +1,14 @@
+package alternativa.editor.scene
+{
+ import mx.core.BitmapAsset;
+
+ [Embed(source="/_assets/73.jpg")]
+ public class CursorScene_redClass extends BitmapAsset
+ {
+ public function CursorScene_redClass()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/EditorScene.as b/src/alternativa/editor/scene/EditorScene.as
new file mode 100644
index 0000000..073143f
--- /dev/null
+++ b/src/alternativa/editor/scene/EditorScene.as
@@ -0,0 +1,239 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.prop.Prop;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.display.View;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.utils.KeyboardUtils;
+ import alternativa.utils.MathUtils;
+ import flash.geom.Point;
+
+ public class EditorScene extends Scene3D
+ {
+ public static const HORIZONTAL_GRID_RESOLUTION_1:Number = 500;
+
+ public static const HORIZONTAL_GRID_RESOLUTION_2:Number = 250;
+
+ public static const VERTICAL_GRID_RESOLUTION_1:Number = 300;
+
+ public static const VERTICAL_GRID_RESOLUTION_2:Number = 150;
+
+ public static var snapByHalf:Boolean = false;
+
+ public static var hBase:Number = 250;
+
+ public static var hBase2:Number = 2 * hBase;
+
+ public static var vBase:Number = 300;
+
+ public var camera:Camera3D;
+
+ public var view:View;
+
+ public var occupyMap:OccupyMap;
+
+ protected var znormal:Point3D;
+
+ protected var ynormal:Point3D;
+
+ protected var xnormal:Point3D;
+
+ public function EditorScene()
+ {
+ this.znormal = new Point3D(0,0,1);
+ this.ynormal = new Point3D(0,1,0);
+ this.xnormal = new Point3D(1,0,0);
+ super();
+ this.initScene();
+ }
+
+ public static function toggleGridResolution() : void
+ {
+ snapByHalf = !snapByHalf;
+ }
+
+ public function viewResize(param1:Number, param2:Number) : void
+ {
+ this.view.width = param1;
+ this.view.height = param2;
+ calculate();
+ }
+
+ protected function initScene() : void
+ {
+ root = new Object3D();
+ this.camera = new Camera3D();
+ this.camera.rotationX = -MathUtils.DEG90 - MathUtils.DEG30;
+ this.camera.coords = new Point3D(250,-7800,4670);
+ root.addChild(this.camera);
+ this.view = new View(this.camera);
+ this.view.interactive = true;
+ this.view.buttonMode = true;
+ this.view.useHandCursor = false;
+ this.view.graphics.beginFill(16777215);
+ this.view.graphics.drawRect(0,0,1,1);
+ this.view.graphics.endFill();
+ }
+
+ protected function getCameraFacing() : CameraFacing
+ {
+ var loc1:Matrix3D = this.camera.transformation;
+ if(loc1.a > 1 / Math.SQRT2)
+ {
+ return CameraFacing.Y;
+ }
+ if(loc1.a < -1 / Math.SQRT2)
+ {
+ return CameraFacing.NEGATIVE_Y;
+ }
+ if(loc1.e > 0)
+ {
+ return CameraFacing.NEGATIVE_X;
+ }
+ return CameraFacing.X;
+ }
+
+ protected function move(param1:Prop, param2:uint) : void
+ {
+ var loc3:Point = null;
+ var loc4:CameraFacing = null;
+ var loc5:Point = null;
+ if(param1 != null)
+ {
+ loc3 = new Point();
+ switch(param2)
+ {
+ case KeyboardUtils.UP:
+ loc3.y = 1;
+ break;
+ case KeyboardUtils.DOWN:
+ loc3.y = -1;
+ break;
+ case KeyboardUtils.LEFT:
+ loc3.x = -1;
+ break;
+ case KeyboardUtils.RIGHT:
+ loc3.x = 1;
+ }
+ if(loc3.length > 0)
+ {
+ loc4 = this.getCameraFacing();
+ loc5 = loc4.getGlobalVector(loc3);
+ param1.x += (EditorScene.snapByHalf ? EditorScene.HORIZONTAL_GRID_RESOLUTION_2 : EditorScene.HORIZONTAL_GRID_RESOLUTION_1) * loc5.x;
+ param1.y += (EditorScene.snapByHalf ? EditorScene.HORIZONTAL_GRID_RESOLUTION_2 : EditorScene.HORIZONTAL_GRID_RESOLUTION_1) * loc5.y;
+ }
+ }
+ }
+
+ public function getPropsGroupCenter(param1:Set) : Point
+ {
+ var loc8:* = undefined;
+ var loc9:Number = NaN;
+ var loc10:Prop = null;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc2:Number = Number.POSITIVE_INFINITY;
+ var loc3:Number = Number.NEGATIVE_INFINITY;
+ var loc4:Number = Number.POSITIVE_INFINITY;
+ var loc5:Number = Number.NEGATIVE_INFINITY;
+ var loc6:Number = 0;
+ var loc7:Number = 0;
+ for(loc8 in param1)
+ {
+ loc10 = loc8;
+ loc11 = loc10.distancesX.x + loc10.x;
+ loc12 = loc10.distancesX.y + loc10.x;
+ if(loc11 < loc2)
+ {
+ loc2 = loc11;
+ }
+ if(loc12 > loc3)
+ {
+ loc3 = loc12;
+ }
+ loc11 = loc10.distancesY.x + loc10.y;
+ loc12 = loc10.distancesY.y + loc10.y;
+ if(loc11 < loc4)
+ {
+ loc4 = loc11;
+ }
+ if(loc12 > loc5)
+ {
+ loc5 = loc12;
+ }
+ loc6 += loc10.x;
+ loc7 += loc10.y;
+ }
+ loc9 = (loc3 - loc2) / EditorScene.hBase2 % 2;
+ if(loc9 != (loc5 - loc4) / EditorScene.hBase2 % 2)
+ {
+ if(loc9 != 0)
+ {
+ loc6 /= param1.length;
+ if(Math.abs(loc6 - loc3) < Math.abs(loc6 - loc2))
+ {
+ loc3 += EditorScene.hBase2;
+ }
+ else
+ {
+ loc2 -= EditorScene.hBase2;
+ }
+ }
+ else
+ {
+ loc7 /= param1.length;
+ if(Math.abs(loc7 - loc5) < Math.abs(loc7 - loc4))
+ {
+ loc5 += EditorScene.hBase2;
+ }
+ else
+ {
+ loc4 -= EditorScene.hBase2;
+ }
+ }
+ }
+ return new Point((loc3 + loc2) / 2,(loc5 + loc4) / 2);
+ }
+
+ protected function rotatePropsCounterClockwise(param1:Set) : void
+ {
+ var loc3:* = undefined;
+ var loc4:Prop = null;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc2:Point = this.getPropsGroupCenter(param1);
+ for(loc3 in param1)
+ {
+ loc4 = loc3;
+ loc5 = loc4.x;
+ loc6 = loc4.y;
+ loc4.x = -loc6 + loc2.x + loc2.y;
+ loc4.y = loc5 + loc2.y - loc2.x;
+ loc4.rotateCounterClockwise();
+ }
+ }
+
+ protected function rotatePropsClockwise(param1:Set) : void
+ {
+ var loc3:* = undefined;
+ var loc4:Prop = null;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc2:Point = this.getPropsGroupCenter(param1);
+ for(loc3 in param1)
+ {
+ loc4 = loc3;
+ loc5 = loc4.x;
+ loc6 = loc4.y;
+ loc4.x = loc6 + loc2.x - loc2.y;
+ loc4.y = -loc5 + loc2.y + loc2.x;
+ loc4.rotateClockwise();
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/Layer.as b/src/alternativa/editor/scene/Layer.as
new file mode 100644
index 0000000..516b957
--- /dev/null
+++ b/src/alternativa/editor/scene/Layer.as
@@ -0,0 +1,34 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.prop.Prop;
+ import alternativa.types.Set;
+
+ public class Layer
+ {
+ public var visible:Boolean = true;
+
+ public var props:Set;
+
+ public function Layer()
+ {
+ this.props = new Set();
+ super();
+ }
+
+ public function addProp(param1:Prop) : void
+ {
+ this.props.add(param1);
+ }
+
+ public function removeProp(param1:Prop) : void
+ {
+ this.props.remove(param1);
+ }
+
+ public function clear() : void
+ {
+ this.props.clear();
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/Layers.as b/src/alternativa/editor/scene/Layers.as
new file mode 100644
index 0000000..998849f
--- /dev/null
+++ b/src/alternativa/editor/scene/Layers.as
@@ -0,0 +1,83 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.prop.Prop;
+
+ public class Layers
+ {
+ public var layers:Object;
+
+ public function Layers()
+ {
+ this.layers = {};
+ super();
+ }
+
+ public function addProp(param1:String, param2:Prop) : void
+ {
+ this.getLayer(param1).addProp(param2);
+ }
+
+ public function removeProp(param1:Prop, param2:String = null) : void
+ {
+ var loc3:Layer = null;
+ if(param2)
+ {
+ this.getLayer(param2).removeProp(param1);
+ }
+ else
+ {
+ for each(loc3 in this.layers)
+ {
+ loc3.removeProp(param1);
+ }
+ }
+ }
+
+ public function getLayersContainingProp(param1:Prop) : Vector.
+ {
+ var loc3:Layer = null;
+ var loc2:Vector. = new Vector.();
+ for each(loc3 in this.layers)
+ {
+ if(loc3.props.has(param1))
+ {
+ loc2.push(loc3);
+ }
+ }
+ return loc2;
+ }
+
+ public function getLayerNamesContainingProp(param1:Prop) : Vector.
+ {
+ var loc3:String = null;
+ var loc2:Vector. = new Vector.();
+ for(loc3 in this.layers)
+ {
+ if(this.layers[loc3].props.has(param1))
+ {
+ loc2.push(loc3);
+ }
+ }
+ return loc2;
+ }
+
+ internal function getLayer(param1:String) : Layer
+ {
+ if(this.layers[param1] == null)
+ {
+ this.layers[param1] = new Layer();
+ }
+ return this.layers[param1];
+ }
+
+ public function clear() : void
+ {
+ var loc1:Layer = null;
+ for each(loc1 in this.layers)
+ {
+ loc1.clear();
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/MainScene.as b/src/alternativa/editor/scene/MainScene.as
new file mode 100644
index 0000000..b4658e1
--- /dev/null
+++ b/src/alternativa/editor/scene/MainScene.as
@@ -0,0 +1,1138 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.BonusRegionPropertiesPanel;
+ import alternativa.editor.FunctionalProps;
+ import alternativa.editor.GraphicUtils;
+ import alternativa.editor.KillZonePropertiesPanel;
+ import alternativa.editor.LayerNames;
+ import alternativa.editor.TexturePanel;
+ import alternativa.editor.eventjournal.EventJournal;
+ import alternativa.editor.eventjournal.EventJournalItem;
+ import alternativa.editor.events.DominationSpawnLinkEndEvent;
+ import alternativa.editor.events.DominationSpawnLinkStartEvent;
+ import alternativa.editor.events.LayerContentChangeEvent;
+ import alternativa.editor.events.LayerVisibilityChangeEvent;
+ import alternativa.editor.mapexport.FileExporter;
+ import alternativa.editor.mapexport.FileType;
+ import alternativa.editor.mapexport.TanksXmlExporterV1Full;
+ import alternativa.editor.mapexport.TanksXmlExporterV1Lite;
+ import alternativa.editor.mapexport.TanksXmlExporterV3;
+ import alternativa.editor.prop.BonusRegion;
+ import alternativa.editor.prop.ControlPoint;
+ import alternativa.editor.prop.FreeBonusRegion;
+ import alternativa.editor.prop.KillBox;
+ import alternativa.editor.prop.MeshProp;
+ import alternativa.editor.prop.Prop;
+ import alternativa.editor.prop.SpawnPoint;
+ import alternativa.editor.prop.Sprite3DProp;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.events.MouseEvent3D;
+ import alternativa.engine3d.materials.WireMaterial;
+ import alternativa.engine3d.physics.EllipsoidCollider;
+ import alternativa.engine3d.primitives.Plane;
+ import alternativa.types.Map;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.filesystem.FileStream;
+ import flash.geom.Point;
+ import flash.utils.Dictionary;
+ import flash.utils.getQualifiedClassName;
+ import gui.events.PropListEvent;
+ import mx.containers.Panel;
+
+ public class MainScene extends EditorScene
+ {
+ public static var collider:EllipsoidCollider;
+
+ public var selectedProp:Prop;
+
+ public var selectedProps:Set;
+
+ public var propMouseDown:Boolean = false;
+
+ public var snapMode:Boolean = true;
+
+ private var _changed:Boolean = false;
+
+ private var hiddenProps:Array;
+
+ private var texturePanel:TexturePanel;
+
+ private var propertyPanel:Panel;
+
+ private var bonusTypesPanel:BonusRegionPropertiesPanel;
+
+ private var killZonePanel:KillZonePropertiesPanel;
+
+ private var currentBitmaps:Map;
+
+ private var _selectablePropTypes:Set;
+
+ private var grid:Plane;
+
+ private var exporters:Object;
+
+ private var layers:Layers;
+
+ private var dominationPoints:Dictionary;
+
+ private var domSpawnPoint:SpawnPoint;
+
+ private var controlPointNameField:ControlPointNameField;
+
+ public function MainScene()
+ {
+ this.hiddenProps = [];
+ this.bonusTypesPanel = new BonusRegionPropertiesPanel();
+ this.killZonePanel = new KillZonePropertiesPanel();
+ this._selectablePropTypes = new Set();
+ this.exporters = {};
+ this.layers = new Layers();
+ this.dominationPoints = new Dictionary();
+ super();
+ occupyMap = new OccupyMap();
+ this.selectedProps = new Set();
+ this.selectablePropTypes = AlternativaEditor.DEFAULT_SELECTABLE_TYPES;
+ var loc2:Number = 15 * hBase2;
+ this.grid = new Plane(loc2,loc2,15,15);
+ this.grid.cloneMaterialToAllSurfaces(new WireMaterial(1,9474192));
+ root.addChild(this.grid);
+ this.grid.x = hBase;
+ this.grid.y = hBase;
+ this.grid.mouseEnabled = false;
+ this.exporters[FileType.MAP_XML_VERSION_1_LITE] = new TanksXmlExporterV1Lite(root);
+ this.exporters[FileType.MAP_XML_VERSION_1_FULL] = new TanksXmlExporterV1Full(root);
+ this.exporters[FileType.MAP_XML_VERSION_3] = new TanksXmlExporterV3(root);
+ this.createControlPointNameTextField();
+ collider = new EllipsoidCollider(this,30,30,30);
+ GlobalEventDispatcher.addListener(LayerVisibilityChangeEvent.VISIBILITY_CHANGED,this.onLayerVisibilityChange);
+ GlobalEventDispatcher.addListener(LayerContentChangeEvent.LAYER_CONTENT_CHANGED,this.onLayerContentChange);
+ GlobalEventDispatcher.addListener(DominationSpawnLinkStartEvent.DOMINATION_SPAWN_LINK_START,this.onDominationLinkStart);
+ GlobalEventDispatcher.addListener(DominationSpawnLinkEndEvent.DOMINATION_SPAWN_LINK_END,this.onDominationLinkEnd);
+ }
+
+ public static function getProjectedPoint(param1:Point3D) : Point3D
+ {
+ var loc2:Point3D = new Point3D();
+ collider.calculateDestination(param1,new Point3D(0,0,-10000),loc2);
+ return loc2;
+ }
+
+ private static function snapPropsToGrid(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ for(loc2 in param1)
+ {
+ Prop(loc2).snapToGrid();
+ }
+ }
+
+ private function createControlPointNameTextField() : void
+ {
+ this.controlPointNameField = new ControlPointNameField();
+ }
+
+ private function onDominationLinkStart(param1:DominationSpawnLinkStartEvent) : void
+ {
+ this.domSpawnPoint = param1.spawnPoint;
+ }
+
+ private function onDominationLinkEnd(param1:DominationSpawnLinkEndEvent) : void
+ {
+ if(this.domSpawnPoint != null)
+ {
+ if(this.domSpawnPoint.data != null)
+ {
+ ControlPoint(this.domSpawnPoint.data).removeSpawnPoint(this.domSpawnPoint);
+ }
+ param1.checkPoint.addSpawnPoint(this.domSpawnPoint);
+ this.domSpawnPoint = null;
+ }
+ }
+
+ private function onLayerVisibilityChange(param1:LayerVisibilityChangeEvent) : void
+ {
+ var loc3:* = undefined;
+ var loc2:Layer = this.layers.getLayer(param1.layerName);
+ loc2.visible = param1.visible;
+ for(loc3 in loc2.props)
+ {
+ this.checkPropVisibility(loc3);
+ }
+ }
+
+ override public function set root(param1:Object3D) : void
+ {
+ var loc2:FileExporter = null;
+ super.root = param1;
+ for each(loc2 in this.exporters)
+ {
+ loc2.sceneRoot = param1;
+ }
+ }
+
+ public function exportScene(param1:FileType, param2:FileStream) : void
+ {
+ FileExporter(this.exporters[param1]).exportToFileStream(param2);
+ this._changed = false;
+ }
+
+ public function moveProps(param1:Set, param2:Point3D) : void
+ {
+ var loc3:* = undefined;
+ var loc4:Prop = null;
+ for(loc3 in param1)
+ {
+ loc4 = loc3;
+ occupyMap.free(loc4);
+ loc4.x -= param2.x;
+ loc4.y -= param2.y;
+ loc4.z -= param2.z;
+ if(this.snapMode)
+ {
+ loc4.snapToGrid();
+ occupyMap.occupy(loc4);
+ }
+ }
+ }
+
+ public function undo(param1:EventJournalItem) : void
+ {
+ var loc3:* = undefined;
+ var loc4:Prop = null;
+ var loc2:Set = param1.props;
+ switch(param1.operation)
+ {
+ case EventJournal.ADD:
+ this.deleteProps(loc2);
+ break;
+ case EventJournal.COPY:
+ this.deleteProps(loc2);
+ break;
+ case EventJournal.DELETE:
+ for(loc3 in loc2)
+ {
+ loc4 = loc3;
+ loc4.deselect();
+ this.addProp(loc4,loc4.coords,loc4.rotationZ,false);
+ }
+ break;
+ case EventJournal.MOVE:
+ this.moveProps(loc2,param1.oldState);
+ (param1.oldState as Point3D).multiply(-1);
+ break;
+ case EventJournal.ROTATE:
+ if(param1.oldState)
+ {
+ this.rotateCounterClockwise(loc2);
+ }
+ else
+ {
+ this.rotateClockwise(loc2);
+ }
+ param1.oldState = !param1.oldState;
+ break;
+ case EventJournal.CHANGE_TEXTURE:
+ }
+ }
+
+ public function redo(param1:EventJournalItem) : void
+ {
+ var loc3:Prop = null;
+ var loc4:* = undefined;
+ var loc2:Set = param1.props;
+ switch(param1.operation)
+ {
+ case EventJournal.ADD:
+ loc3 = loc2.peek();
+ this.addProp(loc3,loc3.coords,loc3.rotationZ,false);
+ break;
+ case EventJournal.COPY:
+ for(loc4 in loc2)
+ {
+ loc3 = loc4;
+ this.addProp(loc3,loc3.coords,loc3.rotationZ,false);
+ }
+ break;
+ case EventJournal.DELETE:
+ this.deleteProps(loc2);
+ break;
+ case EventJournal.MOVE:
+ this.moveProps(loc2,param1.oldState);
+ (param1.oldState as Point3D).multiply(-1);
+ break;
+ case EventJournal.ROTATE:
+ if(param1.oldState)
+ {
+ this.rotateCounterClockwise(loc2);
+ }
+ else
+ {
+ this.rotateClockwise(loc2);
+ }
+ param1.oldState = !param1.oldState;
+ break;
+ case EventJournal.CHANGE_TEXTURE:
+ }
+ }
+
+ public function setCameraPosition(param1:Point3D, param2:Number, param3:Number, param4:Number) : void
+ {
+ camera.coords = param1;
+ camera.rotationX = param2;
+ camera.rotationY = param3;
+ camera.rotationZ = param4;
+ }
+
+ public function showCollisionBoxes() : void
+ {
+ var loc1:* = undefined;
+ var loc2:MeshProp = null;
+ for(loc1 in root.children)
+ {
+ loc2 = loc1 as MeshProp;
+ if(loc2)
+ {
+ loc2.showCollisionBoxes();
+ }
+ }
+ }
+
+ public function hideCollisionBoxes() : void
+ {
+ var loc1:* = undefined;
+ var loc2:MeshProp = null;
+ for(loc1 in root.children)
+ {
+ loc2 = loc1 as MeshProp;
+ if(loc2)
+ {
+ loc2.hideCollisionBoxes();
+ }
+ }
+ }
+
+ public function showGrid() : void
+ {
+ root.addChild(this.grid);
+ }
+
+ public function hideGrid() : void
+ {
+ root.removeChild(this.grid);
+ }
+
+ public function showPlaneBounds() : void
+ {
+ var loc1:* = undefined;
+ var loc2:MeshProp = null;
+ for(loc1 in root.children)
+ {
+ loc2 = loc1 as MeshProp;
+ if(Boolean(loc2) && loc2.height == 0)
+ {
+ loc2.showBound();
+ }
+ }
+ }
+
+ public function hidePlaneBounds() : void
+ {
+ var loc1:* = undefined;
+ var loc2:MeshProp = null;
+ for(loc1 in root.children)
+ {
+ loc2 = loc1 as MeshProp;
+ if(Boolean(loc2) && loc2.height == 0)
+ {
+ loc2.hideBound();
+ }
+ }
+ }
+
+ public function set selectablePropTypes(param1:Array) : void
+ {
+ var loc4:* = undefined;
+ var loc5:Prop = null;
+ var loc6:* = undefined;
+ var loc7:Object3D = null;
+ this._selectablePropTypes.clear();
+ var loc2:int = int(param1.length);
+ var loc3:int = 0;
+ while(loc3 < loc2)
+ {
+ this._selectablePropTypes.add(getQualifiedClassName(param1[loc3]));
+ loc3++;
+ }
+ for(loc4 in root.children)
+ {
+ loc5 = loc4 as Prop;
+ if(loc5)
+ {
+ loc5.mouseEnabled = this.isSelectableProp(loc5);
+ for(loc6 in loc5.children)
+ {
+ loc7 = loc6 as Object3D;
+ loc7.mouseEnabled = loc5.mouseEnabled;
+ }
+ }
+ }
+ }
+
+ public function get isTexturePanel() : Boolean
+ {
+ return this.propertyPanel.contains(this.texturePanel) && this.texturePanel.selectedItem;
+ }
+
+ public function setPropertyPanel(param1:Panel) : void
+ {
+ this.propertyPanel = param1;
+ this.texturePanel = new TexturePanel();
+ this.texturePanel.addEventListener(PropListEvent.SELECT,this.onTexturePanelSelect);
+ }
+
+ public function get changed() : Boolean
+ {
+ return this._changed;
+ }
+
+ public function set changed(param1:Boolean) : void
+ {
+ this._changed = param1;
+ }
+
+ public function moveSelectedPropsByMouse(param1:Boolean) : void
+ {
+ var loc2:Point = null;
+ var loc3:Point3D = null;
+ var loc4:* = undefined;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:CameraFacing = null;
+ var loc9:Prop = null;
+ if(this.selectedProp)
+ {
+ loc2 = new Point(view.mouseX,view.mouseY);
+ for(loc4 in this.selectedProps)
+ {
+ occupyMap.free(loc4 as Prop);
+ }
+ loc5 = 0;
+ loc6 = 0;
+ loc7 = 0;
+ if(param1)
+ {
+ loc8 = getCameraFacing();
+ if(loc8 == CameraFacing.Y || loc8 == CameraFacing.NEGATIVE_Y)
+ {
+ loc3 = view.projectViewPointToPlane(loc2,ynormal,this.selectedProp.y);
+ loc5 = loc3.x - this.selectedProp.x;
+ this.selectedProp.x = loc3.x;
+ }
+ else
+ {
+ loc3 = view.projectViewPointToPlane(loc2,xnormal,this.selectedProp.x);
+ loc6 = loc3.y - this.selectedProp.y;
+ this.selectedProp.y = loc3.y;
+ }
+ loc7 = loc3.z - this.selectedProp.z;
+ this.selectedProp.z = loc3.z;
+ }
+ else
+ {
+ loc3 = view.projectViewPointToPlane(loc2,znormal,this.selectedProp.z);
+ loc5 = loc3.x - this.selectedProp.x;
+ loc6 = loc3.y - this.selectedProp.y;
+ this.selectedProp.x = loc3.x;
+ this.selectedProp.y = loc3.y;
+ }
+ for(loc4 in this.selectedProps)
+ {
+ loc9 = loc4;
+ if(loc9 != this.selectedProp)
+ {
+ loc9.x += loc5;
+ loc9.y += loc6;
+ loc9.z += loc7;
+ }
+ if(this.snapMode || loc9 is MeshProp && !(loc9 is Sprite3DProp))
+ {
+ loc9.snapToGrid();
+ occupyMap.occupy(loc9);
+ }
+ }
+ }
+ }
+
+ public function moveByArrows(param1:uint) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Prop = null;
+ for(loc2 in this.selectedProps)
+ {
+ loc3 = loc2;
+ occupyMap.free(loc3);
+ move(loc3,param1);
+ if(this.snapMode)
+ {
+ occupyMap.occupy(loc3);
+ }
+ }
+ }
+
+ public function verticalMove(param1:Boolean) : void
+ {
+ var loc3:* = undefined;
+ var loc4:Prop = null;
+ var loc2:Number = EditorScene.snapByHalf ? EditorScene.VERTICAL_GRID_RESOLUTION_2 : EditorScene.VERTICAL_GRID_RESOLUTION_1;
+ if(param1)
+ {
+ loc2 = -loc2;
+ }
+ for(loc3 in this.selectedProps)
+ {
+ loc4 = loc3;
+ occupyMap.free(loc4);
+ loc4.z += loc2;
+ if(this.snapMode)
+ {
+ occupyMap.occupy(loc4);
+ }
+ }
+ }
+
+ public function onPropMouseDown(param1:MouseEvent3D) : void
+ {
+ var loc2:Prop = null;
+ var loc3:Boolean = false;
+ if(!param1.ctrlKey)
+ {
+ loc2 = param1.object as Prop;
+ if(this.isSelectableProp(loc2))
+ {
+ loc3 = loc2.selected;
+ if(param1.shiftKey)
+ {
+ if(param1.altKey)
+ {
+ if(loc3)
+ {
+ this.deselectProp(loc2);
+ }
+ }
+ else if(!loc3)
+ {
+ this.selectProp(loc2);
+ }
+ }
+ else if(!loc3)
+ {
+ this.deselectProps();
+ this.selectProp(loc2);
+ }
+ else
+ {
+ this.selectedProp = loc2;
+ }
+ this.propMouseDown = true;
+ }
+ }
+ }
+
+ public function deselectProps() : void
+ {
+ while(!this.selectedProps.isEmpty())
+ {
+ this.deselectProp(this.selectedProps.peek());
+ }
+ this.selectedProps.clear();
+ this.selectedProp = null;
+ this.hidePropertyPanelItem(this.bonusTypesPanel);
+ this.hidePropertyPanelItem(this.texturePanel);
+ }
+
+ public function deselectProp(param1:Prop) : void
+ {
+ param1.deselect();
+ this.selectedProps.remove(param1);
+ if(param1 == this.selectedProp)
+ {
+ this.selectedProp = null;
+ }
+ var loc2:Boolean = this.isOneBonusSelected();
+ if(loc2)
+ {
+ this.showPropertyPanelItem(this.bonusTypesPanel);
+ }
+ else
+ {
+ this.hidePropertyPanelItem(this.bonusTypesPanel);
+ }
+ if(!loc2 && Boolean(this.noConflictBitmaps()))
+ {
+ this.showPropertyPanelItem(this.texturePanel);
+ }
+ else
+ {
+ this.hidePropertyPanelItem(this.texturePanel);
+ }
+ if(param1 is BonusRegion && (param1 as BonusRegion).gameModes.length < 1)
+ {
+ this.deleteProp(param1);
+ }
+ }
+
+ public function selectProps(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Prop = null;
+ this.deselectProps();
+ for(loc2 in param1)
+ {
+ loc3 = loc2;
+ if(this.isSelectableProp(loc3))
+ {
+ loc3.select();
+ this.selectedProps.add(loc3);
+ this.selectedProp = loc3;
+ }
+ }
+ this.showPropertyPanel();
+ }
+
+ public function selectConflictingProps() : void
+ {
+ this.selectProps(occupyMap.getConflictProps());
+ }
+
+ public function selectProp(param1:Prop) : void
+ {
+ if(this.isSelectableProp(param1))
+ {
+ param1.select();
+ this.selectedProps.add(param1);
+ this.selectedProp = param1;
+ this.showPropertyPanel();
+ }
+ }
+
+ public function getPropsUnderRect(param1:Point, param2:Number, param3:Number, param4:Boolean) : Set
+ {
+ var loc6:* = undefined;
+ var loc7:Prop = null;
+ var loc8:Point3D = null;
+ var loc5:Set = new Set();
+ for(loc6 in root.children)
+ {
+ loc7 = loc6 as Prop;
+ if((Boolean(loc7)) && this.isSelectableProp(loc7))
+ {
+ loc8 = view.projectPoint(loc7.coords);
+ if(loc8.x >= param1.x && loc8.x <= param1.x + param2 && loc8.y >= param1.y && loc8.y <= param1.y + param3)
+ {
+ if(param4)
+ {
+ if(!loc7.selected)
+ {
+ loc7.select();
+ }
+ }
+ else if(loc7.selected)
+ {
+ loc7.deselect();
+ }
+ loc5.add(loc7);
+ }
+ }
+ }
+ return loc5;
+ }
+
+ public function addProp(param1:Prop, param2:Point3D, param3:Number, param4:Boolean = true, param5:Boolean = true) : Prop
+ {
+ var loc6:Prop = null;
+ var loc7:* = undefined;
+ var loc8:Object3D = null;
+ if(param4)
+ {
+ loc6 = param1.clone() as Prop;
+ loc6.rotationZ = param3;
+ }
+ else
+ {
+ loc6 = param1;
+ }
+ root.addChild(loc6);
+ loc6.onAddedToScene();
+ if(loc6 is ControlPoint)
+ {
+ this.dominationPoints[loc6] = true;
+ }
+ if(param3 != 0 && param4)
+ {
+ loc6.calculate();
+ }
+ loc6.x = param2.x;
+ loc6.y = param2.y;
+ loc6.z = param2.z;
+ loc6.addEventListener(MouseEvent3D.MOUSE_DOWN,this.onPropMouseDown);
+ loc6.addEventListener(MouseEvent3D.MOUSE_OUT,this.onPropMouseOut);
+ loc6.addEventListener(MouseEvent3D.MOUSE_OVER,this.onPropMouseOver);
+ this._changed = true;
+ if(this.snapMode && param5)
+ {
+ occupyMap.occupy(loc6);
+ }
+ loc6.mouseEnabled = this.isSelectableProp(loc6);
+ for(loc7 in loc6.children)
+ {
+ loc8 = loc7 as Object3D;
+ loc8.mouseEnabled = loc6.mouseEnabled;
+ }
+ this.addPropToLayer(loc6);
+ return loc6;
+ }
+
+ private function addPropToLayer(param1:Prop, param2:String = null) : void
+ {
+ var loc3:BonusRegion = null;
+ var loc4:String = null;
+ if(!param2)
+ {
+ if(param1 is BonusRegion)
+ {
+ loc3 = BonusRegion(param1);
+ for(loc4 in loc3.gameModes)
+ {
+ this.layers.addProp(loc4,param1);
+ }
+ }
+ param2 = FunctionalProps.getPropLayer(param1);
+ }
+ if(param2 != null)
+ {
+ this.layers.addProp(param2,param1);
+ this.checkPropVisibility(param1);
+ }
+ }
+
+ private function checkPropVisibility(param1:Prop) : void
+ {
+ var loc3:* = undefined;
+ var loc2:Boolean = false;
+ for each(loc3 in this.layers.getLayersContainingProp(param1))
+ {
+ if(loc3.visible)
+ {
+ loc2 = true;
+ }
+ }
+ if(!loc2)
+ {
+ this.hideProp(param1);
+ }
+ else
+ {
+ this.showProp(param1);
+ }
+ }
+
+ private function removePropFromLayer(param1:Prop, param2:String) : void
+ {
+ if(param2 != null)
+ {
+ this.layers.removeProp(param1,param2);
+ this.checkPropVisibility(param1);
+ }
+ }
+
+ private function hideProp(param1:Prop) : void
+ {
+ var loc2:Set = new Set();
+ loc2.add(param1);
+ this.hideProps(loc2);
+ }
+
+ private function deleteProp(param1:Prop) : void
+ {
+ var loc2:Set = new Set();
+ loc2.add(param1);
+ this.deleteProps(loc2);
+ }
+
+ private function showProp(param1:Prop) : void
+ {
+ var loc2:Set = new Set();
+ loc2.add(param1);
+ this.showProps(loc2);
+ }
+
+ public function deleteProps(param1:Set = null) : Set
+ {
+ var loc2:Set = null;
+ var loc3:int = 0;
+ var loc4:* = undefined;
+ var loc5:Prop = null;
+ if(!param1)
+ {
+ param1 = this.selectedProps;
+ this.selectedProp = null;
+ }
+ if(param1)
+ {
+ loc2 = param1.clone();
+ for(loc4 in loc2)
+ {
+ loc5 = loc4;
+ loc3++;
+ root.removeChild(loc5);
+ occupyMap.free(loc5);
+ if(this.selectedProps.has(loc5))
+ {
+ this.deselectProp(loc5);
+ }
+ this.layers.removeProp(loc5);
+ if(loc5 is ControlPoint)
+ {
+ delete this.dominationPoints[loc5];
+ ControlPoint(loc5).unlinkSpawnPoints();
+ }
+ else if(loc5 is SpawnPoint)
+ {
+ if(SpawnPoint(loc5).name == FunctionalProps.DOMINATION_SPAWN)
+ {
+ if(loc5.data != null)
+ {
+ ControlPoint(loc5.data).removeSpawnPoint(SpawnPoint(loc5));
+ }
+ }
+ }
+ }
+ this.hidePropertyPanelItem(this.bonusTypesPanel);
+ this.hidePropertyPanelItem(this.texturePanel);
+ this.propMouseDown = false;
+ this._changed = true;
+ }
+ return loc2;
+ }
+
+ public function clear() : void
+ {
+ var loc1:* = undefined;
+ var loc2:Prop = null;
+ for(loc1 in root.children)
+ {
+ loc2 = loc1 as Prop;
+ if(loc2)
+ {
+ root.removeChild(loc2);
+ }
+ }
+ this.selectedProp = null;
+ this.selectedProps.clear();
+ occupyMap.clear();
+ this.layers.clear();
+ view.interactive = true;
+ this.dominationPoints = new Dictionary();
+ }
+
+ public function onTexturePanelSelect(param1:PropListEvent = null) : void
+ {
+ var loc2:* = undefined;
+ var loc3:MeshProp = null;
+ for(loc2 in this.selectedProps)
+ {
+ loc3 = loc2;
+ if(Boolean(loc3) && Boolean(loc3.bitmaps))
+ {
+ loc3.textureName = this.texturePanel.selectedItem;
+ }
+ }
+ }
+
+ public function showPropertyPanel() : void
+ {
+ var loc1:Map = null;
+ this.hideAllPropertyPanelItems();
+ if(this.isOneBonusSelected())
+ {
+ this.showPropertyPanelItem(this.bonusTypesPanel);
+ this.bonusTypesPanel.setBonusRegion(FreeBonusRegion(this.selectedProps.peek()));
+ }
+ else if(this.isControlPointSelected())
+ {
+ this.showPropertyPanelItem(this.controlPointNameField);
+ this.controlPointNameField.setControlPoint(ControlPoint(this.selectedProp));
+ }
+ else if(this.isOneKillZoneSelected())
+ {
+ this.showPropertyPanelItem(this.killZonePanel);
+ this.killZonePanel.setBonusRegion(KillBox(this.selectedProp));
+ }
+ else
+ {
+ this.bonusTypesPanel.setBonusRegion(null);
+ loc1 = this.noConflictBitmaps();
+ if(loc1)
+ {
+ this.showTexturePanel(loc1);
+ }
+ }
+ }
+
+ private function showTexturePanel(param1:Map) : void
+ {
+ this.showPropertyPanelItem(this.texturePanel);
+ if(param1 != this.currentBitmaps)
+ {
+ this.texturePanel.fill(param1);
+ this.currentBitmaps = param1;
+ }
+ }
+
+ private function isControlPointSelected() : Boolean
+ {
+ return this.selectedProps.length == 1 && this.selectedProp is ControlPoint;
+ }
+
+ public function mirrorTextures() : void
+ {
+ var loc1:* = undefined;
+ var loc2:MeshProp = null;
+ for(loc1 in this.selectedProps)
+ {
+ loc2 = loc1 as MeshProp;
+ if(loc2 != null)
+ {
+ loc2.mirrorTexture();
+ }
+ }
+ }
+
+ private function hideProps(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Prop = null;
+ for(loc2 in param1)
+ {
+ loc3 = loc2;
+ if(!loc3.free)
+ {
+ occupyMap.free(loc3);
+ loc3.free = true;
+ }
+ loc3.hide();
+ }
+ }
+
+ private function showProps(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Prop = null;
+ for(loc2 in param1)
+ {
+ loc3 = loc2;
+ loc3.show();
+ occupyMap.occupy(loc3);
+ }
+ }
+
+ public function hideSelectedProps() : void
+ {
+ var loc2:* = undefined;
+ var loc3:Prop = null;
+ var loc1:Set = this.selectedProps.clone();
+ this.deselectProps();
+ for(loc2 in loc1)
+ {
+ loc3 = loc2;
+ this.hiddenProps.push(loc3);
+ if(!loc3.free)
+ {
+ occupyMap.free(loc3);
+ loc3.free = true;
+ }
+ loc3.hide();
+ }
+ }
+
+ public function showAll() : void
+ {
+ var loc3:Prop = null;
+ var loc1:int = int(this.hiddenProps.length);
+ var loc2:int = 0;
+ while(loc2 < loc1)
+ {
+ loc3 = this.hiddenProps[loc2];
+ loc3.show();
+ occupyMap.occupy(loc3);
+ loc2++;
+ }
+ this.hiddenProps.length = 0;
+ }
+
+ public function rotateCounterClockwise(param1:Set = null) : void
+ {
+ if(!param1)
+ {
+ param1 = this.selectedProps;
+ }
+ this.freeProps(param1);
+ rotatePropsCounterClockwise(param1);
+ if(this.snapMode)
+ {
+ snapPropsToGrid(param1);
+ }
+ this._changed = true;
+ }
+
+ public function rotateClockwise(param1:Set = null) : void
+ {
+ if(!param1)
+ {
+ param1 = this.selectedProps;
+ }
+ this.freeProps(param1);
+ rotatePropsClockwise(param1);
+ if(this.snapMode)
+ {
+ snapPropsToGrid(param1);
+ }
+ this._changed = true;
+ }
+
+ private function freeProps(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ for(loc2 in param1)
+ {
+ occupyMap.free(loc2);
+ }
+ }
+
+ private function isSelectableProp(param1:Prop) : Boolean
+ {
+ return !param1.hidden && this._selectablePropTypes.has(getQualifiedClassName(param1));
+ }
+
+ private function showPropertyPanelItem(param1:DisplayObject) : void
+ {
+ if(!this.propertyPanel.contains(param1))
+ {
+ this.propertyPanel.addChild(param1);
+ }
+ }
+
+ private function hidePropertyPanelItem(param1:DisplayObject) : void
+ {
+ if(this.propertyPanel.contains(param1))
+ {
+ this.propertyPanel.removeChild(param1);
+ }
+ }
+
+ private function hideAllPropertyPanelItems() : void
+ {
+ this.propertyPanel.removeAllChildren();
+ }
+
+ private function onPropMouseOut(param1:MouseEvent3D) : void
+ {
+ view.useHandCursor = false;
+ }
+
+ private function onPropMouseOver(param1:MouseEvent3D) : void
+ {
+ view.useHandCursor = true;
+ }
+
+ private function noConflictBitmaps() : Map
+ {
+ var loc1:Map = null;
+ var loc2:* = undefined;
+ var loc3:MeshProp = null;
+ for(loc2 in this.selectedProps)
+ {
+ loc3 = loc2 as MeshProp;
+ if(Boolean(loc3) && Boolean(loc3.bitmaps))
+ {
+ if(!loc1)
+ {
+ loc1 = loc3.bitmaps;
+ }
+ else if(loc1 != loc3.bitmaps)
+ {
+ return null;
+ }
+ }
+ }
+ return loc1;
+ }
+
+ private function isOneBonusSelected() : Boolean
+ {
+ if(this.selectedProps.length > 1)
+ {
+ return false;
+ }
+ var loc1:Prop = this.selectedProps.peek();
+ return loc1 is FreeBonusRegion;
+ }
+
+ private function isOneKillZoneSelected() : Boolean
+ {
+ if(this.selectedProps.length > 1)
+ {
+ return false;
+ }
+ var loc1:KillBox = this.selectedProps.peek() as KillBox;
+ return loc1 != null;
+ }
+
+ public function drawDominationLinks(param1:Graphics) : void
+ {
+ var loc2:* = undefined;
+ param1.clear();
+ if(this.layers.getLayer(LayerNames.DOMINATION).visible)
+ {
+ for(loc2 in this.dominationPoints)
+ {
+ this.drawDominationPointLinks(param1,loc2);
+ }
+ }
+ }
+
+ private function drawDominationPointLinks(param1:Graphics, param2:ControlPoint) : void
+ {
+ var loc4:SpawnPoint = null;
+ var loc5:Point3D = null;
+ param1.lineStyle(0,65280);
+ var loc3:Point3D = view.projectPoint(param2.coords);
+ for each(loc4 in param2.getSpawnPoints())
+ {
+ loc5 = view.projectPoint(loc4.coords);
+ GraphicUtils.drawLine(param1,loc3,loc5);
+ }
+ }
+
+ public function selectAll() : void
+ {
+ }
+
+ private function onLayerContentChange(param1:LayerContentChangeEvent) : void
+ {
+ if(param1.layerContainsProp)
+ {
+ this.addPropToLayer(param1.prop,param1.layerName);
+ }
+ else
+ {
+ this.removePropFromLayer(param1.prop,param1.layerName);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/editor/scene/OccupyMap.as b/src/alternativa/editor/scene/OccupyMap.as
new file mode 100644
index 0000000..97b2297
--- /dev/null
+++ b/src/alternativa/editor/scene/OccupyMap.as
@@ -0,0 +1,332 @@
+package alternativa.editor.scene
+{
+ import alternativa.editor.prop.Prop;
+ import alternativa.types.Map;
+ import alternativa.types.Set;
+
+ public class OccupyMap
+ {
+ private var map:Map;
+
+ public function OccupyMap()
+ {
+ super();
+ this.map = new Map();
+ }
+
+ public function occupy(param1:Prop) : void
+ {
+ var loc2:Number = NaN;
+ var loc3:Number = NaN;
+ var loc4:Map = null;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Set = null;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ if(param1.free)
+ {
+ loc2 = param1.distancesZ.x + param1.z;
+ loc3 = param1.distancesZ.y + param1.z;
+ loc4 = new Map();
+ loc5 = loc2;
+ while(loc5 < loc3)
+ {
+ loc4.add(loc5,[param1]);
+ loc5 += EditorScene.vBase;
+ }
+ loc6 = param1.distancesY.x + param1.y;
+ loc7 = param1.distancesY.y + param1.y;
+ loc8 = new Set();
+ loc5 = loc6;
+ while(loc5 < loc7)
+ {
+ loc8.add(loc5);
+ loc5 += EditorScene.hBase;
+ }
+ loc9 = param1.distancesX.x + param1.x;
+ loc10 = param1.distancesX.y + param1.x;
+ loc11 = loc9;
+ while(loc11 < loc10)
+ {
+ loc12 = loc6;
+ while(loc12 < loc7)
+ {
+ loc13 = loc2;
+ while(loc13 < loc3)
+ {
+ this.addElement(loc11,loc12,loc13,param1);
+ loc13 += EditorScene.vBase;
+ }
+ loc12 += EditorScene.hBase;
+ }
+ loc11 += EditorScene.hBase;
+ }
+ param1.free = false;
+ }
+ }
+
+ public function addElement(param1:Number, param2:Number, param3:Number, param4:Prop) : void
+ {
+ var loc5:Map = this.map[param1];
+ if(!loc5)
+ {
+ loc5 = new Map();
+ this.map[param1] = loc5;
+ }
+ var loc6:Map = loc5[param2];
+ if(!loc6)
+ {
+ loc6 = new Map();
+ loc5[param2] = loc6;
+ }
+ var loc7:Array = loc6[param3];
+ if(!loc7)
+ {
+ loc6.add(param3,[param4]);
+ }
+ else
+ {
+ loc7.push(param4);
+ }
+ }
+
+ public function free(param1:Prop) : void
+ {
+ var loc2:Number = NaN;
+ var loc3:Number = NaN;
+ var loc4:Set = null;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Set = null;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Map = null;
+ var loc12:* = undefined;
+ var loc13:Number = NaN;
+ var loc14:Map = null;
+ var loc15:* = undefined;
+ var loc16:Number = NaN;
+ var loc17:Array = null;
+ var loc18:int = 0;
+ if(!param1.free)
+ {
+ loc2 = param1.distancesZ.x + param1.z;
+ loc3 = param1.distancesZ.y + param1.z;
+ loc4 = new Set();
+ loc5 = loc2;
+ while(loc5 < loc3)
+ {
+ loc4.add(loc5);
+ loc5 += EditorScene.vBase;
+ }
+ loc6 = param1.distancesY.x + param1.y;
+ loc7 = param1.distancesY.y + param1.y;
+ loc8 = new Set();
+ loc5 = loc6;
+ while(loc5 < loc7)
+ {
+ loc8.add(loc5);
+ loc5 += EditorScene.hBase;
+ }
+ loc9 = param1.distancesX.x + param1.x;
+ loc10 = param1.distancesX.y + param1.x;
+ loc5 = loc9;
+ while(loc5 < loc10)
+ {
+ loc11 = this.map[loc5];
+ if(loc11)
+ {
+ for(loc12 in loc8)
+ {
+ loc13 = loc12;
+ loc14 = loc11[loc13];
+ if(loc14)
+ {
+ for(loc15 in loc4)
+ {
+ loc16 = loc15;
+ loc17 = loc14[loc16];
+ if(loc17)
+ {
+ loc18 = int(loc17.indexOf(param1));
+ if(loc18 > -1)
+ {
+ loc17.splice(loc18,1);
+ if(loc17.length == 0)
+ {
+ loc14.remove(loc16);
+ }
+ }
+ }
+ }
+ if(loc14.length == 0)
+ {
+ loc11.remove(loc13);
+ }
+ }
+ }
+ if(loc11.length == 0)
+ {
+ this.map.remove(loc5);
+ }
+ }
+ loc5 += EditorScene.hBase;
+ }
+ param1.free = true;
+ }
+ }
+
+ public function isOccupy(param1:Number, param2:Number, param3:Number) : Array
+ {
+ var loc5:Map = null;
+ var loc4:Map = this.map[param1];
+ if(loc4)
+ {
+ loc5 = loc4[param2];
+ if(loc5)
+ {
+ if(loc5.hasKey(param3))
+ {
+ return loc5[param3];
+ }
+ }
+ }
+ return null;
+ }
+
+ public function clear() : void
+ {
+ this.map.clear();
+ }
+
+ public function isConflict(param1:Prop) : Boolean
+ {
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Number = NaN;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Array = null;
+ var loc2:Number = param1.distancesX.x + param1.x;
+ var loc3:Number = param1.distancesX.y + param1.x;
+ var loc4:Number = loc2;
+ while(loc4 < loc3)
+ {
+ loc5 = param1.distancesY.x + param1.y;
+ loc6 = param1.distancesY.y + param1.y;
+ loc7 = loc5;
+ while(loc7 < loc6)
+ {
+ loc8 = param1.distancesZ.x + param1.z;
+ loc9 = param1.distancesZ.y + param1.z;
+ loc10 = loc8;
+ while(loc10 < loc9)
+ {
+ loc11 = this.isOccupy(loc4,loc7,loc10);
+ if((Boolean(loc11)) && (loc11.indexOf(param1) == -1 || loc11.length > 1))
+ {
+ return true;
+ }
+ loc10 += EditorScene.vBase;
+ }
+ loc7 += EditorScene.hBase;
+ }
+ loc4 += EditorScene.hBase;
+ }
+ return false;
+ }
+
+ public function isConflictGroup(param1:Prop) : Boolean
+ {
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Number = NaN;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Array = null;
+ var loc12:int = 0;
+ var loc13:int = 0;
+ var loc14:Prop = null;
+ var loc2:Number = param1.distancesX.x + param1.x;
+ var loc3:Number = param1.distancesX.y + param1.x;
+ var loc4:Number = loc2;
+ while(loc4 < loc3)
+ {
+ loc5 = param1.distancesY.x + param1.y;
+ loc6 = param1.distancesY.y + param1.y;
+ loc7 = loc5;
+ while(loc7 < loc6)
+ {
+ loc8 = param1.distancesZ.x + param1.z;
+ loc9 = param1.distancesZ.y + param1.z;
+ loc10 = loc8;
+ while(loc10 < loc9)
+ {
+ loc11 = this.isOccupy(loc4,loc7,loc10);
+ if(loc11)
+ {
+ loc12 = int(loc11.length);
+ loc13 = 0;
+ while(loc13 < loc12)
+ {
+ loc14 = loc11[loc13];
+ if(loc14 != param1 && loc14.groupName == param1.groupName)
+ {
+ return true;
+ }
+ loc13++;
+ }
+ }
+ loc10 += EditorScene.vBase;
+ }
+ loc7 += EditorScene.hBase;
+ }
+ loc4 += EditorScene.hBase;
+ }
+ return false;
+ }
+
+ public function getConflictProps() : Set
+ {
+ var loc2:* = undefined;
+ var loc3:Map = null;
+ var loc4:* = undefined;
+ var loc5:Map = null;
+ var loc6:* = undefined;
+ var loc7:Array = null;
+ var loc8:int = 0;
+ var loc1:Set = new Set();
+ for(loc2 in this.map)
+ {
+ loc3 = this.map[loc2];
+ for(loc4 in loc3)
+ {
+ loc5 = loc3[loc4];
+ for(loc6 in loc5)
+ {
+ loc7 = loc5[loc6];
+ if((Boolean(loc7)) && loc7.length > 1)
+ {
+ loc8 = 0;
+ while(loc8 < loc7.length)
+ {
+ loc1.add(loc7[loc8]);
+ loc8++;
+ }
+ }
+ }
+ }
+ }
+ return loc1;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/alternativa3d.as b/src/alternativa/engine3d/alternativa3d.as
new file mode 100644
index 0000000..2488cf0
--- /dev/null
+++ b/src/alternativa/engine3d/alternativa3d.as
@@ -0,0 +1,5 @@
+package alternativa.engine3d
+{
+ public namespace alternativa3d = "http://alternativaplatform.com/en/alternativa3d";
+}
+
diff --git a/src/alternativa/engine3d/controllers/ObjectController.as b/src/alternativa/engine3d/controllers/ObjectController.as
new file mode 100644
index 0000000..b0fa6c3
--- /dev/null
+++ b/src/alternativa/engine3d/controllers/ObjectController.as
@@ -0,0 +1,569 @@
+package alternativa.engine3d.controllers
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.physics.EllipsoidCollider;
+ import alternativa.types.Map;
+ import alternativa.types.Point3D;
+ import alternativa.utils.ObjectUtils;
+ import flash.display.DisplayObject;
+ import flash.events.KeyboardEvent;
+ import flash.events.MouseEvent;
+ import flash.utils.getTimer;
+
+ use namespace alternativa3d;
+
+ public class ObjectController
+ {
+ public static const ACTION_FORWARD:String = "ACTION_FORWARD";
+
+ public static const ACTION_BACK:String = "ACTION_BACK";
+
+ public static const ACTION_LEFT:String = "ACTION_LEFT";
+
+ public static const ACTION_RIGHT:String = "ACTION_RIGHT";
+
+ public static const ACTION_UP:String = "ACTION_UP";
+
+ public static const ACTION_DOWN:String = "ACTION_DOWN";
+
+ public static const ACTION_PITCH_UP:String = "ACTION_PITCH_UP";
+
+ public static const ACTION_PITCH_DOWN:String = "ACTION_PITCH_DOWN";
+
+ public static const ACTION_YAW_LEFT:String = "ACTION_YAW_LEFT";
+
+ public static const ACTION_YAW_RIGHT:String = "ACTION_YAW_RIGHT";
+
+ public static const ACTION_ACCELERATE:String = "ACTION_ACCELERATE";
+
+ public static const ACTION_MOUSE_LOOK:String = "ACTION_MOUSE_LOOK";
+
+ protected var _forward:Boolean;
+
+ protected var _back:Boolean;
+
+ protected var _left:Boolean;
+
+ protected var _right:Boolean;
+
+ protected var _up:Boolean;
+
+ protected var _down:Boolean;
+
+ protected var _pitchUp:Boolean;
+
+ protected var _pitchDown:Boolean;
+
+ protected var _yawLeft:Boolean;
+
+ protected var _yawRight:Boolean;
+
+ protected var _accelerate:Boolean;
+
+ protected var _mouseLookActive:Boolean;
+
+ protected var startMouseCoords:Point3D;
+
+ protected var _enabled:Boolean = true;
+
+ protected var _eventsSource:DisplayObject;
+
+ protected var keyBindings:Map;
+
+ protected var actionBindings:Map;
+
+ protected var _keyboardEnabled:Boolean;
+
+ protected var _mouseEnabled:Boolean;
+
+ protected var _mouseSensitivity:Number = 1;
+
+ protected var _mouseSensitivityY:Number = 0.008726646259971648;
+
+ protected var _mouseSensitivityX:Number = 0.008726646259971648;
+
+ protected var _mouseCoefficientY:Number;
+
+ protected var _mouseCoefficientX:Number;
+
+ protected var _pitchSpeed:Number = 1;
+
+ protected var _yawSpeed:Number = 1;
+
+ protected var _speed:Number = 100;
+
+ protected var _speedMultiplier:Number = 2;
+
+ protected var _object:Object3D;
+
+ protected var lastFrameTime:uint;
+
+ protected var _coords:Point3D;
+
+ protected var _isMoving:Boolean;
+
+ protected var _collider:EllipsoidCollider;
+
+ public var checkCollisions:Boolean;
+
+ public var onStartMoving:Function;
+
+ public var onStopMoving:Function;
+
+ private var _displacement:Point3D;
+
+ public function ObjectController(param1:DisplayObject)
+ {
+ this.startMouseCoords = new Point3D();
+ this.keyBindings = new Map();
+ this.actionBindings = new Map();
+ this._mouseCoefficientY = this._mouseSensitivity * this._mouseSensitivityY;
+ this._mouseCoefficientX = this._mouseSensitivity * this._mouseSensitivityX;
+ this._coords = new Point3D();
+ this._collider = new EllipsoidCollider();
+ this._displacement = new Point3D();
+ super();
+ if(param1 == null)
+ {
+ throw new ArgumentError(ObjectUtils.getClassName(this) + ": eventsSourceObject is null");
+ }
+ this._eventsSource = param1;
+ this.actionBindings[ACTION_FORWARD] = this.moveForward;
+ this.actionBindings[ACTION_BACK] = this.moveBack;
+ this.actionBindings[ACTION_LEFT] = this.moveLeft;
+ this.actionBindings[ACTION_RIGHT] = this.moveRight;
+ this.actionBindings[ACTION_UP] = this.moveUp;
+ this.actionBindings[ACTION_DOWN] = this.moveDown;
+ this.actionBindings[ACTION_PITCH_UP] = this.pitchUp;
+ this.actionBindings[ACTION_PITCH_DOWN] = this.pitchDown;
+ this.actionBindings[ACTION_YAW_LEFT] = this.yawLeft;
+ this.actionBindings[ACTION_YAW_RIGHT] = this.yawRight;
+ this.actionBindings[ACTION_ACCELERATE] = this.accelerate;
+ this.actionBindings[ACTION_MOUSE_LOOK] = this.setMouseLook;
+ this.keyboardEnabled = true;
+ this.mouseEnabled = true;
+ }
+
+ public function get enabled() : Boolean
+ {
+ return this._enabled;
+ }
+
+ public function set enabled(param1:Boolean) : void
+ {
+ this._enabled = param1;
+ if(this._enabled)
+ {
+ if(this._mouseEnabled)
+ {
+ this.registerMouseListeners();
+ }
+ if(this._keyboardEnabled)
+ {
+ this.registerKeyboardListeners();
+ }
+ }
+ else
+ {
+ if(this._mouseEnabled)
+ {
+ this.unregisterMouseListeners();
+ this.setMouseLook(false);
+ }
+ if(this._keyboardEnabled)
+ {
+ this.unregisterKeyboardListeners();
+ }
+ }
+ }
+
+ public function get coords() : Point3D
+ {
+ return this._coords.clone();
+ }
+
+ public function set coords(param1:Point3D) : void
+ {
+ this._coords.copy(param1);
+ this.setObjectCoords();
+ }
+
+ public function readCoords(param1:Point3D) : void
+ {
+ param1.copy(this._coords);
+ }
+
+ public function get object() : Object3D
+ {
+ return this._object;
+ }
+
+ public function set object(param1:Object3D) : void
+ {
+ this._object = param1;
+ this._collider.scene = this._object == null ? null : this._object.scene;
+ this.setObjectCoords();
+ }
+
+ public function get collider() : EllipsoidCollider
+ {
+ return this._collider;
+ }
+
+ public function moveForward(param1:Boolean) : void
+ {
+ this._forward = param1;
+ }
+
+ public function moveBack(param1:Boolean) : void
+ {
+ this._back = param1;
+ }
+
+ public function moveLeft(param1:Boolean) : void
+ {
+ this._left = param1;
+ }
+
+ public function moveRight(param1:Boolean) : void
+ {
+ this._right = param1;
+ }
+
+ public function moveUp(param1:Boolean) : void
+ {
+ this._up = param1;
+ }
+
+ public function moveDown(param1:Boolean) : void
+ {
+ this._down = param1;
+ }
+
+ public function pitchUp(param1:Boolean) : void
+ {
+ this._pitchUp = param1;
+ }
+
+ public function pitchDown(param1:Boolean) : void
+ {
+ this._pitchDown = param1;
+ }
+
+ public function yawLeft(param1:Boolean) : void
+ {
+ this._yawLeft = param1;
+ }
+
+ public function yawRight(param1:Boolean) : void
+ {
+ this._yawRight = param1;
+ }
+
+ public function accelerate(param1:Boolean) : void
+ {
+ this._accelerate = param1;
+ }
+
+ public function get pitchSpeed() : Number
+ {
+ return this._pitchSpeed;
+ }
+
+ public function set pitchSpeed(param1:Number) : void
+ {
+ this._pitchSpeed = param1;
+ }
+
+ public function get yawSpeed() : Number
+ {
+ return this._yawSpeed;
+ }
+
+ public function set yawSpeed(param1:Number) : void
+ {
+ this._yawSpeed = param1;
+ }
+
+ public function get speed() : Number
+ {
+ return this._speed;
+ }
+
+ public function set speed(param1:Number) : void
+ {
+ this._speed = param1 < 0 ? -param1 : param1;
+ }
+
+ public function get speedMultiplier() : Number
+ {
+ return this._speedMultiplier;
+ }
+
+ public function set speedMultiplier(param1:Number) : void
+ {
+ this._speedMultiplier = param1;
+ }
+
+ public function get mouseSensitivity() : Number
+ {
+ return this._mouseSensitivity;
+ }
+
+ public function set mouseSensitivity(param1:Number) : void
+ {
+ this._mouseSensitivity = param1;
+ this._mouseCoefficientY = this._mouseSensitivity * this._mouseSensitivityY;
+ this._mouseCoefficientX = this._mouseSensitivity * this._mouseSensitivityX;
+ }
+
+ public function get mouseSensitivityY() : Number
+ {
+ return this._mouseSensitivityY;
+ }
+
+ public function set mouseSensitivityY(param1:Number) : void
+ {
+ this._mouseSensitivityY = param1;
+ this._mouseCoefficientY = this._mouseSensitivity * this._mouseSensitivityY;
+ }
+
+ public function get mouseSensitivityX() : Number
+ {
+ return this._mouseSensitivityX;
+ }
+
+ public function set mouseSensitivityX(param1:Number) : void
+ {
+ this._mouseSensitivityX = param1;
+ this._mouseCoefficientX = this._mouseSensitivity * this._mouseSensitivityX;
+ }
+
+ public function setMouseLook(param1:Boolean) : void
+ {
+ if(this._mouseLookActive != param1)
+ {
+ this._mouseLookActive = param1;
+ if(this._mouseLookActive)
+ {
+ this.startMouseLook();
+ }
+ else
+ {
+ this.stopMouseLook();
+ }
+ }
+ }
+
+ protected function startMouseLook() : void
+ {
+ this.startMouseCoords.x = this._eventsSource.stage.mouseX;
+ this.startMouseCoords.y = this._eventsSource.stage.mouseY;
+ }
+
+ protected function stopMouseLook() : void
+ {
+ }
+
+ public function processInput() : void
+ {
+ if(!this._enabled || this._object == null)
+ {
+ return;
+ }
+ var loc1:Number = getTimer() - this.lastFrameTime;
+ if(loc1 == 0)
+ {
+ return;
+ }
+ this.lastFrameTime += loc1;
+ if(loc1 > 100)
+ {
+ loc1 = 100;
+ }
+ loc1 /= 1000;
+ this.rotateObject(loc1);
+ this.getDisplacement(loc1,this._displacement);
+ this.applyDisplacement(loc1,this._displacement);
+ if(this._object.alternativa3d::changeRotationOrScaleOperation.alternativa3d::queued || this._object.alternativa3d::changeCoordsOperation.alternativa3d::queued)
+ {
+ if(!this._isMoving)
+ {
+ this._isMoving = true;
+ if(this.onStartMoving != null)
+ {
+ this.onStartMoving.call(this);
+ }
+ }
+ }
+ else if(this._isMoving)
+ {
+ this._isMoving = false;
+ if(this.onStopMoving != null)
+ {
+ this.onStopMoving.call(this);
+ }
+ }
+ }
+
+ protected function rotateObject(param1:Number) : void
+ {
+ }
+
+ protected function getDisplacement(param1:Number, param2:Point3D) : void
+ {
+ }
+
+ protected function applyDisplacement(param1:Number, param2:Point3D) : void
+ {
+ }
+
+ public function bindKey(param1:uint, param2:String) : void
+ {
+ var loc3:Function = this.actionBindings[param2];
+ if(loc3 != null)
+ {
+ this.keyBindings[param1] = loc3;
+ }
+ }
+
+ public function unbindKey(param1:uint) : void
+ {
+ this.keyBindings.remove(param1);
+ }
+
+ public function unbindAll() : void
+ {
+ this.keyBindings.clear();
+ }
+
+ public function setDefaultBindings() : void
+ {
+ }
+
+ public function get keyboardEnabled() : Boolean
+ {
+ return this._keyboardEnabled;
+ }
+
+ public function set keyboardEnabled(param1:Boolean) : void
+ {
+ if(this._keyboardEnabled != param1)
+ {
+ this._keyboardEnabled = param1;
+ if(this._keyboardEnabled)
+ {
+ if(this._enabled)
+ {
+ this.registerKeyboardListeners();
+ }
+ }
+ else
+ {
+ this.unregisterKeyboardListeners();
+ }
+ }
+ }
+
+ private function onKeyboardEvent(param1:KeyboardEvent) : void
+ {
+ var loc2:Function = this.keyBindings[param1.keyCode];
+ if(loc2 != null)
+ {
+ loc2.call(this,param1.type == KeyboardEvent.KEY_DOWN);
+ }
+ }
+
+ protected function registerKeyboardListeners() : void
+ {
+ this._eventsSource.addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyboardEvent);
+ this._eventsSource.addEventListener(KeyboardEvent.KEY_UP,this.onKeyboardEvent);
+ }
+
+ protected function unregisterKeyboardListeners() : void
+ {
+ this.clearCommandFlags();
+ this._eventsSource.removeEventListener(KeyboardEvent.KEY_DOWN,this.onKeyboardEvent);
+ this._eventsSource.removeEventListener(KeyboardEvent.KEY_UP,this.onKeyboardEvent);
+ }
+
+ public function get mouseEnabled() : Boolean
+ {
+ return this._mouseEnabled;
+ }
+
+ public function set mouseEnabled(param1:Boolean) : void
+ {
+ if(this._mouseEnabled != param1)
+ {
+ this._mouseEnabled = param1;
+ if(this._mouseEnabled)
+ {
+ if(this._enabled)
+ {
+ this.registerMouseListeners();
+ }
+ }
+ else
+ {
+ this.unregisterMouseListeners();
+ }
+ }
+ }
+
+ protected function registerMouseListeners() : void
+ {
+ this._eventsSource.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
+ }
+
+ protected function unregisterMouseListeners() : void
+ {
+ this._eventsSource.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
+ this._eventsSource.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
+ }
+
+ private function onMouseDown(param1:MouseEvent) : void
+ {
+ this.setMouseLook(true);
+ this._eventsSource.stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
+ }
+
+ private function onMouseUp(param1:MouseEvent) : void
+ {
+ this.setMouseLook(false);
+ this._eventsSource.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
+ }
+
+ protected function setObjectCoords() : void
+ {
+ if(this._object != null)
+ {
+ this._object.coords = this._coords;
+ }
+ }
+
+ public function get accelerated() : Boolean
+ {
+ return this._accelerate;
+ }
+
+ protected function clearCommandFlags() : void
+ {
+ this._forward = false;
+ this._back = false;
+ this._left = false;
+ this._right = false;
+ this._up = false;
+ this._down = false;
+ this._pitchUp = false;
+ this._pitchDown = false;
+ this._yawLeft = false;
+ this._yawRight = false;
+ this._accelerate = false;
+ this._mouseLookActive = false;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/controllers/WalkController.as b/src/alternativa/engine3d/controllers/WalkController.as
new file mode 100644
index 0000000..6d58ce1
--- /dev/null
+++ b/src/alternativa/engine3d/controllers/WalkController.as
@@ -0,0 +1,482 @@
+package alternativa.engine3d.controllers
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.physics.Collision;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.utils.KeyboardUtils;
+ import alternativa.utils.MathUtils;
+ import flash.display.DisplayObject;
+
+ use namespace alternativa3d;
+
+ public class WalkController extends ObjectController
+ {
+ public var gravity:Number = 0;
+
+ public var jumpSpeed:Number = 0;
+
+ private var _groundMesh:Mesh;
+
+ public var speedThreshold:Number = 1;
+
+ public var maxPitch:Number = 1.5707963267948966;
+
+ public var minPitch:Number = -1.5707963267948966;
+
+ private var _airControlCoefficient:Number = 1;
+
+ private var _currentSpeed:Number = 0;
+
+ private var minGroundCos:Number;
+
+ private var destination:Point3D;
+
+ private var collision:Collision;
+
+ private var _objectZPosition:Number = 0.5;
+
+ private var _flyMode:Boolean;
+
+ private var _onGround:Boolean;
+
+ private var _jumpLocked:Boolean;
+
+ private var velocity:Point3D;
+
+ private var tmpVelocity:Point3D;
+
+ private var controlsActive:Boolean;
+
+ private var inJump:Boolean;
+
+ private var startRotX:Number;
+
+ private var startRotZ:Number;
+
+ private var prevMouseCoords:Point3D;
+
+ private var currentMouseCoords:Point3D;
+
+ public function WalkController(param1:DisplayObject, param2:Object3D = null)
+ {
+ this.minGroundCos = Math.cos(MathUtils.toRadian(70));
+ this.destination = new Point3D();
+ this.collision = new Collision();
+ this.velocity = new Point3D();
+ this.tmpVelocity = new Point3D();
+ this.prevMouseCoords = new Point3D();
+ this.currentMouseCoords = new Point3D();
+ super(param1);
+ this.object = param2;
+ }
+
+ public function get groundMesh() : Mesh
+ {
+ return this._groundMesh;
+ }
+
+ public function lookAt(param1:Point3D) : void
+ {
+ if(_object == null)
+ {
+ return;
+ }
+ var loc2:Number = param1.x - _object.x;
+ var loc3:Number = param1.y - _object.y;
+ var loc4:Number = param1.z - _object.z;
+ _object.rotationX = Math.atan2(loc4,Math.sqrt(loc2 * loc2 + loc3 * loc3)) - (_object is Camera3D ? MathUtils.DEG90 : 0);
+ _object.rotationY = 0;
+ _object.rotationZ = -Math.atan2(loc2,loc3);
+ }
+
+ public function get airControlCoefficient() : Number
+ {
+ return this._airControlCoefficient;
+ }
+
+ public function set airControlCoefficient(param1:Number) : void
+ {
+ this._airControlCoefficient = param1 > 0 ? param1 : -param1;
+ }
+
+ public function get maxGroundAngle() : Number
+ {
+ return Math.acos(this.minGroundCos);
+ }
+
+ public function set maxGroundAngle(param1:Number) : void
+ {
+ this.minGroundCos = Math.cos(param1);
+ }
+
+ public function get objectZPosition() : Number
+ {
+ return this._objectZPosition;
+ }
+
+ public function set objectZPosition(param1:Number) : void
+ {
+ this._objectZPosition = param1;
+ this.setObjectCoords();
+ }
+
+ public function get flyMode() : Boolean
+ {
+ return this._flyMode;
+ }
+
+ public function set flyMode(param1:Boolean) : void
+ {
+ this._flyMode = param1;
+ }
+
+ public function get onGround() : Boolean
+ {
+ return this._onGround;
+ }
+
+ public function get currentSpeed() : Number
+ {
+ return this._currentSpeed;
+ }
+
+ override public function setDefaultBindings() : void
+ {
+ unbindAll();
+ bindKey(KeyboardUtils.W,ACTION_FORWARD);
+ bindKey(KeyboardUtils.S,ACTION_BACK);
+ bindKey(KeyboardUtils.A,ACTION_LEFT);
+ bindKey(KeyboardUtils.D,ACTION_RIGHT);
+ bindKey(KeyboardUtils.SPACE,ACTION_UP);
+ bindKey(KeyboardUtils.Z,ACTION_DOWN);
+ bindKey(KeyboardUtils.UP,ACTION_PITCH_UP);
+ bindKey(KeyboardUtils.DOWN,ACTION_PITCH_DOWN);
+ bindKey(KeyboardUtils.LEFT,ACTION_YAW_LEFT);
+ bindKey(KeyboardUtils.RIGHT,ACTION_YAW_RIGHT);
+ bindKey(KeyboardUtils.SHIFT,ACTION_ACCELERATE);
+ bindKey(KeyboardUtils.M,ACTION_MOUSE_LOOK);
+ }
+
+ override protected function rotateObject(param1:Number) : void
+ {
+ var loc2:Number = NaN;
+ if(_mouseLookActive)
+ {
+ this.prevMouseCoords.copy(this.currentMouseCoords);
+ this.currentMouseCoords.x = _eventsSource.stage.mouseX;
+ this.currentMouseCoords.y = _eventsSource.stage.mouseY;
+ if(!this.prevMouseCoords.equals(this.currentMouseCoords))
+ {
+ _object.rotationZ = this.startRotZ + (startMouseCoords.x - this.currentMouseCoords.x) * _mouseCoefficientX;
+ loc2 = this.startRotX + (startMouseCoords.y - this.currentMouseCoords.y) * _mouseCoefficientY;
+ if(_object is Camera3D)
+ {
+ _object.rotationX = (loc2 > this.maxPitch ? this.maxPitch : (loc2 < this.minPitch ? this.minPitch : loc2)) - MathUtils.DEG90;
+ }
+ else
+ {
+ _object.rotationX = loc2 > this.maxPitch ? this.maxPitch : (loc2 < this.minPitch ? this.minPitch : loc2);
+ }
+ }
+ }
+ if(_yawLeft)
+ {
+ _object.rotationZ += _yawSpeed * param1;
+ }
+ else if(_yawRight)
+ {
+ _object.rotationZ -= _yawSpeed * param1;
+ }
+ loc2 = NaN;
+ if(_pitchUp)
+ {
+ loc2 = _object.rotationX + _pitchSpeed * param1;
+ }
+ else if(_pitchDown)
+ {
+ loc2 = _object.rotationX - _pitchSpeed * param1;
+ }
+ if(!isNaN(loc2))
+ {
+ if(_object is Camera3D)
+ {
+ _object.rotationX = loc2 > 0 ? 0 : (loc2 < -Math.PI ? -Math.PI : loc2);
+ }
+ else
+ {
+ _object.rotationX = loc2 > MathUtils.DEG90 ? MathUtils.DEG90 : (loc2 < -MathUtils.DEG90 ? -MathUtils.DEG90 : loc2);
+ }
+ }
+ }
+
+ override protected function getDisplacement(param1:Number, param2:Point3D) : void
+ {
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc9:Matrix3D = null;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc3:Number = 0;
+ if(checkCollisions && !this._flyMode)
+ {
+ param2.x = 0;
+ param2.y = 0;
+ param2.z = -0.5 * this.gravity * param1 * param1;
+ if(_collider.getCollision(_coords,param2,this.collision))
+ {
+ loc3 = this.collision.normal.z;
+ this._groundMesh = this.collision.face.alternativa3d::_mesh;
+ }
+ else
+ {
+ this._groundMesh = null;
+ }
+ }
+ this._onGround = loc3 > this.minGroundCos;
+ if(this._onGround && this.inJump)
+ {
+ this.inJump = false;
+ if(!_up)
+ {
+ this._jumpLocked = false;
+ }
+ }
+ this.controlsActive = _forward || _back || _right || _left;
+ if(this.flyMode || this.gravity == 0)
+ {
+ this.controlsActive = this.controlsActive || (_up || _down);
+ }
+ if(this.controlsActive)
+ {
+ if(this._flyMode)
+ {
+ this.tmpVelocity.x = 0;
+ this.tmpVelocity.y = 0;
+ this.tmpVelocity.z = 0;
+ if(_forward)
+ {
+ this.tmpVelocity.y = 1;
+ }
+ else if(_back)
+ {
+ this.tmpVelocity.y = -1;
+ }
+ if(_right)
+ {
+ this.tmpVelocity.x = 1;
+ }
+ else if(_left)
+ {
+ this.tmpVelocity.x = -1;
+ }
+ if(_up)
+ {
+ this.tmpVelocity.z = 1;
+ }
+ else if(_down)
+ {
+ this.tmpVelocity.z = -1;
+ }
+ loc9 = _object.alternativa3d::_transformation;
+ loc5 = this.tmpVelocity.x;
+ if(_object is Camera3D)
+ {
+ loc6 = -this.tmpVelocity.z;
+ loc7 = this.tmpVelocity.y;
+ }
+ else
+ {
+ loc6 = this.tmpVelocity.y;
+ loc7 = this.tmpVelocity.z;
+ }
+ this.velocity.x += (loc5 * loc9.a + loc6 * loc9.b + loc7 * loc9.c) * _speed;
+ this.velocity.y += (loc5 * loc9.e + loc6 * loc9.f + loc7 * loc9.g) * _speed;
+ this.velocity.z += (loc5 * loc9.i + loc6 * loc9.j + loc7 * loc9.k) * _speed;
+ }
+ else
+ {
+ loc10 = _object.rotationZ;
+ loc11 = Math.cos(loc10);
+ loc12 = Math.sin(loc10);
+ loc13 = _speed;
+ if(this.gravity != 0 && !this._onGround)
+ {
+ loc13 *= this._airControlCoefficient;
+ }
+ if(_forward)
+ {
+ this.velocity.x -= loc13 * loc12;
+ this.velocity.y += loc13 * loc11;
+ }
+ else if(_back)
+ {
+ this.velocity.x += loc13 * loc12;
+ this.velocity.y -= loc13 * loc11;
+ }
+ if(_right)
+ {
+ this.velocity.x += loc13 * loc11;
+ this.velocity.y += loc13 * loc12;
+ }
+ else if(_left)
+ {
+ this.velocity.x -= loc13 * loc11;
+ this.velocity.y -= loc13 * loc12;
+ }
+ if(this.gravity == 0)
+ {
+ if(_up)
+ {
+ this.velocity.z += _speed;
+ }
+ else if(_down)
+ {
+ this.velocity.z -= _speed;
+ }
+ }
+ }
+ }
+ else
+ {
+ loc4 = 1 / Math.pow(3,param1 * 10);
+ if(this._flyMode || this.gravity == 0)
+ {
+ this.velocity.x *= loc4;
+ this.velocity.y *= loc4;
+ this.velocity.z *= loc4;
+ }
+ else if(this._onGround)
+ {
+ this.velocity.x *= loc4;
+ this.velocity.y *= loc4;
+ if(this.velocity.z < 0)
+ {
+ this.velocity.z *= loc4;
+ }
+ }
+ else if(loc3 > 0 && this.velocity.z > 0)
+ {
+ this.velocity.z = 0;
+ }
+ }
+ if(this._onGround && _up && !this.inJump && !this._jumpLocked)
+ {
+ this.velocity.z = this.jumpSpeed;
+ this.inJump = true;
+ this._onGround = false;
+ this._jumpLocked = true;
+ loc3 = 0;
+ }
+ if(!(this._flyMode || this._onGround))
+ {
+ this.velocity.z -= this.gravity * param1;
+ }
+ var loc8:Number = _accelerate ? _speed * _speedMultiplier : _speed;
+ if(this._flyMode || this.gravity == 0)
+ {
+ loc4 = this.velocity.length;
+ if(loc4 > loc8)
+ {
+ this.velocity.length = loc8;
+ }
+ }
+ else
+ {
+ loc4 = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
+ if(loc4 > loc8)
+ {
+ this.velocity.x *= loc8 / loc4;
+ this.velocity.y *= loc8 / loc4;
+ }
+ if(loc3 > 0 && this.velocity.z > 0)
+ {
+ this.velocity.z = 0;
+ }
+ }
+ param2.x = this.velocity.x * param1;
+ param2.y = this.velocity.y * param1;
+ param2.z = this.velocity.z * param1;
+ }
+
+ override protected function applyDisplacement(param1:Number, param2:Point3D) : void
+ {
+ if(checkCollisions)
+ {
+ _collider.calculateDestination(_coords,param2,this.destination);
+ param2.x = this.destination.x - _coords.x;
+ param2.y = this.destination.y - _coords.y;
+ param2.z = this.destination.z - _coords.z;
+ }
+ else
+ {
+ this.destination.x = _coords.x + param2.x;
+ this.destination.y = _coords.y + param2.y;
+ this.destination.z = _coords.z + param2.z;
+ }
+ this.velocity.x = param2.x / param1;
+ this.velocity.y = param2.y / param1;
+ this.velocity.z = param2.z / param1;
+ _coords.x = this.destination.x;
+ _coords.y = this.destination.y;
+ _coords.z = this.destination.z;
+ this.setObjectCoords();
+ var loc3:Number = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y + this.velocity.z * this.velocity.z);
+ if(loc3 < this.speedThreshold)
+ {
+ this.velocity.x = 0;
+ this.velocity.y = 0;
+ this.velocity.z = 0;
+ this._currentSpeed = 0;
+ }
+ else
+ {
+ this._currentSpeed = loc3;
+ }
+ }
+
+ override protected function setObjectCoords() : void
+ {
+ if(_object != null)
+ {
+ _object.x = _coords.x;
+ _object.y = _coords.y;
+ _object.z = _coords.z + (2 * this._objectZPosition - 1) * _collider.radiusZ;
+ }
+ }
+
+ override protected function startMouseLook() : void
+ {
+ super.startMouseLook();
+ this.startRotX = _object is Camera3D ? _object.rotationX + MathUtils.DEG90 : _object.rotationX;
+ this.startRotZ = _object.rotationZ;
+ }
+
+ override public function set enabled(param1:Boolean) : void
+ {
+ super.enabled = param1;
+ if(!param1)
+ {
+ this.velocity.reset();
+ this._currentSpeed = 0;
+ }
+ }
+
+ override public function moveUp(param1:Boolean) : void
+ {
+ super.moveUp(param1);
+ if(!this.inJump && !param1)
+ {
+ this._jumpLocked = false;
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/BSPNode.as b/src/alternativa/engine3d/core/BSPNode.as
new file mode 100644
index 0000000..2326137
--- /dev/null
+++ b/src/alternativa/engine3d/core/BSPNode.as
@@ -0,0 +1,91 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+
+ use namespace alternativa3d;
+
+ public final class BSPNode
+ {
+ private static var collector:Array = new Array();
+
+ alternativa3d var splitter:Splitter;
+
+ alternativa3d var frontSector:Sector;
+
+ alternativa3d var backSector:Sector;
+
+ alternativa3d var isSprite:Boolean;
+
+ alternativa3d var parent:BSPNode;
+
+ alternativa3d var front:BSPNode;
+
+ alternativa3d var back:BSPNode;
+
+ alternativa3d var normal:Point3D;
+
+ alternativa3d var offset:Number;
+
+ alternativa3d var mobility:int = 2147483647;
+
+ alternativa3d var primitive:PolyPrimitive;
+
+ alternativa3d var backPrimitives:Set;
+
+ alternativa3d var frontPrimitives:Set;
+
+ public function BSPNode()
+ {
+ this.alternativa3d::normal = new Point3D();
+ super();
+ }
+
+ alternativa3d static function create(param1:PolyPrimitive) : BSPNode
+ {
+ var loc2:BSPNode = null;
+ var loc3:SplitterPrimitive = null;
+ loc2 = collector.pop();
+ if(loc2 == null)
+ {
+ loc2 = new BSPNode();
+ }
+ loc2.alternativa3d::primitive = param1;
+ param1.alternativa3d::node = loc2;
+ if(param1.alternativa3d::face == null)
+ {
+ loc3 = param1 as SplitterPrimitive;
+ if(loc3 == null)
+ {
+ loc2.alternativa3d::normal.x = 0;
+ loc2.alternativa3d::normal.y = 0;
+ loc2.alternativa3d::normal.z = 0;
+ loc2.alternativa3d::offset = 0;
+ loc2.alternativa3d::isSprite = true;
+ }
+ else
+ {
+ loc2.alternativa3d::splitter = loc3.alternativa3d::splitter;
+ loc2.alternativa3d::normal.copy(loc3.alternativa3d::splitter.alternativa3d::normal);
+ loc2.alternativa3d::offset = loc3.alternativa3d::splitter.alternativa3d::offset;
+ loc2.alternativa3d::isSprite = false;
+ }
+ }
+ else
+ {
+ loc2.alternativa3d::normal.copy(param1.alternativa3d::face.alternativa3d::globalNormal);
+ loc2.alternativa3d::offset = param1.alternativa3d::face.alternativa3d::globalOffset;
+ loc2.alternativa3d::isSprite = false;
+ }
+ loc2.alternativa3d::mobility = param1.mobility;
+ return loc2;
+ }
+
+ alternativa3d static function destroy(param1:BSPNode) : void
+ {
+ collector.push(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Camera3D.as b/src/alternativa/engine3d/core/Camera3D.as
new file mode 100644
index 0000000..d3b8f3b
--- /dev/null
+++ b/src/alternativa/engine3d/core/Camera3D.as
@@ -0,0 +1,1175 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.display.Skin;
+ import alternativa.engine3d.display.View;
+ import alternativa.engine3d.materials.DrawPoint;
+ import alternativa.engine3d.materials.SpriteMaterial;
+ import alternativa.engine3d.materials.SurfaceMaterial;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import flash.geom.Matrix;
+
+ use namespace alternativa3d;
+
+ public class Camera3D extends Object3D
+ {
+ private static var counter:uint = 0;
+
+ alternativa3d var calculateMatrixOperation:Operation;
+
+ alternativa3d var calculatePlanesOperation:Operation;
+
+ alternativa3d var renderOperation:Operation;
+
+ alternativa3d var sector:Sector;
+
+ alternativa3d var _fov:Number = 1.5707963267948966;
+
+ alternativa3d var _focalLength:Number;
+
+ alternativa3d var focalDistortion:Number;
+
+ alternativa3d var uvMatricesCalculated:Set;
+
+ private var textureA:Point3D;
+
+ private var textureB:Point3D;
+
+ private var textureC:Point3D;
+
+ alternativa3d var _view:View;
+
+ alternativa3d var _orthographic:Boolean = false;
+
+ private var fullDraw:Boolean;
+
+ alternativa3d var _zoom:Number = 1;
+
+ private var viewAngle:Number;
+
+ private var direction:Point3D;
+
+ alternativa3d var cameraMatrix:Matrix3D;
+
+ private var firstSkin:Skin;
+
+ private var prevSkin:Skin;
+
+ private var currentSkin:Skin;
+
+ private var leftPlane:Point3D;
+
+ private var rightPlane:Point3D;
+
+ private var topPlane:Point3D;
+
+ private var bottomPlane:Point3D;
+
+ private var farPlane:Point3D;
+
+ private var leftOffset:Number;
+
+ private var rightOffset:Number;
+
+ private var topOffset:Number;
+
+ private var bottomOffset:Number;
+
+ private var nearOffset:Number;
+
+ private var farOffset:Number;
+
+ private var points1:Array;
+
+ private var points2:Array;
+
+ private var drawPoints:Array;
+
+ private var spritePoint:Point3D;
+
+ private var spritePrimitives:Array;
+
+ alternativa3d var _nearClippingDistance:Number = 1;
+
+ alternativa3d var _farClippingDistance:Number = 1;
+
+ alternativa3d var _nearClipping:Boolean = false;
+
+ alternativa3d var _farClipping:Boolean = false;
+
+ alternativa3d var _viewClipping:Boolean = true;
+
+ public function Camera3D(param1:String = null)
+ {
+ this.alternativa3d::calculateMatrixOperation = new Operation("calculateMatrix",this,this.calculateMatrix,Operation.alternativa3d::CAMERA_CALCULATE_MATRIX);
+ this.alternativa3d::calculatePlanesOperation = new Operation("calculatePlanes",this,this.calculatePlanes,Operation.alternativa3d::CAMERA_CALCULATE_PLANES);
+ this.alternativa3d::renderOperation = new Operation("render",this,this.render,Operation.alternativa3d::CAMERA_RENDER);
+ this.alternativa3d::uvMatricesCalculated = new Set(true);
+ this.textureA = new Point3D();
+ this.textureB = new Point3D();
+ this.textureC = new Point3D();
+ this.direction = new Point3D(0,0,1);
+ this.alternativa3d::cameraMatrix = new Matrix3D();
+ this.leftPlane = new Point3D();
+ this.rightPlane = new Point3D();
+ this.topPlane = new Point3D();
+ this.bottomPlane = new Point3D();
+ this.farPlane = new Point3D();
+ this.points1 = new Array();
+ this.points2 = new Array();
+ this.drawPoints = new Array();
+ this.spritePoint = new Point3D();
+ this.spritePrimitives = new Array();
+ super(param1);
+ }
+
+ private function calculateMatrix() : void
+ {
+ this.alternativa3d::cameraMatrix.copy(alternativa3d::_transformation);
+ this.alternativa3d::cameraMatrix.invert();
+ if(this.alternativa3d::_orthographic)
+ {
+ this.alternativa3d::cameraMatrix.scale(this.alternativa3d::_zoom,this.alternativa3d::_zoom,this.alternativa3d::_zoom);
+ }
+ this.direction.x = alternativa3d::_transformation.c;
+ this.direction.y = alternativa3d::_transformation.g;
+ this.direction.z = alternativa3d::_transformation.k;
+ this.direction.normalize();
+ }
+
+ private function calculatePlanes() : void
+ {
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ var loc23:Number = NaN;
+ var loc24:Number = NaN;
+ var loc25:Number = NaN;
+ var loc26:Number = NaN;
+ var loc27:Number = NaN;
+ var loc28:Number = NaN;
+ var loc29:Number = NaN;
+ var loc1:Number = this.alternativa3d::_view.alternativa3d::_width * 0.5;
+ var loc2:Number = this.alternativa3d::_view.alternativa3d::_height * 0.5;
+ var loc3:Number = alternativa3d::_transformation.a * loc1;
+ var loc4:Number = alternativa3d::_transformation.e * loc1;
+ var loc5:Number = alternativa3d::_transformation.i * loc1;
+ var loc6:Number = alternativa3d::_transformation.b * loc2;
+ var loc7:Number = alternativa3d::_transformation.f * loc2;
+ var loc8:Number = alternativa3d::_transformation.j * loc2;
+ if(this.alternativa3d::_orthographic)
+ {
+ if(this.alternativa3d::_viewClipping)
+ {
+ loc3 /= this.alternativa3d::_zoom;
+ loc4 /= this.alternativa3d::_zoom;
+ loc5 /= this.alternativa3d::_zoom;
+ loc6 /= this.alternativa3d::_zoom;
+ loc7 /= this.alternativa3d::_zoom;
+ loc8 /= this.alternativa3d::_zoom;
+ this.leftPlane.x = alternativa3d::_transformation.f * alternativa3d::_transformation.k - alternativa3d::_transformation.j * alternativa3d::_transformation.g;
+ this.leftPlane.y = alternativa3d::_transformation.j * alternativa3d::_transformation.c - alternativa3d::_transformation.b * alternativa3d::_transformation.k;
+ this.leftPlane.z = alternativa3d::_transformation.b * alternativa3d::_transformation.g - alternativa3d::_transformation.f * alternativa3d::_transformation.c;
+ this.leftOffset = (alternativa3d::_transformation.d - loc3) * this.leftPlane.x + (alternativa3d::_transformation.h - loc4) * this.leftPlane.y + (alternativa3d::_transformation.l - loc5) * this.leftPlane.z;
+ this.rightPlane.x = -this.leftPlane.x;
+ this.rightPlane.y = -this.leftPlane.y;
+ this.rightPlane.z = -this.leftPlane.z;
+ this.rightOffset = (alternativa3d::_transformation.d + loc3) * this.rightPlane.x + (alternativa3d::_transformation.h + loc4) * this.rightPlane.y + (alternativa3d::_transformation.l + loc5) * this.rightPlane.z;
+ this.topPlane.x = alternativa3d::_transformation.g * alternativa3d::_transformation.i - alternativa3d::_transformation.k * alternativa3d::_transformation.e;
+ this.topPlane.y = alternativa3d::_transformation.k * alternativa3d::_transformation.a - alternativa3d::_transformation.c * alternativa3d::_transformation.i;
+ this.topPlane.z = alternativa3d::_transformation.c * alternativa3d::_transformation.e - alternativa3d::_transformation.g * alternativa3d::_transformation.a;
+ this.topOffset = (alternativa3d::_transformation.d - loc6) * this.topPlane.x + (alternativa3d::_transformation.h - loc7) * this.topPlane.y + (alternativa3d::_transformation.l - loc8) * this.topPlane.z;
+ this.bottomPlane.x = -this.topPlane.x;
+ this.bottomPlane.y = -this.topPlane.y;
+ this.bottomPlane.z = -this.topPlane.z;
+ this.bottomOffset = (alternativa3d::_transformation.d + loc6) * this.bottomPlane.x + (alternativa3d::_transformation.h + loc7) * this.bottomPlane.y + (alternativa3d::_transformation.l + loc8) * this.bottomPlane.z;
+ }
+ }
+ else
+ {
+ this.alternativa3d::_focalLength = Math.sqrt(this.alternativa3d::_view.alternativa3d::_width * this.alternativa3d::_view.alternativa3d::_width + this.alternativa3d::_view.alternativa3d::_height * this.alternativa3d::_view.alternativa3d::_height) * 0.5 / Math.tan(0.5 * this.alternativa3d::_fov);
+ this.alternativa3d::focalDistortion = 1 / (this.alternativa3d::_focalLength * this.alternativa3d::_focalLength);
+ if(this.alternativa3d::_viewClipping)
+ {
+ loc13 = alternativa3d::_transformation.c * this.alternativa3d::_focalLength;
+ loc14 = alternativa3d::_transformation.g * this.alternativa3d::_focalLength;
+ loc15 = alternativa3d::_transformation.k * this.alternativa3d::_focalLength;
+ loc16 = -loc3 - loc6 + loc13;
+ loc17 = -loc4 - loc7 + loc14;
+ loc18 = -loc5 - loc8 + loc15;
+ loc19 = loc3 - loc6 + loc13;
+ loc20 = loc4 - loc7 + loc14;
+ loc21 = loc5 - loc8 + loc15;
+ loc22 = -loc3 + loc6 + loc13;
+ loc23 = -loc4 + loc7 + loc14;
+ loc24 = -loc5 + loc8 + loc15;
+ loc25 = loc3 + loc6 + loc13;
+ loc26 = loc4 + loc7 + loc14;
+ loc27 = loc5 + loc8 + loc15;
+ this.leftPlane.x = loc23 * loc18 - loc24 * loc17;
+ this.leftPlane.y = loc24 * loc16 - loc22 * loc18;
+ this.leftPlane.z = loc22 * loc17 - loc23 * loc16;
+ this.leftOffset = alternativa3d::_transformation.d * this.leftPlane.x + alternativa3d::_transformation.h * this.leftPlane.y + alternativa3d::_transformation.l * this.leftPlane.z;
+ this.rightPlane.x = loc20 * loc27 - loc21 * loc26;
+ this.rightPlane.y = loc21 * loc25 - loc19 * loc27;
+ this.rightPlane.z = loc19 * loc26 - loc20 * loc25;
+ this.rightOffset = alternativa3d::_transformation.d * this.rightPlane.x + alternativa3d::_transformation.h * this.rightPlane.y + alternativa3d::_transformation.l * this.rightPlane.z;
+ this.topPlane.x = loc17 * loc21 - loc18 * loc20;
+ this.topPlane.y = loc18 * loc19 - loc16 * loc21;
+ this.topPlane.z = loc16 * loc20 - loc17 * loc19;
+ this.topOffset = alternativa3d::_transformation.d * this.topPlane.x + alternativa3d::_transformation.h * this.topPlane.y + alternativa3d::_transformation.l * this.topPlane.z;
+ this.bottomPlane.x = loc26 * loc24 - loc27 * loc23;
+ this.bottomPlane.y = loc27 * loc22 - loc25 * loc24;
+ this.bottomPlane.z = loc25 * loc23 - loc26 * loc22;
+ this.bottomOffset = alternativa3d::_transformation.d * this.bottomPlane.x + alternativa3d::_transformation.h * this.bottomPlane.y + alternativa3d::_transformation.l * this.bottomPlane.z;
+ loc28 = Math.sqrt(loc16 * loc16 + loc17 * loc17 + loc18 * loc18);
+ loc16 /= loc28;
+ loc17 /= loc28;
+ loc18 /= loc28;
+ loc28 = Math.sqrt(loc19 * loc19 + loc20 * loc20 + loc21 * loc21);
+ loc19 /= loc28;
+ loc20 /= loc28;
+ loc21 /= loc28;
+ loc28 = Math.sqrt(loc22 * loc22 + loc23 * loc23 + loc24 * loc24);
+ loc22 /= loc28;
+ loc23 /= loc28;
+ loc24 /= loc28;
+ loc28 = Math.sqrt(loc25 * loc25 + loc26 * loc26 + loc27 * loc27);
+ loc25 /= loc28;
+ loc26 /= loc28;
+ loc27 /= loc28;
+ this.viewAngle = loc16 * this.direction.x + loc17 * this.direction.y + loc18 * this.direction.z;
+ loc29 = loc19 * this.direction.x + loc20 * this.direction.y + loc21 * this.direction.z;
+ this.viewAngle = loc29 < this.viewAngle ? loc29 : this.viewAngle;
+ loc29 = loc22 * this.direction.x + loc23 * this.direction.y + loc24 * this.direction.z;
+ this.viewAngle = loc29 < this.viewAngle ? loc29 : this.viewAngle;
+ loc29 = loc25 * this.direction.x + loc26 * this.direction.y + loc27 * this.direction.z;
+ this.viewAngle = loc29 < this.viewAngle ? loc29 : this.viewAngle;
+ this.viewAngle = Math.sin(Math.acos(this.viewAngle));
+ }
+ else
+ {
+ this.viewAngle = 1;
+ }
+ }
+ if(this.alternativa3d::_nearClipping)
+ {
+ if(this.alternativa3d::_orthographic)
+ {
+ loc12 = this.alternativa3d::_nearClippingDistance / this.alternativa3d::_zoom;
+ loc9 = alternativa3d::_transformation.c * loc12 + alternativa3d::_transformation.d;
+ loc10 = alternativa3d::_transformation.g * loc12 + alternativa3d::_transformation.h;
+ loc11 = alternativa3d::_transformation.k * loc12 + alternativa3d::_transformation.l;
+ }
+ else
+ {
+ loc9 = alternativa3d::_transformation.c * this.alternativa3d::_nearClippingDistance + alternativa3d::_transformation.d;
+ loc10 = alternativa3d::_transformation.g * this.alternativa3d::_nearClippingDistance + alternativa3d::_transformation.h;
+ loc11 = alternativa3d::_transformation.k * this.alternativa3d::_nearClippingDistance + alternativa3d::_transformation.l;
+ }
+ this.nearOffset = this.direction.x * loc9 + this.direction.y * loc10 + this.direction.z * loc11;
+ }
+ if(this.alternativa3d::_farClipping)
+ {
+ if(this.alternativa3d::_orthographic)
+ {
+ loc12 = this.alternativa3d::_farClippingDistance / this.alternativa3d::_zoom;
+ loc9 = alternativa3d::_transformation.c * loc12 + alternativa3d::_transformation.d;
+ loc10 = alternativa3d::_transformation.g * loc12 + alternativa3d::_transformation.h;
+ loc11 = alternativa3d::_transformation.k * loc12 + alternativa3d::_transformation.l;
+ }
+ else
+ {
+ loc9 = alternativa3d::_transformation.c * this.alternativa3d::_farClippingDistance + alternativa3d::_transformation.d;
+ loc10 = alternativa3d::_transformation.g * this.alternativa3d::_farClippingDistance + alternativa3d::_transformation.h;
+ loc11 = alternativa3d::_transformation.k * this.alternativa3d::_farClippingDistance + alternativa3d::_transformation.l;
+ }
+ this.farPlane.x = -this.direction.x;
+ this.farPlane.y = -this.direction.y;
+ this.farPlane.z = -this.direction.z;
+ this.farOffset = this.farPlane.x * loc9 + this.farPlane.y * loc10 + this.farPlane.z * loc11;
+ }
+ }
+
+ private function render() : void
+ {
+ this.fullDraw = this.alternativa3d::calculateMatrixOperation.alternativa3d::queued || this.alternativa3d::calculatePlanesOperation.alternativa3d::queued;
+ this.prevSkin = null;
+ this.currentSkin = this.firstSkin;
+ this.alternativa3d::sector = null;
+ this.findSector(alternativa3d::_scene.alternativa3d::bsp);
+ this.renderSplitterNode(alternativa3d::_scene.alternativa3d::bsp);
+ this.alternativa3d::uvMatricesCalculated.clear();
+ while(this.currentSkin != null)
+ {
+ this.removeCurrentSkin();
+ }
+ if(this.alternativa3d::_view.alternativa3d::_interactive)
+ {
+ this.alternativa3d::_view.alternativa3d::checkMouseOverOut(true);
+ }
+ }
+
+ private function findSector(param1:BSPNode) : void
+ {
+ var loc2:Point3D = null;
+ if(param1 != null && param1.alternativa3d::splitter != null)
+ {
+ loc2 = param1.alternativa3d::normal;
+ if(alternativa3d::globalCoords.x * loc2.x + alternativa3d::globalCoords.y * loc2.y + alternativa3d::globalCoords.z * loc2.z - param1.alternativa3d::offset >= 0)
+ {
+ if(param1.alternativa3d::frontSector != null)
+ {
+ this.alternativa3d::sector = param1.alternativa3d::frontSector;
+ }
+ else
+ {
+ this.findSector(param1.alternativa3d::front);
+ }
+ }
+ else if(param1.alternativa3d::backSector != null)
+ {
+ this.alternativa3d::sector = param1.alternativa3d::backSector;
+ }
+ else
+ {
+ this.findSector(param1.alternativa3d::back);
+ }
+ }
+ }
+
+ private function renderSplitterNode(param1:BSPNode) : void
+ {
+ var loc3:Point3D = null;
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::splitter != null)
+ {
+ loc3 = param1.alternativa3d::normal;
+ loc4 = this.direction.x * loc3.x + this.direction.y * loc3.y + this.direction.z * loc3.z;
+ if(!this.alternativa3d::_orthographic)
+ {
+ loc5 = alternativa3d::globalCoords.x * loc3.x + alternativa3d::globalCoords.y * loc3.y + alternativa3d::globalCoords.z * loc3.z - param1.alternativa3d::offset;
+ }
+ if(this.alternativa3d::_orthographic ? loc4 < 0 : loc5 > 0)
+ {
+ if((this.alternativa3d::_orthographic || loc4 < this.viewAngle) && (param1.alternativa3d::splitter.alternativa3d::_open && (param1.alternativa3d::backSector == null || this.alternativa3d::sector == null || this.alternativa3d::sector.alternativa3d::_visible[param1.alternativa3d::backSector])))
+ {
+ this.renderSplitterNode(param1.alternativa3d::back);
+ }
+ if(param1.alternativa3d::frontSector == null || this.alternativa3d::sector == null || Boolean(this.alternativa3d::sector.alternativa3d::_visible[param1.alternativa3d::frontSector]))
+ {
+ this.renderSplitterNode(param1.alternativa3d::front);
+ }
+ }
+ else
+ {
+ if((this.alternativa3d::_orthographic || loc4 > -this.viewAngle) && (param1.alternativa3d::splitter.alternativa3d::_open && (param1.alternativa3d::frontSector == null || this.alternativa3d::sector == null || this.alternativa3d::sector.alternativa3d::_visible[param1.alternativa3d::frontSector])))
+ {
+ this.renderSplitterNode(param1.alternativa3d::front);
+ }
+ if(param1.alternativa3d::backSector == null || this.alternativa3d::sector == null || Boolean(this.alternativa3d::sector.alternativa3d::_visible[param1.alternativa3d::backSector]))
+ {
+ this.renderSplitterNode(param1.alternativa3d::back);
+ }
+ }
+ }
+ else
+ {
+ this.renderBSPNode(param1);
+ }
+ }
+ }
+
+ private function renderBSPNode(param1:BSPNode) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Point3D = null;
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::isSprite)
+ {
+ if(param1.alternativa3d::primitive != null)
+ {
+ this.drawSpriteSkin(param1.alternativa3d::primitive as SpritePrimitive);
+ }
+ else
+ {
+ this.drawSpritePrimitives(param1.alternativa3d::frontPrimitives);
+ }
+ }
+ else
+ {
+ loc3 = param1.alternativa3d::normal;
+ loc4 = this.direction.x * loc3.x + this.direction.y * loc3.y + this.direction.z * loc3.z;
+ if(!this.alternativa3d::_orthographic)
+ {
+ loc5 = alternativa3d::globalCoords.x * loc3.x + alternativa3d::globalCoords.y * loc3.y + alternativa3d::globalCoords.z * loc3.z - param1.alternativa3d::offset;
+ }
+ if(this.alternativa3d::_orthographic ? loc4 < 0 : loc5 > 0)
+ {
+ if(this.alternativa3d::_orthographic || loc4 < this.viewAngle)
+ {
+ this.renderBSPNode(param1.alternativa3d::back);
+ if(param1.alternativa3d::primitive != null)
+ {
+ this.drawSkin(param1.alternativa3d::primitive);
+ }
+ else
+ {
+ for(loc2 in param1.alternativa3d::frontPrimitives)
+ {
+ this.drawSkin(loc2);
+ }
+ }
+ }
+ this.renderBSPNode(param1.alternativa3d::front);
+ }
+ else
+ {
+ if(this.alternativa3d::_orthographic || loc4 > -this.viewAngle)
+ {
+ this.renderBSPNode(param1.alternativa3d::front);
+ if(param1.alternativa3d::primitive == null)
+ {
+ for(loc2 in param1.alternativa3d::backPrimitives)
+ {
+ this.drawSkin(loc2);
+ }
+ }
+ }
+ this.renderBSPNode(param1.alternativa3d::back);
+ }
+ }
+ }
+ }
+
+ private function drawSpritePrimitives(param1:Set) : void
+ {
+ var loc2:SpritePrimitive = null;
+ var loc4:* = undefined;
+ var loc6:Point3D = null;
+ var loc7:Number = NaN;
+ var loc3:int = -1;
+ for(loc4 in param1)
+ {
+ loc2 = loc4;
+ loc6 = loc2.alternativa3d::sprite.alternativa3d::globalCoords;
+ loc7 = this.alternativa3d::cameraMatrix.i * loc6.x + this.alternativa3d::cameraMatrix.j * loc6.y + this.alternativa3d::cameraMatrix.k * loc6.z + this.alternativa3d::cameraMatrix.l;
+ loc2.alternativa3d::screenDepth = loc7;
+ var loc10:*;
+ this.spritePrimitives[loc10 = ++loc3] = loc2;
+ }
+ if(loc3 > 0)
+ {
+ this.sortSpritePrimitives(0,loc3);
+ }
+ var loc5:int = loc3;
+ while(loc5 >= 0)
+ {
+ this.drawSpriteSkin(this.spritePrimitives[loc5]);
+ loc5--;
+ }
+ }
+
+ private function sortSpritePrimitives(param1:int, param2:int) : void
+ {
+ var loc5:SpritePrimitive = null;
+ var loc7:SpritePrimitive = null;
+ var loc3:int = param1;
+ var loc4:int = param2;
+ var loc6:Number = Number(this.spritePrimitives[param2 + param1 >> 1].screenDepth);
+ while(true)
+ {
+ loc5 = this.spritePrimitives[loc3];
+ if(loc5.alternativa3d::screenDepth >= loc6)
+ {
+ while(loc6 < (loc7 = this.spritePrimitives[loc4]).alternativa3d::screenDepth)
+ {
+ loc4--;
+ }
+ if(loc3 <= loc4)
+ {
+ var loc8:*;
+ this.spritePrimitives[loc8 = loc3++] = loc7;
+ var loc9:*;
+ this.spritePrimitives[loc9 = loc4--] = loc5;
+ }
+ if(loc3 > loc4)
+ {
+ break;
+ }
+ }
+ else
+ {
+ loc3++;
+ }
+ }
+ if(param1 < loc4)
+ {
+ this.sortSpritePrimitives(param1,loc4);
+ }
+ if(loc3 < param2)
+ {
+ this.sortSpritePrimitives(loc3,param2);
+ }
+ }
+
+ private function drawSpriteSkin(param1:SpritePrimitive) : void
+ {
+ var loc2:Sprite3D = null;
+ var loc3:SpriteMaterial = null;
+ if(!this.fullDraw && this.currentSkin != null && this.currentSkin.alternativa3d::primitive == param1 && !alternativa3d::_scene.alternativa3d::changedPrimitives[param1])
+ {
+ this.prevSkin = this.currentSkin;
+ this.currentSkin = this.currentSkin.alternativa3d::nextSkin;
+ }
+ else
+ {
+ loc2 = param1.alternativa3d::sprite;
+ loc3 = loc2.alternativa3d::_material;
+ if(loc3 == null)
+ {
+ return;
+ }
+ if(!loc3.alternativa3d::canDraw(this))
+ {
+ return;
+ }
+ if(this.fullDraw || Boolean(alternativa3d::_scene.alternativa3d::changedPrimitives[param1]))
+ {
+ if(this.currentSkin == null)
+ {
+ this.addCurrentSkin();
+ }
+ else if(this.fullDraw || Boolean(alternativa3d::_scene.alternativa3d::changedPrimitives[this.currentSkin.alternativa3d::primitive]))
+ {
+ this.currentSkin.alternativa3d::material.alternativa3d::clear(this.currentSkin);
+ }
+ else
+ {
+ this.insertCurrentSkin();
+ }
+ this.currentSkin.alternativa3d::primitive = param1;
+ this.currentSkin.alternativa3d::material = loc3;
+ loc3.alternativa3d::draw(this,this.currentSkin);
+ this.prevSkin = this.currentSkin;
+ this.currentSkin = this.currentSkin.alternativa3d::nextSkin;
+ }
+ else
+ {
+ while(this.currentSkin != null && Boolean(alternativa3d::_scene.alternativa3d::changedPrimitives[this.currentSkin.alternativa3d::primitive]))
+ {
+ this.removeCurrentSkin();
+ }
+ if(this.currentSkin != null)
+ {
+ this.prevSkin = this.currentSkin;
+ this.currentSkin = this.currentSkin.alternativa3d::nextSkin;
+ }
+ }
+ }
+ }
+
+ private function drawSkin(param1:PolyPrimitive) : void
+ {
+ var loc2:Surface = null;
+ var loc3:SurfaceMaterial = null;
+ var loc4:uint = 0;
+ var loc6:Array = null;
+ var loc7:uint = 0;
+ var loc8:Point3D = null;
+ var loc9:DrawPoint = null;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Matrix3D = null;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ if(!this.fullDraw && this.currentSkin != null && this.currentSkin.alternativa3d::primitive == param1 && !alternativa3d::_scene.alternativa3d::changedPrimitives[param1])
+ {
+ this.prevSkin = this.currentSkin;
+ this.currentSkin = this.currentSkin.alternativa3d::nextSkin;
+ }
+ else
+ {
+ loc2 = param1.alternativa3d::face.alternativa3d::_surface;
+ if(loc2 == null)
+ {
+ return;
+ }
+ loc3 = loc2.alternativa3d::_material;
+ if(loc3 == null || !loc3.alternativa3d::canDraw(param1))
+ {
+ return;
+ }
+ loc4 = param1.alternativa3d::num;
+ loc6 = param1.alternativa3d::points;
+ if(this.alternativa3d::_farClipping && this.alternativa3d::_nearClipping)
+ {
+ loc4 = this.clip(loc4,loc6,this.points1,this.direction,this.nearOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc4 = this.clip(loc4,this.points1,this.points2,this.farPlane,this.farOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc6 = this.points2;
+ }
+ else if(this.alternativa3d::_nearClipping)
+ {
+ loc4 = this.clip(loc4,loc6,this.points2,this.direction,this.nearOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc6 = this.points2;
+ }
+ else if(this.alternativa3d::_farClipping)
+ {
+ loc4 = this.clip(loc4,loc6,this.points2,this.farPlane,this.farOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc6 = this.points2;
+ }
+ if(this.alternativa3d::_viewClipping)
+ {
+ loc4 = this.clip(loc4,loc6,this.points1,this.leftPlane,this.leftOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc4 = this.clip(loc4,this.points1,this.points2,this.rightPlane,this.rightOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc4 = this.clip(loc4,this.points2,this.points1,this.topPlane,this.topOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc4 = this.clip(loc4,this.points1,this.points2,this.bottomPlane,this.bottomOffset);
+ if(loc4 < 3)
+ {
+ return;
+ }
+ loc6 = this.points2;
+ }
+ if(this.fullDraw || Boolean(alternativa3d::_scene.alternativa3d::changedPrimitives[param1]))
+ {
+ loc14 = param1.alternativa3d::face.alternativa3d::uvMatrix;
+ if(!this.alternativa3d::_orthographic && loc3.alternativa3d::useUV && Boolean(loc14))
+ {
+ loc7 = 0;
+ while(loc7 < loc4)
+ {
+ loc8 = loc6[loc7];
+ loc10 = loc8.x;
+ loc11 = loc8.y;
+ loc12 = loc8.z;
+ loc13 = this.alternativa3d::cameraMatrix.i * loc10 + this.alternativa3d::cameraMatrix.j * loc11 + this.alternativa3d::cameraMatrix.k * loc12 + this.alternativa3d::cameraMatrix.l;
+ if(loc13 < 0)
+ {
+ return;
+ }
+ loc15 = loc14.a * loc10 + loc14.b * loc11 + loc14.c * loc12 + loc14.d;
+ loc16 = loc14.e * loc10 + loc14.f * loc11 + loc14.g * loc12 + loc14.h;
+ loc9 = this.drawPoints[loc7];
+ if(loc9 == null)
+ {
+ this.drawPoints[loc7] = new DrawPoint(this.alternativa3d::cameraMatrix.a * loc10 + this.alternativa3d::cameraMatrix.b * loc11 + this.alternativa3d::cameraMatrix.c * loc12 + this.alternativa3d::cameraMatrix.d,this.alternativa3d::cameraMatrix.e * loc10 + this.alternativa3d::cameraMatrix.f * loc11 + this.alternativa3d::cameraMatrix.g * loc12 + this.alternativa3d::cameraMatrix.h,loc13,loc15,loc16);
+ }
+ else
+ {
+ loc9.x = this.alternativa3d::cameraMatrix.a * loc10 + this.alternativa3d::cameraMatrix.b * loc11 + this.alternativa3d::cameraMatrix.c * loc12 + this.alternativa3d::cameraMatrix.d;
+ loc9.y = this.alternativa3d::cameraMatrix.e * loc10 + this.alternativa3d::cameraMatrix.f * loc11 + this.alternativa3d::cameraMatrix.g * loc12 + this.alternativa3d::cameraMatrix.h;
+ loc9.z = loc13;
+ loc9.u = loc15;
+ loc9.v = loc16;
+ }
+ loc7++;
+ }
+ }
+ else
+ {
+ loc7 = 0;
+ while(loc7 < loc4)
+ {
+ loc8 = loc6[loc7];
+ loc10 = loc8.x;
+ loc11 = loc8.y;
+ loc12 = loc8.z;
+ loc13 = this.alternativa3d::cameraMatrix.i * loc10 + this.alternativa3d::cameraMatrix.j * loc11 + this.alternativa3d::cameraMatrix.k * loc12 + this.alternativa3d::cameraMatrix.l;
+ if(loc13 < 0 && !this.alternativa3d::_orthographic)
+ {
+ return;
+ }
+ loc9 = this.drawPoints[loc7];
+ if(loc9 == null)
+ {
+ this.drawPoints[loc7] = new DrawPoint(this.alternativa3d::cameraMatrix.a * loc10 + this.alternativa3d::cameraMatrix.b * loc11 + this.alternativa3d::cameraMatrix.c * loc12 + this.alternativa3d::cameraMatrix.d,this.alternativa3d::cameraMatrix.e * loc10 + this.alternativa3d::cameraMatrix.f * loc11 + this.alternativa3d::cameraMatrix.g * loc12 + this.alternativa3d::cameraMatrix.h,loc13);
+ }
+ else
+ {
+ loc9.x = this.alternativa3d::cameraMatrix.a * loc10 + this.alternativa3d::cameraMatrix.b * loc11 + this.alternativa3d::cameraMatrix.c * loc12 + this.alternativa3d::cameraMatrix.d;
+ loc9.y = this.alternativa3d::cameraMatrix.e * loc10 + this.alternativa3d::cameraMatrix.f * loc11 + this.alternativa3d::cameraMatrix.g * loc12 + this.alternativa3d::cameraMatrix.h;
+ loc9.z = loc13;
+ }
+ loc7++;
+ }
+ }
+ if(this.currentSkin == null)
+ {
+ this.addCurrentSkin();
+ }
+ else if(this.fullDraw || Boolean(alternativa3d::_scene.alternativa3d::changedPrimitives[this.currentSkin.alternativa3d::primitive]))
+ {
+ this.currentSkin.alternativa3d::material.alternativa3d::clear(this.currentSkin);
+ }
+ else
+ {
+ this.insertCurrentSkin();
+ }
+ this.currentSkin.alternativa3d::primitive = param1;
+ this.currentSkin.alternativa3d::material = loc3;
+ loc3.alternativa3d::draw(this,this.currentSkin,loc4,this.drawPoints);
+ this.prevSkin = this.currentSkin;
+ this.currentSkin = this.currentSkin.alternativa3d::nextSkin;
+ }
+ else
+ {
+ while(this.currentSkin != null && Boolean(alternativa3d::_scene.alternativa3d::changedPrimitives[this.currentSkin.alternativa3d::primitive]))
+ {
+ this.removeCurrentSkin();
+ }
+ if(this.currentSkin != null)
+ {
+ this.prevSkin = this.currentSkin;
+ this.currentSkin = this.currentSkin.alternativa3d::nextSkin;
+ }
+ }
+ }
+ }
+
+ private function clip(param1:uint, param2:Array, param3:Array, param4:Point3D, param5:Number) : uint
+ {
+ var loc6:uint = 0;
+ var loc7:Number = NaN;
+ var loc9:Point3D = null;
+ var loc10:Point3D = null;
+ var loc11:Point3D = null;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc8:uint = 0;
+ loc10 = param2[param1 - 1];
+ loc12 = param4.x * loc10.x + param4.y * loc10.y + param4.z * loc10.z - param5;
+ loc6 = 0;
+ while(loc6 < param1)
+ {
+ loc11 = param2[loc6];
+ loc13 = param4.x * loc11.x + param4.y * loc11.y + param4.z * loc11.z - param5;
+ if(loc13 > 0)
+ {
+ if(loc12 <= 0)
+ {
+ loc7 = loc13 / (loc13 - loc12);
+ loc9 = param3[loc8];
+ if(loc9 == null)
+ {
+ loc9 = new Point3D(loc11.x - (loc11.x - loc10.x) * loc7,loc11.y - (loc11.y - loc10.y) * loc7,loc11.z - (loc11.z - loc10.z) * loc7);
+ param3[loc8] = loc9;
+ }
+ else
+ {
+ loc9.x = loc11.x - (loc11.x - loc10.x) * loc7;
+ loc9.y = loc11.y - (loc11.y - loc10.y) * loc7;
+ loc9.z = loc11.z - (loc11.z - loc10.z) * loc7;
+ }
+ loc8++;
+ }
+ loc9 = param3[loc8];
+ if(loc9 == null)
+ {
+ loc9 = new Point3D(loc11.x,loc11.y,loc11.z);
+ param3[loc8] = loc9;
+ }
+ else
+ {
+ loc9.x = loc11.x;
+ loc9.y = loc11.y;
+ loc9.z = loc11.z;
+ }
+ loc8++;
+ }
+ else if(loc12 > 0)
+ {
+ loc7 = loc13 / (loc13 - loc12);
+ loc9 = param3[loc8];
+ if(loc9 == null)
+ {
+ loc9 = new Point3D(loc11.x - (loc11.x - loc10.x) * loc7,loc11.y - (loc11.y - loc10.y) * loc7,loc11.z - (loc11.z - loc10.z) * loc7);
+ param3[loc8] = loc9;
+ }
+ else
+ {
+ loc9.x = loc11.x - (loc11.x - loc10.x) * loc7;
+ loc9.y = loc11.y - (loc11.y - loc10.y) * loc7;
+ loc9.z = loc11.z - (loc11.z - loc10.z) * loc7;
+ }
+ loc8++;
+ }
+ loc12 = loc13;
+ loc10 = loc11;
+ loc6++;
+ }
+ return loc8;
+ }
+
+ private function addCurrentSkin() : void
+ {
+ this.currentSkin = Skin.alternativa3d::createSkin();
+ this.alternativa3d::_view.alternativa3d::canvas.addChild(this.currentSkin);
+ if(this.prevSkin == null)
+ {
+ this.firstSkin = this.currentSkin;
+ }
+ else
+ {
+ this.prevSkin.alternativa3d::nextSkin = this.currentSkin;
+ }
+ }
+
+ private function insertCurrentSkin() : void
+ {
+ var loc1:Skin = Skin.alternativa3d::createSkin();
+ this.alternativa3d::_view.alternativa3d::canvas.addChildAt(loc1,this.alternativa3d::_view.alternativa3d::canvas.getChildIndex(this.currentSkin));
+ loc1.alternativa3d::nextSkin = this.currentSkin;
+ if(this.prevSkin == null)
+ {
+ this.firstSkin = loc1;
+ }
+ else
+ {
+ this.prevSkin.alternativa3d::nextSkin = loc1;
+ }
+ this.currentSkin = loc1;
+ }
+
+ private function removeCurrentSkin() : void
+ {
+ var loc1:Skin = this.currentSkin.alternativa3d::nextSkin;
+ this.alternativa3d::_view.alternativa3d::canvas.removeChild(this.currentSkin);
+ if(this.currentSkin.alternativa3d::material != null)
+ {
+ this.currentSkin.alternativa3d::material.alternativa3d::clear(this.currentSkin);
+ }
+ this.currentSkin.alternativa3d::nextSkin = null;
+ this.currentSkin.alternativa3d::primitive = null;
+ this.currentSkin.alternativa3d::material = null;
+ Skin.alternativa3d::destroySkin(this.currentSkin);
+ this.currentSkin = loc1;
+ if(this.prevSkin == null)
+ {
+ this.firstSkin = this.currentSkin;
+ }
+ else
+ {
+ this.prevSkin.alternativa3d::nextSkin = this.currentSkin;
+ }
+ }
+
+ alternativa3d function calculateUVMatrix(param1:Face, param2:uint, param3:uint) : void
+ {
+ var loc4:Point3D = param1.alternativa3d::primitive.alternativa3d::points[0];
+ this.textureA.x = this.alternativa3d::cameraMatrix.a * loc4.x + this.alternativa3d::cameraMatrix.b * loc4.y + this.alternativa3d::cameraMatrix.c * loc4.z;
+ this.textureA.y = this.alternativa3d::cameraMatrix.e * loc4.x + this.alternativa3d::cameraMatrix.f * loc4.y + this.alternativa3d::cameraMatrix.g * loc4.z;
+ loc4 = param1.alternativa3d::primitive.alternativa3d::points[1];
+ this.textureB.x = this.alternativa3d::cameraMatrix.a * loc4.x + this.alternativa3d::cameraMatrix.b * loc4.y + this.alternativa3d::cameraMatrix.c * loc4.z;
+ this.textureB.y = this.alternativa3d::cameraMatrix.e * loc4.x + this.alternativa3d::cameraMatrix.f * loc4.y + this.alternativa3d::cameraMatrix.g * loc4.z;
+ loc4 = param1.alternativa3d::primitive.alternativa3d::points[2];
+ this.textureC.x = this.alternativa3d::cameraMatrix.a * loc4.x + this.alternativa3d::cameraMatrix.b * loc4.y + this.alternativa3d::cameraMatrix.c * loc4.z;
+ this.textureC.y = this.alternativa3d::cameraMatrix.e * loc4.x + this.alternativa3d::cameraMatrix.f * loc4.y + this.alternativa3d::cameraMatrix.g * loc4.z;
+ var loc5:Number = this.textureB.x - this.textureA.x;
+ var loc6:Number = this.textureB.y - this.textureA.y;
+ var loc7:Number = this.textureC.x - this.textureA.x;
+ var loc8:Number = this.textureC.y - this.textureA.y;
+ var loc9:Matrix = param1.alternativa3d::uvMatrixBase;
+ var loc10:Matrix = param1.alternativa3d::orthoTextureMatrix;
+ loc10.a = (loc9.a * loc5 + loc9.b * loc7) / param2;
+ loc10.b = (loc9.a * loc6 + loc9.b * loc8) / param2;
+ loc10.c = -(loc9.c * loc5 + loc9.d * loc7) / param3;
+ loc10.d = -(loc9.c * loc6 + loc9.d * loc8) / param3;
+ loc10.tx = (loc9.tx + loc9.c) * loc5 + (loc9.ty + loc9.d) * loc7 + this.textureA.x + this.alternativa3d::cameraMatrix.d;
+ loc10.ty = (loc9.tx + loc9.c) * loc6 + (loc9.ty + loc9.d) * loc8 + this.textureA.y + this.alternativa3d::cameraMatrix.h;
+ this.alternativa3d::uvMatricesCalculated[param1] = true;
+ }
+
+ public function get view() : View
+ {
+ return this.alternativa3d::_view;
+ }
+
+ public function set view(param1:View) : void
+ {
+ if(param1 != this.alternativa3d::_view)
+ {
+ if(this.alternativa3d::_view != null)
+ {
+ this.alternativa3d::_view.camera = null;
+ }
+ if(param1 != null)
+ {
+ param1.camera = this;
+ }
+ }
+ }
+
+ public function get orthographic() : Boolean
+ {
+ return this.alternativa3d::_orthographic;
+ }
+
+ public function set orthographic(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_orthographic != param1)
+ {
+ alternativa3d::addOperationToScene(this.alternativa3d::calculateMatrixOperation);
+ this.alternativa3d::_orthographic = param1;
+ }
+ }
+
+ public function get fov() : Number
+ {
+ return this.alternativa3d::_fov;
+ }
+
+ public function set fov(param1:Number) : void
+ {
+ param1 = param1 < 0 ? 0 : (param1 > Math.PI - 0.0001 ? Math.PI - 0.0001 : param1);
+ if(this.alternativa3d::_fov != param1)
+ {
+ if(!this.alternativa3d::_orthographic)
+ {
+ alternativa3d::addOperationToScene(this.alternativa3d::calculatePlanesOperation);
+ }
+ this.alternativa3d::_fov = param1;
+ }
+ }
+
+ public function get focalLength() : Number
+ {
+ if(this.alternativa3d::_view == null)
+ {
+ return NaN;
+ }
+ if(this.orthographic || this.alternativa3d::calculatePlanesOperation.alternativa3d::queued || scene == null)
+ {
+ return 0.5 * Math.sqrt(this.alternativa3d::_view.alternativa3d::_width * this.alternativa3d::_view.alternativa3d::_width + this.alternativa3d::_view.alternativa3d::_height * this.alternativa3d::_view.alternativa3d::_height) / Math.tan(0.5 * this.alternativa3d::_fov);
+ }
+ return this.alternativa3d::_focalLength;
+ }
+
+ public function get zoom() : Number
+ {
+ return this.alternativa3d::_zoom;
+ }
+
+ public function set zoom(param1:Number) : void
+ {
+ param1 = param1 < 0 ? 0 : param1;
+ if(this.alternativa3d::_zoom != param1)
+ {
+ if(this.alternativa3d::_orthographic)
+ {
+ alternativa3d::addOperationToScene(this.alternativa3d::calculateMatrixOperation);
+ }
+ this.alternativa3d::_zoom = param1;
+ }
+ }
+
+ public function get currentSector() : Sector
+ {
+ if(alternativa3d::_scene == null)
+ {
+ return null;
+ }
+ this.alternativa3d::sector = null;
+ this.findSector(alternativa3d::_scene.alternativa3d::bsp);
+ return this.alternativa3d::sector;
+ }
+
+ override protected function addToScene(param1:Scene3D) : void
+ {
+ super.addToScene(param1);
+ if(this.alternativa3d::_view != null)
+ {
+ param1.alternativa3d::addOperation(this.alternativa3d::calculatePlanesOperation);
+ param1.alternativa3d::changePrimitivesOperation.alternativa3d::addSequel(this.alternativa3d::renderOperation);
+ }
+ }
+
+ override protected function removeFromScene(param1:Scene3D) : void
+ {
+ super.removeFromScene(param1);
+ param1.alternativa3d::removeOperation(this.alternativa3d::calculateMatrixOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::calculatePlanesOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::renderOperation);
+ if(this.alternativa3d::_view != null)
+ {
+ param1.alternativa3d::changePrimitivesOperation.alternativa3d::removeSequel(this.alternativa3d::renderOperation);
+ }
+ }
+
+ alternativa3d function addToView(param1:View) : void
+ {
+ this.firstSkin = param1.alternativa3d::canvas.numChildren > 0 ? Skin(param1.alternativa3d::canvas.getChildAt(0)) : null;
+ alternativa3d::calculateTransformationOperation.alternativa3d::addSequel(this.alternativa3d::calculateMatrixOperation);
+ this.alternativa3d::calculateMatrixOperation.alternativa3d::addSequel(this.alternativa3d::calculatePlanesOperation);
+ this.alternativa3d::calculatePlanesOperation.alternativa3d::addSequel(this.alternativa3d::renderOperation);
+ if(alternativa3d::_scene != null)
+ {
+ alternativa3d::_scene.alternativa3d::addOperation(this.alternativa3d::calculateMatrixOperation);
+ alternativa3d::_scene.alternativa3d::changePrimitivesOperation.alternativa3d::addSequel(this.alternativa3d::renderOperation);
+ }
+ this.alternativa3d::_view = param1;
+ }
+
+ alternativa3d function removeFromView(param1:View) : void
+ {
+ this.firstSkin = null;
+ alternativa3d::calculateTransformationOperation.alternativa3d::removeSequel(this.alternativa3d::calculateMatrixOperation);
+ this.alternativa3d::calculateMatrixOperation.alternativa3d::removeSequel(this.alternativa3d::calculatePlanesOperation);
+ this.alternativa3d::calculatePlanesOperation.alternativa3d::removeSequel(this.alternativa3d::renderOperation);
+ if(alternativa3d::_scene != null)
+ {
+ alternativa3d::_scene.alternativa3d::removeOperation(this.alternativa3d::calculateMatrixOperation);
+ alternativa3d::_scene.alternativa3d::removeOperation(this.alternativa3d::calculatePlanesOperation);
+ alternativa3d::_scene.alternativa3d::removeOperation(this.alternativa3d::renderOperation);
+ alternativa3d::_scene.alternativa3d::changePrimitivesOperation.alternativa3d::removeSequel(this.alternativa3d::renderOperation);
+ }
+ this.alternativa3d::_view = null;
+ }
+
+ override protected function defaultName() : String
+ {
+ return "camera" + ++counter;
+ }
+
+ override protected function createEmptyObject() : Object3D
+ {
+ return new Camera3D();
+ }
+
+ override protected function clonePropertiesFrom(param1:Object3D) : void
+ {
+ super.clonePropertiesFrom(param1);
+ var loc2:Camera3D = Camera3D(param1);
+ this.orthographic = loc2.alternativa3d::_orthographic;
+ this.zoom = loc2.alternativa3d::_zoom;
+ this.fov = loc2.alternativa3d::_fov;
+ }
+
+ public function get nearClipping() : Boolean
+ {
+ return this.alternativa3d::_nearClipping;
+ }
+
+ public function set nearClipping(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_nearClipping != param1)
+ {
+ this.alternativa3d::_nearClipping = param1;
+ alternativa3d::addOperationToScene(this.alternativa3d::calculatePlanesOperation);
+ }
+ }
+
+ public function get nearClippingDistance() : Number
+ {
+ return this.alternativa3d::_nearClippingDistance;
+ }
+
+ public function set nearClippingDistance(param1:Number) : void
+ {
+ if(param1 < 0)
+ {
+ param1 = 0;
+ }
+ if(this.alternativa3d::_nearClippingDistance != param1)
+ {
+ this.alternativa3d::_nearClippingDistance = param1;
+ alternativa3d::addOperationToScene(this.alternativa3d::calculatePlanesOperation);
+ }
+ }
+
+ public function get farClipping() : Boolean
+ {
+ return this.alternativa3d::_farClipping;
+ }
+
+ public function set farClipping(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_farClipping != param1)
+ {
+ this.alternativa3d::_farClipping = param1;
+ alternativa3d::addOperationToScene(this.alternativa3d::calculatePlanesOperation);
+ }
+ }
+
+ public function get farClippingDistance() : Number
+ {
+ return this.alternativa3d::_farClippingDistance;
+ }
+
+ public function set farClippingDistance(param1:Number) : void
+ {
+ if(param1 < 0)
+ {
+ param1 = 0;
+ }
+ if(this.alternativa3d::_farClippingDistance != param1)
+ {
+ this.alternativa3d::_farClippingDistance = param1;
+ alternativa3d::addOperationToScene(this.alternativa3d::calculatePlanesOperation);
+ }
+ }
+
+ public function get viewClipping() : Boolean
+ {
+ return this.alternativa3d::_viewClipping;
+ }
+
+ public function set viewClipping(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_viewClipping != param1)
+ {
+ this.alternativa3d::_viewClipping = param1;
+ alternativa3d::addOperationToScene(this.alternativa3d::calculatePlanesOperation);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Face.as b/src/alternativa/engine3d/core/Face.as
new file mode 100644
index 0000000..8cfdbb9
--- /dev/null
+++ b/src/alternativa/engine3d/core/Face.as
@@ -0,0 +1,698 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IEventDispatcher;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+
+ use namespace alternativa3d;
+
+ public final class Face implements IEventDispatcher
+ {
+ private static const uvThreshold:Number = 1 / 2880;
+
+ alternativa3d var calculateNormalOperation:Operation;
+
+ alternativa3d var calculateBaseUVOperation:Operation;
+
+ alternativa3d var calculateUVOperation:Operation;
+
+ alternativa3d var updatePrimitiveOperation:Operation;
+
+ alternativa3d var updateMaterialOperation:Operation;
+
+ alternativa3d var _mesh:Mesh;
+
+ alternativa3d var _surface:Surface;
+
+ alternativa3d var _vertices:Array;
+
+ alternativa3d var _verticesCount:uint;
+
+ alternativa3d var primitive:PolyPrimitive;
+
+ alternativa3d var _aUV:Point;
+
+ alternativa3d var _bUV:Point;
+
+ alternativa3d var _cUV:Point;
+
+ alternativa3d var uvMatrixBase:Matrix;
+
+ alternativa3d var uvMatrix:Matrix3D;
+
+ alternativa3d var orthoTextureMatrix:Matrix;
+
+ alternativa3d var globalNormal:Point3D;
+
+ alternativa3d var globalOffset:Number;
+
+ public var mouseEnabled:Boolean = true;
+
+ private var dispatcher:EventDispatcher;
+
+ public function Face(param1:Array)
+ {
+ var loc3:Vertex = null;
+ this.alternativa3d::calculateNormalOperation = new Operation("calculateNormal",this,this.calculateNormal,Operation.alternativa3d::FACE_CALCULATE_NORMAL);
+ this.alternativa3d::calculateBaseUVOperation = new Operation("calculateBaseUV",this,this.calculateBaseUV,Operation.alternativa3d::FACE_CALCULATE_BASE_UV);
+ this.alternativa3d::calculateUVOperation = new Operation("calculateUV",this,this.calculateUV,Operation.alternativa3d::FACE_CALCULATE_UV);
+ this.alternativa3d::updatePrimitiveOperation = new Operation("updatePrimitive",this,this.updatePrimitive,Operation.alternativa3d::FACE_UPDATE_PRIMITIVE);
+ this.alternativa3d::updateMaterialOperation = new Operation("updateMaterial",this,this.updateMaterial,Operation.alternativa3d::FACE_UPDATE_MATERIAL);
+ this.alternativa3d::globalNormal = new Point3D();
+ super();
+ this.alternativa3d::_vertices = param1;
+ this.alternativa3d::_verticesCount = param1.length;
+ this.alternativa3d::primitive = PolyPrimitive.alternativa3d::create();
+ this.alternativa3d::primitive.alternativa3d::face = this;
+ this.alternativa3d::primitive.alternativa3d::num = this.alternativa3d::_verticesCount;
+ var loc2:uint = 0;
+ while(loc2 < this.alternativa3d::_verticesCount)
+ {
+ loc3 = param1[loc2];
+ this.alternativa3d::primitive.alternativa3d::points.push(loc3.alternativa3d::globalCoords);
+ loc3.alternativa3d::addToFace(this);
+ loc2++;
+ }
+ this.alternativa3d::calculateNormalOperation.alternativa3d::addSequel(this.alternativa3d::updatePrimitiveOperation);
+ this.alternativa3d::calculateNormalOperation.alternativa3d::addSequel(this.alternativa3d::calculateUVOperation);
+ this.alternativa3d::calculateBaseUVOperation.alternativa3d::addSequel(this.alternativa3d::calculateUVOperation);
+ this.alternativa3d::calculateUVOperation.alternativa3d::addSequel(this.alternativa3d::updateMaterialOperation);
+ }
+
+ private function calculateNormal() : void
+ {
+ var loc1:Vertex = this.alternativa3d::_vertices[0];
+ var loc2:Point3D = loc1.alternativa3d::globalCoords;
+ loc1 = this.alternativa3d::_vertices[1];
+ var loc3:Point3D = loc1.alternativa3d::globalCoords;
+ var loc4:Number = loc3.x - loc2.x;
+ var loc5:Number = loc3.y - loc2.y;
+ var loc6:Number = loc3.z - loc2.z;
+ loc1 = this.alternativa3d::_vertices[2];
+ var loc7:Point3D = loc1.alternativa3d::globalCoords;
+ var loc8:Number = loc7.x - loc2.x;
+ var loc9:Number = loc7.y - loc2.y;
+ var loc10:Number = loc7.z - loc2.z;
+ this.alternativa3d::globalNormal.x = loc10 * loc5 - loc9 * loc6;
+ this.alternativa3d::globalNormal.y = loc8 * loc6 - loc10 * loc4;
+ this.alternativa3d::globalNormal.z = loc9 * loc4 - loc8 * loc5;
+ this.alternativa3d::globalNormal.normalize();
+ }
+
+ private function updatePrimitive() : void
+ {
+ var loc1:Vertex = this.alternativa3d::_vertices[0];
+ this.alternativa3d::globalOffset = loc1.alternativa3d::globalCoords.x * this.alternativa3d::globalNormal.x + loc1.alternativa3d::globalCoords.y * this.alternativa3d::globalNormal.y + loc1.alternativa3d::globalCoords.z * this.alternativa3d::globalNormal.z;
+ this.removePrimitive(this.alternativa3d::primitive);
+ this.alternativa3d::primitive.mobility = this.alternativa3d::_mesh.alternativa3d::inheritedMobility;
+ this.alternativa3d::_mesh.alternativa3d::_scene.alternativa3d::addPrimitives.push(this.alternativa3d::primitive);
+ }
+
+ private function removePrimitive(param1:PolyPrimitive) : void
+ {
+ if(param1.alternativa3d::backFragment != null)
+ {
+ this.removePrimitive(param1.alternativa3d::backFragment);
+ this.removePrimitive(param1.alternativa3d::frontFragment);
+ param1.alternativa3d::backFragment = null;
+ param1.alternativa3d::frontFragment = null;
+ if(param1 != this.alternativa3d::primitive)
+ {
+ param1.alternativa3d::parent = null;
+ param1.alternativa3d::sibling = null;
+ PolyPrimitive.alternativa3d::destroy(param1);
+ }
+ }
+ else if(param1.alternativa3d::node != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::_scene.alternativa3d::removeBSPPrimitive(param1);
+ }
+ }
+
+ private function updateMaterial() : void
+ {
+ if(!this.alternativa3d::updatePrimitiveOperation.alternativa3d::queued)
+ {
+ this.changePrimitive(this.alternativa3d::primitive);
+ }
+ }
+
+ private function changePrimitive(param1:PolyPrimitive) : void
+ {
+ if(param1.alternativa3d::backFragment != null)
+ {
+ this.changePrimitive(param1.alternativa3d::backFragment);
+ this.changePrimitive(param1.alternativa3d::frontFragment);
+ }
+ else
+ {
+ this.alternativa3d::_mesh.alternativa3d::_scene.alternativa3d::changedPrimitives[param1] = true;
+ }
+ }
+
+ private function calculateBaseUV() : void
+ {
+ var loc1:Number = NaN;
+ var loc2:Number = NaN;
+ var loc3:Number = NaN;
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ if(this.alternativa3d::_aUV != null && this.alternativa3d::_bUV != null && this.alternativa3d::_cUV != null)
+ {
+ loc1 = this.alternativa3d::_bUV.x - this.alternativa3d::_aUV.x;
+ loc2 = this.alternativa3d::_bUV.y - this.alternativa3d::_aUV.y;
+ loc3 = this.alternativa3d::_cUV.x - this.alternativa3d::_aUV.x;
+ loc4 = this.alternativa3d::_cUV.y - this.alternativa3d::_aUV.y;
+ loc5 = loc1 * loc4 - loc2 * loc3;
+ if(loc5 < uvThreshold && loc5 > -uvThreshold)
+ {
+ if(loc1 < uvThreshold && loc1 > -uvThreshold && loc2 < uvThreshold && loc2 > -uvThreshold)
+ {
+ if(loc3 < uvThreshold && loc3 > -uvThreshold && loc4 < uvThreshold && loc4 > -uvThreshold)
+ {
+ loc1 = uvThreshold;
+ loc4 = uvThreshold;
+ }
+ else
+ {
+ loc6 = Math.sqrt(loc3 * loc3 + loc4 * loc4);
+ loc1 = uvThreshold * loc4 / loc6;
+ loc2 = -uvThreshold * loc3 / loc6;
+ }
+ }
+ else if(loc3 < uvThreshold && loc3 > -uvThreshold && loc4 < uvThreshold && loc4 > -uvThreshold)
+ {
+ loc6 = Math.sqrt(loc1 * loc1 + loc2 * loc2);
+ loc3 = -uvThreshold * loc2 / loc6;
+ loc4 = uvThreshold * loc1 / loc6;
+ }
+ else
+ {
+ loc6 = Math.sqrt(loc1 * loc1 + loc2 * loc2);
+ loc3 += uvThreshold * loc2 / loc6;
+ loc4 -= uvThreshold * loc1 / loc6;
+ }
+ loc5 = loc1 * loc4 - loc2 * loc3;
+ }
+ if(this.alternativa3d::uvMatrixBase == null)
+ {
+ this.alternativa3d::uvMatrixBase = new Matrix();
+ this.alternativa3d::orthoTextureMatrix = new Matrix();
+ }
+ this.alternativa3d::uvMatrixBase.a = loc4 / loc5;
+ this.alternativa3d::uvMatrixBase.b = -loc2 / loc5;
+ this.alternativa3d::uvMatrixBase.c = -loc3 / loc5;
+ this.alternativa3d::uvMatrixBase.d = loc1 / loc5;
+ this.alternativa3d::uvMatrixBase.tx = -(this.alternativa3d::uvMatrixBase.a * this.alternativa3d::_aUV.x + this.alternativa3d::uvMatrixBase.c * this.alternativa3d::_aUV.y);
+ this.alternativa3d::uvMatrixBase.ty = -(this.alternativa3d::uvMatrixBase.b * this.alternativa3d::_aUV.x + this.alternativa3d::uvMatrixBase.d * this.alternativa3d::_aUV.y);
+ }
+ else
+ {
+ this.alternativa3d::uvMatrixBase = null;
+ this.alternativa3d::orthoTextureMatrix = null;
+ }
+ }
+
+ private function calculateUV() : void
+ {
+ var loc1:Point3D = null;
+ var loc2:Point3D = null;
+ var loc3:Point3D = null;
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Number = NaN;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ if(this.alternativa3d::uvMatrixBase != null)
+ {
+ if(this.alternativa3d::uvMatrix == null)
+ {
+ this.alternativa3d::uvMatrix = new Matrix3D();
+ }
+ loc1 = this.alternativa3d::_vertices[0].globalCoords;
+ loc2 = this.alternativa3d::_vertices[1].globalCoords;
+ loc3 = this.alternativa3d::_vertices[2].globalCoords;
+ loc4 = loc2.x - loc1.x;
+ loc5 = loc2.y - loc1.y;
+ loc6 = loc2.z - loc1.z;
+ loc7 = loc3.x - loc1.x;
+ loc8 = loc3.y - loc1.y;
+ loc9 = loc3.z - loc1.z;
+ this.alternativa3d::uvMatrix.a = loc4 * this.alternativa3d::uvMatrixBase.a + loc7 * this.alternativa3d::uvMatrixBase.b;
+ this.alternativa3d::uvMatrix.b = loc4 * this.alternativa3d::uvMatrixBase.c + loc7 * this.alternativa3d::uvMatrixBase.d;
+ this.alternativa3d::uvMatrix.c = this.alternativa3d::globalNormal.x;
+ this.alternativa3d::uvMatrix.d = loc4 * this.alternativa3d::uvMatrixBase.tx + loc7 * this.alternativa3d::uvMatrixBase.ty + loc1.x;
+ this.alternativa3d::uvMatrix.e = loc5 * this.alternativa3d::uvMatrixBase.a + loc8 * this.alternativa3d::uvMatrixBase.b;
+ this.alternativa3d::uvMatrix.f = loc5 * this.alternativa3d::uvMatrixBase.c + loc8 * this.alternativa3d::uvMatrixBase.d;
+ this.alternativa3d::uvMatrix.g = this.alternativa3d::globalNormal.y;
+ this.alternativa3d::uvMatrix.h = loc5 * this.alternativa3d::uvMatrixBase.tx + loc8 * this.alternativa3d::uvMatrixBase.ty + loc1.y;
+ this.alternativa3d::uvMatrix.i = loc6 * this.alternativa3d::uvMatrixBase.a + loc9 * this.alternativa3d::uvMatrixBase.b;
+ this.alternativa3d::uvMatrix.j = loc6 * this.alternativa3d::uvMatrixBase.c + loc9 * this.alternativa3d::uvMatrixBase.d;
+ this.alternativa3d::uvMatrix.k = this.alternativa3d::globalNormal.z;
+ this.alternativa3d::uvMatrix.l = loc6 * this.alternativa3d::uvMatrixBase.tx + loc9 * this.alternativa3d::uvMatrixBase.ty + loc1.z;
+ loc10 = this.alternativa3d::uvMatrix.a;
+ loc11 = this.alternativa3d::uvMatrix.b;
+ loc12 = this.alternativa3d::uvMatrix.c;
+ loc13 = this.alternativa3d::uvMatrix.d;
+ loc14 = this.alternativa3d::uvMatrix.e;
+ loc15 = this.alternativa3d::uvMatrix.f;
+ loc16 = this.alternativa3d::uvMatrix.g;
+ loc17 = this.alternativa3d::uvMatrix.h;
+ loc18 = this.alternativa3d::uvMatrix.i;
+ loc19 = this.alternativa3d::uvMatrix.j;
+ loc20 = this.alternativa3d::uvMatrix.k;
+ loc21 = this.alternativa3d::uvMatrix.l;
+ loc22 = -loc12 * loc15 * loc18 + loc11 * loc16 * loc18 + loc12 * loc14 * loc19 - loc10 * loc16 * loc19 - loc11 * loc14 * loc20 + loc10 * loc15 * loc20;
+ if(loc22 != 0)
+ {
+ this.alternativa3d::uvMatrix.a = (-loc16 * loc19 + loc15 * loc20) / loc22;
+ this.alternativa3d::uvMatrix.b = (loc12 * loc19 - loc11 * loc20) / loc22;
+ this.alternativa3d::uvMatrix.c = (-loc12 * loc15 + loc11 * loc16) / loc22;
+ this.alternativa3d::uvMatrix.d = (loc13 * loc16 * loc19 - loc12 * loc17 * loc19 - loc13 * loc15 * loc20 + loc11 * loc17 * loc20 + loc12 * loc15 * loc21 - loc11 * loc16 * loc21) / loc22;
+ this.alternativa3d::uvMatrix.e = (loc16 * loc18 - loc14 * loc20) / loc22;
+ this.alternativa3d::uvMatrix.f = (-loc12 * loc18 + loc10 * loc20) / loc22;
+ this.alternativa3d::uvMatrix.g = (loc12 * loc14 - loc10 * loc16) / loc22;
+ this.alternativa3d::uvMatrix.h = (loc12 * loc17 * loc18 - loc13 * loc16 * loc18 + loc13 * loc14 * loc20 - loc10 * loc17 * loc20 - loc12 * loc14 * loc21 + loc10 * loc16 * loc21) / loc22;
+ this.alternativa3d::uvMatrix.i = (-loc15 * loc18 + loc14 * loc19) / loc22;
+ this.alternativa3d::uvMatrix.j = (loc11 * loc18 - loc10 * loc19) / loc22;
+ this.alternativa3d::uvMatrix.k = (-loc11 * loc14 + loc10 * loc15) / loc22;
+ this.alternativa3d::uvMatrix.l = (loc13 * loc15 * loc18 - loc11 * loc17 * loc18 - loc13 * loc14 * loc19 + loc10 * loc17 * loc19 + loc11 * loc14 * loc21 - loc10 * loc15 * loc21) / loc22;
+ }
+ else
+ {
+ this.alternativa3d::uvMatrix = null;
+ }
+ }
+ else
+ {
+ this.alternativa3d::uvMatrix = null;
+ }
+ }
+
+ public function get vertices() : Array
+ {
+ return new Array().concat(this.alternativa3d::_vertices);
+ }
+
+ public function get verticesCount() : uint
+ {
+ return this.alternativa3d::_verticesCount;
+ }
+
+ public function get mesh() : Mesh
+ {
+ return this.alternativa3d::_mesh;
+ }
+
+ public function get surface() : Surface
+ {
+ return this.alternativa3d::_surface;
+ }
+
+ public function get id() : Object
+ {
+ return this.alternativa3d::_mesh != null ? this.alternativa3d::_mesh.getFaceId(this) : null;
+ }
+
+ public function get aUV() : Point
+ {
+ return this.alternativa3d::_aUV != null ? this.alternativa3d::_aUV.clone() : null;
+ }
+
+ public function get bUV() : Point
+ {
+ return this.alternativa3d::_bUV != null ? this.alternativa3d::_bUV.clone() : null;
+ }
+
+ public function get cUV() : Point
+ {
+ return this.alternativa3d::_cUV != null ? this.alternativa3d::_cUV.clone() : null;
+ }
+
+ public function set aUV(param1:Point) : void
+ {
+ if(this.alternativa3d::_aUV != null)
+ {
+ if(param1 != null)
+ {
+ if(!this.alternativa3d::_aUV.equals(param1))
+ {
+ this.alternativa3d::_aUV.x = param1.x;
+ this.alternativa3d::_aUV.y = param1.y;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+ else
+ {
+ this.alternativa3d::_aUV = null;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+ else if(param1 != null)
+ {
+ this.alternativa3d::_aUV = param1.clone();
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+
+ public function set bUV(param1:Point) : void
+ {
+ if(this.alternativa3d::_bUV != null)
+ {
+ if(param1 != null)
+ {
+ if(!this.alternativa3d::_bUV.equals(param1))
+ {
+ this.alternativa3d::_bUV.x = param1.x;
+ this.alternativa3d::_bUV.y = param1.y;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+ else
+ {
+ this.alternativa3d::_bUV = null;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+ else if(param1 != null)
+ {
+ this.alternativa3d::_bUV = param1.clone();
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+
+ public function set cUV(param1:Point) : void
+ {
+ if(this.alternativa3d::_cUV != null)
+ {
+ if(param1 != null)
+ {
+ if(!this.alternativa3d::_cUV.equals(param1))
+ {
+ this.alternativa3d::_cUV.x = param1.x;
+ this.alternativa3d::_cUV.y = param1.y;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+ else
+ {
+ this.alternativa3d::_cUV = null;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+ else if(param1 != null)
+ {
+ this.alternativa3d::_cUV = param1.clone();
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::calculateBaseUVOperation);
+ }
+ }
+ }
+
+ public function get normal() : Point3D
+ {
+ var loc12:Number = NaN;
+ var loc1:Point3D = new Point3D();
+ var loc2:Vertex = this.alternativa3d::_vertices[0];
+ var loc3:Point3D = loc2.coords;
+ loc2 = this.alternativa3d::_vertices[1];
+ var loc4:Point3D = loc2.coords;
+ var loc5:Number = loc4.x - loc3.x;
+ var loc6:Number = loc4.y - loc3.y;
+ var loc7:Number = loc4.z - loc3.z;
+ loc2 = this.alternativa3d::_vertices[2];
+ var loc8:Point3D = loc2.coords;
+ var loc9:Number = loc8.x - loc3.x;
+ var loc10:Number = loc8.y - loc3.y;
+ var loc11:Number = loc8.z - loc3.z;
+ loc1.x = loc11 * loc6 - loc10 * loc7;
+ loc1.y = loc9 * loc7 - loc11 * loc5;
+ loc1.z = loc10 * loc5 - loc9 * loc6;
+ if(loc1.x != 0 || loc1.y != 0 || loc1.z != 0)
+ {
+ loc12 = Math.sqrt(loc1.x * loc1.x + loc1.y * loc1.y + loc1.z * loc1.z);
+ loc1.x /= loc12;
+ loc1.y /= loc12;
+ loc1.z /= loc12;
+ }
+ return loc1;
+ }
+
+ public function getUV(param1:Point3D) : Point
+ {
+ return this.alternativa3d::getUVFast(param1,this.normal);
+ }
+
+ alternativa3d function getUVFast(param1:Point3D, param2:Point3D) : Point
+ {
+ var loc3:uint = 0;
+ if(this.alternativa3d::_aUV == null || this.alternativa3d::_bUV == null || this.alternativa3d::_cUV == null)
+ {
+ return null;
+ }
+ if((param2.x < 0 ? -param2.x : param2.x) > (param2.y < 0 ? -param2.y : param2.y))
+ {
+ if((param2.x < 0 ? -param2.x : param2.x) > (param2.z < 0 ? -param2.z : param2.z))
+ {
+ loc3 = 0;
+ }
+ else
+ {
+ loc3 = 2;
+ }
+ }
+ else if((param2.y < 0 ? -param2.y : param2.y) > (param2.z < 0 ? -param2.z : param2.z))
+ {
+ loc3 = 1;
+ }
+ else
+ {
+ loc3 = 2;
+ }
+ var loc4:Vertex = this.alternativa3d::_vertices[0];
+ var loc5:Point3D = loc4.alternativa3d::_coords;
+ loc4 = this.alternativa3d::_vertices[1];
+ var loc6:Point3D = loc4.alternativa3d::_coords;
+ loc4 = this.alternativa3d::_vertices[2];
+ var loc7:Point3D = loc4.alternativa3d::_coords;
+ var loc8:Number = loc3 == 0 ? loc6.y - loc5.y : loc6.x - loc5.x;
+ var loc9:Number = loc3 == 2 ? loc6.y - loc5.y : loc6.z - loc5.z;
+ var loc10:Number = loc3 == 0 ? loc7.y - loc5.y : loc7.x - loc5.x;
+ var loc11:Number = loc3 == 2 ? loc7.y - loc5.y : loc7.z - loc5.z;
+ var loc12:Number = loc8 * loc11 - loc10 * loc9;
+ var loc13:Number = loc3 == 0 ? param1.y - loc5.y : param1.x - loc5.x;
+ var loc14:Number = loc3 == 2 ? param1.y - loc5.y : param1.z - loc5.z;
+ var loc15:Number = (loc13 * loc11 - loc10 * loc14) / loc12;
+ var loc16:Number = (loc8 * loc14 - loc13 * loc9) / loc12;
+ var loc17:Number = this.alternativa3d::_bUV.x - this.alternativa3d::_aUV.x;
+ var loc18:Number = this.alternativa3d::_bUV.y - this.alternativa3d::_aUV.y;
+ var loc19:Number = this.alternativa3d::_cUV.x - this.alternativa3d::_aUV.x;
+ var loc20:Number = this.alternativa3d::_cUV.y - this.alternativa3d::_aUV.y;
+ return new Point(this.alternativa3d::_aUV.x + loc17 * loc15 + loc19 * loc16,this.alternativa3d::_aUV.y + loc18 * loc15 + loc20 * loc16);
+ }
+
+ public function get edgeJoinedFaces() : Set
+ {
+ var loc3:Vertex = null;
+ var loc4:Vertex = null;
+ var loc5:* = undefined;
+ var loc6:Face = null;
+ var loc1:Set = new Set(true);
+ var loc2:uint = 0;
+ while(loc2 < this.alternativa3d::_verticesCount)
+ {
+ loc3 = this.alternativa3d::_vertices[loc2];
+ loc4 = this.alternativa3d::_vertices[loc2 < this.alternativa3d::_verticesCount - 1 ? loc2 + 1 : 0];
+ for(loc5 in loc3.alternativa3d::_faces)
+ {
+ loc6 = loc5;
+ if(loc6 != this && loc6.alternativa3d::_vertices.indexOf(loc4) >= 0)
+ {
+ loc1[loc6] = true;
+ }
+ }
+ loc2++;
+ }
+ return loc1;
+ }
+
+ alternativa3d function removeVertices() : void
+ {
+ var loc2:Vertex = null;
+ var loc1:uint = 0;
+ while(loc1 < this.alternativa3d::_verticesCount)
+ {
+ loc2 = this.alternativa3d::_vertices.pop();
+ loc2.alternativa3d::removeFromFace(this);
+ loc1++;
+ }
+ this.alternativa3d::primitive.alternativa3d::points.length = 0;
+ this.alternativa3d::_verticesCount = 0;
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::addOperation(this.alternativa3d::calculateNormalOperation);
+ param1.alternativa3d::addOperation(this.alternativa3d::calculateBaseUVOperation);
+ this.alternativa3d::updatePrimitiveOperation.alternativa3d::addSequel(param1.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::updateMaterialOperation.alternativa3d::addSequel(param1.alternativa3d::changePrimitivesOperation);
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::removeOperation(this.alternativa3d::calculateBaseUVOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::calculateNormalOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::updatePrimitiveOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::updateMaterialOperation);
+ this.removePrimitive(this.alternativa3d::primitive);
+ param1.alternativa3d::addOperation(param1.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::updatePrimitiveOperation.alternativa3d::removeSequel(param1.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::updateMaterialOperation.alternativa3d::removeSequel(param1.alternativa3d::changePrimitivesOperation);
+ }
+
+ alternativa3d function addToMesh(param1:Mesh) : void
+ {
+ param1.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(this.alternativa3d::updatePrimitiveOperation);
+ param1.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(this.alternativa3d::calculateUVOperation);
+ param1.alternativa3d::changeRotationOrScaleOperation.alternativa3d::addSequel(this.alternativa3d::calculateNormalOperation);
+ param1.alternativa3d::calculateMobilityOperation.alternativa3d::addSequel(this.alternativa3d::updatePrimitiveOperation);
+ this.alternativa3d::_mesh = param1;
+ }
+
+ alternativa3d function removeFromMesh(param1:Mesh) : void
+ {
+ param1.alternativa3d::changeCoordsOperation.alternativa3d::removeSequel(this.alternativa3d::updatePrimitiveOperation);
+ param1.alternativa3d::changeCoordsOperation.alternativa3d::removeSequel(this.alternativa3d::calculateUVOperation);
+ param1.alternativa3d::changeRotationOrScaleOperation.alternativa3d::removeSequel(this.alternativa3d::calculateNormalOperation);
+ param1.alternativa3d::calculateMobilityOperation.alternativa3d::removeSequel(this.alternativa3d::updatePrimitiveOperation);
+ this.alternativa3d::_mesh = null;
+ }
+
+ alternativa3d function addToSurface(param1:Surface) : void
+ {
+ param1.alternativa3d::changeMaterialOperation.alternativa3d::addSequel(this.alternativa3d::updateMaterialOperation);
+ if(this.alternativa3d::_mesh != null && (this.alternativa3d::_surface != null && this.alternativa3d::_surface.alternativa3d::_material != param1.alternativa3d::_material || this.alternativa3d::_surface == null && param1.alternativa3d::_material != null))
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::updateMaterialOperation);
+ }
+ this.alternativa3d::_surface = param1;
+ }
+
+ alternativa3d function removeFromSurface(param1:Surface) : void
+ {
+ param1.alternativa3d::changeMaterialOperation.alternativa3d::removeSequel(this.alternativa3d::updateMaterialOperation);
+ if(param1.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::updateMaterialOperation);
+ }
+ this.alternativa3d::_surface = null;
+ }
+
+ public function toString() : String
+ {
+ var loc3:Vertex = null;
+ var loc1:String = "[Face ID:" + this.id + (this.alternativa3d::_verticesCount > 0 ? " vertices:" : "");
+ var loc2:uint = 0;
+ while(loc2 < this.alternativa3d::_verticesCount)
+ {
+ loc3 = this.alternativa3d::_vertices[loc2];
+ loc1 += loc3.id + (loc2 < this.alternativa3d::_verticesCount - 1 ? ", " : "");
+ loc2++;
+ }
+ return loc1 + "]";
+ }
+
+ public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
+ {
+ if(this.dispatcher == null)
+ {
+ this.dispatcher = new EventDispatcher(this);
+ }
+ param3 = false;
+ this.dispatcher.addEventListener(param1,param2,param3,param4,param5);
+ }
+
+ public function dispatchEvent(param1:Event) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ this.dispatcher.dispatchEvent(param1);
+ }
+ return false;
+ }
+
+ public function hasEventListener(param1:String) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ return this.dispatcher.hasEventListener(param1);
+ }
+ return false;
+ }
+
+ public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
+ {
+ if(this.dispatcher != null)
+ {
+ param3 = false;
+ this.dispatcher.removeEventListener(param1,param2,param3);
+ }
+ }
+
+ public function willTrigger(param1:String) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ return this.dispatcher.willTrigger(param1);
+ }
+ return false;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Mesh.as b/src/alternativa/engine3d/core/Mesh.as
new file mode 100644
index 0000000..5de0000
--- /dev/null
+++ b/src/alternativa/engine3d/core/Mesh.as
@@ -0,0 +1,738 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.errors.FaceExistsError;
+ import alternativa.engine3d.errors.FaceNeedMoreVerticesError;
+ import alternativa.engine3d.errors.FaceNotFoundError;
+ import alternativa.engine3d.errors.InvalidIDError;
+ import alternativa.engine3d.errors.SurfaceExistsError;
+ import alternativa.engine3d.errors.SurfaceNotFoundError;
+ import alternativa.engine3d.errors.VertexExistsError;
+ import alternativa.engine3d.errors.VertexNotFoundError;
+ import alternativa.engine3d.materials.SurfaceMaterial;
+ import alternativa.types.Map;
+ import alternativa.utils.ObjectUtils;
+ import flash.geom.Point;
+
+ use namespace alternativa3d;
+
+ public class Mesh extends Object3D
+ {
+ private static var counter:uint = 0;
+
+ private var vertexIDCounter:uint = 0;
+
+ private var faceIDCounter:uint = 0;
+
+ private var surfaceIDCounter:uint = 0;
+
+ alternativa3d var _vertices:Map;
+
+ alternativa3d var _faces:Map;
+
+ alternativa3d var _surfaces:Map;
+
+ public function Mesh(param1:String = null)
+ {
+ this.alternativa3d::_vertices = new Map();
+ this.alternativa3d::_faces = new Map();
+ this.alternativa3d::_surfaces = new Map();
+ super(param1);
+ }
+
+ public function createVertex(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Object = null) : Vertex
+ {
+ if(param4 != null)
+ {
+ if(this.alternativa3d::_vertices[param4] != undefined)
+ {
+ if(this.alternativa3d::_vertices[param4] is Vertex)
+ {
+ throw new VertexExistsError(param4,this);
+ }
+ throw new InvalidIDError(param4,this);
+ }
+ }
+ else
+ {
+ while(this.alternativa3d::_vertices[this.vertexIDCounter] != undefined)
+ {
+ ++this.vertexIDCounter;
+ }
+ param4 = this.vertexIDCounter;
+ }
+ var loc5:Vertex = new Vertex(param1,param2,param3);
+ if(alternativa3d::_scene != null)
+ {
+ loc5.alternativa3d::addToScene(alternativa3d::_scene);
+ }
+ loc5.alternativa3d::addToMesh(this);
+ this.alternativa3d::_vertices[param4] = loc5;
+ return loc5;
+ }
+
+ public function removeVertex(param1:Object) : Vertex
+ {
+ var loc2:* = param1 is Vertex;
+ if(param1 == null)
+ {
+ throw new VertexNotFoundError(null,this);
+ }
+ if(loc2)
+ {
+ if(Vertex(param1).alternativa3d::_mesh != this)
+ {
+ throw new VertexNotFoundError(param1,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_vertices[param1] == undefined)
+ {
+ throw new VertexNotFoundError(param1,this);
+ }
+ if(!(this.alternativa3d::_vertices[param1] is Vertex))
+ {
+ throw new InvalidIDError(param1,this);
+ }
+ }
+ var loc3:Vertex = loc2 ? Vertex(param1) : this.alternativa3d::_vertices[param1];
+ var loc4:Object = loc2 ? this.getVertexId(Vertex(param1)) : param1;
+ if(alternativa3d::_scene != null)
+ {
+ loc3.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ loc3.alternativa3d::removeFromMesh(this);
+ delete this.alternativa3d::_vertices[loc4];
+ return loc3;
+ }
+
+ public function createFace(param1:Array, param2:Object = null) : Face
+ {
+ var loc5:Vertex = null;
+ if(param1 == null)
+ {
+ throw new FaceNeedMoreVerticesError(this);
+ }
+ if(param2 != null)
+ {
+ if(this.alternativa3d::_faces[param2] != undefined)
+ {
+ if(this.alternativa3d::_faces[param2] is Face)
+ {
+ throw new FaceExistsError(param2,this);
+ }
+ throw new InvalidIDError(param2,this);
+ }
+ }
+ else
+ {
+ while(this.alternativa3d::_faces[this.faceIDCounter] != undefined)
+ {
+ ++this.faceIDCounter;
+ }
+ param2 = this.faceIDCounter;
+ }
+ var loc3:uint = param1.length;
+ if(loc3 < 3)
+ {
+ throw new FaceNeedMoreVerticesError(this,loc3);
+ }
+ var loc4:Array = new Array();
+ var loc6:uint = 0;
+ while(loc6 < loc3)
+ {
+ if(param1[loc6] is Vertex)
+ {
+ loc5 = param1[loc6];
+ if(loc5.alternativa3d::_mesh != this)
+ {
+ throw new VertexNotFoundError(param1[loc6],this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_vertices[param1[loc6]] == null)
+ {
+ throw new VertexNotFoundError(param1[loc6],this);
+ }
+ if(!(this.alternativa3d::_vertices[param1[loc6]] is Vertex))
+ {
+ throw new InvalidIDError(param1[loc6],this);
+ }
+ loc5 = this.alternativa3d::_vertices[param1[loc6]];
+ }
+ loc4.push(loc5);
+ loc6++;
+ }
+ var loc7:Face = new Face(loc4);
+ if(alternativa3d::_scene != null)
+ {
+ loc7.alternativa3d::addToScene(alternativa3d::_scene);
+ }
+ loc7.alternativa3d::addToMesh(this);
+ this.alternativa3d::_faces[param2] = loc7;
+ return loc7;
+ }
+
+ public function removeFace(param1:Object) : Face
+ {
+ var loc2:* = param1 is Face;
+ if(param1 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(loc2)
+ {
+ if(Face(param1).alternativa3d::_mesh != this)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_faces[param1] == undefined)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ if(!(this.alternativa3d::_faces[param1] is Face))
+ {
+ throw new InvalidIDError(param1,this);
+ }
+ }
+ var loc3:Face = loc2 ? Face(param1) : this.alternativa3d::_faces[param1];
+ var loc4:Object = loc2 ? this.getFaceId(Face(param1)) : param1;
+ loc3.alternativa3d::removeVertices();
+ if(loc3.alternativa3d::_surface != null)
+ {
+ loc3.alternativa3d::_surface.alternativa3d::_faces.remove(loc3);
+ loc3.alternativa3d::removeFromSurface(loc3.alternativa3d::_surface);
+ }
+ if(alternativa3d::_scene != null)
+ {
+ loc3.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ loc3.alternativa3d::removeFromMesh(this);
+ delete this.alternativa3d::_faces[loc4];
+ return loc3;
+ }
+
+ public function createSurface(param1:Array = null, param2:Object = null) : Surface
+ {
+ var loc4:uint = 0;
+ var loc5:uint = 0;
+ if(param2 != null)
+ {
+ if(this.alternativa3d::_surfaces[param2] != undefined)
+ {
+ if(this.alternativa3d::_surfaces[param2] is Surface)
+ {
+ throw new SurfaceExistsError(param2,this);
+ }
+ throw new InvalidIDError(param2,this);
+ }
+ }
+ else
+ {
+ while(this.alternativa3d::_surfaces[this.surfaceIDCounter] != undefined)
+ {
+ ++this.surfaceIDCounter;
+ }
+ param2 = this.surfaceIDCounter;
+ }
+ var loc3:Surface = new Surface();
+ if(alternativa3d::_scene != null)
+ {
+ loc3.alternativa3d::addToScene(alternativa3d::_scene);
+ }
+ loc3.alternativa3d::addToMesh(this);
+ this.alternativa3d::_surfaces[param2] = loc3;
+ if(param1 != null)
+ {
+ loc4 = param1.length;
+ loc5 = 0;
+ while(loc5 < loc4)
+ {
+ loc3.addFace(param1[loc5]);
+ loc5++;
+ }
+ }
+ return loc3;
+ }
+
+ public function removeSurface(param1:Object) : Surface
+ {
+ var loc2:* = param1 is Surface;
+ if(param1 == null)
+ {
+ throw new SurfaceNotFoundError(null,this);
+ }
+ if(loc2)
+ {
+ if(Surface(param1).alternativa3d::_mesh != this)
+ {
+ throw new SurfaceNotFoundError(param1,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_surfaces[param1] == undefined)
+ {
+ throw new SurfaceNotFoundError(param1,this);
+ }
+ if(!(this.alternativa3d::_surfaces[param1] is Surface))
+ {
+ throw new InvalidIDError(param1,this);
+ }
+ }
+ var loc3:Surface = loc2 ? Surface(param1) : this.alternativa3d::_surfaces[param1];
+ var loc4:Object = loc2 ? this.getSurfaceId(Surface(param1)) : param1;
+ if(alternativa3d::_scene != null)
+ {
+ loc3.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ loc3.alternativa3d::removeFaces();
+ loc3.alternativa3d::removeFromMesh(this);
+ delete this.alternativa3d::_surfaces[loc4];
+ return loc3;
+ }
+
+ public function moveAllFacesToSurface(param1:Object = null, param2:Boolean = false) : Surface
+ {
+ var loc3:Surface = null;
+ var loc4:Object = null;
+ var loc5:Face = null;
+ var loc6:Map = null;
+ var loc7:* = undefined;
+ var loc8:Surface = null;
+ if(param1 is Surface)
+ {
+ if(param1._mesh != this)
+ {
+ throw new SurfaceNotFoundError(param1,this);
+ }
+ loc3 = Surface(param1);
+ }
+ else if(this.alternativa3d::_surfaces[param1] == undefined)
+ {
+ loc3 = this.createSurface(null,param1);
+ loc4 = param1;
+ }
+ else
+ {
+ if(!(this.alternativa3d::_surfaces[param1] is Surface))
+ {
+ throw new InvalidIDError(param1,this);
+ }
+ loc3 = this.alternativa3d::_surfaces[param1];
+ }
+ for each(loc5 in this.alternativa3d::_faces)
+ {
+ if(loc5.alternativa3d::_surface != loc3)
+ {
+ loc3.addFace(loc5);
+ }
+ }
+ if(param2)
+ {
+ if(loc4 == null)
+ {
+ loc4 = this.getSurfaceId(loc3);
+ }
+ loc6 = new Map();
+ loc6[loc4] = loc3;
+ delete this.alternativa3d::_surfaces[loc4];
+ for(loc7 in this.alternativa3d::_surfaces)
+ {
+ loc8 = this.alternativa3d::_surfaces[loc7];
+ if(alternativa3d::_scene != null)
+ {
+ loc8.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ loc8.alternativa3d::removeFromMesh(this);
+ delete this.alternativa3d::_surfaces[loc7];
+ }
+ this.alternativa3d::_surfaces = loc6;
+ }
+ return loc3;
+ }
+
+ public function setMaterialToSurface(param1:SurfaceMaterial, param2:Object) : void
+ {
+ var loc3:* = param2 is Surface;
+ if(param2 == null)
+ {
+ throw new SurfaceNotFoundError(null,this);
+ }
+ if(loc3)
+ {
+ if(Surface(param2).alternativa3d::_mesh != this)
+ {
+ throw new SurfaceNotFoundError(param2,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_surfaces[param2] == undefined)
+ {
+ throw new SurfaceNotFoundError(param2,this);
+ }
+ if(!(this.alternativa3d::_surfaces[param2] is Surface))
+ {
+ throw new InvalidIDError(param2,this);
+ }
+ }
+ var loc4:Surface = loc3 ? Surface(param2) : this.alternativa3d::_surfaces[param2];
+ loc4.material = param1;
+ }
+
+ public function cloneMaterialToAllSurfaces(param1:SurfaceMaterial) : void
+ {
+ var loc2:Surface = null;
+ for each(loc2 in this.alternativa3d::_surfaces)
+ {
+ loc2.material = param1 != null ? SurfaceMaterial(param1.clone()) : null;
+ }
+ }
+
+ public function setUVsToFace(param1:Point, param2:Point, param3:Point, param4:Object) : void
+ {
+ var loc5:* = param4 is Face;
+ if(param4 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(loc5)
+ {
+ if(Face(param4).alternativa3d::_mesh != this)
+ {
+ throw new FaceNotFoundError(param4,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_faces[param4] == undefined)
+ {
+ throw new FaceNotFoundError(param4,this);
+ }
+ if(!(this.alternativa3d::_faces[param4] is Face))
+ {
+ throw new InvalidIDError(param4,this);
+ }
+ }
+ var loc6:Face = loc5 ? Face(param4) : this.alternativa3d::_faces[param4];
+ loc6.aUV = param1;
+ loc6.bUV = param2;
+ loc6.cUV = param3;
+ }
+
+ public function get vertices() : Map
+ {
+ return this.alternativa3d::_vertices.clone();
+ }
+
+ public function get faces() : Map
+ {
+ return this.alternativa3d::_faces.clone();
+ }
+
+ public function get surfaces() : Map
+ {
+ return this.alternativa3d::_surfaces.clone();
+ }
+
+ public function getVertexById(param1:Object) : Vertex
+ {
+ if(param1 == null)
+ {
+ throw new VertexNotFoundError(null,this);
+ }
+ if(this.alternativa3d::_vertices[param1] == undefined)
+ {
+ throw new VertexNotFoundError(param1,this);
+ }
+ if(this.alternativa3d::_vertices[param1] is Vertex)
+ {
+ return this.alternativa3d::_vertices[param1];
+ }
+ throw new InvalidIDError(param1,this);
+ }
+
+ public function getVertexId(param1:Vertex) : Object
+ {
+ var loc2:Object = null;
+ if(param1 == null)
+ {
+ throw new VertexNotFoundError(null,this);
+ }
+ if(param1.alternativa3d::_mesh != this)
+ {
+ throw new VertexNotFoundError(param1,this);
+ }
+ for(loc2 in this.alternativa3d::_vertices)
+ {
+ if(this.alternativa3d::_vertices[loc2] == param1)
+ {
+ return loc2;
+ }
+ }
+ throw new VertexNotFoundError(param1,this);
+ }
+
+ public function hasVertex(param1:Object) : Boolean
+ {
+ if(param1 == null)
+ {
+ throw new VertexNotFoundError(null,this);
+ }
+ if(param1 is Vertex)
+ {
+ return param1._mesh == this;
+ }
+ if(this.alternativa3d::_vertices[param1] != undefined)
+ {
+ if(this.alternativa3d::_vertices[param1] is Vertex)
+ {
+ return true;
+ }
+ throw new InvalidIDError(param1,this);
+ }
+ return false;
+ }
+
+ public function getFaceById(param1:Object) : Face
+ {
+ if(param1 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(this.alternativa3d::_faces[param1] == undefined)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ if(this.alternativa3d::_faces[param1] is Face)
+ {
+ return this.alternativa3d::_faces[param1];
+ }
+ throw new InvalidIDError(param1,this);
+ }
+
+ public function getFaceId(param1:Face) : Object
+ {
+ var loc2:Object = null;
+ if(param1 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(param1.alternativa3d::_mesh != this)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ for(loc2 in this.alternativa3d::_faces)
+ {
+ if(this.alternativa3d::_faces[loc2] == param1)
+ {
+ return loc2;
+ }
+ }
+ throw new FaceNotFoundError(param1,this);
+ }
+
+ public function hasFace(param1:Object) : Boolean
+ {
+ if(param1 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(param1 is Face)
+ {
+ return param1._mesh == this;
+ }
+ if(this.alternativa3d::_faces[param1] != undefined)
+ {
+ if(this.alternativa3d::_faces[param1] is Face)
+ {
+ return true;
+ }
+ throw new InvalidIDError(param1,this);
+ }
+ return false;
+ }
+
+ public function getSurfaceById(param1:Object) : Surface
+ {
+ if(param1 == null)
+ {
+ throw new SurfaceNotFoundError(null,this);
+ }
+ if(this.alternativa3d::_surfaces[param1] == undefined)
+ {
+ throw new SurfaceNotFoundError(param1,this);
+ }
+ if(this.alternativa3d::_surfaces[param1] is Surface)
+ {
+ return this.alternativa3d::_surfaces[param1];
+ }
+ throw new InvalidIDError(param1,this);
+ }
+
+ public function getSurfaceId(param1:Surface) : Object
+ {
+ var loc2:Object = null;
+ if(param1 == null)
+ {
+ throw new SurfaceNotFoundError(null,this);
+ }
+ if(param1.alternativa3d::_mesh != this)
+ {
+ throw new SurfaceNotFoundError(param1,this);
+ }
+ for(loc2 in this.alternativa3d::_surfaces)
+ {
+ if(this.alternativa3d::_surfaces[loc2] == param1)
+ {
+ return loc2;
+ }
+ }
+ return null;
+ }
+
+ public function hasSurface(param1:Object) : Boolean
+ {
+ if(param1 == null)
+ {
+ throw new SurfaceNotFoundError(null,this);
+ }
+ if(param1 is Surface)
+ {
+ return param1._mesh == this;
+ }
+ if(this.alternativa3d::_surfaces[param1] != undefined)
+ {
+ if(this.alternativa3d::_surfaces[param1] is Surface)
+ {
+ return true;
+ }
+ throw new InvalidIDError(param1,this);
+ }
+ return false;
+ }
+
+ override alternativa3d function setScene(param1:Scene3D) : void
+ {
+ var loc2:Vertex = null;
+ var loc3:Face = null;
+ var loc4:Surface = null;
+ if(alternativa3d::_scene != param1)
+ {
+ if(param1 != null)
+ {
+ for each(loc2 in this.alternativa3d::_vertices)
+ {
+ loc2.alternativa3d::addToScene(param1);
+ }
+ for each(loc3 in this.alternativa3d::_faces)
+ {
+ loc3.alternativa3d::addToScene(param1);
+ }
+ for each(loc4 in this.alternativa3d::_surfaces)
+ {
+ loc4.alternativa3d::addToScene(param1);
+ }
+ }
+ else
+ {
+ for each(loc2 in this.alternativa3d::_vertices)
+ {
+ loc2.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ for each(loc3 in this.alternativa3d::_faces)
+ {
+ loc3.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ for each(loc4 in this.alternativa3d::_surfaces)
+ {
+ loc4.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ }
+ }
+ super.alternativa3d::setScene(param1);
+ }
+
+ override protected function defaultName() : String
+ {
+ return "mesh" + ++counter;
+ }
+
+ override public function toString() : String
+ {
+ return "[" + ObjectUtils.getClassName(this) + " " + alternativa3d::_name + " vertices: " + this.alternativa3d::_vertices.length + " faces: " + this.alternativa3d::_faces.length + "]";
+ }
+
+ override protected function createEmptyObject() : Object3D
+ {
+ return new Mesh();
+ }
+
+ override protected function clonePropertiesFrom(param1:Object3D) : void
+ {
+ var loc3:* = undefined;
+ var loc4:int = 0;
+ var loc5:int = 0;
+ var loc7:Map = null;
+ var loc8:Vertex = null;
+ var loc9:Face = null;
+ var loc10:Array = null;
+ var loc11:Face = null;
+ var loc12:Surface = null;
+ var loc13:Array = null;
+ var loc14:Surface = null;
+ var loc15:SurfaceMaterial = null;
+ super.clonePropertiesFrom(param1);
+ var loc2:Mesh = Mesh(param1);
+ var loc6:Map = new Map(true);
+ for(loc3 in loc2.alternativa3d::_vertices)
+ {
+ loc8 = loc2.alternativa3d::_vertices[loc3];
+ loc6[loc8] = this.createVertex(loc8.x,loc8.y,loc8.z,loc3);
+ }
+ loc7 = new Map(true);
+ for(loc3 in loc2.alternativa3d::_faces)
+ {
+ loc9 = loc2.alternativa3d::_faces[loc3];
+ loc4 = int(loc9.alternativa3d::_vertices.length);
+ loc10 = new Array(loc4);
+ loc5 = 0;
+ while(loc5 < loc4)
+ {
+ loc10[loc5] = loc6[loc9.alternativa3d::_vertices[loc5]];
+ loc5++;
+ }
+ loc11 = this.createFace(loc10,loc3);
+ loc11.aUV = loc9.alternativa3d::_aUV;
+ loc11.bUV = loc9.alternativa3d::_bUV;
+ loc11.cUV = loc9.alternativa3d::_cUV;
+ loc7[loc9] = loc11;
+ }
+ for(loc3 in loc2.alternativa3d::_surfaces)
+ {
+ loc12 = loc2.alternativa3d::_surfaces[loc3];
+ loc13 = loc12.alternativa3d::_faces.toArray();
+ loc4 = int(loc13.length);
+ loc5 = 0;
+ while(loc5 < loc4)
+ {
+ loc13[loc5] = loc7[loc13[loc5]];
+ loc5++;
+ }
+ loc14 = this.createSurface(loc13,loc3);
+ loc15 = loc12.material;
+ if(loc15 != null)
+ {
+ loc14.material = SurfaceMaterial(loc15.clone());
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Object3D.as b/src/alternativa/engine3d/core/Object3D.as
new file mode 100644
index 0000000..b58f30e
--- /dev/null
+++ b/src/alternativa/engine3d/core/Object3D.as
@@ -0,0 +1,661 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.errors.Object3DHierarchyError;
+ import alternativa.engine3d.errors.Object3DNotFoundError;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.utils.ObjectUtils;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IEventDispatcher;
+
+ use namespace alternativa3d;
+
+ public class Object3D implements IEventDispatcher
+ {
+ alternativa3d static var matrix1:Matrix3D = new Matrix3D();
+
+ alternativa3d static var matrix2:Matrix3D = new Matrix3D();
+
+ private static var counter:uint = 0;
+
+ alternativa3d var changeRotationOrScaleOperation:Operation;
+
+ alternativa3d var changeCoordsOperation:Operation;
+
+ alternativa3d var calculateTransformationOperation:Operation;
+
+ alternativa3d var calculateMobilityOperation:Operation;
+
+ alternativa3d var _name:String;
+
+ alternativa3d var _scene:Scene3D;
+
+ alternativa3d var _parent:Object3D;
+
+ alternativa3d var _children:Set;
+
+ alternativa3d var _mobility:int = 0;
+
+ alternativa3d var inheritedMobility:int;
+
+ alternativa3d var _coords:Point3D;
+
+ alternativa3d var _rotationX:Number = 0;
+
+ alternativa3d var _rotationY:Number = 0;
+
+ alternativa3d var _rotationZ:Number = 0;
+
+ alternativa3d var _scaleX:Number = 1;
+
+ alternativa3d var _scaleY:Number = 1;
+
+ alternativa3d var _scaleZ:Number = 1;
+
+ alternativa3d var _transformation:Matrix3D;
+
+ alternativa3d var globalCoords:Point3D;
+
+ public var mouseEnabled:Boolean = true;
+
+ private var dispatcher:EventDispatcher;
+
+ public function Object3D(param1:String = null)
+ {
+ this.alternativa3d::changeRotationOrScaleOperation = new Operation("changeRotationOrScale",this);
+ this.alternativa3d::changeCoordsOperation = new Operation("changeCoords",this);
+ this.alternativa3d::calculateTransformationOperation = new Operation("calculateTransformation",this,this.alternativa3d::calculateTransformation,Operation.alternativa3d::OBJECT_CALCULATE_TRANSFORMATION);
+ this.alternativa3d::calculateMobilityOperation = new Operation("calculateMobility",this,this.calculateMobility,Operation.alternativa3d::OBJECT_CALCULATE_MOBILITY);
+ this.alternativa3d::_children = new Set();
+ this.alternativa3d::_coords = new Point3D();
+ this.alternativa3d::_transformation = new Matrix3D();
+ this.alternativa3d::globalCoords = new Point3D();
+ super();
+ this.alternativa3d::_name = param1 != null ? param1 : this.defaultName();
+ this.alternativa3d::changeRotationOrScaleOperation.alternativa3d::addSequel(this.alternativa3d::calculateTransformationOperation);
+ this.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(this.alternativa3d::calculateTransformationOperation);
+ }
+
+ alternativa3d function calculateTransformation() : void
+ {
+ if(this.alternativa3d::changeRotationOrScaleOperation.alternativa3d::queued)
+ {
+ this.alternativa3d::_transformation.toTransform(this.alternativa3d::_coords.x,this.alternativa3d::_coords.y,this.alternativa3d::_coords.z,this.alternativa3d::_rotationX,this.alternativa3d::_rotationY,this.alternativa3d::_rotationZ,this.alternativa3d::_scaleX,this.alternativa3d::_scaleY,this.alternativa3d::_scaleZ);
+ if(this.alternativa3d::_parent != null)
+ {
+ this.alternativa3d::_transformation.combine(this.alternativa3d::_parent.alternativa3d::_transformation);
+ }
+ this.alternativa3d::globalCoords.x = this.alternativa3d::_transformation.d;
+ this.alternativa3d::globalCoords.y = this.alternativa3d::_transformation.h;
+ this.alternativa3d::globalCoords.z = this.alternativa3d::_transformation.l;
+ }
+ else
+ {
+ this.alternativa3d::globalCoords.copy(this.alternativa3d::_coords);
+ if(this.alternativa3d::_parent != null)
+ {
+ this.alternativa3d::globalCoords.transform(this.alternativa3d::_parent.alternativa3d::_transformation);
+ }
+ this.alternativa3d::_transformation.offset(this.alternativa3d::globalCoords.x,this.alternativa3d::globalCoords.y,this.alternativa3d::globalCoords.z);
+ }
+ }
+
+ private function calculateMobility() : void
+ {
+ this.alternativa3d::inheritedMobility = (this.alternativa3d::_parent != null ? this.alternativa3d::_parent.alternativa3d::inheritedMobility : 0) + this.alternativa3d::_mobility;
+ }
+
+ public function addChild(param1:Object3D) : Object3D
+ {
+ var loc2:Object3D = null;
+ if(param1 == null)
+ {
+ throw new Object3DHierarchyError(null,this);
+ }
+ if(param1.alternativa3d::_parent == this)
+ {
+ return param1;
+ }
+ if(param1 == this)
+ {
+ throw new Object3DHierarchyError(this,this);
+ }
+ if(param1.alternativa3d::_scene == this.alternativa3d::_scene)
+ {
+ loc2 = this.alternativa3d::_parent;
+ while(loc2 != null)
+ {
+ if(param1 == loc2)
+ {
+ throw new Object3DHierarchyError(param1,this);
+ }
+ loc2 = loc2.alternativa3d::_parent;
+ }
+ }
+ if(param1.alternativa3d::_parent != null)
+ {
+ param1.alternativa3d::_parent.alternativa3d::_children.remove(param1);
+ }
+ else if(param1.alternativa3d::_scene != null && param1.alternativa3d::_scene.alternativa3d::_root == param1)
+ {
+ param1.alternativa3d::_scene.root = null;
+ }
+ this.alternativa3d::_children.add(param1);
+ param1.alternativa3d::setParent(this);
+ param1.alternativa3d::setLevel((this.alternativa3d::calculateTransformationOperation.alternativa3d::priority & 0xFFFFFF) + 1);
+ param1.alternativa3d::setScene(this.alternativa3d::_scene);
+ return param1;
+ }
+
+ public function removeChild(param1:Object3D) : Object3D
+ {
+ if(param1 == null)
+ {
+ throw new Object3DNotFoundError(null,this);
+ }
+ if(param1.alternativa3d::_parent != this)
+ {
+ throw new Object3DNotFoundError(param1,this);
+ }
+ this.alternativa3d::_children.remove(param1);
+ param1.alternativa3d::setParent(null);
+ param1.alternativa3d::setScene(null);
+ return param1;
+ }
+
+ alternativa3d function setParent(param1:Object3D) : void
+ {
+ if(this.alternativa3d::_parent != null)
+ {
+ this.removeParentSequels();
+ }
+ this.alternativa3d::_parent = param1;
+ if(param1 != null)
+ {
+ this.addParentSequels();
+ }
+ }
+
+ alternativa3d function setScene(param1:Scene3D) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Object3D = null;
+ if(this.alternativa3d::_scene != param1)
+ {
+ if(this.alternativa3d::_scene != null)
+ {
+ this.removeFromScene(this.alternativa3d::_scene);
+ }
+ if(param1 != null)
+ {
+ this.addToScene(param1);
+ }
+ this.alternativa3d::_scene = param1;
+ }
+ else
+ {
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ this.alternativa3d::addOperationToScene(this.alternativa3d::calculateMobilityOperation);
+ }
+ for(loc2 in this.alternativa3d::_children)
+ {
+ loc3 = loc2;
+ loc3.alternativa3d::setScene(this.alternativa3d::_scene);
+ }
+ }
+
+ alternativa3d function setLevel(param1:uint) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Object3D = null;
+ this.alternativa3d::calculateTransformationOperation.alternativa3d::priority = this.alternativa3d::calculateTransformationOperation.alternativa3d::priority & 4278190080 | param1;
+ this.alternativa3d::calculateMobilityOperation.alternativa3d::priority = this.alternativa3d::calculateMobilityOperation.alternativa3d::priority & 4278190080 | param1;
+ for(loc2 in this.alternativa3d::_children)
+ {
+ loc3 = loc2;
+ loc3.alternativa3d::setLevel(param1 + 1);
+ }
+ }
+
+ private function addParentSequels() : void
+ {
+ this.alternativa3d::_parent.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(this.alternativa3d::changeCoordsOperation);
+ this.alternativa3d::_parent.alternativa3d::changeRotationOrScaleOperation.alternativa3d::addSequel(this.alternativa3d::changeRotationOrScaleOperation);
+ this.alternativa3d::_parent.alternativa3d::calculateMobilityOperation.alternativa3d::addSequel(this.alternativa3d::calculateMobilityOperation);
+ }
+
+ private function removeParentSequels() : void
+ {
+ this.alternativa3d::_parent.alternativa3d::changeCoordsOperation.alternativa3d::removeSequel(this.alternativa3d::changeCoordsOperation);
+ this.alternativa3d::_parent.alternativa3d::changeRotationOrScaleOperation.alternativa3d::removeSequel(this.alternativa3d::changeRotationOrScaleOperation);
+ this.alternativa3d::_parent.alternativa3d::calculateMobilityOperation.alternativa3d::removeSequel(this.alternativa3d::calculateMobilityOperation);
+ }
+
+ protected function addToScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::addOperation(this.alternativa3d::changeRotationOrScaleOperation);
+ param1.alternativa3d::addOperation(this.alternativa3d::calculateMobilityOperation);
+ }
+
+ protected function removeFromScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeRotationOrScaleOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeCoordsOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::calculateMobilityOperation);
+ }
+
+ public function get name() : String
+ {
+ return this.alternativa3d::_name;
+ }
+
+ public function set name(param1:String) : void
+ {
+ this.alternativa3d::_name = param1;
+ }
+
+ public function get scene() : Scene3D
+ {
+ return this.alternativa3d::_scene;
+ }
+
+ public function get parent() : Object3D
+ {
+ return this.alternativa3d::_parent;
+ }
+
+ public function get children() : Set
+ {
+ return this.alternativa3d::_children.clone();
+ }
+
+ public function get mobility() : int
+ {
+ return this.alternativa3d::_mobility;
+ }
+
+ public function set mobility(param1:int) : void
+ {
+ if(this.alternativa3d::_mobility != param1)
+ {
+ this.alternativa3d::_mobility = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::calculateMobilityOperation);
+ }
+ }
+
+ public function get x() : Number
+ {
+ return this.alternativa3d::_coords.x;
+ }
+
+ public function get y() : Number
+ {
+ return this.alternativa3d::_coords.y;
+ }
+
+ public function get z() : Number
+ {
+ return this.alternativa3d::_coords.z;
+ }
+
+ public function set x(param1:Number) : void
+ {
+ if(this.alternativa3d::_coords.x != param1)
+ {
+ this.alternativa3d::_coords.x = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+
+ public function set y(param1:Number) : void
+ {
+ if(this.alternativa3d::_coords.y != param1)
+ {
+ this.alternativa3d::_coords.y = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+
+ public function set z(param1:Number) : void
+ {
+ if(this.alternativa3d::_coords.z != param1)
+ {
+ this.alternativa3d::_coords.z = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+
+ public function get coords() : Point3D
+ {
+ return this.alternativa3d::_coords.clone();
+ }
+
+ public function set coords(param1:Point3D) : void
+ {
+ if(!this.alternativa3d::_coords.equals(param1))
+ {
+ this.alternativa3d::_coords.copy(param1);
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+
+ public function get rotationX() : Number
+ {
+ return this.alternativa3d::_rotationX;
+ }
+
+ public function get rotationY() : Number
+ {
+ return this.alternativa3d::_rotationY;
+ }
+
+ public function get rotationZ() : Number
+ {
+ return this.alternativa3d::_rotationZ;
+ }
+
+ public function set rotationX(param1:Number) : void
+ {
+ if(this.alternativa3d::_rotationX != param1)
+ {
+ this.alternativa3d::_rotationX = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ }
+ }
+
+ public function set rotationY(param1:Number) : void
+ {
+ if(this.alternativa3d::_rotationY != param1)
+ {
+ this.alternativa3d::_rotationY = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ }
+ }
+
+ public function set rotationZ(param1:Number) : void
+ {
+ if(this.alternativa3d::_rotationZ != param1)
+ {
+ this.alternativa3d::_rotationZ = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ }
+ }
+
+ public function get scaleX() : Number
+ {
+ return this.alternativa3d::_scaleX;
+ }
+
+ public function get scaleY() : Number
+ {
+ return this.alternativa3d::_scaleY;
+ }
+
+ public function get scaleZ() : Number
+ {
+ return this.alternativa3d::_scaleZ;
+ }
+
+ public function set scaleX(param1:Number) : void
+ {
+ if(this.alternativa3d::_scaleX != param1)
+ {
+ this.alternativa3d::_scaleX = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ }
+ }
+
+ public function set scaleY(param1:Number) : void
+ {
+ if(this.alternativa3d::_scaleY != param1)
+ {
+ this.alternativa3d::_scaleY = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ }
+ }
+
+ public function set scaleZ(param1:Number) : void
+ {
+ if(this.alternativa3d::_scaleZ != param1)
+ {
+ this.alternativa3d::_scaleZ = param1;
+ this.alternativa3d::addOperationToScene(this.alternativa3d::changeRotationOrScaleOperation);
+ }
+ }
+
+ public function toString() : String
+ {
+ return "[" + ObjectUtils.getClassName(this) + " " + this.alternativa3d::_name + "]";
+ }
+
+ protected function defaultName() : String
+ {
+ return "object" + ++counter;
+ }
+
+ alternativa3d function addOperationToScene(param1:Operation) : void
+ {
+ if(this.alternativa3d::_scene != null)
+ {
+ this.alternativa3d::_scene.alternativa3d::addOperation(param1);
+ }
+ }
+
+ alternativa3d function removeOperationFromScene(param1:Operation) : void
+ {
+ if(this.alternativa3d::_scene != null)
+ {
+ this.alternativa3d::_scene.alternativa3d::removeOperation(param1);
+ }
+ }
+
+ protected function createEmptyObject() : Object3D
+ {
+ return new Object3D();
+ }
+
+ protected function clonePropertiesFrom(param1:Object3D) : void
+ {
+ this.alternativa3d::_name = param1.alternativa3d::_name;
+ this.alternativa3d::_mobility = param1.alternativa3d::_mobility;
+ this.alternativa3d::_coords.x = param1.alternativa3d::_coords.x;
+ this.alternativa3d::_coords.y = param1.alternativa3d::_coords.y;
+ this.alternativa3d::_coords.z = param1.alternativa3d::_coords.z;
+ this.alternativa3d::_rotationX = param1.alternativa3d::_rotationX;
+ this.alternativa3d::_rotationY = param1.alternativa3d::_rotationY;
+ this.alternativa3d::_rotationZ = param1.alternativa3d::_rotationZ;
+ this.alternativa3d::_scaleX = param1.alternativa3d::_scaleX;
+ this.alternativa3d::_scaleY = param1.alternativa3d::_scaleY;
+ this.alternativa3d::_scaleZ = param1.alternativa3d::_scaleZ;
+ }
+
+ public function clone() : Object3D
+ {
+ var loc2:* = undefined;
+ var loc3:Object3D = null;
+ var loc1:Object3D = this.createEmptyObject();
+ loc1.clonePropertiesFrom(this);
+ for(loc2 in this.alternativa3d::_children)
+ {
+ loc3 = loc2;
+ loc1.addChild(loc3.clone());
+ }
+ return loc1;
+ }
+
+ public function getChildByName(param1:String, param2:Boolean = false) : Object3D
+ {
+ var loc3:* = undefined;
+ var loc4:Object3D = null;
+ for(loc3 in this.alternativa3d::_children)
+ {
+ loc4 = loc3;
+ if(loc4.alternativa3d::_name == param1)
+ {
+ return loc4;
+ }
+ }
+ if(param2)
+ {
+ for(loc3 in this.alternativa3d::_children)
+ {
+ loc4 = loc3;
+ loc4 = loc4.getChildByName(param1,true);
+ if(loc4 != null)
+ {
+ return loc4;
+ }
+ }
+ }
+ return null;
+ }
+
+ public function localToGlobal(param1:Point3D, param2:Point3D = null) : Point3D
+ {
+ if(this.alternativa3d::_scene == null)
+ {
+ return null;
+ }
+ if(param2 == null)
+ {
+ param2 = param1.clone();
+ }
+ if(this.alternativa3d::_parent == null)
+ {
+ return param2;
+ }
+ this.alternativa3d::getTransformation(alternativa3d::matrix2);
+ param2.transform(alternativa3d::matrix2);
+ return param2;
+ }
+
+ public function globalToLocal(param1:Point3D, param2:Point3D = null) : Point3D
+ {
+ if(this.alternativa3d::_scene == null)
+ {
+ return null;
+ }
+ if(param2 == null)
+ {
+ param2 = param1.clone();
+ }
+ if(this.alternativa3d::_parent == null)
+ {
+ return param2;
+ }
+ this.alternativa3d::getTransformation(alternativa3d::matrix2);
+ alternativa3d::matrix2.invert();
+ param2.transform(alternativa3d::matrix2);
+ return param2;
+ }
+
+ public function get transformation() : Matrix3D
+ {
+ if(this.alternativa3d::_scene == null)
+ {
+ return null;
+ }
+ var loc1:Matrix3D = new Matrix3D();
+ this.alternativa3d::getTransformation(loc1);
+ return loc1;
+ }
+
+ public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
+ {
+ if(this.dispatcher == null)
+ {
+ this.dispatcher = new EventDispatcher(this);
+ }
+ param3 = false;
+ this.dispatcher.addEventListener(param1,param2,param3,param4,param5);
+ }
+
+ public function dispatchEvent(param1:Event) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ this.dispatcher.dispatchEvent(param1);
+ }
+ return false;
+ }
+
+ public function hasEventListener(param1:String) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ return this.dispatcher.hasEventListener(param1);
+ }
+ return false;
+ }
+
+ public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
+ {
+ if(this.dispatcher != null)
+ {
+ param3 = false;
+ this.dispatcher.removeEventListener(param1,param2,param3);
+ }
+ }
+
+ public function willTrigger(param1:String) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ return this.dispatcher.willTrigger(param1);
+ }
+ return false;
+ }
+
+ alternativa3d function getTransformation(param1:Matrix3D) : Boolean
+ {
+ var loc3:Object3D = null;
+ var loc2:Object3D = this.alternativa3d::_scene.alternativa3d::_root;
+ var loc4:Object3D = this;
+ do
+ {
+ if(loc4.alternativa3d::changeCoordsOperation.alternativa3d::queued || loc4.alternativa3d::changeRotationOrScaleOperation.alternativa3d::queued)
+ {
+ loc3 = loc4.alternativa3d::_parent;
+ }
+ }
+ while(loc4 = loc4.alternativa3d::_parent, loc4 != loc2);
+
+ if(loc3 != null)
+ {
+ param1.toTransform(this.alternativa3d::_coords.x,this.alternativa3d::_coords.y,this.alternativa3d::_coords.z,this.alternativa3d::_rotationX,this.alternativa3d::_rotationY,this.alternativa3d::_rotationZ,this.alternativa3d::_scaleX,this.alternativa3d::_scaleY,this.alternativa3d::_scaleZ);
+ loc4 = this;
+ while(true)
+ {
+ loc4 = loc4.alternativa3d::_parent;
+ if(loc4 == loc3)
+ {
+ break;
+ }
+ alternativa3d::matrix1.toTransform(loc4.alternativa3d::_coords.x,loc4.alternativa3d::_coords.y,loc4.alternativa3d::_coords.z,loc4.alternativa3d::_rotationX,loc4.alternativa3d::_rotationY,loc4.alternativa3d::_rotationZ,loc4.alternativa3d::_scaleX,loc4.alternativa3d::_scaleY,loc4.alternativa3d::_scaleZ);
+ param1.combine(alternativa3d::matrix1);
+ }
+ if(loc3 != loc2)
+ {
+ param1.combine(loc3.alternativa3d::_transformation);
+ }
+ return true;
+ }
+ param1.copy(this.alternativa3d::_transformation);
+ return false;
+ }
+
+ public function forEach(param1:Function) : void
+ {
+ var loc2:* = undefined;
+ param1.call(this,this);
+ for(loc2 in this.alternativa3d::_children)
+ {
+ Object3D(loc2).forEach(param1);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Operation.as b/src/alternativa/engine3d/core/Operation.as
new file mode 100644
index 0000000..125919a
--- /dev/null
+++ b/src/alternativa/engine3d/core/Operation.as
@@ -0,0 +1,156 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.types.Set;
+
+ use namespace alternativa3d;
+
+ public class Operation
+ {
+ alternativa3d static const OBJECT_CALCULATE_TRANSFORMATION:uint = 16777216;
+
+ alternativa3d static const OBJECT_CALCULATE_MOBILITY:uint = 33554432;
+
+ alternativa3d static const VERTEX_CALCULATE_COORDS:uint = 50331648;
+
+ alternativa3d static const FACE_CALCULATE_BASE_UV:uint = 67108864;
+
+ alternativa3d static const FACE_CALCULATE_NORMAL:uint = 83886080;
+
+ alternativa3d static const FACE_CALCULATE_UV:uint = 100663296;
+
+ alternativa3d static const FACE_UPDATE_PRIMITIVE:uint = 117440512;
+
+ alternativa3d static const SECTOR_UPDATE:uint = 134217728;
+
+ alternativa3d static const SPLITTER_UPDATE:uint = 150994944;
+
+ alternativa3d static const SCENE_CALCULATE_BSP:uint = 167772160;
+
+ alternativa3d static const SECTOR_FIND_NODE:uint = 184549376;
+
+ alternativa3d static const SPLITTER_CHANGE_STATE:uint = 201326592;
+
+ alternativa3d static const SECTOR_CHANGE_VISIBLE:uint = 218103808;
+
+ alternativa3d static const FACE_UPDATE_MATERIAL:uint = 234881024;
+
+ alternativa3d static const SPRITE_UPDATE_MATERIAL:uint = 251658240;
+
+ alternativa3d static const CAMERA_CALCULATE_MATRIX:uint = 268435456;
+
+ alternativa3d static const CAMERA_CALCULATE_PLANES:uint = 285212672;
+
+ alternativa3d static const CAMERA_RENDER:uint = 301989888;
+
+ alternativa3d static const SCENE_CLEAR_PRIMITIVES:uint = 318767104;
+
+ alternativa3d var object:Object;
+
+ alternativa3d var method:Function;
+
+ alternativa3d var name:String;
+
+ private var sequel:Operation;
+
+ private var sequels:Set;
+
+ alternativa3d var priority:uint;
+
+ alternativa3d var queued:Boolean = false;
+
+ public function Operation(param1:String, param2:Object = null, param3:Function = null, param4:uint = 0)
+ {
+ super();
+ this.alternativa3d::object = param2;
+ this.alternativa3d::method = param3;
+ this.alternativa3d::name = param1;
+ this.alternativa3d::priority = param4;
+ }
+
+ alternativa3d function addSequel(param1:Operation) : void
+ {
+ if(this.sequel == null)
+ {
+ if(this.sequels == null)
+ {
+ this.sequel = param1;
+ }
+ else
+ {
+ this.sequels[param1] = true;
+ }
+ }
+ else if(this.sequel != param1)
+ {
+ this.sequels = new Set(true);
+ this.sequels[this.sequel] = true;
+ this.sequels[param1] = true;
+ this.sequel = null;
+ }
+ }
+
+ alternativa3d function removeSequel(param1:Operation) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Boolean = false;
+ if(this.sequel == null)
+ {
+ if(this.sequels != null)
+ {
+ delete this.sequels[param1];
+ loc3 = false;
+ for(loc2 in this.sequels)
+ {
+ if(loc3)
+ {
+ loc3 = false;
+ break;
+ }
+ loc3 = true;
+ }
+ if(loc3)
+ {
+ this.sequel = loc2;
+ this.sequels = null;
+ }
+ }
+ }
+ else if(this.sequel == param1)
+ {
+ this.sequel = null;
+ }
+ }
+
+ alternativa3d function collectSequels(param1:Array) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Operation = null;
+ if(this.sequel == null)
+ {
+ for(loc2 in this.sequels)
+ {
+ loc3 = loc2;
+ if(!loc3.alternativa3d::queued)
+ {
+ param1.push(loc3);
+ loc3.alternativa3d::queued = true;
+ loc3.alternativa3d::collectSequels(param1);
+ }
+ }
+ }
+ else if(!this.sequel.alternativa3d::queued)
+ {
+ param1.push(this.sequel);
+ this.sequel.alternativa3d::queued = true;
+ this.sequel.alternativa3d::collectSequels(param1);
+ }
+ }
+
+ public function toString() : String
+ {
+ return "[Operation " + (this.alternativa3d::priority >>> 24) + "/" + (this.alternativa3d::priority & 0xFFFFFF) + " " + this.alternativa3d::object + "." + this.alternativa3d::name + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/PolyPrimitive.as b/src/alternativa/engine3d/core/PolyPrimitive.as
new file mode 100644
index 0000000..c83b11f
--- /dev/null
+++ b/src/alternativa/engine3d/core/PolyPrimitive.as
@@ -0,0 +1,73 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+
+ use namespace alternativa3d;
+
+ public class PolyPrimitive
+ {
+ private static var collector:Array = new Array();
+
+ alternativa3d var num:uint;
+
+ alternativa3d var points:Array;
+
+ alternativa3d var face:Face;
+
+ alternativa3d var parent:PolyPrimitive;
+
+ alternativa3d var sibling:PolyPrimitive;
+
+ alternativa3d var backFragment:PolyPrimitive;
+
+ alternativa3d var frontFragment:PolyPrimitive;
+
+ alternativa3d var node:BSPNode;
+
+ alternativa3d var splits:uint;
+
+ alternativa3d var disbalance:int;
+
+ public var splitQuality:Number;
+
+ public var mobility:int;
+
+ public function PolyPrimitive()
+ {
+ this.alternativa3d::points = new Array();
+ super();
+ }
+
+ alternativa3d static function create() : PolyPrimitive
+ {
+ var loc1:PolyPrimitive = null;
+ loc1 = collector.pop();
+ if(loc1 != null)
+ {
+ return loc1;
+ }
+ return new PolyPrimitive();
+ }
+
+ alternativa3d static function destroy(param1:PolyPrimitive) : void
+ {
+ param1.alternativa3d::face = null;
+ param1.alternativa3d::points.length = 0;
+ collector.push(param1);
+ }
+
+ alternativa3d function createFragment() : PolyPrimitive
+ {
+ var loc1:PolyPrimitive = alternativa3d::create();
+ loc1.alternativa3d::face = this.alternativa3d::face;
+ loc1.mobility = this.mobility;
+ return loc1;
+ }
+
+ public function toString() : String
+ {
+ return "[Primitive " + this.alternativa3d::face.alternativa3d::_mesh.alternativa3d::_name + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Scene3D.as b/src/alternativa/engine3d/core/Scene3D.as
new file mode 100644
index 0000000..8b1ec53
--- /dev/null
+++ b/src/alternativa/engine3d/core/Scene3D.as
@@ -0,0 +1,1331 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.errors.SectorInOtherSceneError;
+ import alternativa.engine3d.errors.SplitterInOtherSceneError;
+ import alternativa.engine3d.materials.FillMaterial;
+ import alternativa.engine3d.materials.SpriteTextureMaterial;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.engine3d.materials.WireMaterial;
+ import alternativa.types.*;
+ import flash.display.Shape;
+ import flash.display.Sprite;
+
+ use namespace alternativa3d;
+ use namespace alternativatypes;
+
+ public class Scene3D
+ {
+ alternativa3d var updateBSPOperation:Operation;
+
+ alternativa3d var updateSplittersOperation:Operation;
+
+ alternativa3d var changePrimitivesOperation:Operation;
+
+ alternativa3d var calculateBSPOperation:Operation;
+
+ alternativa3d var clearPrimitivesOperation:Operation;
+
+ alternativa3d var _root:Object3D;
+
+ alternativa3d var operations:Array;
+
+ alternativa3d var dummyOperation:Operation;
+
+ alternativa3d var _splitAnalysis:Boolean = true;
+
+ alternativa3d var _splitBalance:Number = 0;
+
+ alternativa3d var changedPrimitives:Set;
+
+ private var childPrimitives:Set;
+
+ alternativa3d var addPrimitives:Array;
+
+ private var _planeOffsetThreshold:Number = 0.01;
+
+ alternativa3d var bsp:BSPNode;
+
+ alternativa3d var removeNodes:Set;
+
+ alternativa3d var dummyNode:BSPNode;
+
+ private var _splitters:Array;
+
+ private var _sectors:Array;
+
+ public function Scene3D()
+ {
+ this.alternativa3d::updateBSPOperation = new Operation("updateBSP",this);
+ this.alternativa3d::updateSplittersOperation = new Operation("updateSplitters",this);
+ this.alternativa3d::changePrimitivesOperation = new Operation("changePrimitives",this);
+ this.alternativa3d::calculateBSPOperation = new Operation("calculateBSP",this,this.calculateBSP,Operation.alternativa3d::SCENE_CALCULATE_BSP);
+ this.alternativa3d::clearPrimitivesOperation = new Operation("clearPrimitives",this,this.clearPrimitives,Operation.alternativa3d::SCENE_CLEAR_PRIMITIVES);
+ this.alternativa3d::operations = new Array();
+ this.alternativa3d::dummyOperation = new Operation("removed",this);
+ this.alternativa3d::changedPrimitives = new Set();
+ this.childPrimitives = new Set();
+ this.alternativa3d::addPrimitives = new Array();
+ this.alternativa3d::removeNodes = new Set();
+ this.alternativa3d::dummyNode = new BSPNode();
+ this._splitters = new Array();
+ this._sectors = new Array();
+ super();
+ this.alternativa3d::updateBSPOperation.alternativa3d::addSequel(this.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::updateBSPOperation.alternativa3d::addSequel(this.alternativa3d::updateSplittersOperation);
+ this.alternativa3d::updateSplittersOperation.alternativa3d::addSequel(this.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::calculateBSPOperation.alternativa3d::addSequel(this.alternativa3d::changePrimitivesOperation);
+ this.alternativa3d::changePrimitivesOperation.alternativa3d::addSequel(this.alternativa3d::clearPrimitivesOperation);
+ }
+
+ public function calculate() : void
+ {
+ var loc1:Operation = null;
+ var loc2:uint = 0;
+ var loc3:uint = 0;
+ if(this.alternativa3d::operations[0] != undefined)
+ {
+ loc2 = this.alternativa3d::operations.length;
+ loc3 = 0;
+ while(loc3 < loc2)
+ {
+ loc1 = this.alternativa3d::operations[loc3];
+ loc1.alternativa3d::collectSequels(this.alternativa3d::operations);
+ loc3++;
+ }
+ loc2 = this.alternativa3d::operations.length;
+ this.alternativa3d::sortOperations(0,loc2 - 1);
+ loc3 = 0;
+ while(loc3 < loc2)
+ {
+ loc1 = this.alternativa3d::operations[loc3];
+ if(loc1.alternativa3d::method != null)
+ {
+ loc1.alternativa3d::method();
+ }
+ loc3++;
+ }
+ loc3 = 0;
+ while(loc3 < loc2)
+ {
+ loc1 = this.alternativa3d::operations.pop();
+ loc1.alternativa3d::queued = false;
+ loc3++;
+ }
+ }
+ }
+
+ alternativa3d function sortOperations(param1:int, param2:int) : void
+ {
+ var loc5:Operation = null;
+ var loc7:Operation = null;
+ var loc3:int = param1;
+ var loc4:int = param2;
+ var loc6:uint = uint(this.alternativa3d::operations[param2 + param1 >> 1].priority);
+ while(true)
+ {
+ loc5 = this.alternativa3d::operations[loc3];
+ if(loc5.alternativa3d::priority >= loc6)
+ {
+ while(loc6 < (loc7 = this.alternativa3d::operations[loc4]).alternativa3d::priority)
+ {
+ loc4--;
+ }
+ if(loc3 <= loc4)
+ {
+ var loc8:*;
+ this.alternativa3d::operations[loc8 = loc3++] = loc7;
+ var loc9:*;
+ this.alternativa3d::operations[loc9 = loc4--] = loc5;
+ }
+ if(loc3 > loc4)
+ {
+ break;
+ }
+ }
+ else
+ {
+ loc3++;
+ }
+ }
+ if(param1 < loc4)
+ {
+ this.alternativa3d::sortOperations(param1,loc4);
+ }
+ if(loc3 < param2)
+ {
+ this.alternativa3d::sortOperations(loc3,param2);
+ }
+ }
+
+ alternativa3d function addOperation(param1:Operation) : void
+ {
+ if(!param1.alternativa3d::queued)
+ {
+ this.alternativa3d::operations.push(param1);
+ param1.alternativa3d::queued = true;
+ }
+ }
+
+ alternativa3d function removeOperation(param1:Operation) : void
+ {
+ if(param1.alternativa3d::queued)
+ {
+ this.alternativa3d::operations[this.alternativa3d::operations.indexOf(param1)] = this.alternativa3d::dummyOperation;
+ param1.alternativa3d::queued = false;
+ }
+ }
+
+ protected function calculateBSP() : void
+ {
+ var loc1:int = 0;
+ var loc2:Splitter = null;
+ var loc3:int = 0;
+ var loc5:PolyPrimitive = null;
+ var loc6:BSPNode = null;
+ var loc7:BSPNode = null;
+ var loc8:BSPNode = null;
+ var loc9:BSPNode = null;
+ if(this.alternativa3d::updateSplittersOperation.alternativa3d::queued || this.alternativa3d::updateBSPOperation.alternativa3d::queued)
+ {
+ this.alternativa3d::removeNodes.clear();
+ this.childBSP(this.alternativa3d::bsp);
+ this.assembleChildPrimitives();
+ loc1 = int(this._splitters.length);
+ if(loc1 > 0)
+ {
+ loc2 = this._splitters[0];
+ this.alternativa3d::bsp = BSPNode.alternativa3d::create(loc2.alternativa3d::primitive);
+ loc3 = 1;
+ while(loc3 < loc1)
+ {
+ loc2 = this.splitters[loc3];
+ this.addBSP(this.alternativa3d::bsp,loc2.alternativa3d::primitive);
+ loc3++;
+ }
+ }
+ else
+ {
+ this.alternativa3d::bsp = null;
+ }
+ }
+ else if(!this.alternativa3d::removeNodes.isEmpty())
+ {
+ while(true)
+ {
+ loc6 = this.alternativa3d::removeNodes.peek();
+ if(loc6 == null)
+ {
+ break;
+ }
+ loc7 = loc6;
+ while(true)
+ {
+ loc6 = loc6.alternativa3d::parent;
+ if(loc6 == null)
+ {
+ break;
+ }
+ if(this.alternativa3d::removeNodes[loc6])
+ {
+ loc7 = loc6;
+ }
+ }
+ loc8 = loc7.alternativa3d::parent;
+ loc9 = this.removeBSPNode(loc7);
+ if(loc9 == this.alternativa3d::dummyNode)
+ {
+ loc9 = null;
+ }
+ if(loc8 != null)
+ {
+ if(loc8.alternativa3d::front == loc7)
+ {
+ loc8.alternativa3d::front = loc9;
+ }
+ else
+ {
+ loc8.alternativa3d::back = loc9;
+ }
+ }
+ else
+ {
+ this.alternativa3d::bsp = loc9;
+ }
+ if(loc9 != null)
+ {
+ loc9.alternativa3d::parent = loc8;
+ }
+ }
+ this.assembleChildPrimitives();
+ }
+ if(this.alternativa3d::addPrimitives[0] != undefined)
+ {
+ if(this.alternativa3d::_splitAnalysis)
+ {
+ this.analyseSplitQuality();
+ this.alternativa3d::sortPrimitives(0,this.alternativa3d::addPrimitives.length - 1);
+ }
+ else
+ {
+ this.alternativa3d::sortPrimitivesByMobility(0,this.alternativa3d::addPrimitives.length - 1);
+ }
+ if(this.alternativa3d::bsp == null)
+ {
+ loc5 = this.alternativa3d::addPrimitives.pop();
+ this.alternativa3d::bsp = BSPNode.alternativa3d::create(loc5);
+ this.alternativa3d::changedPrimitives[loc5] = true;
+ }
+ while(true)
+ {
+ loc5 = this.alternativa3d::addPrimitives.pop();
+ if(loc5 == null)
+ {
+ break;
+ }
+ this.addBSP(this.alternativa3d::bsp,loc5);
+ }
+ }
+ }
+
+ alternativa3d function sortPrimitives(param1:int, param2:int) : void
+ {
+ var loc5:PolyPrimitive = null;
+ var loc9:PolyPrimitive = null;
+ var loc3:int = param1;
+ var loc4:int = param2;
+ var loc6:PolyPrimitive = this.alternativa3d::addPrimitives[param2 + param1 >> 1];
+ var loc7:int = loc6.mobility;
+ var loc8:Number = loc6.splitQuality;
+ while(true)
+ {
+ loc5 = this.alternativa3d::addPrimitives[loc3];
+ if(!(loc5.mobility > loc7 || loc5.mobility == loc7 && loc5.splitQuality > loc8))
+ {
+ while(loc7 > (loc9 = this.alternativa3d::addPrimitives[loc4]).mobility || loc7 == loc9.mobility && loc8 > loc9.splitQuality)
+ {
+ loc4--;
+ }
+ if(loc3 <= loc4)
+ {
+ var loc10:*;
+ this.alternativa3d::addPrimitives[loc10 = loc3++] = loc9;
+ var loc11:*;
+ this.alternativa3d::addPrimitives[loc11 = loc4--] = loc5;
+ }
+ if(loc3 > loc4)
+ {
+ break;
+ }
+ }
+ else
+ {
+ loc3++;
+ }
+ }
+ if(param1 < loc4)
+ {
+ this.alternativa3d::sortPrimitives(param1,loc4);
+ }
+ if(loc3 < param2)
+ {
+ this.alternativa3d::sortPrimitives(loc3,param2);
+ }
+ }
+
+ alternativa3d function sortPrimitivesByMobility(param1:int, param2:int) : void
+ {
+ var loc5:PolyPrimitive = null;
+ var loc7:PolyPrimitive = null;
+ var loc3:int = param1;
+ var loc4:int = param2;
+ var loc6:int = int(this.alternativa3d::addPrimitives[param2 + param1 >> 1].mobility);
+ while(true)
+ {
+ loc5 = this.alternativa3d::addPrimitives[loc3];
+ if(loc5.mobility <= loc6)
+ {
+ while(loc6 > (loc7 = this.alternativa3d::addPrimitives[loc4]).mobility)
+ {
+ loc4--;
+ }
+ if(loc3 <= loc4)
+ {
+ var loc8:*;
+ this.alternativa3d::addPrimitives[loc8 = loc3++] = loc7;
+ var loc9:*;
+ this.alternativa3d::addPrimitives[loc9 = loc4--] = loc5;
+ }
+ if(loc3 > loc4)
+ {
+ break;
+ }
+ }
+ else
+ {
+ loc3++;
+ }
+ }
+ if(param1 < loc4)
+ {
+ this.alternativa3d::sortPrimitivesByMobility(param1,loc4);
+ }
+ if(loc3 < param2)
+ {
+ this.alternativa3d::sortPrimitivesByMobility(loc3,param2);
+ }
+ }
+
+ private function analyseSplitQuality() : void
+ {
+ var loc1:uint = 0;
+ var loc5:PolyPrimitive = null;
+ var loc6:Point3D = null;
+ var loc7:Number = NaN;
+ var loc8:uint = 0;
+ var loc9:PolyPrimitive = null;
+ var loc10:Boolean = false;
+ var loc11:Boolean = false;
+ var loc12:uint = 0;
+ var loc13:Point3D = null;
+ var loc14:Number = NaN;
+ var loc2:uint = this.alternativa3d::addPrimitives.length;
+ var loc3:uint = 0;
+ var loc4:uint = 0;
+ loc1 = 0;
+ while(loc1 < loc2)
+ {
+ loc5 = this.alternativa3d::addPrimitives[loc1];
+ if(loc5.alternativa3d::face != null)
+ {
+ loc5.alternativa3d::splits = 0;
+ loc5.alternativa3d::disbalance = 0;
+ loc6 = loc5.alternativa3d::face.alternativa3d::globalNormal;
+ loc7 = loc5.alternativa3d::face.alternativa3d::globalOffset;
+ loc8 = 0;
+ while(loc8 < loc2)
+ {
+ if(loc1 != loc8)
+ {
+ loc9 = this.alternativa3d::addPrimitives[loc8];
+ if(loc9.alternativa3d::face != null)
+ {
+ if(loc5.mobility <= loc9.mobility)
+ {
+ loc10 = false;
+ loc11 = false;
+ loc12 = 0;
+ while(loc12 < loc9.alternativa3d::num)
+ {
+ loc13 = loc9.alternativa3d::points[loc12];
+ loc14 = loc13.x * loc6.x + loc13.y * loc6.y + loc13.z * loc6.z - loc7;
+ if(loc14 > this._planeOffsetThreshold)
+ {
+ if(!loc10)
+ {
+ ++loc5.alternativa3d::disbalance;
+ loc10 = true;
+ }
+ if(loc11)
+ {
+ ++loc5.alternativa3d::splits;
+ break;
+ }
+ }
+ else if(loc14 < -this._planeOffsetThreshold)
+ {
+ if(!loc11)
+ {
+ --loc5.alternativa3d::disbalance;
+ loc11 = true;
+ }
+ if(loc10)
+ {
+ ++loc5.alternativa3d::splits;
+ break;
+ }
+ }
+ loc12++;
+ }
+ }
+ }
+ }
+ loc8++;
+ }
+ loc5.alternativa3d::disbalance = loc5.alternativa3d::disbalance > 0 ? loc5.alternativa3d::disbalance : int(-loc5.alternativa3d::disbalance);
+ loc3 = loc3 > loc5.alternativa3d::splits ? loc3 : loc5.alternativa3d::splits;
+ loc4 = loc4 > loc5.alternativa3d::disbalance ? loc4 : uint(loc5.alternativa3d::disbalance);
+ }
+ loc1++;
+ }
+ loc1 = 0;
+ while(loc1 < loc2)
+ {
+ loc5 = this.alternativa3d::addPrimitives[loc1];
+ loc5.splitQuality = (1 - this.alternativa3d::_splitBalance) * loc5.alternativa3d::splits / loc3 + this.alternativa3d::_splitBalance * loc5.alternativa3d::disbalance / loc4;
+ loc1++;
+ }
+ }
+
+ protected function addBSP(param1:BSPNode, param2:PolyPrimitive) : void
+ {
+ var loc3:Point3D = null;
+ var loc4:Point3D = null;
+ var loc5:* = undefined;
+ var loc6:PolyPrimitive = null;
+ var loc7:Array = null;
+ var loc8:Boolean = false;
+ var loc9:Boolean = false;
+ var loc10:uint = 0;
+ var loc11:Number = NaN;
+ var loc12:SplitterPrimitive = null;
+ var loc13:PolyPrimitive = null;
+ var loc14:PolyPrimitive = null;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:uint = 0;
+ var loc19:Number = NaN;
+ if(param2.mobility < param1.alternativa3d::mobility || param1.alternativa3d::isSprite && param2.alternativa3d::face != null)
+ {
+ if(param1.alternativa3d::primitive != null)
+ {
+ this.childPrimitives[param1.alternativa3d::primitive] = true;
+ this.alternativa3d::changedPrimitives[param1.alternativa3d::primitive] = true;
+ param1.alternativa3d::primitive.alternativa3d::node = null;
+ }
+ else
+ {
+ for(loc5 in param1.alternativa3d::backPrimitives)
+ {
+ loc6 = loc5;
+ this.childPrimitives[loc6] = true;
+ this.alternativa3d::changedPrimitives[loc6] = true;
+ loc6.alternativa3d::node = null;
+ }
+ for(loc5 in param1.alternativa3d::frontPrimitives)
+ {
+ loc6 = loc5;
+ this.childPrimitives[loc6] = true;
+ this.alternativa3d::changedPrimitives[loc6] = true;
+ loc6.alternativa3d::node = null;
+ }
+ }
+ this.childBSP(param1.alternativa3d::back);
+ this.childBSP(param1.alternativa3d::front);
+ this.assembleChildPrimitives();
+ if(this.alternativa3d::_splitAnalysis)
+ {
+ this.analyseSplitQuality();
+ this.alternativa3d::sortPrimitives(0,this.alternativa3d::addPrimitives.length - 1);
+ }
+ else
+ {
+ this.alternativa3d::sortPrimitivesByMobility(0,this.alternativa3d::addPrimitives.length - 1);
+ }
+ param1.alternativa3d::primitive = param2;
+ this.alternativa3d::changedPrimitives[param2] = true;
+ param2.alternativa3d::node = param1;
+ param1.alternativa3d::normal.copy(param2.alternativa3d::face.alternativa3d::globalNormal);
+ param1.alternativa3d::offset = param2.alternativa3d::face.alternativa3d::globalOffset;
+ param1.alternativa3d::isSprite = false;
+ param1.alternativa3d::mobility = param2.mobility;
+ param1.alternativa3d::backPrimitives = null;
+ param1.alternativa3d::frontPrimitives = null;
+ param1.alternativa3d::back = null;
+ param1.alternativa3d::front = null;
+ }
+ else
+ {
+ loc4 = param1.alternativa3d::normal;
+ loc7 = param2.alternativa3d::points;
+ loc8 = false;
+ loc9 = false;
+ loc10 = 0;
+ while(loc10 < param2.alternativa3d::num)
+ {
+ loc3 = loc7[loc10];
+ loc11 = loc3.x * loc4.x + loc3.y * loc4.y + loc3.z * loc4.z - param1.alternativa3d::offset;
+ if(loc11 > this._planeOffsetThreshold)
+ {
+ loc8 = true;
+ if(loc9)
+ {
+ break;
+ }
+ }
+ else if(loc11 < -this._planeOffsetThreshold)
+ {
+ loc9 = true;
+ if(loc8)
+ {
+ break;
+ }
+ }
+ loc10++;
+ }
+ if(param1.alternativa3d::splitter != null && !loc8 && !loc9)
+ {
+ if(param2.alternativa3d::face == null)
+ {
+ loc12 = param2 as SplitterPrimitive;
+ if(loc12 != null)
+ {
+ if(Point3D.dot(loc4,loc12.alternativa3d::splitter.alternativa3d::normal) > 0)
+ {
+ loc8 = true;
+ }
+ else
+ {
+ loc9 = true;
+ }
+ }
+ else
+ {
+ loc8 = true;
+ }
+ }
+ else if(Point3D.dot(loc4,param2.alternativa3d::face.alternativa3d::globalNormal) > 0)
+ {
+ loc8 = true;
+ }
+ else
+ {
+ loc9 = true;
+ }
+ }
+ if(!loc8 && !loc9 && (param2.alternativa3d::face != null || param1.alternativa3d::isSprite))
+ {
+ param2.alternativa3d::node = param1;
+ if(param1.alternativa3d::primitive != null)
+ {
+ param1.alternativa3d::frontPrimitives = new Set(true);
+ param1.alternativa3d::frontPrimitives[param1.alternativa3d::primitive] = true;
+ param1.alternativa3d::primitive = null;
+ }
+ if(param2.alternativa3d::face == null || Point3D.dot(param2.alternativa3d::face.alternativa3d::globalNormal,loc4) > 0)
+ {
+ param1.alternativa3d::frontPrimitives[param2] = true;
+ }
+ else
+ {
+ if(param1.alternativa3d::backPrimitives == null)
+ {
+ param1.alternativa3d::backPrimitives = new Set(true);
+ }
+ param1.alternativa3d::backPrimitives[param2] = true;
+ }
+ this.alternativa3d::changedPrimitives[param2] = true;
+ }
+ else if(!loc9)
+ {
+ if(param1.alternativa3d::front == null)
+ {
+ param1.alternativa3d::front = BSPNode.alternativa3d::create(param2);
+ param1.alternativa3d::front.alternativa3d::parent = param1;
+ this.alternativa3d::changedPrimitives[param2] = true;
+ }
+ else
+ {
+ this.addBSP(param1.alternativa3d::front,param2);
+ }
+ }
+ else if(!loc8)
+ {
+ if(param1.alternativa3d::back == null)
+ {
+ param1.alternativa3d::back = BSPNode.alternativa3d::create(param2);
+ param1.alternativa3d::back.alternativa3d::parent = param1;
+ this.alternativa3d::changedPrimitives[param2] = true;
+ }
+ else
+ {
+ this.addBSP(param1.alternativa3d::back,param2);
+ }
+ }
+ else
+ {
+ loc13 = param2.alternativa3d::createFragment();
+ loc14 = param2.alternativa3d::createFragment();
+ loc3 = loc7[0];
+ loc16 = loc15 = loc3.x * loc4.x + loc3.y * loc4.y + loc3.z * loc4.z - param1.alternativa3d::offset;
+ loc10 = 0;
+ while(loc10 < param2.alternativa3d::num)
+ {
+ if(loc10 < param2.alternativa3d::num - 1)
+ {
+ loc18 = uint(loc10 + 1);
+ loc3 = loc7[loc18];
+ loc17 = loc3.x * loc4.x + loc3.y * loc4.y + loc3.z * loc4.z - param1.alternativa3d::offset;
+ }
+ else
+ {
+ loc18 = 0;
+ loc17 = loc15;
+ }
+ if(loc16 > this._planeOffsetThreshold)
+ {
+ loc14.alternativa3d::points.push(loc7[loc10]);
+ }
+ else if(loc16 < -this._planeOffsetThreshold)
+ {
+ loc13.alternativa3d::points.push(loc7[loc10]);
+ }
+ else
+ {
+ loc13.alternativa3d::points.push(loc7[loc10]);
+ loc14.alternativa3d::points.push(loc7[loc10]);
+ }
+ if(loc16 > this._planeOffsetThreshold && loc17 < -this._planeOffsetThreshold || loc16 < -this._planeOffsetThreshold && loc17 > this._planeOffsetThreshold)
+ {
+ loc19 = loc16 / (loc16 - loc17);
+ loc3 = Point3D.interpolate(loc7[loc10],loc7[loc18],loc19);
+ loc13.alternativa3d::points.push(loc3);
+ loc14.alternativa3d::points.push(loc3);
+ }
+ loc16 = loc17;
+ loc10++;
+ }
+ loc13.alternativa3d::num = loc13.alternativa3d::points.length;
+ loc14.alternativa3d::num = loc14.alternativa3d::points.length;
+ loc13.alternativa3d::parent = param2;
+ loc14.alternativa3d::parent = param2;
+ loc13.alternativa3d::sibling = loc14;
+ loc14.alternativa3d::sibling = loc13;
+ param2.alternativa3d::backFragment = loc13;
+ param2.alternativa3d::frontFragment = loc14;
+ if(param1.alternativa3d::back == null)
+ {
+ param1.alternativa3d::back = BSPNode.alternativa3d::create(loc13);
+ param1.alternativa3d::back.alternativa3d::parent = param1;
+ this.alternativa3d::changedPrimitives[loc13] = true;
+ }
+ else
+ {
+ this.addBSP(param1.alternativa3d::back,loc13);
+ }
+ if(param1.alternativa3d::front == null)
+ {
+ param1.alternativa3d::front = BSPNode.alternativa3d::create(loc14);
+ param1.alternativa3d::front.alternativa3d::parent = param1;
+ this.alternativa3d::changedPrimitives[loc14] = true;
+ }
+ else
+ {
+ this.addBSP(param1.alternativa3d::front,loc14);
+ }
+ }
+ }
+ }
+
+ protected function removeBSPNode(param1:BSPNode) : BSPNode
+ {
+ var loc2:BSPNode = null;
+ if(param1 != null)
+ {
+ param1.alternativa3d::back = this.removeBSPNode(param1.alternativa3d::back);
+ param1.alternativa3d::front = this.removeBSPNode(param1.alternativa3d::front);
+ if(!this.alternativa3d::removeNodes[param1])
+ {
+ loc2 = param1;
+ if(param1.alternativa3d::back != null)
+ {
+ if(param1.alternativa3d::back != this.alternativa3d::dummyNode)
+ {
+ param1.alternativa3d::back.alternativa3d::parent = param1;
+ }
+ else
+ {
+ param1.alternativa3d::back = null;
+ }
+ }
+ if(param1.alternativa3d::front != null)
+ {
+ if(param1.alternativa3d::front != this.alternativa3d::dummyNode)
+ {
+ param1.alternativa3d::front.alternativa3d::parent = param1;
+ }
+ else
+ {
+ param1.alternativa3d::front = null;
+ }
+ }
+ }
+ else
+ {
+ if(param1.alternativa3d::back == null)
+ {
+ if(param1.alternativa3d::front != null)
+ {
+ loc2 = param1.alternativa3d::front;
+ param1.alternativa3d::front = null;
+ }
+ }
+ else if(param1.alternativa3d::front == null)
+ {
+ loc2 = param1.alternativa3d::back;
+ param1.alternativa3d::back = null;
+ }
+ else
+ {
+ this.childBSP(param1.alternativa3d::back);
+ this.childBSP(param1.alternativa3d::front);
+ loc2 = this.alternativa3d::dummyNode;
+ param1.alternativa3d::back = null;
+ param1.alternativa3d::front = null;
+ }
+ delete this.alternativa3d::removeNodes[param1];
+ param1.alternativa3d::parent = null;
+ BSPNode.alternativa3d::destroy(param1);
+ }
+ }
+ return loc2;
+ }
+
+ alternativa3d function removeBSPPrimitive(param1:PolyPrimitive) : void
+ {
+ var loc4:* = undefined;
+ var loc5:BSPNode = null;
+ var loc2:BSPNode = param1.alternativa3d::node;
+ param1.alternativa3d::node = null;
+ var loc3:Boolean = false;
+ this.alternativa3d::changedPrimitives[param1] = true;
+ if(loc2.alternativa3d::primitive == param1)
+ {
+ this.alternativa3d::removeNodes[loc2] = true;
+ loc2.alternativa3d::primitive = null;
+ }
+ else if(loc2.alternativa3d::frontPrimitives[param1])
+ {
+ delete loc2.alternativa3d::frontPrimitives[param1];
+ for(loc4 in loc2.alternativa3d::frontPrimitives)
+ {
+ if(loc3)
+ {
+ loc3 = false;
+ break;
+ }
+ loc3 = true;
+ }
+ if(loc4 == null)
+ {
+ loc5 = loc2.alternativa3d::back;
+ loc2.alternativa3d::back = loc2.alternativa3d::front;
+ loc2.alternativa3d::front = loc5;
+ loc2.alternativa3d::normal.invert();
+ loc2.alternativa3d::offset = -loc2.alternativa3d::offset;
+ for(loc4 in loc2.alternativa3d::backPrimitives)
+ {
+ if(loc3)
+ {
+ loc3 = false;
+ break;
+ }
+ loc3 = true;
+ }
+ if(loc3)
+ {
+ loc2.alternativa3d::primitive = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::primitive.mobility;
+ loc2.alternativa3d::frontPrimitives = null;
+ }
+ else
+ {
+ loc2.alternativa3d::frontPrimitives = loc2.alternativa3d::backPrimitives;
+ if(param1.mobility == loc2.alternativa3d::mobility)
+ {
+ loc2.alternativa3d::mobility = int.MAX_VALUE;
+ for(loc4 in loc2.alternativa3d::frontPrimitives)
+ {
+ param1 = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::mobility > param1.mobility ? param1.mobility : loc2.alternativa3d::mobility;
+ }
+ }
+ }
+ loc2.alternativa3d::backPrimitives = null;
+ }
+ else if(loc3 && loc2.alternativa3d::backPrimitives == null)
+ {
+ loc2.alternativa3d::primitive = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::primitive.mobility;
+ loc2.alternativa3d::frontPrimitives = null;
+ }
+ else if(param1.mobility == loc2.alternativa3d::mobility)
+ {
+ loc2.alternativa3d::mobility = int.MAX_VALUE;
+ for(loc4 in loc2.alternativa3d::backPrimitives)
+ {
+ param1 = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::mobility > param1.mobility ? param1.mobility : loc2.alternativa3d::mobility;
+ }
+ for(loc4 in loc2.alternativa3d::frontPrimitives)
+ {
+ param1 = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::mobility > param1.mobility ? param1.mobility : loc2.alternativa3d::mobility;
+ }
+ }
+ }
+ else
+ {
+ delete loc2.alternativa3d::backPrimitives[param1];
+ var loc6:int = 0;
+ var loc7:* = loc2.alternativa3d::backPrimitives;
+ for(loc4 in loc7)
+ {
+ }
+ if(loc4 == null)
+ {
+ for(loc4 in loc2.alternativa3d::frontPrimitives)
+ {
+ if(loc3)
+ {
+ loc3 = false;
+ break;
+ }
+ loc3 = true;
+ }
+ if(loc3)
+ {
+ loc2.alternativa3d::primitive = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::primitive.mobility;
+ loc2.alternativa3d::frontPrimitives = null;
+ }
+ else if(param1.mobility == loc2.alternativa3d::mobility)
+ {
+ loc2.alternativa3d::mobility = int.MAX_VALUE;
+ for(loc4 in loc2.alternativa3d::frontPrimitives)
+ {
+ param1 = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::mobility > param1.mobility ? param1.mobility : loc2.alternativa3d::mobility;
+ }
+ }
+ loc2.alternativa3d::backPrimitives = null;
+ }
+ else if(param1.mobility == loc2.alternativa3d::mobility)
+ {
+ loc2.alternativa3d::mobility = int.MAX_VALUE;
+ for(loc4 in loc2.alternativa3d::backPrimitives)
+ {
+ param1 = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::mobility > param1.mobility ? param1.mobility : loc2.alternativa3d::mobility;
+ }
+ for(loc4 in loc2.alternativa3d::frontPrimitives)
+ {
+ param1 = loc4;
+ loc2.alternativa3d::mobility = loc2.alternativa3d::mobility > param1.mobility ? param1.mobility : loc2.alternativa3d::mobility;
+ }
+ }
+ }
+ }
+
+ protected function childBSP(param1:BSPNode) : void
+ {
+ var loc2:PolyPrimitive = null;
+ var loc3:* = undefined;
+ if(param1 != null && param1 != this.alternativa3d::dummyNode)
+ {
+ loc2 = param1.alternativa3d::primitive;
+ if(loc2 != null)
+ {
+ this.childPrimitives[loc2] = true;
+ this.alternativa3d::changedPrimitives[loc2] = true;
+ param1.alternativa3d::primitive = null;
+ loc2.alternativa3d::node = null;
+ }
+ else
+ {
+ for(loc3 in param1.alternativa3d::backPrimitives)
+ {
+ loc2 = loc3;
+ this.childPrimitives[loc2] = true;
+ this.alternativa3d::changedPrimitives[loc2] = true;
+ loc2.alternativa3d::node = null;
+ }
+ for(loc3 in param1.alternativa3d::frontPrimitives)
+ {
+ loc2 = loc3;
+ this.childPrimitives[loc2] = true;
+ this.alternativa3d::changedPrimitives[loc2] = true;
+ loc2.alternativa3d::node = null;
+ }
+ param1.alternativa3d::backPrimitives = null;
+ param1.alternativa3d::frontPrimitives = null;
+ }
+ this.childBSP(param1.alternativa3d::back);
+ this.childBSP(param1.alternativa3d::front);
+ param1.alternativa3d::parent = null;
+ param1.alternativa3d::back = null;
+ param1.alternativa3d::front = null;
+ BSPNode.alternativa3d::destroy(param1);
+ }
+ }
+
+ protected function assembleChildPrimitives() : void
+ {
+ var loc1:PolyPrimitive = null;
+ while(true)
+ {
+ loc1 = this.childPrimitives.take();
+ if(loc1 == null)
+ {
+ break;
+ }
+ this.assemblePrimitive(loc1);
+ }
+ }
+
+ private function assemblePrimitive(param1:PolyPrimitive) : void
+ {
+ if(param1.alternativa3d::sibling != null && this.canAssemble(param1.alternativa3d::sibling))
+ {
+ this.assemblePrimitive(param1.alternativa3d::parent);
+ param1.alternativa3d::sibling.alternativa3d::sibling = null;
+ param1.alternativa3d::sibling.alternativa3d::parent = null;
+ PolyPrimitive.alternativa3d::destroy(param1.alternativa3d::sibling);
+ param1.alternativa3d::sibling = null;
+ param1.alternativa3d::parent.alternativa3d::backFragment = null;
+ param1.alternativa3d::parent.alternativa3d::frontFragment = null;
+ param1.alternativa3d::parent = null;
+ PolyPrimitive.alternativa3d::destroy(param1);
+ }
+ else
+ {
+ this.alternativa3d::addPrimitives.push(param1);
+ }
+ }
+
+ private function canAssemble(param1:PolyPrimitive) : Boolean
+ {
+ var loc2:PolyPrimitive = null;
+ var loc3:PolyPrimitive = null;
+ var loc4:Boolean = false;
+ var loc5:Boolean = false;
+ if(this.childPrimitives[param1])
+ {
+ delete this.childPrimitives[param1];
+ return true;
+ }
+ loc2 = param1.alternativa3d::backFragment;
+ loc3 = param1.alternativa3d::frontFragment;
+ if(loc2 != null)
+ {
+ loc4 = this.canAssemble(loc2);
+ loc5 = this.canAssemble(loc3);
+ if(loc4 && loc5)
+ {
+ loc2.alternativa3d::parent = null;
+ loc3.alternativa3d::parent = null;
+ loc2.alternativa3d::sibling = null;
+ loc3.alternativa3d::sibling = null;
+ param1.alternativa3d::backFragment = null;
+ param1.alternativa3d::frontFragment = null;
+ PolyPrimitive.alternativa3d::destroy(loc2);
+ PolyPrimitive.alternativa3d::destroy(loc3);
+ return true;
+ }
+ if(loc4)
+ {
+ this.alternativa3d::addPrimitives.push(loc2);
+ }
+ if(loc5)
+ {
+ this.alternativa3d::addPrimitives.push(loc3);
+ }
+ }
+ return false;
+ }
+
+ private function clearPrimitives() : void
+ {
+ this.alternativa3d::changedPrimitives.clear();
+ }
+
+ public function hasChanges() : Boolean
+ {
+ var loc1:int = int(this.alternativa3d::operations.length);
+ var loc2:int = 0;
+ while(loc2 < loc1)
+ {
+ if(this.alternativa3d::operations[loc2] != this.alternativa3d::dummyOperation)
+ {
+ return true;
+ }
+ loc2++;
+ }
+ return false;
+ }
+
+ public function get root() : Object3D
+ {
+ return this.alternativa3d::_root;
+ }
+
+ public function set root(param1:Object3D) : void
+ {
+ if(this.alternativa3d::_root != param1)
+ {
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::_parent != null)
+ {
+ param1.alternativa3d::_parent.alternativa3d::_children.remove(param1);
+ }
+ else if(param1.alternativa3d::_scene != null && param1.alternativa3d::_scene.alternativa3d::_root == param1)
+ {
+ param1.alternativa3d::_scene.root = null;
+ }
+ param1.alternativa3d::setParent(null);
+ param1.alternativa3d::setScene(this);
+ param1.alternativa3d::setLevel(0);
+ }
+ if(this.alternativa3d::_root != null)
+ {
+ this.alternativa3d::_root.alternativa3d::setParent(null);
+ this.alternativa3d::_root.alternativa3d::setScene(null);
+ }
+ this.alternativa3d::_root = param1;
+ }
+ }
+
+ public function get splitters() : Array
+ {
+ return new Array().concat(this._splitters);
+ }
+
+ public function set splitters(param1:Array) : void
+ {
+ var loc2:Splitter = null;
+ var loc3:int = 0;
+ var loc4:int = 0;
+ for each(loc2 in this._splitters)
+ {
+ loc2.alternativa3d::removeFromScene(this);
+ }
+ if(param1 != null)
+ {
+ loc3 = int(param1.length);
+ loc4 = 0;
+ while(loc4 < loc3)
+ {
+ loc2 = param1[loc4];
+ if(loc2.alternativa3d::_scene != null)
+ {
+ this._splitters.length = loc4;
+ this.alternativa3d::addOperation(this.alternativa3d::updateSplittersOperation);
+ throw new SplitterInOtherSceneError(loc2,this);
+ }
+ loc2.alternativa3d::addToScene(this);
+ this._splitters[loc4] = loc2;
+ loc4++;
+ }
+ this._splitters.length = loc3;
+ }
+ else
+ {
+ this._splitters.length = 0;
+ }
+ this.alternativa3d::addOperation(this.alternativa3d::updateSplittersOperation);
+ }
+
+ public function get sectors() : Array
+ {
+ return new Array().concat(this._sectors);
+ }
+
+ public function set sectors(param1:Array) : void
+ {
+ var loc2:Sector = null;
+ var loc3:int = 0;
+ var loc4:int = 0;
+ for each(loc2 in this._sectors)
+ {
+ loc2.alternativa3d::removeFromScene(this);
+ }
+ if(param1 != null)
+ {
+ loc3 = int(param1.length);
+ loc4 = 0;
+ while(loc4 < loc3)
+ {
+ loc2 = param1[loc4];
+ if(loc2.alternativa3d::_scene != null)
+ {
+ this._sectors.length = loc4;
+ throw new SectorInOtherSceneError(loc2,this);
+ }
+ loc2.alternativa3d::addToScene(this);
+ loc2.alternativa3d::setLevel(loc4);
+ this._sectors[loc4] = loc2;
+ loc4++;
+ }
+ this._sectors.length = loc3;
+ }
+ else
+ {
+ this._sectors.length = 0;
+ }
+ }
+
+ public function get splitAnalysis() : Boolean
+ {
+ return this.alternativa3d::_splitAnalysis;
+ }
+
+ public function set splitAnalysis(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_splitAnalysis != param1)
+ {
+ this.alternativa3d::_splitAnalysis = param1;
+ this.alternativa3d::addOperation(this.alternativa3d::updateBSPOperation);
+ }
+ }
+
+ public function get splitBalance() : Number
+ {
+ return this.alternativa3d::_splitBalance;
+ }
+
+ public function set splitBalance(param1:Number) : void
+ {
+ param1 = param1 < 0 ? 0 : (param1 > 1 ? 1 : param1);
+ if(this.alternativa3d::_splitBalance != param1)
+ {
+ this.alternativa3d::_splitBalance = param1;
+ if(this.alternativa3d::_splitAnalysis)
+ {
+ this.alternativa3d::addOperation(this.alternativa3d::updateBSPOperation);
+ }
+ }
+ }
+
+ public function get planeOffsetThreshold() : Number
+ {
+ return this._planeOffsetThreshold;
+ }
+
+ public function set planeOffsetThreshold(param1:Number) : void
+ {
+ param1 = param1 < 0 ? 0 : param1;
+ if(this._planeOffsetThreshold != param1)
+ {
+ this._planeOffsetThreshold = param1;
+ this.alternativa3d::addOperation(this.alternativa3d::updateBSPOperation);
+ }
+ }
+
+ public function drawBSP(param1:Sprite) : void
+ {
+ param1.graphics.clear();
+ while(param1.numChildren > 0)
+ {
+ param1.removeChildAt(0);
+ }
+ if(this.alternativa3d::bsp != null)
+ {
+ this.drawBSPNode(this.alternativa3d::bsp,param1,0,0,1);
+ }
+ }
+
+ private function drawBSPNode(param1:BSPNode, param2:Sprite, param3:Number, param4:Number, param5:Number) : void
+ {
+ var loc10:SpritePrimitive = null;
+ var loc11:SpriteTextureMaterial = null;
+ var loc12:PolyPrimitive = null;
+ var loc6:Shape = new Shape();
+ param2.addChild(loc6);
+ loc6.x = param3;
+ loc6.y = param4;
+ var loc7:uint = 16711680;
+ if(param1.alternativa3d::splitter != null)
+ {
+ if(param1.alternativa3d::splitter.alternativa3d::_open)
+ {
+ loc7 = 65280;
+ }
+ else
+ {
+ loc7 = 16773120;
+ }
+ loc6.graphics.beginFill(loc7);
+ loc6.graphics.moveTo(-4,0);
+ loc6.graphics.lineTo(0,-4);
+ loc6.graphics.lineTo(4,0);
+ loc6.graphics.lineTo(0,4);
+ loc6.graphics.endFill();
+ }
+ else if(param1.alternativa3d::isSprite)
+ {
+ if(param1.alternativa3d::primitive != null)
+ {
+ loc10 = param1.alternativa3d::primitive as SpritePrimitive;
+ }
+ else if(param1.alternativa3d::frontPrimitives != null)
+ {
+ loc10 = param1.alternativa3d::frontPrimitives.peek();
+ }
+ if(loc10 != null)
+ {
+ loc11 = loc10.alternativa3d::sprite.alternativa3d::_material as SpriteTextureMaterial;
+ if(loc11 != null && loc11.alternativa3d::_texture != null)
+ {
+ loc7 = loc11.alternativa3d::_texture.alternativatypes::_bitmapData.getPixel(loc11.alternativa3d::_texture.alternativatypes::_bitmapData.width >> 1,loc11.alternativa3d::_texture.alternativatypes::_bitmapData.height >> 1);
+ }
+ }
+ loc6.graphics.beginFill(loc7);
+ loc6.graphics.drawRect(0,0,5,5);
+ loc6.graphics.endFill();
+ }
+ else
+ {
+ if(param1.alternativa3d::primitive != null)
+ {
+ loc12 = param1.alternativa3d::primitive;
+ }
+ else if(param1.alternativa3d::frontPrimitives != null)
+ {
+ loc12 = param1.alternativa3d::frontPrimitives.peek();
+ }
+ if(loc12 != null)
+ {
+ if(loc12.alternativa3d::face.alternativa3d::_surface != null && loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material != null)
+ {
+ if(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material is FillMaterial)
+ {
+ loc7 = FillMaterial(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material).alternativa3d::_color;
+ }
+ if(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material is WireMaterial)
+ {
+ loc7 = WireMaterial(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material).alternativa3d::_color;
+ }
+ if(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material is TextureMaterial && TextureMaterial(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material).alternativa3d::_texture != null)
+ {
+ loc7 = TextureMaterial(loc12.alternativa3d::face.alternativa3d::_surface.alternativa3d::_material).texture.alternativatypes::_bitmapData.getPixel(0,0);
+ }
+ }
+ }
+ if(param1 == this.alternativa3d::dummyNode)
+ {
+ loc7 = 16711935;
+ }
+ loc6.graphics.beginFill(loc7);
+ loc6.graphics.drawCircle(0,0,3);
+ loc6.graphics.endFill();
+ }
+ if(param1.alternativa3d::back != null)
+ {
+ param2.graphics.lineStyle(0,6684672);
+ param2.graphics.moveTo(param3,param4);
+ param2.graphics.lineTo(param3 - 100 * param5,param4 + 20);
+ this.drawBSPNode(param1.alternativa3d::back,param2,param3 - 100 * param5,param4 + 20,param5 * 0.8);
+ }
+ if(param1.alternativa3d::front != null)
+ {
+ param2.graphics.lineStyle(0,26112);
+ param2.graphics.moveTo(param3,param4);
+ param2.graphics.lineTo(param3 + 100 * param5,param4 + 20);
+ this.drawBSPNode(param1.alternativa3d::front,param2,param3 + 100 * param5,param4 + 20,param5 * 0.8);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Sector.as b/src/alternativa/engine3d/core/Sector.as
new file mode 100644
index 0000000..86da554
--- /dev/null
+++ b/src/alternativa/engine3d/core/Sector.as
@@ -0,0 +1,253 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+
+ use namespace alternativa3d;
+
+ public class Sector
+ {
+ private static var counter:uint = 0;
+
+ alternativa3d var updateOperation:Operation;
+
+ alternativa3d var findNodeOperation:Operation;
+
+ alternativa3d var changeVisibleOperation:Operation;
+
+ alternativa3d var _visible:Set;
+
+ private var x:Number;
+
+ private var y:Number;
+
+ private var z:Number;
+
+ alternativa3d var _scene:Scene3D;
+
+ private var _node:BSPNode;
+
+ public var name:String;
+
+ public function Sector(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:String = null)
+ {
+ this.alternativa3d::updateOperation = new Operation("removeSector",this,this.removeFromBSP,Operation.alternativa3d::SECTOR_UPDATE);
+ this.alternativa3d::findNodeOperation = new Operation("addSector",this,this.addToBSP,Operation.alternativa3d::SECTOR_FIND_NODE);
+ this.alternativa3d::changeVisibleOperation = new Operation("changeSectorVisibility",this,this.changeVisible,Operation.alternativa3d::SECTOR_CHANGE_VISIBLE);
+ this.alternativa3d::_visible = new Set();
+ super();
+ this.name = param4 != null ? param4 : "sector" + ++counter;
+ this.x = param1;
+ this.y = param2;
+ this.z = param3;
+ this.alternativa3d::_visible[this] = true;
+ this.alternativa3d::updateOperation.alternativa3d::addSequel(this.alternativa3d::findNodeOperation);
+ this.alternativa3d::findNodeOperation.alternativa3d::addSequel(this.alternativa3d::changeVisibleOperation);
+ }
+
+ public function addVisible(param1:Sector, ... rest) : void
+ {
+ var loc5:Sector = null;
+ param1.alternativa3d::_visible[this] = true;
+ this.alternativa3d::_visible[param1] = true;
+ param1.alternativa3d::markToChange();
+ var loc3:int = int(rest.length);
+ var loc4:int = 0;
+ while(loc4 < loc3)
+ {
+ loc5 = rest[loc4];
+ loc5.alternativa3d::_visible[this] = true;
+ this.alternativa3d::_visible[loc5] = true;
+ loc5.alternativa3d::markToChange();
+ loc4++;
+ }
+ this.alternativa3d::markToChange();
+ }
+
+ public function removeVisible(param1:Sector, ... rest) : void
+ {
+ var loc5:Sector = null;
+ if(Boolean(this.alternativa3d::_visible[param1]) && param1 != this)
+ {
+ delete param1.alternativa3d::_visible[this];
+ param1.alternativa3d::markToChange();
+ delete this.alternativa3d::_visible[param1];
+ this.alternativa3d::markToChange();
+ }
+ var loc3:int = int(rest.length);
+ var loc4:int = 0;
+ while(loc4 < loc3)
+ {
+ loc5 = rest[loc4];
+ if(Boolean(this.alternativa3d::_visible[loc5]) && loc5 != this)
+ {
+ delete loc5.alternativa3d::_visible[this];
+ loc5.alternativa3d::markToChange();
+ delete this.alternativa3d::_visible[loc5];
+ this.alternativa3d::markToChange();
+ }
+ loc4++;
+ }
+ }
+
+ public function isVisible(param1:Sector) : Boolean
+ {
+ return this.alternativa3d::_visible[param1];
+ }
+
+ public function toString() : String
+ {
+ var loc2:Sector = null;
+ var loc4:* = undefined;
+ var loc1:String = "[Sector " + this.name + " X:" + this.x.toFixed(3) + " Y:" + this.y.toFixed(3) + " Z:" + this.z.toFixed(3);
+ var loc3:String = "";
+ for(loc4 in this.alternativa3d::_visible)
+ {
+ if(loc4 != this)
+ {
+ if(loc2 == null)
+ {
+ loc2 = loc4;
+ loc3 = loc2.name;
+ }
+ else
+ {
+ loc2 = loc4;
+ loc3 += " " + loc2.name;
+ }
+ }
+ }
+ return loc2 == null ? loc1 + "]" : loc1 + " visible:[" + loc3 + "]]";
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ this.alternativa3d::_scene = param1;
+ param1.alternativa3d::updateSplittersOperation.alternativa3d::addSequel(this.alternativa3d::updateOperation);
+ this.alternativa3d::changeVisibleOperation.alternativa3d::addSequel(param1.alternativa3d::changePrimitivesOperation);
+ param1.alternativa3d::addOperation(this.alternativa3d::findNodeOperation);
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::updateSplittersOperation.alternativa3d::removeSequel(this.alternativa3d::updateOperation);
+ this.alternativa3d::changeVisibleOperation.alternativa3d::removeSequel(param1.alternativa3d::changePrimitivesOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::findNodeOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeVisibleOperation);
+ this.removeFromBSP();
+ this.alternativa3d::_scene = null;
+ }
+
+ alternativa3d function setLevel(param1:int) : void
+ {
+ this.alternativa3d::findNodeOperation.alternativa3d::priority = this.alternativa3d::findNodeOperation.alternativa3d::priority & 4278190080 | param1;
+ }
+
+ alternativa3d function markToChange() : void
+ {
+ if(this.alternativa3d::_scene != null)
+ {
+ this.alternativa3d::_scene.alternativa3d::addOperation(this.alternativa3d::changeVisibleOperation);
+ }
+ }
+
+ private function removeFromBSP() : void
+ {
+ if(this._node != null)
+ {
+ if(this._node.alternativa3d::frontSector == this)
+ {
+ this._node.alternativa3d::frontSector = null;
+ }
+ else
+ {
+ this._node.alternativa3d::backSector = null;
+ }
+ this._node = null;
+ }
+ }
+
+ private function addToBSP() : void
+ {
+ this.findSectorNode(this.alternativa3d::_scene.alternativa3d::bsp);
+ }
+
+ private function findSectorNode(param1:BSPNode) : void
+ {
+ var loc2:Point3D = null;
+ if(param1 != null && param1.alternativa3d::splitter != null)
+ {
+ loc2 = param1.alternativa3d::normal;
+ if(this.x * loc2.x + this.y * loc2.y + this.z * loc2.z - param1.alternativa3d::offset >= 0)
+ {
+ if(param1.alternativa3d::front == null || param1.alternativa3d::front.alternativa3d::splitter == null)
+ {
+ if(param1.alternativa3d::frontSector == null)
+ {
+ param1.alternativa3d::frontSector = this;
+ this._node = param1;
+ }
+ }
+ else
+ {
+ this.findSectorNode(param1.alternativa3d::front);
+ }
+ }
+ else if(param1.alternativa3d::back == null || param1.alternativa3d::back.alternativa3d::splitter == null)
+ {
+ if(param1.alternativa3d::backSector == null)
+ {
+ param1.alternativa3d::backSector = this;
+ this._node = param1;
+ }
+ }
+ else
+ {
+ this.findSectorNode(param1.alternativa3d::back);
+ }
+ }
+ }
+
+ private function changeVisible() : void
+ {
+ if(this._node != null)
+ {
+ if(this._node.alternativa3d::frontSector == this)
+ {
+ this.changeNode(this._node.alternativa3d::front);
+ }
+ else
+ {
+ this.changeNode(this._node.alternativa3d::back);
+ }
+ }
+ }
+
+ private function changeNode(param1:BSPNode) : void
+ {
+ var loc2:* = undefined;
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::primitive != null)
+ {
+ this.alternativa3d::_scene.alternativa3d::changedPrimitives[param1.alternativa3d::primitive] = true;
+ }
+ else
+ {
+ for(loc2 in param1.alternativa3d::frontPrimitives)
+ {
+ this.alternativa3d::_scene.alternativa3d::changedPrimitives[loc2] = true;
+ }
+ for(loc2 in param1.alternativa3d::backPrimitives)
+ {
+ this.alternativa3d::_scene.alternativa3d::changedPrimitives[loc2] = true;
+ }
+ }
+ this.changeNode(param1.alternativa3d::back);
+ this.changeNode(param1.alternativa3d::front);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Splitter.as b/src/alternativa/engine3d/core/Splitter.as
new file mode 100644
index 0000000..4cf4edd
--- /dev/null
+++ b/src/alternativa/engine3d/core/Splitter.as
@@ -0,0 +1,227 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.errors.SplitterNeedMoreVerticesError;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+
+ use namespace alternativa3d;
+
+ public class Splitter
+ {
+ private static var counter:uint = 0;
+
+ alternativa3d var changeStateOperation:Operation;
+
+ alternativa3d var updatePrimitiveOperation:Operation;
+
+ alternativa3d var _open:Boolean = true;
+
+ alternativa3d var primitive:SplitterPrimitive;
+
+ alternativa3d var normal:Point3D;
+
+ alternativa3d var offset:Number;
+
+ alternativa3d var _scene:Scene3D;
+
+ public var name:String;
+
+ public function Splitter(param1:Array, param2:String = null)
+ {
+ this.alternativa3d::changeStateOperation = new Operation("changeSplitterState",this,this.changeState,Operation.alternativa3d::SPLITTER_CHANGE_STATE);
+ this.alternativa3d::updatePrimitiveOperation = new Operation("updateSplitter",this,this.updatePrimitive,Operation.alternativa3d::SPLITTER_UPDATE);
+ this.alternativa3d::normal = new Point3D();
+ super();
+ var loc3:int = int(param1.length);
+ if(loc3 < 3)
+ {
+ throw new SplitterNeedMoreVerticesError(loc3);
+ }
+ this.alternativa3d::primitive = SplitterPrimitive.alternativa3d::create();
+ this.alternativa3d::primitive.mobility = int.MIN_VALUE;
+ this.alternativa3d::primitive.alternativa3d::splitter = this;
+ var loc4:int = 0;
+ while(loc4 < loc3)
+ {
+ this.alternativa3d::primitive.alternativa3d::points[loc4] = Point3D(param1[loc4]).clone();
+ loc4++;
+ }
+ this.alternativa3d::primitive.alternativa3d::num = loc3;
+ this.calculatePlane();
+ this.name = param2 != null ? param2 : "splitter" + ++counter;
+ }
+
+ public static function createFromFace(param1:Face, param2:String = null) : Splitter
+ {
+ var loc5:int = 0;
+ var loc6:Matrix3D = null;
+ var loc7:Point3D = null;
+ var loc3:Array = param1.alternativa3d::_vertices;
+ var loc4:Array = new Array();
+ if(param1.alternativa3d::_mesh != null && param1.alternativa3d::_mesh.alternativa3d::_scene != null)
+ {
+ loc6 = Object3D.alternativa3d::matrix2;
+ param1.alternativa3d::_mesh.alternativa3d::getTransformation(loc6);
+ loc5 = 0;
+ while(loc5 < param1.alternativa3d::_verticesCount)
+ {
+ loc7 = Vertex(loc3[loc5]).alternativa3d::_coords.clone();
+ loc7.transform(loc6);
+ loc4[loc5] = loc7;
+ loc5++;
+ }
+ }
+ else
+ {
+ loc5 = 0;
+ while(loc5 < param1.alternativa3d::_verticesCount)
+ {
+ loc4[loc5] = Vertex(loc3[loc5]).alternativa3d::_coords;
+ loc5++;
+ }
+ }
+ return new Splitter(loc4,param2);
+ }
+
+ public function get vertices() : Array
+ {
+ var loc1:Array = new Array().concat(this.alternativa3d::primitive.alternativa3d::points);
+ var loc2:int = 0;
+ while(loc2 < this.alternativa3d::primitive.alternativa3d::num)
+ {
+ loc1[loc2] = Point3D(loc1[loc2]).clone();
+ loc2++;
+ }
+ return loc1;
+ }
+
+ public function get open() : Boolean
+ {
+ return this.alternativa3d::_open;
+ }
+
+ public function set open(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_open != param1)
+ {
+ this.alternativa3d::_open = param1;
+ if(this.alternativa3d::_scene != null)
+ {
+ this.alternativa3d::_scene.alternativa3d::addOperation(this.alternativa3d::changeStateOperation);
+ }
+ }
+ }
+
+ public function toString() : String
+ {
+ return "[Splitter " + this.name + (this.alternativa3d::_open ? " open]" : " closed]");
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ this.alternativa3d::_scene = param1;
+ this.alternativa3d::changeStateOperation.alternativa3d::addSequel(this.alternativa3d::_scene.alternativa3d::changePrimitivesOperation);
+ this.alternativa3d::_scene.alternativa3d::updateBSPOperation.alternativa3d::addSequel(this.alternativa3d::updatePrimitiveOperation);
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ this.alternativa3d::changeStateOperation.alternativa3d::removeSequel(param1.alternativa3d::changePrimitivesOperation);
+ param1.alternativa3d::updateBSPOperation.alternativa3d::removeSequel(this.alternativa3d::updatePrimitiveOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeStateOperation);
+ this.removePrimitive(this.alternativa3d::primitive);
+ this.alternativa3d::_scene = null;
+ }
+
+ private function calculatePlane() : void
+ {
+ var loc1:Point3D = this.alternativa3d::primitive.alternativa3d::points[0];
+ var loc2:Point3D = this.alternativa3d::primitive.alternativa3d::points[1];
+ var loc3:Number = loc2.x - loc1.x;
+ var loc4:Number = loc2.y - loc1.y;
+ var loc5:Number = loc2.z - loc1.z;
+ var loc6:Point3D = this.alternativa3d::primitive.alternativa3d::points[2];
+ var loc7:Number = loc6.x - loc1.x;
+ var loc8:Number = loc6.y - loc1.y;
+ var loc9:Number = loc6.z - loc1.z;
+ this.alternativa3d::normal.x = loc9 * loc4 - loc8 * loc5;
+ this.alternativa3d::normal.y = loc7 * loc5 - loc9 * loc3;
+ this.alternativa3d::normal.z = loc8 * loc3 - loc7 * loc4;
+ this.alternativa3d::normal.normalize();
+ this.alternativa3d::offset = loc1.x * this.alternativa3d::normal.x + loc1.y * this.alternativa3d::normal.y + loc1.z * this.alternativa3d::normal.z;
+ }
+
+ private function updatePrimitive() : void
+ {
+ this.removePrimitive(this.alternativa3d::primitive);
+ }
+
+ private function changeState() : void
+ {
+ this.changePrimitiveNode(this.alternativa3d::primitive);
+ }
+
+ private function changePrimitiveNode(param1:PolyPrimitive) : void
+ {
+ if(param1.alternativa3d::backFragment == null)
+ {
+ this.changePrimitivesInNode(param1.alternativa3d::node.alternativa3d::back);
+ this.changePrimitivesInNode(param1.alternativa3d::node.alternativa3d::front);
+ }
+ else
+ {
+ this.changePrimitiveNode(param1.alternativa3d::backFragment);
+ this.changePrimitiveNode(param1.alternativa3d::frontFragment);
+ }
+ }
+
+ private function changePrimitivesInNode(param1:BSPNode) : void
+ {
+ var loc2:* = undefined;
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::primitive != null)
+ {
+ this.alternativa3d::_scene.alternativa3d::changedPrimitives[param1.alternativa3d::primitive] = true;
+ }
+ else
+ {
+ for(loc2 in param1.alternativa3d::frontPrimitives)
+ {
+ this.alternativa3d::_scene.alternativa3d::changedPrimitives[loc2] = true;
+ }
+ for(loc2 in param1.alternativa3d::backPrimitives)
+ {
+ this.alternativa3d::_scene.alternativa3d::changedPrimitives[loc2] = true;
+ }
+ }
+ this.changePrimitivesInNode(param1.alternativa3d::back);
+ this.changePrimitivesInNode(param1.alternativa3d::front);
+ }
+ }
+
+ private function removePrimitive(param1:PolyPrimitive) : void
+ {
+ if(param1.alternativa3d::backFragment != null)
+ {
+ this.removePrimitive(param1.alternativa3d::backFragment);
+ this.removePrimitive(param1.alternativa3d::frontFragment);
+ param1.alternativa3d::backFragment = null;
+ param1.alternativa3d::frontFragment = null;
+ }
+ else if(param1.alternativa3d::node != null)
+ {
+ param1.alternativa3d::node.alternativa3d::splitter = null;
+ this.alternativa3d::_scene.alternativa3d::removeBSPPrimitive(param1);
+ }
+ if(param1 != this.alternativa3d::primitive)
+ {
+ param1.alternativa3d::parent = null;
+ param1.alternativa3d::sibling = null;
+ SplitterPrimitive.alternativa3d::destroy(param1 as SplitterPrimitive);
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/SplitterPrimitive.as b/src/alternativa/engine3d/core/SplitterPrimitive.as
new file mode 100644
index 0000000..7a69df9
--- /dev/null
+++ b/src/alternativa/engine3d/core/SplitterPrimitive.as
@@ -0,0 +1,45 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+
+ use namespace alternativa3d;
+
+ public class SplitterPrimitive extends PolyPrimitive
+ {
+ private static var collector:Array = new Array();
+
+ alternativa3d var splitter:Splitter;
+
+ public function SplitterPrimitive()
+ {
+ super();
+ }
+
+ alternativa3d static function create() : SplitterPrimitive
+ {
+ var loc1:SplitterPrimitive = null;
+ loc1 = collector.pop();
+ if(loc1 != null)
+ {
+ return loc1;
+ }
+ return new SplitterPrimitive();
+ }
+
+ alternativa3d static function destroy(param1:SplitterPrimitive) : void
+ {
+ param1.alternativa3d::splitter = null;
+ param1.alternativa3d::points.length = 0;
+ collector.push(param1);
+ }
+
+ override alternativa3d function createFragment() : PolyPrimitive
+ {
+ var loc1:SplitterPrimitive = alternativa3d::create();
+ loc1.alternativa3d::splitter = this.alternativa3d::splitter;
+ loc1.mobility = mobility;
+ return loc1;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Sprite3D.as b/src/alternativa/engine3d/core/Sprite3D.as
new file mode 100644
index 0000000..7b8e96e
--- /dev/null
+++ b/src/alternativa/engine3d/core/Sprite3D.as
@@ -0,0 +1,163 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.materials.SpriteMaterial;
+
+ use namespace alternativa3d;
+
+ public class Sprite3D extends Object3D
+ {
+ private static var counter:uint = 0;
+
+ alternativa3d var updateMaterialOperation:Operation;
+
+ alternativa3d var primitive:SpritePrimitive;
+
+ alternativa3d var _material:SpriteMaterial;
+
+ alternativa3d var _materialScale:Number;
+
+ public function Sprite3D(param1:String = null)
+ {
+ this.alternativa3d::updateMaterialOperation = new Operation("updateSpriteMaterial",this,this.updateMaterial,Operation.alternativa3d::SPRITE_UPDATE_MATERIAL);
+ super(param1);
+ this.alternativa3d::primitive = new SpritePrimitive();
+ this.alternativa3d::primitive.alternativa3d::sprite = this;
+ this.alternativa3d::primitive.alternativa3d::points = [this.alternativa3d::globalCoords];
+ this.alternativa3d::primitive.alternativa3d::num = 1;
+ this.alternativa3d::primitive.mobility = int.MAX_VALUE;
+ }
+
+ override alternativa3d function calculateTransformation() : void
+ {
+ var loc1:Number = NaN;
+ var loc2:Number = NaN;
+ var loc3:Number = NaN;
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Number = NaN;
+ var loc9:Number = NaN;
+ super.alternativa3d::calculateTransformation();
+ this.updatePrimitive();
+ if(alternativa3d::changeRotationOrScaleOperation.alternativa3d::queued)
+ {
+ loc1 = Number(alternativa3d::_transformation.a);
+ loc2 = Number(alternativa3d::_transformation.b);
+ loc3 = Number(alternativa3d::_transformation.c);
+ loc4 = Number(alternativa3d::_transformation.e);
+ loc5 = Number(alternativa3d::_transformation.f);
+ loc6 = Number(alternativa3d::_transformation.g);
+ loc7 = Number(alternativa3d::_transformation.i);
+ loc8 = Number(alternativa3d::_transformation.j);
+ loc9 = Number(alternativa3d::_transformation.k);
+ this.alternativa3d::_materialScale = (Math.sqrt(loc1 * loc1 + loc4 * loc4 + loc7 * loc7) + Math.sqrt(loc2 * loc2 + loc5 * loc5 + loc8 * loc8) + Math.sqrt(loc3 * loc3 + loc6 * loc6 + loc9 * loc9)) / 3;
+ }
+ }
+
+ private function updatePrimitive() : void
+ {
+ if(this.alternativa3d::primitive.alternativa3d::node != null)
+ {
+ alternativa3d::_scene.alternativa3d::removeBSPPrimitive(this.alternativa3d::primitive);
+ }
+ alternativa3d::_scene.alternativa3d::addPrimitives.push(this.alternativa3d::primitive);
+ }
+
+ private function updateMaterial() : void
+ {
+ if(!alternativa3d::calculateTransformationOperation.alternativa3d::queued)
+ {
+ alternativa3d::_scene.alternativa3d::changedPrimitives[this.alternativa3d::primitive] = true;
+ }
+ }
+
+ override protected function addToScene(param1:Scene3D) : void
+ {
+ super.addToScene(param1);
+ alternativa3d::calculateTransformationOperation.alternativa3d::addSequel(param1.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::updateMaterialOperation.alternativa3d::addSequel(param1.alternativa3d::changePrimitivesOperation);
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::addToScene(param1);
+ }
+ }
+
+ override protected function removeFromScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::removeOperation(this.alternativa3d::updateMaterialOperation);
+ if(this.alternativa3d::primitive.alternativa3d::node != null)
+ {
+ param1.alternativa3d::removeBSPPrimitive(this.alternativa3d::primitive);
+ }
+ param1.alternativa3d::addOperation(param1.alternativa3d::calculateBSPOperation);
+ alternativa3d::calculateTransformationOperation.alternativa3d::removeSequel(param1.alternativa3d::calculateBSPOperation);
+ this.alternativa3d::updateMaterialOperation.alternativa3d::removeSequel(param1.alternativa3d::changePrimitivesOperation);
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromScene(param1);
+ }
+ super.removeFromScene(param1);
+ }
+
+ alternativa3d function addMaterialChangedOperationToScene() : void
+ {
+ if(alternativa3d::_scene != null)
+ {
+ alternativa3d::_scene.alternativa3d::addOperation(this.alternativa3d::updateMaterialOperation);
+ }
+ }
+
+ public function get material() : SpriteMaterial
+ {
+ return this.alternativa3d::_material;
+ }
+
+ public function set material(param1:SpriteMaterial) : void
+ {
+ if(this.alternativa3d::_material != param1)
+ {
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromSprite(this);
+ if(alternativa3d::_scene != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromScene(alternativa3d::_scene);
+ }
+ }
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::_sprite != null)
+ {
+ param1.alternativa3d::_sprite.material = null;
+ }
+ param1.alternativa3d::addToSprite(this);
+ if(alternativa3d::_scene != null)
+ {
+ param1.alternativa3d::addToScene(alternativa3d::_scene);
+ }
+ }
+ this.alternativa3d::_material = param1;
+ this.alternativa3d::addMaterialChangedOperationToScene();
+ }
+ }
+
+ override protected function defaultName() : String
+ {
+ return "sprite" + ++counter;
+ }
+
+ override protected function createEmptyObject() : Object3D
+ {
+ return new Sprite3D();
+ }
+
+ override protected function clonePropertiesFrom(param1:Object3D) : void
+ {
+ super.clonePropertiesFrom(param1);
+ this.material = (param1 as Sprite3D).material.clone() as SpriteMaterial;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/SpritePrimitive.as b/src/alternativa/engine3d/core/SpritePrimitive.as
new file mode 100644
index 0000000..9358e7b
--- /dev/null
+++ b/src/alternativa/engine3d/core/SpritePrimitive.as
@@ -0,0 +1,24 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+
+ use namespace alternativa3d;
+
+ public class SpritePrimitive extends PolyPrimitive
+ {
+ alternativa3d var sprite:Sprite3D;
+
+ alternativa3d var screenDepth:Number;
+
+ public function SpritePrimitive()
+ {
+ super();
+ }
+
+ override public function toString() : String
+ {
+ return "[SpritePrimitive " + this.alternativa3d::sprite.toString() + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Surface.as b/src/alternativa/engine3d/core/Surface.as
new file mode 100644
index 0000000..0893393
--- /dev/null
+++ b/src/alternativa/engine3d/core/Surface.as
@@ -0,0 +1,298 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.errors.FaceExistsError;
+ import alternativa.engine3d.errors.FaceNotFoundError;
+ import alternativa.engine3d.errors.InvalidIDError;
+ import alternativa.engine3d.materials.SurfaceMaterial;
+ import alternativa.types.Set;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IEventDispatcher;
+
+ use namespace alternativa3d;
+
+ public class Surface implements IEventDispatcher
+ {
+ alternativa3d var changeFacesOperation:Operation;
+
+ alternativa3d var changeMaterialOperation:Operation;
+
+ alternativa3d var _mesh:Mesh;
+
+ alternativa3d var _material:SurfaceMaterial;
+
+ alternativa3d var _faces:Set;
+
+ public var mouseEnabled:Boolean = true;
+
+ private var dispatcher:EventDispatcher;
+
+ public function Surface()
+ {
+ this.alternativa3d::changeFacesOperation = new Operation("changeFaces",this);
+ this.alternativa3d::changeMaterialOperation = new Operation("changeMaterial",this);
+ this.alternativa3d::_faces = new Set();
+ super();
+ }
+
+ public function addFace(param1:Object) : void
+ {
+ var loc2:* = param1 is Face;
+ if(this.alternativa3d::_mesh == null)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ if(param1 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(loc2)
+ {
+ if(Face(param1).alternativa3d::_mesh != this.alternativa3d::_mesh)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_mesh.alternativa3d::_faces[param1] == undefined)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ if(!(this.alternativa3d::_mesh.alternativa3d::_faces[param1] is Face))
+ {
+ throw new InvalidIDError(param1,this);
+ }
+ }
+ var loc3:Face = loc2 ? Face(param1) : this.alternativa3d::_mesh.alternativa3d::_faces[param1];
+ if(this.alternativa3d::_faces.has(loc3))
+ {
+ throw new FaceExistsError(loc3,this);
+ }
+ if(loc3.alternativa3d::_surface != null)
+ {
+ loc3.alternativa3d::_surface.alternativa3d::_faces.remove(loc3);
+ loc3.alternativa3d::removeFromSurface(loc3.alternativa3d::_surface);
+ }
+ this.alternativa3d::_faces.add(loc3);
+ loc3.alternativa3d::addToSurface(this);
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeFacesOperation);
+ }
+
+ public function removeFace(param1:Object) : void
+ {
+ var loc2:* = param1 is Face;
+ if(this.alternativa3d::_mesh == null)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ if(param1 == null)
+ {
+ throw new FaceNotFoundError(null,this);
+ }
+ if(loc2)
+ {
+ if(Face(param1).alternativa3d::_mesh != this.alternativa3d::_mesh)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_mesh.alternativa3d::_faces[param1] == undefined)
+ {
+ throw new FaceNotFoundError(param1,this);
+ }
+ if(!(this.alternativa3d::_mesh.alternativa3d::_faces[param1] is Face))
+ {
+ throw new InvalidIDError(param1,this);
+ }
+ }
+ var loc3:Face = loc2 ? Face(param1) : this.alternativa3d::_mesh.alternativa3d::_faces[param1];
+ if(!this.alternativa3d::_faces.has(loc3))
+ {
+ throw new FaceNotFoundError(loc3,this);
+ }
+ this.alternativa3d::_faces.remove(loc3);
+ loc3.alternativa3d::removeFromSurface(this);
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeFacesOperation);
+ }
+
+ public function get material() : SurfaceMaterial
+ {
+ return this.alternativa3d::_material;
+ }
+
+ public function set material(param1:SurfaceMaterial) : void
+ {
+ if(this.alternativa3d::_material != param1)
+ {
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromSurface(this);
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromMesh(this.alternativa3d::_mesh);
+ if(this.alternativa3d::_mesh.alternativa3d::_scene != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromScene(this.alternativa3d::_mesh.alternativa3d::_scene);
+ }
+ }
+ }
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::_surface != null)
+ {
+ param1.alternativa3d::_surface.material = null;
+ }
+ param1.alternativa3d::addToSurface(this);
+ if(this.alternativa3d::_mesh != null)
+ {
+ param1.alternativa3d::addToMesh(this.alternativa3d::_mesh);
+ if(this.alternativa3d::_mesh.alternativa3d::_scene != null)
+ {
+ param1.alternativa3d::addToScene(this.alternativa3d::_mesh.alternativa3d::_scene);
+ }
+ }
+ }
+ this.alternativa3d::_material = param1;
+ this.alternativa3d::addMaterialChangedOperationToScene();
+ }
+ }
+
+ public function get faces() : Set
+ {
+ return this.alternativa3d::_faces.clone();
+ }
+
+ public function get mesh() : Mesh
+ {
+ return this.alternativa3d::_mesh;
+ }
+
+ public function get id() : Object
+ {
+ return this.alternativa3d::_mesh != null ? this.alternativa3d::_mesh.getSurfaceId(this) : null;
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::addToScene(param1);
+ }
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeFacesOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeMaterialOperation);
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromScene(param1);
+ }
+ }
+
+ alternativa3d function addToMesh(param1:Mesh) : void
+ {
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::addToMesh(param1);
+ }
+ this.alternativa3d::_mesh = param1;
+ }
+
+ alternativa3d function removeFromMesh(param1:Mesh) : void
+ {
+ if(this.alternativa3d::_material != null)
+ {
+ this.alternativa3d::_material.alternativa3d::removeFromMesh(param1);
+ }
+ this.alternativa3d::_mesh = null;
+ }
+
+ alternativa3d function removeFaces() : void
+ {
+ var loc1:* = undefined;
+ var loc2:Face = null;
+ for(loc1 in this.alternativa3d::_faces)
+ {
+ loc2 = loc1;
+ this.alternativa3d::_faces.remove(loc2);
+ loc2.alternativa3d::removeFromSurface(this);
+ }
+ }
+
+ alternativa3d function addMaterialChangedOperationToScene() : void
+ {
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeMaterialOperation);
+ }
+ }
+
+ public function toString() : String
+ {
+ var loc4:* = undefined;
+ var loc5:Face = null;
+ var loc1:uint = this.alternativa3d::_faces.length;
+ var loc2:String = "[Surface ID:" + this.id + (loc1 > 0 ? " faces:" : "");
+ var loc3:uint = 0;
+ for(loc4 in this.alternativa3d::_faces)
+ {
+ loc5 = loc4;
+ loc2 += loc5.id + (loc3 < loc1 - 1 ? ", " : "");
+ loc3++;
+ }
+ return loc2 + "]";
+ }
+
+ public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
+ {
+ if(this.dispatcher == null)
+ {
+ this.dispatcher = new EventDispatcher(this);
+ }
+ param3 = false;
+ this.dispatcher.addEventListener(param1,param2,param3,param4,param5);
+ }
+
+ public function dispatchEvent(param1:Event) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ this.dispatcher.dispatchEvent(param1);
+ }
+ return false;
+ }
+
+ public function hasEventListener(param1:String) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ return this.dispatcher.hasEventListener(param1);
+ }
+ return false;
+ }
+
+ public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
+ {
+ if(this.dispatcher != null)
+ {
+ param3 = false;
+ this.dispatcher.removeEventListener(param1,param2,param3);
+ }
+ }
+
+ public function willTrigger(param1:String) : Boolean
+ {
+ if(this.dispatcher != null)
+ {
+ return this.dispatcher.willTrigger(param1);
+ }
+ return false;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/core/Vertex.as b/src/alternativa/engine3d/core/Vertex.as
new file mode 100644
index 0000000..4cf50eb
--- /dev/null
+++ b/src/alternativa/engine3d/core/Vertex.as
@@ -0,0 +1,175 @@
+package alternativa.engine3d.core
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+
+ use namespace alternativa3d;
+
+ public final class Vertex
+ {
+ alternativa3d var changeCoordsOperation:Operation;
+
+ alternativa3d var calculateCoordsOperation:Operation;
+
+ alternativa3d var _mesh:Mesh;
+
+ alternativa3d var _coords:Point3D;
+
+ alternativa3d var _faces:Set;
+
+ alternativa3d var globalCoords:Point3D;
+
+ public function Vertex(param1:Number = 0, param2:Number = 0, param3:Number = 0)
+ {
+ this.alternativa3d::changeCoordsOperation = new Operation("changeCoords",this);
+ this.alternativa3d::calculateCoordsOperation = new Operation("calculateCoords",this,this.calculateCoords,Operation.alternativa3d::VERTEX_CALCULATE_COORDS);
+ this.alternativa3d::_faces = new Set();
+ this.alternativa3d::globalCoords = new Point3D();
+ super();
+ this.alternativa3d::_coords = new Point3D(param1,param2,param3);
+ this.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(this.alternativa3d::calculateCoordsOperation);
+ }
+
+ private function calculateCoords() : void
+ {
+ this.alternativa3d::globalCoords.copy(this.alternativa3d::_coords);
+ this.alternativa3d::globalCoords.transform(this.alternativa3d::_mesh.alternativa3d::_transformation);
+ }
+
+ public function set x(param1:Number) : void
+ {
+ if(this.alternativa3d::_coords.x != param1)
+ {
+ this.alternativa3d::_coords.x = param1;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+ }
+
+ public function set y(param1:Number) : void
+ {
+ if(this.alternativa3d::_coords.y != param1)
+ {
+ this.alternativa3d::_coords.y = param1;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+ }
+
+ public function set z(param1:Number) : void
+ {
+ if(this.alternativa3d::_coords.z != param1)
+ {
+ this.alternativa3d::_coords.z = param1;
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+ }
+
+ public function set coords(param1:Point3D) : void
+ {
+ if(!this.alternativa3d::_coords.equals(param1))
+ {
+ this.alternativa3d::_coords.copy(param1);
+ if(this.alternativa3d::_mesh != null)
+ {
+ this.alternativa3d::_mesh.alternativa3d::addOperationToScene(this.alternativa3d::changeCoordsOperation);
+ }
+ }
+ }
+
+ public function get x() : Number
+ {
+ return this.alternativa3d::_coords.x;
+ }
+
+ public function get y() : Number
+ {
+ return this.alternativa3d::_coords.y;
+ }
+
+ public function get z() : Number
+ {
+ return this.alternativa3d::_coords.z;
+ }
+
+ public function get coords() : Point3D
+ {
+ return this.alternativa3d::_coords.clone();
+ }
+
+ public function get mesh() : Mesh
+ {
+ return this.alternativa3d::_mesh;
+ }
+
+ public function get faces() : Set
+ {
+ return this.alternativa3d::_faces.clone();
+ }
+
+ public function get id() : Object
+ {
+ return this.alternativa3d::_mesh != null ? this.alternativa3d::_mesh.getVertexId(this) : null;
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::addOperation(this.alternativa3d::calculateCoordsOperation);
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ param1.alternativa3d::removeOperation(this.alternativa3d::calculateCoordsOperation);
+ param1.alternativa3d::removeOperation(this.alternativa3d::changeCoordsOperation);
+ }
+
+ alternativa3d function addToMesh(param1:Mesh) : void
+ {
+ param1.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(this.alternativa3d::calculateCoordsOperation);
+ param1.alternativa3d::changeRotationOrScaleOperation.alternativa3d::addSequel(this.alternativa3d::calculateCoordsOperation);
+ this.alternativa3d::_mesh = param1;
+ }
+
+ alternativa3d function removeFromMesh(param1:Mesh) : void
+ {
+ var loc2:* = undefined;
+ var loc3:Face = null;
+ param1.alternativa3d::changeCoordsOperation.alternativa3d::removeSequel(this.alternativa3d::calculateCoordsOperation);
+ param1.alternativa3d::changeRotationOrScaleOperation.alternativa3d::removeSequel(this.alternativa3d::calculateCoordsOperation);
+ for(loc2 in this.alternativa3d::_faces)
+ {
+ loc3 = loc2;
+ param1.removeFace(loc3);
+ }
+ this.alternativa3d::_mesh = null;
+ }
+
+ alternativa3d function addToFace(param1:Face) : void
+ {
+ this.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(param1.alternativa3d::calculateUVOperation);
+ this.alternativa3d::changeCoordsOperation.alternativa3d::addSequel(param1.alternativa3d::calculateNormalOperation);
+ this.alternativa3d::_faces.add(param1);
+ }
+
+ alternativa3d function removeFromFace(param1:Face) : void
+ {
+ this.alternativa3d::changeCoordsOperation.alternativa3d::removeSequel(param1.alternativa3d::calculateUVOperation);
+ this.alternativa3d::changeCoordsOperation.alternativa3d::removeSequel(param1.alternativa3d::calculateNormalOperation);
+ this.alternativa3d::_faces.remove(param1);
+ }
+
+ public function toString() : String
+ {
+ return "[Vertex ID:" + this.id + " " + this.alternativa3d::_coords.x.toFixed(2) + ", " + this.alternativa3d::_coords.y.toFixed(2) + ", " + this.alternativa3d::_coords.z.toFixed(2) + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/display/Skin.as b/src/alternativa/engine3d/display/Skin.as
new file mode 100644
index 0000000..c8696c7
--- /dev/null
+++ b/src/alternativa/engine3d/display/Skin.as
@@ -0,0 +1,46 @@
+package alternativa.engine3d.display
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.PolyPrimitive;
+ import alternativa.engine3d.materials.Material;
+ import flash.display.Graphics;
+ import flash.display.Sprite;
+
+ use namespace alternativa3d;
+
+ public class Skin extends Sprite
+ {
+ private static var collector:Array = new Array();
+
+ alternativa3d var gfx:Graphics;
+
+ alternativa3d var nextSkin:Skin;
+
+ alternativa3d var primitive:PolyPrimitive;
+
+ alternativa3d var material:Material;
+
+ public function Skin()
+ {
+ this.alternativa3d::gfx = graphics;
+ super();
+ }
+
+ alternativa3d static function createSkin() : Skin
+ {
+ var loc1:Skin = null;
+ loc1 = collector.pop();
+ if(loc1 != null)
+ {
+ return loc1;
+ }
+ return new Skin();
+ }
+
+ alternativa3d static function destroySkin(param1:Skin) : void
+ {
+ collector.push(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/display/View.as b/src/alternativa/engine3d/display/View.as
new file mode 100644
index 0000000..23fabd9
--- /dev/null
+++ b/src/alternativa/engine3d/display/View.as
@@ -0,0 +1,796 @@
+package alternativa.engine3d.display
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Sprite3D;
+ import alternativa.engine3d.core.SpritePrimitive;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.events.MouseEvent3D;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.events.MouseEvent;
+ import flash.geom.Point;
+
+ use namespace alternativa3d;
+
+ public class View extends Sprite
+ {
+ alternativa3d var canvas:Sprite;
+
+ private var _camera:Camera3D;
+
+ alternativa3d var _width:Number;
+
+ alternativa3d var _height:Number;
+
+ alternativa3d var _interactive:Boolean;
+
+ private var faceUnderPoint:Face;
+
+ private var objectUnderPoint:Object3D;
+
+ private var lastMouseEvent:MouseEvent;
+
+ private var stagePoint:Point;
+
+ private var currentFace:Face;
+
+ private var currentSurface:Surface;
+
+ private var currentObject:Object3D;
+
+ private var pressedFace:Face;
+
+ private var pressedSurface:Surface;
+
+ private var pressedObject:Object3D;
+
+ private var lineVector:Point3D;
+
+ private var linePoint:Point3D;
+
+ private var globalCursor3DCoords:Point3D;
+
+ private var localCursor3DCoords:Point3D;
+
+ private var uvPoint:Point;
+
+ private var inverseMatrix:Matrix3D;
+
+ public function View(param1:Camera3D = null, param2:Number = 0, param3:Number = 0)
+ {
+ this.stagePoint = new Point();
+ this.lineVector = new Point3D();
+ this.linePoint = new Point3D();
+ this.globalCursor3DCoords = new Point3D();
+ this.localCursor3DCoords = new Point3D();
+ this.uvPoint = new Point();
+ this.inverseMatrix = new Matrix3D();
+ super();
+ this.alternativa3d::canvas = new Sprite();
+ this.alternativa3d::canvas.mouseEnabled = false;
+ this.alternativa3d::canvas.mouseChildren = false;
+ this.alternativa3d::canvas.tabEnabled = false;
+ this.alternativa3d::canvas.tabChildren = false;
+ addChild(this.alternativa3d::canvas);
+ this.camera = param1;
+ this.width = param2;
+ this.height = param3;
+ addEventListener(Event.REMOVED_FROM_STAGE,this.onRemovedFromStage);
+ }
+
+ public function get camera() : Camera3D
+ {
+ return this._camera;
+ }
+
+ public function set camera(param1:Camera3D) : void
+ {
+ var loc2:Skin = null;
+ var loc3:Skin = null;
+ if(this._camera != param1)
+ {
+ if(this._camera != null)
+ {
+ this._camera.alternativa3d::removeFromView(this);
+ }
+ if(param1 != null)
+ {
+ if(param1.alternativa3d::_view != null)
+ {
+ param1.alternativa3d::_view.camera = null;
+ }
+ param1.alternativa3d::addToView(this);
+ }
+ else if(this.alternativa3d::canvas.numChildren > 0)
+ {
+ loc2 = Skin(this.alternativa3d::canvas.getChildAt(0));
+ while(loc2 != null)
+ {
+ loc3 = loc2.alternativa3d::nextSkin;
+ this.alternativa3d::canvas.removeChild(loc2);
+ if(loc2.alternativa3d::material != null)
+ {
+ loc2.alternativa3d::material.alternativa3d::clear(loc2);
+ }
+ loc2.alternativa3d::nextSkin = null;
+ loc2.alternativa3d::primitive = null;
+ loc2.alternativa3d::material = null;
+ Skin.alternativa3d::destroySkin(loc2);
+ loc2 = loc3;
+ }
+ }
+ this._camera = param1;
+ }
+ }
+
+ override public function get width() : Number
+ {
+ return this.alternativa3d::_width;
+ }
+
+ override public function set width(param1:Number) : void
+ {
+ if(this.alternativa3d::_width != param1)
+ {
+ this.alternativa3d::_width = param1;
+ this.alternativa3d::canvas.x = this.alternativa3d::_width * 0.5;
+ if(this._camera != null)
+ {
+ this.camera.alternativa3d::addOperationToScene(this.camera.alternativa3d::calculatePlanesOperation);
+ }
+ }
+ }
+
+ override public function get height() : Number
+ {
+ return this.alternativa3d::_height;
+ }
+
+ override public function set height(param1:Number) : void
+ {
+ if(this.alternativa3d::_height != param1)
+ {
+ this.alternativa3d::_height = param1;
+ this.alternativa3d::canvas.y = this.alternativa3d::_height * 0.5;
+ if(this._camera != null)
+ {
+ this.camera.alternativa3d::addOperationToScene(this.camera.alternativa3d::calculatePlanesOperation);
+ }
+ }
+ }
+
+ public function getObjectUnderPoint(param1:Point) : Object
+ {
+ var loc4:Skin = null;
+ if(stage == null)
+ {
+ return null;
+ }
+ var loc2:Point = localToGlobal(param1);
+ var loc3:Array = stage.getObjectsUnderPoint(loc2);
+ var loc5:int = int(loc3.length - 1);
+ while(loc5 >= 0)
+ {
+ loc4 = loc3[loc5] as Skin;
+ if(loc4 != null && loc4.parent.parent == this)
+ {
+ return loc4.alternativa3d::primitive.alternativa3d::face != null ? loc4.alternativa3d::primitive.alternativa3d::face : (loc4.alternativa3d::primitive as SpritePrimitive).alternativa3d::sprite;
+ }
+ loc5--;
+ }
+ return null;
+ }
+
+ override public function getObjectsUnderPoint(param1:Point) : Array
+ {
+ var loc7:Skin = null;
+ if(stage == null)
+ {
+ return null;
+ }
+ var loc2:Point = localToGlobal(param1);
+ var loc3:Array = stage.getObjectsUnderPoint(loc2);
+ var loc4:Array = new Array();
+ var loc5:uint = loc3.length;
+ var loc6:uint = 0;
+ while(loc6 < loc5)
+ {
+ loc7 = loc3[loc6] as Skin;
+ if(loc7 != null && loc7.parent.parent == this)
+ {
+ if(loc7.alternativa3d::primitive.alternativa3d::face != null)
+ {
+ loc4.push(loc7.alternativa3d::primitive.alternativa3d::face);
+ }
+ else
+ {
+ loc4.push((loc7.alternativa3d::primitive as SpritePrimitive).alternativa3d::sprite);
+ }
+ }
+ loc6++;
+ }
+ return loc4;
+ }
+
+ public function projectPoint(param1:Point3D) : Point3D
+ {
+ var loc4:Number = NaN;
+ if(this._camera == null || this._camera.alternativa3d::_scene == null)
+ {
+ return null;
+ }
+ var loc2:Matrix3D = Object3D.alternativa3d::matrix2;
+ var loc3:Number = this._camera.alternativa3d::_focalLength;
+ if(this._camera.alternativa3d::getTransformation(loc2))
+ {
+ loc2.invert();
+ if(this._camera.alternativa3d::_orthographic)
+ {
+ loc4 = this._camera.zoom;
+ loc2.scale(loc4,loc4,loc4);
+ }
+ }
+ else if(this._camera.alternativa3d::_orthographic && this._camera.alternativa3d::calculateMatrixOperation.alternativa3d::queued)
+ {
+ loc2.invert();
+ loc4 = this._camera.zoom;
+ loc2.scale(loc4,loc4,loc4);
+ }
+ else
+ {
+ loc2 = this._camera.alternativa3d::cameraMatrix;
+ }
+ if(!this._camera.alternativa3d::_orthographic && this._camera.alternativa3d::calculatePlanesOperation.alternativa3d::queued)
+ {
+ loc3 = 0.5 * Math.sqrt(this.alternativa3d::_height * this.alternativa3d::_height + this.alternativa3d::_width * this.alternativa3d::_width) / Math.tan(0.5 * this._camera.alternativa3d::_fov);
+ }
+ var loc5:Number = loc2.a * param1.x + loc2.b * param1.y + loc2.c * param1.z + loc2.d;
+ var loc6:Number = loc2.e * param1.x + loc2.f * param1.y + loc2.g * param1.z + loc2.h;
+ var loc7:Number = loc2.i * param1.x + loc2.j * param1.y + loc2.k * param1.z + loc2.l;
+ if(this._camera.alternativa3d::_orthographic)
+ {
+ return new Point3D(loc5 + (this.alternativa3d::_width >> 1),loc6 + (this.alternativa3d::_height >> 1),loc7);
+ }
+ return new Point3D(loc5 * loc3 / loc7 + (this.alternativa3d::_width >> 1),loc6 * loc3 / loc7 + (this.alternativa3d::_height >> 1),loc7);
+ }
+
+ public function get interactive() : Boolean
+ {
+ return this.alternativa3d::_interactive;
+ }
+
+ public function set interactive(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_interactive == param1)
+ {
+ return;
+ }
+ this.alternativa3d::_interactive = param1;
+ if(this.alternativa3d::_interactive)
+ {
+ addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseEvent);
+ addEventListener(MouseEvent.MOUSE_UP,this.onMouseEvent);
+ addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseEvent);
+ addEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseEvent);
+ addEventListener(MouseEvent.MOUSE_OUT,this.onMouseEvent);
+ }
+ else
+ {
+ removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseEvent);
+ removeEventListener(MouseEvent.MOUSE_UP,this.onMouseEvent);
+ removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseEvent);
+ removeEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseEvent);
+ removeEventListener(MouseEvent.MOUSE_OUT,this.onMouseEvent);
+ if(stage != null)
+ {
+ stage.removeEventListener(MouseEvent.MOUSE_UP,this.stageMouseUp);
+ }
+ this.pressedFace = this.currentFace = null;
+ this.pressedSurface = this.currentSurface = null;
+ this.pressedObject = this.currentObject = null;
+ }
+ }
+
+ public function projectViewPointToPlane(param1:Point, param2:Point3D, param3:Number, param4:Point3D = null) : Point3D
+ {
+ if(this._camera == null || this._camera.alternativa3d::_scene == null)
+ {
+ return null;
+ }
+ if(param4 == null)
+ {
+ param4 = new Point3D();
+ }
+ this.calculateRayOriginAndVector(param1.x - (this.alternativa3d::_width >> 1),param1.y - (this.alternativa3d::_height >> 1),this.linePoint,this.lineVector,true);
+ if(!this.calculateLineAndPlaneIntersection(this.linePoint,this.lineVector,param2,param3,param4))
+ {
+ param4.reset(NaN,NaN,NaN);
+ }
+ return param4;
+ }
+
+ public function get3DCoords(param1:Point, param2:Number, param3:Point3D = null) : Point3D
+ {
+ var loc4:Number = NaN;
+ if(this._camera == null)
+ {
+ return null;
+ }
+ if(param3 == null)
+ {
+ param3 = new Point3D();
+ }
+ if(this._camera.alternativa3d::_orthographic)
+ {
+ param3.x = (param1.x - (this.alternativa3d::_width >> 1)) / this.camera.alternativa3d::_zoom;
+ param3.y = (param1.y - (this.alternativa3d::_height >> 1)) / this.camera.alternativa3d::_zoom;
+ }
+ else
+ {
+ loc4 = param2 / this._camera.focalLength;
+ param3.x = (param1.x - (this.alternativa3d::_width >> 1)) * loc4;
+ param3.y = (param1.y - (this.alternativa3d::_height >> 1)) * loc4;
+ }
+ param3.z = param2;
+ return param3;
+ }
+
+ private function onRemovedFromStage(param1:Event) : void
+ {
+ this.interactive = false;
+ }
+
+ private function stageMouseUp(param1:MouseEvent) : void
+ {
+ if(stage == null)
+ {
+ return;
+ }
+ this.pressedFace = null;
+ this.pressedSurface = null;
+ this.pressedObject = null;
+ stage.removeEventListener(MouseEvent.MOUSE_UP,this.stageMouseUp);
+ }
+
+ private function getInteractiveObjectUnderPoint(param1:Number, param2:Number) : void
+ {
+ var loc4:Skin = null;
+ var loc6:Sprite3D = null;
+ if(stage == null)
+ {
+ return;
+ }
+ this.faceUnderPoint = null;
+ this.objectUnderPoint = null;
+ this.stagePoint.x = param1;
+ this.stagePoint.y = param2;
+ var loc3:Array = stage.getObjectsUnderPoint(this.stagePoint);
+ var loc5:int = int(loc3.length - 1);
+ while(loc5 >= 0)
+ {
+ loc4 = loc3[loc5] as Skin;
+ if(loc4 != null && loc4.parent.parent == this)
+ {
+ if(loc4.alternativa3d::primitive.alternativa3d::face != null)
+ {
+ if(loc4.alternativa3d::primitive.alternativa3d::face.alternativa3d::_mesh.mouseEnabled)
+ {
+ this.faceUnderPoint = loc4.alternativa3d::primitive.alternativa3d::face;
+ this.objectUnderPoint = this.faceUnderPoint.alternativa3d::_mesh;
+ return;
+ }
+ }
+ else
+ {
+ loc6 = (loc4.alternativa3d::primitive as SpritePrimitive).alternativa3d::sprite;
+ if(loc6.mouseEnabled)
+ {
+ this.objectUnderPoint = loc6;
+ return;
+ }
+ }
+ }
+ loc5--;
+ }
+ }
+
+ private function getInteractiveObjectPointProperties(param1:Number, param2:Number) : void
+ {
+ var loc3:Point3D = null;
+ var loc4:Number = NaN;
+ var loc5:Point = null;
+ if(this.objectUnderPoint == null)
+ {
+ return;
+ }
+ this.calculateRayOriginAndVector(param1,param2,this.linePoint,this.lineVector);
+ if(this.faceUnderPoint != null)
+ {
+ loc3 = this.faceUnderPoint.alternativa3d::globalNormal;
+ loc4 = this.faceUnderPoint.alternativa3d::globalOffset;
+ }
+ else
+ {
+ loc3 = this.lineVector.clone();
+ loc3.invert();
+ this.globalCursor3DCoords.copy(this.objectUnderPoint.alternativa3d::_coords);
+ this.globalCursor3DCoords.transform(this.objectUnderPoint.alternativa3d::_transformation);
+ loc4 = this.globalCursor3DCoords.dot(loc3);
+ }
+ this.calculateLineAndPlaneIntersection(this.linePoint,this.lineVector,loc3,loc4,this.globalCursor3DCoords);
+ this.inverseMatrix.copy((this.faceUnderPoint != null ? this.faceUnderPoint.alternativa3d::_mesh : this.objectUnderPoint)._transformation);
+ this.inverseMatrix.invert();
+ this.localCursor3DCoords.copy(this.globalCursor3DCoords);
+ this.localCursor3DCoords.transform(this.inverseMatrix);
+ if(this.faceUnderPoint != null)
+ {
+ loc5 = this.faceUnderPoint.getUV(this.localCursor3DCoords);
+ if(loc5 != null)
+ {
+ this.uvPoint.x = loc5.x;
+ this.uvPoint.y = loc5.y;
+ }
+ else
+ {
+ this.uvPoint.x = NaN;
+ this.uvPoint.y = NaN;
+ }
+ }
+ }
+
+ private function createSimpleMouseEvent3D(param1:String, param2:Object3D, param3:Surface, param4:Face) : MouseEvent3D
+ {
+ var loc5:Boolean = this.lastMouseEvent == null ? false : this.lastMouseEvent.altKey;
+ var loc6:Boolean = this.lastMouseEvent == null ? false : this.lastMouseEvent.ctrlKey;
+ var loc7:Boolean = this.lastMouseEvent == null ? false : this.lastMouseEvent.shiftKey;
+ var loc8:int = this.lastMouseEvent == null ? 0 : this.lastMouseEvent.delta;
+ return new MouseEvent3D(param1,this,param2,param3,param4,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,loc5,loc6,loc7,loc8);
+ }
+
+ private function createFullMouseEvent3D(param1:String, param2:Object3D, param3:Surface, param4:Face) : MouseEvent3D
+ {
+ var loc5:Boolean = this.lastMouseEvent == null ? false : this.lastMouseEvent.altKey;
+ var loc6:Boolean = this.lastMouseEvent == null ? false : this.lastMouseEvent.ctrlKey;
+ var loc7:Boolean = this.lastMouseEvent == null ? false : this.lastMouseEvent.shiftKey;
+ var loc8:int = this.lastMouseEvent == null ? 0 : this.lastMouseEvent.delta;
+ return new MouseEvent3D(param1,this,param2,param3,param4,this.globalCursor3DCoords.x,this.globalCursor3DCoords.y,this.globalCursor3DCoords.z,this.localCursor3DCoords.x,this.localCursor3DCoords.y,this.localCursor3DCoords.z,this.uvPoint.x,this.uvPoint.y,loc5,loc6,loc7,loc8);
+ }
+
+ private function onMouseEvent(param1:MouseEvent) : void
+ {
+ if(stage == null)
+ {
+ return;
+ }
+ this.lastMouseEvent = param1;
+ this.getInteractiveObjectUnderPoint(stage.mouseX,stage.mouseY);
+ this.getInteractiveObjectPointProperties(mouseX - (this.alternativa3d::_width >> 1),mouseY - (this.alternativa3d::_height >> 1));
+ switch(param1.type)
+ {
+ case MouseEvent.MOUSE_MOVE:
+ this.processMouseMove();
+ break;
+ case MouseEvent.MOUSE_OUT:
+ stage.addEventListener(MouseEvent.MOUSE_UP,this.stageMouseUp);
+ this.alternativa3d::checkMouseOverOut();
+ break;
+ case MouseEvent.MOUSE_DOWN:
+ this.processMouseDown();
+ break;
+ case MouseEvent.MOUSE_UP:
+ this.processMouseUp();
+ break;
+ case MouseEvent.MOUSE_WHEEL:
+ this.processMouseWheel();
+ }
+ this.lastMouseEvent = null;
+ }
+
+ private function processMouseDown() : void
+ {
+ var loc1:MouseEvent3D = null;
+ if(this.objectUnderPoint == null)
+ {
+ return;
+ }
+ if(this.faceUnderPoint != null)
+ {
+ this.currentFace = this.faceUnderPoint;
+ this.currentSurface = this.faceUnderPoint.alternativa3d::_surface;
+ }
+ else
+ {
+ this.currentFace = null;
+ this.currentSurface = null;
+ }
+ this.currentObject = this.pressedObject = this.objectUnderPoint;
+ if(this.currentFace != null && this.currentFace.mouseEnabled)
+ {
+ this.pressedFace = this.currentFace;
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_DOWN,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc1);
+ }
+ if(this.currentSurface != null && this.currentSurface.mouseEnabled)
+ {
+ this.pressedSurface = this.currentSurface;
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_DOWN,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc1);
+ }
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_DOWN,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc1);
+ }
+
+ private function processMouseUp() : void
+ {
+ var loc1:MouseEvent3D = null;
+ if(this.objectUnderPoint == null)
+ {
+ this.pressedFace = null;
+ this.pressedSurface = null;
+ this.pressedObject = null;
+ return;
+ }
+ if(this.faceUnderPoint != null)
+ {
+ this.currentFace = this.faceUnderPoint;
+ this.currentSurface = this.faceUnderPoint.alternativa3d::_surface;
+ }
+ else
+ {
+ this.currentFace = null;
+ this.currentSurface = null;
+ }
+ this.currentObject = this.objectUnderPoint;
+ if(this.currentFace != null && this.currentFace.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_UP,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc1);
+ }
+ if(this.currentSurface != null && this.currentSurface.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_UP,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc1);
+ }
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_UP,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc1);
+ if(this.currentFace != null && this.currentFace == this.pressedFace && this.currentFace.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.CLICK,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc1);
+ }
+ if(this.currentSurface != null && this.currentSurface == this.pressedSurface && this.currentSurface.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.CLICK,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc1);
+ }
+ if(this.currentObject == this.pressedObject)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.CLICK,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc1);
+ }
+ this.pressedFace = null;
+ this.pressedSurface = null;
+ this.pressedObject = null;
+ }
+
+ private function processMouseWheel() : void
+ {
+ var loc1:MouseEvent3D = null;
+ if(this.objectUnderPoint == null)
+ {
+ return;
+ }
+ if(this.faceUnderPoint != null)
+ {
+ this.currentFace = this.faceUnderPoint;
+ this.currentSurface = this.faceUnderPoint.alternativa3d::_surface;
+ if(this.currentFace.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_WHEEL,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc1);
+ }
+ if(this.currentSurface.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_WHEEL,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc1);
+ }
+ }
+ else
+ {
+ this.currentFace = null;
+ this.currentSurface = null;
+ }
+ this.currentObject = this.objectUnderPoint;
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_WHEEL,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc1);
+ }
+
+ alternativa3d function checkMouseOverOut(param1:Boolean = false) : void
+ {
+ var loc2:MouseEvent3D = null;
+ var loc3:Surface = null;
+ var loc4:Boolean = false;
+ var loc5:Boolean = false;
+ var loc6:Boolean = false;
+ if(stage == null)
+ {
+ return;
+ }
+ if(param1)
+ {
+ this.getInteractiveObjectUnderPoint(stage.mouseX,stage.mouseY);
+ this.getInteractiveObjectPointProperties(mouseX - (this.alternativa3d::_width >> 1),mouseY - (this.alternativa3d::_height >> 1));
+ }
+ if(this.objectUnderPoint == null)
+ {
+ if(this.currentFace != null)
+ {
+ if(this.currentFace.mouseEnabled)
+ {
+ loc2 = this.createSimpleMouseEvent3D(MouseEvent3D.MOUSE_OUT,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc2);
+ }
+ if(this.currentSurface.mouseEnabled)
+ {
+ loc2 = this.createSimpleMouseEvent3D(MouseEvent3D.MOUSE_OUT,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc2);
+ }
+ }
+ if(this.currentObject != null)
+ {
+ loc2 = this.createSimpleMouseEvent3D(MouseEvent3D.MOUSE_OUT,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc2);
+ }
+ this.currentFace = null;
+ this.currentSurface = null;
+ this.currentObject = null;
+ }
+ else
+ {
+ if(this.faceUnderPoint != null)
+ {
+ loc3 = this.faceUnderPoint.alternativa3d::_surface;
+ }
+ if(this.faceUnderPoint != this.currentFace)
+ {
+ if(this.currentFace != null && this.currentFace.mouseEnabled)
+ {
+ loc2 = this.createSimpleMouseEvent3D(MouseEvent3D.MOUSE_OUT,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc2);
+ }
+ loc4 = true;
+ if(loc3 != this.currentSurface)
+ {
+ if(this.currentSurface != null && this.currentSurface.mouseEnabled)
+ {
+ loc2 = this.createSimpleMouseEvent3D(MouseEvent3D.MOUSE_OUT,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc2);
+ }
+ loc5 = true;
+ }
+ }
+ if(this.objectUnderPoint != this.currentObject)
+ {
+ if(this.currentObject != null)
+ {
+ loc2 = this.createSimpleMouseEvent3D(MouseEvent3D.MOUSE_OUT,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc2);
+ }
+ loc6 = true;
+ }
+ this.currentFace = this.faceUnderPoint;
+ this.currentSurface = loc3;
+ this.currentObject = this.objectUnderPoint;
+ if(this.currentFace != null)
+ {
+ if(loc4 && this.currentFace.mouseEnabled)
+ {
+ loc2 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_OVER,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc2);
+ }
+ if(loc5 && this.currentSurface.mouseEnabled)
+ {
+ loc2 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_OVER,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc2);
+ }
+ }
+ if(loc6)
+ {
+ loc2 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_OVER,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc2);
+ }
+ }
+ }
+
+ private function processMouseMove() : void
+ {
+ var loc1:MouseEvent3D = null;
+ this.alternativa3d::checkMouseOverOut();
+ if(this.currentFace != null)
+ {
+ if(this.currentFace.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_MOVE,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentFace.dispatchEvent(loc1);
+ }
+ if(this.currentSurface.mouseEnabled)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_MOVE,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentSurface.dispatchEvent(loc1);
+ }
+ }
+ if(this.currentObject != null)
+ {
+ loc1 = this.createFullMouseEvent3D(MouseEvent3D.MOUSE_MOVE,this.currentObject,this.currentSurface,this.currentFace);
+ this.currentObject.dispatchEvent(loc1);
+ }
+ }
+
+ private function calculateLineAndPlaneIntersection(param1:Point3D, param2:Point3D, param3:Point3D, param4:Number, param5:Point3D) : Boolean
+ {
+ var loc6:Number = param3.x * param2.x + param3.y * param2.y + param3.z * param2.z;
+ if(loc6 < 1e-8 && loc6 > -1e-8)
+ {
+ return false;
+ }
+ var loc7:Number = (param4 - param1.x * param3.x - param1.y * param3.y - param1.z * param3.z) / loc6;
+ param5.x = param1.x + loc7 * param2.x;
+ param5.y = param1.y + loc7 * param2.y;
+ param5.z = param1.z + loc7 * param2.z;
+ return true;
+ }
+
+ private function calculateRayOriginAndVector(param1:Number, param2:Number, param3:Point3D, param4:Point3D, param5:Boolean = false) : void
+ {
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Number = NaN;
+ var loc9:Matrix3D = null;
+ if(param5)
+ {
+ loc9 = Object3D.alternativa3d::matrix2;
+ this._camera.alternativa3d::getTransformation(loc9);
+ }
+ else
+ {
+ loc9 = this._camera.alternativa3d::_transformation;
+ }
+ if(this._camera.alternativa3d::_orthographic)
+ {
+ loc6 = param1 / this._camera.zoom;
+ loc7 = param2 / this._camera.zoom;
+ param3.x = loc9.a * loc6 + loc9.b * loc7 + loc9.d;
+ param3.y = loc9.e * loc6 + loc9.f * loc7 + loc9.h;
+ param3.z = loc9.i * loc6 + loc9.j * loc7 + loc9.l;
+ loc7 = 0;
+ loc6 = 0;
+ loc8 = 1;
+ }
+ else
+ {
+ param3.x = loc9.d;
+ param3.y = loc9.h;
+ param3.z = loc9.l;
+ loc6 = param1;
+ loc7 = param2;
+ if(param5)
+ {
+ loc8 = this._camera.focalLength;
+ }
+ else
+ {
+ loc8 = this._camera.alternativa3d::_focalLength;
+ }
+ }
+ this.lineVector.x = loc6 * loc9.a + loc7 * loc9.b + loc8 * loc9.c;
+ this.lineVector.y = loc6 * loc9.e + loc7 * loc9.f + loc8 * loc9.g;
+ this.lineVector.z = loc6 * loc9.i + loc7 * loc9.j + loc8 * loc9.k;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/Engine3DError.as b/src/alternativa/engine3d/errors/Engine3DError.as
new file mode 100644
index 0000000..ef6d9b0
--- /dev/null
+++ b/src/alternativa/engine3d/errors/Engine3DError.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.errors
+{
+ public class Engine3DError extends Error
+ {
+ public var source:Object;
+
+ public function Engine3DError(param1:String = "", param2:Object = null)
+ {
+ super(param1);
+ this.source = param2;
+ this.name = "Engine3DError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/FaceExistsError.as b/src/alternativa/engine3d/errors/FaceExistsError.as
new file mode 100644
index 0000000..54a8df6
--- /dev/null
+++ b/src/alternativa/engine3d/errors/FaceExistsError.as
@@ -0,0 +1,34 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.utils.TextUtils;
+
+ public class FaceExistsError extends ObjectExistsError
+ {
+ public function FaceExistsError(param1:Object = null, param2:Object = null)
+ {
+ var loc3:* = null;
+ if(param2 is Mesh)
+ {
+ loc3 = "Mesh ";
+ }
+ else if(param2 is Surface)
+ {
+ loc3 = "Surface ";
+ }
+ if(param1 is Face)
+ {
+ loc3 += "%1. Face %2 already exists.";
+ }
+ else
+ {
+ loc3 += "%1. Face with ID \'%2\' already exists.";
+ }
+ super(TextUtils.insertVars(loc3,param2,param1),param1,param2);
+ this.name = "FaceExistsError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/FaceNeedMoreVerticesError.as b/src/alternativa/engine3d/errors/FaceNeedMoreVerticesError.as
new file mode 100644
index 0000000..3f470c3
--- /dev/null
+++ b/src/alternativa/engine3d/errors/FaceNeedMoreVerticesError.as
@@ -0,0 +1,18 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.utils.TextUtils;
+
+ public class FaceNeedMoreVerticesError extends Engine3DError
+ {
+ public var count:uint;
+
+ public function FaceNeedMoreVerticesError(param1:Mesh = null, param2:uint = 0)
+ {
+ super(TextUtils.insertVars("Mesh %1. %2 vertices not enough for face creation.",param1,param2),param1);
+ this.count = param2;
+ this.name = "FaceNeedMoreVerticesError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/FaceNotFoundError.as b/src/alternativa/engine3d/errors/FaceNotFoundError.as
new file mode 100644
index 0000000..0e02dae
--- /dev/null
+++ b/src/alternativa/engine3d/errors/FaceNotFoundError.as
@@ -0,0 +1,33 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.utils.TextUtils;
+
+ public class FaceNotFoundError extends ObjectNotFoundError
+ {
+ public function FaceNotFoundError(param1:Object = null, param2:Object = null)
+ {
+ var loc3:* = null;
+ if(param2 is Mesh)
+ {
+ loc3 = "Mesh ";
+ }
+ else
+ {
+ loc3 = "Surface ";
+ }
+ if(param1 is Face)
+ {
+ loc3 += "%1. Face %2 not found.";
+ }
+ else
+ {
+ loc3 += "%1. Face with ID \'%2\' not found.";
+ }
+ super(TextUtils.insertVars(loc3,param2,param1),param1,param2);
+ this.name = "FaceNotFoundError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/InvalidIDError.as b/src/alternativa/engine3d/errors/InvalidIDError.as
new file mode 100644
index 0000000..5015d3d
--- /dev/null
+++ b/src/alternativa/engine3d/errors/InvalidIDError.as
@@ -0,0 +1,28 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.utils.TextUtils;
+
+ public class InvalidIDError extends Engine3DError
+ {
+ public var id:Object;
+
+ public function InvalidIDError(param1:Object = null, param2:Object = null)
+ {
+ var loc3:String = null;
+ if(param2 is Mesh)
+ {
+ loc3 = "Mesh %2. ";
+ }
+ else if(param2 is Surface)
+ {
+ loc3 = "Surface %2. ";
+ }
+ super(TextUtils.insertVars(loc3 + "ID %1 is reserved and cannot be used",[param1,param2]),param2);
+ this.id = param1;
+ this.name = "InvalidIDError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/Object3DHierarchyError.as b/src/alternativa/engine3d/errors/Object3DHierarchyError.as
new file mode 100644
index 0000000..a1df579
--- /dev/null
+++ b/src/alternativa/engine3d/errors/Object3DHierarchyError.as
@@ -0,0 +1,18 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.utils.TextUtils;
+
+ public class Object3DHierarchyError extends Engine3DError
+ {
+ public var object:Object3D;
+
+ public function Object3DHierarchyError(param1:Object3D = null, param2:Object3D = null)
+ {
+ super(TextUtils.insertVars("Object3D %1. Object %2 cannot be added",param2,param1),param2);
+ this.object = param1;
+ this.name = "Object3DHierarchyError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/Object3DNotFoundError.as b/src/alternativa/engine3d/errors/Object3DNotFoundError.as
new file mode 100644
index 0000000..d36c4d6
--- /dev/null
+++ b/src/alternativa/engine3d/errors/Object3DNotFoundError.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.utils.TextUtils;
+
+ public class Object3DNotFoundError extends ObjectNotFoundError
+ {
+ public function Object3DNotFoundError(param1:Object3D = null, param2:Object3D = null)
+ {
+ super(TextUtils.insertVars("Object3D %1. Object %2 not in child list",param2,param1),param1,param2);
+ this.name = "Object3DNotFoundError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/ObjectExistsError.as b/src/alternativa/engine3d/errors/ObjectExistsError.as
new file mode 100644
index 0000000..f2b9ca2
--- /dev/null
+++ b/src/alternativa/engine3d/errors/ObjectExistsError.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.errors
+{
+ public class ObjectExistsError extends Engine3DError
+ {
+ public var object:Object;
+
+ public function ObjectExistsError(param1:String = "", param2:Object = null, param3:Object = null)
+ {
+ super(param1,param3);
+ this.object = param2;
+ this.name = "ObjectExistsError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/ObjectNotFoundError.as b/src/alternativa/engine3d/errors/ObjectNotFoundError.as
new file mode 100644
index 0000000..4af9233
--- /dev/null
+++ b/src/alternativa/engine3d/errors/ObjectNotFoundError.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.errors
+{
+ public class ObjectNotFoundError extends Engine3DError
+ {
+ public var object:Object;
+
+ public function ObjectNotFoundError(param1:String = "", param2:Object = null, param3:Object = null)
+ {
+ super(param1,param3);
+ this.object = param2;
+ this.name = "ObjectNotFoundError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/SectorInOtherSceneError.as b/src/alternativa/engine3d/errors/SectorInOtherSceneError.as
new file mode 100644
index 0000000..75c0563
--- /dev/null
+++ b/src/alternativa/engine3d/errors/SectorInOtherSceneError.as
@@ -0,0 +1,16 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.core.Sector;
+ import alternativa.utils.TextUtils;
+
+ public class SectorInOtherSceneError extends Engine3DError
+ {
+ public function SectorInOtherSceneError(param1:Sector = null, param2:Scene3D = null)
+ {
+ super(TextUtils.insertVars("%1. Sector %2 is aready situated in the other scene",param2,param1),param2);
+ this.name = "SectorInOtherSceneError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/SplitterInOtherSceneError.as b/src/alternativa/engine3d/errors/SplitterInOtherSceneError.as
new file mode 100644
index 0000000..5c6d9a7
--- /dev/null
+++ b/src/alternativa/engine3d/errors/SplitterInOtherSceneError.as
@@ -0,0 +1,16 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.core.Splitter;
+ import alternativa.utils.TextUtils;
+
+ public class SplitterInOtherSceneError extends Engine3DError
+ {
+ public function SplitterInOtherSceneError(param1:Splitter = null, param2:Scene3D = null)
+ {
+ super(TextUtils.insertVars("%1. Splitter %2 is aready situated in the other scene",param2,param1),param2);
+ this.name = "SplitterInOtherSceneError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/SplitterNeedMoreVerticesError.as b/src/alternativa/engine3d/errors/SplitterNeedMoreVerticesError.as
new file mode 100644
index 0000000..649b0f5
--- /dev/null
+++ b/src/alternativa/engine3d/errors/SplitterNeedMoreVerticesError.as
@@ -0,0 +1,17 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.utils.TextUtils;
+
+ public class SplitterNeedMoreVerticesError extends Engine3DError
+ {
+ public var count:uint;
+
+ public function SplitterNeedMoreVerticesError(param1:uint = 0)
+ {
+ super(TextUtils.insertVars("%1 points not enough for splitter creation.",param1),null);
+ this.count = param1;
+ this.name = "SplitterNeedMoreVerticesError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/SurfaceExistsError.as b/src/alternativa/engine3d/errors/SurfaceExistsError.as
new file mode 100644
index 0000000..bfe4b26
--- /dev/null
+++ b/src/alternativa/engine3d/errors/SurfaceExistsError.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.utils.TextUtils;
+
+ public class SurfaceExistsError extends ObjectExistsError
+ {
+ public function SurfaceExistsError(param1:Object = null, param2:Mesh = null)
+ {
+ super(TextUtils.insertVars("Mesh %1. Surface with ID \'%2\' already exists.",param2,param1),param1,param2);
+ this.name = "SurfaceExistsError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/SurfaceNotFoundError.as b/src/alternativa/engine3d/errors/SurfaceNotFoundError.as
new file mode 100644
index 0000000..5ab1752
--- /dev/null
+++ b/src/alternativa/engine3d/errors/SurfaceNotFoundError.as
@@ -0,0 +1,27 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.utils.TextUtils;
+
+ public class SurfaceNotFoundError extends ObjectNotFoundError
+ {
+ public function SurfaceNotFoundError(param1:Object = null, param2:Mesh = null)
+ {
+ if(param2 == null)
+ {
+ }
+ if(param1 is Surface)
+ {
+ message = "Mesh %1. Surface %2 not found.";
+ }
+ else
+ {
+ message = "Mesh %1. Surface with ID \'%2\' not found.";
+ }
+ super(TextUtils.insertVars(message,param2,param1),param1,param2);
+ this.name = "SurfaceNotFoundError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/VertexExistsError.as b/src/alternativa/engine3d/errors/VertexExistsError.as
new file mode 100644
index 0000000..593b152
--- /dev/null
+++ b/src/alternativa/engine3d/errors/VertexExistsError.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.utils.TextUtils;
+
+ public class VertexExistsError extends ObjectExistsError
+ {
+ public function VertexExistsError(param1:Object = null, param2:Mesh = null)
+ {
+ super(TextUtils.insertVars("Mesh %1. Vertex with ID \'%2\' already exists.",param2,param1),param1,param2);
+ this.name = "VertexExistsError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/errors/VertexNotFoundError.as b/src/alternativa/engine3d/errors/VertexNotFoundError.as
new file mode 100644
index 0000000..f2c001c
--- /dev/null
+++ b/src/alternativa/engine3d/errors/VertexNotFoundError.as
@@ -0,0 +1,24 @@
+package alternativa.engine3d.errors
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.utils.TextUtils;
+
+ public class VertexNotFoundError extends ObjectNotFoundError
+ {
+ public function VertexNotFoundError(param1:Object = null, param2:Mesh = null)
+ {
+ if(param1 is Vertex)
+ {
+ message = "Mesh %1. Vertex %2 not found.";
+ }
+ else
+ {
+ message = "Mesh %1. Vertex with ID \'%2\' not found.";
+ }
+ super(TextUtils.insertVars(message,param2,param1),param1,param2);
+ this.name = "VertexNotFoundError";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/events/MouseEvent3D.as b/src/alternativa/engine3d/events/MouseEvent3D.as
new file mode 100644
index 0000000..b564d9c
--- /dev/null
+++ b/src/alternativa/engine3d/events/MouseEvent3D.as
@@ -0,0 +1,89 @@
+package alternativa.engine3d.events
+{
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.display.View;
+ import flash.events.Event;
+
+ public class MouseEvent3D extends Event
+ {
+ public static const CLICK:String = "click";
+
+ public static const MOUSE_DOWN:String = "mouseDown";
+
+ public static const MOUSE_UP:String = "mouseUp";
+
+ public static const MOUSE_OVER:String = "mouseOver";
+
+ public static const MOUSE_OUT:String = "mouseOut";
+
+ public static const MOUSE_MOVE:String = "mouseMove";
+
+ public static const MOUSE_WHEEL:String = "mouseWheel";
+
+ public var object:Object3D;
+
+ public var surface:Surface;
+
+ public var face:Face;
+
+ public var view:View;
+
+ public var globalX:Number;
+
+ public var globalY:Number;
+
+ public var globalZ:Number;
+
+ public var localX:Number;
+
+ public var localY:Number;
+
+ public var localZ:Number;
+
+ public var u:Number;
+
+ public var v:Number;
+
+ public var altKey:Boolean;
+
+ public var ctrlKey:Boolean;
+
+ public var shiftKey:Boolean;
+
+ public var delta:int;
+
+ public function MouseEvent3D(param1:String, param2:View, param3:Object3D, param4:Surface, param5:Face, param6:Number = NaN, param7:Number = NaN, param8:Number = NaN, param9:Number = NaN, param10:Number = NaN, param11:Number = NaN, param12:Number = NaN, param13:Number = NaN, param14:Boolean = false, param15:Boolean = false, param16:Boolean = false, param17:int = 0)
+ {
+ super(param1);
+ this.view = param2;
+ this.object = param3;
+ this.surface = param4;
+ this.face = param5;
+ this.globalX = param6;
+ this.globalY = param7;
+ this.globalZ = param8;
+ this.localX = param9;
+ this.localY = param10;
+ this.localZ = param11;
+ this.u = param12;
+ this.v = param13;
+ this.altKey = param14;
+ this.ctrlKey = param15;
+ this.shiftKey = param16;
+ this.delta = param17;
+ }
+
+ override public function toString() : String
+ {
+ return formatToString("MouseEvent3D","object","surface","face","globalX","globalY","globalZ","localX","localY","localZ","u","v","delta","altKey","ctrlKey","shiftKey");
+ }
+
+ override public function clone() : Event
+ {
+ return new MouseEvent3D(type,this.view,this.object,this.surface,this.face,this.globalX,this.globalY,this.globalZ,this.localX,this.localY,this.localZ,this.u,this.v,this.altKey,this.ctrlKey,this.shiftKey,this.delta);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/Loader3D.as b/src/alternativa/engine3d/loaders/Loader3D.as
new file mode 100644
index 0000000..62e475e
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/Loader3D.as
@@ -0,0 +1,160 @@
+package alternativa.engine3d.loaders
+{
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.loaders.events.LoaderEvent;
+ import alternativa.engine3d.loaders.events.LoaderProgressEvent;
+ import flash.events.ErrorEvent;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.events.ProgressEvent;
+ import flash.events.SecurityErrorEvent;
+ import flash.net.URLLoader;
+ import flash.net.URLLoaderDataFormat;
+ import flash.net.URLRequest;
+ import flash.system.LoaderContext;
+ import flash.utils.ByteArray;
+
+ public class Loader3D extends EventDispatcher
+ {
+ protected var loaderState:int = 0;
+
+ protected var baseURL:String;
+
+ protected var loaderContext:LoaderContext;
+
+ protected var _content:Object3D;
+
+ private var mainLoader:URLLoader;
+
+ public function Loader3D()
+ {
+ super(this);
+ }
+
+ final public function get content() : Object3D
+ {
+ return this._content;
+ }
+
+ final public function load(param1:String, param2:LoaderContext = null) : void
+ {
+ this.baseURL = param1.substring(0,param1.lastIndexOf("/") + 1);
+ this.loaderContext = param2;
+ if(this.mainLoader == null)
+ {
+ this.mainLoader = new URLLoader();
+ this.mainLoader.dataFormat = URLLoaderDataFormat.BINARY;
+ this.mainLoader.addEventListener(Event.COMPLETE,this.onMainLoadingComplete);
+ this.mainLoader.addEventListener(ProgressEvent.PROGRESS,this.onMainLoadingProgress);
+ this.mainLoader.addEventListener(IOErrorEvent.IO_ERROR,this.onMainLoadingError);
+ this.mainLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,this.onMainLoadingError);
+ }
+ else
+ {
+ this.close();
+ }
+ this._content = null;
+ this.setState(Loader3DState.LOADING_MAIN);
+ this.mainLoader.load(new URLRequest(param1));
+ if(hasEventListener(LoaderEvent.LOADING_START))
+ {
+ dispatchEvent(new LoaderEvent(LoaderEvent.LOADING_START,LoadingStage.MAIN_FILE));
+ }
+ }
+
+ final public function loadBytes(param1:ByteArray, param2:String = null, param3:LoaderContext = null) : void
+ {
+ if(param2 == null)
+ {
+ param2 = "";
+ }
+ else if(param2.length > 0 && param2.charAt(param2.length - 1) != "/")
+ {
+ param2 += "/";
+ }
+ this.baseURL = param2;
+ this.loaderContext = param3;
+ this.close();
+ this._content = null;
+ this.parse(param1);
+ }
+
+ final public function close() : void
+ {
+ if(this.loaderState == Loader3DState.LOADING_MAIN)
+ {
+ this.mainLoader.close();
+ }
+ this.closeInternal();
+ this.clean();
+ this.setState(Loader3DState.IDLE);
+ }
+
+ final public function unload() : void
+ {
+ if(this.loaderState != Loader3DState.IDLE)
+ {
+ return;
+ }
+ this._content = null;
+ this.unloadInternal();
+ }
+
+ protected function closeInternal() : void
+ {
+ }
+
+ protected function unloadInternal() : void
+ {
+ }
+
+ protected function setState(param1:int) : void
+ {
+ this.loaderState = param1;
+ }
+
+ protected function parse(param1:ByteArray) : void
+ {
+ }
+
+ protected function onMainLoadingError(param1:ErrorEvent) : void
+ {
+ this.setState(Loader3DState.IDLE);
+ dispatchEvent(param1);
+ }
+
+ final protected function complete() : void
+ {
+ this.setState(Loader3DState.IDLE);
+ this.clean();
+ if(hasEventListener(Event.COMPLETE))
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+
+ protected function clean() : void
+ {
+ }
+
+ private function onMainLoadingComplete(param1:Event) : void
+ {
+ this.setState(Loader3DState.IDLE);
+ if(hasEventListener(LoaderEvent.LOADING_COMPLETE))
+ {
+ dispatchEvent(new LoaderEvent(LoaderEvent.LOADING_COMPLETE,LoadingStage.MAIN_FILE));
+ }
+ this.parse(this.mainLoader.data);
+ }
+
+ private function onMainLoadingProgress(param1:ProgressEvent) : void
+ {
+ if(hasEventListener(LoaderProgressEvent.LOADING_PROGRESS))
+ {
+ dispatchEvent(new LoaderProgressEvent(LoaderProgressEvent.LOADING_PROGRESS,LoadingStage.MAIN_FILE,1,0,param1.bytesLoaded,param1.bytesTotal));
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/Loader3DS.as b/src/alternativa/engine3d/loaders/Loader3DS.as
new file mode 100644
index 0000000..8a55ca4
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/Loader3DS.as
@@ -0,0 +1,195 @@
+package alternativa.engine3d.loaders
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.loaders.events.LoaderEvent;
+ import alternativa.engine3d.loaders.events.LoaderProgressEvent;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.types.Texture;
+ import flash.events.Event;
+ import flash.events.IOErrorEvent;
+ import flash.utils.ByteArray;
+
+ use namespace alternativa3d;
+
+ public class Loader3DS extends Loader3D
+ {
+ public var loadMaterials:Boolean = true;
+
+ private var bitmapLoader:TextureMapsBatchLoader;
+
+ private var parser:Parser3DS;
+
+ public function Loader3DS()
+ {
+ super();
+ this.parser = new Parser3DS();
+ }
+
+ public function get repeat() : Boolean
+ {
+ return this.parser.repeat;
+ }
+
+ public function set repeat(param1:Boolean) : void
+ {
+ this.parser.repeat = param1;
+ }
+
+ public function get smooth() : Boolean
+ {
+ return this.parser.smooth;
+ }
+
+ public function set smooth(param1:Boolean) : void
+ {
+ this.parser.smooth = param1;
+ }
+
+ public function get blendMode() : String
+ {
+ return this.parser.blendMode;
+ }
+
+ public function set blendMode(param1:String) : void
+ {
+ this.parser.blendMode = param1;
+ }
+
+ public function get precision() : Number
+ {
+ return this.parser.precision;
+ }
+
+ public function set precision(param1:Number) : void
+ {
+ this.parser.precision = param1;
+ }
+
+ public function get scale() : Number
+ {
+ return this.parser.scale;
+ }
+
+ public function set scale(param1:Number) : void
+ {
+ this.parser.scale = param1;
+ }
+
+ public function get mobility() : int
+ {
+ return this.parser.mobility;
+ }
+
+ public function set mobility(param1:int) : void
+ {
+ this.parser.mobility = param1;
+ }
+
+ override protected function closeInternal() : void
+ {
+ super.closeInternal();
+ if(loaderState == Loader3DState.LOADING_TEXTURE)
+ {
+ this.bitmapLoader.close();
+ }
+ }
+
+ override protected function unloadInternal() : void
+ {
+ if(this.bitmapLoader != null)
+ {
+ this.bitmapLoader.unload();
+ }
+ }
+
+ override protected function parse(param1:ByteArray) : void
+ {
+ this.parser.parse(param1);
+ _content = this.parser.content;
+ if(this.loadMaterials && this.parser.textureMaterials != null)
+ {
+ this.loadTextures();
+ }
+ else
+ {
+ complete();
+ }
+ }
+
+ private function loadTextures() : void
+ {
+ if(this.bitmapLoader == null)
+ {
+ this.bitmapLoader = new TextureMapsBatchLoader();
+ this.bitmapLoader.addEventListener(LoaderEvent.LOADING_START,this.onTextureLoadingStart);
+ this.bitmapLoader.addEventListener(LoaderEvent.LOADING_COMPLETE,this.onTextureLoadingComplete);
+ this.bitmapLoader.addEventListener(LoaderProgressEvent.LOADING_PROGRESS,this.onTextureLoadingProgress);
+ this.bitmapLoader.addEventListener(Event.COMPLETE,this.onTextureMaterialsLoadingComplete);
+ this.bitmapLoader.addEventListener(IOErrorEvent.IO_ERROR,this.onTextureLoadingError);
+ }
+ setState(Loader3DState.LOADING_TEXTURE);
+ this.bitmapLoader.load(baseURL,this.parser.textureMaterials,loaderContext);
+ }
+
+ private function onTextureLoadingError(param1:IOErrorEvent) : void
+ {
+ dispatchEvent(param1);
+ }
+
+ private function onTextureLoadingStart(param1:LoaderEvent) : void
+ {
+ if(hasEventListener(param1.type))
+ {
+ dispatchEvent(param1);
+ }
+ }
+
+ private function onTextureLoadingComplete(param1:LoaderEvent) : void
+ {
+ if(hasEventListener(param1.type))
+ {
+ dispatchEvent(param1);
+ }
+ }
+
+ private function onTextureLoadingProgress(param1:LoaderProgressEvent) : void
+ {
+ if(hasEventListener(param1.type))
+ {
+ dispatchEvent(param1);
+ }
+ }
+
+ private function onTextureMaterialsLoadingComplete(param1:Event) : void
+ {
+ this.parser.content.forEach(this.setTextures);
+ complete();
+ }
+
+ private function setTextures(param1:Object3D) : void
+ {
+ var loc3:String = null;
+ var loc4:TextureMapsInfo = null;
+ var loc5:Texture = null;
+ var loc6:Surface = null;
+ var loc2:Mesh = param1 as Mesh;
+ if(loc2 != null)
+ {
+ for(loc3 in loc2.alternativa3d::_surfaces)
+ {
+ loc4 = this.parser.textureMaterials[loc3];
+ if(loc4 != null)
+ {
+ loc5 = new Texture(this.bitmapLoader.textures[loc3],loc4.diffuseMapFileName);
+ loc6 = loc2.alternativa3d::_surfaces[loc3];
+ TextureMaterial(loc6.material).texture = loc5;
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/Loader3DState.as b/src/alternativa/engine3d/loaders/Loader3DState.as
new file mode 100644
index 0000000..88d1cd8
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/Loader3DState.as
@@ -0,0 +1,19 @@
+package alternativa.engine3d.loaders
+{
+ public final class Loader3DState
+ {
+ public static const IDLE:int = 0;
+
+ public static const LOADING_MAIN:int = 1;
+
+ public static const LOADING_TEXTURE:int = 2;
+
+ public static const LOADING_LIBRARY:int = 3;
+
+ public function Loader3DState()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/LoadingStage.as b/src/alternativa/engine3d/loaders/LoadingStage.as
new file mode 100644
index 0000000..538b5d7
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/LoadingStage.as
@@ -0,0 +1,17 @@
+package alternativa.engine3d.loaders
+{
+ public final class LoadingStage
+ {
+ public static const MAIN_FILE:int = 0;
+
+ public static const TEXTURE:int = 1;
+
+ public static const MATERIAL_LIBRARY:int = 2;
+
+ public function LoadingStage()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/Parser3DS.as b/src/alternativa/engine3d/loaders/Parser3DS.as
new file mode 100644
index 0000000..676eef5
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/Parser3DS.as
@@ -0,0 +1,1064 @@
+package alternativa.engine3d.loaders
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.core.Vertex;
+ import alternativa.engine3d.materials.FillMaterial;
+ import alternativa.engine3d.materials.TextureMaterial;
+ import alternativa.engine3d.materials.TextureMaterialPrecision;
+ import alternativa.engine3d.materials.WireMaterial;
+ import alternativa.types.Map;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Point3D;
+ import alternativa.utils.ColorUtils;
+ import alternativa.utils.MathUtils;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+ import flash.utils.ByteArray;
+ import flash.utils.Endian;
+
+ use namespace alternativa3d;
+
+ public class Parser3DS
+ {
+ private static const CHUNK_MAIN:uint = 19789;
+
+ private static const CHUNK_VERSION:uint = 2;
+
+ private static const CHUNK_SCENE:uint = 15677;
+
+ private static const CHUNK_ANIMATION:uint = 45056;
+
+ private static const CHUNK_OBJECT:uint = 16384;
+
+ private static const CHUNK_TRIMESH:uint = 16640;
+
+ private static const CHUNK_VERTICES:uint = 16656;
+
+ private static const CHUNK_FACES:uint = 16672;
+
+ private static const CHUNK_FACESMATERIAL:uint = 16688;
+
+ private static const CHUNK_MAPPINGCOORDS:uint = 16704;
+
+ private static const CHUNK_OBJECTCOLOR:uint = 16741;
+
+ private static const CHUNK_TRANSFORMATION:uint = 16736;
+
+ private static const CHUNK_MESHANIMATION:uint = 45058;
+
+ private static const CHUNK_MATERIAL:uint = 45055;
+
+ private var data:ByteArray;
+
+ private var _content:Object3D;
+
+ private var _textureMaterials:Map;
+
+ private var _repeat:Boolean = true;
+
+ private var _smooth:Boolean = false;
+
+ private var _blendMode:String = "normal";
+
+ private var _precision:Number;
+
+ private var _scale:Number = 1;
+
+ private var _mobility:int = 0;
+
+ private var version:uint;
+
+ private var objectDatas:Map;
+
+ private var animationDatas:Array;
+
+ private var materialDatas:Map;
+
+ public function Parser3DS()
+ {
+ this._precision = TextureMaterialPrecision.MEDIUM;
+ super();
+ }
+
+ public function get content() : Object3D
+ {
+ return this._content;
+ }
+
+ public function get repeat() : Boolean
+ {
+ return this._repeat;
+ }
+
+ public function set repeat(param1:Boolean) : void
+ {
+ this._repeat = param1;
+ }
+
+ public function get smooth() : Boolean
+ {
+ return this._smooth;
+ }
+
+ public function set smooth(param1:Boolean) : void
+ {
+ this._smooth = param1;
+ }
+
+ public function get blendMode() : String
+ {
+ return this._blendMode;
+ }
+
+ public function set blendMode(param1:String) : void
+ {
+ this._blendMode = param1;
+ }
+
+ public function get precision() : Number
+ {
+ return this._precision;
+ }
+
+ public function set precision(param1:Number) : void
+ {
+ this._precision = param1;
+ }
+
+ public function get scale() : Number
+ {
+ return this._scale;
+ }
+
+ public function set scale(param1:Number) : void
+ {
+ this._scale = param1;
+ }
+
+ public function get mobility() : int
+ {
+ return this._mobility;
+ }
+
+ public function set mobility(param1:int) : void
+ {
+ this._mobility = param1;
+ }
+
+ public function get textureMaterials() : Map
+ {
+ return this._textureMaterials;
+ }
+
+ public function parse(param1:ByteArray) : Boolean
+ {
+ var data:ByteArray = param1;
+ this.unload();
+ if(data.bytesAvailable < 6)
+ {
+ return false;
+ }
+ this.data = data;
+ data.endian = Endian.LITTLE_ENDIAN;
+ try
+ {
+ this.parse3DSChunk(data.position,data.bytesAvailable);
+ this.buildContent();
+ }
+ catch(e:Error)
+ {
+ unload();
+ throw e;
+ }
+ finally
+ {
+ this.clean();
+ }
+ return true;
+ }
+
+ public function unload() : void
+ {
+ this._content = null;
+ this._textureMaterials = null;
+ }
+
+ private function clean() : void
+ {
+ this.version = 0;
+ this.objectDatas = null;
+ this.animationDatas = null;
+ this.materialDatas = null;
+ }
+
+ private function readChunkInfo(param1:uint, param2:uint) : ChunkInfo
+ {
+ if(param2 < 6)
+ {
+ return null;
+ }
+ this.data.position = param1;
+ var loc3:ChunkInfo = new ChunkInfo();
+ loc3.id = this.data.readUnsignedShort();
+ loc3.size = this.data.readUnsignedInt();
+ loc3.dataSize = loc3.size - 6;
+ loc3.dataPosition = this.data.position;
+ loc3.nextChunkPosition = param1 + loc3.size;
+ return loc3;
+ }
+
+ private function parse3DSChunk(param1:uint, param2:uint) : void
+ {
+ var loc3:ChunkInfo = this.readChunkInfo(param1,param2);
+ if(loc3 == null)
+ {
+ return;
+ }
+ this.data.position = param1;
+ switch(loc3.id)
+ {
+ case CHUNK_MAIN:
+ this.parseMainChunk(loc3.dataPosition,loc3.dataSize);
+ }
+ this.parse3DSChunk(loc3.nextChunkPosition,param2 - loc3.size);
+ }
+
+ private function parseMainChunk(param1:uint, param2:uint) : void
+ {
+ var loc3:ChunkInfo = this.readChunkInfo(param1,param2);
+ if(loc3 == null)
+ {
+ return;
+ }
+ switch(loc3.id)
+ {
+ case CHUNK_VERSION:
+ this.version = this.data.readUnsignedInt();
+ break;
+ case CHUNK_SCENE:
+ this.parse3DChunk(loc3.dataPosition,loc3.dataSize);
+ break;
+ case CHUNK_ANIMATION:
+ this.parseAnimationChunk(loc3.dataPosition,loc3.dataSize);
+ }
+ this.parseMainChunk(loc3.nextChunkPosition,param2 - loc3.size);
+ }
+
+ private function parse3DChunk(param1:uint, param2:uint) : void
+ {
+ var loc4:MaterialData = null;
+ var loc3:ChunkInfo = this.readChunkInfo(param1,param2);
+ if(loc3 == null)
+ {
+ return;
+ }
+ switch(loc3.id)
+ {
+ case CHUNK_MATERIAL:
+ loc4 = new MaterialData();
+ this.parseMaterialChunk(loc4,loc3.dataPosition,loc3.dataSize);
+ break;
+ case CHUNK_OBJECT:
+ this.parseObject(loc3);
+ }
+ this.parse3DChunk(loc3.nextChunkPosition,param2 - loc3.size);
+ }
+
+ private function parseObject(param1:ChunkInfo) : void
+ {
+ if(this.objectDatas == null)
+ {
+ this.objectDatas = new Map();
+ }
+ var loc2:ObjectData = new ObjectData();
+ loc2.name = this.getString(param1.dataPosition);
+ this.objectDatas[loc2.name] = loc2;
+ var loc3:int = loc2.name.length + 1;
+ this.parseObjectChunk(loc2,param1.dataPosition + loc3,param1.dataSize - loc3);
+ }
+
+ private function parseObjectChunk(param1:ObjectData, param2:uint, param3:uint) : void
+ {
+ var loc4:ChunkInfo = this.readChunkInfo(param2,param3);
+ if(loc4 == null)
+ {
+ return;
+ }
+ switch(loc4.id)
+ {
+ case CHUNK_TRIMESH:
+ this.parseMeshChunk(param1,loc4.dataPosition,loc4.dataSize);
+ break;
+ case 17920:
+ case 18176:
+ }
+ this.parseObjectChunk(param1,loc4.nextChunkPosition,param3 - loc4.size);
+ }
+
+ private function parseMeshChunk(param1:ObjectData, param2:uint, param3:uint) : void
+ {
+ var loc4:ChunkInfo = this.readChunkInfo(param2,param3);
+ if(loc4 == null)
+ {
+ return;
+ }
+ switch(loc4.id)
+ {
+ case CHUNK_VERTICES:
+ this.parseVertices(param1);
+ break;
+ case CHUNK_MAPPINGCOORDS:
+ this.parseUVs(param1);
+ break;
+ case CHUNK_TRANSFORMATION:
+ this.parseMatrix(param1);
+ break;
+ case CHUNK_FACES:
+ this.parseFaces(param1,loc4);
+ }
+ this.parseMeshChunk(param1,loc4.nextChunkPosition,param3 - loc4.size);
+ }
+
+ private function parseVertices(param1:ObjectData) : void
+ {
+ var loc2:uint = this.data.readUnsignedShort();
+ param1.vertices = new Array();
+ var loc3:uint = 0;
+ while(loc3 < loc2)
+ {
+ param1.vertices.push(new Point3D(this.data.readFloat(),this.data.readFloat(),this.data.readFloat()));
+ loc3++;
+ }
+ }
+
+ private function parseUVs(param1:ObjectData) : void
+ {
+ var loc2:uint = this.data.readUnsignedShort();
+ param1.uvs = new Array();
+ var loc3:uint = 0;
+ while(loc3 < loc2)
+ {
+ param1.uvs.push(new Point(this.data.readFloat(),this.data.readFloat()));
+ loc3++;
+ }
+ }
+
+ private function parseMatrix(param1:ObjectData) : void
+ {
+ param1.matrix = new Matrix3D();
+ param1.matrix.a = this.data.readFloat();
+ param1.matrix.e = this.data.readFloat();
+ param1.matrix.i = this.data.readFloat();
+ param1.matrix.b = this.data.readFloat();
+ param1.matrix.f = this.data.readFloat();
+ param1.matrix.j = this.data.readFloat();
+ param1.matrix.c = this.data.readFloat();
+ param1.matrix.g = this.data.readFloat();
+ param1.matrix.k = this.data.readFloat();
+ param1.matrix.d = this.data.readFloat();
+ param1.matrix.h = this.data.readFloat();
+ param1.matrix.l = this.data.readFloat();
+ }
+
+ private function parseFaces(param1:ObjectData, param2:ChunkInfo) : void
+ {
+ var loc6:FaceData = null;
+ var loc3:uint = this.data.readUnsignedShort();
+ param1.faces = new Array();
+ var loc4:uint = 0;
+ while(loc4 < loc3)
+ {
+ loc6 = new FaceData();
+ loc6.a = this.data.readUnsignedShort();
+ loc6.b = this.data.readUnsignedShort();
+ loc6.c = this.data.readUnsignedShort();
+ param1.faces.push(loc6);
+ this.data.position += 2;
+ loc4++;
+ }
+ var loc5:uint = 2 + 8 * loc3;
+ this.parseFacesChunk(param1,param2.dataPosition + loc5,param2.dataSize - loc5);
+ }
+
+ private function parseFacesChunk(param1:ObjectData, param2:uint, param3:uint) : void
+ {
+ var loc4:ChunkInfo = this.readChunkInfo(param2,param3);
+ if(loc4 == null)
+ {
+ return;
+ }
+ switch(loc4.id)
+ {
+ case CHUNK_FACESMATERIAL:
+ this.parseSurface(param1);
+ }
+ this.parseFacesChunk(param1,loc4.nextChunkPosition,param3 - loc4.size);
+ }
+
+ private function parseSurface(param1:ObjectData) : void
+ {
+ if(param1.surfaces == null)
+ {
+ param1.surfaces = new Map();
+ }
+ var loc2:SurfaceData = new SurfaceData();
+ loc2.materialName = this.getString(this.data.position);
+ param1.surfaces[loc2.materialName] = loc2;
+ var loc3:uint = this.data.readUnsignedShort();
+ loc2.faces = new Array(loc3);
+ var loc4:uint = 0;
+ while(loc4 < loc3)
+ {
+ loc2.faces[loc4] = this.data.readUnsignedShort();
+ loc4++;
+ }
+ }
+
+ private function parseAnimationChunk(param1:uint, param2:uint) : void
+ {
+ var loc4:AnimationData = null;
+ var loc3:ChunkInfo = this.readChunkInfo(param1,param2);
+ if(loc3 == null)
+ {
+ return;
+ }
+ switch(loc3.id)
+ {
+ case 45057:
+ case 45058:
+ case 45059:
+ case 45060:
+ case 45061:
+ case 45062:
+ case 45063:
+ if(this.animationDatas == null)
+ {
+ this.animationDatas = new Array();
+ }
+ loc4 = new AnimationData();
+ this.animationDatas.push(loc4);
+ this.parseObjectAnimationChunk(loc4,loc3.dataPosition,loc3.dataSize);
+ break;
+ case 45064:
+ }
+ this.parseAnimationChunk(loc3.nextChunkPosition,param2 - loc3.size);
+ }
+
+ private function parseObjectAnimationChunk(param1:AnimationData, param2:uint, param3:uint) : void
+ {
+ var loc4:ChunkInfo = this.readChunkInfo(param2,param3);
+ if(loc4 == null)
+ {
+ return;
+ }
+ switch(loc4.id)
+ {
+ case 45072:
+ param1.objectName = this.getString(this.data.position);
+ this.data.position += 4;
+ param1.parentIndex = this.data.readUnsignedShort();
+ break;
+ case 45073:
+ param1.objectName = this.getString(this.data.position);
+ break;
+ case 45075:
+ param1.pivot = new Point3D(this.data.readFloat(),this.data.readFloat(),this.data.readFloat());
+ break;
+ case 45088:
+ this.data.position += 20;
+ param1.position = new Point3D(this.data.readFloat(),this.data.readFloat(),this.data.readFloat());
+ break;
+ case 45089:
+ this.data.position += 20;
+ param1.rotation = this.getRotationFrom3DSAngleAxis(this.data.readFloat(),this.data.readFloat(),this.data.readFloat(),this.data.readFloat());
+ break;
+ case 45090:
+ this.data.position += 20;
+ param1.scale = new Point3D(this.data.readFloat(),this.data.readFloat(),this.data.readFloat());
+ }
+ this.parseObjectAnimationChunk(param1,loc4.nextChunkPosition,param3 - loc4.size);
+ }
+
+ private function parseMaterialChunk(param1:MaterialData, param2:uint, param3:uint) : void
+ {
+ var loc5:TextureMapsInfo = null;
+ var loc4:ChunkInfo = this.readChunkInfo(param2,param3);
+ if(loc4 == null)
+ {
+ return;
+ }
+ switch(loc4.id)
+ {
+ case 40960:
+ this.parseMaterialName(param1);
+ break;
+ case 40976:
+ break;
+ case 40992:
+ this.data.position = loc4.dataPosition + 6;
+ param1.color = ColorUtils.rgb(this.data.readUnsignedByte(),this.data.readUnsignedByte(),this.data.readUnsignedByte());
+ break;
+ case 41008:
+ break;
+ case 41024:
+ this.data.position = loc4.dataPosition + 6;
+ param1.glossiness = this.data.readUnsignedShort();
+ break;
+ case 41025:
+ this.data.position = loc4.dataPosition + 6;
+ param1.specular = this.data.readUnsignedShort();
+ break;
+ case 41040:
+ this.data.position = loc4.dataPosition + 6;
+ param1.transparency = this.data.readUnsignedShort();
+ break;
+ case 41472:
+ param1.diffuseMap = new MapData();
+ this.parseMapChunk(param1.name,param1.diffuseMap,loc4.dataPosition,loc4.dataSize);
+ loc5 = this.getTextureMapsInfo(param1.name);
+ loc5.diffuseMapFileName = param1.diffuseMap.filename;
+ break;
+ case 41786:
+ break;
+ case 41488:
+ param1.opacityMap = new MapData();
+ this.parseMapChunk(param1.name,param1.opacityMap,loc4.dataPosition,loc4.dataSize);
+ loc5 = this.getTextureMapsInfo(param1.name);
+ loc5.opacityMapFileName = param1.opacityMap.filename;
+ break;
+ case 41520:
+ case 41788:
+ case 41476:
+ case 41789:
+ case 41504:
+ }
+ this.parseMaterialChunk(param1,loc4.nextChunkPosition,param3 - loc4.size);
+ }
+
+ private function getTextureMapsInfo(param1:String) : TextureMapsInfo
+ {
+ if(this._textureMaterials == null)
+ {
+ this._textureMaterials = new Map();
+ }
+ var loc2:TextureMapsInfo = this._textureMaterials[param1];
+ if(loc2 == null)
+ {
+ loc2 = new TextureMapsInfo();
+ this._textureMaterials[param1] = loc2;
+ }
+ return loc2;
+ }
+
+ private function parseMaterialName(param1:MaterialData) : void
+ {
+ if(this.materialDatas == null)
+ {
+ this.materialDatas = new Map();
+ }
+ param1.name = this.getString(this.data.position);
+ this.materialDatas[param1.name] = param1;
+ }
+
+ private function parseMapChunk(param1:String, param2:MapData, param3:uint, param4:uint) : void
+ {
+ var loc5:ChunkInfo = this.readChunkInfo(param3,param4);
+ if(loc5 == null)
+ {
+ return;
+ }
+ switch(loc5.id)
+ {
+ case 41728:
+ param2.filename = this.getString(loc5.dataPosition).toLowerCase();
+ break;
+ case 41809:
+ break;
+ case 41812:
+ param2.scaleU = this.data.readFloat();
+ break;
+ case 41814:
+ param2.scaleV = this.data.readFloat();
+ break;
+ case 41816:
+ param2.offsetU = this.data.readFloat();
+ break;
+ case 41818:
+ param2.offsetV = this.data.readFloat();
+ break;
+ case 41820:
+ param2.rotation = this.data.readFloat();
+ }
+ this.parseMapChunk(param1,param2,loc5.nextChunkPosition,param4 - loc5.size);
+ }
+
+ private function buildContent() : void
+ {
+ var loc1:uint = 0;
+ var loc2:uint = 0;
+ var loc3:String = null;
+ var loc4:ObjectData = null;
+ var loc5:Mesh = null;
+ var loc6:AnimationData = null;
+ var loc7:uint = 0;
+ var loc8:uint = 0;
+ var loc9:AnimationData = null;
+ var loc10:String = null;
+ var loc11:ObjectData = null;
+ var loc12:Object3D = null;
+ this._content = new Object3D("container_3ds");
+ this.buildMaterialMatrices();
+ if(this.animationDatas != null)
+ {
+ if(this.objectDatas != null)
+ {
+ loc2 = this.animationDatas.length;
+ loc1 = 0;
+ while(loc1 < loc2)
+ {
+ loc6 = this.animationDatas[loc1];
+ loc3 = loc6.objectName;
+ loc4 = this.objectDatas[loc3];
+ if(loc4 != null)
+ {
+ loc7 = 2;
+ loc8 = uint(loc1 + 1);
+ while(loc8 < loc2)
+ {
+ loc9 = this.animationDatas[loc8];
+ if(loc3 == loc9.objectName)
+ {
+ loc10 = loc3 + loc7;
+ loc9.objectName = loc10;
+ loc11 = new ObjectData();
+ loc11.name = loc10;
+ if(loc4.vertices != null)
+ {
+ loc11.vertices = new Array().concat(loc4.vertices);
+ }
+ if(loc4.uvs != null)
+ {
+ loc11.uvs = new Array().concat(loc4.uvs);
+ }
+ if(loc4.matrix != null)
+ {
+ loc11.matrix = loc4.matrix.clone();
+ }
+ if(loc4.faces != null)
+ {
+ loc11.faces = new Array().concat(loc4.faces);
+ }
+ if(loc4.surfaces != null)
+ {
+ loc11.surfaces = loc4.surfaces.clone();
+ }
+ this.objectDatas[loc10] = loc11;
+ loc7++;
+ }
+ loc8++;
+ }
+ }
+ if(loc4 != null && loc4.vertices != null)
+ {
+ loc5 = new Mesh(loc3);
+ loc6.object = loc5;
+ this.setBasicObjectProperties(loc6);
+ this.buildMesh(loc5,loc4,loc6);
+ }
+ else
+ {
+ loc12 = new Object3D(loc3);
+ loc6.object = loc12;
+ this.setBasicObjectProperties(loc6);
+ }
+ loc1++;
+ }
+ this.buildHierarchy();
+ }
+ }
+ else
+ {
+ for(loc3 in this.objectDatas)
+ {
+ loc4 = this.objectDatas[loc3];
+ if(loc4.vertices != null)
+ {
+ loc5 = new Mesh(loc3);
+ this.buildMesh(loc5,loc4,null);
+ this._content.addChild(loc5);
+ }
+ }
+ }
+ }
+
+ private function buildMaterialMatrices() : void
+ {
+ var loc1:MaterialData = null;
+ var loc2:String = null;
+ var loc3:Matrix = null;
+ var loc4:MapData = null;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ for(loc2 in this.materialDatas)
+ {
+ loc1 = this.materialDatas[loc2];
+ loc3 = new Matrix();
+ loc4 = loc1.diffuseMap;
+ if(loc4 != null)
+ {
+ loc5 = MathUtils.toRadian(loc4.rotation);
+ loc6 = Math.sin(loc5);
+ loc7 = Math.cos(loc5);
+ loc3.translate(-loc4.offsetU,loc4.offsetV);
+ loc3.translate(-0.5,-0.5);
+ loc3.rotate(-loc5);
+ loc3.scale(loc4.scaleU,loc4.scaleV);
+ loc3.translate(0.5,0.5);
+ }
+ loc1.matrix = loc3;
+ }
+ }
+
+ private function setBasicObjectProperties(param1:AnimationData) : void
+ {
+ var loc2:Object3D = param1.object;
+ if(param1.position != null)
+ {
+ loc2.x = param1.position.x * this._scale;
+ loc2.y = param1.position.y * this._scale;
+ loc2.z = param1.position.z * this._scale;
+ }
+ if(param1.rotation != null)
+ {
+ loc2.rotationX = param1.rotation.x;
+ loc2.rotationY = param1.rotation.y;
+ loc2.rotationZ = param1.rotation.z;
+ }
+ if(param1.scale != null)
+ {
+ loc2.scaleX = param1.scale.x;
+ loc2.scaleY = param1.scale.y;
+ loc2.scaleZ = param1.scale.z;
+ }
+ loc2.mobility = this._mobility;
+ }
+
+ private function buildMesh(param1:Mesh, param2:ObjectData, param3:AnimationData) : void
+ {
+ var loc4:int = 0;
+ var loc5:* = undefined;
+ var loc6:Vertex = null;
+ var loc7:Face = null;
+ var loc9:Point3D = null;
+ var loc10:FaceData = null;
+ var loc11:String = null;
+ var loc12:MaterialData = null;
+ var loc13:SurfaceData = null;
+ var loc14:Surface = null;
+ var loc15:Matrix = null;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:Surface = null;
+ var loc19:String = null;
+ var loc8:int = int(param2.vertices.length);
+ loc4 = 0;
+ while(loc4 < loc8)
+ {
+ loc9 = param2.vertices[loc4];
+ param2.vertices[loc4] = param1.createVertex(loc9.x,loc9.y,loc9.z,loc4);
+ loc4++;
+ }
+ if(param3 != null)
+ {
+ param2.matrix.invert();
+ if(param3.pivot != null)
+ {
+ param2.matrix.d -= param3.pivot.x;
+ param2.matrix.h -= param3.pivot.y;
+ param2.matrix.l -= param3.pivot.z;
+ }
+ for(loc5 in param1.alternativa3d::_vertices)
+ {
+ loc6 = param1.alternativa3d::_vertices[loc5];
+ loc6.alternativa3d::_coords.transform(param2.matrix);
+ }
+ }
+ for(loc5 in param1.alternativa3d::_vertices)
+ {
+ loc6 = param1.alternativa3d::_vertices[loc5];
+ loc6.alternativa3d::_coords.multiply(this._scale);
+ }
+ loc8 = param2.faces == null ? 0 : int(param2.faces.length);
+ loc4 = 0;
+ while(loc4 < loc8)
+ {
+ loc10 = param2.faces[loc4];
+ loc7 = param1.createFace([param2.vertices[loc10.a],param2.vertices[loc10.b],param2.vertices[loc10.c]],loc4);
+ if(param2.uvs != null)
+ {
+ loc7.aUV = param2.uvs[loc10.a];
+ loc7.bUV = param2.uvs[loc10.b];
+ loc7.cUV = param2.uvs[loc10.c];
+ }
+ loc4++;
+ }
+ if(param2.surfaces != null)
+ {
+ for(loc11 in param2.surfaces)
+ {
+ loc12 = this.materialDatas[loc11];
+ loc13 = param2.surfaces[loc11];
+ loc14 = param1.createSurface(loc13.faces,loc11);
+ if(loc12.diffuseMap != null)
+ {
+ loc8 = int(loc13.faces.length);
+ loc4 = 0;
+ while(loc4 < loc8)
+ {
+ loc7 = param1.getFaceById(loc13.faces[loc4]);
+ if(loc7.alternativa3d::_aUV != null && loc7.alternativa3d::_bUV != null && loc7.alternativa3d::_cUV != null)
+ {
+ loc15 = loc12.matrix;
+ loc16 = loc7.aUV.x;
+ loc17 = loc7.aUV.y;
+ loc7.alternativa3d::_aUV.x = loc15.a * loc16 + loc15.b * loc17 + loc15.tx;
+ loc7.alternativa3d::_aUV.y = loc15.c * loc16 + loc15.d * loc17 + loc15.ty;
+ loc16 = loc7.alternativa3d::_bUV.x;
+ loc17 = loc7.alternativa3d::_bUV.y;
+ loc7.alternativa3d::_bUV.x = loc15.a * loc16 + loc15.b * loc17 + loc15.tx;
+ loc7.alternativa3d::_bUV.y = loc15.c * loc16 + loc15.d * loc17 + loc15.ty;
+ loc16 = loc7.alternativa3d::_cUV.x;
+ loc17 = loc7.alternativa3d::_cUV.y;
+ loc7.alternativa3d::_cUV.x = loc15.a * loc16 + loc15.b * loc17 + loc15.tx;
+ loc7.alternativa3d::_cUV.y = loc15.c * loc16 + loc15.d * loc17 + loc15.ty;
+ }
+ loc4++;
+ }
+ loc14.material = new TextureMaterial(null,1 - loc12.transparency / 100,this._repeat,this._smooth,this._blendMode,-1,0,this._precision);
+ }
+ else
+ {
+ loc14.material = new FillMaterial(this.materialDatas[loc11].color,1 - loc12.transparency / 100);
+ }
+ }
+ }
+ else
+ {
+ loc18 = param1.createSurface();
+ for(loc19 in param1.alternativa3d::_faces)
+ {
+ loc18.addFace(param1.alternativa3d::_faces[loc19]);
+ }
+ loc18.material = new WireMaterial(0,8355711);
+ }
+ }
+
+ private function buildHierarchy() : void
+ {
+ var loc3:AnimationData = null;
+ var loc1:Number = this.animationDatas.length;
+ var loc2:int = 0;
+ while(loc2 < loc1)
+ {
+ loc3 = this.animationDatas[loc2];
+ if(loc3.parentIndex == 65535)
+ {
+ this._content.addChild(loc3.object);
+ }
+ else
+ {
+ AnimationData(this.animationDatas[loc3.parentIndex]).object.addChild(loc3.object);
+ }
+ loc2++;
+ }
+ }
+
+ private function getString(param1:uint) : String
+ {
+ var loc2:uint = 0;
+ this.data.position = param1;
+ var loc3:String = "";
+ while(true)
+ {
+ loc2 = uint(this.data.readByte());
+ if(loc2 == 0)
+ {
+ break;
+ }
+ loc3 += String.fromCharCode(loc2);
+ }
+ return loc3;
+ }
+
+ private function getRotationFrom3DSAngleAxis(param1:Number, param2:Number, param3:Number, param4:Number) : Point3D
+ {
+ var loc10:Number = NaN;
+ var loc5:Point3D = new Point3D();
+ var loc6:Number = Math.sin(param1);
+ var loc7:Number = Math.cos(param1);
+ var loc8:Number = 1 - loc7;
+ var loc9:Number = param2 * param4 * loc8 + param3 * loc6;
+ if(loc9 >= 1)
+ {
+ loc10 = param1 / 2;
+ loc5.z = -2 * Math.atan2(param2 * Math.sin(loc10),Math.cos(loc10));
+ loc5.y = -Math.PI / 2;
+ loc5.x = 0;
+ return loc5;
+ }
+ if(loc9 <= -1)
+ {
+ loc10 = param1 / 2;
+ loc5.z = 2 * Math.atan2(param2 * Math.sin(loc10),Math.cos(loc10));
+ loc5.y = Math.PI / 2;
+ loc5.x = 0;
+ return loc5;
+ }
+ loc5.z = -Math.atan2(param4 * loc6 - param2 * param3 * loc8,1 - (param4 * param4 + param3 * param3) * loc8);
+ loc5.y = -Math.asin(param2 * param4 * loc8 + param3 * loc6);
+ loc5.x = -Math.atan2(param2 * loc6 - param4 * param3 * loc8,1 - (param2 * param2 + param3 * param3) * loc8);
+ return loc5;
+ }
+ }
+}
+
+import alternativa.engine3d.core.Object3D;
+import alternativa.types.Map;
+import alternativa.types.Matrix3D;
+import alternativa.types.Point3D;
+import flash.geom.Matrix;
+
+class MaterialData
+{
+ public var name:String;
+
+ public var color:uint;
+
+ public var specular:uint;
+
+ public var glossiness:uint;
+
+ public var transparency:uint;
+
+ public var diffuseMap:MapData;
+
+ public var opacityMap:MapData;
+
+ public var matrix:Matrix;
+
+ public function MaterialData()
+ {
+ super();
+ }
+}
+
+class MapData
+{
+ public var filename:String;
+
+ public var scaleU:Number = 1;
+
+ public var scaleV:Number = 1;
+
+ public var offsetU:Number = 0;
+
+ public var offsetV:Number = 0;
+
+ public var rotation:Number = 0;
+
+ public function MapData()
+ {
+ super();
+ }
+}
+
+class ObjectData
+{
+ public var name:String;
+
+ public var vertices:Array;
+
+ public var uvs:Array;
+
+ public var matrix:Matrix3D;
+
+ public var faces:Array;
+
+ public var surfaces:Map;
+
+ public function ObjectData()
+ {
+ super();
+ }
+}
+
+class FaceData
+{
+ public var a:uint;
+
+ public var b:uint;
+
+ public var c:uint;
+
+ public function FaceData()
+ {
+ super();
+ }
+}
+
+class SurfaceData
+{
+ public var materialName:String;
+
+ public var faces:Array;
+
+ public function SurfaceData()
+ {
+ super();
+ }
+}
+
+class AnimationData
+{
+ public var objectName:String;
+
+ public var object:Object3D;
+
+ public var parentIndex:uint;
+
+ public var pivot:Point3D;
+
+ public var position:Point3D;
+
+ public var rotation:Point3D;
+
+ public var scale:Point3D;
+
+ public function AnimationData()
+ {
+ super();
+ }
+}
+
+class ChunkInfo
+{
+ public var id:uint;
+
+ public var size:uint;
+
+ public var dataSize:uint;
+
+ public var dataPosition:uint;
+
+ public var nextChunkPosition:uint;
+
+ public function ChunkInfo()
+ {
+ super();
+ }
+}
diff --git a/src/alternativa/engine3d/loaders/TextureMapsBatchLoader.as b/src/alternativa/engine3d/loaders/TextureMapsBatchLoader.as
new file mode 100644
index 0000000..270dbbf
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/TextureMapsBatchLoader.as
@@ -0,0 +1,180 @@
+package alternativa.engine3d.loaders
+{
+ import alternativa.engine3d.loaders.events.LoaderEvent;
+ import alternativa.engine3d.loaders.events.LoaderProgressEvent;
+ import alternativa.types.Map;
+ import flash.display.BitmapData;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.events.ProgressEvent;
+ import flash.system.LoaderContext;
+
+ public class TextureMapsBatchLoader extends EventDispatcher
+ {
+ public static var stubBitmapData:BitmapData;
+
+ private var loader:TextureMapsLoader;
+
+ private var loaderContext:LoaderContext;
+
+ private var baseUrl:String;
+
+ private var batch:Map;
+
+ private var materialNames:Array;
+
+ private var totalFiles:int;
+
+ private var currFileIndex:int;
+
+ private var materialIndex:int;
+
+ private var _textures:Map;
+
+ public function TextureMapsBatchLoader()
+ {
+ super();
+ }
+
+ public function get textures() : Map
+ {
+ return this._textures;
+ }
+
+ private function getStubBitmapData() : BitmapData
+ {
+ var loc1:uint = 0;
+ var loc2:uint = 0;
+ var loc3:uint = 0;
+ if(stubBitmapData == null)
+ {
+ loc1 = 20;
+ stubBitmapData = new BitmapData(loc1,loc1,false,0);
+ loc2 = 0;
+ while(loc2 < loc1)
+ {
+ loc3 = 0;
+ while(loc3 < loc1)
+ {
+ stubBitmapData.setPixel(!!(loc2 % 2) ? int(loc3) : loc3 + 1,loc2,16711935);
+ loc3 += 2;
+ }
+ loc2++;
+ }
+ }
+ return stubBitmapData;
+ }
+
+ public function close() : void
+ {
+ if(this.loader != null)
+ {
+ this.loader.close();
+ }
+ }
+
+ private function clean() : void
+ {
+ this.loaderContext = null;
+ this.batch = null;
+ this.materialNames = null;
+ }
+
+ public function unload() : void
+ {
+ this._textures = null;
+ }
+
+ public function load(param1:String, param2:Map, param3:LoaderContext) : void
+ {
+ var loc4:String = null;
+ var loc5:TextureMapsInfo = null;
+ this.baseUrl = param1;
+ this.batch = param2;
+ this.loaderContext = param3;
+ if(this.loader == null)
+ {
+ this.loader = new TextureMapsLoader();
+ this.loader.addEventListener(LoaderEvent.LOADING_START,this.onTextureLoadingStart);
+ this.loader.addEventListener(LoaderEvent.LOADING_COMPLETE,this.onTextureLoadingComplete);
+ this.loader.addEventListener(ProgressEvent.PROGRESS,this.onProgress);
+ this.loader.addEventListener(Event.COMPLETE,this.onMaterialTexturesLoadingComplete);
+ this.loader.addEventListener(IOErrorEvent.IO_ERROR,this.onMaterialTexturesLoadingComplete);
+ }
+ else
+ {
+ this.close();
+ }
+ this.totalFiles = 0;
+ this.materialNames = new Array();
+ for(loc4 in param2)
+ {
+ this.materialNames.push(loc4);
+ loc5 = param2[loc4];
+ this.totalFiles += loc5.opacityMapFileName == null ? 1 : 2;
+ }
+ this.currFileIndex = 0;
+ this.materialIndex = 0;
+ this._textures = new Map();
+ this.loadNextTextureFile();
+ }
+
+ private function loadNextTextureFile() : void
+ {
+ var loc1:TextureMapsInfo = this.batch[this.materialNames[this.materialIndex]];
+ this.loader.load(this.baseUrl + loc1.diffuseMapFileName,loc1.opacityMapFileName == null ? null : this.baseUrl + loc1.opacityMapFileName,this.loaderContext);
+ }
+
+ private function onTextureLoadingStart(param1:Event) : void
+ {
+ dispatchEvent(param1);
+ }
+
+ private function onTextureLoadingComplete(param1:Event) : void
+ {
+ dispatchEvent(param1);
+ ++this.currFileIndex;
+ }
+
+ private function onProgress(param1:ProgressEvent) : void
+ {
+ dispatchEvent(new LoaderProgressEvent(LoaderProgressEvent.LOADING_PROGRESS,LoadingStage.TEXTURE,this.totalFiles,this.currFileIndex,param1.bytesLoaded,param1.bytesTotal));
+ }
+
+ private function onMaterialTexturesLoadingComplete(param1:Event) : void
+ {
+ var loc2:IOErrorEvent = null;
+ var loc3:TextureMapsInfo = null;
+ if(param1 is IOErrorEvent)
+ {
+ this._textures.add(this.materialNames[this.materialIndex],this.getStubBitmapData());
+ loc2 = IOErrorEvent(param1);
+ loc3 = this.batch[this.materialNames[this.materialIndex]];
+ if(loc3.diffuseMapFileName)
+ {
+ loc2.text += this.baseUrl + loc3.diffuseMapFileName;
+ }
+ if(loc3.opacityMapFileName)
+ {
+ loc2.text += this.baseUrl + loc3.opacityMapFileName;
+ }
+ dispatchEvent(loc2);
+ }
+ else
+ {
+ this._textures.add(this.materialNames[this.materialIndex],this.loader.bitmapData);
+ }
+ if(++this.materialIndex == this.materialNames.length)
+ {
+ this.clean();
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ else
+ {
+ this.loadNextTextureFile();
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/TextureMapsInfo.as b/src/alternativa/engine3d/loaders/TextureMapsInfo.as
new file mode 100644
index 0000000..2d7f4ed
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/TextureMapsInfo.as
@@ -0,0 +1,22 @@
+package alternativa.engine3d.loaders
+{
+ public class TextureMapsInfo
+ {
+ public var diffuseMapFileName:String;
+
+ public var opacityMapFileName:String;
+
+ public function TextureMapsInfo(param1:String = null, param2:String = null)
+ {
+ super();
+ this.diffuseMapFileName = param1;
+ this.opacityMapFileName = param2;
+ }
+
+ public function toString() : String
+ {
+ return "[Object TextureMapsInfo, diffuseMapFileName:" + this.diffuseMapFileName + ", opacityMapFileName: " + this.opacityMapFileName + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/TextureMapsLoader.as b/src/alternativa/engine3d/loaders/TextureMapsLoader.as
new file mode 100644
index 0000000..c1ce6b4
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/TextureMapsLoader.as
@@ -0,0 +1,155 @@
+package alternativa.engine3d.loaders
+{
+ import alternativa.engine3d.loaders.events.LoaderEvent;
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.display.BitmapDataChannel;
+ import flash.display.BlendMode;
+ import flash.display.Loader;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.events.ProgressEvent;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+ import flash.net.URLRequest;
+ import flash.system.LoaderContext;
+
+ public class TextureMapsLoader extends EventDispatcher
+ {
+ private static const STATE_IDLE:int = 0;
+
+ private static const STATE_LOADING_DIFFUSE_MAP:int = 1;
+
+ private static const STATE_LOADING_ALPHA_MAP:int = 2;
+
+ private var _bitmapData:BitmapData;
+
+ private var bitmapLoader:Loader;
+
+ private var alphaTextureUrl:String;
+
+ private var loaderContext:LoaderContext;
+
+ private var loaderState:int = 0;
+
+ public function TextureMapsLoader(param1:String = null, param2:String = null, param3:LoaderContext = null)
+ {
+ super();
+ if(param1 != null)
+ {
+ this.load(param1,param2,param3);
+ }
+ }
+
+ public function load(param1:String, param2:String = null, param3:LoaderContext = null) : void
+ {
+ this.alphaTextureUrl = param2;
+ this.loaderContext = param3;
+ if(this.bitmapLoader == null)
+ {
+ this.bitmapLoader = new Loader();
+ this.bitmapLoader.contentLoaderInfo.addEventListener(Event.OPEN,this.onOpen);
+ this.bitmapLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.onComplete);
+ this.bitmapLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,this.onProgress);
+ this.bitmapLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,this.onLoadError);
+ }
+ else
+ {
+ this.close();
+ }
+ this.startLoading(STATE_LOADING_DIFFUSE_MAP,param1);
+ }
+
+ private function onOpen(param1:Event) : void
+ {
+ dispatchEvent(new LoaderEvent(LoaderEvent.LOADING_START,LoadingStage.TEXTURE));
+ }
+
+ private function onProgress(param1:Event) : void
+ {
+ dispatchEvent(param1);
+ }
+
+ private function startLoading(param1:int, param2:String) : void
+ {
+ this.loaderState = param1;
+ this.bitmapLoader.load(new URLRequest(param2),this.loaderContext);
+ }
+
+ private function onComplete(param1:Event) : void
+ {
+ var loc2:BitmapData = null;
+ var loc3:BitmapData = null;
+ dispatchEvent(new LoaderEvent(LoaderEvent.LOADING_COMPLETE,LoadingStage.TEXTURE));
+ switch(this.loaderState)
+ {
+ case STATE_LOADING_DIFFUSE_MAP:
+ this._bitmapData = Bitmap(this.bitmapLoader.content).bitmapData;
+ if(this.alphaTextureUrl != null)
+ {
+ this.startLoading(STATE_LOADING_ALPHA_MAP,this.alphaTextureUrl);
+ break;
+ }
+ this.complete();
+ break;
+ case STATE_LOADING_ALPHA_MAP:
+ loc2 = this._bitmapData;
+ this._bitmapData = new BitmapData(this._bitmapData.width,this._bitmapData.height,true,0);
+ this._bitmapData.copyPixels(loc2,loc2.rect,new Point());
+ loc3 = Bitmap(this.bitmapLoader.content).bitmapData;
+ if(this._bitmapData.width != loc3.width || this._bitmapData.height != loc3.height)
+ {
+ loc2.draw(loc3,new Matrix(this._bitmapData.width / loc3.width,0,0,this._bitmapData.height / loc3.height),null,BlendMode.NORMAL,null,true);
+ loc3.dispose();
+ loc3 = loc2;
+ }
+ this._bitmapData.copyChannel(loc3,loc3.rect,new Point(),BitmapDataChannel.RED,BitmapDataChannel.ALPHA);
+ loc3.dispose();
+ this.complete();
+ }
+ }
+
+ private function onLoadError(param1:IOErrorEvent) : void
+ {
+ this.loaderState = STATE_IDLE;
+ dispatchEvent(param1);
+ }
+
+ private function complete() : void
+ {
+ this.loaderState = STATE_IDLE;
+ this.bitmapLoader.unload();
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+
+ public function get bitmapData() : BitmapData
+ {
+ return this._bitmapData;
+ }
+
+ public function close() : void
+ {
+ if(this.loaderState != STATE_IDLE)
+ {
+ this.loaderState = STATE_IDLE;
+ this.bitmapLoader.close();
+ }
+ this.unload();
+ }
+
+ public function unload() : void
+ {
+ if(this.loaderState == STATE_IDLE)
+ {
+ if(this.bitmapLoader != null)
+ {
+ this.bitmapLoader.unload();
+ }
+ this.loaderContext = null;
+ this._bitmapData = null;
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/events/LoaderEvent.as b/src/alternativa/engine3d/loaders/events/LoaderEvent.as
new file mode 100644
index 0000000..e75b6cd
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/events/LoaderEvent.as
@@ -0,0 +1,35 @@
+package alternativa.engine3d.loaders.events
+{
+ import flash.events.Event;
+
+ public class LoaderEvent extends Event
+ {
+ public static const LOADING_START:String = "loadingStart";
+
+ public static const LOADING_COMPLETE:String = "loadingComplete";
+
+ private var _loadingStage:int;
+
+ public function LoaderEvent(param1:String, param2:int)
+ {
+ super(param1);
+ this._loadingStage = param2;
+ }
+
+ public function get loadingStage() : int
+ {
+ return this._loadingStage;
+ }
+
+ override public function clone() : Event
+ {
+ return new LoaderEvent(type,this._loadingStage);
+ }
+
+ override public function toString() : String
+ {
+ return "[LoaderEvent type=\"" + type + "\", loadingStage=" + this._loadingStage + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/loaders/events/LoaderProgressEvent.as b/src/alternativa/engine3d/loaders/events/LoaderProgressEvent.as
new file mode 100644
index 0000000..60558d3
--- /dev/null
+++ b/src/alternativa/engine3d/loaders/events/LoaderProgressEvent.as
@@ -0,0 +1,50 @@
+package alternativa.engine3d.loaders.events
+{
+ import flash.events.Event;
+ import flash.events.ProgressEvent;
+
+ public class LoaderProgressEvent extends ProgressEvent
+ {
+ public static const LOADING_PROGRESS:String = "loadingProgress";
+
+ private var _loadingStage:int;
+
+ private var _totalItems:int;
+
+ private var _currentItem:int;
+
+ public function LoaderProgressEvent(param1:String, param2:int, param3:int, param4:int, param5:uint = 0, param6:uint = 0)
+ {
+ super(param1,false,false,param5,param6);
+ this._loadingStage = param2;
+ this._totalItems = param3;
+ this._currentItem = param4;
+ }
+
+ public function get loadingStage() : int
+ {
+ return this._loadingStage;
+ }
+
+ public function get totalItems() : int
+ {
+ return this._totalItems;
+ }
+
+ public function get currentItem() : int
+ {
+ return this._currentItem;
+ }
+
+ override public function clone() : Event
+ {
+ return new LoaderProgressEvent(type,this._loadingStage,this._totalItems,this._currentItem,bytesLoaded,bytesTotal);
+ }
+
+ override public function toString() : String
+ {
+ return "[LoaderProgressEvent type=\"" + type + "\", loadingStage=" + this._loadingStage + ", totalItems=" + this._totalItems + ", currentItem=" + this._currentItem + ", bytesTotal=" + bytesTotal + ", bytesLoaded=" + bytesLoaded + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/DrawPoint.as b/src/alternativa/engine3d/materials/DrawPoint.as
new file mode 100644
index 0000000..1aebbac
--- /dev/null
+++ b/src/alternativa/engine3d/materials/DrawPoint.as
@@ -0,0 +1,26 @@
+package alternativa.engine3d.materials
+{
+ public final class DrawPoint
+ {
+ public var x:Number;
+
+ public var y:Number;
+
+ public var z:Number;
+
+ public var u:Number;
+
+ public var v:Number;
+
+ public function DrawPoint(param1:Number, param2:Number, param3:Number, param4:Number = 0, param5:Number = 0)
+ {
+ super();
+ this.x = param1;
+ this.y = param2;
+ this.z = param3;
+ this.u = param4;
+ this.v = param5;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/FillMaterial.as b/src/alternativa/engine3d/materials/FillMaterial.as
new file mode 100644
index 0000000..5cc5726
--- /dev/null
+++ b/src/alternativa/engine3d/materials/FillMaterial.as
@@ -0,0 +1,131 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.display.Skin;
+ import flash.display.Graphics;
+
+ use namespace alternativa3d;
+
+ public class FillMaterial extends SurfaceMaterial
+ {
+ alternativa3d var _color:uint;
+
+ alternativa3d var _wireThickness:Number;
+
+ alternativa3d var _wireColor:uint;
+
+ public function FillMaterial(param1:uint, param2:Number = 1, param3:String = "normal", param4:Number = -1, param5:uint = 0)
+ {
+ super(param2,param3);
+ this.alternativa3d::_color = param1;
+ this.alternativa3d::_wireThickness = param4;
+ this.alternativa3d::_wireColor = param5;
+ }
+
+ override alternativa3d function draw(param1:Camera3D, param2:Skin, param3:uint, param4:Array) : void
+ {
+ var loc5:uint = 0;
+ var loc6:DrawPoint = null;
+ var loc8:Number = NaN;
+ param2.alpha = alternativa3d::_alpha;
+ param2.blendMode = alternativa3d::_blendMode;
+ var loc7:Graphics = param2.alternativa3d::gfx;
+ if(param1.alternativa3d::_orthographic)
+ {
+ loc7.beginFill(this.alternativa3d::_color);
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc7.lineStyle(this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ loc6 = param4[0];
+ loc7.moveTo(loc6.x,loc6.y);
+ loc5 = 1;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ loc7.lineTo(loc6.x,loc6.y);
+ loc5++;
+ }
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc6 = param4[0];
+ loc7.lineTo(loc6.x,loc6.y);
+ }
+ }
+ else
+ {
+ loc7.beginFill(this.alternativa3d::_color);
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc7.lineStyle(this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ loc6 = param4[0];
+ loc8 = param1.alternativa3d::_focalLength / loc6.z;
+ loc7.moveTo(loc6.x * loc8,loc6.y * loc8);
+ loc5 = 1;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ loc8 = param1.alternativa3d::_focalLength / loc6.z;
+ loc7.lineTo(loc6.x * loc8,loc6.y * loc8);
+ loc5++;
+ }
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc6 = param4[0];
+ loc8 = param1.alternativa3d::_focalLength / loc6.z;
+ loc7.lineTo(loc6.x * loc8,loc6.y * loc8);
+ }
+ }
+ }
+
+ public function get color() : uint
+ {
+ return this.alternativa3d::_color;
+ }
+
+ public function set color(param1:uint) : void
+ {
+ if(this.alternativa3d::_color != param1)
+ {
+ this.alternativa3d::_color = param1;
+ markToChange();
+ }
+ }
+
+ public function get wireThickness() : Number
+ {
+ return this.alternativa3d::_wireThickness;
+ }
+
+ public function set wireThickness(param1:Number) : void
+ {
+ if(this.alternativa3d::_wireThickness != param1)
+ {
+ this.alternativa3d::_wireThickness = param1;
+ markToChange();
+ }
+ }
+
+ public function get wireColor() : uint
+ {
+ return this.alternativa3d::_wireColor;
+ }
+
+ public function set wireColor(param1:uint) : void
+ {
+ if(this.alternativa3d::_wireColor != param1)
+ {
+ this.alternativa3d::_wireColor = param1;
+ markToChange();
+ }
+ }
+
+ override public function clone() : Material
+ {
+ return new FillMaterial(this.alternativa3d::_color,alternativa3d::_alpha,alternativa3d::_blendMode,this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/Material.as b/src/alternativa/engine3d/materials/Material.as
new file mode 100644
index 0000000..220bb5f
--- /dev/null
+++ b/src/alternativa/engine3d/materials/Material.as
@@ -0,0 +1,64 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.display.Skin;
+
+ use namespace alternativa3d;
+
+ public class Material
+ {
+ alternativa3d var _alpha:Number;
+
+ alternativa3d var _blendMode:String;
+
+ public function Material(param1:Number, param2:String)
+ {
+ super();
+ this.alternativa3d::_alpha = param1;
+ this.alternativa3d::_blendMode = param2;
+ }
+
+ public function get alpha() : Number
+ {
+ return this.alternativa3d::_alpha;
+ }
+
+ public function set alpha(param1:Number) : void
+ {
+ if(this.alternativa3d::_alpha != param1)
+ {
+ this.alternativa3d::_alpha = param1;
+ this.markToChange();
+ }
+ }
+
+ public function get blendMode() : String
+ {
+ return this.alternativa3d::_blendMode;
+ }
+
+ public function set blendMode(param1:String) : void
+ {
+ if(this.alternativa3d::_blendMode != param1)
+ {
+ this.alternativa3d::_blendMode = param1;
+ this.markToChange();
+ }
+ }
+
+ protected function markToChange() : void
+ {
+ }
+
+ alternativa3d function clear(param1:Skin) : void
+ {
+ param1.alternativa3d::gfx.clear();
+ }
+
+ public function clone() : Material
+ {
+ return new Material(this.alternativa3d::_alpha,this.alternativa3d::_blendMode);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/SpriteMaterial.as b/src/alternativa/engine3d/materials/SpriteMaterial.as
new file mode 100644
index 0000000..a90861a
--- /dev/null
+++ b/src/alternativa/engine3d/materials/SpriteMaterial.as
@@ -0,0 +1,68 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.core.Sprite3D;
+ import alternativa.engine3d.display.Skin;
+
+ use namespace alternativa3d;
+
+ public class SpriteMaterial extends Material
+ {
+ alternativa3d var _sprite:Sprite3D;
+
+ public function SpriteMaterial(param1:Number = 1, param2:String = "normal")
+ {
+ super(param1,param2);
+ }
+
+ public function get sprite() : Sprite3D
+ {
+ return this.alternativa3d::_sprite;
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ }
+
+ alternativa3d function addToSprite(param1:Sprite3D) : void
+ {
+ this.alternativa3d::_sprite = param1;
+ }
+
+ alternativa3d function removeFromSprite(param1:Sprite3D) : void
+ {
+ this.alternativa3d::_sprite = null;
+ }
+
+ alternativa3d function canDraw(param1:Camera3D) : Boolean
+ {
+ return true;
+ }
+
+ alternativa3d function draw(param1:Camera3D, param2:Skin) : void
+ {
+ param2.alpha = alternativa3d::_alpha;
+ param2.blendMode = alternativa3d::_blendMode;
+ }
+
+ override protected function markToChange() : void
+ {
+ if(this.alternativa3d::_sprite != null)
+ {
+ this.alternativa3d::_sprite.alternativa3d::addMaterialChangedOperationToScene();
+ }
+ }
+
+ override public function clone() : Material
+ {
+ return new SpriteMaterial(alternativa3d::_alpha,alternativa3d::_blendMode);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/SpriteTextureMaterial.as b/src/alternativa/engine3d/materials/SpriteTextureMaterial.as
new file mode 100644
index 0000000..7d06408
--- /dev/null
+++ b/src/alternativa/engine3d/materials/SpriteTextureMaterial.as
@@ -0,0 +1,185 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.display.Skin;
+ import alternativa.types.Matrix3D;
+ import alternativa.types.Texture;
+ import alternativa.types.alternativatypes;
+ import flash.geom.Matrix;
+ import flash.geom.Rectangle;
+
+ use namespace alternativa3d;
+ use namespace alternativatypes;
+
+ public class SpriteTextureMaterial extends SpriteMaterial
+ {
+ private static var drawRect:Rectangle = new Rectangle();
+
+ private static var textureMatrix:Matrix = new Matrix();
+
+ alternativa3d var _texture:Texture;
+
+ alternativa3d var _smooth:Boolean;
+
+ alternativa3d var _originX:Number;
+
+ alternativa3d var _originY:Number;
+
+ public function SpriteTextureMaterial(param1:Texture, param2:Number = 1, param3:Boolean = false, param4:String = "normal", param5:Number = 0.5, param6:Number = 0.5)
+ {
+ super(param2,param4);
+ this.alternativa3d::_texture = param1;
+ this.alternativa3d::_smooth = param3;
+ this.alternativa3d::_originX = param5;
+ this.alternativa3d::_originY = param6;
+ }
+
+ override alternativa3d function canDraw(param1:Camera3D) : Boolean
+ {
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc13:Number = NaN;
+ if(this.alternativa3d::_texture == null)
+ {
+ return false;
+ }
+ var loc2:Matrix3D = param1.alternativa3d::cameraMatrix;
+ var loc3:Number = Number(alternativa3d::_sprite.alternativa3d::globalCoords.x);
+ var loc4:Number = Number(alternativa3d::_sprite.alternativa3d::globalCoords.y);
+ var loc5:Number = Number(alternativa3d::_sprite.alternativa3d::globalCoords.z);
+ var loc6:Number = loc2.a * loc3 + loc2.b * loc4 + loc2.c * loc5 + loc2.d;
+ var loc7:Number = loc2.e * loc3 + loc2.f * loc4 + loc2.g * loc5 + loc2.h;
+ var loc8:Number = loc2.i * loc3 + loc2.j * loc4 + loc2.k * loc5 + loc2.l;
+ if(param1.alternativa3d::_orthographic)
+ {
+ if(param1.alternativa3d::_nearClipping && loc8 < param1.alternativa3d::_nearClippingDistance || param1.alternativa3d::_farClipping && loc8 > param1.alternativa3d::_farClippingDistance)
+ {
+ return false;
+ }
+ loc9 = this.alternativa3d::_texture.alternativatypes::_width * param1.alternativa3d::_zoom * alternativa3d::_sprite.alternativa3d::_materialScale;
+ loc10 = this.alternativa3d::_texture.alternativatypes::_height * param1.alternativa3d::_zoom * alternativa3d::_sprite.alternativa3d::_materialScale;
+ loc3 = loc6 - loc9 * this.alternativa3d::_originX;
+ loc4 = loc7 - loc10 * this.alternativa3d::_originY;
+ }
+ else
+ {
+ if(loc8 <= 0 || param1.alternativa3d::_nearClipping && loc8 < param1.alternativa3d::_nearClippingDistance || param1.alternativa3d::_farClipping && loc8 > param1.alternativa3d::_farClippingDistance)
+ {
+ return false;
+ }
+ loc13 = param1.alternativa3d::_focalLength / loc8;
+ loc9 = this.alternativa3d::_texture.alternativatypes::_width * loc13 * alternativa3d::_sprite.alternativa3d::_materialScale;
+ loc10 = this.alternativa3d::_texture.alternativatypes::_height * loc13 * alternativa3d::_sprite.alternativa3d::_materialScale;
+ loc3 = loc6 * loc13 - loc9 * this.alternativa3d::_originX;
+ loc4 = loc7 * loc13 - loc10 * this.alternativa3d::_originY;
+ }
+ var loc11:Number = param1.alternativa3d::_view.alternativa3d::_width * 0.5;
+ var loc12:Number = param1.alternativa3d::_view.alternativa3d::_height * 0.5;
+ if(param1.alternativa3d::_viewClipping && (loc3 >= loc11 || loc4 >= loc12 || loc3 + loc9 <= -loc11 || loc4 + loc10 <= -loc12))
+ {
+ return false;
+ }
+ textureMatrix.a = loc9 / this.alternativa3d::_texture.alternativatypes::_width;
+ textureMatrix.d = loc10 / this.alternativa3d::_texture.alternativatypes::_height;
+ textureMatrix.tx = loc3;
+ textureMatrix.ty = loc4;
+ if(param1.alternativa3d::_viewClipping)
+ {
+ if(loc3 < -loc11)
+ {
+ loc9 -= -loc11 - loc3;
+ loc3 = -loc11;
+ }
+ if(loc3 + loc9 > loc11)
+ {
+ loc9 = loc11 - loc3;
+ }
+ if(loc4 < -loc12)
+ {
+ loc10 -= -loc12 - loc4;
+ loc4 = -loc12;
+ }
+ if(loc4 + loc10 > loc12)
+ {
+ loc10 = loc12 - loc4;
+ }
+ }
+ drawRect.x = loc3;
+ drawRect.y = loc4;
+ drawRect.width = loc9;
+ drawRect.height = loc10;
+ return true;
+ }
+
+ override alternativa3d function draw(param1:Camera3D, param2:Skin) : void
+ {
+ param2.alpha = alternativa3d::_alpha;
+ param2.blendMode = alternativa3d::_blendMode;
+ param2.alternativa3d::gfx.beginBitmapFill(this.alternativa3d::_texture.alternativatypes::_bitmapData,textureMatrix,false,this.alternativa3d::_smooth);
+ param2.alternativa3d::gfx.drawRect(drawRect.x,drawRect.y,drawRect.width,drawRect.height);
+ }
+
+ public function get texture() : Texture
+ {
+ return this.alternativa3d::_texture;
+ }
+
+ public function set texture(param1:Texture) : void
+ {
+ if(this.alternativa3d::_texture != param1)
+ {
+ this.alternativa3d::_texture = param1;
+ markToChange();
+ }
+ }
+
+ public function get smooth() : Boolean
+ {
+ return this.alternativa3d::_smooth;
+ }
+
+ public function set smooth(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_smooth != param1)
+ {
+ this.alternativa3d::_smooth = param1;
+ markToChange();
+ }
+ }
+
+ public function get originX() : Number
+ {
+ return this.alternativa3d::_originX;
+ }
+
+ public function set originX(param1:Number) : void
+ {
+ if(this.alternativa3d::_originX != param1)
+ {
+ this.alternativa3d::_originX = param1;
+ markToChange();
+ }
+ }
+
+ public function get originY() : Number
+ {
+ return this.alternativa3d::_originY;
+ }
+
+ public function set originY(param1:Number) : void
+ {
+ if(this.alternativa3d::_originY != param1)
+ {
+ this.alternativa3d::_originY = param1;
+ markToChange();
+ }
+ }
+
+ override public function clone() : Material
+ {
+ return new SpriteTextureMaterial(this.alternativa3d::_texture,alternativa3d::_alpha,this.alternativa3d::_smooth,alternativa3d::_blendMode,this.alternativa3d::_originX,this.alternativa3d::_originY);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/SurfaceMaterial.as b/src/alternativa/engine3d/materials/SurfaceMaterial.as
new file mode 100644
index 0000000..6df3a9d
--- /dev/null
+++ b/src/alternativa/engine3d/materials/SurfaceMaterial.as
@@ -0,0 +1,80 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.PolyPrimitive;
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.engine3d.core.Surface;
+ import alternativa.engine3d.display.Skin;
+
+ use namespace alternativa3d;
+
+ public class SurfaceMaterial extends Material
+ {
+ alternativa3d var _surface:Surface;
+
+ alternativa3d var useUV:Boolean = false;
+
+ public function SurfaceMaterial(param1:Number = 1, param2:String = "normal")
+ {
+ super(param1,param2);
+ }
+
+ public function get surface() : Surface
+ {
+ return this.alternativa3d::_surface;
+ }
+
+ alternativa3d function addToScene(param1:Scene3D) : void
+ {
+ }
+
+ alternativa3d function removeFromScene(param1:Scene3D) : void
+ {
+ }
+
+ alternativa3d function addToMesh(param1:Mesh) : void
+ {
+ }
+
+ alternativa3d function removeFromMesh(param1:Mesh) : void
+ {
+ }
+
+ alternativa3d function addToSurface(param1:Surface) : void
+ {
+ this.alternativa3d::_surface = param1;
+ }
+
+ alternativa3d function removeFromSurface(param1:Surface) : void
+ {
+ this.alternativa3d::_surface = null;
+ }
+
+ override protected function markToChange() : void
+ {
+ if(this.alternativa3d::_surface != null)
+ {
+ this.alternativa3d::_surface.alternativa3d::addMaterialChangedOperationToScene();
+ }
+ }
+
+ alternativa3d function canDraw(param1:PolyPrimitive) : Boolean
+ {
+ return true;
+ }
+
+ alternativa3d function draw(param1:Camera3D, param2:Skin, param3:uint, param4:Array) : void
+ {
+ param2.alpha = alternativa3d::_alpha;
+ param2.blendMode = alternativa3d::_blendMode;
+ }
+
+ override public function clone() : Material
+ {
+ return new SurfaceMaterial(alternativa3d::_alpha,alternativa3d::_blendMode);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/TextureMaterial.as b/src/alternativa/engine3d/materials/TextureMaterial.as
new file mode 100644
index 0000000..6bc3eb8
--- /dev/null
+++ b/src/alternativa/engine3d/materials/TextureMaterial.as
@@ -0,0 +1,526 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.Face;
+ import alternativa.engine3d.core.PolyPrimitive;
+ import alternativa.engine3d.display.Skin;
+ import alternativa.types.*;
+ import flash.display.BitmapData;
+ import flash.display.Graphics;
+ import flash.geom.Matrix;
+
+ use namespace alternativa3d;
+ use namespace alternativatypes;
+
+ public class TextureMaterial extends SurfaceMaterial
+ {
+ private static var stubBitmapData:BitmapData;
+
+ private static var stubMatrix:Matrix;
+
+ private var gfx:Graphics;
+
+ private var textureMatrix:Matrix;
+
+ private var focalLength:Number;
+
+ private var distortion:Number;
+
+ alternativa3d var _texture:Texture;
+
+ alternativa3d var _repeat:Boolean;
+
+ alternativa3d var _smooth:Boolean;
+
+ alternativa3d var _precision:Number;
+
+ alternativa3d var _wireThickness:Number;
+
+ alternativa3d var _wireColor:uint;
+
+ public function TextureMaterial(param1:Texture, param2:Number = 1, param3:Boolean = true, param4:Boolean = false, param5:String = "normal", param6:Number = -1, param7:uint = 0, param8:Number = 10)
+ {
+ this.textureMatrix = new Matrix();
+ super(param2,param5);
+ this.alternativa3d::_texture = param1;
+ this.alternativa3d::_repeat = param3;
+ this.alternativa3d::_smooth = param4;
+ this.alternativa3d::_wireThickness = param6;
+ this.alternativa3d::_wireColor = param7;
+ this.alternativa3d::_precision = param8;
+ alternativa3d::useUV = true;
+ }
+
+ override alternativa3d function canDraw(param1:PolyPrimitive) : Boolean
+ {
+ return this.alternativa3d::_texture != null;
+ }
+
+ override alternativa3d function draw(param1:Camera3D, param2:Skin, param3:uint, param4:Array) : void
+ {
+ var loc5:uint = 0;
+ var loc6:DrawPoint = null;
+ var loc7:Number = NaN;
+ var loc8:Face = null;
+ var loc9:uint = 0;
+ var loc10:uint = 0;
+ var loc11:uint = 0;
+ var loc12:uint = 0;
+ var loc13:* = false;
+ var loc14:DrawPoint = null;
+ var loc15:DrawPoint = null;
+ var loc16:DrawPoint = null;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ var loc23:Number = NaN;
+ var loc24:Number = NaN;
+ var loc25:Number = NaN;
+ var loc26:Number = NaN;
+ var loc27:Number = NaN;
+ param2.alpha = alternativa3d::_alpha;
+ param2.blendMode = alternativa3d::_blendMode;
+ this.gfx = param2.alternativa3d::gfx;
+ if(param2.alternativa3d::primitive.alternativa3d::face.alternativa3d::uvMatrixBase == null)
+ {
+ if(stubBitmapData == null)
+ {
+ stubBitmapData = new BitmapData(2,2,false,0);
+ stubBitmapData.setPixel(0,0,16711935);
+ stubBitmapData.setPixel(1,1,16711935);
+ stubMatrix = new Matrix(10,0,0,10,0,0);
+ }
+ this.gfx.beginBitmapFill(stubBitmapData,stubMatrix);
+ if(param1.alternativa3d::_orthographic)
+ {
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ this.gfx.lineStyle(this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ loc6 = param4[0];
+ this.gfx.moveTo(loc6.x,loc6.y);
+ loc5 = 1;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ this.gfx.lineTo(loc6.x,loc6.y);
+ loc5++;
+ }
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc6 = param4[0];
+ this.gfx.lineTo(loc6.x,loc6.y);
+ }
+ }
+ else
+ {
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ this.gfx.lineStyle(this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ loc6 = param4[0];
+ loc7 = param1.alternativa3d::_focalLength / loc6.z;
+ this.gfx.moveTo(loc6.x * loc7,loc6.y * loc7);
+ loc5 = 1;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ loc7 = param1.alternativa3d::_focalLength / loc6.z;
+ this.gfx.lineTo(loc6.x * loc7,loc6.y * loc7);
+ loc5++;
+ }
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc6 = param4[0];
+ loc7 = param1.alternativa3d::_focalLength / loc6.z;
+ this.gfx.lineTo(loc6.x * loc7,loc6.y * loc7);
+ }
+ }
+ return;
+ }
+ if(param1.alternativa3d::_orthographic)
+ {
+ loc8 = param2.alternativa3d::primitive.alternativa3d::face;
+ if(!param1.alternativa3d::uvMatricesCalculated[loc8])
+ {
+ param1.alternativa3d::calculateUVMatrix(loc8,this.alternativa3d::_texture.alternativatypes::_width,this.alternativa3d::_texture.alternativatypes::_height);
+ }
+ this.gfx.beginBitmapFill(this.alternativa3d::_texture.alternativatypes::_bitmapData,loc8.alternativa3d::orthoTextureMatrix,this.alternativa3d::_repeat,this.alternativa3d::_smooth);
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ this.gfx.lineStyle(this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ loc6 = param4[0];
+ this.gfx.moveTo(loc6.x,loc6.y);
+ loc5 = 1;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ this.gfx.lineTo(loc6.x,loc6.y);
+ loc5++;
+ }
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ loc6 = param4[0];
+ this.gfx.lineTo(loc6.x,loc6.y);
+ }
+ }
+ else
+ {
+ this.focalLength = param1.alternativa3d::_focalLength;
+ this.distortion = param1.alternativa3d::focalDistortion * this.alternativa3d::_precision;
+ loc9 = 0;
+ loc10 = param3 - 1;
+ loc11 = 1;
+ loc12 = loc10 > 0 ? loc10 - 1 : param3 - 1;
+ loc13 = true;
+ loc14 = param4[loc10];
+ loc16 = param4[loc9];
+ if(this.alternativa3d::_precision > 0)
+ {
+ loc17 = loc14.x / loc14.z;
+ loc18 = loc14.y / loc14.z;
+ loc21 = loc16.x / loc16.z;
+ loc22 = loc16.y / loc16.z;
+ loc23 = (loc16.x + loc14.x) / (loc16.z + loc14.z) - 0.5 * (loc21 + loc17);
+ loc24 = (loc16.y + loc14.y) / (loc16.z + loc14.z) - 0.5 * (loc22 + loc18);
+ loc27 = loc23 * loc23 + loc24 * loc24;
+ while(loc9 != loc12)
+ {
+ if(loc13)
+ {
+ loc14 = param4[loc9];
+ loc15 = param4[loc11];
+ loc16 = param4[loc10];
+ loc19 = loc17;
+ loc20 = loc18;
+ loc17 = loc21;
+ loc18 = loc22;
+ loc21 = loc19;
+ loc22 = loc20;
+ loc19 = loc15.x / loc15.z;
+ loc20 = loc15.y / loc15.z;
+ loc23 = (loc15.x + loc16.x) / (loc15.z + loc16.z) - 0.5 * (loc19 + loc21);
+ loc24 = (loc15.y + loc16.y) / (loc15.z + loc16.z) - 0.5 * (loc20 + loc22);
+ loc26 = loc23 * loc23 + loc24 * loc24;
+ loc9 = loc11;
+ loc11 = loc9 < param3 - 1 ? uint(loc9 + 1) : 0;
+ }
+ else
+ {
+ loc14 = param4[loc12];
+ loc15 = param4[loc10];
+ loc16 = param4[loc9];
+ loc17 = loc19;
+ loc18 = loc20;
+ loc19 = loc21;
+ loc20 = loc22;
+ loc21 = loc17;
+ loc22 = loc18;
+ loc17 = loc14.x / loc14.z;
+ loc18 = loc14.y / loc14.z;
+ loc23 = (loc16.x + loc14.x) / (loc16.z + loc14.z) - 0.5 * (loc21 + loc17);
+ loc24 = (loc16.y + loc14.y) / (loc16.z + loc14.z) - 0.5 * (loc22 + loc18);
+ loc27 = loc23 * loc23 + loc24 * loc24;
+ loc10 = loc12;
+ loc12 = loc10 > 0 ? loc10 - 1 : param3 - 1;
+ }
+ if((loc19 - loc17) * (loc22 - loc18) - (loc20 - loc18) * (loc21 - loc17) < -param1.alternativa3d::focalDistortion)
+ {
+ loc23 = (loc14.x + loc15.x) / (loc14.z + loc15.z) - 0.5 * (loc17 + loc19);
+ loc24 = (loc14.y + loc15.y) / (loc14.z + loc15.z) - 0.5 * (loc18 + loc20);
+ loc25 = loc23 * loc23 + loc24 * loc24;
+ this.bisection(loc14.x,loc14.y,loc14.z,loc14.u,loc14.v,loc15.x,loc15.y,loc15.z,loc15.u,loc15.v,loc16.x,loc16.y,loc16.z,loc16.u,loc16.v,loc25,loc26,loc27);
+ }
+ loc13 = !loc13;
+ }
+ }
+ else
+ {
+ loc17 = this.focalLength * loc14.x / loc14.z;
+ loc18 = this.focalLength * loc14.y / loc14.z;
+ loc21 = this.focalLength * loc16.x / loc16.z;
+ loc22 = this.focalLength * loc16.y / loc16.z;
+ while(loc9 != loc12)
+ {
+ if(loc13)
+ {
+ loc14 = param4[loc9];
+ loc15 = param4[loc11];
+ loc16 = param4[loc10];
+ loc19 = loc17;
+ loc20 = loc18;
+ loc17 = loc21;
+ loc18 = loc22;
+ loc21 = loc19;
+ loc22 = loc20;
+ loc19 = this.focalLength * loc15.x / loc15.z;
+ loc20 = this.focalLength * loc15.y / loc15.z;
+ loc9 = loc11;
+ loc11 = loc9 < param3 - 1 ? uint(loc9 + 1) : 0;
+ }
+ else
+ {
+ loc14 = param4[loc12];
+ loc15 = param4[loc10];
+ loc16 = param4[loc9];
+ loc17 = loc19;
+ loc18 = loc20;
+ loc19 = loc21;
+ loc20 = loc22;
+ loc21 = loc17;
+ loc22 = loc18;
+ loc17 = this.focalLength * loc14.x / loc14.z;
+ loc18 = this.focalLength * loc14.y / loc14.z;
+ loc10 = loc12;
+ loc12 = loc10 > 0 ? loc10 - 1 : param3 - 1;
+ }
+ this.drawTriangle(loc17,loc18,loc14.u,loc14.v,loc19,loc20,loc15.u,loc15.v,loc21,loc22,loc16.u,loc16.v);
+ loc13 = !loc13;
+ }
+ }
+ }
+ }
+
+ private function bisection(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number, param8:Number, param9:Number, param10:Number, param11:Number, param12:Number, param13:Number, param14:Number, param15:Number, param16:Number, param17:Number, param18:Number) : void
+ {
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ var loc23:Number = NaN;
+ var loc24:Number = NaN;
+ var loc25:Number = NaN;
+ var loc26:Number = NaN;
+ var loc27:Number = NaN;
+ var loc28:Number = NaN;
+ if(param16 > param17)
+ {
+ if(param16 > param18)
+ {
+ if(param16 > this.distortion)
+ {
+ loc19 = 0.5 * (param1 + param6);
+ loc20 = 0.5 * (param2 + param7);
+ loc21 = 0.5 * (param3 + param8);
+ loc22 = 0.5 * (param4 + param9);
+ loc23 = 0.5 * (param5 + param10);
+ loc24 = (param1 + loc19) / (param3 + loc21) - 0.5 * (param1 / param3 + loc19 / loc21);
+ loc25 = (param2 + loc20) / (param3 + loc21) - 0.5 * (param2 / param3 + loc20 / loc21);
+ loc26 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param6 + loc19) / (param8 + loc21) - 0.5 * (param6 / param8 + loc19 / loc21);
+ loc25 = (param7 + loc20) / (param8 + loc21) - 0.5 * (param7 / param8 + loc20 / loc21);
+ loc27 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param11 + loc19) / (param13 + loc21) - 0.5 * (param11 / param13 + loc19 / loc21);
+ loc25 = (param12 + loc20) / (param13 + loc21) - 0.5 * (param12 / param13 + loc20 / loc21);
+ loc28 = loc24 * loc24 + loc25 * loc25;
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param11,param12,param13,param14,param15,param1,param2,param3,param4,param5,loc28,param18,loc26);
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param6,param7,param8,param9,param10,param11,param12,param13,param14,param15,loc27,param17,loc28);
+ return;
+ }
+ }
+ else if(param18 > this.distortion)
+ {
+ loc19 = 0.5 * (param11 + param1);
+ loc20 = 0.5 * (param12 + param2);
+ loc21 = 0.5 * (param13 + param3);
+ loc22 = 0.5 * (param14 + param4);
+ loc23 = 0.5 * (param15 + param5);
+ loc24 = (param1 + loc19) / (param3 + loc21) - 0.5 * (param1 / param3 + loc19 / loc21);
+ loc25 = (param2 + loc20) / (param3 + loc21) - 0.5 * (param2 / param3 + loc20 / loc21);
+ loc26 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param6 + loc19) / (param8 + loc21) - 0.5 * (param6 / param8 + loc19 / loc21);
+ loc25 = (param7 + loc20) / (param8 + loc21) - 0.5 * (param7 / param8 + loc20 / loc21);
+ loc27 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param11 + loc19) / (param13 + loc21) - 0.5 * (param11 / param13 + loc19 / loc21);
+ loc25 = (param12 + loc20) / (param13 + loc21) - 0.5 * (param12 / param13 + loc20 / loc21);
+ loc28 = loc24 * loc24 + loc25 * loc25;
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param6,param7,param8,param9,param10,param11,param12,param13,param14,param15,loc27,param17,loc28);
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10,loc26,param16,loc27);
+ return;
+ }
+ }
+ else if(param17 > param18)
+ {
+ if(param17 > this.distortion)
+ {
+ loc19 = 0.5 * (param6 + param11);
+ loc20 = 0.5 * (param7 + param12);
+ loc21 = 0.5 * (param8 + param13);
+ loc22 = 0.5 * (param9 + param14);
+ loc23 = 0.5 * (param10 + param15);
+ loc24 = (param1 + loc19) / (param3 + loc21) - 0.5 * (param1 / param3 + loc19 / loc21);
+ loc25 = (param2 + loc20) / (param3 + loc21) - 0.5 * (param2 / param3 + loc20 / loc21);
+ loc26 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param6 + loc19) / (param8 + loc21) - 0.5 * (param6 / param8 + loc19 / loc21);
+ loc25 = (param7 + loc20) / (param8 + loc21) - 0.5 * (param7 / param8 + loc20 / loc21);
+ loc27 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param11 + loc19) / (param13 + loc21) - 0.5 * (param11 / param13 + loc19 / loc21);
+ loc25 = (param12 + loc20) / (param13 + loc21) - 0.5 * (param12 / param13 + loc20 / loc21);
+ loc28 = loc24 * loc24 + loc25 * loc25;
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10,loc26,param16,loc27);
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param11,param12,param13,param14,param15,param1,param2,param3,param4,param5,loc28,param18,loc26);
+ return;
+ }
+ }
+ else if(param18 > this.distortion)
+ {
+ loc19 = 0.5 * (param11 + param1);
+ loc20 = 0.5 * (param12 + param2);
+ loc21 = 0.5 * (param13 + param3);
+ loc22 = 0.5 * (param14 + param4);
+ loc23 = 0.5 * (param15 + param5);
+ loc24 = (param1 + loc19) / (param3 + loc21) - 0.5 * (param1 / param3 + loc19 / loc21);
+ loc25 = (param2 + loc20) / (param3 + loc21) - 0.5 * (param2 / param3 + loc20 / loc21);
+ loc26 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param6 + loc19) / (param8 + loc21) - 0.5 * (param6 / param8 + loc19 / loc21);
+ loc25 = (param7 + loc20) / (param8 + loc21) - 0.5 * (param7 / param8 + loc20 / loc21);
+ loc27 = loc24 * loc24 + loc25 * loc25;
+ loc24 = (param11 + loc19) / (param13 + loc21) - 0.5 * (param11 / param13 + loc19 / loc21);
+ loc25 = (param12 + loc20) / (param13 + loc21) - 0.5 * (param12 / param13 + loc20 / loc21);
+ loc28 = loc24 * loc24 + loc25 * loc25;
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param6,param7,param8,param9,param10,param11,param12,param13,param14,param15,loc27,param17,loc28);
+ this.bisection(loc19,loc20,loc21,loc22,loc23,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10,loc26,param16,loc27);
+ return;
+ }
+ var loc29:Number = this.focalLength / param3;
+ var loc30:Number = this.focalLength / param8;
+ var loc31:Number = this.focalLength / param13;
+ this.drawTriangle(param1 * loc29,param2 * loc29,param4,param5,param6 * loc30,param7 * loc30,param9,param10,param11 * loc31,param12 * loc31,param14,param15);
+ }
+
+ private function drawTriangle(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number, param8:Number, param9:Number, param10:Number, param11:Number, param12:Number) : void
+ {
+ var loc13:Number = param5 - param1;
+ var loc14:Number = param6 - param2;
+ var loc15:Number = param9 - param1;
+ var loc16:Number = param10 - param2;
+ var loc17:Number = param7 - param3;
+ var loc18:Number = param8 - param4;
+ var loc19:Number = param11 - param3;
+ var loc20:Number = param12 - param4;
+ var loc21:Number = loc17 * loc20 - loc18 * loc19;
+ var loc22:Number = this.alternativa3d::_texture.alternativatypes::_width;
+ var loc23:Number = this.alternativa3d::_texture.alternativatypes::_height;
+ this.textureMatrix.a = (loc20 * loc13 - loc18 * loc15) / loc21;
+ this.textureMatrix.b = (loc20 * loc14 - loc18 * loc16) / loc21;
+ this.textureMatrix.c = (loc19 * loc13 - loc17 * loc15) / loc21;
+ this.textureMatrix.d = (loc19 * loc14 - loc17 * loc16) / loc21;
+ this.textureMatrix.tx = (param4 - 1) * this.textureMatrix.c - param3 * this.textureMatrix.a + param1;
+ this.textureMatrix.ty = (param4 - 1) * this.textureMatrix.d - param3 * this.textureMatrix.b + param2;
+ this.textureMatrix.a /= loc22;
+ this.textureMatrix.b /= loc22;
+ this.textureMatrix.c /= loc23;
+ this.textureMatrix.d /= loc23;
+ this.gfx.beginBitmapFill(this.alternativa3d::_texture.alternativatypes::_bitmapData,this.textureMatrix,this.alternativa3d::_repeat,this.alternativa3d::_smooth);
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ this.gfx.lineStyle(this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor);
+ }
+ this.gfx.moveTo(param1,param2);
+ this.gfx.lineTo(param5,param6);
+ this.gfx.lineTo(param9,param10);
+ if(this.alternativa3d::_wireThickness >= 0)
+ {
+ this.gfx.lineTo(param1,param2);
+ }
+ }
+
+ public function get texture() : Texture
+ {
+ return this.alternativa3d::_texture;
+ }
+
+ public function set texture(param1:Texture) : void
+ {
+ if(this.alternativa3d::_texture != param1)
+ {
+ this.alternativa3d::_texture = param1;
+ markToChange();
+ }
+ }
+
+ public function get repeat() : Boolean
+ {
+ return this.alternativa3d::_repeat;
+ }
+
+ public function set repeat(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_repeat != param1)
+ {
+ this.alternativa3d::_repeat = param1;
+ markToChange();
+ }
+ }
+
+ public function get smooth() : Boolean
+ {
+ return this.alternativa3d::_smooth;
+ }
+
+ public function set smooth(param1:Boolean) : void
+ {
+ if(this.alternativa3d::_smooth != param1)
+ {
+ this.alternativa3d::_smooth = param1;
+ if(alternativa3d::_surface != null)
+ {
+ alternativa3d::_surface.alternativa3d::addMaterialChangedOperationToScene();
+ }
+ }
+ }
+
+ public function get wireThickness() : Number
+ {
+ return this.alternativa3d::_wireThickness;
+ }
+
+ public function set wireThickness(param1:Number) : void
+ {
+ if(this.alternativa3d::_wireThickness != param1)
+ {
+ this.alternativa3d::_wireThickness = param1;
+ markToChange();
+ }
+ }
+
+ public function get wireColor() : uint
+ {
+ return this.alternativa3d::_wireColor;
+ }
+
+ public function set wireColor(param1:uint) : void
+ {
+ if(this.alternativa3d::_wireColor != param1)
+ {
+ this.alternativa3d::_wireColor = param1;
+ markToChange();
+ }
+ }
+
+ public function get precision() : Number
+ {
+ return this.alternativa3d::_precision;
+ }
+
+ public function set precision(param1:Number) : void
+ {
+ if(this.alternativa3d::_precision != param1)
+ {
+ this.alternativa3d::_precision = param1;
+ markToChange();
+ }
+ }
+
+ override public function clone() : Material
+ {
+ return new TextureMaterial(this.alternativa3d::_texture,alternativa3d::_alpha,this.alternativa3d::_repeat,this.alternativa3d::_smooth,alternativa3d::_blendMode,this.alternativa3d::_wireThickness,this.alternativa3d::_wireColor,this.alternativa3d::_precision);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/TextureMaterialPrecision.as b/src/alternativa/engine3d/materials/TextureMaterialPrecision.as
new file mode 100644
index 0000000..cf94ce3
--- /dev/null
+++ b/src/alternativa/engine3d/materials/TextureMaterialPrecision.as
@@ -0,0 +1,25 @@
+package alternativa.engine3d.materials
+{
+ public class TextureMaterialPrecision
+ {
+ public static const NONE:Number = -1;
+
+ public static const VERY_LOW:Number = 50;
+
+ public static const LOW:Number = 25;
+
+ public static const MEDIUM:Number = 10;
+
+ public static const HIGH:Number = 6;
+
+ public static const VERY_HIGH:Number = 3;
+
+ public static const BEST:Number = 1;
+
+ public function TextureMaterialPrecision()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/materials/WireMaterial.as b/src/alternativa/engine3d/materials/WireMaterial.as
new file mode 100644
index 0000000..1025be4
--- /dev/null
+++ b/src/alternativa/engine3d/materials/WireMaterial.as
@@ -0,0 +1,101 @@
+package alternativa.engine3d.materials
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.Camera3D;
+ import alternativa.engine3d.core.PolyPrimitive;
+ import alternativa.engine3d.display.Skin;
+ import flash.display.Graphics;
+
+ use namespace alternativa3d;
+
+ public class WireMaterial extends SurfaceMaterial
+ {
+ alternativa3d var _color:uint;
+
+ alternativa3d var _thickness:Number;
+
+ public function WireMaterial(param1:Number = 0, param2:uint = 0, param3:Number = 1, param4:String = "normal")
+ {
+ super(param3,param4);
+ this.alternativa3d::_color = param2;
+ this.alternativa3d::_thickness = param1;
+ }
+
+ override alternativa3d function canDraw(param1:PolyPrimitive) : Boolean
+ {
+ return this.alternativa3d::_thickness >= 0;
+ }
+
+ override alternativa3d function draw(param1:Camera3D, param2:Skin, param3:uint, param4:Array) : void
+ {
+ var loc5:uint = 0;
+ var loc6:DrawPoint = null;
+ var loc8:Number = NaN;
+ param2.alpha = alternativa3d::_alpha;
+ param2.blendMode = alternativa3d::_blendMode;
+ var loc7:Graphics = param2.alternativa3d::gfx;
+ if(param1.alternativa3d::_orthographic)
+ {
+ loc7.lineStyle(this.alternativa3d::_thickness,this.alternativa3d::_color);
+ loc6 = param4[param3 - 1];
+ loc7.moveTo(loc6.x,loc6.y);
+ loc5 = 0;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ loc7.lineTo(loc6.x,loc6.y);
+ loc5++;
+ }
+ }
+ else
+ {
+ loc7.lineStyle(this.alternativa3d::_thickness,this.alternativa3d::_color);
+ loc6 = param4[param3 - 1];
+ loc8 = param1.alternativa3d::_focalLength / loc6.z;
+ loc7.moveTo(loc6.x * loc8,loc6.y * loc8);
+ loc5 = 0;
+ while(loc5 < param3)
+ {
+ loc6 = param4[loc5];
+ loc8 = param1.alternativa3d::_focalLength / loc6.z;
+ loc7.lineTo(loc6.x * loc8,loc6.y * loc8);
+ loc5++;
+ }
+ }
+ }
+
+ public function get color() : uint
+ {
+ return this.alternativa3d::_color;
+ }
+
+ public function set color(param1:uint) : void
+ {
+ if(this.alternativa3d::_color != param1)
+ {
+ this.alternativa3d::_color = param1;
+ markToChange();
+ }
+ }
+
+ public function get thickness() : Number
+ {
+ return this.alternativa3d::_thickness;
+ }
+
+ public function set thickness(param1:Number) : void
+ {
+ if(this.alternativa3d::_thickness != param1)
+ {
+ this.alternativa3d::_thickness = param1;
+ markToChange();
+ }
+ }
+
+ override public function clone() : Material
+ {
+ return new WireMaterial(this.alternativa3d::_thickness,this.alternativa3d::_color,alternativa3d::_alpha,alternativa3d::_blendMode);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/physics/Collision.as b/src/alternativa/engine3d/physics/Collision.as
new file mode 100644
index 0000000..2d80849
--- /dev/null
+++ b/src/alternativa/engine3d/physics/Collision.as
@@ -0,0 +1,22 @@
+package alternativa.engine3d.physics
+{
+ import alternativa.engine3d.core.Face;
+ import alternativa.types.Point3D;
+
+ public class Collision
+ {
+ public var face:Face;
+
+ public var normal:Point3D;
+
+ public var offset:Number;
+
+ public var point:Point3D;
+
+ public function Collision()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/physics/CollisionPlane.as b/src/alternativa/engine3d/physics/CollisionPlane.as
new file mode 100644
index 0000000..854cf73
--- /dev/null
+++ b/src/alternativa/engine3d/physics/CollisionPlane.as
@@ -0,0 +1,46 @@
+package alternativa.engine3d.physics
+{
+ import alternativa.engine3d.alternativa3d;
+ import alternativa.engine3d.core.BSPNode;
+
+ use namespace alternativa3d;
+
+ public class CollisionPlane
+ {
+ private static var collector:Array = new Array();
+
+ public var node:BSPNode;
+
+ public var infront:Boolean;
+
+ public var sourceOffset:Number;
+
+ public var destinationOffset:Number;
+
+ public function CollisionPlane()
+ {
+ super();
+ }
+
+ alternativa3d static function createCollisionPlane(param1:BSPNode, param2:Boolean, param3:Number, param4:Number) : CollisionPlane
+ {
+ var loc5:CollisionPlane = collector.pop();
+ if(loc5 == null)
+ {
+ loc5 = new CollisionPlane();
+ }
+ loc5.node = param1;
+ loc5.infront = param2;
+ loc5.sourceOffset = param3;
+ loc5.destinationOffset = param4;
+ return loc5;
+ }
+
+ alternativa3d static function destroyCollisionPlane(param1:CollisionPlane) : void
+ {
+ param1.node = null;
+ collector.push(param1);
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/physics/CollisionSetMode.as b/src/alternativa/engine3d/physics/CollisionSetMode.as
new file mode 100644
index 0000000..0b82701
--- /dev/null
+++ b/src/alternativa/engine3d/physics/CollisionSetMode.as
@@ -0,0 +1,15 @@
+package alternativa.engine3d.physics
+{
+ public class CollisionSetMode
+ {
+ public static const EXCLUDE:int = 1;
+
+ public static const INCLUDE:int = 2;
+
+ public function CollisionSetMode()
+ {
+ super();
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/physics/EllipsoidCollider.as b/src/alternativa/engine3d/physics/EllipsoidCollider.as
new file mode 100644
index 0000000..d4c93f1
--- /dev/null
+++ b/src/alternativa/engine3d/physics/EllipsoidCollider.as
@@ -0,0 +1,948 @@
+package alternativa.engine3d.physics
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.BSPNode;
+ import alternativa.engine3d.core.PolyPrimitive;
+ import alternativa.engine3d.core.Scene3D;
+ import alternativa.types.Point3D;
+ import alternativa.types.Set;
+ import alternativa.utils.ObjectUtils;
+
+ use namespace alternativa3d;
+
+ public class EllipsoidCollider
+ {
+ private static const MAX_COLLISIONS:uint = 50;
+
+ private var _radius:Number = 100;
+
+ private var _radius2:Number;
+
+ private var _radiusX:Number;
+
+ private var _radiusY:Number;
+
+ private var _radiusZ:Number;
+
+ private var _radiusX2:Number;
+
+ private var _radiusY2:Number;
+
+ private var _radiusZ2:Number;
+
+ private var _scaleX:Number = 1;
+
+ private var _scaleY:Number = 1;
+
+ private var _scaleZ:Number = 1;
+
+ private var _scaleX2:Number = 1;
+
+ private var _scaleY2:Number = 1;
+
+ private var _scaleZ2:Number = 1;
+
+ private var collisionSource:Point3D;
+
+ private var currentDisplacement:Point3D;
+
+ private var collisionDestination:Point3D;
+
+ private var collisionPlanes:Array;
+
+ private var collisionPrimitive:PolyPrimitive;
+
+ private var collisionPrimitiveNearest:PolyPrimitive;
+
+ private var collisionPlanePoint:Point3D;
+
+ private var collisionPrimitiveNearestLengthSqr:Number;
+
+ private var collisionPrimitivePoint:Point3D;
+
+ private var collisionNormal:Point3D;
+
+ private var collisionPoint:Point3D;
+
+ private var collisionOffset:Number;
+
+ private var currentCoords:Point3D;
+
+ private var collision:Collision;
+
+ private var collisionRadius:Number;
+
+ private var radiusVector:Point3D;
+
+ private var p1:Point3D;
+
+ private var p2:Point3D;
+
+ private var localCollisionPlanePoint:Point3D;
+
+ private var useSimpleAlgorithm:Boolean = true;
+
+ public var scene:Scene3D;
+
+ public var offsetThreshold:Number = 0.0001;
+
+ public var collisionSet:Set;
+
+ private var _collisionSetMode:int = 1;
+
+ public function EllipsoidCollider(param1:Scene3D = null, param2:Number = 100, param3:Number = 100, param4:Number = 100)
+ {
+ this._radius2 = this._radius * this._radius;
+ this._radiusX = this._radius;
+ this._radiusY = this._radius;
+ this._radiusZ = this._radius;
+ this._radiusX2 = this._radiusX * this._radiusX;
+ this._radiusY2 = this._radiusY * this._radiusY;
+ this._radiusZ2 = this._radiusZ * this._radiusZ;
+ this.currentDisplacement = new Point3D();
+ this.collisionDestination = new Point3D();
+ this.collisionPlanes = new Array();
+ this.collisionPlanePoint = new Point3D();
+ this.collisionPrimitivePoint = new Point3D();
+ this.collisionNormal = new Point3D();
+ this.collisionPoint = new Point3D();
+ this.currentCoords = new Point3D();
+ this.collision = new Collision();
+ this.radiusVector = new Point3D();
+ this.p1 = new Point3D();
+ this.p2 = new Point3D();
+ this.localCollisionPlanePoint = new Point3D();
+ super();
+ this.scene = param1;
+ this.radiusX = param2;
+ this.radiusY = param3;
+ this.radiusZ = param4;
+ }
+
+ public function get collisionSetMode() : int
+ {
+ return this._collisionSetMode;
+ }
+
+ public function set collisionSetMode(param1:int) : void
+ {
+ if(param1 != CollisionSetMode.EXCLUDE && param1 != CollisionSetMode.INCLUDE)
+ {
+ throw ArgumentError(ObjectUtils.getClassName(this) + ".collisionSetMode invalid value");
+ }
+ this._collisionSetMode = param1;
+ }
+
+ public function get radiusX() : Number
+ {
+ return this._radiusX;
+ }
+
+ public function set radiusX(param1:Number) : void
+ {
+ this._radiusX = param1 >= 0 ? param1 : -param1;
+ this._radiusX2 = this._radiusX * this._radiusX;
+ this.calculateScales();
+ }
+
+ public function get radiusY() : Number
+ {
+ return this._radiusY;
+ }
+
+ public function set radiusY(param1:Number) : void
+ {
+ this._radiusY = param1 >= 0 ? param1 : -param1;
+ this._radiusY2 = this._radiusY * this._radiusY;
+ this.calculateScales();
+ }
+
+ public function get radiusZ() : Number
+ {
+ return this._radiusZ;
+ }
+
+ public function set radiusZ(param1:Number) : void
+ {
+ this._radiusZ = param1 >= 0 ? param1 : -param1;
+ this._radiusZ2 = this._radiusZ * this._radiusZ;
+ this.calculateScales();
+ }
+
+ private function calculateScales() : void
+ {
+ this._radius = this._radiusX;
+ if(this._radiusY > this._radius)
+ {
+ this._radius = this._radiusY;
+ }
+ if(this._radiusZ > this._radius)
+ {
+ this._radius = this._radiusZ;
+ }
+ this._radius2 = this._radius * this._radius;
+ this._scaleX = this._radiusX / this._radius;
+ this._scaleY = this._radiusY / this._radius;
+ this._scaleZ = this._radiusZ / this._radius;
+ this._scaleX2 = this._scaleX * this._scaleX;
+ this._scaleY2 = this._scaleY * this._scaleY;
+ this._scaleZ2 = this._scaleZ * this._scaleZ;
+ this.useSimpleAlgorithm = this._radiusX == this._radiusY && this._radiusX == this._radiusZ;
+ }
+
+ public function calculateDestination(param1:Point3D, param2:Point3D, param3:Point3D) : void
+ {
+ if(param2.x < this.offsetThreshold && param2.x > -this.offsetThreshold && param2.y < this.offsetThreshold && param2.y > -this.offsetThreshold && param2.z < this.offsetThreshold && param2.z > -this.offsetThreshold)
+ {
+ param3.x = param1.x;
+ param3.y = param1.y;
+ param3.z = param1.z;
+ return;
+ }
+ this.currentCoords.x = param1.x;
+ this.currentCoords.y = param1.y;
+ this.currentCoords.z = param1.z;
+ this.currentDisplacement.x = param2.x;
+ this.currentDisplacement.y = param2.y;
+ this.currentDisplacement.z = param2.z;
+ param3.x = param1.x + this.currentDisplacement.x;
+ param3.y = param1.y + this.currentDisplacement.y;
+ param3.z = param1.z + this.currentDisplacement.z;
+ if(this.useSimpleAlgorithm)
+ {
+ this.calculateDestinationS(param1,param3);
+ }
+ else
+ {
+ this.calculateDestinationE(param1,param3);
+ }
+ }
+
+ private function calculateDestinationS(param1:Point3D, param2:Point3D) : void
+ {
+ var loc4:Boolean = false;
+ var loc5:Number = NaN;
+ var loc3:uint = 0;
+ do
+ {
+ loc4 = this.getCollision(this.currentCoords,this.currentDisplacement,this.collision);
+ if(loc4)
+ {
+ loc5 = this._radius + this.offsetThreshold + this.collision.offset - param2.x * this.collision.normal.x - param2.y * this.collision.normal.y - param2.z * this.collision.normal.z;
+ param2.x += this.collision.normal.x * loc5;
+ param2.y += this.collision.normal.y * loc5;
+ param2.z += this.collision.normal.z * loc5;
+ this.currentCoords.x = this.collision.point.x + this.collision.normal.x * (this._radius + this.offsetThreshold);
+ this.currentCoords.y = this.collision.point.y + this.collision.normal.y * (this._radius + this.offsetThreshold);
+ this.currentCoords.z = this.collision.point.z + this.collision.normal.z * (this._radius + this.offsetThreshold);
+ this.currentDisplacement.x = param2.x - this.currentCoords.x;
+ this.currentDisplacement.y = param2.y - this.currentCoords.y;
+ this.currentDisplacement.z = param2.z - this.currentCoords.z;
+ if(this.currentDisplacement.x < this.offsetThreshold && this.currentDisplacement.x > -this.offsetThreshold && this.currentDisplacement.y < this.offsetThreshold && this.currentDisplacement.y > -this.offsetThreshold && this.currentDisplacement.z < this.offsetThreshold && this.currentDisplacement.z > -this.offsetThreshold)
+ {
+ break;
+ }
+ }
+ }
+ while(loc4 && ++loc3 < MAX_COLLISIONS);
+
+ if(loc3 == MAX_COLLISIONS)
+ {
+ param2.x = param1.x;
+ param2.y = param1.y;
+ param2.z = param1.z;
+ }
+ }
+
+ private function calculateDestinationE(param1:Point3D, param2:Point3D) : void
+ {
+ var loc4:Boolean = false;
+ var loc5:Number = NaN;
+ var loc3:uint = 0;
+ do
+ {
+ loc4 = this.getCollision(this.currentCoords,this.currentDisplacement,this.collision);
+ if(loc4)
+ {
+ loc5 = this.collisionRadius + this.offsetThreshold + this.collision.offset - param2.x * this.collision.normal.x - param2.y * this.collision.normal.y - param2.z * this.collision.normal.z;
+ param2.x += this.collision.normal.x * loc5;
+ param2.y += this.collision.normal.y * loc5;
+ param2.z += this.collision.normal.z * loc5;
+ this.collisionRadius = (this.collisionRadius + this.offsetThreshold) / this.collisionRadius;
+ this.currentCoords.x = this.collision.point.x - this.collisionRadius * this.radiusVector.x;
+ this.currentCoords.y = this.collision.point.y - this.collisionRadius * this.radiusVector.y;
+ this.currentCoords.z = this.collision.point.z - this.collisionRadius * this.radiusVector.z;
+ this.currentDisplacement.x = param2.x - this.currentCoords.x;
+ this.currentDisplacement.y = param2.y - this.currentCoords.y;
+ this.currentDisplacement.z = param2.z - this.currentCoords.z;
+ if(this.currentDisplacement.x < this.offsetThreshold && this.currentDisplacement.x > -this.offsetThreshold && this.currentDisplacement.y < this.offsetThreshold && this.currentDisplacement.y > -this.offsetThreshold && this.currentDisplacement.z < this.offsetThreshold && this.currentDisplacement.z > -this.offsetThreshold)
+ {
+ param2.x = this.currentCoords.x;
+ param2.y = this.currentCoords.y;
+ param2.z = this.currentCoords.z;
+ break;
+ }
+ }
+ }
+ while(loc4 && ++loc3 < MAX_COLLISIONS);
+
+ if(loc3 == MAX_COLLISIONS)
+ {
+ param2.x = param1.x;
+ param2.y = param1.y;
+ param2.z = param1.z;
+ }
+ }
+
+ public function getCollision(param1:Point3D, param2:Point3D, param3:Collision) : Boolean
+ {
+ var loc4:CollisionPlane = null;
+ if(this.scene == null)
+ {
+ return false;
+ }
+ this.collisionSource = param1;
+ this.currentDisplacement.x = param2.x;
+ this.currentDisplacement.y = param2.y;
+ this.currentDisplacement.z = param2.z;
+ this.collisionDestination.x = this.collisionSource.x + this.currentDisplacement.x;
+ this.collisionDestination.y = this.collisionSource.y + this.currentDisplacement.y;
+ this.collisionDestination.z = this.collisionSource.z + this.currentDisplacement.z;
+ this.collectPotentialCollisionPlanes(this.scene.alternativa3d::bsp);
+ this.collisionPlanes.sortOn("sourceOffset",Array.NUMERIC | Array.DESCENDING);
+ if(this.useSimpleAlgorithm)
+ {
+ while(true)
+ {
+ loc4 = this.collisionPlanes.pop();
+ if(loc4 == null)
+ {
+ break;
+ }
+ if(this.collisionPrimitive == null)
+ {
+ this.calculateCollisionWithPlaneS(loc4);
+ }
+ CollisionPlane.alternativa3d::destroyCollisionPlane(loc4);
+ }
+ }
+ else
+ {
+ while(true)
+ {
+ loc4 = this.collisionPlanes.pop();
+ if(loc4 == null)
+ {
+ break;
+ }
+ if(this.collisionPrimitive == null)
+ {
+ this.calculateCollisionWithPlaneE(loc4);
+ }
+ CollisionPlane.alternativa3d::destroyCollisionPlane(loc4);
+ }
+ }
+ var loc5:* = this.collisionPrimitive != null;
+ if(loc5)
+ {
+ param3.face = this.collisionPrimitive.alternativa3d::face;
+ param3.normal = this.collisionNormal;
+ param3.offset = this.collisionOffset;
+ param3.point = this.collisionPoint;
+ }
+ this.collisionPrimitive = null;
+ this.collisionSource = null;
+ return loc5;
+ }
+
+ private function collectPotentialCollisionPlanes(param1:BSPNode) : void
+ {
+ var loc4:CollisionPlane = null;
+ if(param1 == null)
+ {
+ return;
+ }
+ var loc2:Number = this.collisionSource.x * param1.alternativa3d::normal.x + this.collisionSource.y * param1.alternativa3d::normal.y + this.collisionSource.z * param1.alternativa3d::normal.z - param1.alternativa3d::offset;
+ var loc3:Number = this.collisionDestination.x * param1.alternativa3d::normal.x + this.collisionDestination.y * param1.alternativa3d::normal.y + this.collisionDestination.z * param1.alternativa3d::normal.z - param1.alternativa3d::offset;
+ if(loc2 >= 0)
+ {
+ this.collectPotentialCollisionPlanes(param1.alternativa3d::front);
+ if(loc3 < this._radius && !param1.alternativa3d::isSprite)
+ {
+ if(param1.alternativa3d::splitter == null)
+ {
+ loc4 = CollisionPlane.alternativa3d::createCollisionPlane(param1,true,loc2,loc3);
+ this.collisionPlanes.push(loc4);
+ }
+ this.collectPotentialCollisionPlanes(param1.alternativa3d::back);
+ }
+ }
+ else
+ {
+ this.collectPotentialCollisionPlanes(param1.alternativa3d::back);
+ if(loc3 > -this._radius)
+ {
+ if(param1.alternativa3d::backPrimitives != null)
+ {
+ loc4 = CollisionPlane.alternativa3d::createCollisionPlane(param1,false,-loc2,-loc3);
+ this.collisionPlanes.push(loc4);
+ }
+ this.collectPotentialCollisionPlanes(param1.alternativa3d::front);
+ }
+ }
+ }
+
+ private function calculateCollisionWithPlaneS(param1:CollisionPlane) : void
+ {
+ var loc3:* = undefined;
+ var loc4:Number = NaN;
+ var loc5:Number = NaN;
+ var loc6:Number = NaN;
+ var loc7:Number = NaN;
+ var loc8:Number = NaN;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ this.collisionPlanePoint.copy(this.collisionSource);
+ var loc2:Point3D = param1.node.alternativa3d::normal;
+ if(param1.sourceOffset <= this._radius)
+ {
+ if(param1.infront)
+ {
+ this.collisionPlanePoint.x -= loc2.x * param1.sourceOffset;
+ this.collisionPlanePoint.y -= loc2.y * param1.sourceOffset;
+ this.collisionPlanePoint.z -= loc2.z * param1.sourceOffset;
+ }
+ else
+ {
+ this.collisionPlanePoint.x += loc2.x * param1.sourceOffset;
+ this.collisionPlanePoint.y += loc2.y * param1.sourceOffset;
+ this.collisionPlanePoint.z += loc2.z * param1.sourceOffset;
+ }
+ }
+ else
+ {
+ loc4 = (param1.sourceOffset - this._radius) / (param1.sourceOffset - param1.destinationOffset);
+ this.collisionPlanePoint.x = this.collisionSource.x + this.currentDisplacement.x * loc4;
+ this.collisionPlanePoint.y = this.collisionSource.y + this.currentDisplacement.y * loc4;
+ this.collisionPlanePoint.z = this.collisionSource.z + this.currentDisplacement.z * loc4;
+ if(param1.infront)
+ {
+ this.collisionPlanePoint.x -= loc2.x * this._radius;
+ this.collisionPlanePoint.y -= loc2.y * this._radius;
+ this.collisionPlanePoint.z -= loc2.z * this._radius;
+ }
+ else
+ {
+ this.collisionPlanePoint.x += loc2.x * this._radius;
+ this.collisionPlanePoint.y += loc2.y * this._radius;
+ this.collisionPlanePoint.z += loc2.z * this._radius;
+ }
+ }
+ this.collisionPrimitiveNearestLengthSqr = Number.MAX_VALUE;
+ this.collisionPrimitiveNearest = null;
+ if(param1.infront)
+ {
+ loc3 = param1.node.alternativa3d::primitive;
+ if(loc3 != null)
+ {
+ if(this._collisionSetMode == CollisionSetMode.EXCLUDE && (this.collisionSet == null || !(Boolean(this.collisionSet[loc3.face._mesh]) || Boolean(this.collisionSet[loc3.face._surface]))) || this._collisionSetMode == CollisionSetMode.INCLUDE && this.collisionSet != null && (this.collisionSet[loc3.face._mesh] || this.collisionSet[loc3.face._surface]))
+ {
+ this.calculateCollisionWithPrimitiveS(param1.node.alternativa3d::primitive);
+ }
+ }
+ else
+ {
+ for(loc3 in param1.node.alternativa3d::frontPrimitives)
+ {
+ if(this._collisionSetMode == CollisionSetMode.EXCLUDE && (this.collisionSet == null || !(Boolean(this.collisionSet[loc3.face._mesh]) || Boolean(this.collisionSet[loc3.face._surface]))) || this._collisionSetMode == CollisionSetMode.INCLUDE && this.collisionSet != null && (this.collisionSet[loc3.face._mesh] || this.collisionSet[loc3.face._surface]))
+ {
+ this.calculateCollisionWithPrimitiveS(loc3);
+ if(this.collisionPrimitive != null)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for(loc3 in param1.node.alternativa3d::backPrimitives)
+ {
+ if(this._collisionSetMode == CollisionSetMode.EXCLUDE && (this.collisionSet == null || !(Boolean(this.collisionSet[loc3.face._mesh]) || Boolean(this.collisionSet[loc3.face._surface]))) || this._collisionSetMode == CollisionSetMode.INCLUDE && this.collisionSet != null && (this.collisionSet[loc3.face._mesh] || this.collisionSet[loc3.face._surface]))
+ {
+ this.calculateCollisionWithPrimitiveS(loc3);
+ if(this.collisionPrimitive != null)
+ {
+ break;
+ }
+ }
+ }
+ }
+ if(this.collisionPrimitive != null)
+ {
+ if(param1.infront)
+ {
+ this.collisionNormal.x = loc2.x;
+ this.collisionNormal.y = loc2.y;
+ this.collisionNormal.z = loc2.z;
+ this.collisionOffset = param1.node.alternativa3d::offset;
+ }
+ else
+ {
+ this.collisionNormal.x = -loc2.x;
+ this.collisionNormal.y = -loc2.y;
+ this.collisionNormal.z = -loc2.z;
+ this.collisionOffset = -param1.node.alternativa3d::offset;
+ }
+ this.collisionPoint.x = this.collisionPlanePoint.x;
+ this.collisionPoint.y = this.collisionPlanePoint.y;
+ this.collisionPoint.z = this.collisionPlanePoint.z;
+ }
+ else
+ {
+ loc5 = this.collisionSource.x - this.collisionPrimitivePoint.x;
+ loc6 = this.collisionSource.y - this.collisionPrimitivePoint.y;
+ loc7 = this.collisionSource.z - this.collisionPrimitivePoint.z;
+ if(loc5 * this.currentDisplacement.x + loc6 * this.currentDisplacement.y + loc7 * this.currentDisplacement.z <= 0)
+ {
+ loc8 = Math.sqrt(this.currentDisplacement.x * this.currentDisplacement.x + this.currentDisplacement.y * this.currentDisplacement.y + this.currentDisplacement.z * this.currentDisplacement.z);
+ loc9 = -this.currentDisplacement.x / loc8;
+ loc10 = -this.currentDisplacement.y / loc8;
+ loc11 = -this.currentDisplacement.z / loc8;
+ loc12 = loc5 * loc5 + loc6 * loc6 + loc7 * loc7;
+ loc13 = loc5 * loc9 + loc6 * loc10 + loc7 * loc11;
+ loc14 = this._radius2 - loc12 + loc13 * loc13;
+ if(loc14 > 0)
+ {
+ loc15 = loc13 - Math.sqrt(loc14);
+ if(loc15 < loc8)
+ {
+ this.collisionPoint.x = this.collisionPrimitivePoint.x;
+ this.collisionPoint.y = this.collisionPrimitivePoint.y;
+ this.collisionPoint.z = this.collisionPrimitivePoint.z;
+ loc16 = Math.sqrt(loc12);
+ this.collisionNormal.x = loc5 / loc16;
+ this.collisionNormal.y = loc6 / loc16;
+ this.collisionNormal.z = loc7 / loc16;
+ this.collisionOffset = this.collisionPoint.x * this.collisionNormal.x + this.collisionPoint.y * this.collisionNormal.y + this.collisionPoint.z * this.collisionNormal.z;
+ this.collisionPrimitive = this.collisionPrimitiveNearest;
+ }
+ }
+ }
+ }
+ }
+
+ private function calculateCollisionWithPrimitiveS(param1:PolyPrimitive) : void
+ {
+ var loc7:Point3D = null;
+ var loc8:Point3D = null;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ var loc23:Number = NaN;
+ var loc24:Number = NaN;
+ var loc25:Number = NaN;
+ var loc2:uint = param1.alternativa3d::num;
+ var loc3:Array = param1.alternativa3d::points;
+ var loc4:Point3D = param1.alternativa3d::face.alternativa3d::globalNormal;
+ var loc5:Boolean = true;
+ var loc6:uint = 0;
+ while(loc6 < loc2)
+ {
+ loc7 = loc3[loc6];
+ loc8 = loc3[loc6 < loc2 - 1 ? loc6 + 1 : 0];
+ loc9 = loc8.x - loc7.x;
+ loc10 = loc8.y - loc7.y;
+ loc11 = loc8.z - loc7.z;
+ loc12 = this.collisionPlanePoint.x - loc7.x;
+ loc13 = this.collisionPlanePoint.y - loc7.y;
+ loc14 = this.collisionPlanePoint.z - loc7.z;
+ loc15 = loc13 * loc11 - loc14 * loc10;
+ loc16 = loc14 * loc9 - loc12 * loc11;
+ loc17 = loc12 * loc10 - loc13 * loc9;
+ if(loc15 * loc4.x + loc16 * loc4.y + loc17 * loc4.z > 0)
+ {
+ loc5 = false;
+ loc18 = loc9 * loc9 + loc10 * loc10 + loc11 * loc11;
+ loc19 = (loc15 * loc15 + loc16 * loc16 + loc17 * loc17) / loc18;
+ if(loc19 < this.collisionPrimitiveNearestLengthSqr)
+ {
+ loc20 = Math.sqrt(loc18);
+ loc21 = loc9 / loc20;
+ loc22 = loc10 / loc20;
+ loc23 = loc11 / loc20;
+ loc24 = loc21 * loc12 + loc22 * loc13 + loc23 * loc14;
+ if(loc24 < 0)
+ {
+ loc25 = loc12 * loc12 + loc13 * loc13 + loc14 * loc14;
+ if(loc25 < this.collisionPrimitiveNearestLengthSqr)
+ {
+ this.collisionPrimitiveNearestLengthSqr = loc25;
+ this.collisionPrimitivePoint.x = loc7.x;
+ this.collisionPrimitivePoint.y = loc7.y;
+ this.collisionPrimitivePoint.z = loc7.z;
+ this.collisionPrimitiveNearest = param1;
+ }
+ }
+ else if(loc24 > loc20)
+ {
+ loc12 = this.collisionPlanePoint.x - loc8.x;
+ loc13 = this.collisionPlanePoint.y - loc8.y;
+ loc14 = this.collisionPlanePoint.z - loc8.z;
+ loc25 = loc12 * loc12 + loc13 * loc13 + loc14 * loc14;
+ if(loc25 < this.collisionPrimitiveNearestLengthSqr)
+ {
+ this.collisionPrimitiveNearestLengthSqr = loc25;
+ this.collisionPrimitivePoint.x = loc8.x;
+ this.collisionPrimitivePoint.y = loc8.y;
+ this.collisionPrimitivePoint.z = loc8.z;
+ this.collisionPrimitiveNearest = param1;
+ }
+ }
+ else
+ {
+ this.collisionPrimitiveNearestLengthSqr = loc19;
+ this.collisionPrimitivePoint.x = loc7.x + loc21 * loc24;
+ this.collisionPrimitivePoint.y = loc7.y + loc22 * loc24;
+ this.collisionPrimitivePoint.z = loc7.z + loc23 * loc24;
+ this.collisionPrimitiveNearest = param1;
+ }
+ }
+ }
+ loc6++;
+ }
+ if(loc5)
+ {
+ this.collisionPrimitive = param1;
+ }
+ }
+
+ private function calculateCollisionWithPlaneE(param1:CollisionPlane) : void
+ {
+ var loc14:* = undefined;
+ var loc15:Number = NaN;
+ var loc16:Boolean = false;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ var loc23:Number = NaN;
+ var loc24:Number = NaN;
+ var loc2:Number = param1.node.alternativa3d::normal.x;
+ var loc3:Number = param1.node.alternativa3d::normal.y;
+ var loc4:Number = param1.node.alternativa3d::normal.z;
+ var loc5:Number = this.currentDisplacement.x * loc2 + this.currentDisplacement.y * loc3 + this.currentDisplacement.z * loc4;
+ if(param1.infront)
+ {
+ loc5 = -loc5;
+ }
+ if(loc5 < 0)
+ {
+ return;
+ }
+ var loc6:Number = this._radius / Math.sqrt(loc2 * loc2 * this._scaleX2 + loc3 * loc3 * this._scaleY2 + loc4 * loc4 * this._scaleZ2);
+ var loc7:Number = loc6 * loc2 * this._scaleX2;
+ var loc8:Number = loc6 * loc3 * this._scaleY2;
+ var loc9:Number = loc6 * loc4 * this._scaleZ2;
+ var loc10:Number = this.collisionSource.x + loc7;
+ var loc11:Number = this.collisionSource.y + loc8;
+ var loc12:Number = this.collisionSource.z + loc9;
+ var loc13:Number = loc10 * loc2 + loc11 * loc3 + loc12 * loc4 - param1.node.alternativa3d::offset;
+ if(!param1.infront)
+ {
+ loc13 = -loc13;
+ }
+ if(loc13 > param1.sourceOffset)
+ {
+ loc10 = this.collisionSource.x - loc7;
+ loc11 = this.collisionSource.y - loc8;
+ loc12 = this.collisionSource.z - loc9;
+ loc13 = loc10 * loc2 + loc11 * loc3 + loc12 * loc4 - param1.node.alternativa3d::offset;
+ if(!param1.infront)
+ {
+ loc13 = -loc13;
+ }
+ }
+ if(loc13 > loc5)
+ {
+ return;
+ }
+ if(loc13 <= 0)
+ {
+ if(param1.infront)
+ {
+ this.collisionPlanePoint.x = loc10 - loc2 * loc13;
+ this.collisionPlanePoint.y = loc11 - loc3 * loc13;
+ this.collisionPlanePoint.z = loc12 - loc4 * loc13;
+ }
+ else
+ {
+ this.collisionPlanePoint.x = loc10 + loc2 * loc13;
+ this.collisionPlanePoint.y = loc11 + loc3 * loc13;
+ this.collisionPlanePoint.z = loc12 + loc4 * loc13;
+ }
+ }
+ else
+ {
+ loc15 = loc13 / loc5;
+ this.collisionPlanePoint.x = loc10 + this.currentDisplacement.x * loc15;
+ this.collisionPlanePoint.y = loc11 + this.currentDisplacement.y * loc15;
+ this.collisionPlanePoint.z = loc12 + this.currentDisplacement.z * loc15;
+ }
+ this.collisionPrimitiveNearestLengthSqr = Number.MAX_VALUE;
+ this.collisionPrimitiveNearest = null;
+ if(param1.infront)
+ {
+ loc14 = param1.node.alternativa3d::primitive;
+ if(loc14 != null)
+ {
+ if(this._collisionSetMode == CollisionSetMode.EXCLUDE && (this.collisionSet == null || !(Boolean(this.collisionSet[loc14.face._mesh]) || Boolean(this.collisionSet[loc14.face._surface]))) || this._collisionSetMode == CollisionSetMode.INCLUDE && this.collisionSet != null && (this.collisionSet[loc14.face._mesh] || this.collisionSet[loc14.face._surface]))
+ {
+ this.calculateCollisionWithPrimitiveE(loc14);
+ }
+ }
+ else
+ {
+ for(loc14 in param1.node.alternativa3d::frontPrimitives)
+ {
+ if(this._collisionSetMode == CollisionSetMode.EXCLUDE && (this.collisionSet == null || !(Boolean(this.collisionSet[loc14.face._mesh]) || Boolean(this.collisionSet[loc14.face._surface]))) || this._collisionSetMode == CollisionSetMode.INCLUDE && this.collisionSet != null && (this.collisionSet[loc14.face._mesh] || this.collisionSet[loc14.face._surface]))
+ {
+ this.calculateCollisionWithPrimitiveE(loc14);
+ if(this.collisionPrimitive != null)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for(loc14 in param1.node.alternativa3d::backPrimitives)
+ {
+ if(this._collisionSetMode == CollisionSetMode.EXCLUDE && (this.collisionSet == null || !(Boolean(this.collisionSet[loc14.face._mesh]) || Boolean(this.collisionSet[loc14.face._surface]))) || this._collisionSetMode == CollisionSetMode.INCLUDE && this.collisionSet != null && (this.collisionSet[loc14.face._mesh] || this.collisionSet[loc14.face._surface]))
+ {
+ this.calculateCollisionWithPrimitiveE(loc14);
+ if(this.collisionPrimitive != null)
+ {
+ break;
+ }
+ }
+ }
+ }
+ if(this.collisionPrimitive != null)
+ {
+ if(param1.infront)
+ {
+ this.collisionNormal.x = loc2;
+ this.collisionNormal.y = loc3;
+ this.collisionNormal.z = loc4;
+ this.collisionOffset = param1.node.alternativa3d::offset;
+ }
+ else
+ {
+ this.collisionNormal.x = -loc2;
+ this.collisionNormal.y = -loc3;
+ this.collisionNormal.z = -loc4;
+ this.collisionOffset = -param1.node.alternativa3d::offset;
+ }
+ this.collisionRadius = loc7 * this.collisionNormal.x + loc8 * this.collisionNormal.y + loc9 * this.collisionNormal.z;
+ if(this.collisionRadius < 0)
+ {
+ this.collisionRadius = -this.collisionRadius;
+ }
+ this.radiusVector.x = loc10 - this.collisionSource.x;
+ this.radiusVector.y = loc11 - this.collisionSource.y;
+ this.radiusVector.z = loc12 - this.collisionSource.z;
+ this.collisionPoint.x = this.collisionPlanePoint.x;
+ this.collisionPoint.y = this.collisionPlanePoint.y;
+ this.collisionPoint.z = this.collisionPlanePoint.z;
+ }
+ else
+ {
+ loc10 = this.collisionPrimitivePoint.x;
+ loc11 = this.collisionPrimitivePoint.y;
+ loc12 = this.collisionPrimitivePoint.z;
+ loc17 = loc10 * loc10 + loc11 * loc11 + loc12 * loc12;
+ if(loc17 < this._radius2)
+ {
+ loc6 = this._radius / Math.sqrt(loc17);
+ loc10 *= loc6 * this._scaleX;
+ loc11 *= loc6 * this._scaleY;
+ loc12 *= loc6 * this._scaleZ;
+ loc16 = true;
+ }
+ else
+ {
+ loc18 = -this.currentDisplacement.x / this._scaleX;
+ loc19 = -this.currentDisplacement.y / this._scaleY;
+ loc20 = -this.currentDisplacement.z / this._scaleZ;
+ loc21 = loc18 * loc18 + loc19 * loc19 + loc20 * loc20;
+ loc22 = 2 * (loc10 * loc18 + loc11 * loc19 + loc12 * loc20);
+ loc23 = loc17 - this._radius2;
+ loc24 = loc22 * loc22 - 4 * loc21 * loc23;
+ if(loc24 >= 0)
+ {
+ loc15 = -0.5 * (loc22 + Math.sqrt(loc24)) / loc21;
+ if(loc15 >= 0 && loc15 <= 1)
+ {
+ loc10 = (loc10 + loc15 * loc18) * this._scaleX;
+ loc11 = (loc11 + loc15 * loc19) * this._scaleY;
+ loc12 = (loc12 + loc15 * loc20) * this._scaleZ;
+ loc16 = true;
+ }
+ }
+ }
+ if(loc16)
+ {
+ this.collisionNormal.x = -loc10 / this._scaleX2;
+ this.collisionNormal.y = -loc11 / this._scaleY2;
+ this.collisionNormal.z = -loc12 / this._scaleZ2;
+ this.collisionNormal.normalize();
+ this.collisionRadius = loc10 * this.collisionNormal.x + loc11 * this.collisionNormal.y + loc12 * this.collisionNormal.z;
+ if(this.collisionRadius < 0)
+ {
+ this.collisionRadius = -this.collisionRadius;
+ }
+ this.radiusVector.x = loc10;
+ this.radiusVector.y = loc11;
+ this.radiusVector.z = loc12;
+ this.collisionPoint.x = this.collisionPrimitivePoint.x * this._scaleX + this.currentCoords.x;
+ this.collisionPoint.y = this.collisionPrimitivePoint.y * this._scaleY + this.currentCoords.y;
+ this.collisionPoint.z = this.collisionPrimitivePoint.z * this._scaleZ + this.currentCoords.z;
+ this.collisionOffset = this.collisionPoint.x * this.collisionNormal.x + this.collisionPoint.y * this.collisionNormal.y + this.collisionPoint.z * this.collisionNormal.z;
+ this.collisionPrimitive = this.collisionPrimitiveNearest;
+ }
+ }
+ }
+
+ private function calculateCollisionWithPrimitiveE(param1:PolyPrimitive) : void
+ {
+ var loc6:Point3D = null;
+ var loc9:Number = NaN;
+ var loc10:Number = NaN;
+ var loc11:Number = NaN;
+ var loc12:Number = NaN;
+ var loc13:Number = NaN;
+ var loc14:Number = NaN;
+ var loc15:Number = NaN;
+ var loc16:Number = NaN;
+ var loc17:Number = NaN;
+ var loc18:Number = NaN;
+ var loc19:Number = NaN;
+ var loc20:Number = NaN;
+ var loc21:Number = NaN;
+ var loc22:Number = NaN;
+ var loc23:Number = NaN;
+ var loc24:Number = NaN;
+ var loc25:Number = NaN;
+ var loc2:uint = param1.alternativa3d::num;
+ var loc3:Array = param1.alternativa3d::points;
+ var loc4:Point3D = param1.alternativa3d::face.alternativa3d::globalNormal;
+ var loc5:Boolean = true;
+ var loc7:Point3D = loc3[loc2 - 1];
+ this.p2.x = (loc7.x - this.currentCoords.x) / this._scaleX;
+ this.p2.y = (loc7.y - this.currentCoords.y) / this._scaleY;
+ this.p2.z = (loc7.z - this.currentCoords.z) / this._scaleZ;
+ this.localCollisionPlanePoint.x = (this.collisionPlanePoint.x - this.currentCoords.x) / this._scaleX;
+ this.localCollisionPlanePoint.y = (this.collisionPlanePoint.y - this.currentCoords.y) / this._scaleY;
+ this.localCollisionPlanePoint.z = (this.collisionPlanePoint.z - this.currentCoords.z) / this._scaleZ;
+ var loc8:uint = 0;
+ while(loc8 < loc2)
+ {
+ loc6 = loc7;
+ loc7 = loc3[loc8];
+ this.p1.x = this.p2.x;
+ this.p1.y = this.p2.y;
+ this.p1.z = this.p2.z;
+ this.p2.x = (loc7.x - this.currentCoords.x) / this._scaleX;
+ this.p2.y = (loc7.y - this.currentCoords.y) / this._scaleY;
+ this.p2.z = (loc7.z - this.currentCoords.z) / this._scaleZ;
+ loc9 = this.p2.x - this.p1.x;
+ loc10 = this.p2.y - this.p1.y;
+ loc11 = this.p2.z - this.p1.z;
+ loc12 = this.localCollisionPlanePoint.x - this.p1.x;
+ loc13 = this.localCollisionPlanePoint.y - this.p1.y;
+ loc14 = this.localCollisionPlanePoint.z - this.p1.z;
+ loc15 = loc13 * loc11 - loc14 * loc10;
+ loc16 = loc14 * loc9 - loc12 * loc11;
+ loc17 = loc12 * loc10 - loc13 * loc9;
+ if(loc15 * loc4.x + loc16 * loc4.y + loc17 * loc4.z > 0)
+ {
+ loc5 = false;
+ loc18 = loc9 * loc9 + loc10 * loc10 + loc11 * loc11;
+ loc19 = (loc15 * loc15 + loc16 * loc16 + loc17 * loc17) / loc18;
+ if(loc19 < this.collisionPrimitiveNearestLengthSqr)
+ {
+ loc20 = Math.sqrt(loc18);
+ loc21 = loc9 / loc20;
+ loc22 = loc10 / loc20;
+ loc23 = loc11 / loc20;
+ loc24 = loc21 * loc12 + loc22 * loc13 + loc23 * loc14;
+ if(loc24 < 0)
+ {
+ loc25 = loc12 * loc12 + loc13 * loc13 + loc14 * loc14;
+ if(loc25 < this.collisionPrimitiveNearestLengthSqr)
+ {
+ this.collisionPrimitiveNearestLengthSqr = loc25;
+ this.collisionPrimitivePoint.x = this.p1.x;
+ this.collisionPrimitivePoint.y = this.p1.y;
+ this.collisionPrimitivePoint.z = this.p1.z;
+ this.collisionPrimitiveNearest = param1;
+ }
+ }
+ else if(loc24 > loc20)
+ {
+ loc12 = this.localCollisionPlanePoint.x - this.p2.x;
+ loc13 = this.localCollisionPlanePoint.y - this.p2.y;
+ loc14 = this.localCollisionPlanePoint.z - this.p2.z;
+ loc25 = loc12 * loc12 + loc13 * loc13 + loc14 * loc14;
+ if(loc25 < this.collisionPrimitiveNearestLengthSqr)
+ {
+ this.collisionPrimitiveNearestLengthSqr = loc25;
+ this.collisionPrimitivePoint.x = this.p2.x;
+ this.collisionPrimitivePoint.y = this.p2.y;
+ this.collisionPrimitivePoint.z = this.p2.z;
+ this.collisionPrimitiveNearest = param1;
+ }
+ }
+ else
+ {
+ this.collisionPrimitiveNearestLengthSqr = loc19;
+ this.collisionPrimitivePoint.x = this.p1.x + loc21 * loc24;
+ this.collisionPrimitivePoint.y = this.p1.y + loc22 * loc24;
+ this.collisionPrimitivePoint.z = this.p1.z + loc23 * loc24;
+ this.collisionPrimitiveNearest = param1;
+ }
+ }
+ }
+ loc8++;
+ }
+ if(loc5)
+ {
+ this.collisionPrimitive = param1;
+ }
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/primitives/Box.as b/src/alternativa/engine3d/primitives/Box.as
new file mode 100644
index 0000000..dd961af
--- /dev/null
+++ b/src/alternativa/engine3d/primitives/Box.as
@@ -0,0 +1,381 @@
+package alternativa.engine3d.primitives
+{
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Surface;
+ import flash.geom.Point;
+
+ public class Box extends Mesh
+ {
+ private static var counter:uint = 0;
+
+ public function Box(param1:Number = 100, param2:Number = 100, param3:Number = 100, param4:uint = 1, param5:uint = 1, param6:uint = 1, param7:Boolean = false, param8:Boolean = false)
+ {
+ var loc15:int = 0;
+ var loc16:int = 0;
+ var loc17:int = 0;
+ var loc27:String = null;
+ var loc28:Point = null;
+ var loc29:Point = null;
+ super();
+ if(param4 == 0 || param5 == 0 || param6 == 0)
+ {
+ return;
+ }
+ param1 = param1 < 0 ? 0 : param1;
+ param2 = param2 < 0 ? 0 : param2;
+ param3 = param3 < 0 ? 0 : param3;
+ var loc9:Number = param1 / 2;
+ var loc10:Number = param2 / 2;
+ var loc11:Number = param3 / 2;
+ var loc12:Number = param1 / param4;
+ var loc13:Number = param2 / param5;
+ var loc14:Number = param3 / param6;
+ loc15 = 0;
+ while(loc15 <= param4)
+ {
+ loc16 = 0;
+ while(loc16 <= param5)
+ {
+ loc17 = 0;
+ while(loc17 <= param6)
+ {
+ if(loc15 == 0 || loc15 == param4 || loc16 == 0 || loc16 == param5 || loc17 == 0 || loc17 == param6)
+ {
+ createVertex(loc15 * loc12 - loc9,loc16 * loc13 - loc10,loc17 * loc14 - loc11,loc15 + "_" + loc16 + "_" + loc17);
+ }
+ loc17++;
+ }
+ loc16++;
+ }
+ loc15++;
+ }
+ var loc18:Surface = createSurface(null,"front");
+ var loc19:Surface = createSurface(null,"back");
+ var loc20:Surface = createSurface(null,"left");
+ var loc21:Surface = createSurface(null,"right");
+ var loc22:Surface = createSurface(null,"top");
+ var loc23:Surface = createSurface(null,"bottom");
+ var loc24:Number = 1 / param4;
+ var loc25:Number = 1 / param5;
+ var loc26:Number = 1 / param6;
+ loc16 = 0;
+ while(loc16 < param5)
+ {
+ loc15 = 0;
+ while(loc15 < param4)
+ {
+ loc27 = "top_" + loc15 + "_" + loc16;
+ if(param7)
+ {
+ if(param8)
+ {
+ loc28 = new Point(loc15 * loc24,(param5 - loc16) * loc25);
+ loc29 = new Point((loc15 + 1) * loc24,(param5 - loc16 - 1) * loc25);
+ createFace([loc15 + "_" + loc16 + "_" + param6,loc15 + "_" + (loc16 + 1) + "_" + param6,loc15 + 1 + "_" + (loc16 + 1) + "_" + param6],loc27 + ":1");
+ setUVsToFace(loc28,new Point(loc15 * loc24,(param5 - loc16 - 1) * loc25),loc29,loc27 + ":1");
+ createFace([loc15 + 1 + "_" + (loc16 + 1) + "_" + param6,loc15 + 1 + "_" + loc16 + "_" + param6,loc15 + "_" + loc16 + "_" + param6],loc27 + ":0");
+ setUVsToFace(loc29,new Point((loc15 + 1) * loc24,(param5 - loc16) * loc25),loc28,loc27 + ":0");
+ }
+ else
+ {
+ createFace([loc15 + "_" + loc16 + "_" + param6,loc15 + "_" + (loc16 + 1) + "_" + param6,loc15 + 1 + "_" + (loc16 + 1) + "_" + param6,loc15 + 1 + "_" + loc16 + "_" + param6],loc27);
+ setUVsToFace(new Point(loc15 * loc24,(param5 - loc16) * loc25),new Point(loc15 * loc24,(param5 - loc16 - 1) * loc25),new Point((loc15 + 1) * loc24,(param5 - loc16 - 1) * loc25),loc27);
+ }
+ }
+ else if(param8)
+ {
+ loc28 = new Point(loc15 * loc24,loc16 * loc25);
+ loc29 = new Point((loc15 + 1) * loc24,(loc16 + 1) * loc25);
+ createFace([loc15 + "_" + loc16 + "_" + param6,loc15 + 1 + "_" + loc16 + "_" + param6,loc15 + 1 + "_" + (loc16 + 1) + "_" + param6],loc27 + ":0");
+ setUVsToFace(loc28,new Point((loc15 + 1) * loc24,loc16 * loc25),loc29,loc27 + ":0");
+ createFace([loc15 + 1 + "_" + (loc16 + 1) + "_" + param6,loc15 + "_" + (loc16 + 1) + "_" + param6,loc15 + "_" + loc16 + "_" + param6],loc27 + ":1");
+ setUVsToFace(loc29,new Point(loc15 * loc24,(loc16 + 1) * loc25),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([loc15 + "_" + loc16 + "_" + param6,loc15 + 1 + "_" + loc16 + "_" + param6,loc15 + 1 + "_" + (loc16 + 1) + "_" + param6,loc15 + "_" + (loc16 + 1) + "_" + param6],loc27);
+ setUVsToFace(new Point(loc15 * loc24,loc16 * loc25),new Point((loc15 + 1) * loc24,loc16 * loc25),new Point((loc15 + 1) * loc24,(loc16 + 1) * loc25),loc27);
+ }
+ if(param8)
+ {
+ loc22.addFace(loc27 + ":0");
+ loc22.addFace(loc27 + ":1");
+ }
+ else
+ {
+ loc22.addFace(loc27);
+ }
+ loc15++;
+ }
+ loc16++;
+ }
+ loc16 = 0;
+ while(loc16 < param5)
+ {
+ loc15 = 0;
+ while(loc15 < param4)
+ {
+ loc27 = "bottom_" + loc15 + "_" + loc16;
+ if(param7)
+ {
+ if(param8)
+ {
+ loc28 = new Point((param4 - loc15) * loc24,(param5 - loc16) * loc25);
+ loc29 = new Point((param4 - loc15 - 1) * loc24,(param5 - loc16 - 1) * loc25);
+ createFace([loc15 + "_" + loc16 + "_" + 0,loc15 + 1 + "_" + loc16 + "_" + 0,loc15 + 1 + "_" + (loc16 + 1) + "_" + 0],loc27 + ":0");
+ setUVsToFace(loc28,new Point((param4 - loc15 - 1) * loc24,(param5 - loc16) * loc25),loc29,loc27 + ":0");
+ createFace([loc15 + 1 + "_" + (loc16 + 1) + "_" + 0,loc15 + "_" + (loc16 + 1) + "_" + 0,loc15 + "_" + loc16 + "_" + 0],loc27 + ":1");
+ setUVsToFace(loc29,new Point((param4 - loc15) * loc24,(param5 - loc16 - 1) * loc25),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([loc15 + "_" + loc16 + "_" + 0,loc15 + 1 + "_" + loc16 + "_" + 0,loc15 + 1 + "_" + (loc16 + 1) + "_" + 0,loc15 + "_" + (loc16 + 1) + "_" + 0],loc27);
+ setUVsToFace(new Point((param4 - loc15) * loc24,(param5 - loc16) * loc25),new Point((param4 - loc15 - 1) * loc24,(param5 - loc16) * loc25),new Point((param4 - loc15 - 1) * loc24,(param5 - loc16 - 1) * loc25),loc27);
+ }
+ }
+ else if(param8)
+ {
+ loc28 = new Point((param4 - loc15) * loc24,loc16 * loc25);
+ loc29 = new Point((param4 - loc15 - 1) * loc24,(loc16 + 1) * loc25);
+ createFace([loc15 + "_" + loc16 + "_" + 0,loc15 + "_" + (loc16 + 1) + "_" + 0,loc15 + 1 + "_" + (loc16 + 1) + "_" + 0],loc27 + ":1");
+ setUVsToFace(loc28,new Point((param4 - loc15) * loc24,(loc16 + 1) * loc25),loc29,loc27 + ":1");
+ createFace([loc15 + 1 + "_" + (loc16 + 1) + "_" + 0,loc15 + 1 + "_" + loc16 + "_" + 0,loc15 + "_" + loc16 + "_" + 0],loc27 + ":0");
+ setUVsToFace(loc29,new Point((param4 - loc15 - 1) * loc24,loc16 * loc25),loc28,loc27 + ":0");
+ }
+ else
+ {
+ createFace([loc15 + "_" + loc16 + "_" + 0,loc15 + "_" + (loc16 + 1) + "_" + 0,loc15 + 1 + "_" + (loc16 + 1) + "_" + 0,loc15 + 1 + "_" + loc16 + "_" + 0],loc27);
+ setUVsToFace(new Point((param4 - loc15) * loc24,loc16 * loc25),new Point((param4 - loc15) * loc24,(loc16 + 1) * loc25),new Point((param4 - loc15 - 1) * loc24,(loc16 + 1) * loc25),loc27);
+ }
+ if(param8)
+ {
+ loc23.addFace(loc27 + ":0");
+ loc23.addFace(loc27 + ":1");
+ }
+ else
+ {
+ loc23.addFace(loc27);
+ }
+ loc15++;
+ }
+ loc16++;
+ }
+ loc17 = 0;
+ while(loc17 < param6)
+ {
+ loc15 = 0;
+ while(loc15 < param4)
+ {
+ loc27 = "front_" + loc15 + "_" + loc17;
+ if(param7)
+ {
+ if(param8)
+ {
+ loc28 = new Point((param4 - loc15) * loc24,loc17 * loc26);
+ loc29 = new Point((param4 - loc15 - 1) * loc24,(loc17 + 1) * loc26);
+ createFace([loc15 + "_" + 0 + "_" + loc17,loc15 + "_" + 0 + "_" + (loc17 + 1),loc15 + 1 + "_" + 0 + "_" + (loc17 + 1)],loc27 + ":1");
+ setUVsToFace(loc28,new Point((param4 - loc15) * loc24,(loc17 + 1) * loc26),loc29,loc27 + ":1");
+ createFace([loc15 + 1 + "_" + 0 + "_" + (loc17 + 1),loc15 + 1 + "_" + 0 + "_" + loc17,loc15 + "_" + 0 + "_" + loc17],loc27 + ":0");
+ setUVsToFace(loc29,new Point((param4 - loc15 - 1) * loc24,loc17 * loc26),loc28,loc27 + ":0");
+ }
+ else
+ {
+ createFace([loc15 + "_" + 0 + "_" + loc17,loc15 + "_" + 0 + "_" + (loc17 + 1),loc15 + 1 + "_" + 0 + "_" + (loc17 + 1),loc15 + 1 + "_" + 0 + "_" + loc17],loc27);
+ setUVsToFace(new Point((param4 - loc15) * loc24,loc17 * loc26),new Point((param4 - loc15) * loc24,(loc17 + 1) * loc26),new Point((param4 - loc15 - 1) * loc24,(loc17 + 1) * loc26),loc27);
+ }
+ }
+ else if(param8)
+ {
+ loc28 = new Point(loc15 * loc24,loc17 * loc26);
+ loc29 = new Point((loc15 + 1) * loc24,(loc17 + 1) * loc26);
+ createFace([loc15 + "_" + 0 + "_" + loc17,loc15 + 1 + "_" + 0 + "_" + loc17,loc15 + 1 + "_" + 0 + "_" + (loc17 + 1)],loc27 + ":0");
+ setUVsToFace(loc28,new Point((loc15 + 1) * loc24,loc17 * loc26),loc29,loc27 + ":0");
+ createFace([loc15 + 1 + "_" + 0 + "_" + (loc17 + 1),loc15 + "_" + 0 + "_" + (loc17 + 1),loc15 + "_" + 0 + "_" + loc17],loc27 + ":1");
+ setUVsToFace(loc29,new Point(loc15 * loc24,(loc17 + 1) * loc26),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([loc15 + "_" + 0 + "_" + loc17,loc15 + 1 + "_" + 0 + "_" + loc17,loc15 + 1 + "_" + 0 + "_" + (loc17 + 1),loc15 + "_" + 0 + "_" + (loc17 + 1)],loc27);
+ setUVsToFace(new Point(loc15 * loc24,loc17 * loc26),new Point((loc15 + 1) * loc24,loc17 * loc26),new Point((loc15 + 1) * loc24,(loc17 + 1) * loc26),loc27);
+ }
+ if(param8)
+ {
+ loc18.addFace(loc27 + ":0");
+ loc18.addFace(loc27 + ":1");
+ }
+ else
+ {
+ loc18.addFace(loc27);
+ }
+ loc15++;
+ }
+ loc17++;
+ }
+ loc17 = 0;
+ while(loc17 < param6)
+ {
+ loc15 = 0;
+ while(loc15 < param4)
+ {
+ loc27 = "back_" + loc15 + "_" + loc17;
+ if(param7)
+ {
+ if(param8)
+ {
+ loc28 = new Point(loc15 * loc24,(loc17 + 1) * loc26);
+ loc29 = new Point((loc15 + 1) * loc24,loc17 * loc26);
+ createFace([loc15 + "_" + param5 + "_" + (loc17 + 1),loc15 + "_" + param5 + "_" + loc17,loc15 + 1 + "_" + param5 + "_" + loc17],loc27 + ":0");
+ setUVsToFace(loc28,new Point(loc15 * loc24,loc17 * loc26),loc29,loc27 + ":0");
+ createFace([loc15 + 1 + "_" + param5 + "_" + loc17,loc15 + 1 + "_" + param5 + "_" + (loc17 + 1),loc15 + "_" + param5 + "_" + (loc17 + 1)],loc27 + ":1");
+ setUVsToFace(loc29,new Point((loc15 + 1) * loc24,(loc17 + 1) * loc26),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([loc15 + "_" + param5 + "_" + loc17,loc15 + 1 + "_" + param5 + "_" + loc17,loc15 + 1 + "_" + param5 + "_" + (loc17 + 1),loc15 + "_" + param5 + "_" + (loc17 + 1)],loc27);
+ setUVsToFace(new Point(loc15 * loc24,loc17 * loc26),new Point((loc15 + 1) * loc24,loc17 * loc26),new Point((loc15 + 1) * loc24,(loc17 + 1) * loc26),loc27);
+ }
+ }
+ else if(param8)
+ {
+ loc28 = new Point((param4 - loc15) * loc24,(loc17 + 1) * loc26);
+ loc29 = new Point((param4 - loc15 - 1) * loc24,loc17 * loc26);
+ createFace([loc15 + "_" + param5 + "_" + loc17,loc15 + "_" + param5 + "_" + (loc17 + 1),loc15 + 1 + "_" + param5 + "_" + loc17],loc27 + ":0");
+ setUVsToFace(new Point((param4 - loc15) * loc24,loc17 * loc26),loc28,loc29,loc27 + ":0");
+ createFace([loc15 + "_" + param5 + "_" + (loc17 + 1),loc15 + 1 + "_" + param5 + "_" + (loc17 + 1),loc15 + 1 + "_" + param5 + "_" + loc17],loc27 + ":1");
+ setUVsToFace(loc28,new Point((param4 - loc15 - 1) * loc24,(loc17 + 1) * loc26),loc29,loc27 + ":1");
+ }
+ else
+ {
+ createFace([loc15 + "_" + param5 + "_" + loc17,loc15 + "_" + param5 + "_" + (loc17 + 1),loc15 + 1 + "_" + param5 + "_" + (loc17 + 1),loc15 + 1 + "_" + param5 + "_" + loc17],loc27);
+ setUVsToFace(new Point((param4 - loc15) * loc24,loc17 * loc26),new Point((param4 - loc15) * loc24,(loc17 + 1) * loc26),new Point((param4 - loc15 - 1) * loc24,(loc17 + 1) * loc26),loc27);
+ }
+ if(param8)
+ {
+ loc19.addFace(loc27 + ":0");
+ loc19.addFace(loc27 + ":1");
+ }
+ else
+ {
+ loc19.addFace(loc27);
+ }
+ loc15++;
+ }
+ loc17++;
+ }
+ loc16 = 0;
+ while(loc16 < param5)
+ {
+ loc17 = 0;
+ while(loc17 < param6)
+ {
+ loc27 = "left_" + loc16 + "_" + loc17;
+ if(param7)
+ {
+ if(param8)
+ {
+ loc28 = new Point(loc16 * loc25,(loc17 + 1) * loc26);
+ loc29 = new Point((loc16 + 1) * loc25,loc17 * loc26);
+ createFace([0 + "_" + loc16 + "_" + (loc17 + 1),0 + "_" + loc16 + "_" + loc17,0 + "_" + (loc16 + 1) + "_" + loc17],loc27 + ":0");
+ setUVsToFace(loc28,new Point(loc16 * loc25,loc17 * loc26),loc29,loc27 + ":0");
+ createFace([0 + "_" + (loc16 + 1) + "_" + loc17,0 + "_" + (loc16 + 1) + "_" + (loc17 + 1),0 + "_" + loc16 + "_" + (loc17 + 1)],loc27 + ":1");
+ setUVsToFace(loc29,new Point((loc16 + 1) * loc25,(loc17 + 1) * loc26),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([0 + "_" + loc16 + "_" + loc17,0 + "_" + (loc16 + 1) + "_" + loc17,0 + "_" + (loc16 + 1) + "_" + (loc17 + 1),0 + "_" + loc16 + "_" + (loc17 + 1)],loc27);
+ setUVsToFace(new Point(loc16 * loc25,loc17 * loc26),new Point((loc16 + 1) * loc25,loc17 * loc26),new Point((loc16 + 1) * loc25,(loc17 + 1) * loc26),loc27);
+ }
+ }
+ else if(param8)
+ {
+ loc28 = new Point((param5 - loc16 - 1) * loc25,loc17 * loc26);
+ loc29 = new Point((param5 - loc16) * loc25,(loc17 + 1) * loc26);
+ createFace([0 + "_" + (loc16 + 1) + "_" + loc17,0 + "_" + loc16 + "_" + loc17,0 + "_" + loc16 + "_" + (loc17 + 1)],loc27 + ":0");
+ setUVsToFace(loc28,new Point((param5 - loc16) * loc25,loc17 * loc26),loc29,loc27 + ":0");
+ createFace([0 + "_" + loc16 + "_" + (loc17 + 1),0 + "_" + (loc16 + 1) + "_" + (loc17 + 1),0 + "_" + (loc16 + 1) + "_" + loc17],loc27 + ":1");
+ setUVsToFace(loc29,new Point((param5 - loc16 - 1) * loc25,(loc17 + 1) * loc26),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([0 + "_" + loc16 + "_" + loc17,0 + "_" + loc16 + "_" + (loc17 + 1),0 + "_" + (loc16 + 1) + "_" + (loc17 + 1),0 + "_" + (loc16 + 1) + "_" + loc17],loc27);
+ setUVsToFace(new Point((param5 - loc16) * loc25,loc17 * loc26),new Point((param5 - loc16) * loc25,(loc17 + 1) * loc26),new Point((param5 - loc16 - 1) * loc25,(loc17 + 1) * loc26),loc27);
+ }
+ if(param8)
+ {
+ loc20.addFace(loc27 + ":0");
+ loc20.addFace(loc27 + ":1");
+ }
+ else
+ {
+ loc20.addFace(loc27);
+ }
+ loc17++;
+ }
+ loc16++;
+ }
+ loc16 = 0;
+ while(loc16 < param5)
+ {
+ loc17 = 0;
+ while(loc17 < param6)
+ {
+ loc27 = "right_" + loc16 + "_" + loc17;
+ if(param7)
+ {
+ if(param8)
+ {
+ loc28 = new Point((param5 - loc16) * loc25,loc17 * loc26);
+ loc29 = new Point((param5 - loc16 - 1) * loc25,(loc17 + 1) * loc26);
+ createFace([param4 + "_" + loc16 + "_" + loc17,param4 + "_" + loc16 + "_" + (loc17 + 1),param4 + "_" + (loc16 + 1) + "_" + (loc17 + 1)],loc27 + ":1");
+ setUVsToFace(loc28,new Point((param5 - loc16) * loc25,(loc17 + 1) * loc26),loc29,loc27 + ":1");
+ createFace([param4 + "_" + (loc16 + 1) + "_" + (loc17 + 1),param4 + "_" + (loc16 + 1) + "_" + loc17,param4 + "_" + loc16 + "_" + loc17],loc27 + ":0");
+ setUVsToFace(loc29,new Point((param5 - loc16 - 1) * loc25,loc17 * loc26),loc28,loc27 + ":0");
+ }
+ else
+ {
+ createFace([param4 + "_" + loc16 + "_" + loc17,param4 + "_" + loc16 + "_" + (loc17 + 1),param4 + "_" + (loc16 + 1) + "_" + (loc17 + 1),param4 + "_" + (loc16 + 1) + "_" + loc17],loc27);
+ setUVsToFace(new Point((param5 - loc16) * loc25,loc17 * loc26),new Point((param5 - loc16) * loc25,(loc17 + 1) * loc26),new Point((param5 - loc16 - 1) * loc25,(loc17 + 1) * loc26),loc27);
+ }
+ }
+ else if(param8)
+ {
+ loc28 = new Point(loc16 * loc25,loc17 * loc26);
+ loc29 = new Point((loc16 + 1) * loc25,(loc17 + 1) * loc26);
+ createFace([param4 + "_" + loc16 + "_" + loc17,param4 + "_" + (loc16 + 1) + "_" + loc17,param4 + "_" + (loc16 + 1) + "_" + (loc17 + 1)],loc27 + ":0");
+ setUVsToFace(loc28,new Point((loc16 + 1) * loc25,loc17 * loc26),loc29,loc27 + ":0");
+ createFace([param4 + "_" + (loc16 + 1) + "_" + (loc17 + 1),param4 + "_" + loc16 + "_" + (loc17 + 1),param4 + "_" + loc16 + "_" + loc17],loc27 + ":1");
+ setUVsToFace(loc29,new Point(loc16 * loc25,(loc17 + 1) * loc26),loc28,loc27 + ":1");
+ }
+ else
+ {
+ createFace([param4 + "_" + loc16 + "_" + loc17,param4 + "_" + (loc16 + 1) + "_" + loc17,param4 + "_" + (loc16 + 1) + "_" + (loc17 + 1),param4 + "_" + loc16 + "_" + (loc17 + 1)],loc27);
+ setUVsToFace(new Point(loc16 * loc25,loc17 * loc26),new Point((loc16 + 1) * loc25,loc17 * loc26),new Point((loc16 + 1) * loc25,(loc17 + 1) * loc26),loc27);
+ }
+ if(param8)
+ {
+ loc21.addFace(loc27 + ":0");
+ loc21.addFace(loc27 + ":1");
+ }
+ else
+ {
+ loc21.addFace(loc27);
+ }
+ loc17++;
+ }
+ loc16++;
+ }
+ }
+
+ override protected function createEmptyObject() : Object3D
+ {
+ return new Box(0,0,0,0);
+ }
+
+ override protected function defaultName() : String
+ {
+ return "box" + ++counter;
+ }
+ }
+}
+
diff --git a/src/alternativa/engine3d/primitives/Plane.as b/src/alternativa/engine3d/primitives/Plane.as
new file mode 100644
index 0000000..f1501a2
--- /dev/null
+++ b/src/alternativa/engine3d/primitives/Plane.as
@@ -0,0 +1,115 @@
+package alternativa.engine3d.primitives
+{
+ import alternativa.engine3d.*;
+ import alternativa.engine3d.core.Mesh;
+ import alternativa.engine3d.core.Object3D;
+ import alternativa.engine3d.core.Surface;
+ import flash.geom.Point;
+
+ use namespace alternativa3d;
+
+ public class Plane extends Mesh
+ {
+ private static var counter:uint = 0;
+
+ public function Plane(param1:Number = 100, param2:Number = 100, param3:uint = 1, param4:uint = 1, param5:Boolean = true, param6:Boolean = false, param7:Boolean = false)
+ {
+ var loc14:int = 0;
+ var loc15:int = 0;
+ var loc17:Surface = null;
+ var loc18:Surface = null;
+ super();
+ if(param3 == 0 || param4 == 0)
+ {
+ return;
+ }
+ param1 = param1 < 0 ? 0 : param1;
+ param2 = param2 < 0 ? 0 : param2;
+ var loc8:Number = param1 / 2;
+ var loc9:Number = param2 / 2;
+ var loc10:Number = param1 / param3;
+ var loc11:Number = param2 / param4;
+ var loc12:Number = 1 / param3;
+ var loc13:Number = 1 / param4;
+ var loc16:Array = new Array();
+ loc15 = 0;
+ while(loc15 <= param4)
+ {
+ loc16[loc15] = new Array();
+ loc14 = 0;
+ while(loc14 <= param3)
+ {
+ loc16[loc15][loc14] = new Point(loc14 * loc12,loc15 * loc13);
+ createVertex(loc14 * loc10 - loc8,loc15 * loc11 - loc9,0,loc14 + "_" + loc15);
+ loc14++;
+ }
+ loc15++;
+ }
+ if(param5 || !param6)
+ {
+ loc17 = createSurface(null,"front");
+ }
+ if(param5 || param6)
+ {
+ loc18 = createSurface(null,"back");
+ }
+ loc15 = 0;
+ while(loc15 < param4)
+ {
+ loc14 = 0;
+ while(loc14 < param3)
+ {
+ if(param5 || !param6)
+ {
+ if(param7)
+ {
+ createFace([loc14 + "_" + loc15,loc14 + 1 + "_" + loc15,loc14 + 1 + "_" + (loc15 + 1)],"front" + loc14 + "_" + loc15 + ":0");
+ setUVsToFace(loc16[loc15][loc14],loc16[loc15][loc14 + 1],loc16[loc15 + 1][loc14 + 1],"front" + loc14 + "_" + loc15 + ":0");
+ createFace([loc14 + 1 + "_" + (loc15 + 1),loc14 + "_" + (loc15 + 1),loc14 + "_" + loc15],"front" + loc14 + "_" + loc15 + ":1");
+ setUVsToFace(loc16[loc15 + 1][loc14 + 1],loc16[loc15 + 1][loc14],loc16[loc15][loc14],"front" + loc14 + "_" + loc15 + ":1");
+ loc17.addFace("front" + loc14 + "_" + loc15 + ":0");
+ loc17.addFace("front" + loc14 + "_" + loc15 + ":1");
+ }
+ else
+ {
+ createFace([loc14 + "_" + loc15,loc14 + 1 + "_" + loc15,loc14 + 1 + "_" + (loc15 + 1),loc14 + "_" + (loc15 + 1)],"front" + loc14 + "_" + loc15);
+ setUVsToFace(loc16[loc15][loc14],loc16[loc15][loc14 + 1],loc16[loc15 + 1][loc14 + 1],"front" + loc14 + "_" + loc15);
+ loc17.addFace("front" + loc14 + "_" + loc15);
+ }
+ }
+ if(param5 || param6)
+ {
+ if(param7)
+ {
+ createFace([loc14 + "_" + loc15,loc14 + "_" + (loc15 + 1),loc14 + 1 + "_" + (loc15 + 1)],"back" + loc14 + "_" + loc15 + ":0");
+ setUVsToFace(loc16[param4 - loc15][loc14],loc16[param4 - loc15 - 1][loc14],loc16[param4 - loc15 - 1][loc14 + 1],"back" + loc14 + "_" + loc15 + ":0");
+ createFace([loc14 + 1 + "_" + (loc15 + 1),loc14 + 1 + "_" + loc15,loc14 + "_" + loc15],"back" + loc14 + "_" + loc15 + ":1");
+ setUVsToFace(loc16[param4 - loc15 - 1][loc14 + 1],loc16[param4 - loc15][loc14 + 1],loc16[param4 - loc15][loc14],"back" + loc14 + "_" + loc15 + ":1");
+ loc18.addFace("back" + loc14 + "_" + loc15 + ":0");
+ loc18.addFace("back" + loc14 + "_" + loc15 + ":1");
+ }
+ else
+ {
+ createFace([loc14 + "_" + loc15,loc14 + "_" + (loc15 + 1),loc14 + 1 + "_" + (loc15 + 1),loc14 + 1 + "_" + loc15],"back" + loc14 + "_" + loc15);
+ setUVsToFace(loc16[param4 - loc15][loc14],loc16[param4 - loc15 - 1][loc14],loc16[param4 - loc15 - 1][loc14 + 1],"back" + loc14 + "_" + loc15);
+ loc18.addFace("back" + loc14 + "_" + loc15);
+ }
+ }
+ loc14++;
+ }
+ loc15++;
+ }
+ }
+
+ override protected function createEmptyObject() : Object3D
+ {
+ return new Plane(0,0,0);
+ }
+
+ override protected function defaultName() : String
+ {
+ return "plane" + ++counter;
+ }
+ }
+}
+
diff --git a/src/alternativa/types/Map.as b/src/alternativa/types/Map.as
new file mode 100644
index 0000000..421675c
--- /dev/null
+++ b/src/alternativa/types/Map.as
@@ -0,0 +1,199 @@
+package alternativa.types
+{
+ import flash.utils.Dictionary;
+
+ public dynamic class Map extends Dictionary
+ {
+ private var weakKeys:Boolean;
+
+ public function Map(param1:Boolean = false)
+ {
+ this.weakKeys = param1;
+ super(param1);
+ }
+
+ public function add(param1:*, param2:*) : void
+ {
+ this[param1] = param2;
+ }
+
+ public function isEmpty() : Boolean
+ {
+ var loc1:* = undefined;
+ var loc2:int = 0;
+ var loc3:* = this;
+ for(loc1 in loc3)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public function remove(param1:*) : void
+ {
+ delete this[param1];
+ }
+
+ public function hasKey(param1:*) : Boolean
+ {
+ return this[param1] !== undefined;
+ }
+
+ public function get length() : uint
+ {
+ var loc2:* = undefined;
+ var loc1:uint = 0;
+ for(loc2 in this)
+ {
+ loc1++;
+ }
+ return loc1;
+ }
+
+ public function take() : *
+ {
+ var loc1:* = undefined;
+ var loc2:* = undefined;
+ var loc3:int = 0;
+ var loc4:* = this;
+ for(loc1 in loc4)
+ {
+ loc2 = this[loc1];
+ delete this[loc1];
+ return loc2;
+ }
+ return null;
+ }
+
+ public function clear() : void
+ {
+ var loc1:* = undefined;
+ for(loc1 in this)
+ {
+ delete this[loc1];
+ }
+ }
+
+ public function any() : *
+ {
+ var loc3:* = undefined;
+ var loc1:uint = 0;
+ var loc2:uint = Math.random() * length;
+ for(loc3 in this)
+ {
+ if(loc1 == loc2)
+ {
+ return this[loc3];
+ }
+ loc1++;
+ }
+ return null;
+ }
+
+ public function isSingle() : Boolean
+ {
+ var loc2:* = undefined;
+ var loc1:Boolean = false;
+ for(loc2 in this)
+ {
+ if(loc1)
+ {
+ return false;
+ }
+ loc1 = true;
+ }
+ return loc1;
+ }
+
+ public function concat(param1:Map) : void
+ {
+ var loc2:* = undefined;
+ for(loc2 in param1)
+ {
+ this[loc2] = param1[loc2];
+ }
+ }
+
+ public function toSet(param1:Boolean = false) : Set
+ {
+ var loc3:* = undefined;
+ var loc2:Set = new Set(param1);
+ for each(loc3 in this)
+ {
+ loc2[loc3] = true;
+ }
+ return loc2;
+ }
+
+ public function hasValue(param1:*) : Boolean
+ {
+ var loc2:* = undefined;
+ for(loc2 in this)
+ {
+ if(this[loc2] === param1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function toString() : String
+ {
+ var loc3:* = undefined;
+ var loc1:int = 0;
+ var loc2:String = "";
+ for(loc3 in this)
+ {
+ loc2 += "," + loc3 + ":" + this[loc3];
+ loc1++;
+ }
+ return "[Map length:" + loc1 + (loc1 > 0 ? " " + loc2.substring(1) : "") + "]";
+ }
+
+ public function peek() : *
+ {
+ var loc1:* = undefined;
+ var loc2:int = 0;
+ var loc3:* = this;
+ for(loc1 in loc3)
+ {
+ return this[loc1];
+ }
+ return null;
+ }
+
+ public function clone() : Map
+ {
+ var loc2:* = undefined;
+ var loc1:Map = new Map(weakKeys);
+ for(loc2 in this)
+ {
+ loc1[loc2] = this[loc2];
+ }
+ return loc1;
+ }
+
+ public function toArray(param1:Boolean = false) : Array
+ {
+ var loc3:* = undefined;
+ var loc2:Array = new Array();
+ if(param1)
+ {
+ for(loc3 in this)
+ {
+ loc2.push(this[loc3]);
+ }
+ }
+ else
+ {
+ for(loc3 in this)
+ {
+ loc2[loc3] = this[loc3];
+ }
+ }
+ return loc2;
+ }
+ }
+}
+
diff --git a/src/alternativa/types/Matrix3D.as b/src/alternativa/types/Matrix3D.as
new file mode 100644
index 0000000..d1ee5a0
--- /dev/null
+++ b/src/alternativa/types/Matrix3D.as
@@ -0,0 +1,746 @@
+package alternativa.types
+{
+ public final class Matrix3D
+ {
+ public var a:Number;
+
+ public var b:Number;
+
+ public var c:Number;
+
+ public var d:Number;
+
+ public var f:Number;
+
+ public var g:Number;
+
+ public var h:Number;
+
+ public var i:Number;
+
+ public var j:Number;
+
+ public var k:Number;
+
+ public var e:Number;
+
+ public var l:Number;
+
+ public function Matrix3D(param1:Number = 1, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 1, param7:Number = 0, param8:Number = 0, param9:Number = 0, param10:Number = 0, param11:Number = 1, param12:Number = 0)
+ {
+ super();
+ this.a = param1;
+ this.b = param2;
+ this.c = param3;
+ this.d = param4;
+ this.e = param5;
+ this.f = param6;
+ this.g = param7;
+ this.h = param8;
+ this.i = param9;
+ this.j = param10;
+ this.k = param11;
+ this.l = param12;
+ }
+
+ public static function inverseTranslationMatrix(param1:Number = 0, param2:Number = 0, param3:Number = 0) : Matrix3D
+ {
+ return new Matrix3D(1,0,0,-param1,0,1,0,-param2,0,0,1,-param3);
+ }
+
+ public static function translationMatrix(param1:Number = 0, param2:Number = 0, param3:Number = 0) : Matrix3D
+ {
+ return new Matrix3D(1,0,0,param1,0,1,0,param2,0,0,1,param3);
+ }
+
+ public static function axisAngleToMatrix(param1:Point3D, param2:Number = 0) : Matrix3D
+ {
+ var loc3:Number = Math.cos(param2);
+ var loc4:Number = Math.sin(param2);
+ var loc5:Number = 1 - loc3;
+ var loc6:Number = param1.x;
+ var loc7:Number = param1.y;
+ var loc8:Number = param1.z;
+ return new Matrix3D(loc5 * loc6 * loc6 + loc3,loc5 * loc6 * loc7 - loc8 * loc4,loc5 * loc6 * loc8 + loc7 * loc4,0,loc5 * loc6 * loc7 + loc8 * loc4,loc5 * loc7 * loc7 + loc3,loc5 * loc7 * loc8 - loc6 * loc4,0,loc5 * loc6 * loc8 - loc7 * loc4,loc5 * loc7 * loc8 + loc6 * loc4,loc5 * loc8 * loc8 + loc3,0);
+ }
+
+ public static function inverseRotationMatrix(param1:Number = 0, param2:Number = 0, param3:Number = 0) : Matrix3D
+ {
+ var loc4:Number = Math.cos(param1);
+ var loc5:Number = Math.sin(-param1);
+ var loc6:Number = Math.cos(param2);
+ var loc7:Number = Math.sin(-param2);
+ var loc8:Number = Math.cos(param3);
+ var loc9:Number = Math.sin(-param3);
+ var loc10:Number = loc5 * loc7;
+ return new Matrix3D(loc6 * loc8,-loc6 * loc9,loc7,0,loc4 * loc9 + loc10 * loc8,loc4 * loc8 - loc10 * loc9,-loc5 * loc6,0,loc5 * loc9 - loc4 * loc8 * loc7,loc5 * loc8 + loc4 * loc7 * loc9,loc4 * loc6,0);
+ }
+
+ public static function inverseTransformationMatrix(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 0, param7:Number = 1, param8:Number = 1, param9:Number = 1) : Matrix3D
+ {
+ var loc10:Number = Math.cos(-param4);
+ var loc11:Number = Math.sin(-param4);
+ var loc12:Number = Math.cos(-param5);
+ var loc13:Number = Math.sin(-param5);
+ var loc14:Number = Math.cos(-param6);
+ var loc15:Number = Math.sin(-param6);
+ var loc16:Number = loc11 * loc13;
+ var loc17:Number = 1 / param7;
+ var loc18:Number = 1 / param8;
+ var loc19:Number = 1 / param9;
+ var loc20:Number = loc12 * loc17;
+ var loc21:Number = loc10 * loc18;
+ var loc22:Number = loc11 * loc19;
+ var loc23:Number = loc10 * loc19;
+ var loc24:Number = loc14 * loc20;
+ var loc25:Number = -loc15 * loc20;
+ var loc26:Number = loc13 * loc17;
+ var loc27:Number = loc15 * loc21 + loc16 * loc14 * loc18;
+ var loc28:Number = loc14 * loc21 - loc16 * loc15 * loc18;
+ var loc29:Number = -loc11 * loc12 * loc18;
+ var loc30:Number = loc15 * loc22 - loc14 * loc13 * loc23;
+ var loc31:Number = loc14 * loc22 + loc13 * loc15 * loc23;
+ var loc32:Number = loc12 * loc23;
+ return new Matrix3D(loc24,loc25,loc26,-(loc24 * param1 + loc25 * param2 + loc26 * param3),loc27,loc28,loc29,-(loc27 * param1 + loc28 * param2 + loc29 * param3),loc30,loc31,loc32,-(loc30 * param1 + loc31 * param2 + loc32 * param3));
+ }
+
+ public static function inverseMatrix(param1:Matrix3D) : Matrix3D
+ {
+ var loc2:Number = -param1.c * param1.f * param1.i + param1.b * param1.g * param1.i + param1.c * param1.e * param1.j - param1.a * param1.g * param1.j - param1.b * param1.e * param1.k + param1.a * param1.f * param1.k;
+ var loc3:Number = (-param1.g * param1.j + param1.f * param1.k) / loc2;
+ var loc4:Number = (param1.c * param1.j - param1.b * param1.k) / loc2;
+ var loc5:Number = (-param1.c * param1.f + param1.b * param1.g) / loc2;
+ var loc6:Number = (param1.d * param1.g * param1.j - param1.c * param1.h * param1.j - param1.d * param1.f * param1.k + param1.b * param1.h * param1.k + param1.c * param1.f * param1.l - param1.b * param1.g * param1.l) / loc2;
+ var loc7:Number = (param1.g * param1.i - param1.e * param1.k) / loc2;
+ var loc8:Number = (-param1.c * param1.i + param1.a * param1.k) / loc2;
+ var loc9:Number = (param1.c * param1.e - param1.a * param1.g) / loc2;
+ var loc10:Number = (param1.c * param1.h * param1.i - param1.d * param1.g * param1.i + param1.d * param1.e * param1.k - param1.a * param1.h * param1.k - param1.c * param1.e * param1.l + param1.a * param1.g * param1.l) / loc2;
+ var loc11:Number = (-param1.f * param1.i + param1.e * param1.j) / loc2;
+ var loc12:Number = (param1.b * param1.i - param1.a * param1.j) / loc2;
+ var loc13:Number = (-param1.b * param1.e + param1.a * param1.f) / loc2;
+ var loc14:Number = (param1.d * param1.f * param1.i - param1.b * param1.h * param1.i - param1.d * param1.e * param1.j + param1.a * param1.h * param1.j + param1.b * param1.e * param1.l - param1.a * param1.f * param1.l) / loc2;
+ return new Matrix3D(loc3,loc4,loc5,loc6,loc7,loc8,loc9,loc10,loc11,loc12,loc13,loc14);
+ }
+
+ public static function inverseScaleMatrix(param1:Number = 1, param2:Number = 1, param3:Number = 1) : Matrix3D
+ {
+ return new Matrix3D(1 / param1,0,0,0,0,1 / param2,0,0,0,0,1 / param3,0);
+ }
+
+ public static function scaleMatrix(param1:Number = 1, param2:Number = 1, param3:Number = 1) : Matrix3D
+ {
+ return new Matrix3D(param1,0,0,0,0,param2,0,0,0,0,param3,0);
+ }
+
+ public static function transformationMatrix(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 0, param7:Number = 1, param8:Number = 1, param9:Number = 1) : Matrix3D
+ {
+ var loc10:Number = Math.cos(param4);
+ var loc11:Number = Math.sin(param4);
+ var loc12:Number = Math.cos(param5);
+ var loc13:Number = Math.sin(param5);
+ var loc14:Number = Math.cos(param6);
+ var loc15:Number = Math.sin(param6);
+ var loc16:Number = loc14 * loc13;
+ var loc17:Number = loc15 * loc13;
+ var loc18:Number = loc12 * param7;
+ var loc19:Number = loc11 * param8;
+ var loc20:Number = loc10 * param8;
+ var loc21:Number = loc10 * param9;
+ var loc22:Number = loc11 * param9;
+ return new Matrix3D(loc14 * loc18,loc16 * loc19 - loc15 * loc20,loc16 * loc21 + loc15 * loc22,param1,loc15 * loc18,loc17 * loc19 + loc14 * loc20,loc17 * loc21 - loc14 * loc22,param2,-loc13 * param7,loc12 * loc19,loc12 * loc21,param3);
+ }
+
+ public static function product(param1:Matrix3D, param2:Matrix3D) : Matrix3D
+ {
+ return new Matrix3D(param1.a * param2.a + param1.b * param2.e + param1.c * param2.i,param1.a * param2.b + param1.b * param2.f + param1.c * param2.j,param1.a * param2.c + param1.b * param2.g + param1.c * param2.k,param1.a * param2.d + param1.b * param2.h + param1.c * param2.l + param1.d,param1.e * param2.a + param1.f * param2.e + param1.g * param2.i,param1.e * param2.b + param1.f * param2.f + param1.g * param2.j,param1.e * param2.c + param1.f * param2.g + param1.g * param2.k,param1.e * param2.d + param1.f * param2.h + param1.g * param2.l + param1.h,param1.i * param2.a + param1.j * param2.e + param1.k * param2.i,param1.i * param2.b + param1.j * param2.f + param1.k * param2.j,param1.i * param2.c + param1.j * param2.g + param1.k * param2.k,param1.i * param2.d + param1.j * param2.h + param1.k * param2.l + param1.l);
+ }
+
+ public static function rotationMatrix(param1:Number = 0, param2:Number = 0, param3:Number = 0) : Matrix3D
+ {
+ var loc4:Number = Math.cos(param1);
+ var loc5:Number = Math.sin(param1);
+ var loc6:Number = Math.cos(param2);
+ var loc7:Number = Math.sin(param2);
+ var loc8:Number = Math.cos(param3);
+ var loc9:Number = Math.sin(param3);
+ var loc10:Number = loc8 * loc7;
+ var loc11:Number = loc9 * loc7;
+ return new Matrix3D(loc8 * loc6,loc10 * loc5 - loc9 * loc4,loc10 * loc4 + loc9 * loc5,0,loc9 * loc6,loc11 * loc5 + loc8 * loc4,loc11 * loc4 - loc8 * loc5,0,-loc7,loc6 * loc5,loc6 * loc4,0);
+ }
+
+ public function transform(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 0, param7:Number = 1, param8:Number = 1, param9:Number = 1) : void
+ {
+ var loc10:Number = Math.cos(param4);
+ var loc11:Number = Math.sin(param4);
+ var loc12:Number = Math.cos(param5);
+ var loc13:Number = Math.sin(param5);
+ var loc14:Number = Math.cos(param6);
+ var loc15:Number = Math.sin(param6);
+ var loc16:Number = loc14 * loc13;
+ var loc17:Number = loc15 * loc13;
+ var loc18:Number = loc12 * param7;
+ var loc19:Number = loc11 * param8;
+ var loc20:Number = loc10 * param8;
+ var loc21:Number = loc10 * param9;
+ var loc22:Number = loc11 * param9;
+ var loc23:Number = loc14 * loc18;
+ var loc24:Number = loc16 * loc19 - loc15 * loc20;
+ var loc25:Number = loc16 * loc21 + loc15 * loc22;
+ var loc26:Number = param1;
+ var loc27:Number = loc15 * loc18;
+ var loc28:Number = loc17 * loc19 + loc14 * loc20;
+ var loc29:Number = loc17 * loc21 - loc14 * loc22;
+ var loc30:Number = param2;
+ var loc31:Number = -loc13 * param7;
+ var loc32:Number = loc12 * loc19;
+ var loc33:Number = loc12 * loc21;
+ var loc34:Number = param3;
+ var loc35:Number = a;
+ var loc36:Number = b;
+ var loc37:Number = c;
+ var loc38:Number = d;
+ var loc39:Number = e;
+ var loc40:Number = f;
+ var loc41:Number = g;
+ var loc42:Number = h;
+ var loc43:Number = i;
+ var loc44:Number = j;
+ var loc45:Number = k;
+ var loc46:Number = l;
+ a = loc23 * loc35 + loc24 * loc39 + loc25 * loc43;
+ b = loc23 * loc36 + loc24 * loc40 + loc25 * loc44;
+ c = loc23 * loc37 + loc24 * loc41 + loc25 * loc45;
+ d = loc23 * loc38 + loc24 * loc42 + loc25 * loc46 + loc26;
+ e = loc27 * loc35 + loc28 * loc39 + loc29 * loc43;
+ f = loc27 * loc36 + loc28 * loc40 + loc29 * loc44;
+ g = loc27 * loc37 + loc28 * loc41 + loc29 * loc45;
+ h = loc27 * loc38 + loc28 * loc42 + loc29 * loc46 + loc30;
+ i = loc31 * loc35 + loc32 * loc39 + loc33 * loc43;
+ j = loc31 * loc36 + loc32 * loc40 + loc33 * loc44;
+ k = loc31 * loc37 + loc32 * loc41 + loc33 * loc45;
+ l = loc31 * loc38 + loc32 * loc42 + loc33 * loc46 + loc34;
+ }
+
+ public function offset(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ d = param1;
+ h = param2;
+ l = param3;
+ }
+
+ public function getAxis(param1:int, param2:Point3D) : void
+ {
+ switch(param1)
+ {
+ case 0:
+ param2.x = a;
+ param2.y = e;
+ param2.z = i;
+ return;
+ case 1:
+ param2.x = b;
+ param2.y = f;
+ param2.z = j;
+ return;
+ case 2:
+ param2.x = c;
+ param2.y = g;
+ param2.z = k;
+ return;
+ case 3:
+ param2.x = d;
+ param2.y = h;
+ param2.z = l;
+ return;
+ default:
+ return;
+ }
+ }
+
+ public function inverseTransform(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 0, param7:Number = 1, param8:Number = 1, param9:Number = 1) : void
+ {
+ var loc10:Number = Math.cos(param4);
+ var loc11:Number = Math.sin(-param4);
+ var loc12:Number = Math.cos(param5);
+ var loc13:Number = Math.sin(-param5);
+ var loc14:Number = Math.cos(param6);
+ var loc15:Number = Math.sin(-param6);
+ var loc16:Number = loc11 * loc13;
+ var loc17:Number = 1 / param7;
+ var loc18:Number = 1 / param8;
+ var loc19:Number = 1 / param9;
+ var loc20:Number = loc12 * loc17;
+ var loc21:Number = loc10 * loc18;
+ var loc22:Number = loc11 * loc19;
+ var loc23:Number = loc10 * loc19;
+ var loc24:Number = loc14 * loc20;
+ var loc25:Number = -loc15 * loc20;
+ var loc26:Number = loc13 * loc17;
+ var loc27:Number = -(loc24 * param1 + loc25 * param2 + loc26 * param3);
+ var loc28:Number = loc15 * loc21 + loc16 * loc14 * loc18;
+ var loc29:Number = loc14 * loc21 - loc16 * loc15 * loc18;
+ var loc30:Number = -loc11 * loc12 * loc18;
+ var loc31:Number = -(loc28 * param1 + loc29 * param2 + loc30 * param3);
+ var loc32:Number = loc15 * loc22 - loc14 * loc13 * loc23;
+ var loc33:Number = loc14 * loc22 + loc13 * loc15 * loc23;
+ var loc34:Number = loc12 * loc23;
+ var loc35:Number = -(loc32 * param1 + loc33 * param2 + loc34 * param3);
+ var loc36:Number = a;
+ var loc37:Number = b;
+ var loc38:Number = c;
+ var loc39:Number = d;
+ var loc40:Number = e;
+ var loc41:Number = f;
+ var loc42:Number = g;
+ var loc43:Number = h;
+ var loc44:Number = i;
+ var loc45:Number = j;
+ var loc46:Number = k;
+ var loc47:Number = l;
+ a = loc24 * loc36 + loc25 * loc40 + loc26 * loc44;
+ b = loc24 * loc37 + loc25 * loc41 + loc26 * loc45;
+ c = loc24 * loc38 + loc25 * loc42 + loc26 * loc46;
+ d = loc24 * loc39 + loc25 * loc43 + loc26 * loc47 + loc27;
+ e = loc28 * loc36 + loc29 * loc40 + loc30 * loc44;
+ f = loc28 * loc37 + loc29 * loc41 + loc30 * loc45;
+ g = loc28 * loc38 + loc29 * loc42 + loc30 * loc46;
+ h = loc28 * loc39 + loc29 * loc43 + loc30 * loc47 + loc31;
+ i = loc32 * loc36 + loc33 * loc40 + loc34 * loc44;
+ j = loc32 * loc37 + loc33 * loc41 + loc34 * loc45;
+ k = loc32 * loc38 + loc33 * loc42 + loc34 * loc46;
+ l = loc32 * loc39 + loc33 * loc43 + loc34 * loc47 + loc35;
+ }
+
+ public function add(param1:Matrix3D) : void
+ {
+ a += param1.a;
+ b += param1.b;
+ c += param1.c;
+ d += param1.d;
+ e += param1.e;
+ f += param1.f;
+ g += param1.g;
+ h += param1.h;
+ i += param1.i;
+ j += param1.j;
+ k += param1.k;
+ l += param1.l;
+ }
+
+ public function fromAxisAngle(param1:Point3D, param2:Number = 0) : void
+ {
+ var loc3:Number = Math.cos(param2);
+ var loc4:Number = Math.sin(param2);
+ var loc5:Number = 1 - loc3;
+ var loc6:Number = param1.x;
+ var loc7:Number = param1.y;
+ var loc8:Number = param1.z;
+ a = loc5 * loc6 * loc6 + loc3;
+ b = loc5 * loc6 * loc7 - loc8 * loc4;
+ c = loc5 * loc6 * loc8 + loc7 * loc4;
+ d = 0;
+ e = loc5 * loc6 * loc7 + loc8 * loc4;
+ f = loc5 * loc7 * loc7 + loc3;
+ g = loc5 * loc7 * loc8 - loc6 * loc4;
+ h = 0;
+ i = loc5 * loc6 * loc8 - loc7 * loc4;
+ j = loc5 * loc7 * loc8 + loc6 * loc4;
+ k = loc5 * loc8 * loc8 + loc3;
+ l = 0;
+ }
+
+ public function inverseRotate(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ var loc4:Number = Math.cos(param1);
+ var loc5:Number = Math.sin(-param1);
+ var loc6:Number = Math.cos(param2);
+ var loc7:Number = Math.sin(-param2);
+ var loc8:Number = Math.cos(param3);
+ var loc9:Number = Math.sin(-param3);
+ var loc10:Number = loc5 * loc7;
+ var loc11:Number = loc6 * loc8;
+ var loc12:Number = -loc6 * loc9;
+ var loc13:Number = loc7;
+ var loc14:Number = loc4 * loc9 + loc10 * loc8;
+ var loc15:Number = loc4 * loc8 - loc10 * loc9;
+ var loc16:Number = -loc5 * loc6;
+ var loc17:Number = loc5 * loc9 - loc4 * loc8 * loc7;
+ var loc18:Number = loc5 * loc8 + loc4 * loc7 * loc9;
+ var loc19:Number = loc4 * loc6;
+ var loc20:Number = a;
+ var loc21:Number = b;
+ var loc22:Number = c;
+ var loc23:Number = d;
+ var loc24:Number = e;
+ var loc25:Number = f;
+ var loc26:Number = g;
+ var loc27:Number = h;
+ var loc28:Number = i;
+ var loc29:Number = j;
+ var loc30:Number = k;
+ var loc31:Number = l;
+ a = loc11 * loc20 + loc12 * loc24 + loc13 * loc28;
+ b = loc11 * loc21 + loc12 * loc25 + loc13 * loc29;
+ c = loc11 * loc22 + loc12 * loc26 + loc13 * loc30;
+ d = loc11 * loc23 + loc12 * loc27 + loc13 * loc31;
+ e = loc14 * loc20 + loc15 * loc24 + loc16 * loc28;
+ f = loc14 * loc21 + loc15 * loc25 + loc16 * loc29;
+ g = loc14 * loc22 + loc15 * loc26 + loc16 * loc30;
+ h = loc14 * loc23 + loc15 * loc27 + loc16 * loc31;
+ i = loc17 * loc20 + loc18 * loc24 + loc19 * loc28;
+ j = loc17 * loc21 + loc18 * loc25 + loc19 * loc29;
+ k = loc17 * loc22 + loc18 * loc26 + loc19 * loc30;
+ l = loc17 * loc23 + loc18 * loc27 + loc19 * loc31;
+ }
+
+ public function toTransform(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 0, param7:Number = 1, param8:Number = 1, param9:Number = 1) : void
+ {
+ var loc10:Number = Math.cos(param4);
+ var loc11:Number = Math.sin(param4);
+ var loc12:Number = Math.cos(param5);
+ var loc13:Number = Math.sin(param5);
+ var loc14:Number = Math.cos(param6);
+ var loc15:Number = Math.sin(param6);
+ var loc16:Number = loc14 * loc13;
+ var loc17:Number = loc15 * loc13;
+ var loc18:Number = loc12 * param7;
+ var loc19:Number = loc11 * param8;
+ var loc20:Number = loc10 * param8;
+ var loc21:Number = loc10 * param9;
+ var loc22:Number = loc11 * param9;
+ a = loc14 * loc18;
+ b = loc16 * loc19 - loc15 * loc20;
+ c = loc16 * loc21 + loc15 * loc22;
+ d = param1;
+ e = loc15 * loc18;
+ f = loc17 * loc19 + loc14 * loc20;
+ g = loc17 * loc21 - loc14 * loc22;
+ h = param2;
+ i = -loc13 * param7;
+ j = loc12 * loc19;
+ k = loc12 * loc21;
+ l = param3;
+ }
+
+ public function transpose() : void
+ {
+ var loc1:Number = b;
+ b = e;
+ e = loc1;
+ loc1 = c;
+ c = i;
+ i = loc1;
+ loc1 = g;
+ g = j;
+ j = loc1;
+ }
+
+ public function translateLocal(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ d += a * param1 + b * param2 + c * param3;
+ h += e * param1 + f * param2 + g * param3;
+ l += i * param1 + j * param2 + k * param3;
+ }
+
+ public function equals(param1:Matrix3D, param2:Number = 0) : Boolean
+ {
+ var loc3:Number = a - param1.a;
+ var loc4:Number = b - param1.b;
+ var loc5:Number = c - param1.c;
+ var loc6:Number = d - param1.d;
+ var loc7:Number = e - param1.e;
+ var loc8:Number = f - param1.f;
+ var loc9:Number = g - param1.g;
+ var loc10:Number = h - param1.h;
+ var loc11:Number = i - param1.i;
+ var loc12:Number = j - param1.j;
+ var loc13:Number = k - param1.k;
+ var loc14:Number = l - param1.l;
+ loc3 = loc3 < 0 ? -loc3 : loc3;
+ loc4 = loc4 < 0 ? -loc4 : loc4;
+ loc5 = loc5 < 0 ? -loc5 : loc5;
+ loc6 = loc6 < 0 ? -loc6 : loc6;
+ loc7 = loc7 < 0 ? -loc7 : loc7;
+ loc8 = loc8 < 0 ? -loc8 : loc8;
+ loc9 = loc9 < 0 ? -loc9 : loc9;
+ loc10 = loc10 < 0 ? -loc10 : loc10;
+ loc11 = loc11 < 0 ? -loc11 : loc11;
+ loc12 = loc12 < 0 ? -loc12 : loc12;
+ loc13 = loc13 < 0 ? -loc13 : loc13;
+ loc14 = loc14 < 0 ? -loc14 : loc14;
+ return loc3 <= param2 && loc4 <= param2 && loc5 <= param2 && loc6 <= param2 && loc7 <= param2 && loc8 <= param2 && loc9 <= param2 && loc10 <= param2 && loc11 <= param2 && loc12 <= param2 && loc13 <= param2 && loc14 <= param2;
+ }
+
+ public function scale(param1:Number = 1, param2:Number = 1, param3:Number = 1) : void
+ {
+ a *= param1;
+ b *= param1;
+ c *= param1;
+ d *= param1;
+ e *= param2;
+ f *= param2;
+ g *= param2;
+ h *= param2;
+ i *= param3;
+ j *= param3;
+ k *= param3;
+ l *= param3;
+ }
+
+ public function translate(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ d += param1;
+ h += param2;
+ l += param3;
+ }
+
+ public function combine(param1:Matrix3D) : void
+ {
+ var loc2:Number = a;
+ var loc3:Number = b;
+ var loc4:Number = c;
+ var loc5:Number = d;
+ var loc6:Number = e;
+ var loc7:Number = f;
+ var loc8:Number = g;
+ var loc9:Number = h;
+ var loc10:Number = i;
+ var loc11:Number = j;
+ var loc12:Number = k;
+ var loc13:Number = l;
+ a = param1.a * loc2 + param1.b * loc6 + param1.c * loc10;
+ b = param1.a * loc3 + param1.b * loc7 + param1.c * loc11;
+ c = param1.a * loc4 + param1.b * loc8 + param1.c * loc12;
+ d = param1.a * loc5 + param1.b * loc9 + param1.c * loc13 + param1.d;
+ e = param1.e * loc2 + param1.f * loc6 + param1.g * loc10;
+ f = param1.e * loc3 + param1.f * loc7 + param1.g * loc11;
+ g = param1.e * loc4 + param1.f * loc8 + param1.g * loc12;
+ h = param1.e * loc5 + param1.f * loc9 + param1.g * loc13 + param1.h;
+ i = param1.i * loc2 + param1.j * loc6 + param1.k * loc10;
+ j = param1.i * loc3 + param1.j * loc7 + param1.k * loc11;
+ k = param1.i * loc4 + param1.j * loc8 + param1.k * loc12;
+ l = param1.i * loc5 + param1.j * loc9 + param1.k * loc13 + param1.l;
+ }
+
+ public function toIdentity() : void
+ {
+ a = f = k = 1;
+ b = c = d = e = g = h = i = j = l = 0;
+ }
+
+ public function rotate(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ var loc4:Number = Math.cos(param1);
+ var loc5:Number = Math.sin(param1);
+ var loc6:Number = Math.cos(param2);
+ var loc7:Number = Math.sin(param2);
+ var loc8:Number = Math.cos(param3);
+ var loc9:Number = Math.sin(param3);
+ var loc10:Number = loc8 * loc7;
+ var loc11:Number = loc9 * loc7;
+ var loc12:Number = loc8 * loc6;
+ var loc13:Number = loc10 * loc5 - loc9 * loc4;
+ var loc14:Number = loc10 * loc4 + loc9 * loc5;
+ var loc15:Number = loc9 * loc6;
+ var loc16:Number = loc11 * loc5 + loc8 * loc4;
+ var loc17:Number = loc11 * loc4 - loc8 * loc5;
+ var loc18:Number = -loc7;
+ var loc19:Number = loc6 * loc5;
+ var loc20:Number = loc6 * loc4;
+ var loc21:Number = a;
+ var loc22:Number = b;
+ var loc23:Number = c;
+ var loc24:Number = d;
+ var loc25:Number = e;
+ var loc26:Number = f;
+ var loc27:Number = g;
+ var loc28:Number = h;
+ var loc29:Number = i;
+ var loc30:Number = j;
+ var loc31:Number = k;
+ var loc32:Number = l;
+ a = loc12 * loc21 + loc13 * loc25 + loc14 * loc29;
+ b = loc12 * loc22 + loc13 * loc26 + loc14 * loc30;
+ c = loc12 * loc23 + loc13 * loc27 + loc14 * loc31;
+ d = loc12 * loc24 + loc13 * loc28 + loc14 * loc32;
+ e = loc15 * loc21 + loc16 * loc25 + loc17 * loc29;
+ f = loc15 * loc22 + loc16 * loc26 + loc17 * loc30;
+ g = loc15 * loc23 + loc16 * loc27 + loc17 * loc31;
+ h = loc15 * loc24 + loc16 * loc28 + loc17 * loc32;
+ i = loc18 * loc21 + loc19 * loc25 + loc20 * loc29;
+ j = loc18 * loc22 + loc19 * loc26 + loc20 * loc30;
+ k = loc18 * loc23 + loc19 * loc27 + loc20 * loc31;
+ l = loc18 * loc24 + loc19 * loc28 + loc20 * loc32;
+ }
+
+ public function clone() : Matrix3D
+ {
+ return new Matrix3D(a,b,c,d,e,f,g,h,i,j,k,l);
+ }
+
+ public function invert() : void
+ {
+ var loc1:Number = a;
+ var loc2:Number = b;
+ var loc3:Number = c;
+ var loc4:Number = d;
+ var loc5:Number = e;
+ var loc6:Number = f;
+ var loc7:Number = g;
+ var loc8:Number = h;
+ var loc9:Number = i;
+ var loc10:Number = j;
+ var loc11:Number = k;
+ var loc12:Number = l;
+ var loc13:Number = -loc3 * loc6 * loc9 + loc2 * loc7 * loc9 + loc3 * loc5 * loc10 - loc1 * loc7 * loc10 - loc2 * loc5 * loc11 + loc1 * loc6 * loc11;
+ a = (-loc7 * loc10 + loc6 * loc11) / loc13;
+ b = (loc3 * loc10 - loc2 * loc11) / loc13;
+ c = (-loc3 * loc6 + loc2 * loc7) / loc13;
+ d = (loc4 * loc7 * loc10 - loc3 * loc8 * loc10 - loc4 * loc6 * loc11 + loc2 * loc8 * loc11 + loc3 * loc6 * loc12 - loc2 * loc7 * loc12) / loc13;
+ e = (loc7 * loc9 - loc5 * loc11) / loc13;
+ f = (-loc3 * loc9 + loc1 * loc11) / loc13;
+ g = (loc3 * loc5 - loc1 * loc7) / loc13;
+ h = (loc3 * loc8 * loc9 - loc4 * loc7 * loc9 + loc4 * loc5 * loc11 - loc1 * loc8 * loc11 - loc3 * loc5 * loc12 + loc1 * loc7 * loc12) / loc13;
+ i = (-loc6 * loc9 + loc5 * loc10) / loc13;
+ j = (loc2 * loc9 - loc1 * loc10) / loc13;
+ k = (-loc2 * loc5 + loc1 * loc6) / loc13;
+ l = (loc4 * loc6 * loc9 - loc2 * loc8 * loc9 - loc4 * loc5 * loc10 + loc1 * loc8 * loc10 + loc2 * loc5 * loc12 - loc1 * loc6 * loc12) / loc13;
+ }
+
+ public function toString() : String
+ {
+ return "[Matrix3D " + "[" + a.toFixed(3) + " " + b.toFixed(3) + " " + c.toFixed(3) + " " + d.toFixed(3) + "] [" + e.toFixed(3) + " " + f.toFixed(3) + " " + g.toFixed(3) + " " + h.toFixed(3) + "] [" + i.toFixed(3) + " " + j.toFixed(3) + " " + k.toFixed(3) + " " + l.toFixed(3) + "]]";
+ }
+
+ public function inverseCombine(param1:Matrix3D) : void
+ {
+ var loc2:Number = a;
+ var loc3:Number = b;
+ var loc4:Number = c;
+ var loc5:Number = d;
+ var loc6:Number = e;
+ var loc7:Number = f;
+ var loc8:Number = g;
+ var loc9:Number = h;
+ var loc10:Number = i;
+ var loc11:Number = j;
+ var loc12:Number = k;
+ var loc13:Number = l;
+ a = loc2 * param1.a + loc3 * param1.e + loc4 * param1.i;
+ b = loc2 * param1.b + loc3 * param1.f + loc4 * param1.j;
+ c = loc2 * param1.c + loc3 * param1.g + loc4 * param1.k;
+ d = loc2 * param1.d + loc3 * param1.h + loc4 * param1.l + loc5;
+ e = loc6 * param1.a + loc7 * param1.e + loc8 * param1.i;
+ f = loc6 * param1.b + loc7 * param1.f + loc8 * param1.j;
+ g = loc6 * param1.c + loc7 * param1.g + loc8 * param1.k;
+ h = loc6 * param1.d + loc7 * param1.h + loc8 * param1.l + loc9;
+ i = loc10 * param1.a + loc11 * param1.e + loc12 * param1.i;
+ j = loc10 * param1.b + loc11 * param1.f + loc12 * param1.j;
+ k = loc10 * param1.c + loc11 * param1.g + loc12 * param1.k;
+ l = loc10 * param1.d + loc11 * param1.h + loc12 * param1.l + loc13;
+ }
+
+ public function setVectors(param1:Point3D, param2:Point3D, param3:Point3D, param4:Point3D) : void
+ {
+ a = param1.x;
+ e = param1.y;
+ i = param1.z;
+ b = param2.x;
+ f = param2.y;
+ j = param2.z;
+ c = param3.x;
+ g = param3.y;
+ k = param3.z;
+ d = param4.x;
+ h = param4.y;
+ l = param4.z;
+ }
+
+ public function multByScalar(param1:Number) : void
+ {
+ a *= param1;
+ b *= param1;
+ c *= param1;
+ d *= param1;
+ e *= param1;
+ f *= param1;
+ g *= param1;
+ h *= param1;
+ i *= param1;
+ j *= param1;
+ k *= param1;
+ l *= param1;
+ }
+
+ public function copy(param1:Matrix3D) : void
+ {
+ a = param1.a;
+ b = param1.b;
+ c = param1.c;
+ d = param1.d;
+ e = param1.e;
+ f = param1.f;
+ g = param1.g;
+ h = param1.h;
+ i = param1.i;
+ j = param1.j;
+ k = param1.k;
+ l = param1.l;
+ }
+
+ public function deltaTransformVector(param1:Point3D, param2:Point3D) : void
+ {
+ param2.x = a * param1.x + b * param1.y + c * param1.z + d;
+ param2.y = e * param1.x + f * param1.y + g * param1.z + h;
+ param2.z = i * param1.x + j * param1.y + k * param1.z + l;
+ }
+
+ public function inverseScale(param1:Number = 1, param2:Number = 1, param3:Number = 1) : void
+ {
+ var loc4:Number = 1 / param1;
+ var loc5:Number = 1 / param2;
+ var loc6:Number = 1 / param3;
+ a *= loc4;
+ b *= loc4;
+ c *= loc4;
+ d *= loc4;
+ e *= loc5;
+ f *= loc5;
+ g *= loc5;
+ h *= loc5;
+ i *= loc6;
+ j *= loc6;
+ k *= loc6;
+ l *= loc6;
+ }
+
+ public function inverseTranslate(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ d -= param1;
+ h -= param2;
+ l -= param3;
+ }
+
+ public function getRotations(param1:Point3D = null) : Point3D
+ {
+ if(param1 == null)
+ {
+ param1 = new Point3D();
+ }
+ if(-1 < i && i < 1)
+ {
+ param1.x = Math.atan2(j,k);
+ param1.y = -Math.asin(i);
+ param1.z = Math.atan2(e,a);
+ }
+ else
+ {
+ param1.x = 0;
+ param1.y = 0.5 * (i <= -1 ? Math.PI : -Math.PI);
+ param1.z = Math.atan2(-b,f);
+ }
+ return param1;
+ }
+ }
+}
+
diff --git a/src/alternativa/types/Point3D.as b/src/alternativa/types/Point3D.as
new file mode 100644
index 0000000..1683f66
--- /dev/null
+++ b/src/alternativa/types/Point3D.as
@@ -0,0 +1,297 @@
+package alternativa.types
+{
+ import flash.geom.Point;
+
+ public final class Point3D
+ {
+ public var z:Number;
+
+ public var x:Number;
+
+ public var y:Number;
+
+ public function Point3D(param1:Number = 0, param2:Number = 0, param3:Number = 0)
+ {
+ super();
+ this.x = param1;
+ this.y = param2;
+ this.z = param3;
+ }
+
+ public static function cross(param1:Point3D, param2:Point3D) : Point3D
+ {
+ return new Point3D(param1.y * param2.z - param1.z * param2.y,param1.z * param2.x - param1.x * param2.z,param1.x * param2.y - param1.y * param2.x);
+ }
+
+ public static function cross2D(param1:Point3D, param2:Point3D) : Number
+ {
+ return param1.x * param2.y - param1.y * param2.x;
+ }
+
+ public static function angle(param1:Point3D, param2:Point3D) : Number
+ {
+ var loc3:Number = Math.sqrt((param1.x * param1.x + param1.y * param1.y + param1.z * param1.z) * (param2.x * param2.x + param2.y * param2.y + param2.z * param2.z));
+ var loc4:Number = loc3 != 0 ? dot(param1,param2) / loc3 : 1;
+ return Math.acos(loc4);
+ }
+
+ public static function average(param1:Point3D, param2:Point3D = null, param3:Point3D = null, param4:Point3D = null) : Point3D
+ {
+ if(param2 == null)
+ {
+ return param1.clone();
+ }
+ if(param3 == null)
+ {
+ return new Point3D((param1.x + param2.x) * 0.5,(param1.y + param2.y) * 0.5,(param1.z + param2.z) * 0.5);
+ }
+ if(param4 == null)
+ {
+ return new Point3D((param1.x + param2.x + param3.x) / 3,(param1.y + param2.y + param3.y) / 3,(param1.z + param2.z + param3.z) / 3);
+ }
+ return new Point3D((param1.x + param2.x + param3.x + param4.x) * 0.25,(param1.y + param2.y + param3.y + param4.y) * 0.25,(param1.z + param2.z + param3.z + param4.z) / 0.25);
+ }
+
+ public static function random(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Number = 0, param6:Number = 0) : Point3D
+ {
+ return new Point3D(param1 + Math.random() * (param2 - param1),param3 + Math.random() * (param4 - param3),param5 + Math.random() * (param6 - param5));
+ }
+
+ public static function interpolate(param1:Point3D, param2:Point3D, param3:Number = 0.5) : Point3D
+ {
+ return new Point3D(param1.x + (param2.x - param1.x) * param3,param1.y + (param2.y - param1.y) * param3,param1.z + (param2.z - param1.z) * param3);
+ }
+
+ public static function dot(param1:Point3D, param2:Point3D) : Number
+ {
+ return param1.x * param2.x + param1.y * param2.y + param1.z * param2.z;
+ }
+
+ public static function sum(param1:Point3D, param2:Point3D) : Point3D
+ {
+ return new Point3D(param1.x + param2.x,param1.y + param2.y,param1.z + param2.z);
+ }
+
+ public static function dot2D(param1:Point3D, param2:Point3D) : Number
+ {
+ return param1.x * param2.x + param1.y * param2.y;
+ }
+
+ public static function difference(param1:Point3D, param2:Point3D) : Point3D
+ {
+ return new Point3D(param1.x - param2.x,param1.y - param2.y,param1.z - param2.z);
+ }
+
+ public static function angleFast(param1:Point3D, param2:Point3D) : Number
+ {
+ var loc3:Number = dot(param1,param2);
+ if(Math.abs(loc3) > 1)
+ {
+ loc3 = loc3 > 0 ? 1 : -1;
+ }
+ return Math.acos(loc3);
+ }
+
+ public function cross(param1:Point3D) : void
+ {
+ var loc2:Number = y * param1.z - z * param1.y;
+ var loc3:Number = z * param1.x - x * param1.z;
+ var loc4:Number = x * param1.y - y * param1.x;
+ x = loc2;
+ y = loc3;
+ z = loc4;
+ }
+
+ public function transformOrientation(param1:Matrix3D) : void
+ {
+ var loc2:Number = x;
+ var loc3:Number = y;
+ var loc4:Number = z;
+ x = param1.a * loc2 + param1.b * loc3 + param1.c * loc4;
+ y = param1.e * loc2 + param1.f * loc3 + param1.g * loc4;
+ z = param1.i * loc2 + param1.j * loc3 + param1.k * loc4;
+ }
+
+ public function dot(param1:Point3D) : Number
+ {
+ return x * param1.x + y * param1.y + z * param1.z;
+ }
+
+ public function cross2(param1:Point3D, param2:Point3D) : void
+ {
+ x = param1.y * param2.z - param1.z * param2.y;
+ y = param1.z * param2.x - param1.x * param2.z;
+ z = param1.x * param2.y - param1.y * param2.x;
+ }
+
+ public function floor() : void
+ {
+ x = Math.floor(x);
+ y = Math.floor(y);
+ z = Math.floor(z);
+ }
+
+ public function normalize() : void
+ {
+ var loc1:Number = NaN;
+ if(x != 0 || y != 0 || z != 0)
+ {
+ loc1 = Math.sqrt(x * x + y * y + z * z);
+ x /= loc1;
+ y /= loc1;
+ z /= loc1;
+ }
+ else
+ {
+ z = 1;
+ }
+ }
+
+ public function get lengthSqr() : Number
+ {
+ return x * x + y * y + z * z;
+ }
+
+ public function reset(param1:Number = 0, param2:Number = 0, param3:Number = 0) : void
+ {
+ this.x = param1;
+ this.y = param2;
+ this.z = param3;
+ }
+
+ public function createSkewSymmetricMatrix(param1:Matrix3D) : void
+ {
+ param1.a = param1.f = param1.k = param1.d = param1.h = param1.l = 0;
+ param1.b = -z;
+ param1.c = y;
+ param1.e = z;
+ param1.g = -x;
+ param1.i = -y;
+ param1.j = x;
+ }
+
+ public function set length(param1:Number) : void
+ {
+ var loc2:Number = NaN;
+ if(x != 0 || y != 0 || z != 0)
+ {
+ loc2 = param1 / length;
+ x *= loc2;
+ y *= loc2;
+ z *= loc2;
+ }
+ else
+ {
+ z = param1;
+ }
+ }
+
+ public function subtract(param1:Point3D) : void
+ {
+ x -= param1.x;
+ y -= param1.y;
+ z -= param1.z;
+ }
+
+ public function toPoint() : Point
+ {
+ return new Point(x,y);
+ }
+
+ public function invert() : void
+ {
+ x = -x;
+ y = -y;
+ z = -z;
+ }
+
+ public function inverseTransform(param1:Matrix3D) : void
+ {
+ x -= param1.d;
+ y -= param1.h;
+ z -= param1.l;
+ var loc2:Number = x * param1.a + y * param1.e + z * param1.i;
+ var loc3:Number = x * param1.b + y * param1.f + z * param1.j;
+ var loc4:Number = x * param1.c + y * param1.g + z * param1.k;
+ x = loc2;
+ y = loc3;
+ z = loc4;
+ }
+
+ public function clone() : Point3D
+ {
+ return new Point3D(x,y,z);
+ }
+
+ public function add(param1:Point3D) : void
+ {
+ x += param1.x;
+ y += param1.y;
+ z += param1.z;
+ }
+
+ public function multiply(param1:Number) : void
+ {
+ x *= param1;
+ y *= param1;
+ z *= param1;
+ }
+
+ public function get length() : Number
+ {
+ return Math.sqrt(x * x + y * y + z * z);
+ }
+
+ public function toString() : String
+ {
+ return "[Point3D X: " + x.toFixed(3) + " Y:" + y.toFixed(3) + " Z:" + z.toFixed(3) + "]";
+ }
+
+ public function transformTranspose(param1:Matrix3D) : void
+ {
+ var loc2:Number = x * param1.a + y * param1.e + z * param1.i;
+ var loc3:Number = x * param1.b + y * param1.f + z * param1.j;
+ var loc4:Number = x * param1.c + y * param1.g + z * param1.k;
+ x = loc2;
+ y = loc3;
+ z = loc4;
+ }
+
+ public function transform(param1:Matrix3D) : void
+ {
+ var loc2:Number = x;
+ var loc3:Number = y;
+ var loc4:Number = z;
+ x = param1.a * loc2 + param1.b * loc3 + param1.c * loc4 + param1.d;
+ y = param1.e * loc2 + param1.f * loc3 + param1.g * loc4 + param1.h;
+ z = param1.i * loc2 + param1.j * loc3 + param1.k * loc4 + param1.l;
+ }
+
+ public function copy(param1:Point3D) : void
+ {
+ x = param1.x;
+ y = param1.y;
+ z = param1.z;
+ }
+
+ public function round() : void
+ {
+ x = Math.round(x);
+ y = Math.round(y);
+ z = Math.round(z);
+ }
+
+ public function difference(param1:Point3D, param2:Point3D) : void
+ {
+ x = param1.x - param2.x;
+ y = param1.y - param2.y;
+ z = param1.z - param2.z;
+ }
+
+ public function equals(param1:Point3D, param2:Number = 0) : Boolean
+ {
+ return x - param1.x <= param2 && x - param1.x >= -param2 && y - param1.y <= param2 && y - param1.y >= -param2 && z - param1.z <= param2 && z - param1.z >= -param2;
+ }
+ }
+}
+
diff --git a/src/alternativa/types/Set.as b/src/alternativa/types/Set.as
new file mode 100644
index 0000000..2bdee0d
--- /dev/null
+++ b/src/alternativa/types/Set.as
@@ -0,0 +1,241 @@
+package alternativa.types
+{
+ import flash.utils.Dictionary;
+
+ public final dynamic class Set extends Dictionary
+ {
+ private var weakKeys:Boolean;
+
+ public function Set(param1:Boolean = false)
+ {
+ this.weakKeys = param1;
+ super(param1);
+ }
+
+ public static function intersection(param1:Set, param2:Set, param3:Boolean = false) : Set
+ {
+ var loc5:* = undefined;
+ var loc4:Set = new Set(param3);
+ for(loc5 in param1)
+ {
+ if(param2[loc5])
+ {
+ loc4[loc5] = true;
+ }
+ }
+ return loc4;
+ }
+
+ public static function createFromArray(param1:Array, param2:Boolean = false) : Set
+ {
+ var loc4:* = undefined;
+ var loc3:Set = new Set(param2);
+ for each(loc4 in param1)
+ {
+ loc3[loc4] = true;
+ }
+ return loc3;
+ }
+
+ public static function difference(param1:Set, param2:Set, param3:Boolean = false) : Set
+ {
+ var loc5:* = undefined;
+ var loc4:Set = new Set(param3);
+ for(loc5 in param1)
+ {
+ if(!param2[loc5])
+ {
+ loc4[loc5] = true;
+ }
+ }
+ return loc4;
+ }
+
+ public static function union(param1:Set, param2:Set, param3:Boolean = false) : Set
+ {
+ var loc5:* = undefined;
+ var loc4:Set = new Set(param3);
+ for(loc5 in param1)
+ {
+ loc4[loc5] = true;
+ }
+ for(loc5 in param2)
+ {
+ loc4[loc5] = true;
+ }
+ return loc4;
+ }
+
+ public function add(param1:*) : void
+ {
+ this[param1] = true;
+ }
+
+ public function isEmpty() : Boolean
+ {
+ var loc1:* = undefined;
+ var loc2:int = 0;
+ var loc3:* = this;
+ for(loc1 in loc3)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public function remove(param1:*) : void
+ {
+ delete this[param1];
+ }
+
+ public function get length() : uint
+ {
+ var loc2:* = undefined;
+ var loc1:uint = 0;
+ for(loc2 in this)
+ {
+ loc1++;
+ }
+ return loc1;
+ }
+
+ public function take() : *
+ {
+ var loc1:* = undefined;
+ var loc2:int = 0;
+ var loc3:* = this;
+ for(loc1 in loc3)
+ {
+ delete this[loc1];
+ return loc1;
+ }
+ return null;
+ }
+
+ public function clear() : void
+ {
+ var loc1:* = undefined;
+ for(loc1 in this)
+ {
+ delete this[loc1];
+ }
+ }
+
+ public function any() : *
+ {
+ var loc3:* = undefined;
+ var loc1:uint = 0;
+ var loc2:uint = Math.random() * length;
+ for(loc3 in this)
+ {
+ if(loc1 == loc2)
+ {
+ return loc3;
+ }
+ loc1++;
+ }
+ return null;
+ }
+
+ public function isSingle() : Boolean
+ {
+ var loc2:* = undefined;
+ var loc1:Boolean = false;
+ for(loc2 in this)
+ {
+ if(loc1)
+ {
+ return false;
+ }
+ loc1 = true;
+ }
+ return loc1;
+ }
+
+ public function concat(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ for(loc2 in param1)
+ {
+ this[loc2] = true;
+ }
+ }
+
+ public function subtract(param1:Set) : void
+ {
+ var loc2:* = undefined;
+ for(loc2 in param1)
+ {
+ delete this[loc2];
+ }
+ }
+
+ public function toString() : String
+ {
+ var loc3:* = undefined;
+ var loc1:int = 0;
+ var loc2:String = "";
+ for(loc3 in this)
+ {
+ loc2 += "," + loc3;
+ loc1++;
+ }
+ return "[Set length:" + loc1 + (loc1 > 0 ? " " + loc2.substring(1) : "") + "]";
+ }
+
+ public function has(param1:*) : Boolean
+ {
+ return this[param1];
+ }
+
+ public function peek() : *
+ {
+ var loc1:* = undefined;
+ var loc2:int = 0;
+ var loc3:* = this;
+ for(loc1 in loc3)
+ {
+ return loc1;
+ }
+ return null;
+ }
+
+ public function clone() : Set
+ {
+ var loc2:* = undefined;
+ var loc1:Set = new Set(weakKeys);
+ for(loc2 in this)
+ {
+ loc1[loc2] = true;
+ }
+ return loc1;
+ }
+
+ public function toArray() : Array
+ {
+ var loc2:* = undefined;
+ var loc1:Array = new Array();
+ for(loc2 in this)
+ {
+ loc1.push(loc2);
+ }
+ return loc1;
+ }
+
+ public function intersect(param1:Set) : void
+ {
+ var loc3:* = undefined;
+ var loc2:Set = new Set(true);
+ for(loc3 in this)
+ {
+ if(param1[loc3])
+ {
+ loc2[loc3] = true;
+ }
+ delete this[loc3];
+ }
+ concat(loc2);
+ }
+ }
+}
+
diff --git a/src/alternativa/types/Texture.as b/src/alternativa/types/Texture.as
new file mode 100644
index 0000000..46c0d0b
--- /dev/null
+++ b/src/alternativa/types/Texture.as
@@ -0,0 +1,56 @@
+package alternativa.types
+{
+ import flash.display.BitmapData;
+
+ use namespace alternativatypes;
+
+ public class Texture
+ {
+ alternativatypes var _height:uint;
+
+ alternativatypes var _width:uint;
+
+ alternativatypes var _name:String;
+
+ alternativatypes var _bitmapData:BitmapData;
+
+ public function Texture(param1:BitmapData, param2:String = null)
+ {
+ super();
+ if(param1 == null)
+ {
+ throw new Error("Cannot create texture from null bitmapData");
+ }
+ alternativatypes::_bitmapData = param1;
+ alternativatypes::_width = param1.width;
+ alternativatypes::_height = param1.height;
+ alternativatypes::_name = param2;
+ }
+
+ public function get name() : String
+ {
+ return alternativatypes::_name;
+ }
+
+ public function get width() : uint
+ {
+ return alternativatypes::_width;
+ }
+
+ public function get height() : uint
+ {
+ return alternativatypes::_height;
+ }
+
+ public function get bitmapData() : BitmapData
+ {
+ return alternativatypes::_bitmapData;
+ }
+
+ public function toString() : String
+ {
+ return "[Texture " + (alternativatypes::_name != null ? alternativatypes::_name : "") + " " + alternativatypes::_width + "x" + alternativatypes::_height + "]";
+ }
+ }
+}
+
diff --git a/src/alternativa/types/alternativatypes.as b/src/alternativa/types/alternativatypes.as
new file mode 100644
index 0000000..9f716ae
--- /dev/null
+++ b/src/alternativa/types/alternativatypes.as
@@ -0,0 +1,5 @@
+package alternativa.types
+{
+ public namespace alternativatypes = "http://alternativaplatform.com/en/alternativatypes";
+}
+
diff --git a/src/alternativa/utils/ColorUtils.as b/src/alternativa/utils/ColorUtils.as
new file mode 100644
index 0000000..305b07a
--- /dev/null
+++ b/src/alternativa/utils/ColorUtils.as
@@ -0,0 +1,101 @@
+package alternativa.utils
+{
+ public class ColorUtils
+ {
+ public static const BLACK:uint = 0;
+
+ public static const RED:uint = 8323072;
+
+ public static const GREEN:uint = 32512;
+
+ public static const BLUE:uint = 127;
+
+ public static const BROWN:uint = 8355584;
+
+ public static const CYAN:uint = 32639;
+
+ public static const MAGENTA:uint = 8323199;
+
+ public static const GRAY:uint = 8355711;
+
+ public static const LIGHT_RED:uint = 16711680;
+
+ public static const LIGHT_GREEN:uint = 65280;
+
+ public static const LIGHT_BLUE:uint = 255;
+
+ public static const YELLOW:uint = 16776960;
+
+ public static const LIGHT_CYAN:uint = 65535;
+
+ public static const LIGHT_MAGENTA:uint = 16711935;
+
+ public static const WHITE:uint = 16777215;
+
+ public function ColorUtils()
+ {
+ super();
+ }
+
+ public static function interpolate(param1:uint, param2:uint, param3:Number = 0.5) : uint
+ {
+ var loc4:int = (param1 & 0xFF0000) >>> 16;
+ loc4 = loc4 + (((param2 & 0xFF0000) >>> 16) - loc4) * param3;
+ var loc5:int = (param1 & 0xFF00) >>> 8;
+ loc5 = loc5 + (((param2 & 0xFF00) >>> 8) - loc5) * param3;
+ var loc6:* = param1 & 0xFF;
+ loc6 = loc6 + ((param2 & 0xFF) - loc6) * param3;
+ return rgb(loc4,loc5,loc6);
+ }
+
+ public static function random(param1:uint = 0, param2:uint = 255, param3:uint = 0, param4:uint = 255, param5:uint = 0, param6:uint = 255) : uint
+ {
+ return rgb(MathUtils.random(param1,param2),MathUtils.random(param3,param4),MathUtils.random(param5,param6));
+ }
+
+ public static function sum(param1:uint, param2:uint) : uint
+ {
+ var loc3:int = (param1 & 0xFF0000) + (param2 & 0xFF0000);
+ var loc4:int = (param1 & 0xFF00) + (param2 & 0xFF00);
+ var loc5:int = (param1 & 0xFF) + (param2 & 0xFF);
+ return (!!(loc3 >>> 24) ? 16711680 : loc3) + (!!(loc4 >>> 16) ? 65280 : loc4) + (!!(loc5 >>> 8) ? 255 : loc5);
+ }
+
+ public static function red(param1:uint) : uint
+ {
+ return (param1 & 0xFF0000) >>> 16;
+ }
+
+ public static function rgb(param1:int, param2:int, param3:int) : uint
+ {
+ return (param1 < 0 ? 0 : (!!(param1 >>> 8) ? 16711680 : param1 << 16)) + (param2 < 0 ? 0 : (!!(param2 >>> 8) ? 65280 : param2 << 8)) + (param3 < 0 ? 0 : (!!(param3 >>> 8) ? 255 : param3));
+ }
+
+ public static function green(param1:uint) : uint
+ {
+ return (param1 & 0xFF00) >>> 8;
+ }
+
+ public static function multiply(param1:uint, param2:Number) : uint
+ {
+ var loc3:int = ((param1 & 0xFF0000) >>> 16) * param2;
+ var loc4:int = ((param1 & 0xFF00) >>> 8) * param2;
+ var loc5:int = (param1 & 0xFF) * param2;
+ return rgb(loc3,loc4,loc5);
+ }
+
+ public static function blue(param1:uint) : uint
+ {
+ return param1 & 0xFF;
+ }
+
+ public static function difference(param1:uint, param2:uint) : uint
+ {
+ var loc3:int = (param1 & 0xFF0000) - (param2 & 0xFF0000);
+ var loc4:int = (param1 & 0xFF00) - (param2 & 0xFF00);
+ var loc5:int = (param1 & 0xFF) - (param2 & 0xFF);
+ return (loc3 < 0 ? 0 : loc3) + (loc4 < 0 ? 0 : loc4) + (loc5 < 0 ? 0 : loc5);
+ }
+ }
+}
+
diff --git a/src/alternativa/utils/KeyboardUtils.as b/src/alternativa/utils/KeyboardUtils.as
new file mode 100644
index 0000000..2b6b76b
--- /dev/null
+++ b/src/alternativa/utils/KeyboardUtils.as
@@ -0,0 +1,323 @@
+package alternativa.utils
+{
+ import flash.utils.Dictionary;
+
+ public class KeyboardUtils
+ {
+ private static var keyCodeStringRepresentation:Dictionary;
+
+ public static const A:uint = 65;
+
+ public static const B:uint = 66;
+
+ public static const C:uint = 67;
+
+ public static const D:uint = 68;
+
+ public static const E:uint = 69;
+
+ public static const F:uint = 70;
+
+ public static const G:uint = 71;
+
+ public static const H:uint = 72;
+
+ public static const I:uint = 73;
+
+ public static const J:uint = 74;
+
+ public static const K:uint = 75;
+
+ public static const L:uint = 76;
+
+ public static const M:uint = 77;
+
+ public static const N:uint = 78;
+
+ public static const O:uint = 79;
+
+ public static const P:uint = 80;
+
+ public static const Q:uint = 81;
+
+ public static const R:uint = 82;
+
+ public static const S:uint = 83;
+
+ public static const T:uint = 84;
+
+ public static const U:uint = 85;
+
+ public static const V:uint = 86;
+
+ public static const W:uint = 87;
+
+ public static const X:uint = 88;
+
+ public static const Y:uint = 89;
+
+ public static const Z:uint = 90;
+
+ public static const SPACE:uint = 32;
+
+ public static const SEMICOLON:uint = 186;
+
+ public static const COMMA:uint = 188;
+
+ public static const PERIOD:uint = 190;
+
+ public static const SLASH:uint = 191;
+
+ public static const BACKQUOTE:uint = 192;
+
+ public static const LEFTBRACKET:uint = 219;
+
+ public static const BACKSLASH:uint = 220;
+
+ public static const RIGHTBRACKET:uint = 221;
+
+ public static const QUOTE:uint = 222;
+
+ public static const BACKSPACE:uint = 8;
+
+ public static const TAB:uint = 9;
+
+ public static const PAGE_UP:uint = 33;
+
+ public static const PAGE_DOWN:uint = 34;
+
+ public static const END:uint = 35;
+
+ public static const HOME:uint = 36;
+
+ public static const INSERT:uint = 45;
+
+ public static const DELETE:uint = 46;
+
+ public static const NUMBER_0:uint = 48;
+
+ public static const NUMBER_1:uint = 49;
+
+ public static const NUMBER_2:uint = 50;
+
+ public static const NUMBER_3:uint = 51;
+
+ public static const NUMBER_4:uint = 52;
+
+ public static const NUMBER_5:uint = 53;
+
+ public static const NUMBER_6:uint = 54;
+
+ public static const NUMBER_7:uint = 55;
+
+ public static const NUMBER_8:uint = 56;
+
+ public static const NUMBER_9:uint = 57;
+
+ public static const EQUAL:uint = 187;
+
+ public static const MINUS:uint = 189;
+
+ public static const NUMPAD:uint = 21;
+
+ public static const NUMPAD_0:uint = 96;
+
+ public static const NUMPAD_1:uint = 97;
+
+ public static const NUMPAD_2:uint = 98;
+
+ public static const NUMPAD_3:uint = 99;
+
+ public static const NUMPAD_4:uint = 100;
+
+ public static const NUMPAD_5:uint = 101;
+
+ public static const NUMPAD_6:uint = 102;
+
+ public static const NUMPAD_7:uint = 103;
+
+ public static const NUMPAD_8:uint = 104;
+
+ public static const NUMPAD_9:uint = 105;
+
+ public static const NUMPAD_ADD:uint = 107;
+
+ public static const NUMPAD_DECIMAL:uint = 110;
+
+ public static const NUMPAD_DIVIDE:uint = 111;
+
+ public static const NUMPAD_ENTER:uint = 108;
+
+ public static const NUMPAD_MULTIPLY:uint = 106;
+
+ public static const NUMPAD_SUBTRACT:uint = 109;
+
+ public static const ENTER:uint = 13;
+
+ public static const COMMAND:uint = 15;
+
+ public static const SHIFT:uint = 16;
+
+ public static const CONTROL:uint = 17;
+
+ public static const CAPS_LOCK:uint = 20;
+
+ public static const ESCAPE:uint = 27;
+
+ public static const LEFT:uint = 37;
+
+ public static const UP:uint = 38;
+
+ public static const RIGHT:uint = 39;
+
+ public static const DOWN:uint = 40;
+
+ public static const F1:uint = 112;
+
+ public static const F2:uint = 113;
+
+ public static const F3:uint = 114;
+
+ public static const F4:uint = 115;
+
+ public static const F5:uint = 116;
+
+ public static const F6:uint = 117;
+
+ public static const F7:uint = 118;
+
+ public static const F8:uint = 119;
+
+ public static const F9:uint = 120;
+
+ public static const F10:uint = 121;
+
+ public static const F11:uint = 122;
+
+ public static const F12:uint = 123;
+
+ public static const F13:uint = 124;
+
+ public static const F14:uint = 125;
+
+ public static const F15:uint = 126;
+
+ public function KeyboardUtils()
+ {
+ super();
+ }
+
+ private static function fillKeyCodes() : void
+ {
+ keyCodeStringRepresentation = new Dictionary(true);
+ keyCodeStringRepresentation[A] = "A";
+ keyCodeStringRepresentation[B] = "B";
+ keyCodeStringRepresentation[C] = "C";
+ keyCodeStringRepresentation[D] = "D";
+ keyCodeStringRepresentation[E] = "E";
+ keyCodeStringRepresentation[F] = "F";
+ keyCodeStringRepresentation[G] = "G";
+ keyCodeStringRepresentation[H] = "H";
+ keyCodeStringRepresentation[I] = "I";
+ keyCodeStringRepresentation[J] = "J";
+ keyCodeStringRepresentation[K] = "K";
+ keyCodeStringRepresentation[L] = "L";
+ keyCodeStringRepresentation[M] = "M";
+ keyCodeStringRepresentation[N] = "N";
+ keyCodeStringRepresentation[O] = "O";
+ keyCodeStringRepresentation[P] = "P";
+ keyCodeStringRepresentation[Q] = "Q";
+ keyCodeStringRepresentation[R] = "R";
+ keyCodeStringRepresentation[S] = "S";
+ keyCodeStringRepresentation[T] = "T";
+ keyCodeStringRepresentation[U] = "U";
+ keyCodeStringRepresentation[V] = "V";
+ keyCodeStringRepresentation[W] = "W";
+ keyCodeStringRepresentation[X] = "X";
+ keyCodeStringRepresentation[Y] = "Y";
+ keyCodeStringRepresentation[Z] = "Z";
+ keyCodeStringRepresentation[SPACE] = "SPACE";
+ keyCodeStringRepresentation[SEMICOLON] = "SEMICOLON";
+ keyCodeStringRepresentation[COMMA] = "COMMA";
+ keyCodeStringRepresentation[PERIOD] = "PERIOD";
+ keyCodeStringRepresentation[SLASH] = "SLASH";
+ keyCodeStringRepresentation[BACKQUOTE] = "BACK QUOTE";
+ keyCodeStringRepresentation[LEFTBRACKET] = "LEFT BRACKET";
+ keyCodeStringRepresentation[BACKSLASH] = "BACK SLASH";
+ keyCodeStringRepresentation[RIGHTBRACKET] = "RIGHT BRACKET";
+ keyCodeStringRepresentation[QUOTE] = "\'";
+ keyCodeStringRepresentation[BACKSPACE] = "BACKSPACE";
+ keyCodeStringRepresentation[TAB] = "TAB";
+ keyCodeStringRepresentation[PAGE_UP] = "PAGE UP";
+ keyCodeStringRepresentation[PAGE_DOWN] = "PAGE DOWN";
+ keyCodeStringRepresentation[END] = "END";
+ keyCodeStringRepresentation[HOME] = "HOME";
+ keyCodeStringRepresentation[INSERT] = "INSERT";
+ keyCodeStringRepresentation[DELETE] = "DELETE";
+ keyCodeStringRepresentation[NUMBER_0] = "0";
+ keyCodeStringRepresentation[NUMBER_1] = "1";
+ keyCodeStringRepresentation[NUMBER_2] = "2";
+ keyCodeStringRepresentation[NUMBER_3] = "3";
+ keyCodeStringRepresentation[NUMBER_4] = "4";
+ keyCodeStringRepresentation[NUMBER_5] = "5";
+ keyCodeStringRepresentation[NUMBER_6] = "6";
+ keyCodeStringRepresentation[NUMBER_7] = "7";
+ keyCodeStringRepresentation[NUMBER_8] = "8";
+ keyCodeStringRepresentation[NUMBER_9] = "9";
+ keyCodeStringRepresentation[EQUAL] = "EQUAL";
+ keyCodeStringRepresentation[MINUS] = "MINUS";
+ keyCodeStringRepresentation[NUMPAD] = "NUM LOCK";
+ keyCodeStringRepresentation[NUMPAD_0] = "0";
+ keyCodeStringRepresentation[NUMPAD_1] = "1";
+ keyCodeStringRepresentation[NUMPAD_2] = "2";
+ keyCodeStringRepresentation[NUMPAD_3] = "3";
+ keyCodeStringRepresentation[NUMPAD_4] = "4";
+ keyCodeStringRepresentation[NUMPAD_5] = "5";
+ keyCodeStringRepresentation[NUMPAD_6] = "6";
+ keyCodeStringRepresentation[NUMPAD_7] = "7";
+ keyCodeStringRepresentation[NUMPAD_8] = "8";
+ keyCodeStringRepresentation[NUMPAD_9] = "9";
+ keyCodeStringRepresentation[NUMPAD_ADD] = "NUM+";
+ keyCodeStringRepresentation[NUMPAD_DECIMAL] = "NUM DECIMAL";
+ keyCodeStringRepresentation[NUMPAD_DIVIDE] = "NUM DIVIDE";
+ keyCodeStringRepresentation[NUMPAD_ENTER] = "NUMPAD ENTER";
+ keyCodeStringRepresentation[NUMPAD_MULTIPLY] = "NUM MULTIPLY";
+ keyCodeStringRepresentation[NUMPAD_SUBTRACT] = "NUM SUBTRACT";
+ keyCodeStringRepresentation[ENTER] = "ENTER";
+ keyCodeStringRepresentation[COMMAND] = "COMMAND";
+ keyCodeStringRepresentation[SHIFT] = "SHIFT";
+ keyCodeStringRepresentation[CONTROL] = "CONTROL";
+ keyCodeStringRepresentation[CAPS_LOCK] = "CAPS LOCK";
+ keyCodeStringRepresentation[ESCAPE] = "ESCAPE";
+ keyCodeStringRepresentation[LEFT] = "LEFT";
+ keyCodeStringRepresentation[UP] = "UP";
+ keyCodeStringRepresentation[RIGHT] = "RIGHT";
+ keyCodeStringRepresentation[DOWN] = "DOWN";
+ keyCodeStringRepresentation[F1] = "F1";
+ keyCodeStringRepresentation[F2] = "F2";
+ keyCodeStringRepresentation[F3] = "F3";
+ keyCodeStringRepresentation[F4] = "F4";
+ keyCodeStringRepresentation[F5] = "F5";
+ keyCodeStringRepresentation[F6] = "F6";
+ keyCodeStringRepresentation[F7] = "F7";
+ keyCodeStringRepresentation[F8] = "F8";
+ keyCodeStringRepresentation[F9] = "F9";
+ keyCodeStringRepresentation[F10] = "F10";
+ keyCodeStringRepresentation[F11] = "F11";
+ keyCodeStringRepresentation[F12] = "F12";
+ keyCodeStringRepresentation[F13] = "F13";
+ keyCodeStringRepresentation[F14] = "F14";
+ keyCodeStringRepresentation[F15] = "F15";
+ }
+
+ public static function getKeyCodeStringRepresentation(param1:uint) : String
+ {
+ if(keyCodeStringRepresentation == null)
+ {
+ fillKeyCodes();
+ }
+ return keyCodeStringRepresentation[param1];
+ }
+ }
+}
+
diff --git a/src/alternativa/utils/MathUtils.as b/src/alternativa/utils/MathUtils.as
new file mode 100644
index 0000000..0489310
--- /dev/null
+++ b/src/alternativa/utils/MathUtils.as
@@ -0,0 +1,141 @@
+package alternativa.utils
+{
+ import flash.geom.Point;
+
+ public final class MathUtils
+ {
+ private static const toRad:Number = Math.PI / 180;
+
+ private static const toDeg:Number = 180 / Math.PI;
+
+ public static const DEG1:Number = toRad;
+
+ public static const DEG5:Number = Math.PI / 36;
+
+ public static const DEG10:Number = Math.PI / 18;
+
+ public static const DEG30:Number = Math.PI / 6;
+
+ public static const DEG45:Number = Math.PI / 4;
+
+ public static const DEG60:Number = Math.PI / 3;
+
+ public static const DEG90:Number = Math.PI / 2;
+
+ public static const DEG180:Number = Math.PI;
+
+ public static const DEG360:Number = Math.PI + Math.PI;
+
+ public function MathUtils()
+ {
+ super();
+ }
+
+ public static function vectorCross(param1:Point, param2:Point) : Number
+ {
+ return param1.x * param2.y - param1.y * param2.x;
+ }
+
+ public static function segmentDistance(param1:Point, param2:Point, param3:Point) : Number
+ {
+ var loc4:Number = param2.x - param1.x;
+ var loc5:Number = param2.y - param1.y;
+ var loc6:Number = param3.x - param1.x;
+ var loc7:Number = param3.y - param1.y;
+ return (loc4 * loc7 - loc5 * loc6) / Math.sqrt(loc4 * loc4 + loc5 * loc5);
+ }
+
+ public static function vectorAngleFast(param1:Point, param2:Point) : Number
+ {
+ var loc3:Number = vectorDot(param1,param2);
+ if(Math.abs(loc3) > 1)
+ {
+ loc3 = loc3 > 0 ? 1 : -1;
+ }
+ return Math.acos(loc3);
+ }
+
+ public static function randomAngle() : Number
+ {
+ return Math.random() * DEG360;
+ }
+
+ public static function vectorAngle(param1:Point, param2:Point) : Number
+ {
+ var loc3:Number = param1.length * param2.length;
+ var loc4:Number = loc3 != 0 ? vectorDot(param1,param2) / loc3 : 1;
+ return Math.acos(loc4);
+ }
+
+ public static function limitAngle(param1:Number) : Number
+ {
+ var loc2:Number = param1 % DEG360;
+ return loc2 > 0 ? (loc2 > DEG180 ? loc2 - DEG360 : loc2) : (loc2 < -DEG180 ? loc2 + DEG360 : loc2);
+ }
+
+ public static function random(param1:Number = NaN, param2:Number = NaN) : Number
+ {
+ if(isNaN(param1))
+ {
+ return Math.random();
+ }
+ if(isNaN(param2))
+ {
+ return Math.random() * param1;
+ }
+ return Math.random() * (param2 - param1) + param1;
+ }
+
+ public static function vectorDot(param1:Point, param2:Point) : Number
+ {
+ return param1.x * param2.x + param1.y * param2.y;
+ }
+
+ public static function toDegree(param1:Number) : Number
+ {
+ return param1 * toDeg;
+ }
+
+ public static function deltaAngle(param1:Number, param2:Number) : Number
+ {
+ var loc3:Number = param2 - param1;
+ if(loc3 > DEG180)
+ {
+ return loc3 - DEG360;
+ }
+ if(loc3 < -DEG180)
+ {
+ return loc3 + DEG360;
+ }
+ return loc3;
+ }
+
+ public static function toRadian(param1:Number) : Number
+ {
+ return param1 * toRad;
+ }
+
+ public static function triangleHasPoint(param1:Point, param2:Point, param3:Point, param4:Point) : Boolean
+ {
+ if(vectorCross(param3.subtract(param1),param4.subtract(param1)) <= 0)
+ {
+ if(vectorCross(param2.subtract(param3),param4.subtract(param3)) <= 0)
+ {
+ if(vectorCross(param1.subtract(param2),param4.subtract(param2)) <= 0)
+ {
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }
+ return false;
+ }
+
+ public static function equals(param1:Number, param2:Number, param3:Number = 0) : Boolean
+ {
+ return param2 - param1 <= param3 && param2 - param1 >= -param3;
+ }
+ }
+}
+
diff --git a/src/alternativa/utils/ObjectUtils.as b/src/alternativa/utils/ObjectUtils.as
new file mode 100644
index 0000000..a09c309
--- /dev/null
+++ b/src/alternativa/utils/ObjectUtils.as
@@ -0,0 +1,41 @@
+package alternativa.utils
+{
+ import flash.utils.getDefinitionByName;
+ import flash.utils.getQualifiedClassName;
+ import flash.utils.getQualifiedSuperclassName;
+
+ public class ObjectUtils
+ {
+ public function ObjectUtils()
+ {
+ super();
+ }
+
+ public static function getClassTree(param1:*, param2:Class = null) : Array
+ {
+ var loc3:Array = new Array();
+ var loc4:Class = Class(getDefinitionByName(getQualifiedClassName(param1)));
+ param2 = param2 == null ? Object : param2;
+ while(loc4 != param2)
+ {
+ loc3.push(loc4);
+ loc4 = Class(getDefinitionByName(getQualifiedSuperclassName(loc4)));
+ }
+ loc3.push(loc4);
+ return loc3;
+ }
+
+ public static function getClass(param1:*) : Class
+ {
+ return Class(getDefinitionByName(getQualifiedClassName(param1)));
+ }
+
+ public static function getClassName(param1:*) : String
+ {
+ var loc2:String = getQualifiedClassName(param1);
+ var loc3:int = int(loc2.indexOf("::"));
+ return loc3 == -1 ? loc2 : loc2.substring(loc3 + 2);
+ }
+ }
+}
+
diff --git a/src/alternativa/utils/TextUtils.as b/src/alternativa/utils/TextUtils.as
new file mode 100644
index 0000000..ef4c74c
--- /dev/null
+++ b/src/alternativa/utils/TextUtils.as
@@ -0,0 +1,23 @@
+package alternativa.utils
+{
+ public final class TextUtils
+ {
+ public function TextUtils()
+ {
+ super();
+ }
+
+ public static function insertVars(param1:String, ... rest) : String
+ {
+ var loc3:String = param1;
+ var loc4:int = 1;
+ while(loc4 <= rest.length)
+ {
+ loc3 = loc3.replace("%" + loc4.toString(),rest[loc4 - 1]);
+ loc4++;
+ }
+ return loc3;
+ }
+ }
+}
+
diff --git a/src/en_US$collections_properties.as b/src/en_US$collections_properties.as
new file mode 100644
index 0000000..a1bef17
--- /dev/null
+++ b/src/en_US$collections_properties.as
@@ -0,0 +1,48 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$collections_properties extends ResourceBundle
+ {
+ public function en_US$collections_properties()
+ {
+ super("en_US","collections");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "findCondition":"Find criteria must contain all sort fields leading up to \'{0}\'.",
+ "getItemIndexError":"getItemIndex() is not available in this class.",
+ "noComparatorSortField":"Cannot determine comparator for SortField with name \'{0}\'.",
+ "outOfBounds":"Index \'{0}\' specified is out of bounds.",
+ "removeAllError":"removeAll() is not available in this class.",
+ "nonUnique":"Non-unique values in items.",
+ "incorrectAddition":"Attempt to add an item already in the view.",
+ "addItemError":"addItem() is not available in this class.",
+ "getItemAtError":"getItemAt() is not available in this class.",
+ "findRestriction":"Find criteria must contain at least one sort field value.",
+ "stepSizeError":"stepSize cannot be set to a value of zero.",
+ "invalidType":"Incorrect type. Must be of type XML or a XMLList that contains one XML object. ",
+ "unknownMode":"Unknown find mode.",
+ "addItemAtError":"addItemAt() is not available in this class.",
+ "invalidIndex":"Invalid index: \'{0}\'.",
+ "invalidRemove":"Cannot remove when current is beforeFirst or afterLast.",
+ "toArrayError":"toArray() is not available in this class.",
+ "unknownProperty":"Unknown Property: \'{0}\'.",
+ "lengthError":"length() is not available in this class.",
+ "invalidInsert":"Cannot insert when current is beforeFirst.",
+ "itemNotFound":"Cannot find when view is not sorted.",
+ "bookmarkInvalid":"Bookmark no longer valid.",
+ "itemUpdatedError":"itemUpdated() is not available in this class.",
+ "noComparator":"Cannot determine comparator for \'{0}\'.",
+ "setItemAtError":"setItemAt() is not available in this class.",
+ "invalidCursor":"Cursor no longer valid.",
+ "noItems":"No items to search.",
+ "bookmarkNotFound":"Bookmark is not from this view.",
+ "removeItemAtError":"removeItemAt() is not available in this class."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$components_properties.as b/src/en_US$components_properties.as
new file mode 100644
index 0000000..66b2d2b
--- /dev/null
+++ b/src/en_US$components_properties.as
@@ -0,0 +1,70 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$components_properties extends ResourceBundle
+ {
+ public function en_US$components_properties()
+ {
+ super("en_US","components");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "objectNotFoundInDisplayLayer":"{0} is not found in this DisplayLayer.",
+ "sliderPageUpAccName":"Page up",
+ "setChildIndexError":"setChildIndex() is not available in this class. Instead, use setElementIndex() or modify the skin, if you have one.",
+ "scaleGridGroupError":"ScaleGrid properties can not be set on this Group since at least one child element is a DisplayObject.",
+ "videoPlayerVolumeBarAccName":"Volume",
+ "toggleSwitchUnselectedLabel":"OFF",
+ "swapChildrenError":"swapChildren() is not available in this class. Instead, use swapElements() or modify the skin, if you have one.",
+ "sliderPageLeftAccName":"Page left",
+ "addChildError":"addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.",
+ "swapChildrenDataGroupError":"DataGroup manages its own display objects, and you should not call swapChildren() directly. To add, remove, or swap items, modify the dataProvider.",
+ "operationNotSupported":"This operation is not supported.",
+ "unableToCreateRenderer":"Could not create an item renderer for {0}.",
+ "sliderPageRightAccName":"Page right",
+ "sortedDescending":"Sorted descending",
+ "videoPlayerMuteButtonAccName":"Not Muted,Muted",
+ "operationRequiresViewportLayout":"This operation requires that the viewport have a layout.",
+ "setChildIndexDataGroupError":"DataGroup manages its own display objects, and you should not call setChildIndex() directly. To add, remove, or swap items, modify the dataProvider.",
+ "elementNotFoundInGroup":"{0} is not found in this Group.",
+ "viewSource":"View Source",
+ "mxmlElementNoMultipleParents":"MXML element {0} can only have one parent.",
+ "sortedAscending":"Sorted",
+ "skinNotFound":"Skin for {0} cannot be found.",
+ "swapChildrenAtError":"swapChildrenAt() is not available in this class. Instead, use swapElementsAt() or modify the skin, if you have one.",
+ "sliderPageDownAccName":"Page down",
+ "indexOutOfRange":"Index {0} is out of range.",
+ "removeChildAtError":"removeChildAt() is not available in this class. Instead, use removeElementAt() or modify the skin, if you have one.",
+ "operationRequiresSnappingMode":"This operation requires scrollSnappingMode to be set to something other than NONE. ",
+ "sliderPositionAccName":"Position",
+ "videoPlayerScrubBarAccName":"Scrub",
+ "toggleSwitchSelectedLabel":"ON",
+ "videoPlayerVideoDisplayAccName":"Video Player",
+ "rowMofN":"Row %1 of %2",
+ "layoutReadOnly":"You are not allowed to change the layout for this class. It is read-only.",
+ "sortLevel":"Level %1",
+ "spinnerMoreAccName":"More",
+ "spinnerLessAccName":"Less",
+ "cannotAddYourselfAsYourChild":"Cannot add an element as a child of itself.",
+ "requiredSkinPartNotFound":"Required skin part {0} cannot be found.",
+ "cannotDisplayVisualElement":"DataGroup cannot display visual elements directly unless the elements are display objects and implement IVisualElement.",
+ "videoPlayerFullScreenButtonAccName":"Full screen",
+ "removeChildAtDataGroupError":"DataGroup manages its own display objects, and you should not call removeChildAt() directly. To add, remove, or swap items, modify the dataProvider.",
+ "addChildAtError":"addChildAt() is not available in this class. Instead, use addElementAt() or modify the skin, if you have one.",
+ "swapChildrenAtDataGroupError":"DataGroup manages its own display objects, and you should not call swapChildrenAt() directly. To add, remove, or swap items, modify the dataProvider.",
+ "operationSupportedForOneAxisOnly":"This operation is only supported when scrolling either horizontally or vertically, but not both.",
+ "elementNotFoundInScroller":"{0} is not found in this Scroller.",
+ "addChildAtDataGroupError":"DataGroup manages its own display objects, and you should not call addChildAt() directly. To add, remove, or swap items, modify the dataProvider.",
+ "styleSheetError":"This method or property cannot be used on a text field with a style sheet.",
+ "removeChildError":"removeChild() is not available in this class. Instead, use removeElement() or modify the skin, if you have one.",
+ "addChildDataGroupError":"DataGroup manages its own display objects, and you should not call addChild() directly. To add, remove, or swap items, modify the dataProvider.",
+ "removeChildDataGroupError":"DataGroup manages its own display objects, and you should not call removeChild() directly. To add, remove, or swap items, modify the dataProvider.",
+ "videoPlayerPlayButtonAccName":"Play,Pause"
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$containers_properties.as b/src/en_US$containers_properties.as
new file mode 100644
index 0000000..d7f5646
--- /dev/null
+++ b/src/en_US$containers_properties.as
@@ -0,0 +1,23 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$containers_properties extends ResourceBundle
+ {
+ public function en_US$containers_properties()
+ {
+ super("en_US","containers");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "noColumnsFound":"No ConstraintColumns found.",
+ "noRowsFound":"No ConstraintRows found.",
+ "rowNotFound":"ConstraintRow \'{0}\' not found.",
+ "columnNotFound":"ConstraintColumn \'{0}\' not found."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$controls_properties.as b/src/en_US$controls_properties.as
new file mode 100644
index 0000000..0a5c9a1
--- /dev/null
+++ b/src/en_US$controls_properties.as
@@ -0,0 +1,59 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$controls_properties extends ResourceBundle
+ {
+ public function en_US$controls_properties()
+ {
+ super("en_US","controls");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "undefinedParameter":"CuePoint parameter undefined.",
+ "nullURL":"Null URL sent to VideoPlayer.load.",
+ "incorrectType":"Type must be 0, 1 or 2.",
+ "okLabel":"OK",
+ "noLabel":"No",
+ "wrongNumParams":"Num params must be number.",
+ "wrongDisabled":"Disabled must be number.",
+ "wrongTime":"Time must be number.",
+ "dayNamesShortest":"S,M,T,W,T,F,S",
+ "wrongType":"Type must be number.",
+ "firstDayOfWeek":"0",
+ "requiredField":"Required Field",
+ "rootNotSMIL":"URL: \'{0}\' Root node not smil: \'{1}\'.",
+ "errorMessages":"Unable to make connection to server or to find FLV on server.,No matching cue point found.,Illegal cue point.,Invalid seek.,Invalid contentPath.,Invalid XML.,No bitrate match; must be no default FLV.,Cannot delete default VideoPlayer.",
+ "unexpectedEnd":"Unexpected end of cuePoint param string.",
+ "rootNotFound":"URL: \'{0}\' No root node found; if file is an flv, it must have a .flv extension.",
+ "errWrongContainer":"ERROR: The dataProvider of \'{0}\' must not contain objects of type flash.display.DisplayObject.",
+ "invalidCall":"Cannot call reconnect on an http connection.",
+ "cancelLabel":"Cancel",
+ "errWrongType":"ERROR: The dataProvider of \'{0}\' must be String, ViewStack, Array, or IList.",
+ "badArgs":"Bad args to _play.",
+ "missingRoot":"URL: \'{0}\' No root node found; if URL is for an FLV, it must have a .flv extension and take no parameters.",
+ "notLoadable":"Unable to load \'{0}\'.",
+ "wrongName":"Name cannot be undefined or null.",
+ "wrongTimeName":"Time must be number and/or name must not be undefined or null.",
+ "yesLabel":"Yes",
+ "undefinedArray":"CuePoint.array undefined.",
+ "missingProxy":"URL: \'{0}\' fpad xml requires proxy tag.",
+ "unknownInput":"Unknown inputType \'{0}\'.",
+ "missingAttributeSrc":"URL: \'{0}\' Attribute src is required in \'{1}\' tag.",
+ "yearSymbol":"",
+ "wrongIndex":"CuePoint.index must be number between -1 and cuePoint.array.length.",
+ "notImplemented":"\'{0}\' not implemented yet.",
+ "label":"LOADING %3%%",
+ "wrongFormat":"Unexpected cuePoint parameter format.",
+ "tagNotFound":"URL: \'{0}\' At least one video of ref tag is required.",
+ "unsupportedMode":"IMEMode \'{0}\' not supported.",
+ "cannotDisable":"Cannot disable actionscript cue points.",
+ "missingAttributes":"URL: \'{0}\' Tag \'{1}\' requires attributes id, width, and height. Width and height must be numbers greater than or equal to 0.",
+ "notfpad":"URL: \'{0}\' Root node not fpad."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$core_properties.as b/src/en_US$core_properties.as
new file mode 100644
index 0000000..a42fb9a
--- /dev/null
+++ b/src/en_US$core_properties.as
@@ -0,0 +1,35 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$core_properties extends ResourceBundle
+ {
+ public function en_US$core_properties()
+ {
+ super("en_US","core");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "multipleChildSets_ClassAndInstance":"Multiple sets of visual children have been specified for this component (component definition and component instance).",
+ "truncationIndicator":"...",
+ "notExecuting":"Repeater is not executing.",
+ "remoteClassMemoryLeak":"warning: The class {0} has been used in a call to net.registerClassAlias() in {2}. This will cause {1} to be leaked. To resolve the leak, define {0} in the top-level application. ",
+ "nullParameter":"Parameter {0} must be non-null.",
+ "versionAlreadyRead":"Compatibility version has already been read.",
+ "multipleChildSets_ClassAndSubclass":"Multiple sets of visual children have been specified for this component (base component definition and derived component definition).",
+ "fontIncompatible":"warning: incompatible embedded font \'{0}\' specified for {1}. This component requires that the embedded font be declared with embedAsCFF={2}.",
+ "badParameter":"Parameter {0} must be one of the accepted values.",
+ "notImplementedInFTETextField":"\'{0}\' is not implemented in FTETextField.",
+ "viewSource":"View Source",
+ "unsupportedTypeInFTETextField":"FTETextField does not support setting type to \"input\".",
+ "badFile":"File does not exist.",
+ "stateUndefined":"Undefined state \'{0}\'.",
+ "badIndex":"The supplied index is out of bounds.",
+ "versionAlreadySet":"Compatibility version has already been set."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$effects_properties.as b/src/en_US$effects_properties.as
new file mode 100644
index 0000000..763efd7
--- /dev/null
+++ b/src/en_US$effects_properties.as
@@ -0,0 +1,21 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$effects_properties extends ResourceBundle
+ {
+ public function en_US$effects_properties()
+ {
+ super("en_US","effects");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "incorrectTrigger":"The Zoom effect can not be triggered by a moveEffect trigger.",
+ "incorrectSource":"Source property must be a Class or String."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$layout_properties.as b/src/en_US$layout_properties.as
new file mode 100644
index 0000000..34d8470
--- /dev/null
+++ b/src/en_US$layout_properties.as
@@ -0,0 +1,25 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$layout_properties extends ResourceBundle
+ {
+ public function en_US$layout_properties()
+ {
+ super("en_US","layout");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "rowNotFound":"ConstraintRow \'{0}\' not found.",
+ "constraintLayoutNotVirtualized":"ConstraintLayout doesn\'t support virtualization.",
+ "basicLayoutNotVirtualized":"BasicLayout doesn\'t support virtualization.",
+ "columnNotFound":"ConstraintColumn \'{0}\' not found.",
+ "invalidIndex":"invalidIndex",
+ "invalidBaselineOnRow":"Invalid baseline value on row {0}: \'{1}\'. Must be a Number or of the form \'maxAscent:x\'."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$skins_properties.as b/src/en_US$skins_properties.as
new file mode 100644
index 0000000..3588f30
--- /dev/null
+++ b/src/en_US$skins_properties.as
@@ -0,0 +1,18 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$skins_properties extends ResourceBundle
+ {
+ public function en_US$skins_properties()
+ {
+ super("en_US","skins");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {"notLoaded":"Unable to load \'{0}\'."};
+ }
+ }
+}
+
diff --git a/src/en_US$sparkEffects_properties.as b/src/en_US$sparkEffects_properties.as
new file mode 100644
index 0000000..2c4639f
--- /dev/null
+++ b/src/en_US$sparkEffects_properties.as
@@ -0,0 +1,27 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$sparkEffects_properties extends ResourceBundle
+ {
+ public function en_US$sparkEffects_properties()
+ {
+ super("en_US","sparkEffects");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "cannotOperateOn":"AnimateShaderTransition can operate only on IUIComponent and GraphicElement instances.",
+ "accDecWithinRange":"(acceleration + deceleration) must be within range [0,1].",
+ "propNotPropOrStyle":"Property {0} is not a property or a style on object {1}: {2}.",
+ "cannotCalculateValue":"Interpolator cannot calculate interpolated values when startValue ({0}) or endValue ({1}) is not a number.",
+ "illegalPropValue":"Illegal property value: {0}.",
+ "arraysNotOfEqualLength":"The start and end arrays must be of equal length.",
+ "endValContainsNonNums":"The endValue array contains non-Numbers: you must supply a custom Interpolator to Animation.",
+ "startValContainsNonNums":"The startValue array contains non-Numbers: you must supply Interpolator to Animation."
+ };
+ }
+ }
+}
+
diff --git a/src/en_US$styles_properties.as b/src/en_US$styles_properties.as
new file mode 100644
index 0000000..f357c61
--- /dev/null
+++ b/src/en_US$styles_properties.as
@@ -0,0 +1,18 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$styles_properties extends ResourceBundle
+ {
+ public function en_US$styles_properties()
+ {
+ super("en_US","styles");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {"unableToLoad":"Unable to load style({0}): {1}."};
+ }
+ }
+}
+
diff --git a/src/en_US$textLayout_properties.as b/src/en_US$textLayout_properties.as
new file mode 100644
index 0000000..99f02ea
--- /dev/null
+++ b/src/en_US$textLayout_properties.as
@@ -0,0 +1,41 @@
+package
+{
+ import mx.resources.ResourceBundle;
+
+ public class en_US$textLayout_properties extends ResourceBundle
+ {
+ public function en_US$textLayout_properties()
+ {
+ super("en_US","textLayout");
+ }
+
+ override protected function getContent() : Object
+ {
+ return {
+ "badRemoveChild":"Child to remove not found",
+ "badReplaceChildrenIndex":"Out of range index to FlowGroupElement.replaceChildren",
+ "missingTextFlow":"No TextFlow to parse",
+ "unexpectedNamespace":"Unexpected namespace {0}",
+ "badMXMLChildrenArgument":"Bad element of type {0} passed to mxmlChildren",
+ "invalidReplaceTextPositions":"Invalid positions passed to SpanElement.replaceText",
+ "invalidSplitAtPosition":"Invalid parameter to splitAtPosition",
+ "badSurrogatePairCopy":"Copying only half of a surrogate pair in SpanElement.shallowCopy",
+ "invalidChildType":"NewElement not of a type that this can be parent of",
+ "unknownAttribute":"Attribute {0} not permitted in element {1}",
+ "invalidSurrogatePairSplit":"Invalid splitting of a surrogate pair",
+ "expectedExactlyOneTextLayoutFormat":"Expected one and only one TextLayoutFormat in {0}\t",
+ "invalidFlowElementConstruct":"Attempted construct of invalid FlowElement subclass",
+ "malformedTag":"Malformed tag {0}",
+ "missingStringResource":"No string for resource {0}",
+ "invalidSplitAtIndex":"Invalid parameter to splitAtIndex",
+ "illegalOperation":"Illegal attempt to execute {0} operation",
+ "malformedMarkup":"Malformed markup {0}",
+ "unexpectedXMLElementInSpan":"Unexpected element {0} within a span",
+ "badPropertyValue":"Property {0} value {1} is out of range",
+ "badShallowCopyRange":"Bad range in shallowCopy",
+ "unknownElement":"Unknown element {0}"
+ };
+ }
+ }
+}
+
diff --git a/src/gui/events/PropListEvent.as b/src/gui/events/PropListEvent.as
new file mode 100644
index 0000000..64d9704
--- /dev/null
+++ b/src/gui/events/PropListEvent.as
@@ -0,0 +1,41 @@
+package gui.events
+{
+ import flash.events.Event;
+
+ public class PropListEvent extends Event
+ {
+ public static const SELECT:String = "select";
+
+ private var _selectedIndex:int;
+
+ private var _selectedItem:*;
+
+ public function PropListEvent(param1:int, param2:*)
+ {
+ super(PropListEvent.SELECT,false,false);
+ this._selectedIndex = param1;
+ this._selectedItem = param2;
+ }
+
+ public function get selectedIndex() : int
+ {
+ return this._selectedIndex;
+ }
+
+ public function get selectedItem() : *
+ {
+ return this._selectedItem;
+ }
+
+ override public function toString() : String
+ {
+ return formatToString("ListEvents","type","bubbles","cancelable","selectedIndex","selectedItem");
+ }
+
+ override public function clone() : Event
+ {
+ return new PropListEvent(this._selectedIndex,this._selectedItem);
+ }
+ }
+}
+
diff --git a/src/icons/.DS_Store b/src/icons/.DS_Store
new file mode 100644
index 0000000..5028fb7
Binary files /dev/null and b/src/icons/.DS_Store differ
diff --git a/src/icons/editor/boxes_icon.png b/src/icons/editor/boxes_icon.png
new file mode 100644
index 0000000..9a66ad0
Binary files /dev/null and b/src/icons/editor/boxes_icon.png differ
diff --git a/src/icons/editor/boxes_icon_on.png b/src/icons/editor/boxes_icon_on.png
new file mode 100644
index 0000000..3879f71
Binary files /dev/null and b/src/icons/editor/boxes_icon_on.png differ
diff --git a/src/icons/editor/grid_icon.png b/src/icons/editor/grid_icon.png
new file mode 100644
index 0000000..e92a6ce
Binary files /dev/null and b/src/icons/editor/grid_icon.png differ
diff --git a/src/icons/editor/grid_icon_on.png b/src/icons/editor/grid_icon_on.png
new file mode 100644
index 0000000..7cbe1f6
Binary files /dev/null and b/src/icons/editor/grid_icon_on.png differ
diff --git a/src/icons/editor/hide_selected.png b/src/icons/editor/hide_selected.png
new file mode 100644
index 0000000..aa6d1cc
Binary files /dev/null and b/src/icons/editor/hide_selected.png differ
diff --git a/src/icons/editor/show_all.png b/src/icons/editor/show_all.png
new file mode 100644
index 0000000..4bd3b8e
Binary files /dev/null and b/src/icons/editor/show_all.png differ
diff --git a/src/icons/editor/snap_icon.png b/src/icons/editor/snap_icon.png
new file mode 100644
index 0000000..b4c3b6d
Binary files /dev/null and b/src/icons/editor/snap_icon.png differ
diff --git a/src/icons/editor/snap_icon_on.png b/src/icons/editor/snap_icon_on.png
new file mode 100644
index 0000000..a63a303
Binary files /dev/null and b/src/icons/editor/snap_icon_on.png differ
diff --git a/src/icons/editor/textures_icon.png b/src/icons/editor/textures_icon.png
new file mode 100644
index 0000000..a545a3e
Binary files /dev/null and b/src/icons/editor/textures_icon.png differ
diff --git a/src/icons/editor/textures_icon_on.png b/src/icons/editor/textures_icon_on.png
new file mode 100644
index 0000000..5df7aa1
Binary files /dev/null and b/src/icons/editor/textures_icon_on.png differ