zoukankan      html  css  js  c++  java
  • osg::Camera example

    #ifdef _WIN32
    #include <Windows.h>
    #endif // _WIN32
    #include<iostream>
    
    #include <osgViewer/Viewer>
    #include <osgViewer/ViewerEventHandlers> 
    #include <osgViewer/CompositeViewer> 
    
    #include <osgDB/ReadFile>
    
    #include <osg/Geode>
    #include <osg/Node>
    #include <osg/Geometry>
    #include <osg/GraphicsContext>
    #include <osg/ShapeDrawable>
    #include <osg/Material>
    #include <osg/Image>
    #include <osg/Texture2D>
    #include <osg/TexEnv>
    #include <osg/TexGen>
    #include <osg/NodeVisitor>
    #include <osg/MatrixTransform>
    #include <osg/PositionAttitudeTransform>
    #include <osg/AnimationPath>
    #include <osg/Matrixd>
    #include <osg/PagedLOD>
    #include <osg/Camera>
    
    #include <osgGA/TrackballManipulator>
    #include <osgGA/GUIEventHandler>
    #include <osgGA/CameraManipulator>
    #include <osgGA/StandardManipulator>
    #include <osgGA/OrbitManipulator>
    #include <osgGA/TrackballManipulator>
    
    #include <osgUtil/IntersectionVisitor>
    #include <osgUtil/LineSegmentIntersector>
    
    
    int main()
    {
        osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
        osg::ref_ptr<osg::Group> group1 = new osg::Group;
        osg::ref_ptr<osg::Camera> camera1 = new osg::Camera;
    
        osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\参考手册\BIM\osg\build20190628.osgb");
    
        camera1->addChild(node1);
        camera1->setViewport(0, 0, 300, 220);
        camera1->setClearColor(osg::Vec4(0.0,0.0,0.0,0.0));
    
        group1->addChild(node1.get());
        group1->addChild(camera1.get());
    
        viewer1->setSceneData(group1.get());
        viewer1->setUpViewInWindow(200, 200, 800, 500, 0);
    
        viewer1->run();
    }

  • 相关阅读:
    进程池Pool
    进程间通信-Queue
    多任务版udp聊天器
    列表循环放引用并写出打印结果
    协程实现tcp两个客户端的通讯
    正则匹配身份证和邮箱
    python中上双互斥锁的线程执行流程
    小巧的http live streaming m3u8播放器
    js实现@提到好友
    mongoose多级嵌套操作
  • 原文地址:https://www.cnblogs.com/herd/p/11104722.html
Copyright © 2011-2022 走看看