Permalink
Browse files

fix #217

  • Loading branch information...
1 parent f2e860e commit a0004cf8ffa70ada5f440b29a90100afbd8a5b33 @80prozent 80prozent committed Jul 9, 2013
View
4 awaybuilder-core/src/awaybuilder/model/SmartDocumentServiceBase.as
@@ -19,6 +19,7 @@ package awaybuilder.model
import away3d.materials.MaterialBase;
import away3d.materials.TextureMaterial;
import away3d.materials.methods.EffectMethodBase;
+ import away3d.materials.methods.ShadowMapMethodBase;
import away3d.primitives.SkyBox;
import away3d.textures.Texture2DBase;
@@ -210,6 +211,9 @@ package awaybuilder.model
assets.checkEffectMethodForDefaulttexture(event.asset as EffectMethodBase)
_document.materials.addItem( assets.GetAsset( event.asset ) );
break;
+ case AssetType.SHADOW_MAP_METHOD:
+ assets.GetAsset( event.asset );
+ break;
case AssetType.LIGHT:
var light:LightBase = event.asset as LightBase;
_objects.push( light );
View
9 awaybuilder-core/src/awaybuilder/model/SmartFactoryModelBase.as
@@ -366,6 +366,15 @@ package awaybuilder.model
asset.alpha = item.alpha;
asset.type = getQualifiedClassName( item ).split("::")[1];
+
+ var alreadyAdded:Boolean = false;
+ for each( var method:ShadowMethodVO in asset.castingLight.shadowMethods )
+ {
+ if( method.equals( asset ) ) alreadyAdded = true;
+ }
+ if( !alreadyAdded ) asset.castingLight.shadowMethods.addItem( asset );
+
+
if( item is SoftShadowMapMethod )
{
var softShadowMapMethod:SoftShadowMapMethod = item as SoftShadowMapMethod;
View
8 awaybuilder-core/src/awaybuilder/utils/encoders/AWDEncoder.as
@@ -4,6 +4,7 @@ package awaybuilder.utils.encoders
import away3d.core.base.Geometry;
import away3d.core.math.MathConsts;
import away3d.entities.Mesh;
+ import away3d.materials.methods.MethodVO;
import awaybuilder.AwayBuilder;
import awaybuilder.model.DocumentModel;
@@ -52,7 +53,7 @@ package awaybuilder.utils.encoders
public class AWDEncoder implements ISceneGraphEncoder
{
// set debug to true to get some traces in the console
- private var _debug:Boolean=false;
+ private var _debug:Boolean=true;
private var _body : ByteArray;
private var _blockBody : ByteArray;
private var _blockCache : Dictionary;
@@ -441,7 +442,7 @@ package awaybuilder.utils.encoders
var newParentID:uint=0;
switch (true){
- case (vo is LightVO):
+ case (vo is LightVO):
if (!_exportedObjects[vo.id]){
if(_debug)trace("LightVO = "+LightVO(vo).name+" parentID = "+parentID);
_blockCache[vo]=thisBlock;
@@ -454,6 +455,9 @@ package awaybuilder.utils.encoders
newParentID=_encodeCommand(ObjectVO(vo),_exportedObjects[vo.id],parentID);
thisBlock.id=newParentID;
}
+ for each(var shadowMeth:ShadowMethodVO in LightVO(vo).shadowMethods){
+ _getBlockIDorEncodeAsset(shadowMeth)
+ }
break;
case (vo is TextureProjectorVO):
if (!_exportedObjects[vo.id]){

0 comments on commit a0004cf

Please sign in to comment.