14 #ifndef OSG_CULLSETTINGS
15 #define OSG_CULLSETTINGS 1
19 #include <osg/ClearNode>
25 class ApplicationUsage;
34 readEnvironmentalVariables();
40 readEnvironmentalVariables();
50 if (
this==&settings)
return *
this;
51 setCullSettings(settings);
56 virtual void setDefaults();
61 COMPUTE_NEAR_FAR_MODE = (0x1 << 0),
62 CULLING_MODE = (0x1 << 1),
63 LOD_SCALE = (0x1 << 2),
64 SMALL_FEATURE_CULLING_PIXEL_SIZE = (0x1 << 3),
65 CLAMP_PROJECTION_MATRIX_CALLBACK = (0x1 << 4),
66 NEAR_FAR_RATIO = (0x1 << 5),
67 IMPOSTOR_ACTIVE = (0x1 << 6),
68 DEPTH_SORT_IMPOSTOR_SPRITES = (0x1 << 7),
69 IMPOSTOR_PIXEL_ERROR_THRESHOLD = (0x1 << 8),
70 NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES = (0x1 << 9),
71 CULL_MASK = (0x1 << 10),
72 CULL_MASK_LEFT = (0x1 << 11),
73 CULL_MASK_RIGHT = (0x1 << 12),
74 CLEAR_COLOR = (0x1 << 13),
75 CLEAR_MASK = (0x1 << 14),
76 LIGHTING_MODE = (0x1 << 15),
78 DRAW_BUFFER = (0x1 << 17),
79 READ_BUFFER = (0x1 << 18),
81 NO_VARIABLES = 0x00000000,
82 ALL_VARIABLES = 0x7FFFFFFF
100 virtual void inheritCullSettings(
const CullSettings& settings,
unsigned int inheritanceMask);
103 void readEnvironmentalVariables();
112 DO_NOT_MODIFY_INHERITANCE_MASK
122 if (_inheritanceMaskActionOnAttributeSetting==DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT)
124 _inheritanceMask = _inheritanceMask & (~maskBit);
162 DO_NOT_COMPUTE_NEAR_FAR = 0,
165 COMPUTE_NEAR_USING_PRIMITIVES
171 void setNearFarRatio(
double ratio) { _nearFarRatio = ratio; applyMaskAction(NEAR_FAR_RATIO); }
177 VIEW_FRUSTUM_SIDES_CULLING = 0x1,
178 NEAR_PLANE_CULLING = 0x2,
179 FAR_PLANE_CULLING = 0x4,
180 VIEW_FRUSTUM_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
183 SMALL_FEATURE_CULLING = 0x8,
184 SHADOW_OCCLUSION_CULLING = 0x10,
185 CLUSTER_CULLING = 0x20,
186 DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
187 SMALL_FEATURE_CULLING|
188 SHADOW_OCCLUSION_CULLING|
190 ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING|
191 SMALL_FEATURE_CULLING|
192 SHADOW_OCCLUSION_CULLING|
199 void setCullingMode(CullingMode mode) { _cullingMode = mode; applyMaskAction(CULLING_MODE); }
215 void setLODScale(
float scale) { _LODScale = scale; applyMaskAction(LOD_SCALE); }
234 virtual bool clampProjectionMatrixImplementation(
osg::Matrixf& projection,
double& znear,
double& zfar)
const = 0;
235 virtual bool clampProjectionMatrixImplementation(
osg::Matrixd& projection,
double& znear,
double& zfar)
const = 0;
247 void write(std::ostream& out);
void setNearFarRatio(double ratio)
float getImpostorPixelErrorThreshold() const
InheritanceMaskActionOnAttributeSetting _inheritanceMaskActionOnAttributeSetting
ref_ptr< ClampProjectionMatrixCallback > _clampProjectionMatrixCallback
void setSmallFeatureCullingPixelSize(float value)
ComputeNearFarMode _computeNearFar
int _numFramesToKeepImpostorSprites
bool getDepthSortImpostorSprites() const
float getLODScale() const
void setCullingMode(CullingMode mode)
float _impostorPixelErrorThreshold
void setCullMask(osg::Node::NodeMask nm)
InheritanceMask _inheritanceMask
void readCommandLine(osg::ArgumentParser &parser)
float getSmallFeatureCullingPixelSize() const
void setDepthSortImpostorSprites(bool doDepthSort)
void setClampProjectionMatrixCallback(ClampProjectionMatrixCallback *cpmc)
InheritanceMaskActionOnAttributeSetting getInheritanceMaskActionOnAttributeSetting() const
virtual void inheritCullSettings(const CullSettings &settings)
ClampProjectionMatrixCallback * getClampProjectionMatrixCallback()
void setComputeNearFarMode(ComputeNearFarMode cnfm)
void setNumberOfFrameToKeepImpostorSprites(int numFrames)
void setImpostorPixelErrorThreshold(float numPixels)
int getNumberOfFrameToKeepImpostorSprites() const
Node::NodeMask _cullMaskRight
osg::Node::NodeMask getCullMask() const
const ClampProjectionMatrixCallback * getClampProjectionMatrixCallback() const
Node::NodeMask _cullMaskLeft
bool getImpostorsActive() const
CullingMode getCullingMode() const
void applyMaskAction(unsigned int maskBit)
InheritanceMask getInheritanceMask() const
void setInheritanceMaskActionOnAttributeSetting(InheritanceMaskActionOnAttributeSetting action)
void setCullMaskLeft(osg::Node::NodeMask nm)
void setInheritanceMask(InheritanceMask mask)
void setImpostorsActive(bool active)
bool _depthSortImpostorSprites
osg::Node::NodeMask getCullMaskLeft() const
void setLODScale(float scale)
ComputeNearFarMode getComputeNearFarMode() const
float _smallFeatureCullingPixelSize
InheritanceMaskActionOnAttributeSetting
CullSettings(ArgumentParser &arguments)
void setCullMaskRight(osg::Node::NodeMask nm)
double getNearFarRatio() const
osg::Node::NodeMask getCullMaskRight() const