Hi Paul,

I have now added SceneView style methods for controlling the viewer global
light, the new additions to osg::View are:

       /** 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(); }

The default LightingMode is HEADLIGHT, as per SceneView's defaults.  Method
calls that once worked with SceneView will work just
the same with osg::View or any of the classes derived from it, such as
osgViewer::Viewer.   So the following will now work:

     viewer.setLightingMode(osg::Viewer::SKY_LIGHT);
     viewer.getLight()->setDiffuse(osg::Vec4(0.9f,0.6f, 0.8f,1.0f));

CompositeViewer manages a list of View's so for this you'll just need do to
viewer.getView(0)->setLightingMode(...) etc.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to