From Chris Hanson:
Spelling fixes in include/osg/LOD Negated priority in PagedLOD when using _rangeMode==PIXEL_SIZE_ON_SCREEN Added clampedPixelSize() methods to CullStack and CullingSet to return fabs()ed values. Changed LOD and PagedLOD ::traverse to use clampedPixelSize() methods.
This commit is contained in:
@@ -65,6 +65,18 @@ class OSG_EXPORT CullStack : public osg::CullSettings
|
||||
return pixelSize(bs.center(),bs.radius());
|
||||
}
|
||||
|
||||
/** Compute the pixel size of an object at position v, with specified radius. fabs()ed to always be positive. */
|
||||
float clampedPixelSize(const Vec3& v,float radius) const
|
||||
{
|
||||
return getCurrentCullingSet().clampedPixelSize(v,radius);
|
||||
}
|
||||
|
||||
/** Compute the pixel size of the bounding sphere. fabs()ed to always be positive. */
|
||||
float clampedPixelSize(const BoundingSphere& bs) const
|
||||
{
|
||||
return clampedPixelSize(bs.center(),bs.radius());
|
||||
}
|
||||
|
||||
inline void disableAndPushOccludersCurrentMask(NodePath& nodePath)
|
||||
{
|
||||
getCurrentCullingSet().disableAndPushOccludersCurrentMask(nodePath);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <osg/ShadowVolumeOccluder>
|
||||
#include <osg/Referenced>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -172,6 +174,12 @@ class OSG_EXPORT CullingSet : public Referenced
|
||||
/** Compute the pixel of a bounding sphere.*/
|
||||
float pixelSize(const BoundingSphere& bs) const { return bs.radius()/(bs.center()*_pixelSizeVector); }
|
||||
|
||||
/** Compute the pixel of an object at position v, with specified radius. fabs()ed to always be positive. */
|
||||
float clampedPixelSize(const Vec3& v,float radius) const { return fabs(pixelSize(v, radius)); }
|
||||
|
||||
/** Compute the pixel of a bounding sphere. fabs()ed to always be positive. */
|
||||
float clampedPixelSize(const BoundingSphere& bs) const { return fabs(pixelSize(bs)); }
|
||||
|
||||
|
||||
inline bool isCulled(const std::vector<Vec3>& vertices)
|
||||
{
|
||||
|
||||
@@ -55,17 +55,17 @@ class OSG_EXPORT LOD : public Group
|
||||
typedef std::pair<float,float> MinMaxPair;
|
||||
typedef std::vector<MinMaxPair> RangeList;
|
||||
|
||||
/** Modes which control how the center of object should be determined when computed which child is active.*/
|
||||
/** Modes which control how the center of object should be determined when computing which child is active.*/
|
||||
enum CenterMode
|
||||
{
|
||||
USE_BOUNDING_SPHERE_CENTER,
|
||||
USER_DEFINED_CENTER
|
||||
};
|
||||
|
||||
/** Set how the center of object should be determined when computed which child is active.*/
|
||||
/** Set how the center of object should be determined when computing which child is active.*/
|
||||
void setCenterMode(CenterMode mode) { _centerMode=mode; }
|
||||
|
||||
/** Get how the center of object should be determined when computed which child is active.*/
|
||||
/** Get how the center of object should be determined when computing which child is active.*/
|
||||
CenterMode getCenterMode() const { return _centerMode; }
|
||||
|
||||
/** Sets the object-space point which defines the center of the osg::LOD.
|
||||
|
||||
Reference in New Issue
Block a user