Merge remote branch 'swick/mwrender' into mwrender

Conflicts:
	apps/openmw/mwworld/world.cpp
actorid
Marc Zinnschlag 14 years ago
commit 705e11becb

@ -519,4 +519,5 @@ void OMW::Engine::setCompileAll (bool all)
void OMW::Engine::setEncoding(const std::string& encoding)
{
mEncoding = encoding;
}
}

@ -35,7 +35,7 @@ int ExteriorCellRender::uniqueID = 0;
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
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;
sg = mScene.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
@ -350,13 +350,14 @@ void ExteriorCellRender::setAmbientMode()
void ExteriorCellRender::show()
{
// FIXME: this one may be the bug
mBase = mScene.getRoot()->createChildSceneNode();
configureAmbient();
configureFog();
insertCell(mCell, mEnvironment);
sg->build();
}

@ -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
#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;
};

@ -11,11 +11,41 @@
#include "ptr.hpp"
#include "environment.hpp"
#include "player.hpp"
#include "class.hpp"
#include "doingphysics.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
{
@ -69,7 +99,6 @@ namespace MWWorld
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
{
SuppressDoingPhysics scopeGuard;
// remove active
mEnvironment.mMechanicsManager->removeActor (mWorld->getPlayer().getPlayer());
@ -216,4 +245,37 @@ namespace MWWorld
{
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();
std::string getFacedHandle();
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell);
};
}

@ -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,18 +307,17 @@ 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 mWorldScene;
delete mSkyManager;
delete mGlobalVariables;
delete mPlayer;
delete mPhysics;
@ -499,7 +498,7 @@ namespace MWWorld
mGlobalVariables->setFloat ("gamehour", hour);
mSkyManager->setHour (hour);
mRenderingManager->skySetHour (hour);
if (days>0)
setDay (days + mGlobalVariables->getInt ("day"));
@ -534,7 +533,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 +554,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 +562,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…
Cancel
Save