Added fine grained computation of the far plane when using the COMPUTE_NEAR_FAR_USING_PRIMITIVES ComputeNearFarMode.

Added COMPUTE_NEAR_FAR_USING_PRIMITIVES option that provides the original functionality where only the near plane
is computed in a fine grained way, with the far plane being computed simply from bound volumes.
This commit is contained in:
Robert Osfield
2011-09-01 18:48:21 +00:00
parent b21d206d3a
commit 1fd3c84287
3 changed files with 151 additions and 41 deletions

View File

@@ -161,7 +161,8 @@ class OSG_EXPORT CullSettings
{
DO_NOT_COMPUTE_NEAR_FAR = 0,
COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES,
COMPUTE_NEAR_FAR_USING_PRIMITIVES
COMPUTE_NEAR_FAR_USING_PRIMITIVES,
COMPUTE_NEAR_USING_PRIMITIVES
};
void setComputeNearFarMode(ComputeNearFarMode cnfm) { _computeNearFar=cnfm; applyMaskAction(COMPUTE_NEAR_FAR_MODE); }

View File

@@ -211,6 +211,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
inline value_type getCalculatedFarPlane() const { return _computed_zfar; }
value_type computeNearestPointInFrustum(const osg::Matrix& matrix, const osg::Polytope::PlaneList& planes,const osg::Drawable& drawable);
value_type computeFurthestPointInFrustum(const osg::Matrix& matrix, const osg::Polytope::PlaneList& planes,const osg::Drawable& drawable);
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::BoundingBox& bb);
@@ -381,6 +382,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
typedef std::multimap<value_type, MatrixPlanesDrawables> DistanceMatrixDrawableMap;
DistanceMatrixDrawableMap _nearPlaneCandidateMap;
DistanceMatrixDrawableMap _farPlaneCandidateMap;
osg::ref_ptr<Identifier> _identifier;
};