1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Use simplified convex hull clipping maths from the other function doing hte same thing

This commit is contained in:
AnyOldName3 2018-07-31 23:30:15 +01:00
parent 85aba2e1da
commit 02ab3b466a

View file

@ -2416,13 +2416,12 @@ bool MWShadowTechnique::adjustPerspectiveShadowMapCameraSettings(osgUtil::Render
osg::Vec3d nearPoint = frustum.eye + frustum.frustumCenterLine * viewNear;
osg::Vec3d farPoint = frustum.eye + frustum.frustumCenterLine * viewFar;
// TODO: Aren't these just dot products? Also the double negation of farDist is silly.
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));
double nearDist = -frustum.frustumCenterLine * nearPoint;
double farDist = frustum.frustumCenterLine * farPoint;
convexHull.clip(osg::Plane(frustum.frustumCenterLine, nearDist));
convexHull.clip(osg::Plane(-frustum.frustumCenterLine, farDist));
#if 0
OSG_NOTICE<<"ws ConvexHull xMin="<<convexHull.min(0)<<", xMax="<<convexHull.max(0)<<std::endl;