diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/include/SVertexManipulator.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/include/SVertexManipulator.h | 584 |
1 files changed, 292 insertions, 292 deletions
diff --git a/libraries/irrlicht-1.8/include/SVertexManipulator.h b/libraries/irrlicht-1.8/include/SVertexManipulator.h index 6696ad0..592544b 100644 --- a/libraries/irrlicht-1.8/include/SVertexManipulator.h +++ b/libraries/irrlicht-1.8/include/SVertexManipulator.h | |||
@@ -1,292 +1,292 @@ | |||
1 | // Copyright (C) 2009-2012 Christian Stehno | 1 | // Copyright (C) 2009-2012 Christian Stehno |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __S_VERTEX_MANIPULATOR_H_INCLUDED__ | 5 | #ifndef __S_VERTEX_MANIPULATOR_H_INCLUDED__ |
6 | #define __S_VERTEX_MANIPULATOR_H_INCLUDED__ | 6 | #define __S_VERTEX_MANIPULATOR_H_INCLUDED__ |
7 | 7 | ||
8 | #include "S3DVertex.h" | 8 | #include "S3DVertex.h" |
9 | #include "SColor.h" | 9 | #include "SColor.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | namespace scene | 13 | namespace scene |
14 | { | 14 | { |
15 | 15 | ||
16 | class IMesh; | 16 | class IMesh; |
17 | class IMeshBuffer; | 17 | class IMeshBuffer; |
18 | struct SMesh; | 18 | struct SMesh; |
19 | 19 | ||
20 | //! Interface for vertex manipulators. | 20 | //! Interface for vertex manipulators. |
21 | /** You should derive your manipulator from this class if it shall be called for every vertex, getting as parameter just the vertex. | 21 | /** You should derive your manipulator from this class if it shall be called for every vertex, getting as parameter just the vertex. |
22 | */ | 22 | */ |
23 | struct IVertexManipulator | 23 | struct IVertexManipulator |
24 | { | 24 | { |
25 | }; | 25 | }; |
26 | //! Vertex manipulator to set color to a fixed color for all vertices | 26 | //! Vertex manipulator to set color to a fixed color for all vertices |
27 | class SVertexColorSetManipulator : public IVertexManipulator | 27 | class SVertexColorSetManipulator : public IVertexManipulator |
28 | { | 28 | { |
29 | public: | 29 | public: |
30 | SVertexColorSetManipulator(video::SColor color) : Color(color) {} | 30 | SVertexColorSetManipulator(video::SColor color) : Color(color) {} |
31 | void operator()(video::S3DVertex& vertex) const | 31 | void operator()(video::S3DVertex& vertex) const |
32 | { | 32 | { |
33 | vertex.Color=Color; | 33 | vertex.Color=Color; |
34 | } | 34 | } |
35 | private: | 35 | private: |
36 | video::SColor Color; | 36 | video::SColor Color; |
37 | }; | 37 | }; |
38 | //! Vertex manipulator to set the alpha value of the vertex color to a fixed value | 38 | //! Vertex manipulator to set the alpha value of the vertex color to a fixed value |
39 | class SVertexColorSetAlphaManipulator : public IVertexManipulator | 39 | class SVertexColorSetAlphaManipulator : public IVertexManipulator |
40 | { | 40 | { |
41 | public: | 41 | public: |
42 | SVertexColorSetAlphaManipulator(u32 alpha) : Alpha(alpha) {} | 42 | SVertexColorSetAlphaManipulator(u32 alpha) : Alpha(alpha) {} |
43 | void operator()(video::S3DVertex& vertex) const | 43 | void operator()(video::S3DVertex& vertex) const |
44 | { | 44 | { |
45 | vertex.Color.setAlpha(Alpha); | 45 | vertex.Color.setAlpha(Alpha); |
46 | } | 46 | } |
47 | private: | 47 | private: |
48 | u32 Alpha; | 48 | u32 Alpha; |
49 | }; | 49 | }; |
50 | //! Vertex manipulator which invertes the RGB values | 50 | //! Vertex manipulator which invertes the RGB values |
51 | class SVertexColorInvertManipulator : public IVertexManipulator | 51 | class SVertexColorInvertManipulator : public IVertexManipulator |
52 | { | 52 | { |
53 | public: | 53 | public: |
54 | void operator()(video::S3DVertex& vertex) const | 54 | void operator()(video::S3DVertex& vertex) const |
55 | { | 55 | { |
56 | vertex.Color.setRed(255-vertex.Color.getRed()); | 56 | vertex.Color.setRed(255-vertex.Color.getRed()); |
57 | vertex.Color.setGreen(255-vertex.Color.getGreen()); | 57 | vertex.Color.setGreen(255-vertex.Color.getGreen()); |
58 | vertex.Color.setBlue(255-vertex.Color.getBlue()); | 58 | vertex.Color.setBlue(255-vertex.Color.getBlue()); |
59 | } | 59 | } |
60 | }; | 60 | }; |
61 | //! Vertex manipulator to set vertex color to one of two values depending on a given threshold | 61 | //! Vertex manipulator to set vertex color to one of two values depending on a given threshold |
62 | /** If average of the color value is >Threshold the High color is chosen, else Low. */ | 62 | /** If average of the color value is >Threshold the High color is chosen, else Low. */ |
63 | class SVertexColorThresholdManipulator : public IVertexManipulator | 63 | class SVertexColorThresholdManipulator : public IVertexManipulator |
64 | { | 64 | { |
65 | public: | 65 | public: |
66 | SVertexColorThresholdManipulator(u8 threshold, video::SColor low, | 66 | SVertexColorThresholdManipulator(u8 threshold, video::SColor low, |
67 | video::SColor high) : Threshold(threshold), Low(low), High(high) {} | 67 | video::SColor high) : Threshold(threshold), Low(low), High(high) {} |
68 | void operator()(video::S3DVertex& vertex) const | 68 | void operator()(video::S3DVertex& vertex) const |
69 | { | 69 | { |
70 | vertex.Color = ((u8)vertex.Color.getAverage()>Threshold)?High:Low; | 70 | vertex.Color = ((u8)vertex.Color.getAverage()>Threshold)?High:Low; |
71 | } | 71 | } |
72 | private: | 72 | private: |
73 | u8 Threshold; | 73 | u8 Threshold; |
74 | video::SColor Low; | 74 | video::SColor Low; |
75 | video::SColor High; | 75 | video::SColor High; |
76 | }; | 76 | }; |
77 | //! Vertex manipulator which adjusts the brightness by the given amount | 77 | //! Vertex manipulator which adjusts the brightness by the given amount |
78 | /** A positive value increases brightness, a negative value darkens the colors. */ | 78 | /** A positive value increases brightness, a negative value darkens the colors. */ |
79 | class SVertexColorBrightnessManipulator : public IVertexManipulator | 79 | class SVertexColorBrightnessManipulator : public IVertexManipulator |
80 | { | 80 | { |
81 | public: | 81 | public: |
82 | SVertexColorBrightnessManipulator(s32 amount) : Amount(amount) {} | 82 | SVertexColorBrightnessManipulator(s32 amount) : Amount(amount) {} |
83 | void operator()(video::S3DVertex& vertex) const | 83 | void operator()(video::S3DVertex& vertex) const |
84 | { | 84 | { |
85 | vertex.Color.setRed(core::clamp(vertex.Color.getRed()+Amount, 0u, 255u)); | 85 | vertex.Color.setRed(core::clamp(vertex.Color.getRed()+Amount, 0u, 255u)); |
86 | vertex.Color.setGreen(core::clamp(vertex.Color.getGreen()+Amount, 0u, 255u)); | 86 | vertex.Color.setGreen(core::clamp(vertex.Color.getGreen()+Amount, 0u, 255u)); |
87 | vertex.Color.setBlue(core::clamp(vertex.Color.getBlue()+Amount, 0u, 255u)); | 87 | vertex.Color.setBlue(core::clamp(vertex.Color.getBlue()+Amount, 0u, 255u)); |
88 | } | 88 | } |
89 | private: | 89 | private: |
90 | s32 Amount; | 90 | s32 Amount; |
91 | }; | 91 | }; |
92 | //! Vertex manipulator which adjusts the contrast by the given factor | 92 | //! Vertex manipulator which adjusts the contrast by the given factor |
93 | /** Factors over 1 increase contrast, below 1 reduce it. */ | 93 | /** Factors over 1 increase contrast, below 1 reduce it. */ |
94 | class SVertexColorContrastManipulator : public IVertexManipulator | 94 | class SVertexColorContrastManipulator : public IVertexManipulator |
95 | { | 95 | { |
96 | public: | 96 | public: |
97 | SVertexColorContrastManipulator(f32 factor) : Factor(factor) {} | 97 | SVertexColorContrastManipulator(f32 factor) : Factor(factor) {} |
98 | void operator()(video::S3DVertex& vertex) const | 98 | void operator()(video::S3DVertex& vertex) const |
99 | { | 99 | { |
100 | vertex.Color.setRed(core::clamp(core::round32((vertex.Color.getRed()-128)*Factor)+128, 0, 255)); | 100 | vertex.Color.setRed(core::clamp(core::round32((vertex.Color.getRed()-128)*Factor)+128, 0, 255)); |
101 | vertex.Color.setGreen(core::clamp(core::round32((vertex.Color.getGreen()-128)*Factor)+128, 0, 255)); | 101 | vertex.Color.setGreen(core::clamp(core::round32((vertex.Color.getGreen()-128)*Factor)+128, 0, 255)); |
102 | vertex.Color.setBlue(core::clamp(core::round32((vertex.Color.getBlue()-128)*Factor)+128, 0, 255)); | 102 | vertex.Color.setBlue(core::clamp(core::round32((vertex.Color.getBlue()-128)*Factor)+128, 0, 255)); |
103 | } | 103 | } |
104 | private: | 104 | private: |
105 | f32 Factor; | 105 | f32 Factor; |
106 | }; | 106 | }; |
107 | //! Vertex manipulator which adjusts the contrast by the given factor and brightness by a signed amount. | 107 | //! Vertex manipulator which adjusts the contrast by the given factor and brightness by a signed amount. |
108 | /** Factors over 1 increase contrast, below 1 reduce it. | 108 | /** Factors over 1 increase contrast, below 1 reduce it. |
109 | A positive amount increases brightness, a negative one darkens the colors. */ | 109 | A positive amount increases brightness, a negative one darkens the colors. */ |
110 | class SVertexColorContrastBrightnessManipulator : public IVertexManipulator | 110 | class SVertexColorContrastBrightnessManipulator : public IVertexManipulator |
111 | { | 111 | { |
112 | public: | 112 | public: |
113 | SVertexColorContrastBrightnessManipulator(f32 factor, s32 amount) : Factor(factor), Amount(amount+128) {} | 113 | SVertexColorContrastBrightnessManipulator(f32 factor, s32 amount) : Factor(factor), Amount(amount+128) {} |
114 | void operator()(video::S3DVertex& vertex) const | 114 | void operator()(video::S3DVertex& vertex) const |
115 | { | 115 | { |
116 | vertex.Color.setRed(core::clamp(core::round32((vertex.Color.getRed()-128)*Factor)+Amount, 0, 255)); | 116 | vertex.Color.setRed(core::clamp(core::round32((vertex.Color.getRed()-128)*Factor)+Amount, 0, 255)); |
117 | vertex.Color.setGreen(core::clamp(core::round32((vertex.Color.getGreen()-128)*Factor)+Amount, 0, 255)); | 117 | vertex.Color.setGreen(core::clamp(core::round32((vertex.Color.getGreen()-128)*Factor)+Amount, 0, 255)); |
118 | vertex.Color.setBlue(core::clamp(core::round32((vertex.Color.getBlue()-128)*Factor)+Amount, 0, 255)); | 118 | vertex.Color.setBlue(core::clamp(core::round32((vertex.Color.getBlue()-128)*Factor)+Amount, 0, 255)); |
119 | } | 119 | } |
120 | private: | 120 | private: |
121 | f32 Factor; | 121 | f32 Factor; |
122 | s32 Amount; | 122 | s32 Amount; |
123 | }; | 123 | }; |
124 | //! Vertex manipulator which adjusts the brightness by a gamma operation | 124 | //! Vertex manipulator which adjusts the brightness by a gamma operation |
125 | /** A value over one increases brightness, one below darkens the colors. */ | 125 | /** A value over one increases brightness, one below darkens the colors. */ |
126 | class SVertexColorGammaManipulator : public IVertexManipulator | 126 | class SVertexColorGammaManipulator : public IVertexManipulator |
127 | { | 127 | { |
128 | public: | 128 | public: |
129 | SVertexColorGammaManipulator(f32 gamma) : Gamma(1.f) | 129 | SVertexColorGammaManipulator(f32 gamma) : Gamma(1.f) |
130 | { | 130 | { |
131 | if (gamma != 0.f) | 131 | if (gamma != 0.f) |
132 | Gamma = 1.f/gamma; | 132 | Gamma = 1.f/gamma; |
133 | } | 133 | } |
134 | void operator()(video::S3DVertex& vertex) const | 134 | void operator()(video::S3DVertex& vertex) const |
135 | { | 135 | { |
136 | vertex.Color.setRed(core::clamp(core::round32(powf((f32)(vertex.Color.getRed()),Gamma)), 0, 255)); | 136 | vertex.Color.setRed(core::clamp(core::round32(powf((f32)(vertex.Color.getRed()),Gamma)), 0, 255)); |
137 | vertex.Color.setGreen(core::clamp(core::round32(powf((f32)(vertex.Color.getGreen()),Gamma)), 0, 255)); | 137 | vertex.Color.setGreen(core::clamp(core::round32(powf((f32)(vertex.Color.getGreen()),Gamma)), 0, 255)); |
138 | vertex.Color.setBlue(core::clamp(core::round32(powf((f32)(vertex.Color.getBlue()),Gamma)), 0, 255)); | 138 | vertex.Color.setBlue(core::clamp(core::round32(powf((f32)(vertex.Color.getBlue()),Gamma)), 0, 255)); |
139 | } | 139 | } |
140 | private: | 140 | private: |
141 | f32 Gamma; | 141 | f32 Gamma; |
142 | }; | 142 | }; |
143 | //! Vertex manipulator which scales the color values | 143 | //! Vertex manipulator which scales the color values |
144 | /** Can e.g be used for white balance, factor would be 255.f/brightest color. */ | 144 | /** Can e.g be used for white balance, factor would be 255.f/brightest color. */ |
145 | class SVertexColorScaleManipulator : public IVertexManipulator | 145 | class SVertexColorScaleManipulator : public IVertexManipulator |
146 | { | 146 | { |
147 | public: | 147 | public: |
148 | SVertexColorScaleManipulator(f32 factor) : Factor(factor) {} | 148 | SVertexColorScaleManipulator(f32 factor) : Factor(factor) {} |
149 | void operator()(video::S3DVertex& vertex) const | 149 | void operator()(video::S3DVertex& vertex) const |
150 | { | 150 | { |
151 | vertex.Color.setRed(core::clamp(core::round32(vertex.Color.getRed()*Factor), 0, 255)); | 151 | vertex.Color.setRed(core::clamp(core::round32(vertex.Color.getRed()*Factor), 0, 255)); |
152 | vertex.Color.setGreen(core::clamp(core::round32(vertex.Color.getGreen()*Factor), 0, 255)); | 152 | vertex.Color.setGreen(core::clamp(core::round32(vertex.Color.getGreen()*Factor), 0, 255)); |
153 | vertex.Color.setBlue(core::clamp(core::round32(vertex.Color.getBlue()*Factor), 0, 255)); | 153 | vertex.Color.setBlue(core::clamp(core::round32(vertex.Color.getBlue()*Factor), 0, 255)); |
154 | } | 154 | } |
155 | private: | 155 | private: |
156 | f32 Factor; | 156 | f32 Factor; |
157 | }; | 157 | }; |
158 | //! Vertex manipulator which desaturates the color values | 158 | //! Vertex manipulator which desaturates the color values |
159 | /** Uses the lightness value of the color. */ | 159 | /** Uses the lightness value of the color. */ |
160 | class SVertexColorDesaturateToLightnessManipulator : public IVertexManipulator | 160 | class SVertexColorDesaturateToLightnessManipulator : public IVertexManipulator |
161 | { | 161 | { |
162 | public: | 162 | public: |
163 | void operator()(video::S3DVertex& vertex) const | 163 | void operator()(video::S3DVertex& vertex) const |
164 | { | 164 | { |
165 | vertex.Color=core::round32(vertex.Color.getLightness()); | 165 | vertex.Color=core::round32(vertex.Color.getLightness()); |
166 | } | 166 | } |
167 | }; | 167 | }; |
168 | //! Vertex manipulator which desaturates the color values | 168 | //! Vertex manipulator which desaturates the color values |
169 | /** Uses the average value of the color. */ | 169 | /** Uses the average value of the color. */ |
170 | class SVertexColorDesaturateToAverageManipulator : public IVertexManipulator | 170 | class SVertexColorDesaturateToAverageManipulator : public IVertexManipulator |
171 | { | 171 | { |
172 | public: | 172 | public: |
173 | void operator()(video::S3DVertex& vertex) const | 173 | void operator()(video::S3DVertex& vertex) const |
174 | { | 174 | { |
175 | vertex.Color=vertex.Color.getAverage(); | 175 | vertex.Color=vertex.Color.getAverage(); |
176 | } | 176 | } |
177 | }; | 177 | }; |
178 | //! Vertex manipulator which desaturates the color values | 178 | //! Vertex manipulator which desaturates the color values |
179 | /** Uses the luminance value of the color. */ | 179 | /** Uses the luminance value of the color. */ |
180 | class SVertexColorDesaturateToLuminanceManipulator : public IVertexManipulator | 180 | class SVertexColorDesaturateToLuminanceManipulator : public IVertexManipulator |
181 | { | 181 | { |
182 | public: | 182 | public: |
183 | void operator()(video::S3DVertex& vertex) const | 183 | void operator()(video::S3DVertex& vertex) const |
184 | { | 184 | { |
185 | vertex.Color=core::round32(vertex.Color.getLuminance()); | 185 | vertex.Color=core::round32(vertex.Color.getLuminance()); |
186 | } | 186 | } |
187 | }; | 187 | }; |
188 | //! Vertex manipulator which interpolates the color values | 188 | //! Vertex manipulator which interpolates the color values |
189 | /** Uses linear interpolation. */ | 189 | /** Uses linear interpolation. */ |
190 | class SVertexColorInterpolateLinearManipulator : public IVertexManipulator | 190 | class SVertexColorInterpolateLinearManipulator : public IVertexManipulator |
191 | { | 191 | { |
192 | public: | 192 | public: |
193 | SVertexColorInterpolateLinearManipulator(video::SColor color, f32 factor) : | 193 | SVertexColorInterpolateLinearManipulator(video::SColor color, f32 factor) : |
194 | Color(color), Factor(factor) {} | 194 | Color(color), Factor(factor) {} |
195 | void operator()(video::S3DVertex& vertex) const | 195 | void operator()(video::S3DVertex& vertex) const |
196 | { | 196 | { |
197 | vertex.Color=vertex.Color.getInterpolated(Color, Factor); | 197 | vertex.Color=vertex.Color.getInterpolated(Color, Factor); |
198 | } | 198 | } |
199 | private: | 199 | private: |
200 | video::SColor Color; | 200 | video::SColor Color; |
201 | f32 Factor; | 201 | f32 Factor; |
202 | }; | 202 | }; |
203 | //! Vertex manipulator which interpolates the color values | 203 | //! Vertex manipulator which interpolates the color values |
204 | /** Uses linear interpolation. */ | 204 | /** Uses linear interpolation. */ |
205 | class SVertexColorInterpolateQuadraticManipulator : public IVertexManipulator | 205 | class SVertexColorInterpolateQuadraticManipulator : public IVertexManipulator |
206 | { | 206 | { |
207 | public: | 207 | public: |
208 | SVertexColorInterpolateQuadraticManipulator(video::SColor color1, video::SColor color2, f32 factor) : | 208 | SVertexColorInterpolateQuadraticManipulator(video::SColor color1, video::SColor color2, f32 factor) : |
209 | Color1(color1), Color2(color2), Factor(factor) {} | 209 | Color1(color1), Color2(color2), Factor(factor) {} |
210 | void operator()(video::S3DVertex& vertex) const | 210 | void operator()(video::S3DVertex& vertex) const |
211 | { | 211 | { |
212 | vertex.Color=vertex.Color.getInterpolated_quadratic(Color1, Color2, Factor); | 212 | vertex.Color=vertex.Color.getInterpolated_quadratic(Color1, Color2, Factor); |
213 | } | 213 | } |
214 | private: | 214 | private: |
215 | video::SColor Color1; | 215 | video::SColor Color1; |
216 | video::SColor Color2; | 216 | video::SColor Color2; |
217 | f32 Factor; | 217 | f32 Factor; |
218 | }; | 218 | }; |
219 | 219 | ||
220 | //! Vertex manipulator which scales the position of the vertex | 220 | //! Vertex manipulator which scales the position of the vertex |
221 | class SVertexPositionScaleManipulator : public IVertexManipulator | 221 | class SVertexPositionScaleManipulator : public IVertexManipulator |
222 | { | 222 | { |
223 | public: | 223 | public: |
224 | SVertexPositionScaleManipulator(const core::vector3df& factor) : Factor(factor) {} | 224 | SVertexPositionScaleManipulator(const core::vector3df& factor) : Factor(factor) {} |
225 | template <typename VType> | 225 | template <typename VType> |
226 | void operator()(VType& vertex) const | 226 | void operator()(VType& vertex) const |
227 | { | 227 | { |
228 | vertex.Pos *= Factor; | 228 | vertex.Pos *= Factor; |
229 | } | 229 | } |
230 | private: | 230 | private: |
231 | core::vector3df Factor; | 231 | core::vector3df Factor; |
232 | }; | 232 | }; |
233 | 233 | ||
234 | //! Vertex manipulator which scales the position of the vertex along the normals | 234 | //! Vertex manipulator which scales the position of the vertex along the normals |
235 | /** This can look more pleasing than the usual Scale operator, but | 235 | /** This can look more pleasing than the usual Scale operator, but |
236 | depends on the mesh geometry. | 236 | depends on the mesh geometry. |
237 | */ | 237 | */ |
238 | class SVertexPositionScaleAlongNormalsManipulator : public IVertexManipulator | 238 | class SVertexPositionScaleAlongNormalsManipulator : public IVertexManipulator |
239 | { | 239 | { |
240 | public: | 240 | public: |
241 | SVertexPositionScaleAlongNormalsManipulator(const core::vector3df& factor) : Factor(factor) {} | 241 | SVertexPositionScaleAlongNormalsManipulator(const core::vector3df& factor) : Factor(factor) {} |
242 | template <typename VType> | 242 | template <typename VType> |
243 | void operator()(VType& vertex) const | 243 | void operator()(VType& vertex) const |
244 | { | 244 | { |
245 | vertex.Pos += vertex.Normal*Factor; | 245 | vertex.Pos += vertex.Normal*Factor; |
246 | } | 246 | } |
247 | private: | 247 | private: |
248 | core::vector3df Factor; | 248 | core::vector3df Factor; |
249 | }; | 249 | }; |
250 | 250 | ||
251 | //! Vertex manipulator which transforms the position of the vertex | 251 | //! Vertex manipulator which transforms the position of the vertex |
252 | class SVertexPositionTransformManipulator : public IVertexManipulator | 252 | class SVertexPositionTransformManipulator : public IVertexManipulator |
253 | { | 253 | { |
254 | public: | 254 | public: |
255 | SVertexPositionTransformManipulator(const core::matrix4& m) : Transformation(m) {} | 255 | SVertexPositionTransformManipulator(const core::matrix4& m) : Transformation(m) {} |
256 | template <typename VType> | 256 | template <typename VType> |
257 | void operator()(VType& vertex) const | 257 | void operator()(VType& vertex) const |
258 | { | 258 | { |
259 | Transformation.transformVect(vertex.Pos); | 259 | Transformation.transformVect(vertex.Pos); |
260 | } | 260 | } |
261 | private: | 261 | private: |
262 | core::matrix4 Transformation; | 262 | core::matrix4 Transformation; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | //! Vertex manipulator which scales the TCoords of the vertex | 265 | //! Vertex manipulator which scales the TCoords of the vertex |
266 | class SVertexTCoordsScaleManipulator : public IVertexManipulator | 266 | class SVertexTCoordsScaleManipulator : public IVertexManipulator |
267 | { | 267 | { |
268 | public: | 268 | public: |
269 | SVertexTCoordsScaleManipulator(const core::vector2df& factor, u32 uvSet=1) : Factor(factor), UVSet(uvSet) {} | 269 | SVertexTCoordsScaleManipulator(const core::vector2df& factor, u32 uvSet=1) : Factor(factor), UVSet(uvSet) {} |
270 | void operator()(video::S3DVertex2TCoords& vertex) const | 270 | void operator()(video::S3DVertex2TCoords& vertex) const |
271 | { | 271 | { |
272 | if (1==UVSet) | 272 | if (1==UVSet) |
273 | vertex.TCoords *= Factor; | 273 | vertex.TCoords *= Factor; |
274 | else if (2==UVSet) | 274 | else if (2==UVSet) |
275 | vertex.TCoords2 *= Factor; | 275 | vertex.TCoords2 *= Factor; |
276 | } | 276 | } |
277 | template <typename VType> | 277 | template <typename VType> |
278 | void operator()(VType& vertex) const | 278 | void operator()(VType& vertex) const |
279 | { | 279 | { |
280 | if (1==UVSet) | 280 | if (1==UVSet) |
281 | vertex.TCoords *= Factor; | 281 | vertex.TCoords *= Factor; |
282 | } | 282 | } |
283 | private: | 283 | private: |
284 | core::vector2df Factor; | 284 | core::vector2df Factor; |
285 | u32 UVSet; | 285 | u32 UVSet; |
286 | }; | 286 | }; |
287 | 287 | ||
288 | } // end namespace scene | 288 | } // end namespace scene |
289 | } // end namespace irr | 289 | } // end namespace irr |
290 | 290 | ||
291 | 291 | ||
292 | #endif | 292 | #endif |