00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00029 #ifndef _DONNEES_H
00030 #define _DONNEES_H
00031
00032 #include <vector>
00033
00034
00035
00039 class Vect3D
00040 {
00041
00042 protected:
00043
00045 float x1;
00046
00048 float x2;
00049
00051 float x3;
00052
00053 public:
00054
00056 Vect3D() : x1(0.0), x2(0.0), x3(0.0) {}
00057
00059 inline Vect3D(float x, float y, float z)
00060 {
00061 x1 = x;
00062 x2 = y;
00063 x3 = z;
00064 }
00065
00067 inline Vect3D(const Vect3D &vect3d)
00068 {
00069 x1 = vect3d.x1;
00070 x2 = vect3d.x2;
00071 x3 = vect3d.x3;
00072 }
00073
00075 inline Vect3D &operator=(const Vect3D &vect3d)
00076 {
00077 x1 = vect3d.x1;
00078 x2 = vect3d.x2;
00079 x3 = vect3d.x3;
00080
00081 return *this;
00082 }
00083
00085 ~Vect3D() {};
00086
00087 };
00088
00089
00093 class Coord : Vect3D
00094 {
00095
00096 public:
00097
00099 Coord() : Vect3D() {};
00100
00102 Coord(float x, float y, float z) : Vect3D(x, y, z) {};
00103
00105 inline float getX() {return x1;}
00106
00108 inline float getY() {return x2;}
00109
00111 inline float getZ() {return x3;}
00112
00114 inline void setX(float x) {x1 = x;}
00115
00117 inline void setY(float y) {x2 = y;}
00118
00120 inline void setZ(float z) {x3 = z;}
00121
00123 Coord& operator=(Coord b)
00124 {
00125 setX(b.getX());
00126 setY(b.getY());
00127 setZ(b.getZ());
00128
00129 return *this;
00130 }
00131
00133 inline Coord& operator+=(Coord b)
00134 {
00135 float x, y, z;
00136
00137 x = getX() + b.getX();
00138 y = getY() + b.getY();
00139 z = getZ() + b.getZ();
00140
00141 setX(x);
00142 setY(y);
00143 setZ(z);
00144
00145 return *this;
00146
00147 }
00148
00150 Coord& operator-=(Coord b)
00151 {
00152 float x, y, z;
00153
00154 x = getX() - b.getX();
00155 y = getY() - b.getY();
00156 z = getZ() - b.getZ();
00157
00158 setX(x);
00159 setY(y);
00160 setZ(z);
00161
00162 return *this;
00163 }
00164
00166 Coord operator-(const Coord& b) const
00167 {
00168 Coord tmp(*this);
00169
00170 return tmp -= b;
00171 }
00172
00174 Coord operator *(float alpha)
00175 {
00176 return Coord((getX() * alpha),
00177 (getY() * alpha),
00178 (getZ() * alpha));
00179 }
00180
00182 friend Coord min(Coord a, Coord b)
00183 {
00184 return Coord(
00185 std::min(a.getX(), b.getX()),
00186 std::min(a.getY(), b.getY()),
00187 std::min(a.getZ(), b.getZ())
00188 );
00189 }
00190
00192 friend Coord max(Coord a, Coord b)
00193 {
00194 return Coord(
00195 std::max(a.getX(), b.getX()),
00196 std::max(a.getY(), b.getY()),
00197 std::max(a.getZ(), b.getZ()));
00198 }
00199
00201 friend Coord operator+(Coord a, Coord b);
00202
00204 friend Coord operator-(Coord a, Coord b);
00205
00207 ~Coord() {}
00208
00209 };
00210
00211
00215 Coord operator+(Coord a, Coord b);
00216
00217
00221 Coord operator-(Coord a, Coord b);
00222
00223
00227 class Couleur : Vect3D
00228 {
00229 public:
00230
00232 float _alpha;
00233
00234
00236 Couleur() : Vect3D() {_alpha = 0.0;};
00237
00239 inline Couleur(float r, float g, float b) : Vect3D(r, g, b) {_alpha = 0.0;};
00240
00242 inline Couleur(float r, float g, float b, float a) : Vect3D(r, g, b) {_alpha = a;};
00243
00245 inline float getR() {return x1;}
00246
00248 inline float getG() {return x2;}
00249
00251 inline float getB() {return x3;}
00252
00254 inline float getAlpha() {return _alpha;}
00255
00257 inline void setR(float r) {x1 = r;}
00258
00260 inline void setG(float g) {x2 = g;}
00261
00263 inline void setB(float b) {x3 = b;}
00264
00266 inline void setAlpha(float a) {_alpha = a;}
00267
00269 inline Couleur &operator=(Couleur couleur)
00270 {
00271 setR(couleur.getR());
00272 setG(couleur.getG());
00273 setB(couleur.getB());
00274 setAlpha(couleur.getAlpha());
00275
00276 return *this;
00277 }
00278
00280 ~Couleur() {}
00281
00282 };
00283
00284
00288 struct Image
00289 {
00290
00292 unsigned long sizeX;
00293
00295 unsigned long sizeY;
00296
00298 char *data;
00299
00300 };
00301
00302
00306 struct Texture
00307 {
00309 float a;
00310
00312 float b;
00313 };
00314
00315
00319 class Light
00320 {
00321 public:
00322
00324 Couleur _amb;
00325
00327 Couleur _diff;
00328
00330 Couleur _spec;
00331
00333 Coord _pos;
00334
00336 float _alpha;
00337
00338
00340 Light() : _amb(), _diff(), _spec(), _pos(), _alpha() {}
00341
00343 inline Light(const Light &light)
00344 {
00345 _amb = light._amb;
00346 _diff = light._diff;
00347 _spec = light._spec;
00348 _pos = light._pos;
00349 _alpha = light._alpha;
00350 }
00351
00353 inline Light &operator=(const Light &light)
00354 {
00355 _amb = light._amb;
00356 _diff = light._diff;
00357 _spec = light._spec;
00358 _pos = light._pos;
00359 _alpha = light._alpha;
00360
00361 return *this;
00362 }
00363
00365 ~Light() {};
00366
00367 };
00368
00369
00373 class Material
00374 {
00375 public:
00376
00378 Couleur _amb;
00379
00381 Couleur _emis;
00382
00384 Couleur _diff;
00385
00387 Couleur _spec;
00388
00390 float _shin;
00391
00392
00394 Material() : _amb(), _emis(), _diff(), _spec(), _shin() {}
00395
00397 inline Material(const Material &mater)
00398 {
00399 _amb = mater._amb;
00400 _emis = mater._emis;
00401 _diff = mater._diff;
00402 _spec = mater._spec;
00403 _shin = mater._shin;
00404 }
00405
00407 inline Material &operator=(const Material &mater)
00408 {
00409 _amb = mater._amb;
00410 _emis = mater._emis;
00411 _diff = mater._diff;
00412 _spec = mater._spec;
00413 _shin = mater._shin;
00414
00415 return *this;
00416
00417 }
00418
00420 ~Material() {};
00421
00422 };
00423
00424
00425 #endif