Added support for using pixel size control of LOD levels.

This commit is contained in:
Robert Osfield
2004-06-30 19:07:05 +00:00
parent b22de2eba0
commit a8ee967f14
3 changed files with 156 additions and 3 deletions

View File

@@ -55,14 +55,17 @@ class SG_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.*/
enum CenterMode
{
USE_BOUNDING_SPHERE_CENTER,
USER_DEFINED_CENTER
};
/** Set how the center of object should be determined when computed 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.*/
CenterMode getCenterMode() const { return _centerMode; }
/** Sets the object-space point which defines the center of the osg::LOD.
@@ -72,6 +75,21 @@ class SG_EXPORT LOD : public Group
/** return the LOD center point. */
inline const Vec3& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); }
/** Modes that control how the range values should be intepreted when computing which child is active.*/
enum RangeMode
{
DISTANCE_FROM_EYE_POINT,
PIXEL_SIZE_ON_SCREEN
};
/** Set how the range values should be intepreted when computing which child is active.*/
void setRangeMode(RangeMode mode) { _rangeMode = mode; }
/** Get how the range values should be intepreted when computing which child is active.*/
RangeMode getRangeMode() const { return _rangeMode; }
/** Sets the min and max visible ranges of range of specifiec child.
Values are floating point distance specified in local objects coordinates.*/
void setRange(unsigned int childNo, float min,float max);
@@ -101,6 +119,7 @@ class SG_EXPORT LOD : public Group
CenterMode _centerMode;
Vec3 _userDefinedCenter;
RangeMode _rangeMode;
RangeList _rangeList;
};