forked from teamnwah/openmw-tes3coop
Hiding the rendering manager; crash eliminated
This commit is contained in:
parent
965ff24597
commit
d4f63443e6
9 changed files with 66 additions and 56 deletions
|
@ -35,11 +35,13 @@ bool ExteriorCellRender::lightOutQuadInLin = false;
|
||||||
int ExteriorCellRender::uniqueID = 0;
|
int ExteriorCellRender::uniqueID = 0;
|
||||||
|
|
||||||
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics)
|
OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot,MWWorld::PhysicsSystem *physics)
|
||||||
: mCell(_cell), mEnvironment (environment), mRendering(_rendering), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
: mCell(_cell), mEnvironment (environment), mRenderer(renderer), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
||||||
{
|
{
|
||||||
|
mMwRoot = mwRoot;
|
||||||
uniqueID = uniqueID +1;
|
uniqueID = uniqueID +1;
|
||||||
sg = mRendering.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +129,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
||||||
mNpcPart = parent->createChildSceneNode(sceneNodeName);
|
mNpcPart = parent->createChildSceneNode(sceneNodeName);
|
||||||
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
||||||
|
|
||||||
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
MovableObject *ent = mRenderer.getScene()->createEntity(mesh);
|
||||||
|
|
||||||
|
|
||||||
if(translateFirst){
|
if(translateFirst){
|
||||||
|
@ -215,7 +217,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
||||||
assert (mInsert);
|
assert (mInsert);
|
||||||
|
|
||||||
NifOgre::NIFLoader::load(mesh);
|
NifOgre::NIFLoader::load(mesh);
|
||||||
Entity *ent = mRendering.getMgr()->createEntity(mesh);
|
Entity *ent = mRenderer.getScene()->createEntity(mesh);
|
||||||
|
|
||||||
if(!isStatic)
|
if(!isStatic)
|
||||||
{
|
{
|
||||||
|
@ -225,7 +227,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
||||||
{
|
{
|
||||||
sg->addEntity(ent,mInsert->_getDerivedPosition(),mInsert->_getDerivedOrientation(),mInsert->_getDerivedScale());
|
sg->addEntity(ent,mInsert->_getDerivedPosition(),mInsert->_getDerivedOrientation(),mInsert->_getDerivedScale());
|
||||||
sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000));
|
sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000));
|
||||||
mRendering.getMgr()->destroyEntity(ent);
|
mRenderer.getScene()->destroyEntity(ent);
|
||||||
}
|
}
|
||||||
if (mInsertMesh.empty())
|
if (mInsertMesh.empty())
|
||||||
mInsertMesh = mesh;
|
mInsertMesh = mesh;
|
||||||
|
@ -250,7 +252,7 @@ void ExteriorCellRender::insertLight(float r, float g, float b, float radius)
|
||||||
{
|
{
|
||||||
assert (mInsert);
|
assert (mInsert);
|
||||||
|
|
||||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
Ogre::Light *light = mRenderer.getScene()->createLight();
|
||||||
light->setDiffuseColour (r, g, b);
|
light->setDiffuseColour (r, g, b);
|
||||||
|
|
||||||
float cval=0.0f, lval=0.0f, qval=0.0f;
|
float cval=0.0f, lval=0.0f, qval=0.0f;
|
||||||
|
@ -306,7 +308,7 @@ void ExteriorCellRender::configureAmbient()
|
||||||
|
|
||||||
// Create a "sun" that shines light downwards. It doesn't look
|
// Create a "sun" that shines light downwards. It doesn't look
|
||||||
// completely right, but leave it for now.
|
// completely right, but leave it for now.
|
||||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
Ogre::Light *light = mRenderer.getScene()->createLight();
|
||||||
Ogre::ColourValue colour;
|
Ogre::ColourValue colour;
|
||||||
colour.setAsABGR (mCell.cell->ambi.sunlight);
|
colour.setAsABGR (mCell.cell->ambi.sunlight);
|
||||||
light->setDiffuseColour (colour);
|
light->setDiffuseColour (colour);
|
||||||
|
@ -323,9 +325,9 @@ void ExteriorCellRender::configureFog()
|
||||||
float high = 4500 + 9000 * (1-mCell.cell->ambi.fogDensity);
|
float high = 4500 + 9000 * (1-mCell.cell->ambi.fogDensity);
|
||||||
float low = 200;
|
float low = 200;
|
||||||
|
|
||||||
mRendering.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
mRenderer.getScene()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||||
mRendering.getCamera()->setFarClipDistance (high + 10);
|
mRenderer.getCamera()->setFarClipDistance (high + 10);
|
||||||
mRendering.getViewport()->setBackgroundColour (color);
|
mRenderer.getViewport()->setBackgroundColour (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExteriorCellRender::setAmbientMode()
|
void ExteriorCellRender::setAmbientMode()
|
||||||
|
@ -334,17 +336,17 @@ void ExteriorCellRender::setAmbientMode()
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
mRendering.getMgr()->setAmbientLight(mAmbientColor);
|
mRenderer.getScene()->setAmbientLight(mAmbientColor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
mRendering.getMgr()->setAmbientLight(0.7f*mAmbientColor + 0.3f*ColourValue(1,1,1));
|
mRenderer.getScene()->setAmbientLight(0.7f*mAmbientColor + 0.3f*ColourValue(1,1,1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
mRendering.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
mRenderer.getScene()->setAmbientLight(ColourValue(1,1,1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,7 +354,7 @@ void ExteriorCellRender::setAmbientMode()
|
||||||
void ExteriorCellRender::show()
|
void ExteriorCellRender::show()
|
||||||
{
|
{
|
||||||
// FIXME: this one may be the bug
|
// FIXME: this one may be the bug
|
||||||
mBase = mRendering.getRoot()->createChildSceneNode();
|
mBase = mMwRoot->createChildSceneNode();
|
||||||
|
|
||||||
configureAmbient();
|
configureAmbient();
|
||||||
configureFog();
|
configureFog();
|
||||||
|
@ -401,14 +403,14 @@ void ExteriorCellRender::destroy()
|
||||||
{
|
{
|
||||||
destroyAllAttachedMovableObjects(mBase);
|
destroyAllAttachedMovableObjects(mBase);
|
||||||
mBase->removeAndDestroyAllChildren();
|
mBase->removeAndDestroyAllChildren();
|
||||||
mRendering.getMgr()->destroySceneNode(mBase);
|
mRenderer.getScene()->destroySceneNode(mBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
mBase = 0;
|
mBase = 0;
|
||||||
|
|
||||||
if (sg)
|
if (sg)
|
||||||
{
|
{
|
||||||
mRendering.getMgr()->destroyStaticGeometry (sg);
|
mRenderer.getScene()->destroyStaticGeometry (sg);
|
||||||
sg = 0;
|
sg = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,21 +437,21 @@ void ExteriorCellRender::toggleLight()
|
||||||
void ExteriorCellRender::enable (const std::string& handle)
|
void ExteriorCellRender::enable (const std::string& handle)
|
||||||
{
|
{
|
||||||
if (!handle.empty())
|
if (!handle.empty())
|
||||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (true);
|
mRenderer.getScene()->getSceneNode (handle)->setVisible (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExteriorCellRender::disable (const std::string& handle)
|
void ExteriorCellRender::disable (const std::string& handle)
|
||||||
{
|
{
|
||||||
if (!handle.empty())
|
if (!handle.empty())
|
||||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (false);
|
mRenderer.getScene()->getSceneNode (handle)->setVisible (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExteriorCellRender::deleteObject (const std::string& handle)
|
void ExteriorCellRender::deleteObject (const std::string& handle)
|
||||||
{
|
{
|
||||||
if (!handle.empty())
|
if (!handle.empty())
|
||||||
{
|
{
|
||||||
Ogre::SceneNode *node = mRendering.getMgr()->getSceneNode (handle);
|
Ogre::SceneNode *node = mRenderer.getScene()->getSceneNode (handle);
|
||||||
node->removeAndDestroyAllChildren();
|
node->removeAndDestroyAllChildren();
|
||||||
mRendering.getMgr()->destroySceneNode (node);
|
mRenderer.getScene()->destroySceneNode (node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,8 @@ namespace MWRender
|
||||||
|
|
||||||
ESMS::CellStore<MWWorld::RefData> &mCell;
|
ESMS::CellStore<MWWorld::RefData> &mCell;
|
||||||
MWWorld::Environment &mEnvironment;
|
MWWorld::Environment &mEnvironment;
|
||||||
RenderingManager &mRendering;
|
OEngine::Render::OgreRenderer& mRenderer;
|
||||||
|
Ogre::SceneNode *mMwRoot;
|
||||||
MWWorld::PhysicsSystem *mPhysics;
|
MWWorld::PhysicsSystem *mPhysics;
|
||||||
|
|
||||||
/// The scene node that contains all objects belonging to this
|
/// The scene node that contains all objects belonging to this
|
||||||
|
@ -103,7 +104,7 @@ namespace MWRender
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics);
|
OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot, MWWorld::PhysicsSystem *physics);
|
||||||
|
|
||||||
virtual ~ExteriorCellRender() { destroy(); }
|
virtual ~ExteriorCellRender() { destroy(); }
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
||||||
|
|
||||||
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
||||||
|
|
||||||
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
MovableObject *ent = mRenderer.getScene()->createEntity(mesh);
|
||||||
//ent->extr
|
//ent->extr
|
||||||
|
|
||||||
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
|
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
|
||||||
|
@ -186,7 +186,7 @@ void InteriorCellRender::insertMesh(const std::string &mesh)
|
||||||
assert (insert);
|
assert (insert);
|
||||||
|
|
||||||
NifOgre::NIFLoader::load(mesh);
|
NifOgre::NIFLoader::load(mesh);
|
||||||
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
MovableObject *ent = mRenderer.getScene()->createEntity(mesh);
|
||||||
insert->attachObject(ent);
|
insert->attachObject(ent);
|
||||||
|
|
||||||
if (mInsertMesh.empty())
|
if (mInsertMesh.empty())
|
||||||
|
@ -212,7 +212,7 @@ void InteriorCellRender::insertLight(float r, float g, float b, float radius)
|
||||||
{
|
{
|
||||||
assert (insert);
|
assert (insert);
|
||||||
|
|
||||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
Ogre::Light *light = mRenderer.getScene()->createLight();
|
||||||
light->setDiffuseColour (r, g, b);
|
light->setDiffuseColour (r, g, b);
|
||||||
|
|
||||||
float cval=0.0f, lval=0.0f, qval=0.0f;
|
float cval=0.0f, lval=0.0f, qval=0.0f;
|
||||||
|
@ -268,7 +268,7 @@ void InteriorCellRender::configureAmbient()
|
||||||
|
|
||||||
// Create a "sun" that shines light downwards. It doesn't look
|
// Create a "sun" that shines light downwards. It doesn't look
|
||||||
// completely right, but leave it for now.
|
// completely right, but leave it for now.
|
||||||
Ogre::Light *light = mRendering.getMgr()->createLight();
|
Ogre::Light *light = mRenderer.getScene()->createLight();
|
||||||
Ogre::ColourValue colour;
|
Ogre::ColourValue colour;
|
||||||
colour.setAsABGR (cell.cell->ambi.sunlight);
|
colour.setAsABGR (cell.cell->ambi.sunlight);
|
||||||
light->setDiffuseColour (colour);
|
light->setDiffuseColour (colour);
|
||||||
|
@ -285,9 +285,9 @@ void InteriorCellRender::configureFog()
|
||||||
float high = 4500 + 9000 * (1-cell.cell->ambi.fogDensity);
|
float high = 4500 + 9000 * (1-cell.cell->ambi.fogDensity);
|
||||||
float low = 200;
|
float low = 200;
|
||||||
|
|
||||||
mRendering.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
mRenderer.getScene()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||||
mRendering.getCamera()->setFarClipDistance (high + 10);
|
mRenderer.getCamera()->setFarClipDistance (high + 10);
|
||||||
mRendering.getViewport()->setBackgroundColour (color);
|
mRenderer.getViewport()->setBackgroundColour (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteriorCellRender::setAmbientMode()
|
void InteriorCellRender::setAmbientMode()
|
||||||
|
@ -296,24 +296,24 @@ void InteriorCellRender::setAmbientMode()
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
mRendering.getMgr()->setAmbientLight(ambientColor);
|
mRenderer.getScene()->setAmbientLight(ambientColor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
mRendering.getMgr()->setAmbientLight(0.7f*ambientColor + 0.3f*ColourValue(1,1,1));
|
mRenderer.getScene()->setAmbientLight(0.7f*ambientColor + 0.3f*ColourValue(1,1,1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
mRendering.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
mRenderer.getScene()->setAmbientLight(ColourValue(1,1,1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteriorCellRender::show()
|
void InteriorCellRender::show()
|
||||||
{
|
{
|
||||||
base = mRendering.getRoot()->createChildSceneNode();
|
base = mMwRoot->createChildSceneNode();
|
||||||
|
|
||||||
configureAmbient();
|
configureAmbient();
|
||||||
configureFog();
|
configureFog();
|
||||||
|
@ -332,7 +332,7 @@ void InteriorCellRender::destroy()
|
||||||
if(base)
|
if(base)
|
||||||
{
|
{
|
||||||
base->removeAndDestroyAllChildren();
|
base->removeAndDestroyAllChildren();
|
||||||
mRendering.getMgr()->destroySceneNode(base);
|
mRenderer.getScene()->destroySceneNode(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
base = NULL;
|
base = NULL;
|
||||||
|
@ -360,22 +360,22 @@ void InteriorCellRender::toggleLight()
|
||||||
void InteriorCellRender::enable (const std::string& handle)
|
void InteriorCellRender::enable (const std::string& handle)
|
||||||
{
|
{
|
||||||
if (!handle.empty())
|
if (!handle.empty())
|
||||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (true);
|
mRenderer.getScene()->getSceneNode (handle)->setVisible (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteriorCellRender::disable (const std::string& handle)
|
void InteriorCellRender::disable (const std::string& handle)
|
||||||
{
|
{
|
||||||
if (!handle.empty())
|
if (!handle.empty())
|
||||||
mRendering.getMgr()->getSceneNode (handle)->setVisible (false);
|
mRenderer.getScene()->getSceneNode (handle)->setVisible (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteriorCellRender::deleteObject (const std::string& handle)
|
void InteriorCellRender::deleteObject (const std::string& handle)
|
||||||
{
|
{
|
||||||
if (!handle.empty())
|
if (!handle.empty())
|
||||||
{
|
{
|
||||||
Ogre::SceneNode *node = mRendering.getMgr()->getSceneNode (handle);
|
Ogre::SceneNode *node = mRenderer.getScene()->getSceneNode (handle);
|
||||||
node->removeAndDestroyAllChildren();
|
node->removeAndDestroyAllChildren();
|
||||||
mRendering.getMgr()->destroySceneNode (node);
|
mRenderer.getScene()->destroySceneNode (node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,8 @@ namespace MWRender
|
||||||
|
|
||||||
ESMS::CellStore<MWWorld::RefData> &cell;
|
ESMS::CellStore<MWWorld::RefData> &cell;
|
||||||
MWWorld::Environment &mEnvironment;
|
MWWorld::Environment &mEnvironment;
|
||||||
MWRender::RenderingManager &mRendering;
|
OEngine::Render::OgreRenderer& mRenderer;
|
||||||
|
Ogre::SceneNode *mMwRoot;
|
||||||
MWWorld::PhysicsSystem *mPhysics;
|
MWWorld::PhysicsSystem *mPhysics;
|
||||||
|
|
||||||
/// The scene node that contains all objects belonging to this
|
/// The scene node that contains all objects belonging to this
|
||||||
|
@ -95,9 +96,10 @@ namespace MWRender
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics)
|
OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot, MWWorld::PhysicsSystem *physics)
|
||||||
: cell(_cell), mEnvironment (environment), mRendering(_rendering), base(NULL), insert(NULL), ambientMode (0)
|
: cell(_cell), mEnvironment (environment), mRenderer(renderer), base(NULL), insert(NULL), ambientMode (0)
|
||||||
{
|
{
|
||||||
|
mMwRoot = mwRoot;
|
||||||
mPhysics = physics;
|
mPhysics = physics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
|
|
||||||
//std::cout << "ONE";
|
//std::cout << "ONE";
|
||||||
rend.createScene("PlayerCam", 55, 5);
|
rend.createScene("PlayerCam", 55, 5);
|
||||||
mSkyManager = MWRender::SkyManager::create(rend.getWindow(), getCamera(), resDir);
|
mSkyManager = MWRender::SkyManager::create(rend.getWindow(), rend.getCamera(), resDir);
|
||||||
|
|
||||||
// Set default mipmap level (NB some APIs ignore this)
|
// Set default mipmap level (NB some APIs ignore this)
|
||||||
TextureManager::getSingleton().setDefaultNumMipmaps(5);
|
TextureManager::getSingleton().setDefaultNumMipmaps(5);
|
||||||
|
@ -54,10 +54,9 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
playerNode->pitch(Degree(90));
|
playerNode->pitch(Degree(90));
|
||||||
Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode();
|
Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode();
|
||||||
Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode();
|
Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode();
|
||||||
cameraPitchNode->attachObject(getCamera());
|
cameraPitchNode->attachObject(rend.getCamera());
|
||||||
std::cout <<"TWOF\n";
|
|
||||||
|
|
||||||
mPlayer = new MWRender::Player (getCamera(), playerNode->getName());
|
mPlayer = new MWRender::Player (rend.getCamera(), playerNode->getName());
|
||||||
//std::cout << "Three";
|
//std::cout << "Three";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,8 @@ class RenderingManager {
|
||||||
int skyGetMasserPhase() const;
|
int skyGetMasserPhase() const;
|
||||||
int skyGetSecundaPhase() const;
|
int skyGetSecundaPhase() const;
|
||||||
void skySetMoonColour (bool red);
|
void skySetMoonColour (bool red);
|
||||||
|
OEngine::Render::OgreRenderer& getOgreRenderer(){return rend;}
|
||||||
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
||||||
Ogre::Camera *getCamera() { return rend.getCamera(); }
|
|
||||||
Ogre::Viewport *getViewport() { return rend.getViewport(); }
|
|
||||||
Ogre::SceneNode *getRoot() { return mwRoot; }
|
Ogre::SceneNode *getRoot() { return mwRoot; }
|
||||||
MWRender::Player *getPlayer() { return mPlayer; }
|
MWRender::Player *getPlayer() { return mPlayer; }
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -137,7 +137,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
Ptr::CellStore *cell = mWorld->getExterior(x, y);
|
Ptr::CellStore *cell = mWorld->getExterior(x, y);
|
||||||
|
|
||||||
loadCell (cell, new MWRender::ExteriorCellRender (*cell, mEnvironment, mRendering, mPhysics));
|
loadCell (cell, new MWRender::ExteriorCellRender (*cell, mEnvironment, mRenderer, mMwRoot, mPhysics));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,10 +168,12 @@ namespace MWWorld
|
||||||
mCellChanged = true;
|
mCellChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene::Scene (Environment& environment, World *world, MWRender::RenderingManager& rm, PhysicsSystem *physics)
|
//We need the ogre renderer and a scene node.
|
||||||
: mRendering(rm), mCurrentCell (0),
|
Scene::Scene (Environment& environment, World *world, OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot, PhysicsSystem *physics)
|
||||||
|
: mRenderer(renderer), mCurrentCell (0),
|
||||||
mCellChanged (false), mEnvironment (environment), mWorld(world), mPhysics(physics)
|
mCellChanged (false), mEnvironment (environment), mWorld(world), mPhysics(physics)
|
||||||
{
|
{
|
||||||
|
mMwRoot = mwRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene::~Scene()
|
Scene::~Scene()
|
||||||
|
@ -205,7 +207,7 @@ namespace MWWorld
|
||||||
std::cout << "cellName:" << cellName << std::endl;
|
std::cout << "cellName:" << cellName << std::endl;
|
||||||
Ptr::CellStore *cell = mWorld->getInterior(cellName);
|
Ptr::CellStore *cell = mWorld->getInterior(cellName);
|
||||||
|
|
||||||
loadCell (cell, new MWRender::InteriorCellRender (*cell, mEnvironment, mRendering, mPhysics));
|
loadCell (cell, new MWRender::InteriorCellRender (*cell, mEnvironment, mRenderer, mMwRoot, mPhysics));
|
||||||
|
|
||||||
// adjust player
|
// adjust player
|
||||||
mCurrentCell = cell;
|
mCurrentCell = cell;
|
||||||
|
|
|
@ -57,7 +57,8 @@ namespace MWWorld
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MWRender::RenderingManager mRendering;
|
OEngine::Render::OgreRenderer& mRenderer;
|
||||||
|
Ogre::SceneNode *mMwRoot;
|
||||||
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
||||||
CellRenderCollection mActiveCells;
|
CellRenderCollection mActiveCells;
|
||||||
bool mCellChanged;
|
bool mCellChanged;
|
||||||
|
@ -69,7 +70,7 @@ namespace MWWorld
|
||||||
bool adjustPlayerPos = true);
|
bool adjustPlayerPos = true);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Scene (Environment& environment, World *world, MWRender::RenderingManager& rm, PhysicsSystem *physics);
|
Scene (Environment& environment, World *world, OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot, PhysicsSystem *physics);
|
||||||
|
|
||||||
~Scene();
|
~Scene();
|
||||||
|
|
||||||
|
|
|
@ -179,6 +179,7 @@ namespace MWWorld
|
||||||
: mRendering (renderer,resDir), mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
: mRendering (renderer,resDir), mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||||
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this), mDebugging(physEng)
|
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this), mDebugging(physEng)
|
||||||
{
|
{
|
||||||
|
std::cout << "Creating myworld\n";
|
||||||
mPhysEngine = physEng;
|
mPhysEngine = physEng;
|
||||||
|
|
||||||
mPhysics = new PhysicsSystem(renderer, physEng);
|
mPhysics = new PhysicsSystem(renderer, physEng);
|
||||||
|
@ -206,7 +207,8 @@ namespace MWWorld
|
||||||
|
|
||||||
mPhysEngine = physEng;
|
mPhysEngine = physEng;
|
||||||
|
|
||||||
mWorldScene = new Scene(environment, this, mRendering, mPhysics);
|
mWorldScene = new Scene(environment, this, mRendering.getOgreRenderer(), mRendering.getRoot(), mPhysics);
|
||||||
|
std::cout << "After mworldscene\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,8 +216,10 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
delete mWorldScene;
|
delete mWorldScene;
|
||||||
delete mGlobalVariables;
|
delete mGlobalVariables;
|
||||||
delete mPlayer;
|
|
||||||
delete mPhysics;
|
delete mPhysics;
|
||||||
|
|
||||||
|
delete mPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Cell *World::getExterior (const std::string& cellName) const
|
const ESM::Cell *World::getExterior (const std::string& cellName) const
|
||||||
|
|
Loading…
Reference in a new issue