zoukankan      html  css  js  c++  java
  • osg define shape(create box)

    #ifdef _WIN32
    #include <Windows.h>
    #endif // _WIN32
    
    #include <osgViewer/Viewer>
    #include <osgViewer/ViewerEventHandlers> 
    #include <osgViewer/CompositeViewer> 
    #include <osgDB/ReadFile>
    #include <osg/Geode>
    #include <osg/Node>
    #include <osgGA/TrackballManipulator>
    #include <osg/GraphicsContext>
    #include <osg/ShapeDrawable>
    #include <osg/Material>
    #include <osg/Image>
    #include <osg/Texture2D>
    #include <osg/TexEnv>
    #include <osg/TexGen>
    #include <osg/MatrixTransform>
    #include <osg/PositionAttitudeTransform>
    #include <osg/AnimationPath>
    #include <osg/Matrixd>
    
    #include <osgGA/GUIEventHandler>
    #include <osgGA/CameraManipulator>
    #include <osgGA/StandardManipulator>
    #include <osgGA/OrbitManipulator>
    #include <osgGA/TrackballManipulator>
    
    //创建盒子
    osg::ref_ptr<osg::Geode> createBox()
    {
        osg::ref_ptr<osg::Geode> geode1 = new osg::Geode;
        geode1->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0,0.0,0.0),10.0,8.0,6.0)));
        
        return geode1;
    }
    
    int main()
    {
        osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
        osg::ref_ptr<osg::Group> group1 = new osg::Group;
        group1->addChild(createBox());
    
        viewer1->setSceneData(group1.get());
        viewer1->setUpViewInWindow(200, 200, 800, 600, 0);
    
        return viewer1->run();
    }

  • 相关阅读:
    session笔记-韩顺平
    带宽
    cookie-韩顺平
    分层模式开发+MVC模式开发--韩顺平雇员数据库管理
    韩顺平-雇员管理系统-学习小结
    常用的PHP数据库操作方法(MYSQL版)
    使用Three.js 基本组件以及流程
    three.js 相机
    多线程的操作与数据绑定
    矩阵-
  • 原文地址:https://www.cnblogs.com/herd/p/11085354.html
Copyright © 2011-2022 走看看