diff engine/core/controller/engine.cpp @ 661:e3140f01749d

* Merged the light branch back into trunk. * Modified the demos so they work with the new loaders and setting.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 05 Nov 2010 15:21:10 +0000
parents 5d6b1820b953
children 3944096d12ce
line wrap: on
line diff
--- a/engine/core/controller/engine.cpp	Wed Nov 03 13:44:12 2010 +0000
+++ b/engine/core/controller/engine.cpp	Fri Nov 05 15:21:10 2010 +0000
@@ -51,6 +51,7 @@
 #include "video/cursor.h"
 #include "video/devicecaps.h"
 #ifdef HAVE_OPENGL
+#include "video/opengl/fife_opengl.h"
 #include "video/opengl/renderbackendopengl.h"
 #include "gui/base/opengl/opengl_gui_graphics.h"
 #endif
@@ -74,6 +75,7 @@
 #include "view/renderers/cellselectionrenderer.h"
 #include "view/renderers/blockinginforenderer.h"
 #include "view/renderers/genericrenderer.h"
+#include "view/renderers/lightrenderer.h"
 #include "video/image.h"
 #include "gui/console/console.h"
 #include "engine.h"
@@ -256,6 +258,11 @@
 		if( rbackend != "SDL" ) {
 			m_gui_graphics = new OpenGLGuiGraphics(*m_imagepool);
 		}
+
+		if (m_settings.getLightingModel() != 0) {
+			m_renderbackend->setLightingModel(m_settings.getLightingModel());
+		}
+
 #endif
 		if( rbackend == "SDL" ) {
 			m_gui_graphics = new SdlGuiGraphics(*m_imagepool);
@@ -289,6 +296,7 @@
 		m_renderers.push_back(new QuadTreeRenderer(m_renderbackend, 60));
 		m_renderers.push_back(new CoordinateRenderer(m_renderbackend, 70, dynamic_cast<AbstractFont*>(m_defaultfont)));
 		m_renderers.push_back(new GenericRenderer(m_renderbackend, 80, m_imagepool, m_animpool));
+		m_renderers.push_back(new LightRenderer(m_renderbackend, 90, m_imagepool, m_animpool));
 
 		FL_LOG(_log, "Creating model");
 		m_model = new Model(m_renderbackend, m_renderers, m_imagepool, m_animpool);
@@ -358,8 +366,18 @@
 		m_renderbackend->startFrame();
 		m_timemanager->update();
 		m_model->update();
+#ifdef HAVE_OPENGL
+		if (m_settings.getLightingModel() == 1) {
+			m_renderbackend->disableLighting();
+		}
+#endif
 		m_guimanager->turn();
 		m_cursor->draw();
+#ifdef HAVE_OPENGL
+		if (m_settings.getLightingModel() == 1) {
+			m_renderbackend->enableLighting();
+		}
+#endif
 		m_renderbackend->endFrame();
 	}