how to apply an array of jpg textures to an array of cube meshes like those on away3d’s home page?

Software: Away3D 4.x

hfeist, Jr. Member
Posted: 27 June 2013 05:18 PM   Total Posts: 37

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…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X