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


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

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


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

示例1: Private

 Private() 
   : sensorCam1(0), sensorCam2(0)
 {
     // left view
     picksepLeft = new SoSeparator;
     picksepLeft->ref();
     // right view
     picksepRight = new SoSeparator;
     picksepRight->ref();
 }
开发者ID:kkoksvik,项目名称:FreeCAD,代码行数:10,代码来源:ManualAlignment.cpp

示例2: main

int main(int, char **argv)
{
	// Initialize Inventor. This returns a main window to use.
	// If unsuccessful, exit.
	HWND myWindow = SoWin::init("A red cone."); // pass the app name
	if (myWindow == NULL) exit(1);
	// Make a scene containing a red cone
	SoSeparator *root = new SoSeparator;
	SoPerspectiveCamera *myCamera = new SoPerspectiveCamera;
	SoMaterial *myMaterial = new SoMaterial;
	root->ref();
	root->addChild(myCamera);
	root->addChild(new SoDirectionalLight);
	myMaterial->diffuseColor.setValue(1.0, 1.0, 0.0); // Red
	root->addChild(myMaterial);

	root->addChild(new SoCone);
	// Create a renderArea in which to see our scene graph.
	// The render area will appear within the main window.
	SoWinExaminerViewer *myRenderArea = new SoWinExaminerViewer(myWindow);
	// Make myCamera see everything.
	myCamera->viewAll(root, myRenderArea->getViewportRegion());
	// Put our scene in myRenderArea, change the title
	myRenderArea->setSceneGraph(root);
	myRenderArea->setTitle("A red cone");
	myRenderArea->show();
	SoWin::show(myWindow); // Display main window
	SoWin::mainLoop(); // Main Inventor event loop
	delete myRenderArea;
	root->unref();
	return 0;
}
开发者ID:googleknight,项目名称:Coin3D_examples,代码行数:32,代码来源:Source.cpp

示例3: main

// the MAIN function
int main(int argc, char ** argv)
{
  Widget mainWindow = SoXt::init(argv[0]);
  if (mainWindow == NULL) exit(1);

  SoSeparator *root;

  root = new SoSeparator;
  root->ref();

  player.camera = new SoPerspectiveCamera;
  root->addChild(player.camera);
  root->addChild(createScene()) ;

  //player.camera->viewAll(root, myRenderArea->getViewportRegion());
  player.camera->position=SbVec3f(0, 5, 20);
  player.camera->orientation=SbRotation(-0.1, 0, 0, 1);
  player.camera->nearDistance=1;
  player.camera->farDistance=150;
  player.camera->heightAngle=0.5;

  //view the whole scene

  // initialize scenemanager instance
  SoXtRenderArea *myRenderArea = new SoXtRenderArea(mainWindow);
  myRenderArea->setSceneGraph(root);
  myRenderArea->setTitle("Bouncing Ball");
  myRenderArea->show();
  
  SoXt::show(mainWindow);
  SoXt::mainLoop();
  
  return 0;
}
开发者ID:pmitros,项目名称:ball,代码行数:35,代码来源:main.cpp

示例4: exit

SoSeparator *ReadScene(const char *Dir, const char *filename) {
   FILE *filePtr = NULL;
   SoSeparator *root;
   SoInput in;

   in.addDirectoryLast(Dir);

   if (!in.openFile(filename)) {
       cerr << "Error opening file " << filename << " from Directory " << Dir 
	    << endl;
       exit(1);
   }
   
   root = SoDB::readAll(&in);
   if (root == NULL)
       cerr << "Error reading file " << filename << " from Directory " << Dir 
	    << endl;
   else {
#ifdef DEBUG
       cerr << "Scene (" << filename << ") read!\n";
#endif
       root->ref();
   }
   in.closeFile();
   return root;
}
开发者ID:tarunrs,项目名称:homework-fall-2011,代码行数:26,代码来源:OSUInventor.C

示例5: doc_new_kinematic_hand

int QilexDoc::doc_new_kinematic_hand(ct_new_kinematic_chain *data)
{
   int error = 0;
   int tipus = 0;
   void * buffer ; //char *buffer;
   char *buftemp = (char*)malloc(1024);

   SoOutput out;

   size_t sizeModel = 0;

   SoSeparator *kinechain = new SoSeparator;
   SoSeparator *kinetest = new SoSeparator;

   Rchain_hand *kineengine = new Rchain_hand();

   SoTransform *pos_rot = new SoTransform;
   SbVec3f joinax;

   joinax.setValue(SbVec3f(data->x,data->y,data->z));
   pos_rot->translation.setValue(joinax);
   pos_rot->rotation.setValue(SbVec3f(data->axeX, data->axeY, data->axeZ), (float) rad((double) data->angle));

   kinechain = readFile(data->QsModelFile.latin1(), tipus);

   if (kinechain == NULL) // no object read
   { return 1; }
   else  // ok, there's no object with the same name
   {
      error = kineengine->init_dat(data->QsDatFile.latin1()); //

      if (error == 0)
      {
         kinechain->ref();
         kinetest = (SoSeparator*)SoNode::getByName(data->QsName.latin1());

         if (kinetest==NULL)
         {
            //we need to put it in a buffer to write the xml file
            // if is Ok
            SoOutput out;
            out.setBuffer(buftemp, 1024, reallocCB);

            SoWriteAction wa1(&out);
            wa1.apply(kinechain);

            out.getBuffer(buffer, sizeModel);

            kinechain->insertChild(pos_rot, 0);
         }
         error = doc_insert_kinematic_hand(kineengine, kinechain);
      }
   }

   if (error==0)
   {
      writeXML_kineelement((char *)buffer, sizeModel, tipus, data, kineengine);
   }
   return error;
}
开发者ID:BackupTheBerlios,项目名称:qilex-svn,代码行数:60,代码来源:qilexdoc.cpp

示例6: main

int main(int, char **argv)
{
	// Initialize Inventor. This returns a main window to use.
	// If unsuccessful, exit.
	HWND myWindow = SoWin::init("A red cone."); // pass the app name
	if (myWindow == NULL) exit(1);
	// Make a scene containing a red cone
	SoSeparator *root = new SoSeparator;
	root->ref();
	SoMaterial *myMaterial = new SoMaterial;
	myMaterial->diffuseColor.setValue(1.0, 0.0, 0.0);
	root->addChild(myMaterial);
	root->addChild(new SoCone);
	// Set up viewer:
	SoWinExaminerViewer *myViewer =new SoWinExaminerViewer(myWindow);
	myViewer->setSceneGraph(root);
	myViewer->setTitle("Examiner Viewer");
	myViewer->show(); 
	
	SoWin::show(myWindow); // Display main window
	SoWin::mainLoop(); // Main Inventor event loop
	
	root->unref();
	return 0;
}
开发者ID:googleknight,项目名称:Coin3D_examples,代码行数:25,代码来源:examinerview.cpp

示例7: isVisibleFace

    bool isVisibleFace(int faceIndex, const SbVec2f& pos, Gui::View3DInventorViewer* viewer)
    {
        SoSeparator* root = new SoSeparator;
        root->ref();
        root->addChild(viewer->getSoRenderManager()->getCamera());
        root->addChild(vp->getRoot());

        SoSearchAction searchAction;
        searchAction.setType(PartGui::SoBrepFaceSet::getClassTypeId());
        searchAction.setInterest(SoSearchAction::FIRST);
        searchAction.apply(root);
        SoPath* selectionPath = searchAction.getPath();

        SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
        rp.setNormalizedPoint(pos);
        rp.apply(selectionPath);
        root->unref();

        SoPickedPoint* pick = rp.getPickedPoint();
        if (pick) {
            const SoDetail* detail = pick->getDetail();
            if (detail && detail->isOfType(SoFaceDetail::getClassTypeId())) {
                int index = static_cast<const SoFaceDetail*>(detail)->getPartIndex();
                if (faceIndex != index)
                    return false;
                SbVec3f dir = viewer->getViewDirection();
                const SbVec3f& nor = pick->getNormal();
                if (dir.dot(nor) > 0)
                    return false; // bottom side points to user
                return true;
            }
        }

        return false;
    }
开发者ID:abdullahtahiriyo,项目名称:FreeCAD_sf_master,代码行数:35,代码来源:TaskFaceColors.cpp

示例8: getPointOnRay

SoPickedPoint* ViewProvider::getPointOnRay(const SbVec2s& pos, const View3DInventorViewer* viewer) const
{
    //first get the path to this node and calculate the current transformation
    SoSearchAction sa;
    sa.setNode(pcRoot);
    sa.setSearchingAll(true);
    sa.apply(viewer->getSoRenderManager()->getSceneGraph());
    if (!sa.getPath())
        return nullptr;
    SoGetMatrixAction gm(viewer->getSoRenderManager()->getViewportRegion());
    gm.apply(sa.getPath());

    SoTransform* trans = new SoTransform;
    trans->setMatrix(gm.getMatrix());
    trans->ref();
    
    // build a temporary scenegraph only keeping this viewproviders nodes and the accumulated 
    // transformation
    SoSeparator* root = new SoSeparator;
    root->ref();
    root->addChild(viewer->getSoRenderManager()->getCamera());
    root->addChild(trans);
    root->addChild(pcRoot);

    //get the picked point
    SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
    rp.setPoint(pos);
    rp.setRadius(viewer->getPickRadius());
    rp.apply(root);
    root->unref();
    trans->unref();

    SoPickedPoint* pick = rp.getPickedPoint();
    return (pick ? new SoPickedPoint(*pick) : 0);
}
开发者ID:mdjurfeldt,项目名称:FreeCAD,代码行数:35,代码来源:ViewProvider.cpp

示例9: createCameraObject

void
vpSimulator::initSceneGraph()
{
  this->scene = new SoSeparator;
  this->internalRoot = new SoSeparator;
  this->externalRoot = new SoSeparator;

  this->scene->ref();
  this->internalRoot->ref();
  this->externalRoot->ref();

  // define the camera SoPerspectiveCamera
  this->internalCamera = new SoPerspectiveCamera ;
  this->externalCamera = new SoPerspectiveCamera ;
  
  
  this->internalCameraPosition = new SoTransform;
  this->internalCameraObject = createCameraObject(zoomFactor);

  internalCamera->farDistance.setValue(100);
  internalCamera->nearDistance.setValue(0.0001f);



  // link between camera and internal root
  this->internalRoot->addChild (this->internalCamera);
  this->internalRoot->addChild (this->scene);

  this->externalRoot->addChild (this->externalCamera);
  this->externalRoot->addChild (this->scene);


  SoSeparator * camera = new SoSeparator;
  camera->ref();
  camera->addChild (this->internalCameraPosition);
  camera->addChild (this->internalCameraObject);
  this->externalRoot->addChild (camera);


  //this->externalRoot->addChild (internalCameraPosition);
  //  this->externalRoot->addChild (internalCameraObject);
  SoCube *cube = new SoCube ;
  cube->width=0.01f ;
  cube->depth=0.01f ;
  cube->height=0.01f ;

  this->externalRoot->addChild (cube);

  if (realtime==NULL)
  {

    SoDB::enableRealTimeSensor(FALSE);
    SoSceneManager::enableRealTimeUpdate(FALSE);
    realtime = (SbTime *) SoDB::getGlobalField("realTime");
    realtime->setValue(0.0);

  }


}
开发者ID:tswang,项目名称:visp,代码行数:60,代码来源:vpSimulator.cpp

示例10:

/* Cree une fleche composee d'un cylindre et d'un cone.
 * La fleche a une hauteur total de <longueur>, dont
 * <proportionFleche>% pour la fleche. Le rayon du cylindre
 * est <radius>, et celui de la fleche <radius> * 5.
 * La fleche est oriente selon l'axe Y.
 */
static SoSeparator *
createArrow (float longueur,
	     float proportionFleche,
	     float radius)
{
  SoSeparator *fleche = new SoSeparator;
  fleche->ref();

  SoTranslation *poseCylindre = new SoTranslation;
  SoCylinder *line = new SoCylinder;
  SoTranslation *posePointe = new SoTranslation;
  SoCone *pointe = new SoCone;

  float l_cylindre = longueur * ( 1 - proportionFleche);
  float l_cone = longueur * proportionFleche;
  float radius_cylindre = radius;
  float radius_cone = radius * 5;

  line->radius.setValue (radius_cylindre);
  line->height.setValue (l_cylindre);

  poseCylindre->translation.setValue (0, l_cylindre / 2, 0);
  posePointe->translation.setValue (0.0, l_cylindre / 2 + l_cone / 2, 0);

  pointe->bottomRadius.setValue (radius_cone);
  pointe->height.setValue (l_cone);


  fleche->addChild (poseCylindre);
  fleche->addChild (line);
  fleche->addChild (posePointe);
  fleche->addChild (pointe);

  return fleche;
}
开发者ID:tswang,项目名称:visp,代码行数:41,代码来源:vpSimulator.cpp

示例11: main

int main(int argc, char** argv)
{
    QWidget* mainwin = SoQt::init(argc, argv, argv[0]);

    SoSeparator* root = new SoSeparator;
    root->ref();
    InventorRobot robot(root);

    if (argc == 1){
        //robot.parse("../RobotEditorArmar4.dae");
        //robot.parse("/media/sf_host/manikin_creo_4.dae");
        std::cout << "Usage collada <collada file> [<inventor export>]" <<std::endl;
        return 1;
    }
    else {
        robot.parse(argv[1]);
        if (argc==3){
            SoWriteAction writeAction;
            writeAction.getOutput()->openFile(argv[2]);
            writeAction.apply(root);
        }
    }

    SoQtExaminerViewer* viewer = new SoQtExaminerViewer(mainwin);
    viewer->setSceneGraph(root);
    viewer->show();

    // Pop up the main window.
    SoQt::show(mainwin);
    // Loop until exit.
    SoQt::mainLoop();

    root->unref();
    return 1;
}
开发者ID:gkalogiannis,项目名称:simox,代码行数:35,代码来源:viewer.cpp

示例12: title

int
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
        int nCmdShow)
{
#else // UNIX

int
main(int argc, char ** argv)
{

#endif

  // initialize Coin and glut libraries
  SoDB::init();

#ifdef _WIN32
  int argc = 1;
  char * argv[] = { "glutiv.exe", (char *) NULL };
  glutInit(&argc, argv);
#else
  glutInit(&argc, argv);
#endif

  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

  SoSeparator * root;
  root = new SoSeparator;
  root->ref();
  SoPerspectiveCamera * camera = new SoPerspectiveCamera;
  root->addChild(camera);
  root->addChild(new SoDirectionalLight);
  root->addChild(createScenegraph());

  scenemanager = new SoSceneManager;
  scenemanager->setRenderCallback(redraw_cb, (void *)1);
  scenemanager->setBackgroundColor(SbColor(0.2f, 0.2f, 0.2f));
  scenemanager->activate();
  camera->viewAll(root, scenemanager->getViewportRegion());
  scenemanager->setSceneGraph(root);
  
  glutInitWindowSize(512, 400);
  SbString title("Offscreen Rendering");
  glutwin = glutCreateWindow(title.getString());
  glutDisplayFunc(expose_cb);
  glutReshapeFunc(reshape_cb);
 
  // start main loop processing (with an idle callback)

  glutIdleFunc(idle_cb);
  glutMainLoop();

  root->unref();
  delete scenemanager;
  return 0;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:55,代码来源:glut_tex.cpp

示例13: SoSeparator

SoSeparator * HandObjectState::copyHandStateIV(){
  SoSeparator * graspIVRoot = new SoSeparator();
  //FIXME -- is this necesary?
  graspIVRoot->ref();
  SoNode * handIVRoot = mHand->getIVRoot()->copy(1);
  SoNode * objectIVRoot = mTargetObject->getIVRoot()->copy(1);
  graspIVRoot->addChild(handIVRoot);
  graspIVRoot->addChild(objectIVRoot);

  return graspIVRoot;
} 
开发者ID:jon-weisz,项目名称:graspit_bci,代码行数:11,代码来源:searchState.cpp

示例14: main

int main()
{
   SoSeparator *root = new SoSeparator;
   SoPerspectiveCamera *myCamera = new SoPerspectiveCamera;
   SoMaterial *myMaterial = new SoMaterial;
   root->ref();
   root->addChild(myCamera);
   root->addChild(new SoDirectionalLight);
   myMaterial->diffuseColor.setValue(1.0, 0.0, 0.0);
   root->addChild(myMaterial);
   root->addChild(new SoCone);
}
开发者ID:Distrotech,项目名称:mxe,代码行数:12,代码来源:coin-test.cpp

示例15: ivModel

  SoSeparator* IVElement::ivModel(bool tran) {
	  if(tran){
		  SoSeparator* temp = new SoSeparator;
		  temp->ref();
		  temp->addChild(color);
		  temp->addChild(trans);
		  temp->addChild(rot);
		  temp->addChild(ivmodel);
		  return temp;
	  }else
			return ivmodel;
  }
开发者ID:joseparnau,项目名称:rosjac,代码行数:12,代码来源:ivelement.cpp


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