diff --git a/NEWS b/NEWS index 704e882d3..61e7158fb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ OSG News (most significant items from ChangeLog) ================================================ + Added new osgshadowtexture demo which illustrates how to create + dynamic shadow textures in your scene. + Addition osgSim which is NodeKit designed for visual simulation market, currently features high fidelity light points support. diff --git a/src/osg/Group.cpp b/src/osg/Group.cpp index 1ae6de1f2..ed3068ae3 100644 --- a/src/osg/Group.cpp +++ b/src/osg/Group.cpp @@ -160,7 +160,7 @@ bool Group::setChild( unsigned int i, Node* newNode ) if (i<_children.size() && newNode) { - Node* origNode = _children[i].get(); + ref_ptr origNode = _children[i]; // first remove for origNode's parent list. origNode->removeParent(this); @@ -213,7 +213,28 @@ bool Group::setChild( unsigned int i, Node* newNode ) if (delta_numChildrenWithCullingDisabled!=0) { setNumChildrenWithCullingDisabled( - getNumChildrenWithCullingDisabled()-1 + getNumChildrenWithCullingDisabled()+delta_numChildrenWithCullingDisabled + ); + } + + // could now require disabling of culling thanks to the new subgraph, + // so need to check and update if required. + int delta_numChildrenWithOccluderNodes = 0; + if (origNode->getNumChildrenWithOccluderNodes()>0 || + !origNode->getCullingActive()) + { + --delta_numChildrenWithOccluderNodes; + } + if (newNode->getNumChildrenWithOccluderNodes()>0 || + !newNode->getCullingActive()) + { + ++delta_numChildrenWithOccluderNodes; + } + + if (delta_numChildrenWithOccluderNodes!=0) + { + setNumChildrenWithOccluderNodes( + getNumChildrenWithOccluderNodes()+delta_numChildrenWithOccluderNodes ); }