various fixes

actorid
scrawl 13 years ago
parent e1bde415f5
commit 1b89a9e203

@ -27,6 +27,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
mTerrainManager = new TerrainManager(mRendering.getScene(),
environment);
mWater = 0;
//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
configureFog(1, ColourValue(1,1,1));
@ -39,8 +41,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
// disable MRT if it is unsupported
const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
if (caps->getNumMultiRenderTargets() < 2
|| (!caps->isShaderProfileSupported("fp40") && !caps->isShaderProfileSupported("ps_3_0")))
if (caps->getNumMultiRenderTargets() < 2)
Settings::Manager::setBool("multiple render targets", "Render", false);
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());
mWater = 0;
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
mSun = 0;
@ -311,6 +310,8 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue
CompositorInstance* inst = CompositorManager::getSingleton().getCompositorChain(mRendering.getViewport())->getCompositor("gbuffer");
if (inst != 0)
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;
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);
Ogre::Vector3 getRealSunPos();
void setSkyPosition(const Ogre::Vector3& position);
void resetSkyPosition();
private:
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_StaticsSmall * Settings::Manager::getBool("reflect small statics", "Water")
+ RV_Actors * Settings::Manager::getBool("reflect actors", "Water")
+ RV_Misc * Settings::Manager::getBool("reflect misc", "Water");
//+ RV_Sky;
+ RV_Misc * Settings::Manager::getBool("reflect misc", "Water")
+ RV_Sky;
mReflectDistance = Settings::Manager::getInt("reflect distance", "Water");
mWaterNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
@ -145,11 +145,14 @@ void Water::preRenderTargetUpdate(const RenderTargetEvent& evt)
if (mReflectDistance != 0)
mCamera->setFarClipDistance(mReflectDistance);
if (evt.source == mReflectionTarget)
{
mCamera->enableCustomNearClipPlane(Plane(Vector3::UNIT_Y, mTop));
mCamera->enableReflection(Plane(Vector3::UNIT_Y, mTop));
}
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->enableReflection(Plane(Vector3::UNIT_Y, mTop));
}
}
void Water::postRenderTargetUpdate(const RenderTargetEvent& evt)
@ -158,11 +161,12 @@ void Water::postRenderTargetUpdate(const RenderTargetEvent& evt)
mCamera->setFarClipDistance(mOldCameraFarClip);
if (evt.source == mReflectionTarget)
{
mCamera->disableReflection();
mCamera->disableCustomNearClipPlane();
}
if (evt.source == mReflectionTarget)
{
mSky->resetSkyPosition();
mCamera->disableReflection();
mCamera->disableCustomNearClipPlane();
}
}
Ogre::MaterialPtr Water::createMaterial()
@ -199,4 +203,10 @@ Ogre::MaterialPtr Water::createMaterial()
return mat;
}
void Water::setViewportBackground(const ColourValue& bg)
{
if (mReflectionTarget)
mReflectionTarget->getViewport(0)->setBackgroundColour(bg);
}
} // namespace

@ -50,6 +50,8 @@ namespace MWRender {
void toggle();
void setViewportBackground(const Ogre::ColourValue& bg);
void checkUnderwater(float y);
void changeCell(const ESM::Cell* cell);
void setHeight(const float height);

@ -76,7 +76,7 @@ void main_fp
// fresnel
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);

Loading…
Cancel
Save