Osg-Osg之特效OsgFXScribe(Qt5.14.2+osgE3.6.5+win10)-No15-OsgFXScribe
.pro
1 QT += core gui widgets 2 TARGET = TestOsgQt 3 TEMPLATE = app 4 DEFINES += QT_DEPRECATED_WARNINGS 5 CONFIG += c++11 6 7 SOURCES += \ 8 main.cpp 9 10 HEADERS += 11 12 OsgDir = D:\\Gitee\\osg365R 13 CONFIG(release, debug|release) { 14 LIBS += -L$${OsgDir}/lib/ -losgDB -losgViewer -lOpenThreads -losgAnimation -losg \ 15 -losgEarth -losgEarthAnnotation -losgEarthFeatures -losgEarthSymbology -losgEarthUtil \ 16 -losgQOpenGL -losgUtil -losgText -losgTerrain -losgSim \ 17 -losgShadow -losgParticle -losgManipulator -losgGA -losgFX \ 18 -losgWidget 19 } else { 20 LIBS += -L$${OsgDir}/debug/lib/ -losgDBd -losgViewerd -lOpenThreadsd -losgAnimationd -losgd \ 21 -losgEarthd -losgEarthAnnotationd -losgEarthFeaturesd -losgEarthSymbologyd -losgEarthUtild \ 22 -losgQOpenGLd -losgUtild -losgTextd -losgTerraind -losgSimd \ 23 -losgShadowd -losgParticled -losgManipulatord -losgGAd -losgFXd \ 24 } 25 26 27 INCLUDEPATH += $${OsgDir}/include 28 DEPENDPATH += $${OsgDir}/include
main.cpp
1 #include <QApplication> 2 #ifdef _WIN32 3 #include <Windows.h> 4 #endif // _WIN32 5 #include <iostream> 6 //#include <math.h> 7 8 #include <osg/Node> 9 #include <osg/Group> 10 #include <osgDB/ReadFile> 11 #include <osgViewer/Viewer> 12 #include <osg/Geode> 13 #include <osg/ShapeDrawable> 14 #include <osg/Material> 15 #include <osg/Image> 16 #include <osg/Texture2D> 17 #include <osg/BoundingSphere> 18 #include <osg/LineWidth> 19 #include <osg/Point> 20 #include <osg/TexGen> 21 #include <osg/TexEnv> 22 23 //#include <osg/TessellationHints> 24 //#include <osg/NodePath> 25 #include <osgGA/GUIEventHandler> 26 #include <osgGA/GUIEventAdapter> 27 28 #include <osg/PositionAttitudeTransform> 29 #include <osgViewer/ViewerEventHandlers> 30 #include <osg/MatrixTransform> 31 #include <OpenThreads/Thread> 32 #include <osg/LightSource> 33 #include <osg/Light> 34 35 #include <osgFX/Scribe> 36 #include <osgFX/Outline> 37 38 int main() 39 { 40 osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer; 41 osg::ref_ptr<osg::Group> group1 = new osg::Group; 42 43 osg::Geode *geode = new osg::Geode; 44 geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(), 2))); 45 46 osg::ref_ptr<osgFX::Scribe> scribe_fx = new osgFX::Scribe; 47 scribe_fx->addChild(geode); 48 scribe_fx->setEnabled(true); 49 group1->addChild(scribe_fx.get()); 50 51 viewer1->setSceneData(group1.get()); 52 viewer1->setUpViewInWindow(200, 200, 500, 500, 0); 53 return viewer1->run(); 54 }
作者:疯狂Delphi
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
欢迎关注我,一起进步!扫描下方二维码即可加我