Fixed the custom near clip planes

actorid
scrawl 12 years ago
parent 5334934612
commit 979a874220

@ -25,6 +25,7 @@ namespace MWRender
vp->setOverlaysEnabled(false);
vp->setShadowsEnabled(false);
vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain);
vp->setMaterialScheme("water_reflection");
mRenderTarget->setAutoUpdated(true);
mRenderTarget->addListener(this);
}
@ -54,10 +55,9 @@ namespace MWRender
}
void Refraction::setWaterPlane(Ogre::Plane plane)
void Refraction::setHeight(float height)
{
/// \todo
mNearClipPlane = Ogre::Plane( -Ogre::Vector3(0,1,0), 0);
mNearClipPlane = Ogre::Plane( -Ogre::Vector3(0,1,0), -(height + 5));
}
}

@ -20,7 +20,7 @@ namespace MWRender
Refraction(Ogre::Camera* parentCamera);
~Refraction();
void setWaterPlane (Ogre::Plane plane);
void setHeight (float height);
void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);

@ -155,10 +155,10 @@ void PlaneReflection::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt)
mRenderActive = false;
}
void PlaneReflection::setWaterPlane (Plane plane)
void PlaneReflection::setHeight (float height)
{
mWaterPlane = plane;
mErrorPlane = Plane(plane.normal, mWaterPlane.d - 5);
mWaterPlane = Plane(Ogre::Vector3(0,1,0), height);
mErrorPlane = Plane(Ogre::Vector3(0,1,0), height - 5);
}
void PlaneReflection::setActive (bool active)
@ -321,9 +321,9 @@ void Water::setHeight(const float height)
mWaterPlane = Plane(Vector3::UNIT_Y, -height);
if (mReflection)
mReflection->setWaterPlane(mWaterPlane);
mReflection->setHeight(height);
if (mRefraction)
mRefraction->setWaterPlane(mWaterPlane);
mRefraction->setHeight(height);
mWaterNode->setPosition(0, height, 0);
sh::Factory::getInstance ().setSharedParameter ("waterLevel", sh::makeProperty<sh::FloatValue>(new sh::FloatValue(height)));
@ -423,7 +423,7 @@ void Water::applyRTT()
{
mReflection = new PlaneReflection(mSceneMgr, mSky);
mReflection->setParentCamera (mCamera);
mReflection->setWaterPlane(mWaterPlane);
mReflection->setHeight(mTop);
mWater->setRenderQueueGroup(RQG_Water);
}
else
@ -434,6 +434,7 @@ void Water::applyRTT()
mRefraction = NULL;
mRefraction = new Refraction(mCamera);
mRefraction->setHeight(mTop);
}
void Water::applyVisibilityMask()

@ -39,7 +39,7 @@ namespace MWRender {
: mSceneMgr(sceneManager) {}
virtual ~Reflection() {}
virtual void setWaterPlane (Ogre::Plane plane) {}
virtual void setHeight (float height) {}
virtual void setParentCamera (Ogre::Camera* parent) { mParentCamera = parent; }
void setUnderwater(bool underwater) { mIsUnderwater = underwater; }
virtual void setActive (bool active) {}
@ -72,7 +72,7 @@ namespace MWRender {
PlaneReflection(Ogre::SceneManager* sceneManager, SkyManager* sky);
virtual ~PlaneReflection();
virtual void setWaterPlane (Ogre::Plane plane);
virtual void setHeight (float height);
virtual void setActive (bool active);
virtual void setVisibilityMask (int flags);

Loading…
Cancel
Save