i would like to achieve something like the great effect on away3d’s home page.
i have a wall of 48 cube meshes each of which needs a material that is one part of an overall image covering the whole wall.
I’m imagining a loop that would create each mesh and then create its material by pulling bitmap data from images in an array of previously loaded jpgs. Something like this vague example:
private var cubeNum:uint=0;
private function loadTexture():void
{
var jpgLoader:Loader=new Loader;
jpgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,jpgLoaded);
var fileRequest:URLRequest = new URLRequest("/images/image"+cubeNum);
jpgLoader.load(fileRequest);
}
function jpgLoaded(evt:Event):void
{
// something like this?
var nMaterial:TextureMaterial = new TextureMaterial(new BitmapTexture(BitmapData(jpgLoader.content)));
//put this into an array somehow?
cubeNum++;
if(cubeNum<totalNum){
loadTexture();
)
}
}
Perhaps there’s even a way to pull the bitmapdata one rectangle at a time from the large overall image without having to load smaller jpgs at all…