annotate engine/core/view/renderers/lightrenderer.h @ 680:60621d858548

* Fixed the image/animation functions in GenericRenderer and LightRenderer. The functions now consider the camera zoom level. * Added the forgotten LightEdit plugin for the editor.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 21 Nov 2010 15:58:14 +0000
parents 61a5f86a0db3
children
rev   line source
661
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 /***************************************************************************
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2 * Copyright (C) 2005-2008 by the FIFE team *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3 * http://www.fifengine.de *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 * This file is part of FIFE. *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 * *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6 * FIFE is free software; you can redistribute it and/or *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 * License as published by the Free Software Foundation; either *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version. *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 * *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful, *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 * Lesser General Public License for more details. *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 * *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 * License along with this library; if not, write to the *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 * Free Software Foundation, Inc., *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 ***************************************************************************/
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 #ifndef FIFE_LIGHTRENDERER_H
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23 #define FIFE_LIGHTRENDERER_H
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25 // Standard C++ library includes
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 #include <vector>
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 // 3rd party library includes
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 // FIFE includes
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31 // These includes are split up in two parts, separated by one empty line
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 // First block: files included from the FIFE root src directory
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 // Second block: files included from the same folder
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34 #include "view/rendererbase.h"
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36 namespace FIFE {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 class RenderBackend;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38 class AbstractFont;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39 class ImagePool;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40 class AnimationPool;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 class LightRendererNode {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44 LightRendererNode(Instance* attached_instance, const Location &relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
45 LightRendererNode(Instance* attached_instance, const Location &relative_location, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46 LightRendererNode(Instance* attached_instance, Layer* relative_layer, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47 LightRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48 LightRendererNode(const Location &attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
49 LightRendererNode(const Location &attached_location, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 LightRendererNode(Layer* attached_layer, const Point &relative_point = Point(0,0));
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51 LightRendererNode(const Point &attached_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
52 ~LightRendererNode();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
53
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
54 void setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
55 void setAttached(Instance* attached_instance, const Location &relative_location);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
56 void setAttached(Instance* attached_instance, const Point &relative_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
57 void setAttached(Instance* attached_instance);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
58 void setAttached(const Location &attached_location, const Point &relative_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
59 void setAttached(const Location &attached_location);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
60 void setAttached(Layer* attached_layer);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
61 void setAttached(const Point &attached_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
62
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
63 void setRelative(const Location &relative_location);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
64 void setRelative(const Location &relative_location, Point relative_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
65 void setRelative(const Point &relative_point);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
66
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
67 Instance* getAttachedInstance();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 Location getAttachedLocation();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
69 Layer* getAttachedLayer();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 Point getAttachedPoint();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
72 Location getOffsetLocation();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
73 Point getOffsetPoint();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
74
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
75 Instance* getInstance();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
76 Location getLocation();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
77 Layer* getLayer();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
78 Point getPoint();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
79
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
80 Point getCalculatedPoint(Camera* cam, Layer* layer);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
81 private:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
82 Instance* m_instance;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
83 Location m_location;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
84 Layer* m_layer;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
85 Point m_point;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
86 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
87
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
88 class LightRendererElementInfo {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
89 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
90 virtual void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
91 virtual std::string getName() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
92 virtual LightRendererNode* getNode() { return NULL; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
93 virtual int getId() { return -1; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
94 virtual int getSrcBlend() { return -1; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
95 virtual int getDstBlend() { return -1; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
96 virtual void setStencil(uint8_t stencil_ref, float alpha_ref) {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
97 virtual int getStencil() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
98 virtual float getAlpha() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
99 virtual void removeStencil() {};
664
61a5f86a0db3 * Fixed the warnings that were introduced by the light branch merge.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 661
diff changeset
100 virtual std::vector<uint8_t> getColor() { return std::vector<uint8_t>(); };
661
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101 virtual float getRadius() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
102 virtual int getSubdivisions() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
103 virtual float getXStretch() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
104 virtual float getYStretch() { return 0; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
105 virtual ~LightRendererElementInfo() {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
106 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
108 class LightRendererImageInfo : public LightRendererElementInfo {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
109 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
110 void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
111 std::string getName() { return "image"; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
112 LightRendererNode* getNode() { return &m_anchor; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
113 int getId() { return m_image; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
114 int getSrcBlend() { return m_src; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
115 int getDstBlend() { return m_dst; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
116 void setStencil(uint8_t stencil_ref, float alpha_ref);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
117 int getStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
118 float getAlpha();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
119 void removeStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
120 LightRendererImageInfo(LightRendererNode n, int image, int src, int dst);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
121 virtual ~LightRendererImageInfo() {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
122 private:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
123 LightRendererNode m_anchor;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
124 int m_image;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
125 int m_src;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
126 int m_dst;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
127 bool m_stencil;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
128 uint8_t m_stencil_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
129 float m_alpha_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
130 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
131 class LightRendererAnimationInfo : public LightRendererElementInfo {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
132 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
133 void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
134 std::string getName() { return "animation"; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
135 LightRendererNode* getNode() { return &m_anchor; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
136 int getId() { return m_animation; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
137 int getSrcBlend() { return m_src; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
138 int getDstBlend() { return m_dst; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
139 void setStencil(uint8_t stencil_ref, float alpha_ref);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
140 int getStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
141 float getAlpha();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
142 void removeStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
143 LightRendererAnimationInfo(LightRendererNode n, int animation, int src, int dst);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
144 virtual ~LightRendererAnimationInfo() {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
145 private:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
146 LightRendererNode m_anchor;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
147 int m_animation;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
148 int m_src;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
149 int m_dst;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
150 unsigned int m_start_time;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
151 float m_time_scale;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
152 bool m_stencil;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
153 uint8_t m_stencil_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
154 float m_alpha_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
155 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
156 class LightRendererSimpleLightInfo : public LightRendererElementInfo {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
157 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
158 void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
159 std::string getName() { return "simple"; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
160 LightRendererNode* getNode() { return &m_anchor; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
161 int getSrcBlend() { return m_src; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
162 int getDstBlend() { return m_dst; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
163 void setStencil(uint8_t stencil_ref, float alpha_ref);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
164 int getStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
165 float getAlpha();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
166 void removeStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
167 std::vector<uint8_t> getColor();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
168 float getRadius() { return m_radius; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
169 int getSubdivisions() { return m_subdivisions; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
170 float getXStretch() { return m_xstretch; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
171 float getYStretch() { return m_ystretch; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
172 LightRendererSimpleLightInfo(LightRendererNode n, uint8_t intensity, float radius, int subdivisions, float xstretch, float ystretch, uint8_t r, uint8_t g, uint8_t b, int src, int dst);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
173 virtual ~LightRendererSimpleLightInfo() {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
174 private:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
175 LightRendererNode m_anchor;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
176 uint8_t m_intensity;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
177 float m_radius;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
178 int m_subdivisions;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
179 float m_xstretch;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
180 float m_ystretch;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
181 uint8_t m_red;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
182 uint8_t m_green;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
183 uint8_t m_blue;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
184 int m_src;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
185 int m_dst;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
186 bool m_stencil;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
187 uint8_t m_stencil_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
188 float m_alpha_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
189 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
190 class LightRendererResizeInfo : public LightRendererElementInfo {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
191 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
192 void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
193 std::string getName() { return "resize"; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
194 LightRendererNode* getNode() { return &m_anchor; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
195 int getId() { return m_image; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
196 int getSrcBlend() { return m_src; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
197 int getDstBlend() { return m_dst; };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
198 void setStencil(uint8_t stencil_ref, float alpha_ref);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
199 int getStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
200 float getAlpha();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
201 void removeStencil();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
202 LightRendererResizeInfo(LightRendererNode n, int image, int width, int height, int src, int dst);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
203 virtual ~LightRendererResizeInfo() {};
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
204 private:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
205 LightRendererNode m_anchor;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
206 int m_image;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
207 int m_width;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
208 int m_height;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
209 int m_src;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
210 int m_dst;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
211 bool m_stencil;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
212 uint8_t m_stencil_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
213 float m_alpha_ref;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
214 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
215 class LightRenderer: public RendererBase {
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
216 public:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
217 /** constructor.
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
218 * @param renderbackend to use
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
219 * @param position position for this renderer in rendering pipeline
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
220 */
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
221 LightRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
222
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
223 LightRenderer(const LightRenderer& old);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
224
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
225 RendererBase* clone();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
226
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
227 /** Destructor.
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
228 */
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
229 virtual ~LightRenderer();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
230 void render(Camera* cam, Layer* layer, RenderList& instances);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
231 std::string getName() { return "LightRenderer"; }
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
232
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
233 /** Gets instance for interface access
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
234 */
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
235 static LightRenderer* getInstance(IRendererContainer* cnt);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
236
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
237 void addImage(const std::string &group, LightRendererNode n, int image, int src=-1, int dst=-1);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
238 void addAnimation(const std::string &group, LightRendererNode n, int animation, int src=-1, int dst=-1);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
239 void addSimpleLight(const std::string &group, LightRendererNode n, uint8_t intensity, float radius, int subdivisions, float xstretch, float ystretch, uint8_t r, uint8_t g, uint8_t b, int src=-1, int dst=-1);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
240 void resizeImage(const std::string &group, LightRendererNode n, int image, int width, int height, int src=-1, int dst=-1);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
241 void addStencilTest(const std::string &group, uint8_t stencil_ref=0, float alpha_ref=0.0);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
242 void removeStencilTest(const std::string &group);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
243 std::list<std::string> getGroups();
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
244 std::vector<LightRendererElementInfo*> getLightInfo(const std::string &group);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
245 void removeAll(const std::string &group);
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
246
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
247 private:
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
248 ImagePool* m_imagepool;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
249 AnimationPool* m_animationpool;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
250 std::map<std::string, std::vector<LightRendererElementInfo*> > m_groups;
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
251 };
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
252
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
253 }
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
254
e3140f01749d * Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
255 #endif