light->getLight()->setPosition(osg::Vec4f(0.0, 0.0, 0.0, 1.0));
---------------------------------------------------------^
There is a full API (osg::Light - the thing pointed to when you call light->getLight() in your code), for setting spot light parameters.
-don
On 10/20/06, Jean-Sebastien Guay <[EMAIL PROTECTED]> wrote:
Hello,
This is my first project using OSG. I have used other scene graphs before but
each one works a bit differently. I am trying to get a hold of the OSG scene
graph conventions, and something is happening that seems weird to me.
I am trying to use a PositionAttitudeTransform to place a LightSource node at
(-2, 2, 0) in the scene, but it doesn't seem to have any effect. What am I
doing wrong?
Here's the code I'm using to create the scene. It's just a unit sphere centered
at the origin and the light source, which I want at (-2, 2, 0).
--------------------------- code ---------------------------
osg::ref_ptr<osg::Node> scene = new osg::Group;
osg::ref_ptr<osg::Shape> sphere = new osg::Sphere(osg::Vec3f( 0.0, 0.0, 0.0),
1.0);
osg::ref_ptr<osg::ShapeDrawable> sphereDrawable = new
osg::ShapeDrawable(sphere.get());
osg::ref_ptr<osg::Geode> sphereGeode = new osg::Geode;
sphereGeode->addDrawable( sphereDrawable.get());
osg::ref_ptr<osg::PositionAttitudeTransform> lightTransform = new
osg::PositionAttitudeTransform;
lightTransform->setPosition(osg::Vec3d(-2.0, 2.0, 0.0));
osg::ref_ptr<osg::LightSource> light = new osg::LightSource;
light->getLight()->setPosition(osg::Vec4f(0.0, 0.0, 0.0, 0.0));
lightTransform->addChild(light.get());
scene.get()->asGroup()->addChild(lightTransform.get());
scene.get()->asGroup()->addChild( sphereGeode.get());
--------------------------- code ---------------------------
It's all very basic, but without any real documentation on how this works, I
have to ask...
Note that I set the light's internal position to (0,0,0) so that the PAT would
place it exactly where I want. At least that's what I think should happen.
And another question about light sources, how do you specify if the light is a
point light, a directional light or a spot light?
Thanks in advance,
J-S
--
______________________________________________________
Jean-Sebastien Guay [EMAIL PROTECTED]
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
