[Papervision3D] materials dont change when using collada.replaceMaterialByName
ahalim kara
blackhalim at yahoo.com
Wed Jul 15 11:54:24 PDT 2009
Hi all,
I am trying to change material of a loaded collada object with collada.replaceMaterialByName function. But it doesnt change the texture, still uses the png file loaded for collada. If i use collada.getMaterialByName("mat0").copy(new ColorMaterial(0)); it works however Flash crashes. Here is my code:
package org.ahk //this is a document class for a blank fla file
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.utils.setTimeout;
import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.objects.parsers.Collada;
import org.papervision3d.view.BasicView;
/**
* ...
* @author Abdulhalim Kara
*/
public class Main extends MovieClip
{
private var basicView:BasicView;
private var cow:Collada;
public function Main()
{
basicView = new BasicView(640, 480, false);
cow = new Collada("http://papervision2.com/wp-content/downloads/dae/cow.dae");
cow.addEventListener(FileLoadEvent.COLLADA_MATERIALS_DONE, matsLoaded);
basicView.scene.addChild(cow);
basicView.camera.z += 400;
addChild(basicView.viewport);
}
private function matsLoaded(e:FileLoadEvent):void
{
cow.replaceMaterialByName(new ColorMaterial(0), "mat0");
//cow.getMaterialByName("mat0").copy(new ColorMaterial(0));
trace(cow.materialsList());
basicView.startRendering();
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090715/4c5d41fb/attachment.html>
More information about the Papervision3D
mailing list