mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:36:43 +00:00
Use node masks to separate Scene and GUI
This commit is contained in:
parent
c90125f936
commit
62847f0489
5 changed files with 22 additions and 5 deletions
|
@ -41,6 +41,8 @@
|
||||||
#include "mwworld/player.hpp"
|
#include "mwworld/player.hpp"
|
||||||
#include "mwworld/worldimp.hpp"
|
#include "mwworld/worldimp.hpp"
|
||||||
|
|
||||||
|
#include "mwrender/vismask.hpp"
|
||||||
|
|
||||||
#include "mwclass/classes.hpp"
|
#include "mwclass/classes.hpp"
|
||||||
|
|
||||||
#include "mwdialogue/dialoguemanagerimp.hpp"
|
#include "mwdialogue/dialoguemanagerimp.hpp"
|
||||||
|
@ -339,6 +341,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
|
|
||||||
std::string myguiResources = (mResDir / "mygui").string();
|
std::string myguiResources = (mResDir / "mygui").string();
|
||||||
osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
|
osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
|
||||||
|
guiRoot->setNodeMask(MWRender::Mask_GUI);
|
||||||
rootNode->addChild(guiRoot);
|
rootNode->addChild(guiRoot);
|
||||||
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem->getTextureManager(),
|
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem->getTextureManager(),
|
||||||
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
|
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
|
||||||
|
|
|
@ -466,7 +466,7 @@ void RenderManager::initialise()
|
||||||
camera->addChild(geode.get());
|
camera->addChild(geode.get());
|
||||||
|
|
||||||
mGuiRoot = camera;
|
mGuiRoot = camera;
|
||||||
//mSceneRoot->addChild(mGuiRoot.get());
|
mSceneRoot->addChild(mGuiRoot.get());
|
||||||
mViewer->addEventHandler(new ResizeHandler(this));
|
mViewer->addEventHandler(new ResizeHandler(this));
|
||||||
|
|
||||||
osg::ref_ptr<osg::Viewport> vp = mViewer->getCamera()->getViewport();
|
osg::ref_ptr<osg::Viewport> vp = mViewer->getCamera()->getViewport();
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "sky.hpp"
|
#include "sky.hpp"
|
||||||
#include "effectmanager.hpp"
|
#include "effectmanager.hpp"
|
||||||
|
#include "vismask.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
@ -87,8 +88,6 @@ namespace MWRender
|
||||||
|
|
||||||
mObjects.reset(new Objects(mResourceSystem, lightRoot));
|
mObjects.reset(new Objects(mResourceSystem, lightRoot));
|
||||||
|
|
||||||
mSky.reset(new SkyManager(mRootNode, resourceSystem->getSceneManager()));
|
|
||||||
|
|
||||||
mEffectManager.reset(new EffectManager(mRootNode, mResourceSystem));
|
mEffectManager.reset(new EffectManager(mRootNode, mResourceSystem));
|
||||||
|
|
||||||
mViewer.setLightingMode(osgViewer::View::NO_LIGHT);
|
mViewer.setLightingMode(osgViewer::View::NO_LIGHT);
|
||||||
|
@ -105,6 +104,10 @@ namespace MWRender
|
||||||
lightRoot->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::ON);
|
lightRoot->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::ON);
|
||||||
lightRoot->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
lightRoot->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
||||||
|
|
||||||
|
lightRoot->setNodeMask(Mask_Scene);
|
||||||
|
|
||||||
|
mSky.reset(new SkyManager(lightRoot, resourceSystem->getSceneManager()));
|
||||||
|
|
||||||
source->setStateSetModes(*mRootNode->getOrCreateStateSet(), osg::StateAttribute::ON);
|
source->setStateSetModes(*mRootNode->getOrCreateStateSet(), osg::StateAttribute::ON);
|
||||||
|
|
||||||
mStateUpdater = new StateUpdater;
|
mStateUpdater = new StateUpdater;
|
||||||
|
@ -128,6 +131,8 @@ namespace MWRender
|
||||||
zNear = 5.f;
|
zNear = 5.f;
|
||||||
zFar = mViewDistance;
|
zFar = mViewDistance;
|
||||||
mViewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspect, zNear, zFar);
|
mViewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspect, zNear, zFar);
|
||||||
|
|
||||||
|
mViewer.getCamera()->setCullMask(mViewer.getCamera()->getCullMask() & (~Mask_GUI));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderingManager::~RenderingManager()
|
RenderingManager::~RenderingManager()
|
||||||
|
|
|
@ -554,7 +554,6 @@ void SkyManager::create()
|
||||||
depth->setWriteMask(false);
|
depth->setWriteMask(false);
|
||||||
mRootNode->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::ON);
|
mRootNode->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::ON);
|
||||||
mRootNode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
|
mRootNode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
|
||||||
mRootNode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::ON);
|
|
||||||
|
|
||||||
mCreated = true;
|
mCreated = true;
|
||||||
}
|
}
|
||||||
|
@ -562,6 +561,11 @@ void SkyManager::create()
|
||||||
SkyManager::~SkyManager()
|
SkyManager::~SkyManager()
|
||||||
{
|
{
|
||||||
clearRain();
|
clearRain();
|
||||||
|
if (mRootNode)
|
||||||
|
{
|
||||||
|
mRootNode->getParent(0)->removeChild(mRootNode);
|
||||||
|
mRootNode = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkyManager::getMasserPhase() const
|
int SkyManager::getMasserPhase() const
|
||||||
|
|
|
@ -9,7 +9,12 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors
|
Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors
|
||||||
|
|
||||||
Mask_Effect = 0x2
|
// child of Scene
|
||||||
|
Mask_Effect = 0x2,
|
||||||
|
|
||||||
|
// top level masks
|
||||||
|
Mask_Scene = 0x10,
|
||||||
|
Mask_GUI = 0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue