[Orxonox-commit 1956] r6673 - in code/branches/skybox2/src: modules/designtools orxonox/worldentities
gionc at orxonox.net
gionc at orxonox.net
Thu Apr 1 16:20:47 CEST 2010
Author: gionc
Date: 2010-04-01 16:20:47 +0200 (Thu, 01 Apr 2010)
New Revision: 6673
Modified:
code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc
code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h
code/branches/skybox2/src/orxonox/worldentities/ControllableEntity.h
Log:
First version of SkyboxGenerator
Modified: code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc 2010-04-01 13:34:02 UTC (rev 6672)
+++ code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc 2010-04-01 14:20:47 UTC (rev 6673)
@@ -29,10 +29,20 @@
#include "SkyboxGenerator.h"
#include <string>
+#include <cassert>
+#include <OgreRenderWindow.h>
+
#include "core/ConsoleCommand.h"
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
#include "core/ScopedSingletonManager.h"
+#include "controllers/HumanController.h"
+#include "worldentities/CameraPosition.h"
+#include "worldentities/ControllableEntity.h"
+#include "core/GraphicsManager.h"
+#include "core/CommandExecutor.h"
+
+
namespace orxonox
{
@@ -41,11 +51,12 @@
ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false);
- SkyboxGenerator::SkyboxGenerator()
+ SkyboxGenerator::SkyboxGenerator() : iterateOverDirections_(0)
{
RegisterRootObject(SkyboxGenerator);
this->setConfigValues();
+ takeScreenshot_ = false;
}
SkyboxGenerator::~SkyboxGenerator()
@@ -57,53 +68,75 @@
{
SetConfigValue(skyboxPrefix_, "SkyboxFile_");
}
+
+ void SkyboxGenerator::tick(float dt)
+ {
+ if( takeScreenshot_ == true )
+ {
+ ControllableEntity* ce = HumanController::getLocalControllerSingleton()->getControllableEntity();
+ assert(ce);
+
+ Ogre::RenderWindow* w = GraphicsManager::getInstance().getRenderWindow();
+
+
+
+ switch (iterateOverDirections_)
+ {
+ case 0 :
+ CommandExecutor::execute("pause");
+ //w->writeContentsToFile(skyboxPrefix_+"FR.png");
+ w->writeContentsToFile(skyboxPrefix_+"0.png");
+ ce->yaw(Degree(90));
+ iterateOverDirections_++;
+ break;
+
+ case 1 :
+ //w->writeContentsToFile(skyboxPrefix_+"LF.png");
+ w->writeContentsToFile(skyboxPrefix_+"1.png");
+ ce->yaw(Degree(90));
+ iterateOverDirections_++;
+ break;
+
+ case 2 :
+ //w->writeContentsToFile(skyboxPrefix_+"BK.png");
+ w->writeContentsToFile(skyboxPrefix_+"2.png");
+ ce->yaw(Degree(90));
+ iterateOverDirections_++;
+ break;
+
+ case 3 :
+ //w->writeContentsToFile(skyboxPrefix_+"RT.png");
+ w->writeContentsToFile(skyboxPrefix_+"3.png");
+ ce->yaw(Degree(90));
+ ce->pitch(Degree(90));
+ iterateOverDirections_++;
+ break;
+
+ case 4 :
+ //w->writeContentsToFile(skyboxPrefix_+"UP.png");
+ w->writeContentsToFile(skyboxPrefix_+"4.png");
+ ce->pitch(Degree(180));
+ iterateOverDirections_++;
+ break;
+
+ case 5 :
+ //w->writeContentsToFile(skyboxPrefix_+"DN.png");
+ w->writeContentsToFile(skyboxPrefix_+"5.png");
+ ce->pitch(Degree(90));
+ iterateOverDirections_ =0;
+ takeScreenshot_ = false;
+ CommandExecutor::execute("pause");
+
+ }
+ }
+ }
void SkyboxGenerator::createSkybox( )
{
- //SkyboxGenerator* sbg = SkyboxGenerator::getInstancePtr();
- //sbg->skyboxPrefix_;
- /*unsigned int indice = 1;
- char filename[30];
- char fn[1];
- // generate new names...
- //sprintf(filename, "screenshot_%d.png", ++indice);
- //sprintf(filename, fn, ++indice);
- */
+ SkyboxGenerator::getInstance().takeScreenshot_ = true;
+
- /*
- if(stopper == 1){
- //sprintf(filename, "stevecube_FR.bmp");
- mWindow->writeContentsToFile("MySky_FR.bmp");
- }
- else if(stopper == 2){
- //sprintf(filename, "stevecube_LF.bmp");
- cam->pitch(Ogre::Degree(90));
- mWindow->writeContentsToFile("MySky_LF.bmp");
- }
- else if(stopper == 3){
- //sprintf(filename, "stevecube_BK.bmp");
- cam->pitch(Ogre::Degree(90));
- mWindow->writeContentsToFile("MySky_BK.bmp");
- }
- else if(stopper == 4){
- //sprintf(filename, "stevecube_RT.bmp");
- cam->pitch(Ogre::Degree(90));
- mWindow->writeContentsToFile("MySky_RT.bmp");
- }
- else if(stopper == 5){
- //sprintf(filename, "stevecube_UP.bmp");
- cam->yaw(Ogre::Degree(90));
- mWindow->writeContentsToFile("MySky_UP.bmp");
- }
- else if(stopper == 6){
- cam->yaw(Ogre::Degree(-90));
- mWindow->writeContentsToFile("MySky_DN.bmp");
- }
-
- stopper+=1;
- if(stopper >= 7)
- stopper = 1;
- */
+
}
}
Modified: code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h
===================================================================
--- code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h 2010-04-01 13:34:02 UTC (rev 6672)
+++ code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h 2010-04-01 14:20:47 UTC (rev 6673)
@@ -29,23 +29,27 @@
#include "core/OrxonoxClass.h"
#include "util/Singleton.h"
+#include "tools/interfaces/Tickable.h"
namespace orxonox
{
- class SkyboxGenerator : public virtual OrxonoxClass, public Singleton<SkyboxGenerator>
+ class SkyboxGenerator : public virtual OrxonoxClass, public Singleton<SkyboxGenerator>, public Tickable
{
friend class Singleton<SkyboxGenerator>;
public:
SkyboxGenerator();
virtual ~SkyboxGenerator();
- void createSkybox( );
+ static void createSkybox( );
void setConfigValues( );
+ void tick(float dt);
private:
static SkyboxGenerator* singletonPtr_s;
- std::string skyboxPrefix_;
+ std::string skyboxPrefix_;
+ bool takeScreenshot_;
+ int iterateOverDirections_;
};
}
Modified: code/branches/skybox2/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/skybox2/src/orxonox/worldentities/ControllableEntity.h 2010-04-01 13:34:02 UTC (rev 6672)
+++ code/branches/skybox2/src/orxonox/worldentities/ControllableEntity.h 2010-04-01 14:20:47 UTC (rev 6673)
@@ -136,6 +136,8 @@
{ return this->bMouseLook_; }
inline float getMouseLookSpeed() const
{ return this->mouseLookSpeed_; }
+ inline CameraPosition* getCurrentCameraPosition()
+ { return this->currentCameraPosition_; }
inline Controller* getXMLController() const
{ return this->xmlcontroller_; }
More information about the Orxonox-commit
mailing list