Hello, 

I am writting an application wich use osgOcean Plugin.

I add to an ocean scene a submarine (imported from a 3DS file), and I would 
like to activate spot lights of this submarine.
So I attach to the submarine a light :


Code:

Vec4f lightPose(0,-1270,0,1); // le kster mesurant1.26mètres (d'après blender 
et le fichier 3ds), on met la lampe juste devant.
m_lumSpotAvant = new Light;
m_lumSpotAvant->setLightNum(1);
m_lumSpotAvant->setPosition(lightPose);
// look downard (pointed on the seabed)
m_lumSpotAvant->setDirection(Vec3f(0,0,-1));
m_lumSpotAvant->setSpotCutoff(90.0);
m_lumSpotAvant->setSpotExponent(50);
m_lumSpotAvant->setConstantAttenuation(0.1);
m_lumSpotAvant->setDiffuse(osg::Vec4(1.0f,1.0f,1.0f,1.0f));

m_spotAvant = new LightSource;
m_spotAvant->setLight(m_lumSpotAvant);
m_spotAvant->setLocalStateSetModes(osg::StateAttribute::ON);
m_spotAvant->setStateSetModes(*_rootStateSet,osg::StateAttribute::ON);
this->addChild(m_spotAvant);



Where _rootStateSet is the StateSet of the OceanScene.

There is another light in my scene, created like in the oceanExemple :

Code:

StateSet* rootStateSet = m_oceanScene->getOrCreateStateSet();
osg::LightSource* lightSource = new osg::LightSource;
osg::ref_ptr<osg::Light> light = lightSource->getLight();
light->setLightNum(0);
light->setAmbient( osg::Vec4d(0.3f, 0.3f, 0.3f, 1.0f ));
light->setDiffuse( intColor( 191, 191, 191 ,255) );
light->setSpecular(osg::Vec4d( 0.1f, 0.1f, 0.1f, 1.0f ) );
light->setPosition( osg::Vec4f(osg::Vec3f(326.573, 1212.99 ,1275.19), 1.f) ); 
// point light
lightSource->setLocalStateSetModes(osg::StateAttribute::ON);
lightSource->setStateSetModes(*rootStateSet,StateAttribute::ON);
m_oceanScene->addChild( lightSource );




When I did it, I can't see my spotlight.

I tried to do the same thing in a non osgOcean Scene, with the same lights, and 
that's work... I can see my seabed illuminated by an ambiant light, an area 
above the spot, illuminated by the spot...

So why using an OceanScene disable my lighting effects ??


Best Regards, 
A. BARRAL

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31936#31936





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to