forked from teamnwah/openmw-tes3coop
Fix light direction
This commit is contained in:
parent
8b768f4377
commit
820f4a2688
4 changed files with 6 additions and 5 deletions
|
@ -13,7 +13,7 @@ void CSVRender::LightingBright::activate (osg::Group* rootNode)
|
||||||
|
|
||||||
osg::ref_ptr<osg::Light> light (new osg::Light);
|
osg::ref_ptr<osg::Light> light (new osg::Light);
|
||||||
light->setAmbient(osg::Vec4f(0.f, 0.f, 0.f, 1.f));
|
light->setAmbient(osg::Vec4f(0.f, 0.f, 0.f, 1.f));
|
||||||
light->setDirection(osg::Vec3f(0.f, 0.f, -1.f));
|
light->setPosition(osg::Vec4f(0.f, 0.f, 1.f, 0.f));
|
||||||
light->setDiffuse(osg::Vec4f(1.f, 1.f, 1.f, 1.f));
|
light->setDiffuse(osg::Vec4f(1.f, 1.f, 1.f, 1.f));
|
||||||
light->setSpecular(osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
light->setSpecular(osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||||
light->setConstantAttenuation(1.f);
|
light->setConstantAttenuation(1.f);
|
||||||
|
|
|
@ -11,7 +11,7 @@ void CSVRender::LightingDay::activate (osg::Group* rootNode)
|
||||||
mLightSource = new osg::LightSource;
|
mLightSource = new osg::LightSource;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Light> light (new osg::Light);
|
osg::ref_ptr<osg::Light> light (new osg::Light);
|
||||||
light->setDirection(osg::Vec3f(0.f, 0.f, -1.f));
|
light->setPosition(osg::Vec4f(0.f, 0.f, 1.f, 0.f));
|
||||||
light->setAmbient(osg::Vec4f(0.f, 0.f, 0.f, 1.f));
|
light->setAmbient(osg::Vec4f(0.f, 0.f, 0.f, 1.f));
|
||||||
light->setDiffuse(osg::Vec4f(1.f, 1.f, 1.f, 1.f));
|
light->setDiffuse(osg::Vec4f(1.f, 1.f, 1.f, 1.f));
|
||||||
light->setSpecular(osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
light->setSpecular(osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||||
|
|
|
@ -11,7 +11,7 @@ void CSVRender::LightingNight::activate (osg::Group* rootNode)
|
||||||
mLightSource = new osg::LightSource;
|
mLightSource = new osg::LightSource;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Light> light (new osg::Light);
|
osg::ref_ptr<osg::Light> light (new osg::Light);
|
||||||
light->setDirection(osg::Vec3f(0.f, 0.f, -1.f));
|
light->setPosition(osg::Vec4f(0.f, 0.f, 1.f, 0.f));
|
||||||
light->setAmbient(osg::Vec4f(0.f, 0.f, 0.f, 1.f));
|
light->setAmbient(osg::Vec4f(0.f, 0.f, 0.f, 1.f));
|
||||||
light->setDiffuse(osg::Vec4f(0.2f, 0.2f, 0.2f, 1.f));
|
light->setDiffuse(osg::Vec4f(0.2f, 0.2f, 0.2f, 1.f));
|
||||||
light->setSpecular(osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
light->setSpecular(osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||||
|
|
|
@ -178,9 +178,10 @@ namespace MWRender
|
||||||
|
|
||||||
void RenderingManager::setSunDirection(const osg::Vec3f &direction)
|
void RenderingManager::setSunDirection(const osg::Vec3f &direction)
|
||||||
{
|
{
|
||||||
mSunLight->setDirection(direction*-1);
|
osg::Vec3 position = direction * -1;
|
||||||
|
mSunLight->setPosition(osg::Vec4(position.x(), position.y(), position.z(), 0));
|
||||||
|
|
||||||
mSky->setSunDirection(direction*-1);
|
mSky->setSunDirection(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec3f RenderingManager::getEyePos()
|
osg::Vec3f RenderingManager::getEyePos()
|
||||||
|
|
Loading…
Reference in a new issue