当前位置: 首页>>代码示例>>C++>>正文


C++ SoSeparator::unrefNoDelete方法代码示例

本文整理汇总了C++中SoSeparator::unrefNoDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ SoSeparator::unrefNoDelete方法的具体用法?C++ SoSeparator::unrefNoDelete怎么用?C++ SoSeparator::unrefNoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoSeparator的用法示例。


在下文中一共展示了SoSeparator::unrefNoDelete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// Routine to create a scene graph representing a dodecahedron
SoSeparator *
makePyramide()
{
  SoSeparator *result = new SoSeparator;
  result->ref();

  // Define coordinates for vertices
  SoCoordinate3 *myCoords = new SoCoordinate3;
  myCoords->point.setValues(0, 5, pyramidVertexes);
  result->addChild(myCoords);

  // Define the IndexedFaceSet, with indices into the vertices:
  SoIndexedFaceSet *myFaceSet = new SoIndexedFaceSet;
  myFaceSet->coordIndex.setValues (0, 21, (const int32_t*)pyramidFaces);
  result->addChild (myFaceSet);

  result->unrefNoDelete();
  return result;
}
开发者ID:tswang,项目名称:visp,代码行数:20,代码来源:vpSimulator.cpp

示例2: clone

VirtualRobot::VisualizationNodePtr CoinVisualizationNode::clone(bool deepCopy, float scaling)
{
	THROW_VR_EXCEPTION_IF(scaling<=0,"Scaling must be >0");

	SoSeparator* newModel = NULL;
	if (visualization)
	{
		newModel = new SoSeparator;
		newModel->ref();
		if (scaling!=1.0)
		{
			SoScale *s = new SoScale;
			s->scaleFactor.setValue(scaling,scaling,scaling);
			newModel->addChild(s);
		}
		if (deepCopy)
		{
			newModel->addChild(visualization->copy(FALSE));
		} else
			newModel->addChild(visualization);
	}
	VisualizationNodePtr p(new CoinVisualizationNode(newModel));
	if (newModel)
		newModel->unrefNoDelete();
	p->setUpdateVisualization(updateVisualization);
	p->setGlobalPose(getGlobalPose());
	p->setFilename(filename,boundingBox);

	// clone attached visualizations
	std::map< std::string, VisualizationNodePtr >::const_iterator i = attachedVisualizations.begin();
	while (i!=attachedVisualizations.end())
	{
		VisualizationNodePtr attachedClone = i->second->clone(deepCopy,scaling);
		p->attachVisualization(i->first, attachedClone);
		i++;
	}

	return p;
}
开发者ID:TheMarex,项目名称:simox,代码行数:39,代码来源:CoinVisualizationNode.cpp

示例3: doc_insert_kinematic_chain

int QilexDoc::doc_insert_kinematic_chain(Rchain *kineengine, SoSeparator *kinechain)
{
   int error = 0;
   int i;

   SbVec3f joinax;

   float joinangle;
   
   SbName joints[] = {"joint1", "joint2", "joint3", "joint4","joint5", "joint6",
                   "joint7", "joint8", "joint9", "joint10","joint11", "joint12",
                   "joint13", "joint14", "joint15", "joint16","joint17", "joint18",
                   "joint19", "joint20", "joint21", "joint22","joint23", "joint24",  };
   
   SoEngineList compR(kineengine->dof);
   SoNodeList Rots(kineengine->dof);

   SoSearchAction lookingforjoints;
   SoTransform *pjoint = new SoTransform;

      // Identifie the rotations and assing the job
   i = 0;

   while (i < kineengine->dof && error == 0)
   {
      lookingforjoints.setName(joints[i]);
      lookingforjoints.setType(SoTransform::getClassTypeId());
      lookingforjoints.setInterest(SoSearchAction::FIRST);
      lookingforjoints.apply(kinechain);

      //  assert(lookingforjoints.getPath() != NULL);
      SoNode * pnode = lookingforjoints.getPath()->getTail();;

      pjoint = (SoTransform *) pnode;

      if(NULL != pjoint)
      {
         Rots.append((SoTransform *) pjoint);
         compR.append(new SoQtComposeRotation);
         // cal comprobar si l'articulació es de rotació o translació: arreglar...
         ((SoTransform *) Rots[i])->rotation.getValue(joinax, joinangle);
         ((SoQtComposeRotation *) compR[i])->axis.setValue(joinax);

         ((SoTransform *) Rots[i])->rotation.connectFrom(&((SoQtComposeRotation *) compR[i])->rotation);
      }
      else
      {
         error = 5; // not a valid Model3d file
      }
      i++ ;
   }

   if (error == 0)
   {
      SoSeparator *axisworld = new SoSeparator;
      axisworld->unrefNoDelete();
		
		SoCoordinateAxis *AxisW   = new SoCoordinateAxis();
	   AxisW->fNDivision = 1;
      AxisW->fDivisionLength = 200;
		axisworld->addChild(AxisW);

      //kinechain->insertChild(AxisW,1);
      view->addNoColObject(axisworld);
		
    /*  lookingforjoints.setName("tool");
      lookingforjoints.setType(SoSeparator::getClassTypeId());
      lookingforjoints.setInterest(SoSearchAction::FIRST);
      lookingforjoints.apply(kinechain);

      if(lookingforjoints.getPath() != NULL)
      {
         SoNode * pnode = lookingforjoints.getPath()->getTail();;
      	
			SoCoordinateAxis *AxisT   = new SoCoordinateAxis();
			AxisT->fNDivision = 1;
      	AxisT->fDivisionLength = 200;

			SoSeparator *axistool = new SoSeparator;
         axistool->ref();
         axistool = (SoSeparator *) pnode;
         axistool->addChild(AxisT);
			view->addNoColObject(axistool);			
      }
      */ 
      panel_control *panel = new panel_control(0, "Panel", kineengine);

      for (int i = 0; i < kineengine->dof; i++)
      {
         // connect(panel->ldial[i], SIGNAL(valueChange(double)),((SoQtComposeRotation *) compR[i]), SLOT(setValue_angle(double)));
         connect(panel->ldial[i], SIGNAL(valueChange(double)),&panel->kinechain->list_plug[i], SLOT(setValue(double)));
         connect(&panel->kinechain->list_plug[i], SIGNAL(valueChanged(double)),((SoQtComposeRotation *) compR[i]), SLOT(setValue_angle(double)));
         connect(&panel->kinechain->list_plug[i], SIGNAL(valueChanged(double)),panel->ldial[i], SLOT(setValue(double)));
      }

      view->addRobotCell(kinechain);

      panel->show();
      panel->update_limits();
      //panel->kinechain->setconsole_mode(true); Ja estava comentada
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:qilex-svn,代码行数:101,代码来源:qilexdoc.cpp

示例4: createConvexHullVisualization

    SoSeparator* CoinConvexHullVisualization::createConvexHullVisualization(VirtualRobot::MathTools::ConvexHull6DPtr& convHull, bool buseFirst3Coords)
    {
        SoSeparator* result = new SoSeparator;

        if (!convHull || convHull->vertices.size() == 0 || convHull->faces.size() == 0)
        {
            return result;
        }

        result->ref();

        SoUnits* u = new SoUnits;
        u->units = SoUnits::MILLIMETERS;
        result->addChild(u);

        SoScale* sc = new SoScale();
        float fc = 400.0f;
        sc->scaleFactor.setValue(fc, fc, fc);
        result->addChild(sc);


        int nFaces = (int)convHull->faces.size();


        //Eigen::Vector3f v[6];
        // project points to 3d, then create hull of these points to visualize it
        std::vector<Eigen::Vector3f> vProjectedPoints;

        for (int i = 0; i < nFaces; i++)
        {
            for (int j = 0; j < 6; j++)
            {
                if (buseFirst3Coords)
                {
                    //v[j] = convHull->vertices.at(convHull->faces[i].id[j]).p;
                    vProjectedPoints.push_back(convHull->vertices[ convHull->faces[i].id[j] ].p);
                }
                else
                {
                    //v[j] = convHull->vertices.at(convHull->faces[i].id[j]).n;
                    vProjectedPoints.push_back(convHull->vertices[ convHull->faces[i].id[j] ].n);
                }

            }
        }

        VirtualRobot::MathTools::ConvexHull3DPtr projectedHull = ConvexHullGenerator::CreateConvexHull(vProjectedPoints);

        if (!projectedHull)
        {
            GRASPSTUDIO_ERROR << " Could not create hull of projected points, aborting..." << endl;
            return result;
        }

        SoSeparator* hullV = createConvexHullVisualization(projectedHull);

        if (!hullV)
        {
            GRASPSTUDIO_ERROR << " Could not create visualization of projected points, aborting..." << endl;
            return result;
        }

        result->addChild(hullV);
        result->unrefNoDelete();
        return result;
    }
开发者ID:gkalogiannis,项目名称:simox,代码行数:66,代码来源:CoinConvexHullVisualization.cpp


注:本文中的SoSeparator::unrefNoDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。