forked from teamnwah/openmw-tes3coop
moved skyManager into RenderingManager
This commit is contained in:
parent
54724d7e7f
commit
b7dbfb849a
4 changed files with 78 additions and 18 deletions
|
@ -1 +1,52 @@
|
||||||
#include "rendering_manager.hpp"
|
#include "rendering_manager.hpp"
|
||||||
|
|
||||||
|
namespace MWRender {
|
||||||
|
|
||||||
|
RenderingManager::RenderingManager (SkyManager *skyManager) :
|
||||||
|
mSkyManager(skyManager)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderingManager::~RenderingManager ()
|
||||||
|
{
|
||||||
|
delete mSkyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingManager::skyEnable ()
|
||||||
|
{
|
||||||
|
mSkyManager->enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingManager::skyDisable ()
|
||||||
|
{
|
||||||
|
mSkyManager->disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingManager::skySetHour (double hour)
|
||||||
|
{
|
||||||
|
mSkyManager->setHour(hour);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RenderingManager::skySetDate (int day, int month)
|
||||||
|
{
|
||||||
|
mSkyManager->setDate(day, month);
|
||||||
|
}
|
||||||
|
|
||||||
|
int RenderingManager::skyGetMasserPhase() const
|
||||||
|
{
|
||||||
|
return mSkyManager->getMasserPhase();
|
||||||
|
}
|
||||||
|
|
||||||
|
int RenderingManager::skyGetSecundaPhase() const
|
||||||
|
{
|
||||||
|
return mSkyManager->getSecundaPhase();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingManager::skySetMoonColour (bool red)
|
||||||
|
{
|
||||||
|
mSkyManager->setMoonColour(red);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef _GAME_RENDERING_MANAGER_H
|
#ifndef _GAME_RENDERING_MANAGER_H
|
||||||
#define _GAME_RENDERING_MANAGER_H
|
#define _GAME_RENDERING_MANAGER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "sky.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include <openengine/ogre/renderer.hpp>
|
#include <openengine/ogre/renderer.hpp>
|
||||||
#include <openengine/bullet/physic.hpp>
|
#include <openengine/bullet/physic.hpp>
|
||||||
|
@ -10,6 +13,8 @@ namespace MWRender
|
||||||
|
|
||||||
class RenderingManager {
|
class RenderingManager {
|
||||||
public:
|
public:
|
||||||
|
RenderingManager(SkyManager *skyManager);
|
||||||
|
~RenderingManager();
|
||||||
|
|
||||||
void removeCell (MWWorld::Ptr::CellStore *store); // TODO do we want this?
|
void removeCell (MWWorld::Ptr::CellStore *store); // TODO do we want this?
|
||||||
|
|
||||||
|
@ -25,6 +30,7 @@ class RenderingManager {
|
||||||
bool getPhysicsDebugRendering() const;
|
bool getPhysicsDebugRendering() const;
|
||||||
|
|
||||||
void update (float duration);
|
void update (float duration);
|
||||||
|
|
||||||
void skyEnable ();
|
void skyEnable ();
|
||||||
void skyDisable ();
|
void skyDisable ();
|
||||||
void skySetHour (double hour);
|
void skySetHour (double hour);
|
||||||
|
@ -35,6 +41,8 @@ class RenderingManager {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
SkyManager* mSkyManager;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace MWWorld
|
||||||
const Files::Collections& fileCollections,
|
const Files::Collections& fileCollections,
|
||||||
const std::string& master, const boost::filesystem::path& resDir,
|
const std::string& master, const boost::filesystem::path& resDir,
|
||||||
bool newGame, Environment& environment, const std::string& encoding)
|
bool newGame, Environment& environment, const std::string& encoding)
|
||||||
: mSkyManager (0), mScene (renderer,physEng), mPlayer (0), mGlobalVariables (0),
|
: mScene (renderer,physEng), mPlayer (0), mGlobalVariables (0),
|
||||||
mSky (false), mEnvironment (environment), mNextDynamicRecord (0)
|
mSky (false), mEnvironment (environment), mNextDynamicRecord (0)
|
||||||
{
|
{
|
||||||
mPhysEngine = physEng;
|
mPhysEngine = physEng;
|
||||||
|
@ -307,20 +307,20 @@ namespace MWWorld
|
||||||
mGlobalVariables->setInt ("chargenstate", 1);
|
mGlobalVariables->setInt ("chargenstate", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mSkyManager =
|
|
||||||
MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera(), resDir);
|
|
||||||
|
|
||||||
mPhysEngine = physEng;
|
mPhysEngine = physEng;
|
||||||
|
|
||||||
mWorldScene = new Scene(environment, this, mScene, mPhysics);
|
mWorldScene = new Scene(environment, this, mScene, mPhysics);
|
||||||
|
mRenderingManager = new MWRender::RenderingManager(
|
||||||
|
MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera(), resDir)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
World::~World()
|
World::~World()
|
||||||
{
|
{
|
||||||
delete mPlayer;
|
delete mPlayer;
|
||||||
delete mSkyManager;
|
delete mRenderingManager;
|
||||||
delete mGlobalVariables;
|
delete mGlobalVariables;
|
||||||
//delete mWorldScene;
|
//delete mWorldScene; // FIXME sagfault in malloc.h when not commented out
|
||||||
delete mPhysics;
|
delete mPhysics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ namespace MWWorld
|
||||||
|
|
||||||
mGlobalVariables->setFloat ("gamehour", hour);
|
mGlobalVariables->setFloat ("gamehour", hour);
|
||||||
|
|
||||||
mSkyManager->setHour (hour);
|
mRenderingManager->skySetHour (hour);
|
||||||
|
|
||||||
if (days>0)
|
if (days>0)
|
||||||
setDay (days + mGlobalVariables->getInt ("day"));
|
setDay (days + mGlobalVariables->getInt ("day"));
|
||||||
|
@ -534,7 +534,7 @@ namespace MWWorld
|
||||||
mGlobalVariables->setInt ("day", day);
|
mGlobalVariables->setInt ("day", day);
|
||||||
mGlobalVariables->setInt ("month", month);
|
mGlobalVariables->setInt ("month", month);
|
||||||
|
|
||||||
mSkyManager->setDate (day, month);
|
mRenderingManager->skySetDate (day, month);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setMonth (int month)
|
void World::setMonth (int month)
|
||||||
|
@ -555,7 +555,7 @@ namespace MWWorld
|
||||||
if (years>0)
|
if (years>0)
|
||||||
mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year"));
|
mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year"));
|
||||||
|
|
||||||
mSkyManager->setDate (mGlobalVariables->getInt ("day"), month);
|
mRenderingManager->skySetDate (mGlobalVariables->getInt ("day"), month);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::toggleSky()
|
bool World::toggleSky()
|
||||||
|
@ -563,34 +563,34 @@ namespace MWWorld
|
||||||
if (mSky)
|
if (mSky)
|
||||||
{
|
{
|
||||||
mSky = false;
|
mSky = false;
|
||||||
mSkyManager->disable();
|
mRenderingManager->skyDisable();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSky = true;
|
mSky = true;
|
||||||
// TODO check for extorior or interior with sky.
|
// TODO check for extorior or interior with sky.
|
||||||
mSkyManager->setHour (mGlobalVariables->getFloat ("gamehour"));
|
mRenderingManager->skySetHour (mGlobalVariables->getFloat ("gamehour"));
|
||||||
mSkyManager->setDate (mGlobalVariables->getInt ("day"),
|
mRenderingManager->skySetDate (mGlobalVariables->getInt ("day"),
|
||||||
mGlobalVariables->getInt ("month"));
|
mGlobalVariables->getInt ("month"));
|
||||||
mSkyManager->enable();
|
mRenderingManager->skyEnable();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getMasserPhase() const
|
int World::getMasserPhase() const
|
||||||
{
|
{
|
||||||
return mSkyManager->getMasserPhase();
|
return mRenderingManager->skyGetMasserPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getSecundaPhase() const
|
int World::getSecundaPhase() const
|
||||||
{
|
{
|
||||||
return mSkyManager->getSecundaPhase();
|
return mRenderingManager->skyGetSecundaPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setMoonColour (bool red)
|
void World::setMoonColour (bool red)
|
||||||
{
|
{
|
||||||
mSkyManager->setMoonColour (red);
|
mRenderingManager->skySetMoonColour (red);
|
||||||
}
|
}
|
||||||
|
|
||||||
float World::getTimeScaleFactor() const
|
float World::getTimeScaleFactor() const
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwrender/mwscene.hpp"
|
#include "../mwrender/mwscene.hpp"
|
||||||
|
#include "../mwrender/rendering_manager.hpp"
|
||||||
|
|
||||||
#include "refdata.hpp"
|
#include "refdata.hpp"
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
|
@ -66,7 +67,6 @@ namespace MWWorld
|
||||||
|
|
||||||
typedef std::map<Ptr::CellStore *, MWRender::CellRender *> CellRenderCollection;
|
typedef std::map<Ptr::CellStore *, MWRender::CellRender *> CellRenderCollection;
|
||||||
|
|
||||||
MWRender::SkyManager* mSkyManager;
|
|
||||||
MWRender::MWScene mScene;
|
MWRender::MWScene mScene;
|
||||||
MWWorld::Scene *mWorldScene;
|
MWWorld::Scene *mWorldScene;
|
||||||
MWWorld::Player *mPlayer;
|
MWWorld::Player *mPlayer;
|
||||||
|
@ -77,6 +77,7 @@ namespace MWWorld
|
||||||
MWWorld::PhysicsSystem *mPhysics;
|
MWWorld::PhysicsSystem *mPhysics;
|
||||||
bool mSky;
|
bool mSky;
|
||||||
Environment& mEnvironment;
|
Environment& mEnvironment;
|
||||||
|
MWRender::RenderingManager *mRenderingManager;
|
||||||
int mNextDynamicRecord;
|
int mNextDynamicRecord;
|
||||||
|
|
||||||
std::map<std::string, Ptr::CellStore> mInteriors;
|
std::map<std::string, Ptr::CellStore> mInteriors;
|
||||||
|
|
Loading…
Reference in a new issue