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

@@ -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;
};
}