comparison 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
comparison
equal deleted inserted replaced
660:b0733d998d0f 661:e3140f01749d
49 #include "audio/soundclippool.h" 49 #include "audio/soundclippool.h"
50 #include "video/renderbackend.h" 50 #include "video/renderbackend.h"
51 #include "video/cursor.h" 51 #include "video/cursor.h"
52 #include "video/devicecaps.h" 52 #include "video/devicecaps.h"
53 #ifdef HAVE_OPENGL 53 #ifdef HAVE_OPENGL
54 #include "video/opengl/fife_opengl.h"
54 #include "video/opengl/renderbackendopengl.h" 55 #include "video/opengl/renderbackendopengl.h"
55 #include "gui/base/opengl/opengl_gui_graphics.h" 56 #include "gui/base/opengl/opengl_gui_graphics.h"
56 #endif 57 #endif
57 #include "gui/base/sdl/sdl_gui_graphics.h" 58 #include "gui/base/sdl/sdl_gui_graphics.h"
58 #include "gui/base/gui_font.h" 59 #include "gui/base/gui_font.h"
72 #include "view/renderers/coordinaterenderer.h" 73 #include "view/renderers/coordinaterenderer.h"
73 #include "view/renderers/floatingtextrenderer.h" 74 #include "view/renderers/floatingtextrenderer.h"
74 #include "view/renderers/cellselectionrenderer.h" 75 #include "view/renderers/cellselectionrenderer.h"
75 #include "view/renderers/blockinginforenderer.h" 76 #include "view/renderers/blockinginforenderer.h"
76 #include "view/renderers/genericrenderer.h" 77 #include "view/renderers/genericrenderer.h"
78 #include "view/renderers/lightrenderer.h"
77 #include "video/image.h" 79 #include "video/image.h"
78 #include "gui/console/console.h" 80 #include "gui/console/console.h"
79 #include "engine.h" 81 #include "engine.h"
80 82
81 #ifdef USE_COCOA 83 #ifdef USE_COCOA
254 256
255 #ifdef HAVE_OPENGL 257 #ifdef HAVE_OPENGL
256 if( rbackend != "SDL" ) { 258 if( rbackend != "SDL" ) {
257 m_gui_graphics = new OpenGLGuiGraphics(*m_imagepool); 259 m_gui_graphics = new OpenGLGuiGraphics(*m_imagepool);
258 } 260 }
261
262 if (m_settings.getLightingModel() != 0) {
263 m_renderbackend->setLightingModel(m_settings.getLightingModel());
264 }
265
259 #endif 266 #endif
260 if( rbackend == "SDL" ) { 267 if( rbackend == "SDL" ) {
261 m_gui_graphics = new SdlGuiGraphics(*m_imagepool); 268 m_gui_graphics = new SdlGuiGraphics(*m_imagepool);
262 } 269 }
263 FL_LOG(_log, "Constructing GUI manager"); 270 FL_LOG(_log, "Constructing GUI manager");
287 m_renderers.push_back(new BlockingInfoRenderer(m_renderbackend, 40)); 294 m_renderers.push_back(new BlockingInfoRenderer(m_renderbackend, 40));
288 m_renderers.push_back(new FloatingTextRenderer(m_renderbackend, 50, dynamic_cast<AbstractFont*>(m_defaultfont))); 295 m_renderers.push_back(new FloatingTextRenderer(m_renderbackend, 50, dynamic_cast<AbstractFont*>(m_defaultfont)));
289 m_renderers.push_back(new QuadTreeRenderer(m_renderbackend, 60)); 296 m_renderers.push_back(new QuadTreeRenderer(m_renderbackend, 60));
290 m_renderers.push_back(new CoordinateRenderer(m_renderbackend, 70, dynamic_cast<AbstractFont*>(m_defaultfont))); 297 m_renderers.push_back(new CoordinateRenderer(m_renderbackend, 70, dynamic_cast<AbstractFont*>(m_defaultfont)));
291 m_renderers.push_back(new GenericRenderer(m_renderbackend, 80, m_imagepool, m_animpool)); 298 m_renderers.push_back(new GenericRenderer(m_renderbackend, 80, m_imagepool, m_animpool));
299 m_renderers.push_back(new LightRenderer(m_renderbackend, 90, m_imagepool, m_animpool));
292 300
293 FL_LOG(_log, "Creating model"); 301 FL_LOG(_log, "Creating model");
294 m_model = new Model(m_renderbackend, m_renderers, m_imagepool, m_animpool); 302 m_model = new Model(m_renderbackend, m_renderers, m_imagepool, m_animpool);
295 FL_LOG(_log, "Adding pathers to model"); 303 FL_LOG(_log, "Adding pathers to model");
296 m_model->adoptPather(new RoutePather()); 304 m_model->adoptPather(new RoutePather());
356 void Engine::pump() { 364 void Engine::pump() {
357 m_eventmanager->processEvents(); 365 m_eventmanager->processEvents();
358 m_renderbackend->startFrame(); 366 m_renderbackend->startFrame();
359 m_timemanager->update(); 367 m_timemanager->update();
360 m_model->update(); 368 m_model->update();
369 #ifdef HAVE_OPENGL
370 if (m_settings.getLightingModel() == 1) {
371 m_renderbackend->disableLighting();
372 }
373 #endif
361 m_guimanager->turn(); 374 m_guimanager->turn();
362 m_cursor->draw(); 375 m_cursor->draw();
376 #ifdef HAVE_OPENGL
377 if (m_settings.getLightingModel() == 1) {
378 m_renderbackend->enableLighting();
379 }
380 #endif
363 m_renderbackend->endFrame(); 381 m_renderbackend->endFrame();
364 } 382 }
365 383
366 void Engine::finalizePumping() { 384 void Engine::finalizePumping() {
367 // nothing here at the moment.. 385 // nothing here at the moment..