instancerenderer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_INSTANCERENDERER_H
00023 #define FIFE_INSTANCERENDERER_H
00024
00025
00026 #include <string>
00027 #include <list>
00028
00029
00030
00031
00032
00033
00034
00035 #include "view/rendererbase.h"
00036
00037 namespace FIFE {
00038 class Location;
00039 class RenderBackend;
00040 class ImagePool;
00041 class AnimationPool;
00042
00043 class InstanceRenderer: public RendererBase {
00044 public:
00050 InstanceRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool);
00051
00052 InstanceRenderer(const InstanceRenderer& old);
00053
00054 RendererBase* clone();
00055
00058 virtual ~InstanceRenderer();
00059 void render(Camera* cam, Layer* layer, RenderList& instances);
00060 std::string getName() { return "InstanceRenderer"; }
00061
00064 void addOutlined(Instance* instance, int r, int g, int b, int width);
00065
00068 void addColored(Instance* instance, int r, int g, int b);
00069
00072 void addTransparentArea(Instance* instance, const std::list<std::string> &groups, unsigned int w, unsigned int h, unsigned char trans, bool front = true);
00073
00076 void removeOutlined(Instance* instance);
00077
00080 void removeColored(Instance* instance);
00081
00084 void removeTransparentArea(Instance* instance);
00085
00088 void removeAllOutlines();
00089
00092 void removeAllColored();
00093
00096 void removeAllTransparentAreas();
00097
00101 void addIgnoreLight(const std::list<std::string> &groups);
00102
00105 void removeIgnoreLight(const std::list<std::string> &groups);
00106
00109 void removeAllIgnoreLight();
00110
00113 static InstanceRenderer* getInstance(IRendererContainer* cnt);
00114
00117 RenderBackend* getRenderBackend() const {return m_renderbackend;}
00118
00119 void reset();
00120
00121 private:
00122 ImagePool* m_imagepool;
00123 AnimationPool* m_animationpool;
00124 bool m_area_layer;
00125 std::list<std::string> m_unlit_groups;
00126
00127
00128 class OutlineInfo {
00129 public:
00130 uint8_t r;
00131 uint8_t g;
00132 uint8_t b;
00133 int width;
00134 bool dirty;
00135 Image* outline;
00136 Image* curimg;
00137 OutlineInfo();
00138 ~OutlineInfo();
00139 };
00140
00141 class ColoringInfo {
00142 public:
00143 uint8_t r;
00144 uint8_t g;
00145 uint8_t b;
00146 bool dirty;
00147 Image* overlay;
00148 Image* curimg;
00149 ColoringInfo();
00150 ~ColoringInfo();
00151 };
00152 class AreaInfo {
00153 public:
00154 Instance* instance;
00155
00156 std::list<std::string> groups;
00157 unsigned int w;
00158 unsigned int h;
00159 unsigned char trans;
00160 bool front;
00161 float z;
00162 AreaInfo();
00163 ~AreaInfo();
00164 };
00165 typedef std::map<Instance*, OutlineInfo> InstanceToOutlines_t;
00166 typedef std::map<Instance*, ColoringInfo> InstanceToColoring_t;
00167 typedef std::map<Instance*, AreaInfo> InstanceToAreas_t;
00168
00169 InstanceToOutlines_t m_instance_outlines;
00170 InstanceToColoring_t m_instance_colorings;
00171 InstanceToAreas_t m_instance_areas;
00172
00175 Image* bindOutline(OutlineInfo& info, RenderItem& vc, Camera* cam);
00176 Image* bindColoring(ColoringInfo& info, RenderItem& vc, Camera* cam);
00177 };
00178 }
00179
00180 #endif