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


C++ NodeUnrecPtr::updateVolume方法代码示例

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


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

示例1: main

int main (int argc, char **argv)
{
    osgInit(argc,argv);
    
    // GLUT init

    glutInit(&argc, argv);
    glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);

    glutInitWindowSize    (uiSize, uiSize);
    glutInitWindowPosition(100,100);


    int winid = glutCreateWindow("OpenSG");
    glutKeyboardFunc(key);
    glutVisibilityFunc(vis);
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);       
    glutMouseFunc(mouse);   
    glutMotionFunc(motion); 
    
    glutIdleFunc(display);  

    // OSG

    SceneFileHandler::the()->print();

    // create the graph

    // beacon for camera and light  
    NodeUnrecPtr  b1n = Node::create();
    GroupUnrecPtr b1  = Group::create();

    b1n->setCore( b1 );

    // transformation
    NodeUnrecPtr      t1n = Node::create();
    TransformUnrecPtr t1  = Transform::create();

    t1n->setCore (t1 );
    t1n->addChild(b1n);

    cam_trans = t1;

    // light
    
    NodeUnrecPtr             dlight = Node::create();
    DirectionalLightUnrecPtr dl     = DirectionalLight::create();

    {
        dlight->setCore(dl);
        
        dl->setAmbient( .0, .0, .0, 1 );
        dl->setDiffuse( .8, .8, .8, .8 );
        dl->setDirection(0,0,1);
        dl->setBeacon( b1n);
    }

    // root
    root              = Node:: create();
    GroupUnrecPtr gr1 = Group::create();

    root->setCore (gr1   );
    root->addChild(t1n   );
    root->addChild(dlight);

    // Load the file

    NodeUnrecPtr file = NULL;
    
    if(argc > 1)
    {
        file = SceneFileHandler::the()->read(argv[1], NULL);
    }

    if(file == NULL)
    {
        std::cerr << "Couldn't load file, ignoring" << std::endl;

        file = makeSphere(4, 20.0);
    }

    Thread::getCurrentChangeList()->commitChanges();

    file->updateVolume();


    Vec3f min,max;
    file->getVolume().getBounds(min, max);
    
    std::cout << "Volume: from " << min << " to " << max << std::endl;

                 scene_trans = Transform::create();
    NodeUnrecPtr sceneTrN    = Node::create();

    sceneTrN->setCore (scene_trans);
    sceneTrN->addChild(file       );


                 ref_trans = Transform::create();
//.........这里部分代码省略.........
开发者ID:jieah,项目名称:OSGAddOnsGV,代码行数:101,代码来源:testBbqGeoRefRender.cpp

示例2: doMain


//.........这里部分代码省略.........
        geoRef->setCore(Group::create());

        NodeUnrecPtr           pEll     = Node::create();
        MaterialGroupUnrecPtr  pEllMatG = MaterialGroup::create();
        SimpleMaterialUnrecPtr pEllMat  = SimpleMaterial::create();

        pEllMat->editDiffuse().setValuesRGB(0.3, 0.3, 0.3);

        pEllMatG->setMaterial(pEllMat);

        pEll->setCore(pEllMatG);

        pEll->addChild(makeLatLongEllipsoid(18, 
                                            36, 
                                            6378137. * 0.95,
                                            6356752.3142 * 0.95));
    

        geoRef->addChild(pEll);
    
        geoRef->addChild(makeEllipsoidAxis(18, 
                                           36, 
                                           6378137. * 1.05,
                                           6356752.3142 * 1.05));

        file = geoRef; //makeSphere(4, 2.0);
#endif

        file = makeSphere(4, 2.0);
    }

    Thread::getCurrentChangeList()->commitChanges();

    file->updateVolume();


    Vec3f min,max;
    file->getVolume().getBounds(min, max);
    
    std::cout << "Volume: from " << min << " to " << max << std::endl;

/*
    min[0] = -500;
    min[1] = 0;
    min[2] = -500;

    max[0] = 500;
    max[1] = 100;
    max[2] = 500;
 */

                 scene_trans = Transform::create();
    NodeUnrecPtr sceneTrN    = Node::create();

    sceneTrN->setCore (scene_trans);
    sceneTrN->addChild(file       );

    AlgorithmStageUnrecPtr pAlgoStage = AlgorithmStage::create();

    pAlgoStage->setInheritedTarget(true);
    pAlgoStage->setProjectionMode (AlgorithmStage::Ignore);
    pAlgoStage->setCopyViewing    (true);

    CallbackAlgorithmUnrecPtr pAlgo = CallbackAlgorithm::create();

    pAlgo->setCallback(&terrainRenderCB, "");
开发者ID:whztt07,项目名称:OSGAddOnsGV,代码行数:67,代码来源:testMiniTerrainLoad.cpp


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