Added SceneView::Options for SceneView::setDefaults(options) and

OsgCameraGroup::setRealizeSceneViewOptions(options) to allow better control
of what functionality is compiled in by default.
This commit is contained in:
Robert Osfield
2004-07-20 10:17:22 +00:00
parent aed65903db
commit 3bca9ec9cf
4 changed files with 62 additions and 32 deletions

View File

@@ -116,10 +116,15 @@ class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup
float getLODScale() const { return _LODScale; }
void setFusionDistance( osgUtil::SceneView::FusionDistanceMode mode,float value=1.0f);
/** Set the options to set up SceneView with, see osgUtil::SceneView::Options for available options.*/
void setRealizeSceneViewOptions(unsigned int options) { _realizeSceneViewOptions = options; }
unsigned int getRealizeSceneViewOptions() { return _realizeSceneViewOptions; }
/** RealizeCallback class one should override to provide an the implemention of realize callbacks.
* Note, this callback overrides the normal call to OsgSceneHandler::init() so it become the your
* responisibility to call this within your callback if required, it is a safe assumption to
@@ -184,6 +189,8 @@ class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup
osgUtil::SceneView::FusionDistanceMode _fusionDistanceMode;
float _fusionDistanceValue;
unsigned int _realizeSceneViewOptions;
SceneHandlerList _shvec;

View File

@@ -38,10 +38,20 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
/** Construct a default scene view.*/
SceneView(osg::DisplaySettings* ds=NULL);
enum Options
{
NO_SCENEVIEW_LIGHT = 0x0,
HEADLIGHT = 0x1,
SKY_LIGHT = 0x2,
COMPILE_GLOBJECTS_AT_INIT = 0x4,
STANDARD_SETTINGS = HEADLIGHT |
COMPILE_GLOBJECTS_AT_INIT
};
/** Set scene view to use default global state, light, camera
* and render visitor.
*/
void setDefaults();
void setDefaults(unsigned int options = STANDARD_SETTINGS);
/** Set the data which to view. The data will typically be
* an osg::Scene but can be any osg::Node type.
@@ -121,12 +131,15 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
osg::StateSet* getLocalStateSet() { return _localStateSet.get(); }
const osg::StateSet* getLocalStateSet() const { return _localStateSet.get(); }
#if 1
typedef Options LightingMode;
#else
enum LightingMode {
HEADLIGHT, // default
SKY_LIGHT,
NO_SCENEVIEW_LIGHT
};
#endif
void setLightingMode(LightingMode mode) { _lightingMode=mode; }
LightingMode getLightingMode() const { return _lightingMode; }