Ejemplo n.º 1
0
 bool IdentityToGroupTraverser::isTransformToReplace( const NodeSharedPtr & nh )
 {
   bool ok = false;
   if( std::dynamic_pointer_cast<Transform>(nh) )
   {
     TransformSharedPtr t = std::static_pointer_cast<Transform>(nh);
     ok =    ( getIgnoreNames() || t->getName().empty() )
         &&  optimizationAllowed( t )
         &&  !t->isJoint()
         &&  isIdentity( t->getTrafo().getMatrix() );
   }
   return( ok );
 }
Ejemplo n.º 2
0
 GroupSharedPtr IdentityToGroupTraverser::createGroupFromTransform( const TransformSharedPtr & th )
 {
   GroupSharedPtr gh = Group::create();
   gh->setName( th->getName() );
   gh->setAnnotation( th->getAnnotation() );
   gh->setUserData( th->getUserData() );
   gh->setHints( th->getHints() );
   gh->setTraversalMask( th->getTraversalMask() );
   for ( Group::ClipPlaneIterator gcpci = th->beginClipPlanes() ; gcpci != th->endClipPlanes() ; ++gcpci )
   {
     gh->addClipPlane( *gcpci );
   }
   for ( Group::ChildrenIterator gcci = th->beginChildren() ; gcci != th->endChildren() ; ++gcci )
   {
     gh->addChild( *gcci );
   }
   return( gh );
 }