mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 15:39:42 +00:00
Merge remote branch 'swick/mwrender' into mwrender
Conflicts: apps/openmw/mwworld/world.cpp
This commit is contained in:
commit
705e11becb
8 changed files with 148 additions and 23 deletions
|
@ -520,3 +520,4 @@ void OMW::Engine::setEncoding(const std::string& encoding)
|
||||||
{
|
{
|
||||||
mEncoding = encoding;
|
mEncoding = encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ int ExteriorCellRender::uniqueID = 0;
|
||||||
|
|
||||||
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
MWScene &_scene, MWWorld::PhysicsSystem *physics)
|
MWScene &_scene, MWWorld::PhysicsSystem *physics)
|
||||||
: mCell(_cell), mEnvironment (environment), mScene(_scene), mBase(NULL), mInsert(NULL), mAmbientMode (0), mPhysics(physics)
|
: mCell(_cell), mEnvironment (environment), mScene(_scene), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
||||||
{
|
{
|
||||||
uniqueID = uniqueID +1;
|
uniqueID = uniqueID +1;
|
||||||
sg = mScene.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
sg = mScene.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||||
|
@ -350,6 +350,7 @@ void ExteriorCellRender::setAmbientMode()
|
||||||
|
|
||||||
void ExteriorCellRender::show()
|
void ExteriorCellRender::show()
|
||||||
{
|
{
|
||||||
|
// FIXME: this one may be the bug
|
||||||
mBase = mScene.getRoot()->createChildSceneNode();
|
mBase = mScene.getRoot()->createChildSceneNode();
|
||||||
|
|
||||||
configureAmbient();
|
configureAmbient();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,41 @@
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
#include "environment.hpp"
|
#include "environment.hpp"
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
#include "class.hpp"
|
||||||
|
|
||||||
#include "doingphysics.hpp"
|
#include "doingphysics.hpp"
|
||||||
#include "cellfunctors.hpp"
|
#include "cellfunctors.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void insertCellRefList (T& cellRefList, ESMS::CellStore<MWWorld::RefData> &cell)
|
||||||
|
{
|
||||||
|
if (!cellRefList.list.empty())
|
||||||
|
{
|
||||||
|
//const MWWorld::Class& class_ = MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.list.begin(), &cell));
|
||||||
|
|
||||||
|
for (typename T::List::iterator it = cellRefList.list.begin();
|
||||||
|
it != cellRefList.list.end(); it++)
|
||||||
|
{
|
||||||
|
if (it->mData.getCount() || it->mData.isEnabled())
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr (&*it, &cell);
|
||||||
|
/* TODO: call
|
||||||
|
* RenderingManager.insertObject
|
||||||
|
* class_.insertObjectPhysic
|
||||||
|
* class_.insertObjectMechanics
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -69,7 +99,6 @@ namespace MWWorld
|
||||||
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
|
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
|
||||||
{
|
{
|
||||||
SuppressDoingPhysics scopeGuard;
|
SuppressDoingPhysics scopeGuard;
|
||||||
|
|
||||||
// remove active
|
// remove active
|
||||||
mEnvironment.mMechanicsManager->removeActor (mWorld->getPlayer().getPlayer());
|
mEnvironment.mMechanicsManager->removeActor (mWorld->getPlayer().getPlayer());
|
||||||
|
|
||||||
|
@ -216,4 +245,37 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
mCellChanged = false;
|
mCellChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*#include <cassert>
|
||||||
|
#include <iostream>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/ptr.hpp"*/
|
||||||
|
|
||||||
|
void Scene::insertCell(ESMS::CellStore<MWWorld::RefData> &cell)
|
||||||
|
{
|
||||||
|
// Loop through all references in the cell
|
||||||
|
insertCellRefList (cell.activators, cell);
|
||||||
|
insertCellRefList (cell.potions, cell);
|
||||||
|
insertCellRefList (cell.appas, cell);
|
||||||
|
insertCellRefList (cell.armors, cell);
|
||||||
|
insertCellRefList (cell.books, cell);
|
||||||
|
insertCellRefList (cell.clothes, cell);
|
||||||
|
insertCellRefList (cell.containers, cell);
|
||||||
|
insertCellRefList (cell.creatures, cell);
|
||||||
|
insertCellRefList (cell.doors, cell);
|
||||||
|
insertCellRefList (cell.ingreds, cell);
|
||||||
|
insertCellRefList (cell.creatureLists, cell);
|
||||||
|
insertCellRefList (cell.itemLists, cell);
|
||||||
|
insertCellRefList (cell.lights, cell);
|
||||||
|
insertCellRefList (cell.lockpicks, cell);
|
||||||
|
insertCellRefList (cell.miscItems, cell);
|
||||||
|
insertCellRefList (cell.npcs, cell);
|
||||||
|
insertCellRefList (cell.probes, cell);
|
||||||
|
insertCellRefList (cell.repairs, cell);
|
||||||
|
insertCellRefList (cell.statics, cell);
|
||||||
|
insertCellRefList (cell.weapons, cell);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,8 @@ namespace MWWorld
|
||||||
void markCellAsUnchanged();
|
void markCellAsUnchanged();
|
||||||
|
|
||||||
std::string getFacedHandle();
|
std::string getFacedHandle();
|
||||||
|
|
||||||
|
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,18 +307,17 @@ 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 mWorldScene;
|
delete mWorldScene;
|
||||||
delete mSkyManager;
|
|
||||||
delete mGlobalVariables;
|
delete mGlobalVariables;
|
||||||
delete mPlayer;
|
delete mPlayer;
|
||||||
delete mPhysics;
|
delete mPhysics;
|
||||||
|
@ -499,7 +498,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 +533,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 +554,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 +562,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