#include <OSGDepthFirstAction.h>
Inheritance diagram for osg::DepthFirstAction:

Definition at line 61 of file OSGDepthFirstAction.h.
|
|
Definition at line 141 of file OSGDepthFirstAction.h. |
|
|
Definition at line 72 of file OSGNewActionBase.h. |
|
|
Definition at line 73 of file OSGNewActionBase.h. |
|
|
Definition at line 74 of file OSGNewActionBase.h. |
|
|
Definition at line 75 of file OSGNewActionBase.h. |
|
|
Definition at line 156 of file OSGNewActionBase.h. |
|
|
Definition at line 157 of file OSGNewActionBase.h. |
|
|
Definition at line 159 of file OSGNewActionBase.h. |
|
|
Definition at line 160 of file OSGNewActionBase.h. |
|
|
Definition at line 161 of file OSGNewActionBase.h. |
|
|
Destructor. Definition at line 55 of file OSGDepthFirstAction.cpp.
|
|
|
Default constructor. Definition at line 121 of file OSGDepthFirstAction.cpp. Referenced by create(). 00122 : Inherited (), 00123 _nodeStack (), 00124 _extendEnterActors(), 00125 _extendLeaveActors(), 00126 _basicEnterActors (), 00127 _basicLeaveActors () 00128 { 00129 }
|
|
|
Create new instance. Definition at line 67 of file OSGDepthFirstAction.cpp. References DepthFirstAction(). 00068 { 00069 return new DepthFirstAction(); 00070 }
|
|
|
Apply the action to the node pRoot, i.e. traverse the graph below it. Implements osg::NewActionBase. Definition at line 80 of file OSGDepthFirstAction.cpp. References _basicLeaveActors, _extendLeaveActors, _nodeStack, osg::NewActionTypes::Continue, osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::NewActionBase::startActors(), osg::NewActionBase::startEvent(), osg::NewActionBase::stopActors(), osg::NewActionBase::stopEvent(), traverseEnter(), and traverseEnterLeave(). 00081 { 00082 ResultE result = NewActionTypes::Continue; 00083 00084 startEvent(); 00085 00086 result = startActors(); 00087 00088 if(result & NewActionTypes::Quit) 00089 return result; 00090 00091 _nodeStack.push_back(NodeStackEntry(pRoot, 1)); 00092 00093 if((_extendLeaveActors.empty() == true) && 00094 (_basicLeaveActors .empty() == true) ) 00095 { 00096 result = traverseEnter(); 00097 } 00098 else 00099 { 00100 result = traverseEnterLeave(); 00101 } 00102 00103 if(result & NewActionTypes::Quit) 00104 return result; 00105 00106 result = stopActors(); 00107 00108 stopEvent(); 00109 00110 return result; 00111 }
|
|
||||||||||||
|
Inserts the extend actor into an internal data structure, depending on whether the enter node flag and leave node flag are set. This avoids making the destinction everytime the actors are called. Implements osg::NewActionBase. Definition at line 141 of file OSGDepthFirstAction.cpp. References _extendEnterActors, _extendLeaveActors, osg::NewActionBase::beginExtend(), osg::ActorBase::getEnterNodeFlag(), and osg::ActorBase::getLeaveNodeFlag(). 00142 { 00143 ExtendActorStoreIt itActors = beginExtend(); 00144 ExtendActorStoreIt endActors = beginExtend() + actorIndex; 00145 00146 ExtendActorStoreIt itEnter = _extendEnterActors.begin(); 00147 ExtendActorStoreIt itLeave = _extendLeaveActors.begin(); 00148 00149 for(; itActors != endActors; ++itActors) 00150 { 00151 if((*itActors)->getEnterNodeFlag() == true) 00152 ++itEnter; 00153 00154 if((*itActors)->getLeaveNodeFlag() == true) 00155 ++itLeave; 00156 } 00157 00158 if(pActor->getEnterNodeFlag() == true) 00159 _extendEnterActors.insert(itEnter, pActor); 00160 00161 if(pActor->getLeaveNodeFlag() == true) 00162 _extendLeaveActors.insert(itLeave, pActor); 00163 }
|
|
||||||||||||
|
Removes the extend actor from the internal data structures. Implements osg::NewActionBase. Definition at line 169 of file OSGDepthFirstAction.cpp. References _extendEnterActors, and _extendLeaveActors. 00170 { 00171 ExtendActorStoreIt itEnter = _extendEnterActors.begin(); 00172 ExtendActorStoreIt endEnter = _extendEnterActors.end (); 00173 00174 ExtendActorStoreIt itLeave = _extendLeaveActors.begin(); 00175 ExtendActorStoreIt endLeave = _extendLeaveActors.end (); 00176 00177 for(; itEnter != endEnter; ++itEnter) 00178 { 00179 if(*itEnter == pActor) 00180 { 00181 _extendEnterActors.erase(itEnter); 00182 00183 break; 00184 } 00185 } 00186 00187 for(; itLeave != endLeave; ++itLeave) 00188 { 00189 if(*itLeave == pActor) 00190 { 00191 _extendLeaveActors.erase(itLeave); 00192 00193 break; 00194 } 00195 } 00196 }
|
|
||||||||||||
|
Inserts the basic actor into an internal data structure, depending on whether the enter node flag and leave node flag are set. This avoids making the destinction everytime the actors are called. Implements osg::NewActionBase. Definition at line 204 of file OSGDepthFirstAction.cpp. References _basicEnterActors, _basicLeaveActors, osg::NewActionBase::beginBasic(), osg::ActorBase::getEnterNodeFlag(), and osg::ActorBase::getLeaveNodeFlag(). 00205 { 00206 BasicActorStoreIt itActors = beginBasic(); 00207 BasicActorStoreIt endActors = beginBasic() + actorIndex; 00208 00209 BasicActorStoreIt itEnter = _basicEnterActors.begin(); 00210 BasicActorStoreIt itLeave = _basicLeaveActors.begin(); 00211 00212 for(; itActors != endActors; ++itActors) 00213 { 00214 if((*itActors)->getEnterNodeFlag() == true) 00215 ++itEnter; 00216 00217 if((*itActors)->getLeaveNodeFlag() == true) 00218 ++itLeave; 00219 } 00220 00221 if(pActor->getEnterNodeFlag() == true) 00222 _basicEnterActors.insert(itEnter, pActor); 00223 00224 if(pActor->getLeaveNodeFlag() == true) 00225 _basicLeaveActors.insert(itLeave, pActor); 00226 }
|
|
||||||||||||
|
Removes the extend actor from the internal data structures. Implements osg::NewActionBase. Definition at line 232 of file OSGDepthFirstAction.cpp. References _basicEnterActors, and _basicLeaveActors. 00233 { 00234 BasicActorStoreIt itEnter = _basicEnterActors.begin(); 00235 BasicActorStoreIt endEnter = _basicEnterActors.end (); 00236 00237 BasicActorStoreIt itLeave = _basicLeaveActors.begin(); 00238 BasicActorStoreIt endLeave = _basicLeaveActors.end (); 00239 00240 for(; itEnter != endEnter; ++itEnter) 00241 { 00242 if(*itEnter == pActor) 00243 { 00244 _basicEnterActors.erase(itEnter); 00245 00246 break; 00247 } 00248 } 00249 00250 for(; itLeave != endLeave; ++itLeave) 00251 { 00252 if(*itLeave == pActor) 00253 { 00254 _basicLeaveActors.erase(itLeave); 00255 00256 break; 00257 } 00258 } 00259 }
|
|
||||||||||||
|
Does nothing, DepthFirstAction never copies state. Implements osg::NewActionBase. Definition at line 265 of file OSGDepthFirstAction.cpp.
|
|
||||||||||||
|
Does nothing, DepthFirstAction never copies state. Implements osg::NewActionBase. Definition at line 273 of file OSGDepthFirstAction.cpp.
|
|
|
Drives the traversal of the graph. It only calls the actors upon "entering" a node. Definition at line 287 of file OSGDepthFirstAction.cpp. References _nodeStack, osg::NewActionTypes::Continue, enterNode(), osg::NewActionBase::getChildrenList(), osg::StatCollector::getElem(), osg::NewActionBase::getNumPasses(), osg::NewActionBase::getStatistics(), pushChildren(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::ChildrenList::setParentNode(), and osg::NewActionBase::statNodesEnter. Referenced by apply(). 00288 { 00289 ResultE result = NewActionTypes::Continue; 00290 NodePtr pNode; 00291 Int32 nodePass; // pass over the current node 00292 UInt32 multiPasses; // requested passes over the current node 00293 00294 while((_nodeStack.empty() == false) && !(result & NewActionTypes::Quit)) 00295 { 00296 pNode = _nodeStack.back().getNode (); 00297 nodePass = _nodeStack.back().getPassCount(); 00298 00299 getChildrenList().setParentNode(pNode); 00300 00301 #ifdef OSG_NEWACTION_STATISTICS 00302 getStatistics()->getElem(statNodesEnter)->inc(); 00303 #endif /* OSG_NEWACTION_STATISTICS */ 00304 00305 result = enterNode (pNode, static_cast<UInt32>(nodePass - 1)); 00306 multiPasses = getNumPasses( ); 00307 00308 _nodeStack.pop_back(); 00309 00310 // only initial pass (nodePass == 1) can request multiPasses 00311 if((nodePass == 1) && (multiPasses > 1)) 00312 { 00313 for(; multiPasses > 1; --multiPasses) 00314 { 00315 _nodeStack.push_back(NodeStackEntry(pNode, multiPasses)); 00316 } 00317 } 00318 00319 pushChildren(pNode, result); 00320 } 00321 00322 return result; 00323 }
|
|
|
Drives the traversal of the graph. It calls the actors upon "entering" and "leaving" a node. Definition at line 330 of file OSGDepthFirstAction.cpp. References _nodeStack, osg::NewActionTypes::Continue, enterNode(), osg::NewActionBase::getChildrenList(), osg::StatCollector::getElem(), osg::NewActionBase::getNumPasses(), osg::NewActionBase::getStatistics(), leaveNode(), pushChildren(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::ChildrenList::setParentNode(), osg::NewActionBase::statNodesEnter, and osg::NewActionBase::statNodesLeave. Referenced by apply(). 00331 { 00332 ResultE result = NewActionTypes::Continue; 00333 NodePtr pNode; 00334 Int32 nodePass; // pass over the current node 00335 UInt32 multiPasses; // requested passes over the current node 00336 00337 while((_nodeStack.empty() == false) && !(result & NewActionTypes::Quit)) 00338 { 00339 pNode = _nodeStack.back().getNode (); 00340 nodePass = _nodeStack.back().getPassCount(); 00341 00342 getChildrenList().setParentNode(pNode); 00343 00344 if(nodePass > 0) 00345 { 00346 // positive pass -> enter node 00347 00348 #ifdef OSG_NEWACTION_STATISTICS 00349 getStatistics()->getElem(statNodesEnter)->inc(); 00350 #endif /* OSG_NEWACTION_STATISTICS */ 00351 00352 result = enterNode (pNode, static_cast<UInt32>(nodePass - 1)); 00353 multiPasses = getNumPasses( ); 00354 00355 // only initial pass (nodePass == 1) can request multiPasses 00356 if((nodePass == 1) && (multiPasses > 1)) 00357 { 00358 // remove current node from stack 00359 _nodeStack.pop_back(); 00360 00361 for(; multiPasses > 1; --multiPasses) 00362 { 00363 _nodeStack.push_back(NodeStackEntry(pNode, multiPasses)); 00364 } 00365 00366 // readd current node - with negative pass -> leave 00367 _nodeStack.push_back(NodeStackEntry(pNode, -nodePass)); 00368 } 00369 else 00370 { 00371 // change current node passCount to negative -> leave 00372 _nodeStack.back().setPassCount(-nodePass); 00373 } 00374 00375 pushChildren(pNode, result); 00376 } 00377 else 00378 { 00379 // negative pass -> leave node 00380 00381 #ifdef OSG_NEWACTION_STATISTICS 00382 getStatistics()->getElem(statNodesLeave)->inc(); 00383 #endif /* OSG_NEWACTION_STATISTICS */ 00384 00385 result = leaveNode(pNode, static_cast<UInt32>(-nodePass - 1)); 00386 00387 _nodeStack.pop_back(); 00388 } 00389 } 00390 00391 return result; 00392 }
|
|
||||||||||||
|
Pushes the active children and extra children of the traversed node onto the internal stack. Definition at line 399 of file OSGDepthFirstAction.cpp. References _nodeStack, osg::NewActionTypes::Break, osg::ExtraChildrenList::clear(), osg::ExtraChildrenList::getActive(), osg::ChildrenList::getActive(), osg::ExtraChildrenList::getChild(), osg::ChildrenList::getChild(), osg::NewActionBase::getChildrenList(), osg::NewActionBase::getChildrenListEnabled(), osg::NewActionBase::getExtraChildrenList(), osg::ExtraChildrenList::getSize(), osg::ChildrenList::getSize(), osg::NewActionBase::getTravMask(), osg::NullFC, osg::NewActionTypes::Quit, osg::NewActionBase::setChildrenListEnabled(), osg::NewActionBase::setNumPasses(), and osg::NewActionTypes::Skip. Referenced by traverseEnter(), and traverseEnterLeave(). 00400 { 00401 if(result & (NewActionTypes::Skip | 00402 NewActionTypes::Break | 00403 NewActionTypes::Quit )) 00404 { 00405 setChildrenListEnabled(false); 00406 setNumPasses (1 ); 00407 00408 getExtraChildrenList().clear(); 00409 00410 return; 00411 } 00412 00413 ChildrenList &cl = getChildrenList (); 00414 ExtraChildrenList &ecl = getExtraChildrenList(); 00415 00416 if(getChildrenListEnabled() == true) 00417 { 00418 for(UInt32 i = 0, size = cl.getSize(); i < size; ++i) 00419 { 00420 if(( cl.getActive(i) == true ) && 00421 ( cl.getChild (i) != NullFC) && 00422 ((cl.getChild (i)->getTravMask() & getTravMask()) != 0 ) ) 00423 { 00424 _nodeStack.push_back(NodeStackEntry(cl.getChild(i), 1)); 00425 } 00426 } 00427 } 00428 else 00429 { 00430 MFNodePtr::const_iterator itChildren = pNode->getMFChildren()->begin(); 00431 MFNodePtr::const_iterator endChildren = pNode->getMFChildren()->end (); 00432 00433 for(; itChildren != endChildren; ++itChildren) 00434 { 00435 if(( *itChildren != NullFC) && 00436 (((*itChildren)->getTravMask() & getTravMask()) != 0 ) ) 00437 { 00438 _nodeStack.push_back(NodeStackEntry(*itChildren, 1)); 00439 } 00440 } 00441 } 00442 00443 for(UInt32 i = 0, size = ecl.getSize(); i < size; ++i) 00444 { 00445 if(( ecl.getActive(i) == true ) && 00446 ( ecl.getChild (i) != NullFC) && 00447 ((ecl.getChild (i)->getTravMask() & getTravMask()) != 0 ) ) 00448 { 00449 _nodeStack.push_back(NodeStackEntry(ecl.getChild(i), 1)); 00450 } 00451 } 00452 00453 setChildrenListEnabled(false); 00454 setNumPasses (1 ); 00455 ecl.clear ( ); 00456 }
|
|
||||||||||||
|
Calls the enterNode method of the attached actors. Definition at line 52 of file OSGDepthFirstAction.inl. References _basicEnterActors, _extendEnterActors, osg::NewActionTypes::Break, osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), osg::NewActionTypes::Quit, and osg::NewActionBase::ResultE. Referenced by traverseEnter(), and traverseEnterLeave(). 00053 { 00054 FunctorArgumentType funcArg(NULL, pNode, pass); 00055 ResultE result = NewActionTypes::Continue; 00056 00057 ExtendActorStoreIt itExtend = _extendEnterActors.begin(); 00058 ExtendActorStoreIt endExtend = _extendEnterActors.end (); 00059 00060 for(; (itExtend != endExtend ) && 00061 !(result & (NewActionTypes::Break | NewActionTypes::Quit)); 00062 ++itExtend ) 00063 { 00064 funcArg.setActor(*itExtend); 00065 00066 result = static_cast<ResultE>(result | (*itExtend)->enterNode(funcArg)); 00067 } 00068 00069 BasicActorStoreIt itBasic = _basicEnterActors.begin(); 00070 BasicActorStoreIt endBasic = _basicEnterActors.end (); 00071 00072 for(; (itBasic != endBasic ) && 00073 !(result & (NewActionTypes::Break | NewActionTypes::Quit)); 00074 ++itBasic ) 00075 { 00076 funcArg.setActor(*itBasic); 00077 00078 result = static_cast<ResultE>(result | (*itBasic)->enterNode(funcArg)); 00079 } 00080 00081 return result; 00082 }
|
|
||||||||||||
|
Calls the leaveNode method of the attached actors. Definition at line 88 of file OSGDepthFirstAction.inl. References _basicLeaveActors, _extendLeaveActors, osg::NewActionTypes::Break, osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), osg::NewActionTypes::Quit, and osg::NewActionBase::ResultE. Referenced by traverseEnterLeave(). 00089 { 00090 FunctorArgumentType funcArg(NULL, pNode, pass); 00091 ResultE result = NewActionTypes::Continue; 00092 00093 ExtendActorStoreIt itExtend = _extendLeaveActors.begin(); 00094 ExtendActorStoreIt endExtend = _extendLeaveActors.end (); 00095 00096 for(; (itExtend != endExtend ) && 00097 !(result & (NewActionTypes::Break | NewActionTypes::Quit)); 00098 ++itExtend ) 00099 { 00100 funcArg.setActor(*itExtend); 00101 00102 result = static_cast<ResultE>(result | (*itExtend)->leaveNode(funcArg)); 00103 } 00104 00105 BasicActorStoreIt itBasic = _basicLeaveActors.begin(); 00106 BasicActorStoreIt endBasic = _basicLeaveActors.end (); 00107 00108 for(; (itBasic != endBasic ) && 00109 !(result & (NewActionTypes::Break | NewActionTypes::Quit)); 00110 ++itBasic ) 00111 { 00112 funcArg.setActor(*itBasic); 00113 00114 result = static_cast<ResultE>(result | (*itBasic)->leaveNode(funcArg)); 00115 } 00116 00117 return result; 00118 }
|
|
|
|
|
|
|
|
|
|
Add an actor to this action, it will be appended to the list of extend or basic actors. Returns the index at which the actor was added.
Definition at line 144 of file OSGNewActionBase.cpp. References osg::ActorBase::addHelper().
|
|
|
Remove an actor from this action. The actor may now be attached to another action. Dev: See NewActionBase::addActor(ActorBase *pActor) for an explanation of the mechanism used to discover the type of pActor. Definition at line 159 of file OSGNewActionBase.cpp. References osg::ActorBase::subHelper(). 00160 { 00161 pActor->subHelper(this); 00162 }
|
|
|
Return the index of an actor or TypeTraits<UInt32>::getMax() if the actor can not be found. Note that two actors may have the same index, if one is derived from ExtendActorBase and the other from BasicActorBase. Dev: See NewActionBase::addActor(ActorBase *pActor) for an explanation of the mechanism used to discover the type of pActor. I'm not sure if this is a useful thing to have ?? -carsten Definition at line 177 of file OSGNewActionBase.cpp. References osg::ActorBase::findHelper(). 00178 { 00179 return pActor->findHelper(this); 00180 }
|
|
|
Return the total number of actors attached to this action. Definition at line 186 of file OSGNewActionBase.cpp. References osg::NewActionBase::_basicActors, and osg::NewActionBase::_extendActors. Referenced by osg::NewActionBase::addBasicActor(), and osg::NewActionBase::addExtendActor(). 00187 { 00188 return _extendActors.size() + _basicActors.size(); 00189 }
|
|
|
Add an extend actor to this action. Returns the index at which the actor was added.
Definition at line 202 of file OSGNewActionBase.cpp. References osg::NewActionBase::_extendActors. Referenced by osg::ExtendActorBase::addHelper(). 00203 { 00204 return addExtendActor(pActor, _extendActors.size()); 00205 }
|
|
||||||||||||
|
Add an extend actor to this action before the index pos. Returns the index at which the actor was added, i.e. this should be pos.
Definition at line 214 of file OSGNewActionBase.cpp. References osg::NewActionBase::_extendActors, osg::ActorBase::addEvent(), and osg::NewActionBase::getNumActors(). 00215 { 00216 UInt32 actorId = getNumActors(); 00217 00218 pActor ->addEvent (this, actorId); 00219 _extendActors. insert (_extendActors.begin() + pos, pActor ); 00220 this ->addExtendEvent(pActor, pos ); 00221 00222 return pos; 00223 }
|
|
|
Remove the extend actor at index pos. The actor may now be attached to another action. Definition at line 230 of file OSGNewActionBase.cpp. References osg::NewActionBase::_extendActors, osg::ActorBase::getActorId(), and osg::A |