mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 21:45:34 +00:00
Use correct planes for the new matrix
This commit is contained in:
parent
61712168c6
commit
c41befadfb
1 changed files with 22 additions and 11 deletions
|
@ -87,19 +87,10 @@ namespace MWRender
|
|||
|
||||
if (dNear < computedZNear || dFar > computedZFar)
|
||||
{
|
||||
osg::Polytope& frustum = cullVisitor.getCurrentCullingSet().getFrustum();
|
||||
osg::Polytope::ClippingMask resultMask = frustum.getResultMask();
|
||||
osg::Polytope frustum;
|
||||
osg::Polytope::ClippingMask resultMask = cullVisitor.getCurrentCullingSet().getFrustum().getResultMask();
|
||||
if (resultMask)
|
||||
{
|
||||
osg::Polytope::PlaneList planes;
|
||||
osg::Polytope::ClippingMask selectorMask = 0x1;
|
||||
for (const auto& plane : frustum.getPlaneList())
|
||||
{
|
||||
if (resultMask & selectorMask)
|
||||
planes.push_back(plane);
|
||||
selectorMask <<= 1;
|
||||
}
|
||||
|
||||
if (dNear < computedZNear)
|
||||
{
|
||||
dNear = computedZNear;
|
||||
|
@ -121,6 +112,16 @@ namespace MWRender
|
|||
if (instanceDFar < 0 || instanceDNear > dNear)
|
||||
continue;
|
||||
|
||||
frustum.setAndTransformProvidingInverse(cullVisitor.getProjectionCullingStack().back().getFrustum(), fullMatrix);
|
||||
osg::Polytope::PlaneList planes;
|
||||
osg::Polytope::ClippingMask selectorMask = 0x1;
|
||||
for (const auto& plane : frustum.getPlaneList())
|
||||
{
|
||||
if (resultMask & selectorMask)
|
||||
planes.push_back(plane);
|
||||
selectorMask <<= 1;
|
||||
}
|
||||
|
||||
value_type newNear
|
||||
= cullVisitor.computeNearestPointInFrustum(fullMatrix, planes, *drawable);
|
||||
dNear = std::min(dNear, newNear);
|
||||
|
@ -150,6 +151,16 @@ namespace MWRender
|
|||
if (instanceDFar < 0 || instanceDFar < dFar)
|
||||
continue;
|
||||
|
||||
frustum.setAndTransformProvidingInverse(cullVisitor.getProjectionCullingStack().back().getFrustum(), fullMatrix);
|
||||
osg::Polytope::PlaneList planes;
|
||||
osg::Polytope::ClippingMask selectorMask = 0x1;
|
||||
for (const auto& plane : frustum.getPlaneList())
|
||||
{
|
||||
if (resultMask & selectorMask)
|
||||
planes.push_back(plane);
|
||||
selectorMask <<= 1;
|
||||
}
|
||||
|
||||
value_type newFar = cullVisitor.computeFurthestPointInFrustum(
|
||||
instanceMatrix * matrix, planes, *drawable);
|
||||
dFar = std::max(dFar, newFar);
|
||||
|
|
Loading…
Reference in a new issue