mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 04:10:24 +00:00
various fixes
This commit is contained in:
parent
e1bde415f5
commit
1b89a9e203
6 changed files with 43 additions and 17 deletions
|
@ -27,6 +27,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
mTerrainManager = new TerrainManager(mRendering.getScene(),
|
mTerrainManager = new TerrainManager(mRendering.getScene(),
|
||||||
environment);
|
environment);
|
||||||
|
|
||||||
|
mWater = 0;
|
||||||
|
|
||||||
//The fog type must be set before any terrain objects are created as if the
|
//The fog type must be set before any terrain objects are created as if the
|
||||||
//fog type is set to FOG_NONE then the initially created terrain won't have any fog
|
//fog type is set to FOG_NONE then the initially created terrain won't have any fog
|
||||||
configureFog(1, ColourValue(1,1,1));
|
configureFog(1, ColourValue(1,1,1));
|
||||||
|
@ -39,8 +41,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
|
|
||||||
// disable MRT if it is unsupported
|
// disable MRT if it is unsupported
|
||||||
const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
|
const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
|
||||||
if (caps->getNumMultiRenderTargets() < 2
|
if (caps->getNumMultiRenderTargets() < 2)
|
||||||
|| (!caps->isShaderProfileSupported("fp40") && !caps->isShaderProfileSupported("ps_3_0")))
|
|
||||||
Settings::Manager::setBool("multiple render targets", "Render", false);
|
Settings::Manager::setBool("multiple render targets", "Render", false);
|
||||||
|
|
||||||
if (Settings::Manager::getBool("multiple render targets", "Render"))
|
if (Settings::Manager::getBool("multiple render targets", "Render"))
|
||||||
|
@ -73,8 +74,6 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
|
|
||||||
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
|
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
|
||||||
|
|
||||||
mWater = 0;
|
|
||||||
|
|
||||||
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
||||||
mSun = 0;
|
mSun = 0;
|
||||||
|
|
||||||
|
@ -311,6 +310,8 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue
|
||||||
CompositorInstance* inst = CompositorManager::getSingleton().getCompositorChain(mRendering.getViewport())->getCompositor("gbuffer");
|
CompositorInstance* inst = CompositorManager::getSingleton().getCompositorChain(mRendering.getViewport())->getCompositor("gbuffer");
|
||||||
if (inst != 0)
|
if (inst != 0)
|
||||||
inst->getCompositor()->getTechnique(0)->getTargetPass(0)->getPass(0)->setClearColour(colour);
|
inst->getCompositor()->getTechnique(0)->getTargetPass(0)->getPass(0)->setClearColour(colour);
|
||||||
|
if (mWater)
|
||||||
|
mWater->setViewportBackground(colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -913,3 +913,13 @@ Ogre::SceneNode* SkyManager::getSunNode()
|
||||||
if (!mCreated) return 0;
|
if (!mCreated) return 0;
|
||||||
return mSun->getNode();
|
return mSun->getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkyManager::setSkyPosition(const Ogre::Vector3& position)
|
||||||
|
{
|
||||||
|
mRootNode->_setDerivedPosition(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkyManager::resetSkyPosition()
|
||||||
|
{
|
||||||
|
mRootNode->setPosition(0,0,0);
|
||||||
|
}
|
||||||
|
|
|
@ -168,6 +168,9 @@ namespace MWRender
|
||||||
void setGlare(const float glare);
|
void setGlare(const float glare);
|
||||||
Ogre::Vector3 getRealSunPos();
|
Ogre::Vector3 getRealSunPos();
|
||||||
|
|
||||||
|
void setSkyPosition(const Ogre::Vector3& position);
|
||||||
|
void resetSkyPosition();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mCreated;
|
bool mCreated;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
|
||||||
+ RV_Statics * Settings::Manager::getBool("reflect statics", "Water")
|
+ RV_Statics * Settings::Manager::getBool("reflect statics", "Water")
|
||||||
+ RV_StaticsSmall * Settings::Manager::getBool("reflect small statics", "Water")
|
+ RV_StaticsSmall * Settings::Manager::getBool("reflect small statics", "Water")
|
||||||
+ RV_Actors * Settings::Manager::getBool("reflect actors", "Water")
|
+ RV_Actors * Settings::Manager::getBool("reflect actors", "Water")
|
||||||
+ RV_Misc * Settings::Manager::getBool("reflect misc", "Water");
|
+ RV_Misc * Settings::Manager::getBool("reflect misc", "Water")
|
||||||
//+ RV_Sky;
|
+ RV_Sky;
|
||||||
mReflectDistance = Settings::Manager::getInt("reflect distance", "Water");
|
mReflectDistance = Settings::Manager::getInt("reflect distance", "Water");
|
||||||
|
|
||||||
mWaterNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
|
mWaterNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
|
||||||
|
@ -147,6 +147,9 @@ void Water::preRenderTargetUpdate(const RenderTargetEvent& evt)
|
||||||
|
|
||||||
if (evt.source == mReflectionTarget)
|
if (evt.source == mReflectionTarget)
|
||||||
{
|
{
|
||||||
|
Vector3 pos = mCamera->getRealPosition();
|
||||||
|
pos.y = mTop*2 - pos.y;
|
||||||
|
mSky->setSkyPosition(pos);
|
||||||
mCamera->enableCustomNearClipPlane(Plane(Vector3::UNIT_Y, mTop));
|
mCamera->enableCustomNearClipPlane(Plane(Vector3::UNIT_Y, mTop));
|
||||||
mCamera->enableReflection(Plane(Vector3::UNIT_Y, mTop));
|
mCamera->enableReflection(Plane(Vector3::UNIT_Y, mTop));
|
||||||
}
|
}
|
||||||
|
@ -160,6 +163,7 @@ void Water::postRenderTargetUpdate(const RenderTargetEvent& evt)
|
||||||
|
|
||||||
if (evt.source == mReflectionTarget)
|
if (evt.source == mReflectionTarget)
|
||||||
{
|
{
|
||||||
|
mSky->resetSkyPosition();
|
||||||
mCamera->disableReflection();
|
mCamera->disableReflection();
|
||||||
mCamera->disableCustomNearClipPlane();
|
mCamera->disableCustomNearClipPlane();
|
||||||
}
|
}
|
||||||
|
@ -199,4 +203,10 @@ Ogre::MaterialPtr Water::createMaterial()
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Water::setViewportBackground(const ColourValue& bg)
|
||||||
|
{
|
||||||
|
if (mReflectionTarget)
|
||||||
|
mReflectionTarget->getViewport(0)->setBackgroundColour(bg);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -50,6 +50,8 @@ namespace MWRender {
|
||||||
|
|
||||||
void toggle();
|
void toggle();
|
||||||
|
|
||||||
|
void setViewportBackground(const Ogre::ColourValue& bg);
|
||||||
|
|
||||||
void checkUnderwater(float y);
|
void checkUnderwater(float y);
|
||||||
void changeCell(const ESM::Cell* cell);
|
void changeCell(const ESM::Cell* cell);
|
||||||
void setHeight(const float height);
|
void setHeight(const float height);
|
||||||
|
|
|
@ -76,7 +76,7 @@ void main_fp
|
||||||
|
|
||||||
// fresnel
|
// fresnel
|
||||||
float facing = 1.0 - max(abs(dot(normalize(iEyeVector.xyz), normal.xyz)), 0);
|
float facing = 1.0 - max(abs(dot(normalize(iEyeVector.xyz), normal.xyz)), 0);
|
||||||
float reflectionFactor = saturate(0.3 + 0.7 * pow(facing, 2));
|
float reflectionFactor = saturate(0.35 + 0.65 * pow(facing, 2));
|
||||||
|
|
||||||
oColor.xyz = lerp(refraction.xyz, reflection.xyz, depth1 * reflectionFactor);
|
oColor.xyz = lerp(refraction.xyz, reflection.xyz, depth1 * reflectionFactor);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue