1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 09:45:36 +00:00

Hide the terrain in non-exterior cells

This commit is contained in:
scrawl 2017-03-09 02:17:25 +01:00
parent 2580de11a4
commit 4dbd224249
6 changed files with 21 additions and 0 deletions

View file

@ -421,6 +421,11 @@ namespace MWRender
mWater->removeCell(store);
}
void RenderingManager::enableTerrain(bool enable)
{
mTerrain->enable(enable);
}
void RenderingManager::setSkyEnabled(bool enabled)
{
mSky->setEnabled(enabled);

View file

@ -102,6 +102,8 @@ namespace MWRender
void addCell(const MWWorld::CellStore* store);
void removeCell(const MWWorld::CellStore* store);
void enableTerrain(bool enable);
void updatePtr(const MWWorld::Ptr& old, const MWWorld::Ptr& updated);
void rotateObject(const MWWorld::Ptr& ptr, const osg::Quat& rot);

View file

@ -440,6 +440,8 @@ namespace MWWorld
{
mCurrentCell = cell;
mRendering.enableTerrain(cell->isExterior());
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr old = world->getPlayerPtr();
world->getPlayer().setCell(cell);

View file

@ -98,6 +98,8 @@ public:
virtual void accept(osg::NodeVisitor &nv)
{
if (!nv.validNodeMask(*this))
return;
nv.pushOntoNodePath(this);
mWorld->accept(nv);
nv.popFromNodePath();
@ -361,6 +363,12 @@ osg::ref_ptr<osg::Node> QuadTreeWorld::cacheCell(int x, int y)
return NULL;
}
void QuadTreeWorld::enable(bool enabled)
{
if (mRootNode)
mRootNode->setNodeMask(enabled ? ~0 : 0);
}
}

View file

@ -33,6 +33,8 @@ namespace Terrain
virtual void loadCell(int x, int y);
virtual osg::ref_ptr<osg::Node> cacheCell(int x, int y);
virtual void enable(bool enabled);
private:
osg::ref_ptr<RootNode> mRootNode;

View file

@ -64,6 +64,8 @@ namespace Terrain
/// @note May be ignored by derived implementations that don't organize the terrain into cells.
virtual void unloadCell(int x, int y) {}
virtual void enable(bool enabled) {}
Storage* getStorage() { return mStorage; }
protected: