From 597e670eef30025c1e49303dc5ed0afaf87a5304 Mon Sep 17 00:00:00 2001 From: gugus Date: Wed, 8 Feb 2012 00:32:22 +0100 Subject: [PATCH] corrected the light problem --- apps/openmw/mwrender/renderingmanager.cpp | 13 +++++++++---- apps/openmw/mwrender/renderingmanager.hpp | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index c5cf8be5d..bc33951e7 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -54,10 +54,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const cameraPitchNode->attachObject(mRendering.getCamera()); mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode); + mSun = 0; } RenderingManager::~RenderingManager () { + //TODO: destroy mSun? delete mPlayer; delete mSkyManager; } @@ -204,12 +206,15 @@ void RenderingManager::configureAmbient(ESMS::CellStore &mCell // Create a "sun" that shines light downwards. It doesn't look // completely right, but leave it for now. - Ogre::Light *light = mRendering.getScene()->createLight(); + if(!mSun) + { + mSun = mRendering.getScene()->createLight(); + } Ogre::ColourValue colour; colour.setAsABGR (mCell.cell->ambi.sunlight); - light->setDiffuseColour (colour); - light->setType(Ogre::Light::LT_DIRECTIONAL); - light->setDirection(0,-1,0); + mSun->setDiffuseColour (colour); + mSun->setType(Ogre::Light::LT_DIRECTIONAL); + mSun->setDirection(0,-1,0); } // Switch through lighting modes. diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 084f89cb0..ca5d95a3f 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -118,6 +118,7 @@ class RenderingManager: private RenderingInterface { int mAmbientMode; Ogre::ColourValue mAmbientColor; + Ogre::Light* mSun; /// Root node for all objects added to the scene. This is rotated so /// that the OGRE coordinate system matches that used internally in