Fabrice
you could have a tmp small bmd, to pass instead of using bitmapfilematerial, then when loaded asign it to the material predefined.
dunno what these loaders api are doing, but building a loading queue is not rocket science. All you need is pass to queue item the ref to the material.
This would require one or two lines changes in awdata to be fully working.
Fabrice
Let me try one last time:
where AWData defines a material, it uses bitmapfilematerial
replace that with a normal bitmapMaterial
make a tmp bitmapdata like 16x16
pass it to material.
--> now you have replaced "load automatically the source image" by "I make a temp material with very tiny image"
Add after that your queue object or whatever name that is in the api you use
var queueItem:QueueItem = new QueueItem(urlfile, material);
yourWhateverBulkLoader.addToQueue(queueItem);
you probably will have to import your class in awd for this.
--> now you have passed to your api, the url to load the image, and the material refference
in the event where your queueloader triggers per loaded image
somefunctionImageLoaded(queueLoaderEvent:QueueLoaderEvent):void
{
BitmapMaterial(queueLoaderEvent.data).bitmap = queueLoaderEvent.bitmapdata;
}
--> each time an image is loaded, you replace the 16x16 tmp bitmap by the right one that has just finished to load
In your main project:
yourWhateverBulkLoader.addONEverythingLoaded(startawd);
--> when all images are loaded, its time to start the 3d party. all materials will have the propper bitmap set
Again, do not copypaste or argue on methods name, its a speudocode principle to show you how to implement.
It will very on api and your project construct.
But if you simply load all your images first then start your project when all loaded as now, with zero changes
the images to be loaded by awdata (already preloaded by the bulkloader) are probably cached and would be there instantly.
Fabrice
> my problem is that i dont know where and how awdata defines a
> material, cause in the as-file is nothing like bitmap
AWData is in loaders package, it has nothing to do with the as Prefab outputs.
search in AWData class "BitmapFileMaterial" and reread (carefully) previous mail
in the as that Prefab output or in your project file,
just add a listener to start the render once your bulkloader as done its job
Again: have you tried feed your bulkloader with the urls (to be found in the awd file)
and simply start your project after that?
Chances are that all images are cached and will be displayed at init with zero code changes!
Fabrice
In AWData class around line 242, the materials are set
var matBitmap:BitmapFileMaterial = new BitmapFileMaterial(resolvedP
+line)
if you look at the file loaded you will see the materials are defined
near the end of the file.
Its easy loading your own materials ( so don't bother with
bulkloader ) but not so easy to overwrite AWD materials with the
current way the AWData and BSPTree are set up as once the material is
set on the BSPTree it is set on every face, there is a replaceMaterial
method, but it assumes you know the CentralLibrary material used so
that you can search and replace on every face to do the swap.
Take a look at my posts on the ghost material they may give you some
ideas as was trying similar stuff.
Cheers
;j
Basically if you know the material ( which is kind of tricky and not
really viable ) then you can replace it. If you want to replace all of
them with a single material then my approach is to loop through all
materials in the BSPTree and substitute it for my ghost class. The
basic idea is that the ghost class allows you to set the material to
null ( when using collada model as visual ) or allows you to update it
without always looping all materials, it does this via proxying the
render events. I am not sure if it fits your needs but it should work
and I have already posted enough code for you to try it.
http://groups.google.com.ph/group/away3d-dev/browse_thread/thread/97d078b526b343c6
If you have some opensource model you have built and some code example
you can opensource I can take a look and amending the code for you and
publish the example back to the list if time permits.
But I think you need to modify the away source files to get more
control of AWD materials.
Cheers
;j