mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
Removal of MWScene; Object listing fixed
This commit is contained in:
parent
30ba9b74da
commit
6efc61b9df
13 changed files with 100 additions and 195 deletions
|
@ -68,6 +68,7 @@ void OMW::Engine::executeLocalScripts()
|
|||
|
||||
void OMW::Engine::updateFocusReport (float duration)
|
||||
{
|
||||
|
||||
if ((mFocusTDiff += duration)>0.25)
|
||||
{
|
||||
mFocusTDiff = 0;
|
||||
|
@ -80,8 +81,12 @@ void OMW::Engine::updateFocusReport (float duration)
|
|||
{
|
||||
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
if (!ptr.isEmpty()){
|
||||
name = MWWorld::Class::get (ptr).getName (ptr);
|
||||
if (!name.empty())
|
||||
std::cout << "Object: " << name << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (name!=mFocusName)
|
||||
|
@ -284,6 +289,8 @@ void OMW::Engine::setReportFocus (bool report)
|
|||
|
||||
void OMW::Engine::go()
|
||||
{
|
||||
mFocusTDiff = 0;
|
||||
mReportFocus = true;
|
||||
assert (!mEnvironment.mWorld);
|
||||
assert (!mCellName.empty());
|
||||
assert (!mMaster.empty());
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "exterior.hpp"
|
||||
#include "renderingmanager.hpp"
|
||||
|
||||
#include <OgreEntity.h>
|
||||
#include <OgreLight.h>
|
||||
|
@ -34,11 +35,11 @@ bool ExteriorCellRender::lightOutQuadInLin = false;
|
|||
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), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
||||
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics)
|
||||
: mCell(_cell), mEnvironment (environment), mRendering(_rendering), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
||||
{
|
||||
uniqueID = uniqueID +1;
|
||||
sg = mScene.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||
sg = mRendering.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,7 +127,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
|||
mNpcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
||||
|
||||
MovableObject *ent = mScene.getMgr()->createEntity(mesh);
|
||||
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
||||
|
||||
|
||||
if(translateFirst){
|
||||
|
@ -214,7 +215,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
|||
assert (mInsert);
|
||||
|
||||
NifOgre::NIFLoader::load(mesh);
|
||||
Entity *ent = mScene.getMgr()->createEntity(mesh);
|
||||
Entity *ent = mRendering.getMgr()->createEntity(mesh);
|
||||
|
||||
if(!isStatic)
|
||||
{
|
||||
|
@ -224,7 +225,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
|||
{
|
||||
sg->addEntity(ent,mInsert->_getDerivedPosition(),mInsert->_getDerivedOrientation(),mInsert->_getDerivedScale());
|
||||
sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000));
|
||||
mScene.getMgr()->destroyEntity(ent);
|
||||
mRendering.getMgr()->destroyEntity(ent);
|
||||
}
|
||||
if (mInsertMesh.empty())
|
||||
mInsertMesh = mesh;
|
||||
|
@ -249,7 +250,7 @@ void ExteriorCellRender::insertLight(float r, float g, float b, float radius)
|
|||
{
|
||||
assert (mInsert);
|
||||
|
||||
Ogre::Light *light = mScene.getMgr()->createLight();
|
||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
||||
light->setDiffuseColour (r, g, b);
|
||||
|
||||
float cval=0.0f, lval=0.0f, qval=0.0f;
|
||||
|
@ -305,7 +306,7 @@ void ExteriorCellRender::configureAmbient()
|
|||
|
||||
// Create a "sun" that shines light downwards. It doesn't look
|
||||
// completely right, but leave it for now.
|
||||
Ogre::Light *light = mScene.getMgr()->createLight();
|
||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
||||
Ogre::ColourValue colour;
|
||||
colour.setAsABGR (mCell.cell->ambi.sunlight);
|
||||
light->setDiffuseColour (colour);
|
||||
|
@ -322,9 +323,9 @@ void ExteriorCellRender::configureFog()
|
|||
float high = 4500 + 9000 * (1-mCell.cell->ambi.fogDensity);
|
||||
float low = 200;
|
||||
|
||||
mScene.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||
mScene.getCamera()->setFarClipDistance (high + 10);
|
||||
mScene.getViewport()->setBackgroundColour (color);
|
||||
mRendering.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||
mRendering.getCamera()->setFarClipDistance (high + 10);
|
||||
mRendering.getViewport()->setBackgroundColour (color);
|
||||
}
|
||||
|
||||
void ExteriorCellRender::setAmbientMode()
|
||||
|
@ -333,17 +334,17 @@ void ExteriorCellRender::setAmbientMode()
|
|||
{
|
||||
case 0:
|
||||
|
||||
mScene.getMgr()->setAmbientLight(mAmbientColor);
|
||||
mRendering.getMgr()->setAmbientLight(mAmbientColor);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
mScene.getMgr()->setAmbientLight(0.7f*mAmbientColor + 0.3f*ColourValue(1,1,1));
|
||||
mRendering.getMgr()->setAmbientLight(0.7f*mAmbientColor + 0.3f*ColourValue(1,1,1));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
mScene.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
||||
mRendering.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +352,7 @@ void ExteriorCellRender::setAmbientMode()
|
|||
void ExteriorCellRender::show()
|
||||
{
|
||||
// FIXME: this one may be the bug
|
||||
mBase = mScene.getRoot()->createChildSceneNode();
|
||||
mBase = mRendering.getRoot()->createChildSceneNode();
|
||||
|
||||
configureAmbient();
|
||||
configureFog();
|
||||
|
@ -400,14 +401,14 @@ void ExteriorCellRender::destroy()
|
|||
{
|
||||
destroyAllAttachedMovableObjects(mBase);
|
||||
mBase->removeAndDestroyAllChildren();
|
||||
mScene.getMgr()->destroySceneNode(mBase);
|
||||
mRendering.getMgr()->destroySceneNode(mBase);
|
||||
}
|
||||
|
||||
mBase = 0;
|
||||
|
||||
if (sg)
|
||||
{
|
||||
mScene.getMgr()->destroyStaticGeometry (sg);
|
||||
mRendering.getMgr()->destroyStaticGeometry (sg);
|
||||
sg = 0;
|
||||
}
|
||||
}
|
||||
|
@ -434,21 +435,21 @@ void ExteriorCellRender::toggleLight()
|
|||
void ExteriorCellRender::enable (const std::string& handle)
|
||||
{
|
||||
if (!handle.empty())
|
||||
mScene.getMgr()->getSceneNode (handle)->setVisible (true);
|
||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (true);
|
||||
}
|
||||
|
||||
void ExteriorCellRender::disable (const std::string& handle)
|
||||
{
|
||||
if (!handle.empty())
|
||||
mScene.getMgr()->getSceneNode (handle)->setVisible (false);
|
||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (false);
|
||||
}
|
||||
|
||||
void ExteriorCellRender::deleteObject (const std::string& handle)
|
||||
{
|
||||
if (!handle.empty())
|
||||
{
|
||||
Ogre::SceneNode *node = mScene.getMgr()->getSceneNode (handle);
|
||||
Ogre::SceneNode *node = mRendering.getMgr()->getSceneNode (handle);
|
||||
node->removeAndDestroyAllChildren();
|
||||
mScene.getMgr()->destroySceneNode (node);
|
||||
mRendering.getMgr()->destroySceneNode (node);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace MWWorld
|
|||
|
||||
namespace MWRender
|
||||
{
|
||||
class MWScene;
|
||||
class RenderingManager;
|
||||
|
||||
/**
|
||||
This class is responsible for inserting meshes and other
|
||||
|
@ -49,7 +49,7 @@ namespace MWRender
|
|||
|
||||
ESMS::CellStore<MWWorld::RefData> &mCell;
|
||||
MWWorld::Environment &mEnvironment;
|
||||
MWScene &mScene;
|
||||
RenderingManager &mRendering;
|
||||
MWWorld::PhysicsSystem *mPhysics;
|
||||
|
||||
/// The scene node that contains all objects belonging to this
|
||||
|
@ -103,7 +103,7 @@ namespace MWRender
|
|||
public:
|
||||
|
||||
ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||
MWScene &_scene, MWWorld::PhysicsSystem *physics);
|
||||
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics);
|
||||
|
||||
virtual ~ExteriorCellRender() { destroy(); }
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "interior.hpp"
|
||||
#include "renderingmanager.hpp"
|
||||
|
||||
#include <OgreEntity.h>
|
||||
#include <OgreLight.h>
|
||||
|
@ -108,7 +109,7 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
|||
|
||||
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
||||
|
||||
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
||||
//ent->extr
|
||||
|
||||
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
|
||||
|
@ -185,7 +186,7 @@ void InteriorCellRender::insertMesh(const std::string &mesh)
|
|||
assert (insert);
|
||||
|
||||
NifOgre::NIFLoader::load(mesh);
|
||||
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
||||
insert->attachObject(ent);
|
||||
|
||||
if (mInsertMesh.empty())
|
||||
|
@ -211,7 +212,7 @@ void InteriorCellRender::insertLight(float r, float g, float b, float radius)
|
|||
{
|
||||
assert (insert);
|
||||
|
||||
Ogre::Light *light = scene.getMgr()->createLight();
|
||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
||||
light->setDiffuseColour (r, g, b);
|
||||
|
||||
float cval=0.0f, lval=0.0f, qval=0.0f;
|
||||
|
@ -267,7 +268,7 @@ void InteriorCellRender::configureAmbient()
|
|||
|
||||
// Create a "sun" that shines light downwards. It doesn't look
|
||||
// completely right, but leave it for now.
|
||||
Ogre::Light *light = scene.getMgr()->createLight();
|
||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
||||
Ogre::ColourValue colour;
|
||||
colour.setAsABGR (cell.cell->ambi.sunlight);
|
||||
light->setDiffuseColour (colour);
|
||||
|
@ -284,9 +285,9 @@ void InteriorCellRender::configureFog()
|
|||
float high = 4500 + 9000 * (1-cell.cell->ambi.fogDensity);
|
||||
float low = 200;
|
||||
|
||||
scene.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||
scene.getCamera()->setFarClipDistance (high + 10);
|
||||
scene.getViewport()->setBackgroundColour (color);
|
||||
mRendering.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||
mRendering.getCamera()->setFarClipDistance (high + 10);
|
||||
mRendering.getViewport()->setBackgroundColour (color);
|
||||
}
|
||||
|
||||
void InteriorCellRender::setAmbientMode()
|
||||
|
@ -295,24 +296,24 @@ void InteriorCellRender::setAmbientMode()
|
|||
{
|
||||
case 0:
|
||||
|
||||
scene.getMgr()->setAmbientLight(ambientColor);
|
||||
mRendering.getMgr()->setAmbientLight(ambientColor);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
scene.getMgr()->setAmbientLight(0.7f*ambientColor + 0.3f*ColourValue(1,1,1));
|
||||
mRendering.getMgr()->setAmbientLight(0.7f*ambientColor + 0.3f*ColourValue(1,1,1));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
scene.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
||||
mRendering.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void InteriorCellRender::show()
|
||||
{
|
||||
base = scene.getRoot()->createChildSceneNode();
|
||||
base = mRendering.getRoot()->createChildSceneNode();
|
||||
|
||||
configureAmbient();
|
||||
configureFog();
|
||||
|
@ -331,7 +332,7 @@ void InteriorCellRender::destroy()
|
|||
if(base)
|
||||
{
|
||||
base->removeAndDestroyAllChildren();
|
||||
scene.getMgr()->destroySceneNode(base);
|
||||
mRendering.getMgr()->destroySceneNode(base);
|
||||
}
|
||||
|
||||
base = NULL;
|
||||
|
@ -359,22 +360,22 @@ void InteriorCellRender::toggleLight()
|
|||
void InteriorCellRender::enable (const std::string& handle)
|
||||
{
|
||||
if (!handle.empty())
|
||||
scene.getMgr()->getSceneNode (handle)->setVisible (true);
|
||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (true);
|
||||
}
|
||||
|
||||
void InteriorCellRender::disable (const std::string& handle)
|
||||
{
|
||||
if (!handle.empty())
|
||||
scene.getMgr()->getSceneNode (handle)->setVisible (false);
|
||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (false);
|
||||
}
|
||||
|
||||
void InteriorCellRender::deleteObject (const std::string& handle)
|
||||
{
|
||||
if (!handle.empty())
|
||||
{
|
||||
Ogre::SceneNode *node = scene.getMgr()->getSceneNode (handle);
|
||||
Ogre::SceneNode *node = mRendering.getMgr()->getSceneNode (handle);
|
||||
node->removeAndDestroyAllChildren();
|
||||
scene.getMgr()->destroySceneNode (node);
|
||||
mRendering.getMgr()->destroySceneNode (node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace MWWorld
|
|||
|
||||
namespace MWRender
|
||||
{
|
||||
class MWScene;
|
||||
class RenderingManager;
|
||||
|
||||
/**
|
||||
This class is responsible for inserting meshes and other
|
||||
|
@ -48,7 +48,7 @@ namespace MWRender
|
|||
|
||||
ESMS::CellStore<MWWorld::RefData> &cell;
|
||||
MWWorld::Environment &mEnvironment;
|
||||
MWScene &scene;
|
||||
MWRender::RenderingManager &mRendering;
|
||||
MWWorld::PhysicsSystem *mPhysics;
|
||||
|
||||
/// The scene node that contains all objects belonging to this
|
||||
|
@ -95,8 +95,8 @@ namespace MWRender
|
|||
public:
|
||||
|
||||
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||
MWScene &_scene, MWWorld::PhysicsSystem *physics)
|
||||
: cell(_cell), mEnvironment (environment), scene(_scene), base(NULL), insert(NULL), ambientMode (0)
|
||||
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics)
|
||||
: cell(_cell), mEnvironment (environment), mRendering(_rendering), base(NULL), insert(NULL), ambientMode (0)
|
||||
{
|
||||
mPhysics = physics;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ Debugging::Debugging(OEngine::Physic::PhysicEngine* engine){
|
|||
eng = engine;
|
||||
}
|
||||
|
||||
|
||||
bool Debugging::toggleRenderMode (int mode){
|
||||
switch (mode)
|
||||
{
|
||||
|
@ -35,73 +36,3 @@ bool Debugging::toggleRenderMode (int mode){
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
MWScene::MWScene(OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng)
|
||||
: rend(_rend)
|
||||
{
|
||||
eng = physEng;
|
||||
rend.createScene("PlayerCam", 55, 5);
|
||||
|
||||
// Set default mipmap level (NB some APIs ignore this)
|
||||
TextureManager::getSingleton().setDefaultNumMipmaps(5);
|
||||
|
||||
// Load resources
|
||||
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
|
||||
|
||||
// Turn the entire scene (represented by the 'root' node) -90
|
||||
// degrees around the x axis. This makes Z go upwards, and Y go into
|
||||
// the screen (when x is to the right.) This is the orientation that
|
||||
// Morrowind uses, and it automagically makes everything work as it
|
||||
// should.
|
||||
SceneNode *rt = rend.getScene()->getRootSceneNode();
|
||||
mwRoot = rt->createChildSceneNode();
|
||||
mwRoot->pitch(Degree(-90));
|
||||
|
||||
//used to obtain ingame information of ogre objects (which are faced or selected)
|
||||
mRaySceneQuery = rend.getScene()->createRayQuery(Ray());
|
||||
|
||||
Ogre::SceneNode *playerNode = mwRoot->createChildSceneNode ("player");
|
||||
playerNode->pitch(Degree(90));
|
||||
Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode();
|
||||
Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode();
|
||||
cameraPitchNode->attachObject(getCamera());
|
||||
|
||||
|
||||
mPlayer = new MWRender::Player (getCamera(), playerNode->getName());
|
||||
}
|
||||
|
||||
MWScene::~MWScene()
|
||||
{
|
||||
delete mPlayer;
|
||||
}
|
||||
|
||||
std::pair<std::string, float> MWScene::getFacedHandle (MWWorld::World& world)
|
||||
{
|
||||
std::string handle = "";
|
||||
|
||||
//get a ray pointing to the center of the viewport
|
||||
Ray centerRay = getCamera()->getCameraToViewportRay(
|
||||
getViewport()->getWidth()/2,
|
||||
getViewport()->getHeight()/2);
|
||||
//let's avoid the capsule shape of the player.
|
||||
centerRay.setOrigin(centerRay.getOrigin() + 20*centerRay.getDirection());
|
||||
btVector3 from(centerRay.getOrigin().x,-centerRay.getOrigin().z,centerRay.getOrigin().y);
|
||||
btVector3 to(centerRay.getPoint(500).x,-centerRay.getPoint(500).z,centerRay.getPoint(500).y);
|
||||
|
||||
return eng->rayTest(from,to);
|
||||
}
|
||||
|
||||
bool MWScene::toggleRenderMode (int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case MWWorld::World::Render_CollisionDebug:
|
||||
|
||||
// TODO use a proper function instead of accessing the member variable
|
||||
// directly.
|
||||
eng->setDebugRenderingMode (!eng->isDebugCreated);
|
||||
return eng->isDebugCreated;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,47 +37,7 @@ namespace MWRender
|
|||
bool toggleRenderMode (int mode);
|
||||
};
|
||||
|
||||
/// \brief 3D-scene (rendering and physics)
|
||||
|
||||
class MWScene
|
||||
{
|
||||
OEngine::Render::OgreRenderer &rend;
|
||||
|
||||
/// Root node for all objects added to the scene. This is rotated so
|
||||
/// that the OGRE coordinate system matches that used internally in
|
||||
/// Morrowind.
|
||||
Ogre::SceneNode *mwRoot;
|
||||
Ogre::RaySceneQuery *mRaySceneQuery;
|
||||
|
||||
OEngine::Physic::PhysicEngine* eng;
|
||||
|
||||
MWRender::Player *mPlayer;
|
||||
|
||||
public:
|
||||
|
||||
MWScene (OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng);
|
||||
|
||||
~MWScene();
|
||||
|
||||
Ogre::Camera *getCamera() { return rend.getCamera(); }
|
||||
Ogre::SceneNode *getRoot() { return mwRoot; }
|
||||
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
||||
Ogre::Viewport *getViewport() { return rend.getViewport(); }
|
||||
Ogre::RaySceneQuery *getRaySceneQuery() { return mRaySceneQuery; }
|
||||
MWRender::Player *getPlayer() { return mPlayer; }
|
||||
|
||||
/// Gets the handle of the object the player is looking at
|
||||
/// pair<name, distance>
|
||||
/// name is empty and distance = -1 if there is no object which
|
||||
/// can be faced
|
||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||
|
||||
/// Toggle render mode
|
||||
/// \todo Using an int instead of a enum here to avoid cyclic includes. Will be fixed
|
||||
/// when the mw*-refactoring is done.
|
||||
/// \return Resulting mode
|
||||
bool toggleRenderMode (int mode);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,13 +22,14 @@ namespace MWRender {
|
|||
|
||||
|
||||
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem2::path& resDir) :rend(_rend)
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir) :rend(_rend)
|
||||
{
|
||||
camera = rend.getCamera();
|
||||
mSkyManager = MWRender::SkyManager::create(rend.getWindow(), camera, resDir);
|
||||
|
||||
|
||||
|
||||
//std::cout << "ONE";
|
||||
rend.createScene("PlayerCam", 55, 5);
|
||||
mSkyManager = MWRender::SkyManager::create(rend.getWindow(), getCamera(), resDir);
|
||||
|
||||
// Set default mipmap level (NB some APIs ignore this)
|
||||
TextureManager::getSingleton().setDefaultNumMipmaps(5);
|
||||
|
@ -41,7 +42,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
// the screen (when x is to the right.) This is the orientation that
|
||||
// Morrowind uses, and it automagically makes everything work as it
|
||||
// should.
|
||||
|
||||
//std::cout << "TWO";
|
||||
SceneNode *rt = rend.getScene()->getRootSceneNode();
|
||||
mwRoot = rt->createChildSceneNode();
|
||||
mwRoot->pitch(Degree(-90));
|
||||
|
@ -53,16 +54,17 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
playerNode->pitch(Degree(90));
|
||||
Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode();
|
||||
Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode();
|
||||
cameraPitchNode->attachObject(camera);
|
||||
|
||||
|
||||
mPlayer = new MWRender::Player (camera, playerNode->getName());
|
||||
cameraPitchNode->attachObject(getCamera());
|
||||
std::cout <<"TWOF\n";
|
||||
|
||||
mPlayer = new MWRender::Player (getCamera(), playerNode->getName());
|
||||
//std::cout << "Three";
|
||||
|
||||
}
|
||||
|
||||
RenderingManager::~RenderingManager ()
|
||||
{
|
||||
delete mPlayer;
|
||||
delete mSkyManager;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class RenderingManager {
|
|||
MWRender::Player *mPlayer;
|
||||
|
||||
public:
|
||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem2::path& resDir);
|
||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir);
|
||||
~RenderingManager();
|
||||
|
||||
void removeCell (MWWorld::Ptr::CellStore *store); // TODO do we want this?
|
||||
|
@ -77,7 +77,11 @@ class RenderingManager {
|
|||
int skyGetMasserPhase() const;
|
||||
int skyGetSecundaPhase() const;
|
||||
void skySetMoonColour (bool red);
|
||||
|
||||
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
||||
Ogre::Camera *getCamera() { return rend.getCamera(); }
|
||||
Ogre::Viewport *getViewport() { return rend.getViewport(); }
|
||||
Ogre::SceneNode *getRoot() { return mwRoot; }
|
||||
MWRender::Player *getPlayer() { return mPlayer; }
|
||||
private:
|
||||
|
||||
SkyManager* mSkyManager;
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace MWWorld
|
|||
{
|
||||
Ptr::CellStore *cell = mWorld->getExterior(x, y);
|
||||
|
||||
loadCell (cell, new MWRender::ExteriorCellRender (*cell, mEnvironment, mScene, mPhysics));
|
||||
loadCell (cell, new MWRender::ExteriorCellRender (*cell, mEnvironment, mRendering, mPhysics));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,8 +168,8 @@ namespace MWWorld
|
|||
mCellChanged = true;
|
||||
}
|
||||
|
||||
Scene::Scene (Environment& environment, World *world, MWRender::MWScene& scene, PhysicsSystem *physics)
|
||||
: mScene (scene), mCurrentCell (0),
|
||||
Scene::Scene (Environment& environment, World *world, MWRender::RenderingManager& rm, PhysicsSystem *physics)
|
||||
: mRendering(rm), mCurrentCell (0),
|
||||
mCellChanged (false), mEnvironment (environment), mWorld(world), mPhysics(physics)
|
||||
{
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ namespace MWWorld
|
|||
std::cout << "cellName:" << cellName << std::endl;
|
||||
Ptr::CellStore *cell = mWorld->getInterior(cellName);
|
||||
|
||||
loadCell (cell, new MWRender::InteriorCellRender (*cell, mEnvironment, mScene, mPhysics));
|
||||
loadCell (cell, new MWRender::InteriorCellRender (*cell, mEnvironment, mRendering, mPhysics));
|
||||
|
||||
// adjust player
|
||||
mCurrentCell = cell;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "refdata.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "globals.hpp"
|
||||
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
#include <openengine/bullet/physic.hpp>
|
||||
|
||||
namespace Ogre
|
||||
|
@ -57,7 +57,7 @@ namespace MWWorld
|
|||
|
||||
private:
|
||||
|
||||
MWRender::MWScene& mScene;
|
||||
MWRender::RenderingManager mRendering;
|
||||
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
||||
CellRenderCollection mActiveCells;
|
||||
bool mCellChanged;
|
||||
|
@ -69,7 +69,7 @@ namespace MWWorld
|
|||
bool adjustPlayerPos = true);
|
||||
public:
|
||||
|
||||
Scene (Environment& environment, World *world, MWRender::MWScene& scene, PhysicsSystem *physics);
|
||||
Scene (Environment& environment, World *world, MWRender::RenderingManager& rm, PhysicsSystem *physics);
|
||||
|
||||
~Scene();
|
||||
|
||||
|
|
|
@ -176,8 +176,8 @@ namespace MWWorld
|
|||
const Files::Collections& fileCollections,
|
||||
const std::string& master, const boost::filesystem::path& resDir,
|
||||
bool newGame, Environment& environment, const std::string& encoding)
|
||||
: mScene (renderer,physEng), mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this)
|
||||
: mRendering (renderer,resDir), mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this), mDebugging(physEng)
|
||||
{
|
||||
mPhysEngine = physEng;
|
||||
|
||||
|
@ -192,7 +192,7 @@ namespace MWWorld
|
|||
mEsm.open (masterPath.string());
|
||||
mStore.load (mEsm);
|
||||
|
||||
mPlayer = new MWWorld::Player (mScene.getPlayer(), mStore.npcs.find ("player"), *this);
|
||||
mPlayer = new MWWorld::Player (mRendering.getPlayer(), mStore.npcs.find ("player"), *this);
|
||||
mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0));
|
||||
|
||||
// global variables
|
||||
|
@ -206,9 +206,8 @@ namespace MWWorld
|
|||
|
||||
mPhysEngine = physEng;
|
||||
|
||||
mWorldScene = new Scene(environment, this, mScene, mPhysics);
|
||||
mRenderingManager = new MWRender::RenderingManager(renderer,
|
||||
resDir);
|
||||
mWorldScene = new Scene(environment, this, mRendering, mPhysics);
|
||||
|
||||
}
|
||||
|
||||
World::~World()
|
||||
|
@ -397,7 +396,7 @@ namespace MWWorld
|
|||
|
||||
mGlobalVariables->setFloat ("gamehour", hour);
|
||||
|
||||
mRenderingManager->skySetHour (hour);
|
||||
mRendering.skySetHour (hour);
|
||||
|
||||
if (days>0)
|
||||
setDay (days + mGlobalVariables->getInt ("day"));
|
||||
|
@ -432,7 +431,7 @@ namespace MWWorld
|
|||
mGlobalVariables->setInt ("day", day);
|
||||
mGlobalVariables->setInt ("month", month);
|
||||
|
||||
mRenderingManager->skySetDate (day, month);
|
||||
mRendering.skySetDate (day, month);
|
||||
}
|
||||
|
||||
void World::setMonth (int month)
|
||||
|
@ -453,7 +452,7 @@ namespace MWWorld
|
|||
if (years>0)
|
||||
mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year"));
|
||||
|
||||
mRenderingManager->skySetDate (mGlobalVariables->getInt ("day"), month);
|
||||
mRendering.skySetDate (mGlobalVariables->getInt ("day"), month);
|
||||
}
|
||||
|
||||
bool World::toggleSky()
|
||||
|
@ -461,34 +460,34 @@ namespace MWWorld
|
|||
if (mSky)
|
||||
{
|
||||
mSky = false;
|
||||
mRenderingManager->skyDisable();
|
||||
mRendering.skyDisable();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSky = true;
|
||||
// TODO check for extorior or interior with sky.
|
||||
mRenderingManager->skySetHour (mGlobalVariables->getFloat ("gamehour"));
|
||||
mRenderingManager->skySetDate (mGlobalVariables->getInt ("day"),
|
||||
mRendering.skySetHour (mGlobalVariables->getFloat ("gamehour"));
|
||||
mRendering.skySetDate (mGlobalVariables->getInt ("day"),
|
||||
mGlobalVariables->getInt ("month"));
|
||||
mRenderingManager->skyEnable();
|
||||
mRendering.skyEnable();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int World::getMasserPhase() const
|
||||
{
|
||||
return mRenderingManager->skyGetMasserPhase();
|
||||
return mRendering.skyGetMasserPhase();
|
||||
}
|
||||
|
||||
int World::getSecundaPhase() const
|
||||
{
|
||||
return mRenderingManager->skyGetSecundaPhase();
|
||||
return mRendering.skyGetSecundaPhase();
|
||||
}
|
||||
|
||||
void World::setMoonColour (bool red)
|
||||
{
|
||||
mRenderingManager->skySetMoonColour (red);
|
||||
mRendering.skySetMoonColour (red);
|
||||
}
|
||||
|
||||
float World::getTimeScaleFactor() const
|
||||
|
@ -513,7 +512,7 @@ namespace MWWorld
|
|||
|
||||
std::string World::getFacedHandle()
|
||||
{
|
||||
std::pair<std::string, float> result = mScene.getFacedHandle (*this);
|
||||
std::pair<std::string, float> result = mPhysics->getFacedHandle (*this);
|
||||
|
||||
if (result.first.empty() ||
|
||||
result.second>getStore().gameSettings.find ("iMaxActivateDist")->i)
|
||||
|
@ -577,7 +576,7 @@ namespace MWWorld
|
|||
// \todo cell change for non-player ref
|
||||
|
||||
// \todo this should go into the new scene class and eventually into the objects/actors classes.
|
||||
mScene.getMgr()->getSceneNode (ptr.getRefData().getHandle())->
|
||||
mRendering.getMgr()->getSceneNode (ptr.getRefData().getHandle())->
|
||||
setPosition (Ogre::Vector3 (x, y, z));
|
||||
}
|
||||
|
||||
|
@ -652,7 +651,7 @@ namespace MWWorld
|
|||
|
||||
bool World::toggleRenderMode (RenderMode mode)
|
||||
{
|
||||
return mScene.toggleRenderMode (mode);
|
||||
return mDebugging.toggleRenderMode (mode);
|
||||
}
|
||||
|
||||
std::pair<std::string, const ESM::Potion *> World::createRecord (const ESM::Potion& record)
|
||||
|
|
|
@ -65,7 +65,8 @@ namespace MWWorld
|
|||
|
||||
private:
|
||||
|
||||
MWRender::MWScene mScene;
|
||||
MWRender::RenderingManager mRendering;
|
||||
MWRender::Debugging mDebugging;
|
||||
MWWorld::Scene *mWorldScene;
|
||||
MWWorld::Player *mPlayer;
|
||||
ESM::ESMReader mEsm;
|
||||
|
@ -75,7 +76,6 @@ namespace MWWorld
|
|||
MWWorld::PhysicsSystem *mPhysics;
|
||||
bool mSky;
|
||||
Environment& mEnvironment;
|
||||
MWRender::RenderingManager *mRenderingManager;
|
||||
int mNextDynamicRecord;
|
||||
|
||||
Cells mCells;
|
||||
|
|
Loading…
Reference in a new issue