Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021 #include "export.h"
00022 #include "maxheap.h"
00023 #include "tab.h"
00024
00025 class Point3;
00026
00027 namespace GFX_MESH
00028 {
00030 static const unsigned int kMAX_COLORS = 2;
00032 static const unsigned int kMAX_TEXTURES = 8;
00033
00035 enum VertexType {
00036 kPos = 1,
00037 kNormal = 2 ,
00038 kVC0 = 4 ,kVC1 = 8 ,
00039 kUVW0 = 16 ,kUVW1 = 32 ,kUVW2 = 64, kUVW3 = 128,
00040 kUVW4 = 256, kUVW5 = 512, kUVW6 = 1024, kUVW7 = 2048,
00041 kBinormal = 4096, kTangent = 8192
00042 };
00043
00045
00047 class HWVertex : public MaxHeapOperators
00048 {
00049 public:
00050
00052
00055 DllExport HWVertex(DWORD vType);
00056 DllExport HWVertex();
00057 DllExport ~HWVertex();
00058
00059
00061
00062 DllExport void SetVertexType(DWORD vType);
00064 DllExport DWORD GetVertexType();
00065
00066
00068
00073 DllExport void SetUVWSize(unsigned int id, unsigned int size);
00074
00076
00079 DllExport unsigned int GetUVWSize(unsigned int id);
00080
00082
00085 DllExport void SetBuffer(BYTE *vertexBuffer);
00086
00088 DllExport unsigned int GetStride();
00089
00091 DllExport Point3 GetPos();
00094 DllExport void SetPos(Point3 p);
00096 DllExport Point3* GetPosPtr();
00097
00099 DllExport Point3 GetNormal();
00102 DllExport void SetNormal(Point3 p);
00104 DllExport Point3* GetNormalPtr();
00105
00107 DllExport unsigned int GetMaxVC();
00108
00111 DllExport DWORD GetVC(unsigned int id);
00115 DllExport void SetVC(unsigned int id, DWORD c);
00117 DllExport DWORD* GetVCPtr(unsigned int id);
00118
00120 DllExport unsigned int GetMaxUVW();
00121
00124 DllExport float* GetUVW(unsigned int id);
00128 DllExport void SetUVW(unsigned int id, float *uv);
00129
00131 DllExport Point3 GetTangent();
00133 DllExport Point3* GetTangentPtr();
00136 DllExport void SetTangent(Point3 p);
00137
00139 DllExport Point3 GetBinormal();
00141 DllExport Point3* GetBinormalPtr();
00144 DllExport void SetBinormal(Point3 p);
00145
00148 DllExport void CopyDataFrom(HWVertex &hwVertSource);
00150 DllExport BYTE* GetRawBufferPointer();
00151
00152 private:
00153
00154 void Init();
00155
00156 void ComputeStride();
00157
00158
00159 void ComputePointers();
00160
00161 DWORD mVertexType;
00162 BYTE* mVertex;
00163 unsigned int mStride;
00164
00165 Point3 *mP;
00166 Point3 *mN;
00167 DWORD *mVC[kMAX_COLORS];
00168
00169 unsigned int mUVWSizes[kMAX_TEXTURES];
00170 float *mUVW[kMAX_TEXTURES];
00171 Point3 *mTangent;
00172 Point3 *mBinormal;
00173
00174 };
00175
00178 class HWVertexBuffer : public MaxHeapOperators
00179 {
00180 public:
00183 DllExport HWVertexBuffer(DWORD vType);
00185 DllExport ~HWVertexBuffer();
00186
00188 DllExport void FreeBuffer();
00189
00191
00196 DllExport void SetUVWSize(unsigned int id, unsigned int size);
00197
00201 DllExport void SetMaxMapChannel(unsigned int hwChannel, int maxMapChannel);
00204 DllExport int GetMaxMapChannel(unsigned int hwChannel);
00205
00207
00211 DllExport bool CreateBuffer(unsigned int numVertice);
00212
00214 DllExport unsigned int GetStride();
00216 DllExport inline unsigned int Size();
00217
00219 DllExport inline unsigned int NumberVertices();
00220
00222
00225 DllExport bool SetNumberVertices(unsigned int ct);
00226
00227
00230 DllExport inline HWVertex GetHWVert(int id);
00231
00232
00234 DllExport BYTE *GetRawBufferPointer();
00235
00236
00237
00240 DllExport void SetHasConnectionData(bool hasConnectionData);
00242 DllExport bool GetHasConnectionData();
00244
00248 DllExport void SetConnectionData(unsigned int i,unsigned int oldPosID, int oldNormalID);
00249
00251 DllExport unsigned int *GetPositionConnectionList();
00253 DllExport int *GetNormalConnectionList();
00254
00255 private:
00256
00257 bool mHasConnectionData;
00258 Tab<unsigned int> mOriginalVertID;
00259 Tab<int> mOriginalGFXNormalID;
00260
00261
00262
00263
00264 DWORD mVertexType;
00265 HWVertex mHWVertex;
00266
00267 unsigned int mNumberVertices;
00268 unsigned int mStride;
00269 Tab<BYTE> mVertexBuffer;
00270 int mMaxMapChannel[kMAX_TEXTURES];
00271 };
00272
00275 class MeshVertex : public MaxHeapOperators
00276 {
00277 public:
00279 DllExport MeshVertex();
00280
00281
00283 DllExport inline void InitHWVert();
00284
00286 DllExport inline void SetSize(unsigned int s);
00287
00289
00296 DllExport inline bool IsInList(BYTE *hwVert, BYTE *vertexBuffer, unsigned int stride, DWORD &id);
00297
00299
00302 DllExport inline void AddHWVert(DWORD id);
00303
00304
00305 private:
00306
00307 Tab<DWORD> mHWVertex;
00308
00309 };
00310 }