Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SkyBox, Geometry implemented

  • Loading branch information...
commit 988e23342796a06277066dbd7733c79226d53c8b 1 parent 9f6c931
@keyemkey keyemkey authored
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
View
8 awaybuilder-core/src/awaybuilder/CoreContext.as
@@ -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);
View
2  awaybuilder-core/src/awaybuilder/controller/history/HistoryCommandBase.as
@@ -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;
View
39 awaybuilder-core/src/awaybuilder/controller/scene/AddNewGeometryCommand.as
@@ -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;
+ }
+
+ }
+}
View
49 awaybuilder-core/src/awaybuilder/controller/scene/AddNewMeshCommand.as
@@ -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;
+ }
+
+ }
+}
View
49 awaybuilder-core/src/awaybuilder/controller/scene/AddNewSkyBoxCommand.as
@@ -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;
+ }
+
+ }
+}
View
3  awaybuilder-core/src/awaybuilder/controller/scene/ChangeGeometryCommand.as
@@ -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;
View
2  awaybuilder-core/src/awaybuilder/controller/scene/ChangeMeshCommand.as
@@ -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 )
{
View
25 awaybuilder-core/src/awaybuilder/controller/scene/ChangeSkyBoxCommand.as
@@ -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 );
+ }
+ }
+}
View
5 awaybuilder-core/src/awaybuilder/controller/scene/events/SceneEvent.as
@@ -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";
View
68 awaybuilder-core/src/awaybuilder/model/AssetsModel.as
@@ -1,10 +1,16 @@
package awaybuilder.model
{
+ import away3d.core.base.Geometry;
+ import away3d.entities.Mesh;
import away3d.lights.*;
import away3d.lights.shadowmaps.*;
import away3d.materials.*;
import away3d.materials.lightpickers.*;
import away3d.materials.methods.*;
+ import away3d.primitives.CubeGeometry;
+ import away3d.primitives.PrimitiveBase;
+ import away3d.primitives.SkyBox;
+ import away3d.primitives.SphereGeometry;
import away3d.textures.*;
import awaybuilder.model.vo.scene.*;
@@ -83,7 +89,7 @@ package awaybuilder.model
var newMaterial:SinglePassMaterialBase;
var textureMaterial:TextureMaterial = GetObject(clone) as TextureMaterial;
newMaterial = new TextureMaterial( textureMaterial.texture, textureMaterial.smooth, textureMaterial.repeat, textureMaterial.mipmap );
- newMaterial.name = "Material " + AssetUtil.GetNextId("Material");
+ newMaterial.name = "Material" + AssetUtil.GetNextId("Material");
newMaterial.gloss = 50;
return GetAsset(newMaterial) as MaterialVO;
}
@@ -95,7 +101,7 @@ package awaybuilder.model
{
case "LightMapMethod":
method = new LightMapMethod(GetObject(_defaultTexture) as Texture2DBase);
- method.name = "LightMap " + AssetUtil.GetNextId("LightMapMethod");
+ method.name = "LightMap" + AssetUtil.GetNextId("LightMapMethod");
break;
case "ProjectiveTextureMethod":
// method = new ProjectiveTextureMethod();
@@ -103,45 +109,73 @@ package awaybuilder.model
break;
case "RimLightMethod":
method = new RimLightMethod();
- method.name = "RimLight " + AssetUtil.GetNextId("RimLightMethod");
+ method.name = "RimLight" + AssetUtil.GetNextId("RimLightMethod");
break;
case "ColorTransformMethod":
method = new ColorTransformMethod();
ColorTransformMethod(method).colorTransform = new ColorTransform();
- method.name = "ColorTransform " + AssetUtil.GetNextId("ColorTransformMethod");
+ method.name = "ColorTransform" + AssetUtil.GetNextId("ColorTransformMethod");
break;
case "AlphaMaskMethod":
method = new AlphaMaskMethod(GetObject(_defaultTexture) as Texture2DBase, false);
- method.name = "AlphaMask " + AssetUtil.GetNextId("AlphaMaskMethod");
+ method.name = "AlphaMask" + AssetUtil.GetNextId("AlphaMaskMethod");
break;
case "ColorMatrixMethod":
method = new ColorMatrixMethod([ 0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0, 0, 0, 1, 1]);
- method.name = "ColorMatrix " + AssetUtil.GetNextId("ColorMatrixMethod");
+ method.name = "ColorMatrix" + AssetUtil.GetNextId("ColorMatrixMethod");
break;
case "RefractionEnvMapMethod":
method = new RefractionEnvMapMethod( GetObject(_defaultCubeTexture) as CubeTextureBase );
- method.name = "RefractionEnvMap " + AssetUtil.GetNextId("RefractionEnvMapMethod");
+ method.name = "RefractionEnvMap" + AssetUtil.GetNextId("RefractionEnvMapMethod");
break;
case "OutlineMethod":
method = new OutlineMethod();
- method.name = "Outline " + AssetUtil.GetNextId("OutlineMethod");
+ method.name = "Outline" + AssetUtil.GetNextId("OutlineMethod");
break;
case "FresnelEnvMapMethod":
method = new FresnelEnvMapMethod( GetObject(_defaultCubeTexture) as CubeTextureBase );
- method.name = "FresnelEnvMap " + AssetUtil.GetNextId("FresnelEnvMapMethod");
+ method.name = "FresnelEnvMap" + AssetUtil.GetNextId("FresnelEnvMapMethod");
break;
case "FogMethod":
method = new FogMethod(0,1000);
- method.name = "Fog " + AssetUtil.GetNextId("FogMethod");
+ method.name = "Fog" + AssetUtil.GetNextId("FogMethod");
break;
case "EnvMapMethod":
method = new EnvMapMethod( GetObject(_defaultCubeTexture) as CubeTextureBase );
- method.name = "EnvMap " + AssetUtil.GetNextId("EnvMapMethod");
+ method.name = "EnvMap" + AssetUtil.GetNextId("EnvMapMethod");
EnvMapMethod(method).mask = GetObject(_defaultTexture) as Texture2DBase;
break;
}
return GetAsset( method ) as EffectMethodVO;
}
+ public function CreateSkyBox():SkyBoxVO
+ {
+ var mesh:SkyBox = new SkyBox( GetObject(GetDefaultCubeTexture()) as CubeTextureBase );
+ mesh.name = "SkyBox" + AssetUtil.GetNextId("SkyBox");
+ return GetAsset( mesh ) as SkyBoxVO;
+ }
+ public function CreateMesh( geometry:GeometryVO ):MeshVO
+ {
+ var mesh:Mesh = new Mesh( GetObject(geometry) as Geometry );
+ mesh.name = "Mesh" + AssetUtil.GetNextId("Mesh");
+ return GetAsset( mesh ) as MeshVO;
+ }
+ public function CreateGeometry( type:String ):GeometryVO
+ {
+ var geometry:PrimitiveBase;
+ switch( type )
+ {
+ case "CubeGeometry":
+ geometry = new CubeGeometry();
+ geometry.name = "CubeGeometry" + AssetUtil.GetNextId("CubeGeometry");
+ break;
+ case "SphereGeometry":
+ geometry = new SphereGeometry();
+ geometry.name = "SphereGeometry" + AssetUtil.GetNextId("SphereGeometry");
+ break;
+ }
+ return GetAsset( geometry ) as GeometryVO;
+ }
public function CreateCubeTexture():CubeTextureVO
{
var light:BitmapCubeTexture = new BitmapCubeTexture( getChekerboard(0xFFFFFF), getChekerboard(0xAAAAAA), getChekerboard(0xEEEEEE), getChekerboard(0xDDDDDD), getChekerboard(0xCCCCCC), getChekerboard(0xBBBBBB) );
@@ -174,32 +208,32 @@ package awaybuilder.model
public function CreateFilteredShadowMapMethod( light:LightVO ):ShadowMethodVO
{
var method:FilteredShadowMapMethod = new FilteredShadowMapMethod( GetObject(light) as DirectionalLight );
- method.name = "FilteredShadow " + AssetUtil.GetNextId("FilteredShadowMapMethod");
+ method.name = "FilteredShadow" + AssetUtil.GetNextId("FilteredShadowMapMethod");
return GetAsset( method ) as ShadowMethodVO;
}
public function CreateDitheredShadowMapMethod( light:LightVO ):ShadowMethodVO
{
var method:DitheredShadowMapMethod = new DitheredShadowMapMethod( GetObject(light) as DirectionalLight );
- method.name = "DitheredShadow " + AssetUtil.GetNextId("DitheredShadowMapMethod");
+ method.name = "DitheredShadow" + AssetUtil.GetNextId("DitheredShadowMapMethod");
return GetAsset( method ) as ShadowMethodVO;
}
public function CreateSoftShadowMapMethod( light:LightVO ):ShadowMethodVO
{
var method:SoftShadowMapMethod = new SoftShadowMapMethod( GetObject(light) as DirectionalLight );
- method.name = "SoftShadow " + AssetUtil.GetNextId("SoftShadowMapMethod");
+ method.name = "SoftShadow" + AssetUtil.GetNextId("SoftShadowMapMethod");
return GetAsset( method ) as ShadowMethodVO;
}
public function CreateHardShadowMapMethod( light:LightVO ):ShadowMethodVO
{
var method:HardShadowMapMethod = new HardShadowMapMethod( GetObject(light) as LightBase );
- method.name = "HardShadow " + AssetUtil.GetNextId("HardShadowMapMethod");
+ method.name = "HardShadow" + AssetUtil.GetNextId("HardShadowMapMethod");
return GetAsset( method ) as ShadowMethodVO;
}
public function CreateNearShadowMapMethod( light:LightVO ):ShadowMethodVO
{
var simple:SoftShadowMapMethod = new SoftShadowMapMethod( GetObject(light) as DirectionalLight );
var method:NearShadowMapMethod = new NearShadowMapMethod( simple );
- method.name = "NearShadow " + AssetUtil.GetNextId("NearShadowMapMethod");
+ method.name = "NearShadow" + AssetUtil.GetNextId("NearShadowMapMethod");
var asset:ShadowMethodVO = GetAsset( method ) as ShadowMethodVO;;
asset.baseMethod = GetAsset( simple ) as ShadowMethodVO;
return asset;
@@ -208,7 +242,7 @@ package awaybuilder.model
{
var simple:SoftShadowMapMethod = new SoftShadowMapMethod( GetObject(light) as DirectionalLight );
var method:CascadeShadowMapMethod = new CascadeShadowMapMethod( simple );
- method.name = "CascadeShadow " + AssetUtil.GetNextId("CascadeShadowMapMethod");
+ method.name = "CascadeShadow" + AssetUtil.GetNextId("CascadeShadowMapMethod");
return GetAsset( method ) as ShadowMethodVO;
}
public function CreateShadingMethod( type:String ):ShadingMethodVO
View
38 awaybuilder-core/src/awaybuilder/model/SmartFactoryModelBase.as
@@ -24,6 +24,9 @@ package awaybuilder.model
import away3d.materials.lightpickers.StaticLightPicker;
import away3d.materials.methods.*;
import away3d.materials.utils.DefaultMaterialManager;
+ import away3d.primitives.CubeGeometry;
+ import away3d.primitives.SkyBox;
+ import away3d.primitives.SphereGeometry;
import away3d.textures.BitmapCubeTexture;
import away3d.textures.BitmapTexture;
@@ -54,6 +57,8 @@ package awaybuilder.model
return fillMesh( new MeshVO(), item as Mesh );
case(item is LightBase):
return fillLight( new LightVO(), item as LightBase );
+ case(item is SkyBox):
+ return fillSkyBox( new SkyBoxVO(), item as SkyBox );
case(item is Entity):
case(item is ObjectContainer3D):
return fillContainer( new ContainerVO(), item as ObjectContainer3D );
@@ -251,6 +256,13 @@ package awaybuilder.model
}
return asset;
}
+
+ private function fillSkyBox( asset:SkyBoxVO, obj:SkyBox ):SkyBoxVO
+ {
+ asset = fillAsset( asset, obj ) as SkyBoxVO;
+ asset.cubeMap = GetAsset( SkyBoxMaterial(obj.material).cubeMap ) as CubeTextureVO;
+ return asset;
+ }
private function fillLight( asset:LightVO, item:LightBase ):LightVO
{
asset = fillObject( asset, item ) as LightVO;
@@ -303,14 +315,34 @@ package awaybuilder.model
asset.indexData = item.indexData;
return asset;
}
- private function fillGeometry( asset:GeometryVO, item:Geometry ):GeometryVO
+ private function fillGeometry( asset:GeometryVO, obj:Geometry ):GeometryVO
{
- asset = fillAsset( asset, item ) as GeometryVO;
+ asset = fillAsset( asset, obj ) as GeometryVO;
+ asset.type = getQualifiedClassName( obj ).split("::")[1];
asset.subGeometries = new ArrayCollection();
- for each( var sub:ISubGeometry in item.subGeometries )
+ for each( var sub:ISubGeometry in obj.subGeometries )
{
asset.subGeometries.addItem( GetAsset(sub) );
}
+ if( obj is CubeGeometry )
+ {
+ var cubeGeometry:CubeGeometry = obj as CubeGeometry;
+ asset.width = cubeGeometry.width;
+ asset.height = cubeGeometry.height;
+ asset.depth = cubeGeometry.depth;
+ asset.tile6 = cubeGeometry.tile6;
+ asset.segmentsW = cubeGeometry.segmentsW;
+ asset.segmentsH = cubeGeometry.segmentsH;
+ asset.segmentsD = cubeGeometry.segmentsD;
+ }
+ else if( obj is SphereGeometry )
+ {
+ var sphereGeometry:SphereGeometry = obj as SphereGeometry;
+ asset.radius = sphereGeometry.radius;
+ asset.yUp = sphereGeometry.yUp;
+ asset.segmentsW = sphereGeometry.segmentsW;
+ asset.segmentsH = sphereGeometry.segmentsH;
+ }
return asset;
}
View
2  awaybuilder-core/src/awaybuilder/model/UndoRedoModel.as
@@ -15,7 +15,7 @@ import org.robotlegs.mvcs.Actor;
private var _undoStack:Vector.<HistoryEvent> = new <HistoryEvent>[];
private var _redoStack:Vector.<HistoryEvent> = new <HistoryEvent>[];
- public var maxUndoActions:int = 133;
+ public var maxUndoActions:int = 666;
public function get canUndo():Boolean
{
View
24 awaybuilder-core/src/awaybuilder/model/vo/scene/GeometryVO.as
@@ -9,6 +9,19 @@ package awaybuilder.model.vo.scene
public class GeometryVO extends AssetVO
{
+ public var type:String;
+
+ public var radius:Number;
+ public var yUp:Boolean;
+
+ public var width:Number;
+ public var height:Number;
+ public var depth:Number;
+ public var tile6:Boolean;
+ public var segmentsW:uint;
+ public var segmentsH:uint;
+ public var segmentsD:Number;
+
public var subGeometries:ArrayCollection;
public function clone():GeometryVO
@@ -23,6 +36,17 @@ package awaybuilder.model.vo.scene
this.name = asset.name;
this.subGeometries = asset.subGeometries;
+ this.type = asset.type;
+
+ this.width = asset.width;
+ this.height = asset.height;
+ this.depth = asset.depth;
+ this.tile6 = asset.tile6;
+ this.segmentsW = asset.segmentsW;
+ this.segmentsH = asset.segmentsH;
+ this.segmentsD = asset.segmentsD;
+ this.radius = asset.radius;
+ this.yUp = asset.yUp;
this.id = asset.id;
}
View
26 awaybuilder-core/src/awaybuilder/model/vo/scene/SkyBoxVO.as
@@ -0,0 +1,26 @@
+package awaybuilder.model.vo.scene
+{
+ import away3d.primitives.SkyBox;
+
+ [Bindable]
+ public class SkyBoxVO extends AssetVO
+ {
+
+ public var cubeMap:CubeTextureVO;
+
+ public function clone():SkyBoxVO
+ {
+ var clone:SkyBoxVO = new SkyBoxVO();
+ clone.fillFromSkyBox( this );
+ return clone;
+ }
+
+ public function fillFromSkyBox( asset:SkyBoxVO ):void
+ {
+ this.id = asset.id;
+ this.name = asset.name;
+ this.cubeMap = asset.cubeMap;
+ }
+
+ }
+}
View
80 awaybuilder-core/src/awaybuilder/view/components/LibraryPanel.mxml
@@ -9,10 +9,7 @@
<s:Power id="collapseEaser" exponent="2" easeInFraction="0.1" />
<s:Resize id="collapseEffect" duration="150" easer="{collapseEaser}" heightTo="24" />
<fx:Component className="NewTexturePopup">
- <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer"
- chromeColor="0x1d1d1c" color="0xdbdbdb"
- mouseDownOutside="close();"
- >
+ <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb" mouseDownOutside="close();">
<s:layout>
<s:VerticalLayout gap="0"/>
</s:layout>
@@ -21,10 +18,7 @@
</s:SkinnablePopUpContainer>
</fx:Component>
<fx:Component className="NewLightPopup">
- <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer"
- chromeColor="0x1d1d1c" color="0xdbdbdb"
- mouseDownOutside="close();"
- >
+ <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb" mouseDownOutside="close();">
<s:layout>
<s:VerticalLayout gap="0"/>
</s:layout>
@@ -34,10 +28,7 @@
</s:SkinnablePopUpContainer>
</fx:Component>
<fx:Component className="NewEffectPopup">
- <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer"
- chromeColor="0x1d1d1c" color="0xdbdbdb"
- mouseDownOutside="close();"
- >
+ <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb" mouseDownOutside="close();">
<s:layout>
<s:VerticalLayout gap="0"/>
</s:layout>
@@ -54,6 +45,24 @@
<s:Button width="100%" label="New EnvMapMethod" styleName="addItemButton" cornerRadius="0" click="close(true,'EnvMapMethod')"/>
</s:SkinnablePopUpContainer>
</fx:Component>
+ <fx:Component className="NewGeometryPopup">
+ <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb" mouseDownOutside="close();" >
+ <s:layout>
+ <s:VerticalLayout gap="0"/>
+ </s:layout>
+ <s:Button width="100%" label="New CubeGeometry" styleName="addItemButton" cornerRadius="0" click="close(true,'CubeGeometry')"/>
+ <s:Button width="100%" label="New SphereGeometry" styleName="addItemButton" cornerRadius="0" click="close(true,'SphereGeometry')"/>
+ </s:SkinnablePopUpContainer>
+ </fx:Component>
+ <fx:Component className="NewObjectsPopup">
+ <s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb" mouseDownOutside="close();" >
+ <s:layout>
+ <s:VerticalLayout gap="0"/>
+ </s:layout>
+ <s:Button width="100%" label="New Mesh" styleName="addItemButton" cornerRadius="0" click="close(true,'Mesh')"/>
+ <s:Button width="100%" label="New SkyBox" styleName="addItemButton" cornerRadius="0" click="close(true,'SkyBox')"/>
+ </s:SkinnablePopUpContainer>
+ </fx:Component>
</fx:Declarations>
<fx:Script>
<![CDATA[
@@ -159,7 +168,29 @@
{
this.dispatchEvent( new LibraryPanelEvent( LibraryPanelEvent.ADD_MATERIAL ) );
}
+ protected function scenePanel_addNewItemHandler(event:MouseEvent):void
+ {
+ var button:ButtonBase = event.relatedObject as ButtonBase;
+ var popup:NewObjectsPopup = new NewObjectsPopup();
+ popup.open(this);
+ popup.addEventListener('close', newObjectPopup_closeHandler);
+ var pos:Point = button.localToGlobal( new Point() );
+ popup.move( pos.x-4, Math.min(pos.y-4, stage.height-popup.height-8) );
+ }
+ private function newObjectPopup_closeHandler(event:PopUpEvent):void
+ {
+ if (!event.commit) return;
+ switch(event.data)
+ {
+ case "Mesh":
+ this.dispatchEvent( new LibraryPanelEvent( LibraryPanelEvent.ADD_MESH ) );
+ break;
+ default:
+ this.dispatchEvent( new LibraryPanelEvent( LibraryPanelEvent.ADD_SKYBOX ) );
+ break;
+ }
+ }
private function newTexturePopup_closeHandler(event:PopUpEvent):void
{
if (!event.commit) return;
@@ -191,11 +222,27 @@
var pos:Point = button.localToGlobal( new Point() );
popup.move( pos.x-4, Math.min(pos.y-4, stage.height-popup.height-8) );
}
+ private function geometryPanel_addNewItemHandler(event:MouseEvent):void
+ {
+ var button:ButtonBase = event.relatedObject as ButtonBase;
+ var popup:NewGeometryPopup = new NewGeometryPopup();
+ popup.open(this);
+ popup.addEventListener('close', newGeometryPopup_closeHandler);
+ var pos:Point = button.localToGlobal( new Point() );
+ popup.move( pos.x-4, Math.min(pos.y-4, stage.height-popup.height-8) );
+ }
+
private function newEffectPopup_closeHandler(event:PopUpEvent):void
{
if (!event.commit) return;
this.dispatchEvent( new LibraryPanelEvent( LibraryPanelEvent.ADD_EFFECTMETHOD, event.data ) );
- }
+ }
+ private function newGeometryPopup_closeHandler(event:PopUpEvent):void
+ {
+ if (!event.commit) return;
+ this.dispatchEvent( new LibraryPanelEvent( LibraryPanelEvent.ADD_GEOMETRY, event.data ) );
+ }
+
private function newLightPopup_closeHandler(event:PopUpEvent):void
{
if (!event.commit) return;
@@ -234,7 +281,9 @@
</fx:Script>
<s:VGroup width="225" height="100%" gap="0">
<controls:LibraryCollapsiblePanel id="scenePanel" skinClass="awaybuilder.view.skins.CollapsibleDropdownLibraryPanelSkin" borderVisible="false"
- title="Scene Objects" width="100%" collapsed="false" height="100%" collapsedChange="panel_collapsedChangeHandler(event)">
+ title="Scene Objects" width="100%" collapsed="false" height="100%" addEnabled="true"
+ addNewItem="scenePanel_addNewItemHandler(event)"
+ collapsedChange="panel_collapsedChangeHandler(event)">
<tree:Tree id="sceneTree" dataProvider="{model.scene}" selectedItems="{selectedItems}" indentation="10"
change="tree_changeHandler(event)"
width="100%" height="100%"/>
@@ -256,7 +305,8 @@
width="100%" height="100%"/>
</controls:LibraryCollapsiblePanel>
<controls:LibraryCollapsiblePanel id="geometryPanel" skinClass="awaybuilder.view.skins.CollapsibleDropdownLibraryPanelSkin" borderVisible="false"
- title="Geometry" height="24" width="100%" collapsed="true" collapsedChange="panel_collapsedChangeHandler(event)">
+ title="Geometry" height="24" width="100%" collapsed="true" collapsedChange="panel_collapsedChangeHandler(event)"
+ addNewItem="geometryPanel_addNewItemHandler(event)" addEnabled="true">
<tree:Tree id="geometryTree" dataProvider="{model.geometry}" selectedItems="{selectedItems}"
change="tree_changeHandler(event)"
width="100%" height="100%"/>
View
7 awaybuilder-core/src/awaybuilder/view/components/PropertiesPanel.mxml
@@ -24,6 +24,7 @@
<s:State name="cubeTexture"/>
<s:State name="shadowMapper"/>
<s:State name="shadingMethod"/>
+ <s:State name="skyBox"/>
</controls:states>
<fx:Declarations>
<s:Parallel id="nextTransitionEffect">
@@ -71,6 +72,9 @@
public var materials:ArrayCollection;
[Bindable]
+ public var geometry:ArrayCollection;
+
+ [Bindable]
public var cubeTextures:ArrayCollection;
[Bindable]
@@ -107,7 +111,7 @@
<editors:GlobalOptionPropertiesEditor data="{_data}" includeIn="global" />
- <editors:MeshPropertyEditor id="meshProperties" prevSelected="{prevSelected}" data="{_data}" includeIn="mesh,initAll" />
+ <editors:MeshPropertyEditor geometry="{geometry}" prevSelected="{prevSelected}" data="{_data}" includeIn="mesh,initAll" />
<s:Group includeIn="group,initAll"><s:Label text="Group Options"/></s:Group>
@@ -122,6 +126,7 @@
<editors:ShadowMapperPropertyEditor prevSelected="{prevSelected}" data="{_data}" includeIn="shadowMapper,initAll" />
<editors:ShadingPropertyEditor textures="{defaultableTextures}" cubeTextures="{cubeTextures}" prevSelected="{prevSelected}" data="{_data}" includeIn="shadingMethod,initAll" />
<editors:GeometryPropertiesEditor prevSelected="{prevSelected}" data="{_data}" includeIn="geometry,initAll" />
+ <editors:SkyBoxPropertiesEditor prevSelected="{prevSelected}" cubeTextures="{cubeTextures}" data="{_data}" includeIn="skyBox,initAll" />
</s:Group>
</controls:CrutchScroller>
</controls:CollapsiblePanel>
View
22 awaybuilder-core/src/awaybuilder/view/components/editors/EditorBase.as
@@ -69,6 +69,28 @@ package awaybuilder.view.components.editors
_textures = value;
}
+ private var _geometry:ArrayCollection;
+ [Bindable]
+ public function get geometry():ArrayCollection
+ {
+ return _geometry;
+ }
+ public function set geometry(value:ArrayCollection):void
+ {
+ _geometry = value;
+ }
+
+ private var _animator:ArrayCollection;
+ [Bindable]
+ public function get animator():ArrayCollection
+ {
+ return _animator;
+ }
+ public function set animator(value:ArrayCollection):void
+ {
+ _animator = value;
+ }
+
private var _lightPickers:ArrayCollection;
[Bindable]
public function get lightPickers():ArrayCollection
View
45 awaybuilder-core/src/awaybuilder/view/components/editors/GeometryPropertiesEditor.mxml
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<editors:EditorBase xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:components="awaybuilder.view.components.*" xmlns:controls="awaybuilder.view.components.controls.*"
- xmlns:editors="awaybuilder.view.components.editors.*" xmlns:mx="library://ns.adobe.com/flex/mx">
+ xmlns:editors="awaybuilder.view.components.editors.*" xmlns:mx="library://ns.adobe.com/flex/mx"
+ currentState="{_asset.type}">
+ <editors:states>
+ <s:State name="Geometry"/>
+ <s:State name="CubeGeometry"/>
+ <s:State name="SphereGeometry"/>
+ </editors:states>
<fx:Declarations>
</fx:Declarations>
<fx:Script><![CDATA[
@@ -17,9 +23,12 @@
_asset = GeometryVO(asset).clone() as GeometryVO;
}
- private function name_changeHandler(event:Event):void {
+ private function stepper_changeHandler(event:Event):void {
dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.GEOMETRY_STEPPER_CHANGE, _asset));
}
+ private function value_changeHandler(event:Event):void {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.GEOMETRY_CHANGE, _asset));
+ }
]]></fx:Script>
@@ -38,7 +47,37 @@
<s:Form width="100%" skinClass="awaybuilder.view.skins.PropertyFormSkin">
<s:FormItem label="Name" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
- <s:TextInput id="nameInput" width="100%" text="@{_asset.name}" change="name_changeHandler(event)"/>
+ <s:TextInput id="nameInput" width="100%" text="@{_asset.name}" change="stepper_changeHandler(event)"/>
+ </s:FormItem>
+ <s:FormItem label="Radius" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="SphereGeometry">
+ <controls:DragableNumericStepper value="@{_asset.radius}" stepSize="0.1" snapInterval="0.01" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="width" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="CubeGeometry">
+ <controls:DragableNumericStepper value="@{_asset.width}" stepSize="0.1" snapInterval="0.01" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="height" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="CubeGeometry">
+ <controls:DragableNumericStepper value="@{_asset.height}" stepSize="0.1" snapInterval="0.01" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="depth" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="CubeGeometry">
+ <controls:DragableNumericStepper value="@{_asset.depth}" stepSize="0.1" snapInterval="0.01" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="Tile6" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="CubeGeometry"
+ toolTip="The type of uv mapping to use.">
+ <s:CheckBox change="value_changeHandler(event)" selected="@{_asset.tile6}"/>
+ </s:FormItem>
+ <s:FormItem label="SegmentsH" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="SphereGeometry,CubeGeometry">
+ <controls:DragableNumericStepper value="@{_asset.segmentsH}" stepSize="1" snapInterval="1" minimum="1" maximum="100" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="SegmentsW" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="SphereGeometry,CubeGeometry">
+ <controls:DragableNumericStepper value="@{_asset.segmentsW}" stepSize="1" snapInterval="1" minimum="1" maximum="100" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="SegmentsD" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="CubeGeometry">
+ <controls:DragableNumericStepper value="@{_asset.segmentsD}" stepSize="1" snapInterval="1" minimum="1" maximum="100" change="stepper_changeHandler(event)" />
+ </s:FormItem>
+ <s:FormItem label="yUp" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeIn="SphereGeometry"
+ toolTip="Defines whether the sphere poles should lay on the Y-axis (true) or on the Z-axis (false).">
+ <s:CheckBox change="value_changeHandler(event)" selected="@{_asset.yUp}" />
</s:FormItem>
</s:Form>
+
</editors:EditorBase>
View
92 awaybuilder-core/src/awaybuilder/view/components/editors/MeshPropertyEditor.mxml
@@ -15,12 +15,15 @@
import awaybuilder.utils.AssetUtil;
import awaybuilder.view.components.editors.events.PropertyEditorEvent;
+ import flashx.textLayout.debug.assert;
+
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.utils.NameUtil;
import spark.events.GridItemEditorEvent;
+ import spark.events.IndexChangeEvent;
[Bindable]
private var _asset:MeshVO;
@@ -116,6 +119,27 @@
return true;
}
+ protected function geometryDropDownList_changeHandler(event:IndexChangeEvent):void
+ {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.MESH_CHANGE, _asset));
+ }
+
+ protected function animatorDropDownList_changeHandler(event:IndexChangeEvent):void
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected function geometryDropDownListButton_clickHandler(event:MouseEvent):void
+ {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.SHOW_CHILD_PROPERTIES, _asset.geometry));
+ }
+
+ protected function animatorDropDownListButton_clickHandler(event:MouseEvent):void
+ {
+// dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.SHOW_CHILD_PROPERTIES, _asset.animator));
+ }
+
]]></fx:Script>
@@ -140,66 +164,46 @@
<s:Spacer height="6"/>
<controls:CollapsiblePanel width="100%" title="General" collapsed="true">
+ <controls:PropertiesItemContainer label="Specular Method" width="100%">
+ <s:DropDownList id="geometryDropDownList" requireSelection="true" labelField="name"
+ change="geometryDropDownList_changeHandler(event)" width="100%"
+ selectedItem="@{_asset.geometry}" dataProvider="{geometry}"/>
+ <s:Button styleName="editSharedObjectButtonStyle" width="23" height="100%" click="geometryDropDownListButton_clickHandler(event)" />
+ </controls:PropertiesItemContainer>
+ <controls:PropertiesItemContainer label="Animator" width="100%" enabled="false">
+ <s:DropDownList id="animatorDropDownList" requireSelection="true" labelField="name"
+ change="animatorDropDownList_changeHandler(event)" width="100%"
+ selectedItem="" dataProvider="{animator}"/>
+ <s:Button styleName="editSharedObjectButtonStyle" width="23" height="100%" click="animatorDropDownListButton_clickHandler(event)" />
+ </controls:PropertiesItemContainer>
<s:Form height="100%" skinClass="awaybuilder.view.skins.PropertyFormSkin">
-
- <s:FormItem label="Geometry" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" enabled="false">
- <s:DropDownList width="100%"/>
- </s:FormItem>
- <s:FormItem label="Animator" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" enabled="false">
- <s:DropDownList width="100%"/>
- </s:FormItem>
<s:FormItem label="Cast Shadows" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
<s:CheckBox id="castShadowBox" change="castShadowBox_changeHandler(event)" selected="@{_asset.castsShadows}"/>
</s:FormItem>
-
</s:Form>
</controls:CollapsiblePanel>
<controls:CollapsiblePanel width="100%" title="Transformations" collapsed="true">
<s:Form width="100%" skinClass="awaybuilder.view.skins.PropertyFormSkin">
<s:FormItem label="Position" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
- <controls:DragableNumericStepper id="xStepper" stepSize="1" snapInterval="0.001"
- width="100%" value="{_asset.x}"
- change="position_commitHandler(event)" />
- <controls:DragableNumericStepper id="yStepper" stepSize="1" snapInterval="0.001"
- width="100%" value="{_asset.y}"
- change="position_commitHandler(event)"/>
- <controls:DragableNumericStepper id="zStepper" stepSize="1" snapInterval="0.001"
- width="100%" value="{_asset.z}"
- change="position_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="xStepper" stepSize="1" snapInterval="0.001" width="100%" value="{_asset.x}" change="position_commitHandler(event)" />
+ <controls:DragableNumericStepper id="yStepper" stepSize="1" snapInterval="0.001" width="100%" value="{_asset.y}" change="position_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="zStepper" stepSize="1" snapInterval="0.001" width="100%" value="{_asset.z}" change="position_commitHandler(event)"/>
</s:FormItem>
<s:FormItem label="Pivot Point" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
- <controls:DragableNumericStepper id="pivotXStepper" stepSize="1" snapInterval="0.001"
- width="100%" value="{_asset.pivotX}"
- change="pivot_commitHandler(event)" />
- <controls:DragableNumericStepper id="pivotYStepper" stepSize="1" snapInterval="0.001"
- width="100%" value="{_asset.pivotY}"
- change="pivot_commitHandler(event)"/>
- <controls:DragableNumericStepper id="pivotZStepper" stepSize="1" snapInterval="0.001"
- width="100%" value="{_asset.pivotZ}"
- change="pivot_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="pivotXStepper" stepSize="1" snapInterval="0.001" width="100%" value="{_asset.pivotX}" change="pivot_commitHandler(event)" />
+ <controls:DragableNumericStepper id="pivotYStepper" stepSize="1" snapInterval="0.001" width="100%" value="{_asset.pivotY}" change="pivot_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="pivotZStepper" stepSize="1" snapInterval="0.001" width="100%" value="{_asset.pivotZ}" change="pivot_commitHandler(event)"/>
</s:FormItem>
<s:FormItem label="Rotation" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
- <controls:DragableNumericStepper id="rotationXStepper" stepSize="1" snapInterval="0.01" allowValueWrap="true"
- minimum="-360" maximum="360" width="100%" value="{_asset.rotationX}"
- change="rotation_commitHandler(event)"/>
- <controls:DragableNumericStepper id="rotationYStepper" stepSize="1" snapInterval="0.01" allowValueWrap="true"
- minimum="-360" maximum="360" width="100%" value="{_asset.rotationY}"
- change="rotation_commitHandler(event)"/>
- <controls:DragableNumericStepper id="rotationZStepper" stepSize="1" snapInterval="0.01" allowValueWrap="true"
- minimum="-360" maximum="360" width="100%" value="{_asset.rotationZ}"
- change="rotation_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="rotationXStepper" stepSize="1" snapInterval="0.01" allowValueWrap="true" minimum="-360" maximum="360" width="100%" value="{_asset.rotationX}" change="rotation_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="rotationYStepper" stepSize="1" snapInterval="0.01" allowValueWrap="true" minimum="-360" maximum="360" width="100%" value="{_asset.rotationY}" change="rotation_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="rotationZStepper" stepSize="1" snapInterval="0.01" allowValueWrap="true" minimum="-360" maximum="360" width="100%" value="{_asset.rotationZ}" change="rotation_commitHandler(event)"/>
</s:FormItem>
<controls:HorizontalFormSeparator/>
<s:FormItem label="Scale" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
- <controls:DragableNumericStepper id="scaleXStepper" stepSize="0.01" snapInterval="0.01"
- width="100%" value="{_asset.scaleX}"
- change="scale_commitHandler(event)" />
- <controls:DragableNumericStepper id="scaleYStepper" stepSize="0.01" snapInterval="0.01"
- width="100%" value="{_asset.scaleY}"
- change="scale_commitHandler(event)"/>
- <controls:DragableNumericStepper id="scaleZStepper" stepSize="0.01" snapInterval="0.01"
- width="100%" value="{_asset.scaleZ}"
- change="scale_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="scaleXStepper" stepSize="0.01" snapInterval="0.01" width="100%" value="{_asset.scaleX}" change="scale_commitHandler(event)" />
+ <controls:DragableNumericStepper id="scaleYStepper" stepSize="0.01" snapInterval="0.01" width="100%" value="{_asset.scaleY}" change="scale_commitHandler(event)"/>
+ <controls:DragableNumericStepper id="scaleZStepper" stepSize="0.01" snapInterval="0.01" width="100%" value="{_asset.scaleZ}" change="scale_commitHandler(event)"/>
</s:FormItem>
</s:Form>
</controls:CollapsiblePanel>
View
92 awaybuilder-core/src/awaybuilder/view/components/editors/SkyBoxPropertiesEditor.mxml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<editors:EditorBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:components="awaybuilder.view.components.*"
+ xmlns:controls="awaybuilder.view.components.controls.*"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:editors="awaybuilder.view.components.editors.*">
+ <fx:Declarations>
+ </fx:Declarations>
+ <fx:Script><![CDATA[
+ import awaybuilder.model.vo.scene.AssetVO;
+ import awaybuilder.model.vo.scene.CubeTextureVO;
+ import awaybuilder.model.vo.scene.SkyBoxVO;
+ import awaybuilder.view.components.controls.events.ExtendedDropDownEvent;
+ import awaybuilder.view.components.editors.events.PropertyEditorEvent;
+
+ import spark.events.IndexChangeEvent;
+
+ [Bindable]
+ private var _asset:SkyBoxVO;
+
+ override protected function validate(asset:Object):void
+ {
+ if( !(asset is SkyBoxVO) ) return;
+ _asset = SkyBoxVO(asset).clone();
+ }
+
+ private function dropDownLabelFunction(item:AssetVO):Object
+ {
+ return item.name.split("/").pop();
+ }
+
+ private function dropDownCubeTextureIconFunction(item:CubeTextureVO):Object
+ {
+ return item.positiveX;
+ }
+
+ protected function valueStepper_changeHandler(event:Event):void
+ {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.SKYBOX_STEPPER_CHANGE, _asset, true));
+ }
+ protected function textureDropDownList_changeHandler(event:IndexChangeEvent):void
+ {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.SKYBOX_STEPPER_CHANGE, _asset, true));
+ }
+
+ protected function textureDropDownList_addNewItemHandler(event:ExtendedDropDownEvent):void
+ {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.SKYBOX_ADD_CUBE_TEXTURE, _asset, true));
+ }
+
+ protected function button1_clickHandler(event:MouseEvent):void
+ {
+ dispatchEvent(new PropertyEditorEvent(PropertyEditorEvent.SHOW_CHILD_PROPERTIES, _asset.cubeMap));
+ }
+
+ ]]></fx:Script>
+
+
+ <s:Group width="100%" top="0">
+ <s:Rect left="0" right="0" top="3" bottom="3">
+ <s:fill>
+ <s:SolidColor color="0x111111" alpha="0.3"/>
+ </s:fill>
+ </s:Rect>
+ <s:HGroup width="100%" verticalAlign="middle" paddingLeft="2" paddingRight="2" paddingTop="4" paddingBottom="4">
+ <s:Button id="editParentObjectButton" styleName="editParentObjectButtonStyle" visible="{prevSelected.length>0}"
+ width="32" height="32" click="editParentObjectButton_clickHandler(event)"/>
+ <s:Label width="100%" text="SkyBox" fontWeight="bold" fontSize="14"/>
+ </s:HGroup>
+ </s:Group>
+
+ <s:Form width="100%" skinClass="awaybuilder.view.skins.PropertyFormSkin">
+ <s:FormItem label="Name" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:TextInput id="nameInput" width="100%" text="@{_asset.name}" change="valueStepper_changeHandler(event)"/>
+ </s:FormItem>
+ </s:Form>
+
+ <controls:PropertiesItemContainer width="100%" paddingLeft="10" paddingTop="6" paddingRight="8" label="Texture">
+ <controls:ExtendedDropDownList id="textureDropDownList" width="100%" height="40" requireSelection="true"
+ itemRenderer="awaybuilder.view.components.editors.renderers.CubeTextureItemRenderer"
+ dataProvider="{cubeTextures}" selectedItem="@{_asset.cubeMap}"
+ labelFunction="{dropDownLabelFunction}" iconFunction="{dropDownCubeTextureIconFunction}"
+ newItemLabel="New Cube Texture"
+ change="textureDropDownList_changeHandler(event)"
+ addNewItem="textureDropDownList_addNewItemHandler(event)"
+ />
+ <s:Button styleName="editSharedObjectButtonStyle"
+ width="23" height="100%" click="button1_clickHandler(event)" enabled="{!textureDropDownList.selectedItem.isDefault}"/>
+ </controls:PropertiesItemContainer>
+
+</editors:EditorBase>
View
4 awaybuilder-core/src/awaybuilder/view/components/editors/events/PropertyEditorEvent.as
@@ -71,6 +71,10 @@ package awaybuilder.view.components.editors.events
public static const EFFECTMETHOD_ADD_CUBE_TEXTURE:String = "effectmethodAddCubeTexture";
public static const EFFECTMETHOD_STEPPER_CHANGE:String = "effectmethodStepperChange";
+ public static const SKYBOX_CHANGE:String = "skyboxChange";
+ public static const SKYBOX_ADD_CUBE_TEXTURE:String = "skyboxAddCubeTexture";
+ public static const SKYBOX_STEPPER_CHANGE:String = "skyboxStepperChange";
+
public static const LIGHTPICKER_CHANGE:String = "lightPickerChange";
public static const LIGHTPICKER_STEPPER_CHANGE:String = "lightPickerStepperChange";
public static const LIGHTPICKER_ADD_DIRECTIONAL_LIGHT:String = "lightPickerAddDirectionalLight";
View
4 awaybuilder-core/src/awaybuilder/view/components/events/LibraryPanelEvent.as
@@ -9,7 +9,9 @@ package awaybuilder.view.components.events
public static const ADD_TEXTURE:String = "addTexture";
public static const ADD_CUBE_TEXTURE:String = "addCubeTexture";
public static const ADD_MATERIAL:String = "addMaterial";
-
+ public static const ADD_SKYBOX:String = "addSkyBox";
+ public static const ADD_MESH:String = "addMesh";
+ public static const ADD_GEOMETRY:String = "addGeometry";
public static const ADD_EFFECTMETHOD:String = "addEffectMethod";
public static const ADD_DIRECTIONAL_LIGHT:String = "addDirectionalLight";
View
69 awaybuilder-core/src/awaybuilder/view/mediators/CoreEditorMediator.as
@@ -1,6 +1,7 @@
package awaybuilder.view.mediators
{
import away3d.containers.ObjectContainer3D;
+ import away3d.core.base.Geometry;
import away3d.core.base.Object3D;
import away3d.core.base.SubMesh;
import away3d.entities.Mesh;
@@ -18,6 +19,7 @@ package awaybuilder.view.mediators
import away3d.materials.MaterialBase;
import away3d.materials.MultiPassMaterialBase;
import away3d.materials.SinglePassMaterialBase;
+ import away3d.materials.SkyBoxMaterial;
import away3d.materials.TextureMaterial;
import away3d.materials.TextureMultiPassMaterial;
import away3d.materials.lightpickers.LightPickerBase;
@@ -54,6 +56,9 @@ package awaybuilder.view.mediators
import away3d.materials.methods.SoftShadowMapMethod;
import away3d.materials.methods.SubsurfaceScatteringDiffuseMethod;
import away3d.materials.methods.WrapDiffuseMethod;
+ import away3d.primitives.CubeGeometry;
+ import away3d.primitives.SkyBox;
+ import away3d.primitives.SphereGeometry;
import away3d.textures.BitmapCubeTexture;
import away3d.textures.CubeTextureBase;
import away3d.textures.Texture2DBase;
@@ -69,6 +74,7 @@ package awaybuilder.view.mediators
import awaybuilder.model.vo.scene.CubeTextureVO;
import awaybuilder.model.vo.scene.EffectMethodVO;
import awaybuilder.model.vo.scene.ExtraItemVO;
+ import awaybuilder.model.vo.scene.GeometryVO;
import awaybuilder.model.vo.scene.LightPickerVO;
import awaybuilder.model.vo.scene.LightVO;
import awaybuilder.model.vo.scene.MaterialVO;
@@ -77,6 +83,7 @@ package awaybuilder.view.mediators
import awaybuilder.model.vo.scene.ShadingMethodVO;
import awaybuilder.model.vo.scene.ShadowMapperVO;
import awaybuilder.model.vo.scene.ShadowMethodVO;
+ import awaybuilder.model.vo.scene.SkyBoxVO;
import awaybuilder.model.vo.scene.SubMeshVO;
import awaybuilder.utils.scene.CameraManager;
import awaybuilder.utils.scene.Scene3DManager;
@@ -137,6 +144,8 @@ package awaybuilder.view.mediators
addContextListener(SceneEvent.CHANGE_EFFECT_METHOD, eventDispatcher_changeEffectMethodHandler);
addContextListener(SceneEvent.CHANGE_SHADOW_MAPPER, eventDispatcher_changeShadowMapperHandler);
addContextListener(SceneEvent.CHANGE_CUBE_TEXTURE, eventDispatcher_changeCubeTextureHandler);
+ addContextListener(SceneEvent.CHANGE_GEOMETRY, eventDispatcher_changeGeometryHandler);
+ addContextListener(SceneEvent.CHANGE_SKYBOX, eventDispatcher_changeSkyboxHandler);
addContextListener(SceneEvent.ADD_NEW_TEXTURE, eventDispatcher_addNewTextureHandler);
addContextListener(SceneEvent.ADD_NEW_CUBE_TEXTURE, eventDispatcher_addNewCubeTextureHandler);
@@ -307,6 +316,15 @@ package awaybuilder.view.mediators
}
}
+ private function applySkyBox( asset:SkyBoxVO ):void
+ {
+ var obj:SkyBox = assets.GetObject( asset ) as SkyBox;
+ var newSkyBox:SkyBox = new SkyBox( assets.GetObject( asset.cubeMap ) as CubeTextureBase );
+ newSkyBox.name = asset.name;
+ Scene3DManager.removeMesh(obj);
+ Scene3DManager.addObject(newSkyBox);
+ assets.ReplaceObject( obj, newSkyBox );
+ }
private function applyEffectMethod( asset:EffectMethodVO ):void
{
var obj:EffectMethodBase = assets.GetObject( asset ) as EffectMethodBase;
@@ -756,6 +774,12 @@ package awaybuilder.view.mediators
var obj:Mesh = assets.GetObject( item ) as Mesh;
applyContainer( item );
obj.castsShadows = item.castsShadows;
+ obj.geometry = assets.GetObject( item.geometry ) as Geometry;
+
+ for( var i:int = 0; i < obj.subMeshes.length; i++ )
+ {
+ assets.ReplaceObject( assets.GetObject( item.subMeshes.getItemAt(i) as AssetVO ), obj.subMeshes[i] );
+ }
for each( var sub:SubMeshVO in item.subMeshes )
{
applySubMesh( sub );
@@ -826,10 +850,14 @@ package awaybuilder.view.mediators
{
applyEffectMethod( event.items[0] as EffectMethodVO );
}
- if( event.items[0] is ShadingMethodVO )
+ else if( event.items[0] is ShadingMethodVO )
{
applyShadingMethod( event.items[0] as ShadingMethodVO );
}
+ else if( event.items[0] is SkyBoxVO )
+ {
+ applySkyBox( event.items[0] as SkyBoxVO );
+ }
}
}
@@ -851,6 +879,45 @@ package awaybuilder.view.mediators
}
}
+ private function eventDispatcher_changeSkyboxHandler(event:SceneEvent):void
+ {
+ var asset:SkyBoxVO = event.items[0] as SkyBoxVO;
+ if( asset )
+ {
+ applySkyBox( asset );
+ var obj:SkyBox = assets.GetObject( asset ) as SkyBox;
+ obj.name = asset.name;
+ SkyBoxMaterial(obj.material).cubeMap = assets.GetObject( asset.cubeMap ) as CubeTextureBase;
+ }
+ }
+ private function eventDispatcher_changeGeometryHandler(event:SceneEvent):void
+ {
+ var asset:GeometryVO = event.items[0] as GeometryVO;
+ if( asset )
+ {
+ var obj:Geometry = assets.GetObject( asset ) as Geometry;
+ obj.name = asset.name;
+ if( obj is CubeGeometry )
+ {
+ var cubeGeometry:CubeGeometry = obj as CubeGeometry;
+ cubeGeometry.width = asset.width;
+ cubeGeometry.height = asset.height;
+ cubeGeometry.depth = asset.depth;
+ cubeGeometry.tile6 = asset.tile6;
+ cubeGeometry.segmentsD = asset.segmentsD;
+ cubeGeometry.segmentsH = asset.segmentsH;
+ cubeGeometry.segmentsW = asset.segmentsW;
+ }
+ else if( obj is SphereGeometry )
+ {
+ var sphereGeometry:SphereGeometry = obj as SphereGeometry;
+ sphereGeometry.radius = asset.radius;
+ sphereGeometry.yUp = asset.yUp;
+ sphereGeometry.segmentsW = asset.segmentsW;
+ sphereGeometry.segmentsH = asset.segmentsH;
+ }
+ }
+ }
private function eventDispatcher_changeCubeTextureHandler(event:SceneEvent):void
{
var asset:CubeTextureVO = event.items[0] as CubeTextureVO;
View
33 awaybuilder-core/src/awaybuilder/view/mediators/LibraryPanelMediator.as
@@ -4,6 +4,7 @@ package awaybuilder.view.mediators
import away3d.lights.DirectionalLight;
import away3d.materials.lightpickers.LightPickerBase;
import away3d.materials.lightpickers.StaticLightPicker;
+ import away3d.primitives.SkyBox;
import awaybuilder.controller.document.events.ImportTextureEvent;
import awaybuilder.controller.events.DocumentEvent;
@@ -18,11 +19,13 @@ package awaybuilder.view.mediators
import awaybuilder.model.vo.scene.AssetVO;
import awaybuilder.model.vo.scene.CubeTextureVO;
import awaybuilder.model.vo.scene.EffectMethodVO;
+ import awaybuilder.model.vo.scene.GeometryVO;
import awaybuilder.model.vo.scene.LightPickerVO;
import awaybuilder.model.vo.scene.LightVO;
import awaybuilder.model.vo.scene.MaterialVO;
import awaybuilder.model.vo.scene.MeshVO;
import awaybuilder.model.vo.scene.ShadowMethodVO;
+ import awaybuilder.model.vo.scene.SkyBoxVO;
import awaybuilder.utils.AssetUtil;
import awaybuilder.utils.DataMerger;
import awaybuilder.utils.ScenegraphFactory;
@@ -61,7 +64,9 @@ package awaybuilder.view.mediators
addViewListener(LibraryPanelEvent.ADD_LIGHTPICKER, view_addLightPickerHandler);
addViewListener(LibraryPanelEvent.ADD_TEXTURE, view_addTextureHandler);
addViewListener(LibraryPanelEvent.ADD_CUBE_TEXTURE, view_addCubeTextureHandler);
-
+ addViewListener(LibraryPanelEvent.ADD_GEOMETRY, view_addGeometryHandler);
+ addViewListener(LibraryPanelEvent.ADD_MESH, view_addMeshHandler);
+ addViewListener(LibraryPanelEvent.ADD_SKYBOX, view_addSkyBoxHandler);
addViewListener(LibraryPanelEvent.ADD_EFFECTMETHOD, view_addEffectMethodHandler);
addViewListener(LibraryPanelEvent.ADD_MATERIAL, view_addMaterialHandler);
@@ -102,6 +107,32 @@ package awaybuilder.view.mediators
{
this.dispatch(new ImportTextureEvent(ImportTextureEvent.IMPORT_AND_ADD, null));
}
+
+ private function view_addGeometryHandler(event:LibraryPanelEvent):void
+ {
+ var asset:GeometryVO = assets.CreateGeometry( event.data as String );
+ this.dispatch(new SceneEvent(SceneEvent.ADD_NEW_GEOMETRY,null,asset));
+ this.dispatch(new SceneEvent(SceneEvent.SELECT,[asset]));
+ }
+
+ private function view_addSkyBoxHandler(event:LibraryPanelEvent):void
+ {
+ var asset:SkyBoxVO = assets.CreateSkyBox();
+ this.dispatch(new SceneEvent(SceneEvent.ADD_NEW_SKYBOX,null,asset));
+ this.dispatch(new SceneEvent(SceneEvent.SELECT,[asset]));
+ }
+ private function view_addMeshHandler(event:LibraryPanelEvent):void
+ {
+ if( !document.geometry.length )
+ {
+ Alert.show( "To create a Mesh, you need Geometry", "Cancelled" );
+ return;
+ }
+ var asset:MeshVO = assets.CreateMesh( document.geometry.getItemAt(0) as GeometryVO );
+ this.dispatch(new SceneEvent(SceneEvent.ADD_NEW_MESH,null,asset));
+ this.dispatch(new SceneEvent(SceneEvent.SELECT,[asset]));
+ }
+
private function view_addCubeTextureHandler(event:LibraryPanelEvent):void
{
var asset:CubeTextureVO = assets.CreateCubeTexture();
View
36 awaybuilder-core/src/awaybuilder/view/mediators/PropertiesPanelMediator.as
@@ -19,6 +19,7 @@ package awaybuilder.view.mediators
import awaybuilder.model.vo.scene.ShadingMethodVO;
import awaybuilder.model.vo.scene.ShadowMapperVO;
import awaybuilder.model.vo.scene.ShadowMethodVO;
+ import awaybuilder.model.vo.scene.SkyBoxVO;
import awaybuilder.model.vo.scene.SubMeshVO;
import awaybuilder.model.vo.scene.TextureVO;
import awaybuilder.utils.AssetUtil;
@@ -63,6 +64,7 @@ package awaybuilder.view.mediators
addContextListener(SceneEvent.CHANGE_CUBE_TEXTURE, context_simpleUpdateHandler);
addContextListener(SceneEvent.CHANGE_GLOBAL_OPTIONS, context_simpleUpdateHandler);
addContextListener(SceneEvent.CHANGE_EFFECT_METHOD, context_simpleUpdateHandler);
+ addContextListener(SceneEvent.CHANGE_SKYBOX, context_simpleUpdateHandler);
addContextListener(SceneEvent.ADD_NEW_TEXTURE, eventDispatcher_addNewTextureHandler);
addContextListener(SceneEvent.ADD_NEW_CUBE_TEXTURE, eventDispatcher_addNewTextureHandler);
@@ -102,6 +104,10 @@ package awaybuilder.view.mediators
addViewListener( PropertyEditorEvent.SHADOWMETHOD_CHANGE, view_shadowmethodChangeHandler );
addViewListener( PropertyEditorEvent.SHADOWMETHOD_STEPPER_CHANGE, view_shadowmethodChangeStepperHandler );
+ addViewListener( PropertyEditorEvent.SKYBOX_CHANGE, view_skyboxChangeHandler );
+ addViewListener( PropertyEditorEvent.SKYBOX_STEPPER_CHANGE, view_skyboxChangeStepperHandler );
+ addViewListener( PropertyEditorEvent.SKYBOX_ADD_CUBE_TEXTURE, view_skyboxAddCubeTextureHandler );
+
addViewListener( PropertyEditorEvent.SHADINGMETHOD_CHANGE, view_shadingmethodChangeHandler );
addViewListener( PropertyEditorEvent.SHADINGMETHOD_ADD_TEXTURE, view_shadingmethodAddTextureHandler );
addViewListener( PropertyEditorEvent.SHADINGMETHOD_ADD_CUBE_TEXTURE, view_shadingmethodAddCubeTextureHandler );
@@ -291,7 +297,20 @@ package awaybuilder.view.mediators
{
this.dispatch(new SceneEvent(SceneEvent.CHANGE_SHADOW_MAPPER,[view.data], event.data, true));
}
-
+ private function view_skyboxChangeHandler(event:PropertyEditorEvent):void
+ {
+ this.dispatch(new SceneEvent(SceneEvent.CHANGE_SKYBOX,[view.data], event.data));
+ }
+ private function view_skyboxChangeStepperHandler(event:PropertyEditorEvent):void
+ {
+ this.dispatch(new SceneEvent(SceneEvent.CHANGE_SKYBOX,[view.data], event.data));
+ }
+ private function view_skyboxAddCubeTextureHandler(event:PropertyEditorEvent):void
+ {
+ var e:SceneEvent = new SceneEvent(SceneEvent.ADD_NEW_CUBE_TEXTURE,[view.data],assets.CreateCubeTexture());
+ e.options = "cubeMap";
+ this.dispatch(e);
+ }
private function view_shadowmethodChangeHandler(event:PropertyEditorEvent):void
{
this.dispatch(new SceneEvent(SceneEvent.CHANGE_SHADOW_METHOD,[view.data], event.data));
@@ -567,6 +586,11 @@ package awaybuilder.view.mediators
view.SetData(mesh);
view.showEditor( "mesh", event.newValue, event.oldValue );
}
+ else if( event.items[0] is SkyBoxVO )
+ {
+ view.showEditor( "skyBox", event.newValue, event.oldValue );
+ view.SetData(event.items[0]);
+ }
else if( event.items[0] is ContainerVO )
{
view.showEditor( "container", event.newValue, event.oldValue );
@@ -688,6 +712,16 @@ package awaybuilder.view.mediators
view.defaultableTextures = new ArrayCollection(defaultableTextures);
view.cubeTextures = new ArrayCollection(cubeTextures);
+ var geometry:Array = [];
+ for each( asset in document.geometry )
+ {
+ if( asset is GeometryVO )
+ {
+ geometry.push( asset );
+ }
+ }
+ view.geometry = new ArrayCollection(geometry);
+
var materials:ArrayCollection = new ArrayCollection( document.materials.source.concat() );
materials.addItemAt( assets.GetDefaultMaterial(), 0 );
view.materials = materials;
View
BIN  exampleScenes/globeAssets/earth_ambient.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/earth_clouds.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/earth_diffuse.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/earth_normals.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/earth_specular.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare0.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare10.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare11.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare12.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare5.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare6.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare7.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare8.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/flare9.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/moon.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/space_negX.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/space_negY.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/space_negZ.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/space_posX.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/space_posY.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/space_posZ.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  exampleScenes/globeAssets/star.jpg
Diff not rendered
View
BIN  exampleScenes/globeAssets/sun.jpg
Diff not rendered
Please sign in to comment.
Something went wrong with that request. Please try again.