Osg-Osg实例牛对象缩放效果(Qt5.14.2+osgEarht3.6.5+win10)-No8-zoom
2023-09-14 08:57:11 时间
相关资料:
https://www.cnblogs.com/ylwn817/articles/1973396.html osg矩阵变换节点-----平移旋转缩放
代码实例:
.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:\\RuanJian\\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 3 #include <osg/Node> 4 #include <osg/Group> 5 #include <osg/Geode> 6 #include <osg/Geometry> 7 #include <osg/Texture2D> 8 #include <osg/StateSet> 9 #include <osg/PositionAttitudeTransform> 10 #include <osgViewer/Viewer> 11 #include <osgDB/ReadFile> 12 #include <osgParticle/PrecipitationEffect> 13 // 雨雪效果 14 #include <osg/MatrixTransform> 15 // 粒子效果 16 #include <osgParticle/PrecipitationEffect> 17 #include <osgParticle/Particle> 18 #include <osgParticle/LinearInterpolator> 19 #include <osgParticle/ParticleSystem> 20 #include <osgParticle/RandomRateCounter> 21 #include <osgParticle/PointPlacer> 22 #include <osgParticle/RadialShooter> 23 #include <osgParticle/ModularEmitter> 24 #include <osgParticle/ParticleSystemUpdater> 25 #include <osgParticle/ModularProgram> 26 #include <osgUtil/Optimizer> 27 #include <osgUtil/Simplifier> 28 #include <osgParticle/FireEffect> 29 // 雾 30 #include <osg/Fog> 31 #include <osgDB/ReadFile> 32 #include <osgViewer/Viewer> 33 #include <osg/StateSet> 34 #include <osg/StateAttribute> 35 #include <osgViewer/ViewerEventHandlers> 36 #include <osgWidget/ViewerEventHandlers> 37 38 int main(int argc, char *argv[]) 39 { 40 osgViewer::Viewer viewer; 41 osg::ref_ptr<osg::Group> root=new osg::Group(); 42 43 osg::ref_ptr<osg::Node> osgcool=osgDB::readNodeFile("D:\\osgFiles\\cow.osg"); 44 45 osg::ref_ptr<osg::MatrixTransform> trans=new osg::MatrixTransform(); 46 // osg::Matrix::scale(0.5,0.5,0.5)表示缩放的比例,也就是原来物体的一般大小 47 // *osg::Matrix::translate(0,-10,0)表示平移正前 48 trans->setMatrix(osg::Matrix::scale(0.5,0.5,0.5)*osg::Matrix::translate(0,-10,0)); 49 trans->addChild(osgcool.get()); 50 51 root->addChild(osgcool.get()); 52 root->addChild(trans.get()); 53 54 viewer.setUpViewInWindow(50,50,500,400); 55 viewer.setSceneData(root.get()); 56 viewer.realize(); 57 viewer.run(); 58 }
相关文章
- 如何取得ChipmunkConstraint实例对象的私有属性
- objc直接通过指针访问对象实例变量
- 这里我们可以看到:Person是个多层次对象,包含多层嵌入属性对象(multi-layer embeded objects)。如果需要更改Person类型实例中的任何字段时,我们可以直接用行令方式(imperative style):
- Linux平台单实例数据库安装
- 小鸡 宕机的过程记录在实例告警日志中
- C++设计模式5--单例模式Singleton--当前对象只有一个实例
- spring 从bean实例中获取对象
- C/C++基础讲解(二十四)之数据结构篇之队列实例与K阶斐波那契序列
- ASP.NET Core 6框架揭秘实例演示[09]:将配置绑定为对象
- 集合类操作:未将对象引用设置到对象的实例
- 集合类操作:未将对象引用设置到对象的实例
- html表单实例:用户反馈表单页面代码
- ZZNUOJ_C语言1084:计算两点间的距离(多实例测试)(完整代码)
- Python编程:获取类实例对象的元素
- 【Android 逆向】使用 Python 代码解析 ELF 文件 ( PyCharm 中进行断点调试 | ELFFile 实例对象分析 )
- java类的初始化块/执行顺序,实例化对象数据赋值
- C++之4种实例化对象方式(一百一三十一)
- 爬虫日记(19):实例使用Item对象
- php接口数据加密、解密、验证签名代码实例
- 未将对象引用设置到对象的实例--可能出现的问题总结
- 未将对象引用设置到对象的实例--可能出现的问题总结
- HyperLynx中层叠设计实例
- JS 函数参数arguments对象(实例)
- __getattribute__的妙用,实现对象实例的“继承“与方法重载
- 【C++要笑着学】类和对象 | 初识封装 | 访问限定符 | 类的作用域和实例化 | 类对象模型 | this指针