[Papervision3D] re nderLayer and ViewportLayer Problem

charliek carlieman at gmail.com
Wed Oct 1 10:12:29 PDT 2008


Hey guys,

I'm having trouble with ViewportLayers and renderLayers. In my scene I have
a collada model, which doesn't need to be rendered all the time, so I use
renderLayers. By itself it works fine. But then primitives have to moved
through holes in the dae model, so I need ViewportLayers for index sorting.
By itself it works fine! But when I combine both the collada doesnt seem
right. When dae moves number of triangles go up like crazy and framerate of
course down.
I've read about adding the children of the dae to the scene for both to work
properly together, but I can't figure it out.

Can someone please help me.

Here is my code:

//after dae LOAD_COMPLETE

scene.addChild(dae.getChildByName("COLLADA_Scene").getChildByName("cube_a"));
scene.addChild(dae.getChildByName("COLLADA_Scene").getChildByName("cube_b"));
//couple of more children same

dae.getChildByName("COLLADA_Scene").getChildByName("cube_a").scale = 600;
dae.getChildByName("COLLADA_Scene").getChildByName("cube_b").scale = 600;
//couple of more children same

//renderLayers

backLayer = new Array();
frontLayer = new Array();

backLayer.push(viewportMain.getChildLayer(dae, true, true));
frontLayer.push(viewportMain.getChildLayer(pl, true, false));

//Viewport Layers

zBack = new ViewportLayer(viewportMain, null);
viewportMain.containerSprite.addLayer(zBack);
zBack.sortMode = ViewportLayerSortMode.INDEX_SORT;

zBack.getChildLayer(dae, true,true).layerIndex = 0;
zBack.getChildLayer(pl,true,true).layerIndex = 1;


public funtion onEnterFrame(e.Event):void{

renderer.renderLayers(scene, cameraMain, viewportMain, frontLayer);

if (daeMoving){
	renderer.renderLayers(scene, cameraMain, viewportMain, backLayer);
}

-- 
View this message in context: http://www.nabble.com/renderLayer-and-ViewportLayer-Problem-tp19764115p19764115.html
Sent from the Papervision3D mailing list archive at Nabble.com.




More information about the Papervision3D mailing list