Quote:
The behavior that the children are affected as well is actually intended to keep a branch in a consistent state (if a parent is inactive, we don't have to visit the children). The documentation in the header was updated at some point but I guess the HTML file was not regenerated.
I have some problem with this. The recursion of the whole subtree seems to be quite costly as I'm calling this per frame for each active camera. While I see that some kind of optimization is in the SetActivation function I think It can be quite confusing.
Code:
void SceneNode::setActivation( bool active )
{
_active = active;
// Set same activation state for children
for( size_t i = 0, s = _children.size(); i < s; ++i )
{
if( _children[i]->_active != active ) _children[i]->setActivation( active );
}
}
Root (active=true)
- Node1 (active=false)
-- Node1_1 (active=true)
-- Node1_2 (active=false)
- Node2 (active=true)
When I call SetActivation(false) for Root, Node1_1 isn't deactivated because Node1 is not active. I'm not sure if this is a problem as I dont know the visibility system works.
Code:
To solve your problem, I would suggest to introduce node flags. Something like h3dSetNodeFlags( node, H3DNodeFlags::NoDraw | H3DNodeFlags::NoCastShadow ). These flags would just affect a single node, although we could add an optional function parameter to apply the state recursively to all children.
I like this alternative. Thanks. This could be extended with NoRayCast too.
Maybe I should write this into another thread, namely "Get rid of scenegraph"
I think that simple scenegraph (probably multiple ones for multiple scenes) that just simply contains a list of nodes would be much easier to use. With current hierarchy of nodes I have a problem that when I remove a node every children is removed also even if I still would like to use them. So In my wrapper I simply disallowed this deep hierarchy. The hieararchy is only Root->Scene->Object.
Marciano: Any info on the state of the work on "Get rid of scenegraph"? Thanks