Changeset 428
- Timestamp:
- Dec 5, 2007, 11:00:14 PM (17 years ago)
- Location:
- code/branches/skybox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/skybox/src/CMakeLists.txt
r164 r428 3 3 # create a few variables to simplify life 4 4 5 SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc )6 SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h )5 SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc skybox/SkyBox.cc) 6 SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h skybox/SkyBox.h) 7 7 8 8 #Creates an executable -
code/branches/skybox/src/orxonox.cc
r399 r428 41 41 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 42 42 #include <CoreFoundation/CoreFoundation.h> 43 #include "windows.h" 44 45 43 46 44 47 // This function will locate the path to our application on OS X, … … 68 71 namespace orxonox 69 72 { 70 class OrxExitListener : public Ogre::FrameListener 71 { 72 public: 73 OrxExitListener(OIS::Keyboard *keyboard) 74 : mKeyboard(keyboard) 75 { 76 } 77 78 bool frameStarted(const Ogre::FrameEvent& evt) 79 { 80 mKeyboard->capture(); 81 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 82 } 83 84 private: 85 OIS::Keyboard *mKeyboard; 86 }; 73 Ogre::RenderWindow * mWindow; 74 Ogre::SceneManager *mgr; 75 int stopper = 1; 76 87 77 88 78 class OrxApplication … … 104 94 } 105 95 96 OrxApplication() 97 { 98 OrxApplication::pointer_s = this; 99 this->x = 0; 100 } 101 106 102 ~OrxApplication() 107 103 { … … 113 109 } 114 110 115 private:116 Ogre::Root *mRoot;117 OIS::Keyboard *mKeyboard;118 OIS::Mouse *mMouse;119 OIS::InputManager *mInputManager;120 // CEGUI::OgreCEGUIRenderer *mRenderer;121 // CEGUI::System *mSystem;122 OrxExitListener *mListener;123 111 124 112 void createRoot() … … 168 156 void createRenderWindow() 169 157 { 170 m Root->initialise(true, "Ogre Render Window");158 mWindow = mRoot->initialise(true, "Ogre Render Window"); 171 159 } 172 160 … … 184 172 void setupScene() 185 173 { 186 Ogre::SceneManager *mgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager"); 187 Ogre::Camera *cam = mgr->createCamera("Camera"); 188 cam->setPosition(Ogre::Vector3(0,0,-250)); 189 cam->lookAt(Ogre::Vector3(0,0,0)); 174 mgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager"); 175 cam = mgr->createCamera("Camera"); 176 cam->setPosition(Ogre::Vector3(0,0,0)); 177 //cam->lookAt(Ogre::Vector3(0,0,0)); 178 cam->setFOVy(Ogre::Degree(90)); 190 179 Ogre::Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam); 191 180 mgr->setSkyBox(true, "Examples/SpaceSkyBox"); 181 182 // camera pitch here works 183 184 192 185 } 193 186 … … 220 213 Ogre::RenderWindow *win = mRoot->getAutoCreatedWindow(); 221 214 } 215 216 void screenShots() 217 { 218 219 Ogre::Radian x1 = Ogre::Radian(x); 220 221 unsigned int indice = 1; 222 char filename[30]; 223 char fn[1]; 224 // generate new names... 225 sprintf(filename, "SkyBox%d.png", stopper); 226 //sprintf(filename, "screenshot_%d.png", ++indice); 227 //sprintf(filename, fn, ++indice); 228 229 230 Ogre::Radian x2 = Ogre::Radian((3.141592653589/2.0)*(stopper+1)); 231 232 233 if(stopper == 1){ 234 cam->yaw(Ogre::Degree(90)); 235 sprintf(filename, "SkyBox%d.png", stopper+1035); 236 mWindow->writeContentsToFile(filename); 237 238 } 239 else if(stopper == 2){ 240 cam->yaw(Ogre::Degree(180)); 241 mWindow->writeContentsToFile(filename); 242 243 } 244 else if(stopper == 3){ 245 cam->yaw(Ogre::Degree(270)); 246 mWindow->writeContentsToFile(filename); 247 248 } 249 else if(stopper == 4){ 250 cam->yaw(Ogre::Degree(0)); 251 mWindow->writeContentsToFile(filename); 252 253 } 254 255 else if(stopper == 5){ 256 257 cam->yaw(Ogre::Degree(0)); 258 mWindow->writeContentsToFile(filename); 259 260 } 261 else if(stopper == 6){ 262 cam->yaw(Ogre::Degree(180)); 263 mWindow->writeContentsToFile(filename); 264 265 } 266 267 /*else if(stopper == 6){ 268 cam->roll(Ogre::Degree(270)); 269 }*/ 270 271 //cam->pitch(Ogre::Degree(90)*stopper); 272 273 stopper+=1; 274 if(stopper >= 7) 275 stopper = 1; 276 } 277 278 class OrxExitListener : public Ogre::FrameListener 279 { 280 public: 281 OrxExitListener(OIS::Keyboard *keyboard) 282 : mKeyboard(keyboard) 283 { 284 } 285 bool frameEnded(const Ogre::FrameEvent& evt) 286 { 287 if(mKeyboard->isKeyDown(OIS::KC_RETURN) or stopper > 1){ 288 OrxApplication::pointer_s->screenShots(); 289 } 290 291 return true; 292 } 293 294 bool frameStarted(const Ogre::FrameEvent& evt) 295 { 296 mKeyboard->capture(); 297 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 298 } 299 300 301 private: 302 OIS::Keyboard *mKeyboard; 303 }; 222 304 223 305 void createFrameListener() … … 231 313 mRoot->startRendering(); 232 314 } 315 316 317 private: 318 Ogre::Root *mRoot; 319 OIS::Keyboard *mKeyboard; 320 OIS::Mouse *mMouse; 321 OIS::InputManager *mInputManager; 322 // CEGUI::OgreCEGUIRenderer *mRenderer; 323 // CEGUI::System *mSystem; 324 OrxExitListener *mListener; 325 Ogre::Camera * cam; 326 double x; 327 328 public: 329 static OrxApplication* pointer_s; 233 330 }; 331 332 OrxApplication* OrxApplication::pointer_s = 0; 234 333 } 235 334
Note: See TracChangeset
for help on using the changeset viewer.