22 #ifndef FIFE_INSTANCERENDERER_H
23 #define FIFE_INSTANCERENDERER_H
35 #include "view/rendererbase.h"
36 #include "util/time/timer.h"
41 class InstanceDeleteListener;
43 class InstanceRenderer:
public RendererBase {
50 InstanceRenderer(RenderBackend* renderbackend, int32_t position);
52 InstanceRenderer(
const InstanceRenderer& old);
58 virtual ~InstanceRenderer();
59 void render(Camera* cam, Layer* layer, RenderList& instances);
60 std::string getName() {
return "InstanceRenderer"; }
64 void addOutlined(Instance* instance, int32_t r, int32_t g, int32_t b, int32_t width, int32_t threshold = 1);
68 void addColored(Instance* instance, int32_t r, int32_t g, int32_t b);
72 void addTransparentArea(Instance* instance,
const std::list<std::string> &groups, uint32_t w, uint32_t h, uint8_t trans,
bool front =
true);
76 void removeOutlined(Instance* instance);
80 void removeColored(Instance* instance);
84 void removeTransparentArea(Instance* instance);
88 void removeAllOutlines();
92 void removeAllColored();
96 void removeAllTransparentAreas();
101 void addIgnoreLight(
const std::list<std::string> &groups);
105 void removeIgnoreLight(
const std::list<std::string> &groups);
109 void removeAllIgnoreLight();
113 static InstanceRenderer* getInstance(IRendererContainer* cnt);
117 RenderBackend* getRenderBackend()
const {
return m_renderbackend;}
125 void setRemoveInterval(uint32_t interval);
129 uint32_t getRemoveInterval()
const;
134 void addToCheck(
const ImagePtr& image);
143 void removeInstance(Instance* instance);
147 bool needColorBinding() {
return m_need_bind_coloring; }
152 bool m_timer_enabled;
153 std::list<std::string> m_unlit_groups;
155 bool m_need_bind_coloring;
157 enum InstanceRendererEffect {
163 typedef uint8_t Effect;
176 InstanceRenderer* renderer;
177 OutlineInfo(InstanceRenderer* r);
189 InstanceRenderer* renderer;
190 ColoringInfo(InstanceRenderer* r);
196 std::list<std::string> groups;
205 typedef std::map<Instance*, OutlineInfo> InstanceToOutlines_t;
206 typedef std::map<Instance*, ColoringInfo> InstanceToColoring_t;
207 typedef std::map<Instance*, AreaInfo> InstanceToAreas_t;
209 InstanceToOutlines_t m_instance_outlines;
210 InstanceToColoring_t m_instance_colorings;
211 InstanceToAreas_t m_instance_areas;
218 typedef std::list<s_image_entry> ImagesToCheck_t;
220 ImagesToCheck_t m_check_images;
225 InstanceDeleteListener* m_delete_listener;
226 typedef std::map<Instance*, Effect> InstanceToEffects_t;
227 InstanceToEffects_t m_assigned_instances;
231 Image* bindOutline(OutlineInfo& info, RenderItem& vc, Camera* cam);
232 Image* bindColoring(ColoringInfo& info, RenderItem& vc, Camera* cam);
234 void renderUnsorted(Camera* cam, Layer* layer, RenderList& instances);
235 void renderAlreadySorted(Camera* cam, Layer* layer, RenderList& instances);
237 void removeFromCheck(
const ImagePtr& image);
238 bool isValidImage(
const ImagePtr& image);
RendererBase(RenderBackend *renderbackend, int32_t position)
credit to phoku for his NodeDisplay example which the visitor code is adapted from ( he coded the qua...