Hide the terrain in non-exterior cells

pull/185/head
scrawl 8 years ago
parent 2580de11a4
commit 4dbd224249

@ -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);

@ -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);

@ -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);

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

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

@ -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:

Loading…
Cancel
Save