00001 #ifndef __VERTEX_H__
00002 #define __VERTEX_H__
00003
00004 #include "Common/CommonDll.h"
00005 #include <math.h>
00006 #include <memory.h>
00007 #include "Common/Types.h"
00008 #include "Common/Vector.h"
00009
00011
00013
00014 class COMMON_API KIndex
00015 {
00016 public:
00017 unsigned short v0;
00018 unsigned short v1;
00019 unsigned short v2;
00020 };
00021
00023
00025
00026 class COMMON_API KVertex
00027 {
00028 public:
00029
00030 KVector Position;
00031
00032 KVector Normal;
00033
00034 float tu;
00035 float tv;
00036
00037 inline KVertex()
00038 {
00039 tu = 0.0f;
00040 tv = 0.0f;
00041 }
00042 };
00043
00045
00047 class COMMON_API KVertex2
00048 {
00049 public:
00050
00051 KVector Position;
00052
00053 KVector Normal;
00054
00055 float tu1;
00056 float tv1;
00057 float tu2;
00058 float tv2;
00059
00060 inline KVertex2()
00061 {
00062 tu1 = 0.0f;
00063 tv1 = 0.0f;
00064 tu2 = 0.0f;
00065 tv2 = 0.0f;
00066 }
00067
00068 inline bool operator != ( KVertex2& Vertex )
00069 {
00070 return ( ( Position != Vertex.Position ) || ( Normal != Vertex.Normal ) || ( tu1 != Vertex.tu1 ) || ( tv1 != Vertex.tv1 ) || ( tu2 != Vertex.tu2 ) || ( tv2 != Vertex.tv2 ) );
00071 }
00072
00073 inline bool operator == ( KVertex2& Vertex )
00074 {
00075 return ( ( Position == Vertex.Position ) && ( Normal == Vertex.Normal ) && ( tu1 == Vertex.tu1 ) && ( tv1 == Vertex.tv1 ) && ( tu2 == Vertex.tu2 ) && ( tv2 == Vertex.tv2 ) );
00076 }
00077 };
00078
00080
00082 #define KBVERTEX_NUNBLENDWEIGHT 4
00083
00084 class COMMON_API KBVertex
00085 {
00086 public:
00087
00088 KVector m_Position;
00089
00090 u8 m_Weight[KBVERTEX_NUNBLENDWEIGHT];
00091
00092 u8 m_Indices[KBVERTEX_NUNBLENDWEIGHT];
00093
00094 KVector m_Normal;
00095
00096 float m_TU;
00097 float m_TV;
00098
00099 inline KBVertex()
00100 {
00101 }
00102
00103 inline bool operator != ( KBVertex& Vertex )
00104 {
00105 return memcmp( this, &Vertex, sizeof( Vertex ) ) ? true : false;
00106 }
00107
00108 inline bool operator == ( KBVertex& Vertex )
00109 {
00110 return memcmp( this, &Vertex, sizeof( Vertex ) ) ? false : true;
00111 }
00112 };
00113
00115
00117
00118 class COMMON_API KLVertex
00119 {
00120 public:
00121
00122 KVector Position;
00123
00124 int Color;
00125 int Specular;
00126
00127 float tu;
00128 float tv;
00129
00130 inline KLVertex()
00131 {
00132 Color = 0;
00133 Specular = 0;
00134 tu = 0.0f;
00135 tv = 0.0f;
00136 }
00137 };
00138
00139
00140 class COMMON_API KLVertex2
00141 {
00142 public:
00143
00144 KVector Position;
00145
00146 int Color;
00147 int Specular;
00148
00149 float tu1;
00150 float tv1;
00151 float tu2;
00152 float tv2;
00153
00154 inline KLVertex2()
00155 {
00156 Color = 0;
00157 Specular = 0;
00158 tu1 = 0.0f;
00159 tv1 = 0.0f;
00160 tu2 = 0.0f;
00161 tv2 = 0.0f;
00162 }
00163
00164 inline KLVertex2 operator +( KLVertex2& v )
00165 {
00166 KLVertex2 Result;
00167
00168 Result = *this;
00169 Result.Position = Position + v.Position;
00170 Result.tu1 = tu1 + v.tu1;
00171 Result.tv1 = tv1 + v.tv1;
00172 Result.tu2 = tu2 + v.tu2;
00173 Result.tv2 = tv2 + v.tv2;
00174
00175 return Result;
00176 }
00177
00178 inline KLVertex2 operator /( KLVertex2& v )
00179 {
00180 KLVertex2 Result;
00181
00182 Result = *this;
00183 Result.Position = Position / v.Position;
00184 Result.tu1 = tu1 / v.tu1;
00185 Result.tv1 = tv1 / v.tv1;
00186 Result.tu2 = tu2 / v.tu2;
00187 Result.tv2 = tv2 / v.tv2;
00188
00189 return Result;
00190 }
00191
00192 inline KLVertex2 operator /( float f )
00193 {
00194 KLVertex2 Result;
00195
00196 Result = *this;
00197 Result.Position = Position / f;
00198 Result.tu1 = tu1 / f;
00199 Result.tv1 = tv1 / f;
00200 Result.tu2 = tu2 / f;
00201 Result.tv2 = tv2 / f;
00202
00203 return Result;
00204 }
00205
00206 inline bool operator ==( KLVertex2& v )
00207 {
00208 return ( ( Position == v.Position ) &&
00209 ( Color == v.Color ) &&
00210 ( Specular == v.Specular ) &&
00211 ( tu1 == v.tu1 ) &&
00212 ( tv1 == v.tv1 ) &&
00213 ( tu2 == v.tu2 ) &&
00214 ( tv2 == v.tv2 ) );
00215 }
00216 };
00217
00218
00219 class COMMON_API KLVertex3
00220 {
00221 public:
00222
00223 KVector Position;
00224
00225 int Color;
00226 int Specular;
00227
00228 float tu1;
00229 float tv1;
00230 float tu2;
00231 float tv2;
00232 float tu3;
00233 float tv3;
00234
00235 inline KLVertex3()
00236 {
00237 Color = 0;
00238 Specular = 0;
00239 tu1 = 0.0f;
00240 tv1 = 0.0f;
00241 tu2 = 0.0f;
00242 tv2 = 0.0f;
00243 tu3 = 0.0f;
00244 tv3 = 0.0f;
00245 }
00246 };
00247
00249
00251
00252 class COMMON_API KTLVertex
00253 {
00254 public:
00255 float x;
00256 float y;
00257 float z;
00258 float rhw;
00259 int color;
00260 int specular;
00261 float tu;
00262 float tv;
00263
00264 inline KTLVertex()
00265 {
00266 x = 0.0f;
00267 y = 0.0f;
00268 z = 0.0f;
00269 rhw = 0.0f;
00270 color = 0;
00271 specular = 0;
00272 tu = 0.0f;
00273 tv = 0.0f;
00274 }
00275
00276 inline KTLVertex( float x, float y, float z, float rhw, int color, int specular = 0, float tu = 0.0f, float tv = 0.0f)
00277 {
00278 this->x = x;
00279 this->y = y;
00280 this->z = z;
00281 this->rhw = rhw;
00282 this->color = color;
00283 this->specular = specular;
00284 this->tu = tu;
00285 this->tv = tv;
00286 }
00287 };
00288
00290
00292
00293 class COMMON_API KTLVertex2
00294 {
00295 public:
00296 float x;
00297 float y;
00298 float z;
00299 float rhw;
00300 int color;
00301 int specular;
00302 float tu1;
00303 float tv1;
00304 float tu2;
00305 float tv2;
00306
00307 inline KTLVertex2()
00308 {
00309 x = 0.0f;
00310 y = 0.0f;
00311 z = 0.0f;
00312 rhw = 0.0f;
00313 color = 0;
00314 specular = 0;
00315 tu1 = 0.0f;
00316 tv1 = 0.0f;
00317 tu2 = 0.0f;
00318 tv2 = 0.0f;
00319 }
00320
00321 inline KTLVertex2( float x, float y, float z, float rhw, int color, int specular = 0, float tu1 = 0.0f, float tv1 = 0.0f, float tu2 = 0.0f, float tv2 = 0.0f)
00322 {
00323 this->x = x;
00324 this->y = y;
00325 this->z = z;
00326 this->rhw = rhw;
00327 this->color = color;
00328 this->specular = specular;
00329 this->tu1 = tu1;
00330 this->tv1 = tv1;
00331 this->tu2 = tu2;
00332 this->tv2 = tv2;
00333 }
00334 };
00335
00336 #endif // __VERTEX_H__