[Papervision3D] DAE texture swap

Jonathon Stierman jonathon at wolfmotell.com
Tue Jul 7 10:26:01 PDT 2009


Is it possible to dynamically change the texture on a DAE instance?

I've tried updating the materials MaterialList:

var texture:Bitmap = new LaptopTexture() as Bitmap;
                  var newMaterialList:MaterialsList = new MaterialsList();
                  newMaterialList.addMaterial(new BitmapMaterial(texture.bitmapData, true));
                  myDAE.materials = newMaterialList;

I also tried re-loading the DAE, and supplying my own materials list:

                  var texture:Bitmap = new LaptopTexture() as Bitmap;
                  var newMaterialList:MaterialsList = new MaterialsList();
                  newMaterialList.addMaterial(new BitmapMaterial(texture.bitmapData, true));
                  myDAE.load(new DaeModelData(), newMaterialList, true);

And also tried working through the SkinController:

var texture:Bitmap = new LaptopTexture() as Bitmap;
                  var newMaterialList:MaterialsList = new MaterialsList();
                  newMaterialList.addMaterial(new BitmapMaterial(texture.bitmapData, true));

                  var myControllers:Array = myDAE.controllers;
                  var i:int;
                  var loopUntil:int = myControllers.length;
                  var skinController:SkinController
                  for(i=0; i<loopUntil; i++)
                  {
                        if (myControllers[i] is SkinController)
                        {
                              skinController = myControllers[i];
                              skinController.target.materials = newMaterialList;
                              skinController.update();
                        }
                  }

Am I going about this completely wrong?

Jonathon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090707/ab3e54e4/attachment.html>


More information about the Papervision3D mailing list