mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-19 03:39:58 +00:00
Use separate node mask and parent for CompositeMapRenderer to allow the loading screen to pre compile composite maps.
This commit is contained in:
parent
7e4450da55
commit
5eff286c71
@ -107,7 +107,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
|
|||||||
|
|
||||||
if (esmLand.getLandData (ESM::Land::DATA_VHGT))
|
if (esmLand.getLandData (ESM::Land::DATA_VHGT))
|
||||||
{
|
{
|
||||||
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Mask_Terrain));
|
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Mask_Terrain));
|
||||||
mTerrain->loadCell(esmLand.mX,
|
mTerrain->loadCell(esmLand.mX,
|
||||||
esmLand.mY);
|
esmLand.mY);
|
||||||
|
|
||||||
|
@ -297,8 +297,8 @@ namespace MWGui
|
|||||||
// Turn off rendering except the GUI
|
// Turn off rendering except the GUI
|
||||||
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
|
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
|
||||||
int oldCullMask = mViewer->getCamera()->getCullMask();
|
int oldCullMask = mViewer->getCamera()->getCullMask();
|
||||||
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI);
|
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile);
|
||||||
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI);
|
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile);
|
||||||
|
|
||||||
MWBase::Environment::get().getInputManager()->update(0, true, true);
|
MWBase::Environment::get().getInputManager()->update(0, true, true);
|
||||||
|
|
||||||
|
@ -217,8 +217,8 @@ namespace MWRender
|
|||||||
mTerrainStorage = new TerrainStorage(mResourceSystem, Settings::Manager::getString("normal map pattern", "Shaders"), Settings::Manager::getString("normal height map pattern", "Shaders"),
|
mTerrainStorage = new TerrainStorage(mResourceSystem, Settings::Manager::getString("normal map pattern", "Shaders"), Settings::Manager::getString("normal height map pattern", "Shaders"),
|
||||||
Settings::Manager::getBool("auto use terrain normal maps", "Shaders"),
|
Settings::Manager::getBool("auto use terrain normal maps", "Shaders"),
|
||||||
Settings::Manager::getString("terrain specular map pattern", "Shaders"), Settings::Manager::getBool("auto use terrain specular maps", "Shaders"));
|
Settings::Manager::getString("terrain specular map pattern", "Shaders"), Settings::Manager::getBool("auto use terrain specular maps", "Shaders"));
|
||||||
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(),
|
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mViewer->getIncrementalCompileOperation(),
|
||||||
mTerrainStorage, Mask_Terrain));
|
mTerrainStorage, Mask_Terrain, Mask_PreCompile));
|
||||||
|
|
||||||
mCamera.reset(new Camera(mViewer->getCamera()));
|
mCamera.reset(new Camera(mViewer->getCamera()));
|
||||||
|
|
||||||
|
@ -48,8 +48,10 @@ namespace MWRender
|
|||||||
// Set on cameras within the main scene graph
|
// Set on cameras within the main scene graph
|
||||||
Mask_RenderToTexture = (1<<15),
|
Mask_RenderToTexture = (1<<15),
|
||||||
|
|
||||||
|
Mask_PreCompile = (1<<16),
|
||||||
|
|
||||||
// Set on a camera's cull mask to enable the LightManager
|
// Set on a camera's cull mask to enable the LightManager
|
||||||
Mask_Lighting = (1<<16)
|
Mask_Lighting = (1<<17)
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
||||||
TerrainGrid::TerrainGrid(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico, Storage* storage, int nodeMask)
|
TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico, Storage* storage, int nodeMask, int preCompileMask)
|
||||||
: Terrain::World(parent, resourceSystem, ico, storage, nodeMask)
|
: Terrain::World(parent, compileRoot, resourceSystem, ico, storage, nodeMask, preCompileMask)
|
||||||
, mNumSplits(4)
|
, mNumSplits(4)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Material> material (new osg::Material);
|
osg::ref_ptr<osg::Material> material (new osg::Material);
|
||||||
|
@ -19,7 +19,7 @@ namespace Terrain
|
|||||||
class TerrainGrid : public Terrain::World
|
class TerrainGrid : public Terrain::World
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TerrainGrid(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico, Storage* storage, int nodeMask);
|
TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico, Storage* storage, int nodeMask, int preCompileMask=~0);
|
||||||
~TerrainGrid();
|
~TerrainGrid();
|
||||||
|
|
||||||
/// Load a terrain cell and store it in cache for later use.
|
/// Load a terrain cell and store it in cache for later use.
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
||||||
World::World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
||||||
Storage* storage, int nodeMask)
|
Storage* storage, int nodeMask, int preCompileMask)
|
||||||
: mStorage(storage)
|
: mStorage(storage)
|
||||||
, mParent(parent)
|
, mParent(parent)
|
||||||
, mResourceSystem(resourceSystem)
|
, mResourceSystem(resourceSystem)
|
||||||
@ -26,7 +26,9 @@ World::World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUt
|
|||||||
mTerrainRoot->setName("Terrain Root");
|
mTerrainRoot->setName("Terrain Root");
|
||||||
|
|
||||||
osg::ref_ptr<CompositeMapRenderer> renderer (new CompositeMapRenderer);
|
osg::ref_ptr<CompositeMapRenderer> renderer (new CompositeMapRenderer);
|
||||||
mTerrainRoot->addChild(renderer);
|
renderer->setNodeMask(preCompileMask);
|
||||||
|
compileRoot->addChild(renderer);
|
||||||
|
mCompositeMapRenderer = renderer;
|
||||||
|
|
||||||
mParent->addChild(mTerrainRoot);
|
mParent->addChild(mTerrainRoot);
|
||||||
|
|
||||||
@ -43,6 +45,7 @@ World::~World()
|
|||||||
mResourceSystem->removeResourceManager(mTextureManager.get());
|
mResourceSystem->removeResourceManager(mTextureManager.get());
|
||||||
|
|
||||||
mParent->removeChild(mTerrainRoot);
|
mParent->removeChild(mTerrainRoot);
|
||||||
|
mCompositeMapRenderer->getParent(0)->removeChild(mCompositeMapRenderer);
|
||||||
|
|
||||||
delete mStorage;
|
delete mStorage;
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ namespace Terrain
|
|||||||
/// @note takes ownership of \a storage
|
/// @note takes ownership of \a storage
|
||||||
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
|
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
|
||||||
/// @param nodeMask mask for the terrain root
|
/// @param nodeMask mask for the terrain root
|
||||||
World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
||||||
Storage* storage, int nodeMask);
|
Storage* storage, int nodeMask, int preCompileMask);
|
||||||
virtual ~World();
|
virtual ~World();
|
||||||
|
|
||||||
virtual void updateTextureFiltering() {}
|
virtual void updateTextureFiltering() {}
|
||||||
@ -63,6 +63,7 @@ namespace Terrain
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Group> mParent;
|
osg::ref_ptr<osg::Group> mParent;
|
||||||
osg::ref_ptr<osg::Group> mTerrainRoot;
|
osg::ref_ptr<osg::Group> mTerrainRoot;
|
||||||
|
osg::ref_ptr<osg::Node> mCompositeMapRenderer;
|
||||||
|
|
||||||
Resource::ResourceSystem* mResourceSystem;
|
Resource::ResourceSystem* mResourceSystem;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user