Excellent. I understood your previous post regarding how HEADLIGHT would
work in a multiple-camera single-View scenario, so thanks for clarifying
that for me. The methods you've added to View look like they'll do the trick
nicely and ease my documentation process. Thanks again.
   -Paul
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
Sent: Monday, May 07, 2007 4:03 PM
To: osg users
Subject: Re: [osg-users] SceneView in osgViewer


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
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to