1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-04 05:45:35 +00:00

corrected the light problem

This commit is contained in:
gugus 2012-02-08 00:32:22 +01:00 committed by Marc Zinnschlag
parent ee02154805
commit 597e670eef
2 changed files with 10 additions and 4 deletions

View file

@ -54,10 +54,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
cameraPitchNode->attachObject(mRendering.getCamera()); cameraPitchNode->attachObject(mRendering.getCamera());
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode); mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
mSun = 0;
} }
RenderingManager::~RenderingManager () RenderingManager::~RenderingManager ()
{ {
//TODO: destroy mSun?
delete mPlayer; delete mPlayer;
delete mSkyManager; delete mSkyManager;
} }
@ -204,12 +206,15 @@ void RenderingManager::configureAmbient(ESMS::CellStore<MWWorld::RefData> &mCell
// Create a "sun" that shines light downwards. It doesn't look // Create a "sun" that shines light downwards. It doesn't look
// completely right, but leave it for now. // completely right, but leave it for now.
Ogre::Light *light = mRendering.getScene()->createLight(); if(!mSun)
{
mSun = mRendering.getScene()->createLight();
}
Ogre::ColourValue colour; Ogre::ColourValue colour;
colour.setAsABGR (mCell.cell->ambi.sunlight); colour.setAsABGR (mCell.cell->ambi.sunlight);
light->setDiffuseColour (colour); mSun->setDiffuseColour (colour);
light->setType(Ogre::Light::LT_DIRECTIONAL); mSun->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDirection(0,-1,0); mSun->setDirection(0,-1,0);
} }
// Switch through lighting modes. // Switch through lighting modes.

View file

@ -118,6 +118,7 @@ class RenderingManager: private RenderingInterface {
int mAmbientMode; int mAmbientMode;
Ogre::ColourValue mAmbientColor; Ogre::ColourValue mAmbientColor;
Ogre::Light* mSun;
/// Root node for all objects added to the scene. This is rotated so /// Root node for all objects added to the scene. This is rotated so
/// that the OGRE coordinate system matches that used internally in /// that the OGRE coordinate system matches that used internally in