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
00027
00028
00029
00030
00031
00032
00033 #include "view/rendererbase.h"
00034
00035 namespace FIFE {
00036 class Location;
00037 class RenderBackend;
00038 class ImagePool;
00039 class AnimationPool;
00040 class InstanceVisualCacheItem;
00041
00042 class InstanceRenderer: public RendererBase {
00043 public:
00049 InstanceRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool);
00050
00051 InstanceRenderer(const InstanceRenderer& old);
00052
00053 RendererBase* clone();
00054
00057 virtual ~InstanceRenderer();
00058 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances);
00059 std::string getName() { return "InstanceRenderer"; }
00060
00063 void addOutlined(Instance* instance, int r, int g, int b, int width);
00064
00067 void addColored(Instance* instance, int r, int g, int b);
00068
00071 void removeOutlined(Instance* instance);
00072
00075 void removeColored(Instance* instance);
00076
00079 void removeAllOutlines();
00080
00083 void removeAllColored();
00084
00087 static InstanceRenderer* getInstance(IRendererContainer* cnt);
00088
00089 void reset();
00090
00091 private:
00092 ImagePool* m_imagepool;
00093 AnimationPool* m_animationpool;
00094
00095
00096 class OutlineInfo {
00097 public:
00098 uint8_t r;
00099 uint8_t g;
00100 uint8_t b;
00101 int width;
00102 Image* outline;
00103 Image* curimg;
00104 OutlineInfo();
00105 ~OutlineInfo();
00106 };
00107
00108 class ColoringInfo {
00109 public:
00110 uint8_t r;
00111 uint8_t g;
00112 uint8_t b;
00113 Image* overlay;
00114 Image* curimg;
00115 ColoringInfo();
00116 ~ColoringInfo();
00117 };
00118 typedef std::map<Instance*, OutlineInfo> InstanceToOutlines_t;
00119 typedef std::map<Instance*, ColoringInfo> InstanceToColoring_t;
00120
00121 InstanceToOutlines_t m_instance_outlines;
00122 InstanceToColoring_t m_instance_colorings;
00123
00126 Image* bindOutline(OutlineInfo& info, InstanceVisualCacheItem& vc, Camera* cam);
00127 Image* bindColoring(ColoringInfo& info, InstanceVisualCacheItem& vc, Camera* cam);
00128 };
00129 }
00130
00131 #endif