Hi OpenSG Users,
right now i am trying to make my application handle a lot
(really a lot) of models. To improve the overall performance of my program,
I am using lodded models.
Since the farthest lod node appears when the model is very far from the
viewer,
I'd like just the first node of the lod to casts shadow.
So I'd like something like this:
LODNODE
|
|- Child0 (casts shadow)
|
|- Child1 (doesn't cast shadow)
To accomplish this, I thought about using a traverse to add distant lod
nodes to the
ShadowViewport exclude list. In my traverse I do something like:
myApp::AddNodeToScene (mynode)
{
...
...
...
Traverse disableShadowsOnLodNodel (myNode);
...
...
...
}
osg::Action::ResultE myApp::disableShadowsOnLodNodel (osg::NodePtr& curNode)
{
if ((curNode==NullFC))
return Action::Continue;
osg::NodePtr parent = curNode->getParent ();
if (parent==osg::NullFC)
return Action::Continue;
if (parent->getCore()->getType().isDerivedFrom(
osg::DistanceLOD::getClassType()))
{
int curNodeIndex = parent->findChild (curNode);
// avoid to remove the nearest node from the shadow casting
if (curNodeIndex!=0)
for (int i=0;i<m_vViewports.size();i++)
{
beginEditCP(m_vViewports[i]);
m_vViewports[i]->getExcludeNodes().push_back(curNode);
endEditCP(m_vViewports[i]);
}
}
return Action::Continue;
}
My problem is that after this traverse also the nearest lod node does not
cast shadow anymore.
Am I doing something wrong?
Thanks
E.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users