Added near/far flags to Polytope::setToBoundingBox().

This commit is contained in:
Robert Osfield 2020-12-24 09:45:00 +00:00
parent 2d6e0b6a66
commit 6cabb0b012

View File

@ -70,15 +70,15 @@ class OSG_EXPORT Polytope
}
/** Create a Polytope which is a equivalent to BoundingBox.*/
void setToBoundingBox(const BoundingBox& bb)
void setToBoundingBox(const BoundingBox& bb, bool withNear=true, bool withFar=true)
{
_planeList.clear();
_planeList.push_back(Plane(1.0,0.0,0.0,-bb.xMin())); // left plane.
_planeList.push_back(Plane(-1.0,0.0,0.0,bb.xMax())); // right plane.
_planeList.push_back(Plane(0.0,1.0,0.0,-bb.yMin())); // bottom plane.
_planeList.push_back(Plane(0.0,-1.0,0.0,bb.yMax())); // top plane.
_planeList.push_back(Plane(0.0,0.0,1.0,-bb.zMin())); // near plane
_planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMax())); // far plane
if (withNear) _planeList.push_back(Plane(0.0,0.0,1.0,-bb.zMin())); // near plane
if (withFar) _planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMax())); // far plane
setupMask();
}