1. 下载源代码及脚本
这里有一个‘Convenient All-In-One’ 版的框架。
2. 创建场景
解压clean_ogre_cmake_project.zip,修改TutorialApplication.cpp中的函数:
1 void TutorialApplication::createScene(void) 2 { 3 // create your scene here :) 4 mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f,0.5f,0.5f)); 5 6 // Create an entity 7 Ogre::Entity* ogreHead=mSceneMgr->createEntity("Head","ogrehead.mesh"); 8 9 //create a sceneNode and attach the Entity to it 10 Ogre::SceneNode* headNode=mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode"); 11 headNode->attachObject(ogreHead); 12 13 14 //create a light and set its position 15 Ogre::Light* light=mSceneMgr->createLight("MainLight"); 16 light->setPosition(20.0f,80.0f,50.0f); 17 }
3. 编译、安装、运行
cmake CMakeLists.txt make install dist/bin/OgreApp
运行效果如图: