开始学习OSG

来源:互联网 发布:淘宝网装修的工作流程 编辑:程序博客网 时间:2024/04/29 03:58
#ifdef _DEBUG#pragma comment(lib,"osgViewerd.lib")#pragma comment(lib,"osgDBd.lib")#pragma comment(lib,"OpenThreadsd.lib")#pragma comment(lib,"osgd.lib")#else#pragma comment(lib,"osgViewer.lib")#pragma comment(lib,"osgDB.lib")#pragma comment(lib,"OpenThreads.lib")#pragma comment(lib,"osgUtil.lib")#pragma comment(lib,"osg.lib")#endif#include <osgDB/ReadFile>#include <osgViewer/Viewer>#include <osgViewer/ViewerEventHandlers>#include <osg/MatrixTransform>#include <osg/Node>int main(){osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;osg::ref_ptr<osg::Group> gp= new osg::Group;osg::ref_ptr<osg::Node> cowNode = osgDB::readNodeFile("cow.osg");gp->addChild(cowNode);osg::ref_ptr<osg::MatrixTransform > yaw= new osg::MatrixTransform;yaw->setMatrix(osg::Matrix::rotate(osg::DegreesToRadians(-45.0),0,1,0)*osg::Matrix::translate(0,0,3));yaw->addChild(cowNode);gp->addChild(yaw);viewer->setSceneData(gp);return viewer->run();}


原创粉丝点击