Hi Miguel.

On 6/21/07, Miguel Martinez <[EMAIL PROTECTED]> wrote:
Hi all, whe using osgProducer::Viewer I setup the default lighting like this

viewer->setUpViewer( osgProducer::Viewer::STATE_MANIPULATOR|
                            osgProducer::Viewer::SKY_LIGHT_SOURCE);

What is the SKY_LIGHT_SOURCE equivalent for osgViewer ??

The osg::View class that osgViewer::Viewer inherits from (via
osgViewer::View) provides the following methods for control of default
lighting:


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

So you can do:

 viewer.setLightingMode(osg::View::SKY_LIGHT);

To add the StateSetmanipulator you do:

   viewer.addEventHandler( new
osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet())
);

While this is a little more verbose than the old osgProducer::Viewer,
the new osgViewer::Viewer is much more configurable than the old
viewer.

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

Reply via email to