ActiveCamera->render(); excute twice?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
zhuhaizhong2008
Posts: 1
Joined: Wed Jun 30, 2010 6:23 am

ActiveCamera->render(); excute twice?

Post by zhuhaizhong2008 »

if ( ActiveCamera )
{
ActiveCamera->render();
camWorldPos = ActiveCamera->getAbsolutePosition();
}

// let all nodes register themselves
OnRegisterSceneNode();

if(LightManager)
LightManager->OnPreRender(LightList);

//render camera scenes
{
CurrentRendertime = ESNRP_CAMERA;
Driver->getOverrideMaterial().Enabled = ((Driver->getOverrideMaterial().EnablePasses & CurrentRendertime) != 0);

if(LightManager)
LightManager->OnRenderPassPreRender(CurrentRendertime);

for (i=0; i<CameraList.size(); ++i)
CameraList->render();


CameraList.set_used(0);

if(LightManager)
LightManager->OnRenderPassPostRender(CurrentRendertime);
}


code in void CSceneManager::drawAll()
my understanding is that ActiveCamera->render() is excuted twice.am I right ? Is it necessary?
dejai
Posts: 522
Joined: Sat Apr 21, 2007 9:00 am

Post by dejai »

If ActiveCamera is an element in CameraList then I would assume that is getting rendered twice for no reason however I am not exactly sure whether:

Code: Select all

OnRegisterSceneNode();

if(LightManager)
LightManager->OnPreRender(LightList);

//render camera scenes
{
CurrentRendertime = ESNRP_CAMERA;
Driver->getOverrideMaterial().Enabled = ((Driver->getOverrideMaterial().EnablePasses & CurrentRendertime) != 0);

if(LightManager)
LightManager->OnRenderPassPreRender(CurrentRendertime); 
Interfaces with the ActiveCamera in anyway.
Programming Blog: http://www.uberwolf.com
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I'm not saying that it is right, I'm just explaining what it looks like it is trying to do, but it looks like the scene manager needs to have an accurate value for camWorldPos before registering scene nodes (see CSceneManager::registerNodeForRendering()).

Travis
Post Reply