- Timestamp:
- Apr 1, 2010, 4:20:47 PM (15 years ago)
- Location:
- code/branches/skybox2/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc
r6619 r6673 30 30 31 31 #include <string> 32 #include <cassert> 33 #include <OgreRenderWindow.h> 34 32 35 #include "core/ConsoleCommand.h" 33 36 #include "core/CoreIncludes.h" 34 37 #include "core/ConfigValueIncludes.h" 35 38 #include "core/ScopedSingletonManager.h" 39 #include "controllers/HumanController.h" 40 #include "worldentities/CameraPosition.h" 41 #include "worldentities/ControllableEntity.h" 42 #include "core/GraphicsManager.h" 43 #include "core/CommandExecutor.h" 44 45 36 46 37 47 namespace orxonox … … 42 52 ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false); 43 53 44 SkyboxGenerator::SkyboxGenerator() 54 SkyboxGenerator::SkyboxGenerator() : iterateOverDirections_(0) 45 55 { 46 56 RegisterRootObject(SkyboxGenerator); 47 57 48 58 this->setConfigValues(); 59 takeScreenshot_ = false; 49 60 } 50 61 … … 58 69 SetConfigValue(skyboxPrefix_, "SkyboxFile_"); 59 70 } 71 72 void SkyboxGenerator::tick(float dt) 73 { 74 if( takeScreenshot_ == true ) 75 { 76 ControllableEntity* ce = HumanController::getLocalControllerSingleton()->getControllableEntity(); 77 assert(ce); 78 79 Ogre::RenderWindow* w = GraphicsManager::getInstance().getRenderWindow(); 80 81 82 83 switch (iterateOverDirections_) 84 { 85 case 0 : 86 CommandExecutor::execute("pause"); 87 //w->writeContentsToFile(skyboxPrefix_+"FR.png"); 88 w->writeContentsToFile(skyboxPrefix_+"0.png"); 89 ce->yaw(Degree(90)); 90 iterateOverDirections_++; 91 break; 92 93 case 1 : 94 //w->writeContentsToFile(skyboxPrefix_+"LF.png"); 95 w->writeContentsToFile(skyboxPrefix_+"1.png"); 96 ce->yaw(Degree(90)); 97 iterateOverDirections_++; 98 break; 99 100 case 2 : 101 //w->writeContentsToFile(skyboxPrefix_+"BK.png"); 102 w->writeContentsToFile(skyboxPrefix_+"2.png"); 103 ce->yaw(Degree(90)); 104 iterateOverDirections_++; 105 break; 106 107 case 3 : 108 //w->writeContentsToFile(skyboxPrefix_+"RT.png"); 109 w->writeContentsToFile(skyboxPrefix_+"3.png"); 110 ce->yaw(Degree(90)); 111 ce->pitch(Degree(90)); 112 iterateOverDirections_++; 113 break; 114 115 case 4 : 116 //w->writeContentsToFile(skyboxPrefix_+"UP.png"); 117 w->writeContentsToFile(skyboxPrefix_+"4.png"); 118 ce->pitch(Degree(180)); 119 iterateOverDirections_++; 120 break; 121 122 case 5 : 123 //w->writeContentsToFile(skyboxPrefix_+"DN.png"); 124 w->writeContentsToFile(skyboxPrefix_+"5.png"); 125 ce->pitch(Degree(90)); 126 iterateOverDirections_ =0; 127 takeScreenshot_ = false; 128 CommandExecutor::execute("pause"); 129 130 } 131 } 132 } 60 133 61 134 void SkyboxGenerator::createSkybox( ) 62 135 { 63 //SkyboxGenerator* sbg = SkyboxGenerator::getInstancePtr();64 //sbg->skyboxPrefix_;65 136 66 /*unsigned int indice = 1; 67 char filename[30]; 68 char fn[1]; 69 // generate new names... 70 //sprintf(filename, "screenshot_%d.png", ++indice); 71 //sprintf(filename, fn, ++indice); 72 */ 137 SkyboxGenerator::getInstance().takeScreenshot_ = true; 138 73 139 74 /* 75 if(stopper == 1){ 76 //sprintf(filename, "stevecube_FR.bmp"); 77 mWindow->writeContentsToFile("MySky_FR.bmp"); 78 } 79 else if(stopper == 2){ 80 //sprintf(filename, "stevecube_LF.bmp"); 81 cam->pitch(Ogre::Degree(90)); 82 mWindow->writeContentsToFile("MySky_LF.bmp"); 83 } 84 else if(stopper == 3){ 85 //sprintf(filename, "stevecube_BK.bmp"); 86 cam->pitch(Ogre::Degree(90)); 87 mWindow->writeContentsToFile("MySky_BK.bmp"); 88 } 89 else if(stopper == 4){ 90 //sprintf(filename, "stevecube_RT.bmp"); 91 cam->pitch(Ogre::Degree(90)); 92 mWindow->writeContentsToFile("MySky_RT.bmp"); 93 } 94 else if(stopper == 5){ 95 //sprintf(filename, "stevecube_UP.bmp"); 96 cam->yaw(Ogre::Degree(90)); 97 mWindow->writeContentsToFile("MySky_UP.bmp"); 98 } 99 else if(stopper == 6){ 100 cam->yaw(Ogre::Degree(-90)); 101 mWindow->writeContentsToFile("MySky_DN.bmp"); 102 } 103 104 stopper+=1; 105 if(stopper >= 7) 106 stopper = 1; 107 */ 140 108 141 } 109 142 } -
code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h
r6619 r6673 30 30 #include "core/OrxonoxClass.h" 31 31 #include "util/Singleton.h" 32 #include "tools/interfaces/Tickable.h" 32 33 33 34 34 35 namespace orxonox 35 36 { 36 class SkyboxGenerator : public virtual OrxonoxClass, public Singleton<SkyboxGenerator> 37 class SkyboxGenerator : public virtual OrxonoxClass, public Singleton<SkyboxGenerator>, public Tickable 37 38 { 38 39 friend class Singleton<SkyboxGenerator>; … … 41 42 SkyboxGenerator(); 42 43 virtual ~SkyboxGenerator(); 43 void createSkybox( );44 static void createSkybox( ); 44 45 void setConfigValues( ); 46 void tick(float dt); 45 47 46 48 private: 47 49 static SkyboxGenerator* singletonPtr_s; 48 std::string skyboxPrefix_; 50 std::string skyboxPrefix_; 51 bool takeScreenshot_; 52 int iterateOverDirections_; 49 53 50 54 }; -
code/branches/skybox2/src/orxonox/worldentities/ControllableEntity.h
r6417 r6673 137 137 inline float getMouseLookSpeed() const 138 138 { return this->mouseLookSpeed_; } 139 inline CameraPosition* getCurrentCameraPosition() 140 { return this->currentCameraPosition_; } 139 141 140 142 inline Controller* getXMLController() const
Note: See TracChangeset
for help on using the changeset viewer.