Added support for setting the fusion distance directly in SceneView, defaults

to the original behavior of using the values from the Camera if attached.
This commit is contained in:
Robert Osfield
2002-09-04 10:49:17 +00:00
parent 6ff24b338f
commit f574d0dd68
3 changed files with 51 additions and 16 deletions

View File

@@ -127,8 +127,8 @@ class SG_EXPORT DisplaySettings : public osg::Referenced
bool getStencilBuffer() const { return _minimumNumberStencilBits!=0; }
void setMaxNumberOfGraphicsContexts(int num) { _maxNumOfGraphicsContexts = num; }
int getMaxNumberOfGraphicsContexts() const { return _maxNumOfGraphicsContexts; }
void setMaxNumberOfGraphicsContexts(unsigned int num) { _maxNumOfGraphicsContexts = num; }
unsigned int getMaxNumberOfGraphicsContexts() const { return _maxNumOfGraphicsContexts; }
protected:
@@ -152,7 +152,7 @@ class SG_EXPORT DisplaySettings : public osg::Referenced
unsigned int _minimumNumberAlphaBits;
unsigned int _minimumNumberStencilBits;
int _maxNumOfGraphicsContexts;
unsigned int _maxNumOfGraphicsContexts;
};

View File

@@ -190,6 +190,25 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
/** Get the ComputeNearFarMode.*/
CullVisitor::ComputeNearFarMode getComputeNearFarMode() const { return _computeNearFar;}
/** FusionDistanceMode is used only when working in stereo.*/
enum FusionDistanceMode
{
/** Use fusion distance from the attached camera if one exist.*/
USE_CAMERA_FUSION_DISTANCE,
/** Use fusion distance from the value set on the SceneView.*/
USE_FUSION_DISTANCE_VALUE,
/** Compute the fusion distance by multiplying the screen distance by the fusion distance value.*/
PROPORTIONAL_TO_SCREEN_DISTANCE
};
/** Set the FusionDistanceMode and Value. Note, is used only when working in stereo.*/
void setFusionDistance(FusionDistanceMode mode,float value=1.0f);
/** Get the FusionDistanceMode.*/
FusionDistanceMode getFusionDistanceMode() const { return _fusionDistanceMode; }
/** Get the FusionDistanceValue. Note, only used for USE_FUSION_DISTANCE_VALUE & PROPORTIONAL_TO_SCREEN_DISTANCE modes.*/
float getFusionDistanceValue() const { return _fusionDistanceValue; }
/** set whether the draw method should call renderer->prioritizeTexture.*/
@@ -291,20 +310,23 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
osg::ref_ptr<osgUtil::RenderGraph> _rendergraphRight;
osg::ref_ptr<osgUtil::RenderStage> _renderStageRight;
osg::ref_ptr<osg::FrameStamp> _frameStamp;
osg::ref_ptr<osg::FrameStamp> _frameStamp;
osg::Vec4 _backgroundColor;
osg::Vec4 _backgroundColor;
CullVisitor::ComputeNearFarMode _computeNearFar;
osg::CullStack::CullingMode _cullingMode;
float _LODBias;
float _smallFeatureCullingPixelSize;
CullVisitor::ComputeNearFarMode _computeNearFar;
osg::CullStack::CullingMode _cullingMode;
float _LODBias;
float _smallFeatureCullingPixelSize;
osg::ref_ptr<osg::Viewport> _viewport;
FusionDistanceMode _fusionDistanceMode;
float _fusionDistanceValue;
LightingMode _lightingMode;
osg::ref_ptr<osg::Viewport> _viewport;
LightingMode _lightingMode;
bool _prioritizeTextures;
bool _prioritizeTextures;
};