Permalink
Browse files

SkyBox, Geometry implemented

  • Loading branch information...
1 parent 9f6c931 commit 988e23342796a06277066dbd7733c79226d53c8b @keyemkey keyemkey committed May 5, 2013
Showing with 732 additions and 92 deletions.
  1. +8 −0 awaybuilder-core/src/awaybuilder/CoreContext.as
  2. +1 −1 awaybuilder-core/src/awaybuilder/controller/history/HistoryCommandBase.as
  3. +39 −0 awaybuilder-core/src/awaybuilder/controller/scene/AddNewGeometryCommand.as
  4. +49 −0 awaybuilder-core/src/awaybuilder/controller/scene/AddNewMeshCommand.as
  5. +49 −0 awaybuilder-core/src/awaybuilder/controller/scene/AddNewSkyBoxCommand.as
  6. +0 −3 awaybuilder-core/src/awaybuilder/controller/scene/ChangeGeometryCommand.as
  7. +2 −0 awaybuilder-core/src/awaybuilder/controller/scene/ChangeMeshCommand.as
  8. +25 −0 awaybuilder-core/src/awaybuilder/controller/scene/ChangeSkyBoxCommand.as
  9. +5 −0 awaybuilder-core/src/awaybuilder/controller/scene/events/SceneEvent.as
  10. +51 −17 awaybuilder-core/src/awaybuilder/model/AssetsModel.as
  11. +35 −3 awaybuilder-core/src/awaybuilder/model/SmartFactoryModelBase.as
  12. +1 −1 awaybuilder-core/src/awaybuilder/model/UndoRedoModel.as
  13. +24 −0 awaybuilder-core/src/awaybuilder/model/vo/scene/GeometryVO.as
  14. +26 −0 awaybuilder-core/src/awaybuilder/model/vo/scene/SkyBoxVO.as
  15. +65 −15 awaybuilder-core/src/awaybuilder/view/components/LibraryPanel.mxml
  16. +6 −1 awaybuilder-core/src/awaybuilder/view/components/PropertiesPanel.mxml
  17. +22 −0 awaybuilder-core/src/awaybuilder/view/components/editors/EditorBase.as
  18. +42 −3 awaybuilder-core/src/awaybuilder/view/components/editors/GeometryPropertiesEditor.mxml
  19. +48 −44 awaybuilder-core/src/awaybuilder/view/components/editors/MeshPropertyEditor.mxml
  20. +92 −0 awaybuilder-core/src/awaybuilder/view/components/editors/SkyBoxPropertiesEditor.mxml
  21. +4 −0 awaybuilder-core/src/awaybuilder/view/components/editors/events/PropertyEditorEvent.as
  22. +3 −1 awaybuilder-core/src/awaybuilder/view/components/events/LibraryPanelEvent.as
  23. +68 −1 awaybuilder-core/src/awaybuilder/view/mediators/CoreEditorMediator.as
  24. +32 −1 awaybuilder-core/src/awaybuilder/view/mediators/LibraryPanelMediator.as
  25. +35 −1 awaybuilder-core/src/awaybuilder/view/mediators/PropertiesPanelMediator.as
  26. BIN exampleScenes/globeAssets/earth_ambient.jpg
  27. BIN exampleScenes/globeAssets/earth_clouds.jpg
  28. BIN exampleScenes/globeAssets/earth_diffuse.jpg
  29. BIN exampleScenes/globeAssets/earth_normals.png
  30. BIN exampleScenes/globeAssets/earth_specular.jpg
  31. BIN exampleScenes/globeAssets/flare0.jpg
  32. BIN exampleScenes/globeAssets/flare1.jpg
  33. BIN exampleScenes/globeAssets/flare10.jpg
  34. BIN exampleScenes/globeAssets/flare11.jpg
  35. BIN exampleScenes/globeAssets/flare12.jpg
  36. BIN exampleScenes/globeAssets/flare2.jpg
  37. BIN exampleScenes/globeAssets/flare3.jpg
  38. BIN exampleScenes/globeAssets/flare4.jpg
  39. BIN exampleScenes/globeAssets/flare5.jpg
  40. BIN exampleScenes/globeAssets/flare6.jpg
  41. BIN exampleScenes/globeAssets/flare7.jpg
  42. BIN exampleScenes/globeAssets/flare8.jpg
  43. BIN exampleScenes/globeAssets/flare9.jpg
  44. BIN exampleScenes/globeAssets/moon.jpg
  45. BIN exampleScenes/globeAssets/space_negX.jpg
  46. BIN exampleScenes/globeAssets/space_negY.jpg
  47. BIN exampleScenes/globeAssets/space_negZ.jpg
  48. BIN exampleScenes/globeAssets/space_posX.jpg
  49. BIN exampleScenes/globeAssets/space_posY.jpg
  50. BIN exampleScenes/globeAssets/space_posZ.jpg
  51. BIN exampleScenes/globeAssets/star.jpg
  52. BIN exampleScenes/globeAssets/sun.jpg
@@ -35,10 +35,13 @@ package awaybuilder
import awaybuilder.controller.history.UndoRedoEvent;
import awaybuilder.controller.scene.AddNewCubeTextureCommand;
import awaybuilder.controller.scene.AddNewEffectMethodCommand;
+ import awaybuilder.controller.scene.AddNewGeometryCommand;
import awaybuilder.controller.scene.AddNewLightCommand;
import awaybuilder.controller.scene.AddNewLightPickerCommand;
import awaybuilder.controller.scene.AddNewMaterialCommand;
+ import awaybuilder.controller.scene.AddNewMeshCommand;
import awaybuilder.controller.scene.AddNewShadowMethodCommand;
+ import awaybuilder.controller.scene.AddNewSkyBoxCommand;
import awaybuilder.controller.scene.AddNewTextureCommand;
import awaybuilder.controller.scene.ChangeContainerCommand;
import awaybuilder.controller.scene.ChangeCubeTextureCommand;
@@ -51,6 +54,7 @@ package awaybuilder
import awaybuilder.controller.scene.ChangeShadingMethodCommand;
import awaybuilder.controller.scene.ChangeShadowMapperCommand;
import awaybuilder.controller.scene.ChangeShadowMethodCommand;
+ import awaybuilder.controller.scene.ChangeSkyBoxCommand;
import awaybuilder.controller.scene.ChangeTextureCommand;
import awaybuilder.controller.scene.DeleteObjectCommand;
import awaybuilder.controller.scene.ReplaceTextureCommand;
@@ -146,6 +150,7 @@ package awaybuilder
commandMap.mapEvent(SceneEvent.CHANGE_LIGHTPICKER, ChangeLightPickerCommand);
commandMap.mapEvent(SceneEvent.CHANGE_SHADOW_METHOD, ChangeShadowMethodCommand);
commandMap.mapEvent(SceneEvent.CHANGE_EFFECT_METHOD, ChangeEffectMethodCommand);
+ commandMap.mapEvent(SceneEvent.CHANGE_SKYBOX, ChangeSkyBoxCommand);
commandMap.mapEvent(SceneEvent.CHANGE_SHADOW_MAPPER, ChangeShadowMapperCommand);
commandMap.mapEvent(SceneEvent.CHANGE_GEOMETRY, ChangeGeometryCommand);
commandMap.mapEvent(SceneEvent.CHANGE_SHADING_METHOD, ChangeShadingMethodCommand);
@@ -157,8 +162,11 @@ package awaybuilder
commandMap.mapEvent(SceneEvent.ADD_NEW_LIGHT, AddNewLightCommand);
commandMap.mapEvent(SceneEvent.ADD_NEW_LIGHTPICKER, AddNewLightPickerCommand);
commandMap.mapEvent(SceneEvent.ADD_NEW_SHADOW_METHOD, AddNewShadowMethodCommand);
+ commandMap.mapEvent(SceneEvent.ADD_NEW_SKYBOX, AddNewSkyBoxCommand);
commandMap.mapEvent(SceneEvent.ADD_NEW_CUBE_TEXTURE, AddNewCubeTextureCommand);
commandMap.mapEvent(SceneEvent.ADD_NEW_EFFECT_METHOD, AddNewEffectMethodCommand);
+ commandMap.mapEvent(SceneEvent.ADD_NEW_GEOMETRY, AddNewGeometryCommand);
+ commandMap.mapEvent(SceneEvent.ADD_NEW_MESH, AddNewMeshCommand);
commandMap.mapEvent(SceneEvent.REPLACE_TEXTURE, ReplaceTextureCommand);
@@ -25,7 +25,7 @@ package awaybuilder.controller.history
if( event.canBeCombined )
{
var lastEvent:HistoryEvent = undoRedoModel.getLastActon();
- if( lastEvent && lastEvent.canBeCombined && (lastEvent.type==event.type) && (event.timeStamp-lastEvent.timeStamp<500) )
+ if( lastEvent && lastEvent.canBeCombined && (lastEvent.type==event.type) && (event.timeStamp-lastEvent.timeStamp<150) )
{
lastEvent.timeStamp = event.timeStamp;
lastEvent.newValue = event.newValue;
@@ -0,0 +1,39 @@
+package awaybuilder.controller.scene
+{
+ import awaybuilder.controller.events.DocumentModelEvent;
+ import awaybuilder.controller.history.HistoryCommandBase;
+ import awaybuilder.controller.scene.events.SceneEvent;
+ import awaybuilder.model.DocumentModel;
+ import awaybuilder.model.vo.scene.GeometryVO;
+
+ public class AddNewGeometryCommand extends HistoryCommandBase
+ {
+ [Inject]
+ public var event:SceneEvent;
+
+ [Inject]
+ public var document:DocumentModel;
+
+ override public function execute():void
+ {
+ var oldValue:GeometryVO = event.oldValue as GeometryVO;
+ var newValue:GeometryVO = event.newValue as GeometryVO;
+
+ if( event.isUndoAction )
+ {
+ document.removeAsset( document.geometry, oldValue );
+ }
+ else
+ {
+ document.geometry.addItemAt( newValue, 0 );
+ }
+
+ addToHistory( event );
+
+ this.dispatch(new DocumentModelEvent(DocumentModelEvent.DOCUMENT_UPDATED));
+ document.empty = false;
+ document.edited = true;
+ }
+
+ }
+}
@@ -0,0 +1,49 @@
+package awaybuilder.controller.scene
+{
+ import away3d.containers.ObjectContainer3D;
+ import away3d.entities.Mesh;
+
+ import awaybuilder.controller.events.DocumentModelEvent;
+ import awaybuilder.controller.history.HistoryCommandBase;
+ import awaybuilder.controller.scene.events.SceneEvent;
+ import awaybuilder.model.AssetsModel;
+ import awaybuilder.model.DocumentModel;
+ import awaybuilder.model.vo.scene.MeshVO;
+ import awaybuilder.utils.scene.Scene3DManager;
+
+ public class AddNewMeshCommand extends HistoryCommandBase
+ {
+ [Inject]
+ public var event:SceneEvent;
+
+ [Inject]
+ public var document:DocumentModel;
+
+ [Inject]
+ public var assets:AssetsModel;
+
+ override public function execute():void
+ {
+ var oldValue:MeshVO = event.oldValue as MeshVO;
+ var newValue:MeshVO = event.newValue as MeshVO;
+
+ if( event.isUndoAction )
+ {
+ document.removeAsset( document.scene, oldValue );
+ Scene3DManager.removeMesh( assets.GetObject(oldValue) as Mesh );
+ }
+ else
+ {
+ document.scene.addItemAt( newValue, 0 );
+ Scene3DManager.addObject( assets.GetObject(newValue) as ObjectContainer3D );
+ }
+
+ addToHistory( event );
+
+ this.dispatch(new DocumentModelEvent(DocumentModelEvent.DOCUMENT_UPDATED));
+ document.empty = false;
+ document.edited = true;
+ }
+
+ }
+}
@@ -0,0 +1,49 @@
+package awaybuilder.controller.scene
+{
+ import away3d.entities.Mesh;
+ import away3d.primitives.SkyBox;
+
+ import awaybuilder.controller.events.DocumentModelEvent;
+ import awaybuilder.controller.history.HistoryCommandBase;
+ import awaybuilder.controller.scene.events.SceneEvent;
+ import awaybuilder.model.AssetsModel;
+ import awaybuilder.model.DocumentModel;
+ import awaybuilder.model.vo.scene.SkyBoxVO;
+ import awaybuilder.utils.scene.Scene3DManager;
+
+ public class AddNewSkyBoxCommand extends HistoryCommandBase
+ {
+ [Inject]
+ public var event:SceneEvent;
+
+ [Inject]
+ public var document:DocumentModel;
+
+ [Inject]
+ public var assets:AssetsModel;
+
+ override public function execute():void
+ {
+ var oldValue:SkyBoxVO = event.oldValue as SkyBoxVO;
+ var newValue:SkyBoxVO = event.newValue as SkyBoxVO;
+
+ if( event.isUndoAction )
+ {
+ document.removeAsset( document.scene, oldValue );
+// Scene3DManager.removeMesh( assets.GetObject(oldValue) as SkyBox );
+ }
+ else
+ {
+ document.scene.addItemAt( newValue, 0 );
+ Scene3DManager.addObject( assets.GetObject(newValue) as SkyBox );
+ }
+
+ addToHistory( event );
+
+ this.dispatch(new DocumentModelEvent(DocumentModelEvent.DOCUMENT_UPDATED));
+ document.empty = false;
+ document.edited = true;
+ }
+
+ }
+}
@@ -10,9 +10,6 @@ package awaybuilder.controller.scene
[Inject]
public var event:SceneEvent;
- [Inject]
- public var document:DocumentModel;
-
override public function execute():void
{
var newValue:GeometryVO = event.newValue as GeometryVO;
@@ -41,6 +41,8 @@ package awaybuilder.controller.scene
vo.castsShadows = mesh.castsShadows;
+ vo.geometry = mesh.geometry;
+
var e:Array = new Array();
for each( var extra:ExtraItemVO in mesh.extras )
{
@@ -0,0 +1,25 @@
+package awaybuilder.controller.scene
+{
+ import awaybuilder.controller.history.HistoryCommandBase;
+ import awaybuilder.controller.scene.events.SceneEvent;
+ import awaybuilder.model.DocumentModel;
+ import awaybuilder.model.vo.scene.SkyBoxVO;
+
+ public class ChangeSkyBoxCommand extends HistoryCommandBase
+ {
+ [Inject]
+ public var event:SceneEvent;
+
+ override public function execute():void
+ {
+ var newValue:SkyBoxVO = event.newValue as SkyBoxVO;
+ var vo:SkyBoxVO = event.items[0] as SkyBoxVO;
+
+ saveOldValue( event, vo.clone() );
+
+ vo.fillFromSkyBox( newValue );
+
+ addToHistory( event );
+ }
+ }
+}
@@ -27,18 +27,23 @@ import flash.events.Event;
public static const CHANGE_SHADING_METHOD:String = "changeShadingMethod";
+ public static const CHANGE_SKYBOX:String = "changeSkyBox";
+
public static const CHANGE_SHADOW_METHOD:String = "changeShadowMethod";
public static const CHANGE_SHADOW_MAPPER:String = "changeShadowMapper";
public static const CHANGE_EFFECT_METHOD:String = "changeEffectMethod";
public static const ADD_NEW_LIGHT:String = "addNewLight";
public static const ADD_NEW_MATERIAL:String = "addNewMaterial";
+ public static const ADD_NEW_MESH:String = "addNewMesh";
+ public static const ADD_NEW_SKYBOX:String = "addNewSkyBox";
public static const ADD_NEW_SHADOW_METHOD:String = "addNewShadowMethod";
public static const ADD_NEW_EFFECT_METHOD:String = "addNewEffectMethod";
public static const ADD_NEW_LIGHTPICKER:String = "addNewLightPicker";
public static const ADD_NEW_TEXTURE:String = "addNewTexture";
public static const ADD_NEW_CUBE:String = "addNewCubeTexture";
public static const ADD_NEW_CUBE_TEXTURE:String = "addNewCubeTexture";
+ public static const ADD_NEW_GEOMETRY:String = "addNewGeometry";
public static const REPLACE_TEXTURE:String = "replaceTexture";
public static const SWITCH_CAMERA_TO_FREE:String = "switchCameraToFree";
Oops, something went wrong.

0 comments on commit 988e233

Please sign in to comment.