Added s/getLightingMode and s/getLight to osg::View to allow control of the viewers

global light source.
This commit is contained in:
Robert Osfield
2007-05-07 22:07:23 +00:00
parent 6716f0d845
commit 963cd837e3
8 changed files with 123 additions and 6 deletions

View File

@@ -86,10 +86,10 @@ class OSG_EXPORT CullSettings
void setCullSettings(const CullSettings& settings) { inheritCullSettings(settings, ALL_VARIABLES); }
/** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/
void inheritCullSettings(const CullSettings& settings) { inheritCullSettings(settings, _inheritanceMask); }
virtual void inheritCullSettings(const CullSettings& settings) { inheritCullSettings(settings, _inheritanceMask); }
/** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/
void inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask);
virtual void inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask);
/** read the environmental variables.*/
void readEnvironmentalVariables();

View File

@@ -15,6 +15,7 @@
#define OSG_VIEW 1
#include <osg/Camera>
#include <osg/Light>
#include <OpenThreads/Mutex>
@@ -43,6 +44,29 @@ class OSG_EXPORT View : public osg::Object
/** Get the const Stats object.*/
const osg::Stats* getStats() const { return _stats.get(); }
/** Options for controlling the global lighting used for the view.*/
enum LightingMode
{
NO_LIGHT,
HEADLIGHT,
SKY_LIGHT
};
/** Set the global lighting to use for this view.
* Defaults to headlight. */
void setLightingMode(LightingMode lightingMode);
/** Get the global lighting used for this view.*/
LightingMode getLightingMode() const { return _lightingMode; }
/** Get the global light.*/
void setLight(osg::Light* light) { _light = light; }
/** Get the global lighting if assigned.*/
osg::Light* getLight() { return _light.get(); }
/** Get the const global lighting if assigned.*/
const osg::Light* getLight() const { return _light.get(); }
/** Set the master camera of the view. */
void setCamera(osg::Camera* camera);
@@ -109,10 +133,13 @@ class OSG_EXPORT View : public osg::Object
osg::ref_ptr<osg::Stats> _stats;
LightingMode _lightingMode;
osg::ref_ptr<osg::Light> _light;
osg::ref_ptr<osg::Camera> _camera;
typedef std::vector<Slave> Slaves;
Slaves _slaves;
typedef std::vector<Slave> Slaves;
Slaves _slaves;
};
}

View File

@@ -422,6 +422,12 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
virtual osg::Matrixd computeRightEyeProjectionImplementation(const osg::Matrixd& projection) const;
virtual osg::Matrixd computeRightEyeViewImplementation(const osg::Matrixd& view) const;
/** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/
void inheritCullSettings(const CullSettings& settings) { inheritCullSettings(settings, _inheritanceMask); }
/** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/
virtual void inheritCullSettings(const osg::CullSettings& settings, unsigned int inheritanceMask);
/** Do init traversal of attached scene graph using Init NodeVisitor.
* The init traversal is called once for each SceneView, and should