Hi Fabrice,
On Mon, 2007-09-10 at 16:34 +0200, Decle Fabrice wrote:
> I've tried setting the light bounding volume, but no changes.. :(
> My light is at the root of the graph, and it is a pointLight.
>
> it happens on every scene, even a simple torus..
>
> Here is the code of my scene:
>
> NodePtr createScene()
> {
> scene = makeTorus (0.5, 2, 16, 16);
>
> // set the beacons
> cam = PerspectiveCamera::create();
> camBeacon = Node::create();
>
> beginEditCP(camBeacon);
> {
> camXform = Transform::create();
> camBeacon->setCore(camXform);
> }
> endEditCP(camBeacon);
>
> // CAMERA
> beginEditCP(cam);
> {
> cam->setBeacon(camBeacon);
> cam->setFov(deg2rad(45));
> cam->setNear(0.01);
> cam->setFar(5000);
> }
> endEditCP(cam);
>
> // LIGHT
>
> PointLightPtr pLight = PointLight::create();
>
> beginEditCP(pLight);
> {
> pLight->setBeacon(camBeacon);
> pLight->setPosition(Vec3f( 0, 0,0));
> pLight->setDiffuse(Color4f(1,1,1,1));
> pLight->setAmbient(Color4f(0.2,0.2,0.2,1));
> pLight->setSpecular(Color4f(1,1,1,1));
> }
> endEditCP (pLight);
>
> NodePtr lightNode = Node::create();
> beginEditCP(lightNode);
> {
> lightNode->setCore(pLight);
> lightNode->getVolume(true).setInfinite(true);
> }
> endEditCP(lightNode);
>
> // Root node
> NodePtr locscene = Node::create();
> objects = Node::create();
>
> _xObject = Transform::create();
>
> beginEditCP(objects, Node::CoreFieldMask |
> Node::ChildrenFieldMask);
> {
> objects->setCore(_xObject);
> objects->addChild (scene);
> }
> endEditCP(objects, Node::CoreFieldMask | Node::ChildrenFieldMask);
>
> beginEditCP(locscene, Node::CoreFieldMask |
> Node::ChildrenFieldMask);
> {
> locscene->setCore(Group::create());
> locscene->addChild(lightNode);
> locscene->addChild(scene);
^^^^^^^^^^^
you can not add "scene" to "locscene" and "objects". Nodes in OpenSG
have a single parent. You can share the NodeCore between Nodes though,
so you can have the same torus appear at different locations in your
scene (use makeTorusGeo to get the Geometry NodeCore).
> locscene->addChild(camBeacon);
> }
> endEditCP (locscene, Node::CoreFieldMask |
> Node::ChildrenFieldMask);
>
> return locscene;
> }
locscene returned here looks like this:
locSceen[Group]
|
|-----------------------+-- ...
| |
lightNode[PointLight] scene[Geometry]
but as Dirk explained lights are supposed to only affect the tree below
them, so "scene" should actually never be lit (I'm not sure why it is,
might be bug in there).
If you move "scene" to be a child of "lightNode", things should work and
your scene should be lit.
Hope it helps,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users