comparison engine/core/view/renderers/lightrenderer.i @ 661:e3140f01749d

* Merged the light branch back into trunk. * Modified the demos so they work with the new loaders and setting.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 05 Nov 2010 15:21:10 +0000
parents
children
comparison
equal deleted inserted replaced
660:b0733d998d0f 661:e3140f01749d
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 %module fife
23 %{
24 #include "view/renderers/lightrenderer.h"
25 %}
26
27 namespace FIFE {
28 class RenderBackend;
29
30 class LightRendererNode {
31 public:
32 LightRendererNode(Instance* attached_instance, const Location &relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
33 LightRendererNode(Instance* attached_instance, const Location &relative_location, const Point &relative_point = Point(0,0));
34 LightRendererNode(Instance* attached_instance, Layer* relative_layer, const Point &relative_point = Point(0,0));
35 LightRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0));
36 LightRendererNode(const Location &attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
37 LightRendererNode(const Location &attached_location, const Point &relative_point = Point(0,0));
38 LightRendererNode(Layer* attached_layer, const Point &relative_point = Point(0,0));
39 LightRendererNode(const Point &attached_point);
40 ~LightRendererNode();
41
42 void setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point);
43 void setAttached(Instance* attached_instance, const Location &relative_location);
44 void setAttached(Instance* attached_instance, const Point &relative_point);
45 void setAttached(Instance* attached_instance);
46 void setAttached(const Location &attached_location, const Point &relative_point);
47 void setAttached(const Location &attached_location);
48 void setAttached(Layer* attached_layer);
49 void setAttached(const Point &attached_point);
50
51 void setRelative(const Location &relative_location);
52 void setRelative(const Location &relative_location, Point relative_point);
53 void setRelative(const Point &relative_point);
54
55 Instance* getAttachedInstance();
56 Location getAttachedLocation();
57 Layer* getAttachedLayer();
58 Point getAttachedPoint();
59
60 Location getOffsetLocation();
61 Point getOffsetPoint();
62
63 Instance* getInstance();
64 Location getLocation();
65 Layer* getLayer();
66 Point getPoint();
67
68 Point getCalculatedPoint(Camera* cam, Layer* layer);
69 private:
70 Instance* m_instance;
71 Location m_location;
72 Layer* m_layer;
73 Point m_point;
74 };
75 class LightRendererElementInfo {
76 public:
77 virtual std::string getName() { return 0; };
78 virtual LightRendererNode* getNode() { return NULL; };
79 virtual int getId() { return -1; };
80 virtual int getSrcBlend() { return -1; };
81 virtual int getDstBlend() { return -1; };
82 virtual void setStencil(uint8_t stencil_ref, float alpha_ref) {};
83 virtual int getStencil() { return 0; };
84 virtual float getAlpha() { return 0; };
85 virtual void removeStencil() {};
86 virtual std::vector<uint8_t> getColor() {};
87 virtual float getRadius() { return 0; };
88 virtual int getSubdivisions() { return 0; };
89 virtual float getXStretch() { return 0; };
90 virtual float getYStretch() { return 0; };
91 virtual ~LightRendererElementInfo() {};
92 };
93
94 class LightRendererImageInfo : public LightRendererElementInfo {
95 public:
96 LightRendererImageInfo(LightRendererNode n, int image, int src, int dst);
97 virtual ~LightRendererImageInfo() {};
98 private:
99 LightRendererNode m_anchor;
100 int m_image;
101 int m_src;
102 int m_dst;
103 bool m_stencil;
104 uint8_t m_stencil_ref;
105 float m_alpha_ref;
106 };
107 class LightRendererAnimationInfo : public LightRendererElementInfo {
108 public:
109 LightRendererAnimationInfo(LightRendererNode n, int animation, int src, int dst);
110 virtual ~LightRendererAnimationInfo() {};
111 private:
112 LightRendererNode m_anchor;
113 int m_animation;
114 int m_src;
115 int m_dst;
116 bool m_stencil;
117 uint8_t m_stencil_ref;
118 float m_alpha_ref;
119 };
120 class LightRendererSimpleLightInfo : public LightRendererElementInfo {
121 public:
122 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);
123 virtual ~LightRendererSimpleLightInfo() {};
124 private:
125 LightRendererNode m_anchor;
126 uint8_t m_intensity;
127 float m_radius;
128 int m_subdivisions;
129 float m_xstretch;
130 float m_ystretch;
131 uint8_t m_red;
132 uint8_t m_green;
133 uint8_t m_blue;
134 int m_src;
135 int m_dst;
136 bool m_stencil;
137 uint8_t m_stencil_ref;
138 float m_alpha_ref;
139 };
140 class LightRendererResizeInfo : public LightRendererElementInfo {
141 public:
142 LightRendererResizeInfo(LightRendererNode n, int image, int width, int height, int src, int dst);
143 virtual ~LightRendererResizeInfo() {};
144 private:
145 LightRendererNode m_anchor;
146 int m_image;
147 int m_width;
148 int m_height;
149 int m_src;
150 int m_dst;
151 bool m_stencil;
152 uint8_t m_stencil_ref;
153 float m_alpha_ref;
154 };
155 class LightRenderer: public RendererBase {
156 public:
157 LightRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool);
158 ~LightRenderer();
159 std::string getName();
160 static LightRenderer* getInstance(IRendererContainer* cnt);
161 void addImage(const std::string &group, LightRendererNode n, int image, int src=-1, int dst=-1);
162 void addAnimation(const std::string &group, LightRendererNode n, int animation, int src=-1, int dst=-1);
163 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);
164 void resizeImage(const std::string &group, LightRendererNode n, int image, int width, int height, int src=-1, int dst=-1);
165 void addStencilTest(const std::string &group, uint8_t stencil_ref=0, float alpha_ref=0.0);
166 void removeStencilTest(const std::string &group);
167 std::list<std::string> getGroups();
168 std::vector<LightRendererElementInfo*> getLightInfo(const std::string &group);
169 void removeAll(const std::string &group);
170 };
171 }
172
173 namespace std {
174 %template(LightRendererElementInfoVector) vector<FIFE::LightRendererElementInfo*>;
175 }