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


C++ NodeRecPtr::dump方法代码示例

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


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

示例1: main

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

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

    // create the graph

    // beacon for camera and light  
    OSG::NodeRecPtr b1n = OSG::Node::create();
    OSG::GroupRecPtr b1 = OSG::Group::create();
    b1n->setCore( b1 );

    // transformation
    OSG::NodeRecPtr t1n = OSG::Node::create();
    OSG::TransformRecPtr t1 = OSG::Transform::create();
    t1n->setCore( t1 );
    t1n->addChild( b1n );

    cam_trans = t1;

    // light
    OSG::NodeRecPtr dlight = OSG::Node::create();
    OSG::DirectionalLightRecPtr dl = OSG::DirectionalLight::create();

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

    // root
    root = OSG::Node::create();
    OSG::GroupRecPtr gr1 = OSG::Group::create();
    root->setCore( gr1 );
    root->addChild( t1n );
    root->addChild( dlight );

    // Load the file
    OSG::NodeRecPtr file = NULL;
    
    if ( argc > 1 )
        file = OSG::SceneFileHandler::the()->read(argv[1]);
    
    if ( file == NULL )
    {
        std::cerr << "Couldn't load file, ignoring" << std::endl;
        file = OSG::makeTorus( .5, 2, 16, 16 );
    }

    OSG::commitChanges();
    
    file->updateVolume();

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

    dlight->addChild( file );

    std::cerr << "Tree: " << std::endl;
    root->dump();

    // Camera
    OSG::PerspectiveCameraRecPtr cam = OSG::PerspectiveCamera::create();

    cam->setBeacon( b1n );
    cam->setFov( OSG::osgDegree2Rad( 60 ) );
    cam->setNear( 1 );
    cam->setFar( 4000 );

    // Background
    OSG::SolidBackgroundRecPtr bkgnd = OSG::SolidBackground::create();
    bkgnd->setColor( OSG::Color3f( 0,0,1 ) );

    // Viewport
    vp = OSG::Viewport::create();
    vp->setCamera( cam );
    vp->setBackground( bkgnd );
    vp->setRoot( root );
    vp->setSize( 0,0, 1,1 );
    
    // Action
    ract = OSG::RenderAction::create();

    // QT init
    QApplication::setColorSpec( QApplication::CustomColor );
    a = new QApplication( argc, argv );

    if ( !QGLFormat::hasOpenGL() )
    {
        qWarning( "This system has no OpenGL support. Exiting." );
        return -1;
    }

    OSG::Vec3f pos( 0, 0, max[2] + ( max[2] - min[2] ) * 1.5 );

//.........这里部分代码省略.........
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:101,代码来源:testWindowQT4_qt.cpp


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