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:
parent
6ff24b338f
commit
f574d0dd68
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -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.*/
|
||||
@ -300,6 +319,9 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
float _LODBias;
|
||||
float _smallFeatureCullingPixelSize;
|
||||
|
||||
FusionDistanceMode _fusionDistanceMode;
|
||||
float _fusionDistanceValue;
|
||||
|
||||
osg::ref_ptr<osg::Viewport> _viewport;
|
||||
|
||||
LightingMode _lightingMode;
|
||||
|
@ -27,6 +27,9 @@ SceneView::SceneView(DisplaySettings* ds)
|
||||
_LODBias = 1.0f;
|
||||
_smallFeatureCullingPixelSize = 3.0f;
|
||||
|
||||
_fusionDistanceMode = USE_CAMERA_FUSION_DISTANCE;
|
||||
_fusionDistanceValue = 1.0f;
|
||||
|
||||
_lightingMode=HEADLIGHT;
|
||||
|
||||
_prioritizeTextures = false;
|
||||
@ -217,11 +220,21 @@ void SceneView::cull()
|
||||
{
|
||||
|
||||
float fusionDistance = _displaySettings->getScreenDistance();
|
||||
|
||||
switch(_fusionDistanceMode)
|
||||
{
|
||||
case(USE_CAMERA_FUSION_DISTANCE):
|
||||
if (_camera.valid())
|
||||
{
|
||||
fusionDistance = _camera->getFusionDistance();
|
||||
}
|
||||
break;
|
||||
case(USE_FUSION_DISTANCE_VALUE):
|
||||
fusionDistance = _fusionDistanceValue;
|
||||
break;
|
||||
case(PROPORTIONAL_TO_SCREEN_DISTANCE):
|
||||
fusionDistance *= _fusionDistanceValue;
|
||||
break;
|
||||
}
|
||||
|
||||
float iod = _displaySettings->getEyeSeparation();
|
||||
float sd = _displaySettings->getScreenDistance();
|
||||
|
Loading…
Reference in New Issue
Block a user