Assetlibrary

Software: Away3D 4.x

dona, Jr. Member
Posted: 05 June 2012 08:17 AM   Total Posts: 46

Hi Guys,

I’ve 2 queries regarding AssetLoader

1.  I’ve loaded an external obj file using AssetLoader. The obj file contains 20 meshs. But i failed to get the exact name of each mesh in ASSET_COMPLETE event listener, it shows the mesh name as obj0, obj1 & obj2 etc.

For debugging I’ve loaded that obj file in Prefab, it shows the meshs with exact name what i had given in Maya.

My code:

AssetLibrary.load(new URLRequest(’../assets/scene/obj/Scene/scene.obj’), null, “scene”);
 
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onSceneResourceComplete);

private function onSceneResourceComplete(e:AssetEvent):void {

trace(“loaded resource: “+e.asset.name);

}

2.  Is it possible to get load progress information in AssetLoader, like bytesLoaded/totalBytesLoaded ?


Thanks in Advance

Dona

   

Richard Olsson, Administrator
Posted: 16 June 2012 12:41 PM   Total Posts: 1192   [ # 1 ]

1. What version of the codebase are you using? Where did you get it from and when? If Prefab can understand the names, then it should be easy for us to make sure that Away3D can to since basically the same parser is being used by both.

2. I’m assuming you want bytesLoaded and bytesTotal (not two properties defining the amount of bytes loaded)? Unfortunately there is no way of getting this. It’s a rather complicated issue, since AssetLoader doesn’t know the totalBytes until it’s basically done. It doesn’t just load a single file, but whenever a dependency is encountered, it will load that too.

In the case of OBJ files, it may load a 5kb file (.obj), and then when it parses that file it finds a reference to another 1kb file (.mtl) which in turn referens five texture files, each 100kb.

In this case the bytesTotal would first say 5kb, and then when it’s almost done it would suddenly jump up to 6kb, and once it’s almost finished loading that it will suddenly jump up to 506kb.

The resulting progress bar would be very annoying to the end user, no doubt.

We are thinking about an API that can solve this in a way that makes it up to the Away3D user (you) to figure out the percentage, based on some sort of information that the AssetLoader can reliably provide. We have yet to come up with a good solution though, and hence the lack of such properties on AssetLoader.

   

dona, Jr. Member
Posted: 20 June 2012 02:27 PM   Total Posts: 46   [ # 2 ]

Thanks for your reply!

I was using Away3D 4.0.0 src. Now I’ve updated the codebase and the issue is resolved.

Thanks for explaining the loader complexities. I’ve fixed that issue using a URLLoader.

 

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X