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


C++ NodePtr::getCPtr方法代码示例

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


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

示例1: traverse

NodePtr PerformerLoader::traverse(pfNode *node)
{
    FINFO(("PfL:traverse: traversing \"%s\": %p (%s)\n", 
        node->getName()?node->getName():"Unnamed",
        node, pfGetTypeName(node)));    
    
    if(_nodes.find(node) != _nodes.end())
    {
        FINFO(("PfL:traverse: found in nodemap as %p.\n",
                _nodes[node].getCPtr()));    
        
        return cloneTree(_nodes[node]);
    }
    
    NodePtr n = Node::create();
    NodeCorePtr core = NullFC; 
    
    beginEditCP(n);
    
    setName(n, node->getName());
    
	if (node->getType()->isDerivedFrom(pfGroup::getClassType()))
	{
        pfGroup *group = dynamic_cast<pfGroup *>(node);
        
        int ind = 0;
        int num = group->getNumChildren();

	    if (node->getType()->isDerivedFrom(pfLOD::getClassType()))
	    {
            if(_highestLODOnly)
            {
                num = osgMin(num, 1);
                core = Group::create();
            }
            else
            {
                pfLOD *lod = dynamic_cast<pfLOD *>(node);

                DistanceLODPtr l = DistanceLOD::create();

                beginEditCP(l);

                for(int i = 0; i < lod->getNumRanges(); ++i)
                {
                    l->getRange().push_back(lod->getRange(i));
                }

                endEditCP(l);

                core = l;
            }
	    }
	    else if (node->getType()->isDerivedFrom(pfSCS::getClassType()))
	    {
            pfSCS *scs = dynamic_cast<pfSCS *>(node);
            
            if (node->getType()->isDerivedFrom(pfDCS::getClassType()))
            {
            }
            
            pfMatrix pmat;            
            scs->getMat(pmat);
            
            Matrix omat;
            
            omat.setValue( pmat[0][0], pmat[0][1], pmat[0][2], pmat[0][3], 
                           pmat[1][0], pmat[1][1], pmat[1][2], pmat[1][3], 
                           pmat[2][0], pmat[2][1], pmat[2][2], pmat[2][3], 
                           pmat[3][0], pmat[3][1], pmat[3][2], pmat[3][3]);
            
            omat.transpose();
            
            TransformPtr t = Transform::create();
            
            beginEditCP(t);
            t->setMatrix(omat);
            endEditCP(t);
            
            core = t;
	    }
	    else if (node->getType()->isDerivedFrom(pfScene::getClassType()))
	    {
            FWARNING(("PerformerLoader::traverse: encountered scene "
                      "group!\n"));
 	    }
	    else if (node->getType()->isDerivedFrom(pfLayer::getClassType()))
	    {
            FWARNING(("PerformerLoader::traverse: encountered layer "
                      "group!\n"));
	    }
        else if (node->getType() != pfGroup::getClassType())
        {
            FWARNING(("PerformerLoader::traverse: encountered unknown group"
                    " node of type %s\n", pfGetTypeName(node)));
            core = Group::create();
        }
        else
        {
            core = Group::create();
//.........这里部分代码省略.........
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:101,代码来源:OSGPerformerLoader.cpp

示例2: main

// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    // GLUT init
    int winid = setupGLUT(&argc, argv);

    // the connection between GLUT and OpenSG
    GLUTWindowPtr gwin= GLUTWindow::create();
    gwin->setId(winid);
    gwin->init();

    // load the scene

    NodePtr scene;

    if(argc < 2)
    {
        FWARNING(("No file given!\n"));
        FWARNING(("Supported file formats:\n"));
        
        std::list<const char*> suffixes;
        SceneFileHandler::the().getSuffixList(suffixes);
        
        for(std::list<const char*>::iterator it  = suffixes.begin();
                                             it != suffixes.end();
                                           ++it)
        {
            FWARNING(("%s\n", *it));
        }

        scene = makeTorus(.5, 2, 16, 16);
    }
    else
    {
        /*
            All scene file loading is handled via the SceneFileHandler.
        */
        scene = SceneFileHandler::the().read(argv[1]);
    }

    // create the SimpleSceneManager helper
    mgr = new SimpleSceneManager;

    // tell the manager what to manage
    mgr->setWindow(gwin );
    mgr->setRoot  (scene);
    FWARNING(("scene: %p %lu\n", scene.getCPtr(), scene.getCPtr()));
    
    // show the whole scene   
    mgr->showAll();

    // start the debug tool
    startSceneGraphViewThread(scene);

    // GLUT main loop
    glutMainLoop();

    // stop the debug tool
    stopSceneGraphViewThread();

    return 0;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:65,代码来源:testTutorial.cpp


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