1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

underwater tweaks

This commit is contained in:
scrawl 2012-04-06 16:11:08 +02:00
parent 2976625b00
commit c169f9e171
3 changed files with 9 additions and 2 deletions

View File

@ -18,6 +18,8 @@ enum RenderQueueGroups
RQG_Alpha = Ogre::RENDER_QUEUE_7, RQG_Alpha = Ogre::RENDER_QUEUE_7,
RQG_UnderWater = Ogre::RENDER_QUEUE_7+1,
RQG_OcclusionQuery = Ogre::RENDER_QUEUE_8, RQG_OcclusionQuery = Ogre::RENDER_QUEUE_8,
// Sky late (sun & sun flare) // Sky late (sun & sun flare)

View File

@ -54,6 +54,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
if (caps->getNumMultiRenderTargets() < 2) if (caps->getNumMultiRenderTargets() < 2)
Settings::Manager::setBool("shader", "Water", false); Settings::Manager::setBool("shader", "Water", false);
// note that the order is important here
if (useMRT()) if (useMRT())
{ {
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbuffer"); CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbuffer");
@ -61,6 +62,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbufferFinalizer"); CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbufferFinalizer");
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", true); CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", true);
} }
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "Water");
// Turn the entire scene (represented by the 'root' node) -90 // Turn the entire scene (represented by the 'root' node) -90
// degrees around the x axis. This makes Z go upwards, and Y go into // degrees around the x axis. This makes Z go upwards, and Y go into

View File

@ -16,7 +16,6 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
try try
{ {
CompositorManager::getSingleton().addCompositor(mViewport, "Water", -1);
CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Water", false); CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Water", false);
} catch(...) {} } catch(...) {}
@ -76,7 +75,7 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
void Water::setActive(bool active) void Water::setActive(bool active)
{ {
mActive = active; mActive = active;
if (mReflectionTarget) mReflectionTarget->setActive(active); if (mReflectionTarget) mReflectionTarget->setActive(active && !mIsUnderwater);
mWater->setVisible(active); mWater->setVisible(active);
} }
@ -130,6 +129,8 @@ void Water::checkUnderwater(float y)
if (mReflectionTarget) if (mReflectionTarget)
mReflectionTarget->setActive(mActive); mReflectionTarget->setActive(mActive);
mWater->setRenderQueueGroup(RQG_Water);
mIsUnderwater = false; mIsUnderwater = false;
} }
@ -147,6 +148,8 @@ void Water::checkUnderwater(float y)
if (mReflectionTarget) if (mReflectionTarget)
mReflectionTarget->setActive(false); mReflectionTarget->setActive(false);
mWater->setRenderQueueGroup(RQG_UnderWater);
mIsUnderwater = true; mIsUnderwater = true;
} }
} }