mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +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
8 changed files with 20 additions and 14 deletions
|
@ -107,7 +107,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
|
|||
|
||||
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,
|
||||
esmLand.mY);
|
||||
|
||||
|
|
|
@ -297,8 +297,8 @@ namespace MWGui
|
|||
// Turn off rendering except the GUI
|
||||
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
|
||||
int oldCullMask = mViewer->getCamera()->getCullMask();
|
||||
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI);
|
||||
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI);
|
||||
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile);
|
||||
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile);
|
||||
|
||||
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"),
|
||||
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"));
|
||||
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(),
|
||||
mTerrainStorage, Mask_Terrain));
|
||||
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mViewer->getIncrementalCompileOperation(),
|
||||
mTerrainStorage, Mask_Terrain, Mask_PreCompile));
|
||||
|
||||
mCamera.reset(new Camera(mViewer->getCamera()));
|
||||
|
||||
|
|
|
@ -48,8 +48,10 @@ namespace MWRender
|
|||
// Set on cameras within the main scene graph
|
||||
Mask_RenderToTexture = (1<<15),
|
||||
|
||||
Mask_PreCompile = (1<<16),
|
||||
|
||||
// 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
|
||||
{
|
||||
|
||||
TerrainGrid::TerrainGrid(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico, Storage* storage, int nodeMask)
|
||||
: Terrain::World(parent, resourceSystem, ico, storage, nodeMask)
|
||||
TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico, Storage* storage, int nodeMask, int preCompileMask)
|
||||
: Terrain::World(parent, compileRoot, resourceSystem, ico, storage, nodeMask, preCompileMask)
|
||||
, mNumSplits(4)
|
||||
{
|
||||
osg::ref_ptr<osg::Material> material (new osg::Material);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Terrain
|
|||
class TerrainGrid : public Terrain::World
|
||||
{
|
||||
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();
|
||||
|
||||
/// Load a terrain cell and store it in cache for later use.
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
namespace Terrain
|
||||
{
|
||||
|
||||
World::World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
||||
Storage* storage, int nodeMask)
|
||||
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
||||
Storage* storage, int nodeMask, int preCompileMask)
|
||||
: mStorage(storage)
|
||||
, mParent(parent)
|
||||
, mResourceSystem(resourceSystem)
|
||||
|
@ -26,7 +26,9 @@ World::World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUt
|
|||
mTerrainRoot->setName("Terrain Root");
|
||||
|
||||
osg::ref_ptr<CompositeMapRenderer> renderer (new CompositeMapRenderer);
|
||||
mTerrainRoot->addChild(renderer);
|
||||
renderer->setNodeMask(preCompileMask);
|
||||
compileRoot->addChild(renderer);
|
||||
mCompositeMapRenderer = renderer;
|
||||
|
||||
mParent->addChild(mTerrainRoot);
|
||||
|
||||
|
@ -43,6 +45,7 @@ World::~World()
|
|||
mResourceSystem->removeResourceManager(mTextureManager.get());
|
||||
|
||||
mParent->removeChild(mTerrainRoot);
|
||||
mCompositeMapRenderer->getParent(0)->removeChild(mCompositeMapRenderer);
|
||||
|
||||
delete mStorage;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace Terrain
|
|||
/// @note takes ownership of \a storage
|
||||
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
|
||||
/// @param nodeMask mask for the terrain root
|
||||
World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
||||
Storage* storage, int nodeMask);
|
||||
World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
||||
Storage* storage, int nodeMask, int preCompileMask);
|
||||
virtual ~World();
|
||||
|
||||
virtual void updateTextureFiltering() {}
|
||||
|
@ -63,6 +63,7 @@ namespace Terrain
|
|||
|
||||
osg::ref_ptr<osg::Group> mParent;
|
||||
osg::ref_ptr<osg::Group> mTerrainRoot;
|
||||
osg::ref_ptr<osg::Node> mCompositeMapRenderer;
|
||||
|
||||
Resource::ResourceSystem* mResourceSystem;
|
||||
|
||||
|
|
Loading…
Reference in a new issue