FIFE
2008.0
|
00001 /*************************************************************************** 00002 * Copyright (C) 2005-2008 by the FIFE team * 00003 * http://www.fifengine.de * 00004 * This file is part of FIFE. * 00005 * * 00006 * FIFE is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Lesser General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2.1 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library; if not, write to the * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00020 ***************************************************************************/ 00021 00022 #ifndef FIFE_RENDERERBASE_H 00023 #define FIFE_RENDERERBASE_H 00024 00025 // Standard C++ library includes 00026 #include <list> 00027 #include <vector> 00028 00029 // 3rd party library includes 00030 00031 // FIFE includes 00032 // These includes are split up in two parts, separated by one empty line 00033 // First block: files included from the FIFE root src directory 00034 // Second block: files included from the same folder 00035 00036 #include "renderitem.h" 00037 00038 namespace FIFE { 00039 class Camera; 00040 class Layer; 00041 class Map; 00042 class Instance; 00043 class RenderBackend; 00044 00045 class RendererBase; 00050 class IRendererListener { 00051 public: 00052 virtual ~IRendererListener() {} 00053 00056 virtual void onRendererPipelinePositionChanged(RendererBase* renderer) = 0; 00057 00060 virtual void onRendererEnabledChanged(RendererBase* renderer) = 0; 00061 }; 00062 00066 class IRendererContainer { 00067 public: 00068 virtual ~IRendererContainer() {} 00069 00072 virtual RendererBase* getRenderer(const std::string& renderername) = 0; 00073 }; 00074 00078 class RendererBase { 00079 public: 00084 RendererBase(RenderBackend* renderbackend, int position); 00085 00088 RendererBase(const RendererBase& old); 00089 00092 virtual RendererBase* clone() = 0; 00093 00096 virtual ~RendererBase() {}; 00097 00109 virtual void render(Camera* cam, Layer* layer, RenderList& instances) = 0; 00110 00113 virtual std::string getName() = 0; 00114 00117 int getPipelinePosition() const { return m_pipeline_position; } 00118 00124 void setPipelinePosition(int position); 00125 00128 virtual void setEnabled(bool enabled); 00129 00132 virtual void reset() {} 00133 00136 bool isEnabled() const { return m_enabled; } 00137 00140 void setRendererListener(IRendererListener* listener) { m_listener = listener; } 00141 00144 void addActiveLayer(Layer* layer); 00145 00148 void removeActiveLayer(Layer* layer); 00149 00152 void clearActiveLayers(); 00153 00156 void activateAllLayers(Map* elevation); 00157 00160 bool isActivedLayer(Layer* layer); 00161 00164 std::list<Layer*> getActiveLayers() const {return m_active_layers;} 00165 00166 00167 protected: 00168 RendererBase(); 00169 00170 std::list<Layer*> m_active_layers; 00171 RenderBackend* m_renderbackend; 00172 00173 private: 00174 bool m_enabled; 00175 int m_pipeline_position; 00176 IRendererListener* m_listener; 00177 }; 00178 } 00179 00180 #endif