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