From: <axl...@us...> - 2009-07-25 18:32:03
|
Revision: 434 http://hgengine.svn.sourceforge.net/hgengine/?rev=434&view=rev Author: axlecrusher Date: 2009-07-25 18:31:55 +0000 (Sat, 25 Jul 2009) Log Message: ----------- fix ripple taint down Modified Paths: -------------- Mercury2/src/TransformNode.cpp Mercury2/src/TransformNode.h Modified: Mercury2/src/TransformNode.cpp =================================================================== --- Mercury2/src/TransformNode.cpp 2009-07-23 03:50:09 UTC (rev 433) +++ Mercury2/src/TransformNode.cpp 2009-07-25 18:31:55 UTC (rev 434) @@ -44,7 +44,7 @@ void TransformNode::SetTaint(bool taint) { m_tainted = taint; - RippleTaintDown(); + RippleTaintDown(this); } void TransformNode::ComputeMatrix() @@ -81,19 +81,18 @@ return MercuryMatrix::Identity(); } -void TransformNode::RippleTaintDown() +void TransformNode::RippleTaintDown(MercuryNode* node) { - if (m_tainted == true) + TransformNode* tn; + + for (MercuryNode* n = node->FirstChild(); n != NULL; n = node->NextChild(n)) { - TransformNode* tn; - std::list< MercuryNode* >::iterator i; - - for (i = m_children.begin(); i != m_children.end(); ++i ) - { - tn = TransformNode::Cast(*i); - if ( tn ) - tn->SetTaint( true ); - } + tn = TransformNode::Cast(n); + if (tn) + //stop this recursion here on this branch SetTaint will start a new taint recursion + tn->SetTaint(true); + else + RippleTaintDown( n ); } } @@ -147,7 +146,7 @@ tn = TransformNode::Cast( n ); if ( tn ) { - tn->RippleTaintDown(); + RippleTaintDown(tn); return; } n = n->Parent(); Modified: Mercury2/src/TransformNode.h =================================================================== --- Mercury2/src/TransformNode.h 2009-07-23 03:50:09 UTC (rev 433) +++ Mercury2/src/TransformNode.h 2009-07-25 18:31:55 UTC (rev 434) @@ -38,7 +38,7 @@ GENRTTI(TransformNode); private: - void RippleTaintDown(); + static void RippleTaintDown(MercuryNode* n); //use of accessor required MercuryVertex m_scale; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |