Added use of ref_ptr<> for the replaced node in osg::Group::replaceChild(,)

to prevent it being deleted while it was still being used with the body of
the method.

Added mention of the shadow texture demo.
This commit is contained in:
Robert Osfield 2002-11-21 16:08:30 +00:00
parent a545f3b48c
commit 493d86fc73
2 changed files with 26 additions and 2 deletions

3
NEWS
View File

@ -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.

View File

@ -160,7 +160,7 @@ bool Group::setChild( unsigned int i, Node* newNode )
if (i<_children.size() && newNode)
{
Node* origNode = _children[i].get();
ref_ptr<Node> 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
);
}