FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
rendererbase.h
1 /***************************************************************************
2  * Copyright (C) 2005-2008 by the FIFE team *
3  * http://www.fifengine.de *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_RENDERERBASE_H
23 #define FIFE_RENDERERBASE_H
24 
25 // Standard C++ library includes
26 #include <list>
27 #include <vector>
28 
29 // 3rd party library includes
30 
31 // FIFE includes
32 // These includes are split up in two parts, separated by one empty line
33 // First block: files included from the FIFE root src directory
34 // Second block: files included from the same folder
35 
36 #include "renderitem.h"
37 
38 namespace FIFE {
39  class Camera;
40  class Layer;
41  class Map;
42  class Instance;
43  class RenderBackend;
44 
45  class RendererBase;
51  public:
52  virtual ~IRendererListener() {}
53 
56  virtual void onRendererPipelinePositionChanged(RendererBase* renderer) = 0;
57 
60  virtual void onRendererEnabledChanged(RendererBase* renderer) = 0;
61  };
62 
67  public:
68  virtual ~IRendererContainer() {}
69 
72  virtual RendererBase* getRenderer(const std::string& renderername) = 0;
73  };
74 
78  class RendererBase {
79  public:
84  RendererBase(RenderBackend* renderbackend, int32_t position);
85 
88  RendererBase(const RendererBase& old);
89 
92  virtual RendererBase* clone() = 0;
93 
96  virtual ~RendererBase() {};
97 
109  virtual void render(Camera* cam, Layer* layer, RenderList& instances) = 0;
110 
113  virtual std::string getName() = 0;
114 
117  int32_t getPipelinePosition() const { return m_pipeline_position; }
118 
124  void setPipelinePosition(int32_t position);
125 
128  virtual void setEnabled(bool enabled);
129 
132  virtual void reset() {}
133 
136  bool isEnabled() const { return m_enabled; }
137 
140  void setRendererListener(IRendererListener* listener) { m_listener = listener; }
141 
144  void addActiveLayer(Layer* layer);
145 
148  void removeActiveLayer(Layer* layer);
149 
152  void clearActiveLayers();
153 
156  void activateAllLayers(Map* elevation);
157 
160  bool isActivedLayer(Layer* layer);
161 
164  std::list<Layer*> getActiveLayers() const {return m_active_layers;}
165 
166 
167  protected:
168  RendererBase();
169 
170  std::list<Layer*> m_active_layers;
171  RenderBackend* m_renderbackend;
172 
173  private:
174  bool m_enabled;
175  int32_t m_pipeline_position;
176  IRendererListener* m_listener;
177  };
178 }
179 
180 #endif
virtual void render(Camera *cam, Layer *layer, RenderList &instances)=0
virtual ~RendererBase()
Definition: rendererbase.h:96
void removeActiveLayer(Layer *layer)
void activateAllLayers(Map *elevation)
bool isEnabled() const
Definition: rendererbase.h:136
virtual RendererBase * getRenderer(const std::string &renderername)=0
void addActiveLayer(Layer *layer)
virtual void onRendererEnabledChanged(RendererBase *renderer)=0
void setPipelinePosition(int32_t position)
virtual void reset()
Definition: rendererbase.h:132
bool isActivedLayer(Layer *layer)
virtual RendererBase * clone()=0
std::list< Layer * > getActiveLayers() const
Definition: rendererbase.h:164
virtual void setEnabled(bool enabled)
void setRendererListener(IRendererListener *listener)
Definition: rendererbase.h:140
virtual std::string getName()=0
Definition: map.h:86
int32_t getPipelinePosition() const
Definition: rendererbase.h:117
virtual void onRendererPipelinePositionChanged(RendererBase *renderer)=0