Hey Rob
Sorry but there are really things i do not understand while loading
external assets.
here is part of my script :
private function loadObjects():void
{
//var context:AssetLoaderContext = new AssetLoaderContext();
var loader:Loader3D = new Loader3D();
loader.addEventListener(AssetEvent.ASSET_COMPLETE,
onAssetComplete);
loader.load(new URLRequest("assets/test/test.3ds"),new
Max3DSParser());
this.scene.addChild(loader);
}
private function onAssetComplete(event:AssetEvent):void
{
trace("on asset loaded "+event.asset.name+"
type="+event.asset.assetType);
switch (event.asset.assetType) {
case AssetType.MESH :
trace("asset loaded mesh "+event.asset.name);
mesh = event.asset as Mesh;
mesh.castsShadows = true;
mesh.material = material;
break
case AssetType.BITMAP :
var bmp:BitmapDataAsset = event.asset as
BitmapDataAsset;
trace("material info"+bmp.name);
material = new BitmapMaterial();
material.bitmapData = bmp.bitmapData;
material.shadowMethod = new
FilteredShadowMapMethod(this.light);
material.lights = [this.light];
material.gloss = 30;
material.specular = 1;
material.ambientColor = 0x303040;
material.ambient = 1;
break;
default:
break;
}
}
the problem is the following one : on my traces, i see the texture
Uvmapped about my objet is well loaded, but the mesh itself doesn't.
have also tried to do the same with assetLibrary.load(..) with the same
result. If i request to load the jpg , it works, if i request to load
the 3ds, it load the jpg ....
I really understand nothing at all ... Does anyone has a simple sample
about how to load an external mesh ?
PS: just in case, the textures, material etc... has to have width/height
to be an exposure of 2, and max 2048. This was not the case in away3D 3.6.
Le 12/10/2011 22:56, Rob Bateman a écrit :
Hey Fabrice
there will be more demos in the away3d-examples-fp11 folder of this
nature in the coming weeks. But to answer your question directly, yes
there is. You can use the mapUrl() method of the AssetLoaderContext
that is passed as an optional parameter in all load operations in
Away3D if you are having trouble local/global filepaths, or you can
set the includeDependencies property to false and manually handle the
initialisation of materials by setting up an assetComplete event
handler for all material assets encountered in the AssetLibrary parser.
On Wed, Oct 12, 2011 at 8:58 PM, fabrice wolf <fabrice.w...@gmail.com
<mailto:fabrice.w...@gmail.com>> wrote:
Hi
I am currently trying to upgrade my 3D map engine from 3.6 to 4.0.
I used to use TextureQueue, but it seems we have to use
AssetLibrary class now.
My problem is that i can't embed the assets in my swf's, i need to
load them then to build dynamically the objects.
In 3.6, i was using 2 texturequeues feeded with xmls, one to load
the texture, the other to load the normalmaps, and when i was sure
everyhting was well laoded, i loaded the 3ds and build the objetcs
and the meshes with good textures and normal maps.
I have really look everywhere, but i have found no tutorial,
niether explanation anywhere on how to load assets in 4.0.
Anyone could help me ? Is there a solution to "push" urls of
assets to load in the assetlibrary, then to load everthing at once ?
any help would be faaaar welcome
fabrice
--
Rob Bateman
Flash Development & Consultancy
rob.bate...@gmail.com <mailto:rob.bate...@gmail.com>
www.infiniteturtles.co.uk <http://www.infiniteturtles.co.uk>
www.away3d.com <http://www.away3d.com>
--
Fabrice Wolf
Ludoptin / Machiavelic SARL
Tel : 04 84 25 25 78