mirror of
https://github.com/OpenMW/openmw.git
synced 2026-01-30 01:38:57 +00:00
Offsets reflection/refraction clip plane based on camera height and FOV
This commit is contained in:
parent
7628c23750
commit
b7ba58c8f2
1 changed files with 5 additions and 3 deletions
|
|
@ -111,9 +111,11 @@ namespace MWRender
|
|||
}
|
||||
|
||||
// move the plane back along its normal a little bit to prevent bleeding at the water shore
|
||||
const float clipFudge = -5;
|
||||
modelViewMatrix->preMultTranslate(mCullPlane->getNormal() * clipFudge);
|
||||
|
||||
unsigned int fov = Settings::Manager::getInt("field of view", "Camera");
|
||||
const float clipFudge = 2.5; // minimum offset of clip plane
|
||||
const float clipFudgeScale = 1.0; // additional offset of clip plane when standing at shore level with default FOV
|
||||
float clipOffset = abs(abs((*mCullPlane)[3]) - eyePoint.z()) * (clipFudgeScale * fov / (-7500.0)) - clipFudge;
|
||||
modelViewMatrix->preMultTranslate(mCullPlane->getNormal() * clipOffset);
|
||||
cv->pushModelViewMatrix(modelViewMatrix, osg::Transform::RELATIVE_RF);
|
||||
traverse(node, cv);
|
||||
cv->popModelViewMatrix();
|
||||
|
|
|
|||
Loading…
Reference in a new issue