aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/S3DVertex.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/include/S3DVertex.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-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 'libraries/irrlicht-1.8/include/S3DVertex.h')
-rw-r--r--libraries/irrlicht-1.8/include/S3DVertex.h548
1 files changed, 274 insertions, 274 deletions
diff --git a/libraries/irrlicht-1.8/include/S3DVertex.h b/libraries/irrlicht-1.8/include/S3DVertex.h
index bf0fd5b..706cf4b 100644
--- a/libraries/irrlicht-1.8/include/S3DVertex.h
+++ b/libraries/irrlicht-1.8/include/S3DVertex.h
@@ -1,274 +1,274 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
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_3D_VERTEX_H_INCLUDED__ 5#ifndef __S_3D_VERTEX_H_INCLUDED__
6#define __S_3D_VERTEX_H_INCLUDED__ 6#define __S_3D_VERTEX_H_INCLUDED__
7 7
8#include "vector3d.h" 8#include "vector3d.h"
9#include "vector2d.h" 9#include "vector2d.h"
10#include "SColor.h" 10#include "SColor.h"
11 11
12namespace irr 12namespace irr
13{ 13{
14namespace video 14namespace video
15{ 15{
16 16
17//! Enumeration for all vertex types there are. 17//! Enumeration for all vertex types there are.
18enum E_VERTEX_TYPE 18enum E_VERTEX_TYPE
19{ 19{
20 //! Standard vertex type used by the Irrlicht engine, video::S3DVertex. 20 //! Standard vertex type used by the Irrlicht engine, video::S3DVertex.
21 EVT_STANDARD = 0, 21 EVT_STANDARD = 0,
22 22
23 //! Vertex with two texture coordinates, video::S3DVertex2TCoords. 23 //! Vertex with two texture coordinates, video::S3DVertex2TCoords.
24 /** Usually used for geometry with lightmaps or other special materials. */ 24 /** Usually used for geometry with lightmaps or other special materials. */
25 EVT_2TCOORDS, 25 EVT_2TCOORDS,
26 26
27 //! Vertex with a tangent and binormal vector, video::S3DVertexTangents. 27 //! Vertex with a tangent and binormal vector, video::S3DVertexTangents.
28 /** Usually used for tangent space normal mapping. */ 28 /** Usually used for tangent space normal mapping. */
29 EVT_TANGENTS 29 EVT_TANGENTS
30}; 30};
31 31
32//! Array holding the built in vertex type names 32//! Array holding the built in vertex type names
33const char* const sBuiltInVertexTypeNames[] = 33const char* const sBuiltInVertexTypeNames[] =
34{ 34{
35 "standard", 35 "standard",
36 "2tcoords", 36 "2tcoords",
37 "tangents", 37 "tangents",
38 0 38 0
39}; 39};
40 40
41//! standard vertex used by the Irrlicht engine. 41//! standard vertex used by the Irrlicht engine.
42struct S3DVertex 42struct S3DVertex
43{ 43{
44 //! default constructor 44 //! default constructor
45 S3DVertex() {} 45 S3DVertex() {}
46 46
47 //! constructor 47 //! constructor
48 S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv) 48 S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
49 : Pos(x,y,z), Normal(nx,ny,nz), Color(c), TCoords(tu,tv) {} 49 : Pos(x,y,z), Normal(nx,ny,nz), Color(c), TCoords(tu,tv) {}
50 50
51 //! constructor 51 //! constructor
52 S3DVertex(const core::vector3df& pos, const core::vector3df& normal, 52 S3DVertex(const core::vector3df& pos, const core::vector3df& normal,
53 SColor color, const core::vector2d<f32>& tcoords) 53 SColor color, const core::vector2d<f32>& tcoords)
54 : Pos(pos), Normal(normal), Color(color), TCoords(tcoords) {} 54 : Pos(pos), Normal(normal), Color(color), TCoords(tcoords) {}
55 55
56 //! Position 56 //! Position
57 core::vector3df Pos; 57 core::vector3df Pos;
58 58
59 //! Normal vector 59 //! Normal vector
60 core::vector3df Normal; 60 core::vector3df Normal;
61 61
62 //! Color 62 //! Color
63 SColor Color; 63 SColor Color;
64 64
65 //! Texture coordinates 65 //! Texture coordinates
66 core::vector2d<f32> TCoords; 66 core::vector2d<f32> TCoords;
67 67
68 bool operator==(const S3DVertex& other) const 68 bool operator==(const S3DVertex& other) const
69 { 69 {
70 return ((Pos == other.Pos) && (Normal == other.Normal) && 70 return ((Pos == other.Pos) && (Normal == other.Normal) &&
71 (Color == other.Color) && (TCoords == other.TCoords)); 71 (Color == other.Color) && (TCoords == other.TCoords));
72 } 72 }
73 73
74 bool operator!=(const S3DVertex& other) const 74 bool operator!=(const S3DVertex& other) const
75 { 75 {
76 return ((Pos != other.Pos) || (Normal != other.Normal) || 76 return ((Pos != other.Pos) || (Normal != other.Normal) ||
77 (Color != other.Color) || (TCoords != other.TCoords)); 77 (Color != other.Color) || (TCoords != other.TCoords));
78 } 78 }
79 79
80 bool operator<(const S3DVertex& other) const 80 bool operator<(const S3DVertex& other) const
81 { 81 {
82 return ((Pos < other.Pos) || 82 return ((Pos < other.Pos) ||
83 ((Pos == other.Pos) && (Normal < other.Normal)) || 83 ((Pos == other.Pos) && (Normal < other.Normal)) ||
84 ((Pos == other.Pos) && (Normal == other.Normal) && (Color < other.Color)) || 84 ((Pos == other.Pos) && (Normal == other.Normal) && (Color < other.Color)) ||
85 ((Pos == other.Pos) && (Normal == other.Normal) && (Color == other.Color) && (TCoords < other.TCoords))); 85 ((Pos == other.Pos) && (Normal == other.Normal) && (Color == other.Color) && (TCoords < other.TCoords)));
86 } 86 }
87 87
88 E_VERTEX_TYPE getType() const 88 E_VERTEX_TYPE getType() const
89 { 89 {
90 return EVT_STANDARD; 90 return EVT_STANDARD;
91 } 91 }
92 92
93 S3DVertex getInterpolated(const S3DVertex& other, f32 d) 93 S3DVertex getInterpolated(const S3DVertex& other, f32 d)
94 { 94 {
95 d = core::clamp(d, 0.0f, 1.0f); 95 d = core::clamp(d, 0.0f, 1.0f);
96 return S3DVertex(Pos.getInterpolated(other.Pos, d), 96 return S3DVertex(Pos.getInterpolated(other.Pos, d),
97 Normal.getInterpolated(other.Normal, d), 97 Normal.getInterpolated(other.Normal, d),
98 Color.getInterpolated(other.Color, d), 98 Color.getInterpolated(other.Color, d),
99 TCoords.getInterpolated(other.TCoords, d)); 99 TCoords.getInterpolated(other.TCoords, d));
100 } 100 }
101}; 101};
102 102
103 103
104//! Vertex with two texture coordinates. 104//! Vertex with two texture coordinates.
105/** Usually used for geometry with lightmaps 105/** Usually used for geometry with lightmaps
106or other special materials. 106or other special materials.
107*/ 107*/
108struct S3DVertex2TCoords : public S3DVertex 108struct S3DVertex2TCoords : public S3DVertex
109{ 109{
110 //! default constructor 110 //! default constructor
111 S3DVertex2TCoords() : S3DVertex() {} 111 S3DVertex2TCoords() : S3DVertex() {}
112 112
113 //! constructor with two different texture coords, but no normal 113 //! constructor with two different texture coords, but no normal
114 S3DVertex2TCoords(f32 x, f32 y, f32 z, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2) 114 S3DVertex2TCoords(f32 x, f32 y, f32 z, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2)
115 : S3DVertex(x,y,z, 0.0f, 0.0f, 0.0f, c, tu,tv), TCoords2(tu2,tv2) {} 115 : S3DVertex(x,y,z, 0.0f, 0.0f, 0.0f, c, tu,tv), TCoords2(tu2,tv2) {}
116 116
117 //! constructor with two different texture coords, but no normal 117 //! constructor with two different texture coords, but no normal
118 S3DVertex2TCoords(const core::vector3df& pos, SColor color, 118 S3DVertex2TCoords(const core::vector3df& pos, SColor color,
119 const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2) 119 const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2)
120 : S3DVertex(pos, core::vector3df(), color, tcoords), TCoords2(tcoords2) {} 120 : S3DVertex(pos, core::vector3df(), color, tcoords), TCoords2(tcoords2) {}
121 121
122 //! constructor with all values 122 //! constructor with all values
123 S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal, const SColor& color, 123 S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal, const SColor& color,
124 const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2) 124 const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2)
125 : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords2) {} 125 : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords2) {}
126 126
127 //! constructor with all values 127 //! constructor with all values
128 S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2) 128 S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2)
129 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), TCoords2(tu2,tv2) {} 129 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), TCoords2(tu2,tv2) {}
130 130
131 //! constructor with the same texture coords and normal 131 //! constructor with the same texture coords and normal
132 S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv) 132 S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
133 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), TCoords2(tu,tv) {} 133 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), TCoords2(tu,tv) {}
134 134
135 //! constructor with the same texture coords and normal 135 //! constructor with the same texture coords and normal
136 S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal, 136 S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal,
137 SColor color, const core::vector2d<f32>& tcoords) 137 SColor color, const core::vector2d<f32>& tcoords)
138 : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords) {} 138 : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords) {}
139 139
140 //! constructor from S3DVertex 140 //! constructor from S3DVertex
141 S3DVertex2TCoords(S3DVertex& o) : S3DVertex(o) {} 141 S3DVertex2TCoords(S3DVertex& o) : S3DVertex(o) {}
142 142
143 //! Second set of texture coordinates 143 //! Second set of texture coordinates
144 core::vector2d<f32> TCoords2; 144 core::vector2d<f32> TCoords2;
145 145
146 //! Equality operator 146 //! Equality operator
147 bool operator==(const S3DVertex2TCoords& other) const 147 bool operator==(const S3DVertex2TCoords& other) const
148 { 148 {
149 return ((static_cast<S3DVertex>(*this)==other) && 149 return ((static_cast<S3DVertex>(*this)==other) &&
150 (TCoords2 == other.TCoords2)); 150 (TCoords2 == other.TCoords2));
151 } 151 }
152 152
153 //! Inequality operator 153 //! Inequality operator
154 bool operator!=(const S3DVertex2TCoords& other) const 154 bool operator!=(const S3DVertex2TCoords& other) const
155 { 155 {
156 return ((static_cast<S3DVertex>(*this)!=other) || 156 return ((static_cast<S3DVertex>(*this)!=other) ||
157 (TCoords2 != other.TCoords2)); 157 (TCoords2 != other.TCoords2));
158 } 158 }
159 159
160 bool operator<(const S3DVertex2TCoords& other) const 160 bool operator<(const S3DVertex2TCoords& other) const
161 { 161 {
162 return ((static_cast<S3DVertex>(*this) < other) || 162 return ((static_cast<S3DVertex>(*this) < other) ||
163 ((static_cast<S3DVertex>(*this) == other) && (TCoords2 < other.TCoords2))); 163 ((static_cast<S3DVertex>(*this) == other) && (TCoords2 < other.TCoords2)));
164 } 164 }
165 165
166 E_VERTEX_TYPE getType() const 166 E_VERTEX_TYPE getType() const
167 { 167 {
168 return EVT_2TCOORDS; 168 return EVT_2TCOORDS;
169 } 169 }
170 170
171 S3DVertex2TCoords getInterpolated(const S3DVertex2TCoords& other, f32 d) 171 S3DVertex2TCoords getInterpolated(const S3DVertex2TCoords& other, f32 d)
172 { 172 {
173 d = core::clamp(d, 0.0f, 1.0f); 173 d = core::clamp(d, 0.0f, 1.0f);
174 return S3DVertex2TCoords(Pos.getInterpolated(other.Pos, d), 174 return S3DVertex2TCoords(Pos.getInterpolated(other.Pos, d),
175 Normal.getInterpolated(other.Normal, d), 175 Normal.getInterpolated(other.Normal, d),
176 Color.getInterpolated(other.Color, d), 176 Color.getInterpolated(other.Color, d),
177 TCoords.getInterpolated(other.TCoords, d), 177 TCoords.getInterpolated(other.TCoords, d),
178 TCoords2.getInterpolated(other.TCoords2, d)); 178 TCoords2.getInterpolated(other.TCoords2, d));
179 } 179 }
180}; 180};
181 181
182 182
183//! Vertex with a tangent and binormal vector. 183//! Vertex with a tangent and binormal vector.
184/** Usually used for tangent space normal mapping. */ 184/** Usually used for tangent space normal mapping. */
185struct S3DVertexTangents : public S3DVertex 185struct S3DVertexTangents : public S3DVertex
186{ 186{
187 //! default constructor 187 //! default constructor
188 S3DVertexTangents() : S3DVertex() { } 188 S3DVertexTangents() : S3DVertex() { }
189 189
190 //! constructor 190 //! constructor
191 S3DVertexTangents(f32 x, f32 y, f32 z, f32 nx=0.0f, f32 ny=0.0f, f32 nz=0.0f, 191 S3DVertexTangents(f32 x, f32 y, f32 z, f32 nx=0.0f, f32 ny=0.0f, f32 nz=0.0f,
192 SColor c = 0xFFFFFFFF, f32 tu=0.0f, f32 tv=0.0f, 192 SColor c = 0xFFFFFFFF, f32 tu=0.0f, f32 tv=0.0f,
193 f32 tanx=0.0f, f32 tany=0.0f, f32 tanz=0.0f, 193 f32 tanx=0.0f, f32 tany=0.0f, f32 tanz=0.0f,
194 f32 bx=0.0f, f32 by=0.0f, f32 bz=0.0f) 194 f32 bx=0.0f, f32 by=0.0f, f32 bz=0.0f)
195 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), Tangent(tanx,tany,tanz), Binormal(bx,by,bz) { } 195 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), Tangent(tanx,tany,tanz), Binormal(bx,by,bz) { }
196 196
197 //! constructor 197 //! constructor
198 S3DVertexTangents(const core::vector3df& pos, SColor c, 198 S3DVertexTangents(const core::vector3df& pos, SColor c,
199 const core::vector2df& tcoords) 199 const core::vector2df& tcoords)
200 : S3DVertex(pos, core::vector3df(), c, tcoords) { } 200 : S3DVertex(pos, core::vector3df(), c, tcoords) { }
201 201
202 //! constructor 202 //! constructor
203 S3DVertexTangents(const core::vector3df& pos, 203 S3DVertexTangents(const core::vector3df& pos,
204 const core::vector3df& normal, SColor c, 204 const core::vector3df& normal, SColor c,
205 const core::vector2df& tcoords, 205 const core::vector2df& tcoords,
206 const core::vector3df& tangent=core::vector3df(), 206 const core::vector3df& tangent=core::vector3df(),
207 const core::vector3df& binormal=core::vector3df()) 207 const core::vector3df& binormal=core::vector3df())
208 : S3DVertex(pos, normal, c, tcoords), Tangent(tangent), Binormal(binormal) { } 208 : S3DVertex(pos, normal, c, tcoords), Tangent(tangent), Binormal(binormal) { }
209 209
210 //! Tangent vector along the x-axis of the texture 210 //! Tangent vector along the x-axis of the texture
211 core::vector3df Tangent; 211 core::vector3df Tangent;
212 212
213 //! Binormal vector (tangent x normal) 213 //! Binormal vector (tangent x normal)
214 core::vector3df Binormal; 214 core::vector3df Binormal;
215 215
216 bool operator==(const S3DVertexTangents& other) const 216 bool operator==(const S3DVertexTangents& other) const
217 { 217 {
218 return ((static_cast<S3DVertex>(*this)==other) && 218 return ((static_cast<S3DVertex>(*this)==other) &&
219 (Tangent == other.Tangent) && 219 (Tangent == other.Tangent) &&
220 (Binormal == other.Binormal)); 220 (Binormal == other.Binormal));
221 } 221 }
222 222
223 bool operator!=(const S3DVertexTangents& other) const 223 bool operator!=(const S3DVertexTangents& other) const
224 { 224 {
225 return ((static_cast<S3DVertex>(*this)!=other) || 225 return ((static_cast<S3DVertex>(*this)!=other) ||
226 (Tangent != other.Tangent) || 226 (Tangent != other.Tangent) ||
227 (Binormal != other.Binormal)); 227 (Binormal != other.Binormal));
228 } 228 }
229 229
230 bool operator<(const S3DVertexTangents& other) const 230 bool operator<(const S3DVertexTangents& other) const
231 { 231 {
232 return ((static_cast<S3DVertex>(*this) < other) || 232 return ((static_cast<S3DVertex>(*this) < other) ||
233 ((static_cast<S3DVertex>(*this) == other) && (Tangent < other.Tangent)) || 233 ((static_cast<S3DVertex>(*this) == other) && (Tangent < other.Tangent)) ||
234 ((static_cast<S3DVertex>(*this) == other) && (Tangent == other.Tangent) && (Binormal < other.Binormal))); 234 ((static_cast<S3DVertex>(*this) == other) && (Tangent == other.Tangent) && (Binormal < other.Binormal)));
235 } 235 }
236 236
237 E_VERTEX_TYPE getType() const 237 E_VERTEX_TYPE getType() const
238 { 238 {
239 return EVT_TANGENTS; 239 return EVT_TANGENTS;
240 } 240 }
241 241
242 S3DVertexTangents getInterpolated(const S3DVertexTangents& other, f32 d) 242 S3DVertexTangents getInterpolated(const S3DVertexTangents& other, f32 d)
243 { 243 {
244 d = core::clamp(d, 0.0f, 1.0f); 244 d = core::clamp(d, 0.0f, 1.0f);
245 return S3DVertexTangents(Pos.getInterpolated(other.Pos, d), 245 return S3DVertexTangents(Pos.getInterpolated(other.Pos, d),
246 Normal.getInterpolated(other.Normal, d), 246 Normal.getInterpolated(other.Normal, d),
247 Color.getInterpolated(other.Color, d), 247 Color.getInterpolated(other.Color, d),
248 TCoords.getInterpolated(other.TCoords, d), 248 TCoords.getInterpolated(other.TCoords, d),
249 Tangent.getInterpolated(other.Tangent, d), 249 Tangent.getInterpolated(other.Tangent, d),
250 Binormal.getInterpolated(other.Binormal, d)); 250 Binormal.getInterpolated(other.Binormal, d));
251 } 251 }
252}; 252};
253 253
254 254
255 255
256inline u32 getVertexPitchFromType(E_VERTEX_TYPE vertexType) 256inline u32 getVertexPitchFromType(E_VERTEX_TYPE vertexType)
257{ 257{
258 switch (vertexType) 258 switch (vertexType)
259 { 259 {
260 case video::EVT_2TCOORDS: 260 case video::EVT_2TCOORDS:
261 return sizeof(video::S3DVertex2TCoords); 261 return sizeof(video::S3DVertex2TCoords);
262 case video::EVT_TANGENTS: 262 case video::EVT_TANGENTS:
263 return sizeof(video::S3DVertexTangents); 263 return sizeof(video::S3DVertexTangents);
264 default: 264 default:
265 return sizeof(video::S3DVertex); 265 return sizeof(video::S3DVertex);
266 } 266 }
267} 267}
268 268
269 269
270} // end namespace video 270} // end namespace video
271} // end namespace irr 271} // end namespace irr
272 272
273#endif 273#endif
274 274