mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Resolve computed near plane issues with extremely high viewing distances.
This commit is contained in:
parent
759e6fb804
commit
50fdd0be99
1 changed files with 4 additions and 1 deletions
|
@ -927,6 +927,9 @@ void MWShadowTechnique::cull(osgUtil::CullVisitor& cv)
|
|||
|
||||
//OSG_NOTICE<<"maxZFar "<<maxZFar<<std::endl;
|
||||
|
||||
// Workaround for absurdly huge viewing distances where OSG would otherwise push the near plane out.
|
||||
cv.setNearFarRatio(minZNear / maxZFar);
|
||||
|
||||
Frustum frustum(&cv, minZNear, maxZFar);
|
||||
if (_debugHud)
|
||||
_debugHud->setFrustumVertices(new osg::Vec3dArray(8, &frustum.corners[0]));
|
||||
|
@ -2252,7 +2255,7 @@ bool MWShadowTechnique::adjustPerspectiveShadowMapCameraSettings(osgUtil::Render
|
|||
double nearDist = frustum.frustumCenterLine.x() * nearPoint.x() + frustum.frustumCenterLine.y() * nearPoint.y() + frustum.frustumCenterLine.z() * nearPoint.z();
|
||||
double farDist = -frustum.frustumCenterLine.x() * farPoint.x() - frustum.frustumCenterLine.y() * farPoint.y() - frustum.frustumCenterLine.z() * farPoint.z();
|
||||
|
||||
|
||||
|
||||
convexHull.clip(osg::Plane(frustum.frustumCenterLine, -nearDist));
|
||||
convexHull.clip(osg::Plane(-frustum.frustumCenterLine, -farDist));
|
||||
|
||||
|
|
Loading…
Reference in a new issue