00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015 #include "maxheap.h"
00016 #include "coreexp.h"
00017 #include "PatchTypeConstants.h"
00018 #include <WTypes.h>
00019 #include "TabTypes.h"
00020 #include "point3.h"
00021
00022
00023 class PolyShape;
00024 class BezierShape;
00025 class PatchMesh;
00026 class Mesh;
00027 class Matrix3;
00028
00029
00037 #define CAPTYPE_MORPH 0 //!< Uses the existing vertices in the PolyShape to generate the cap.
00038
00041 #define CAPTYPE_GRID 1 //!< Generates new vertices in the interior of the shape in a grid pattern.
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 #define CF_ABLINE (1<<0)
00067 #define CF_BCLINE (1<<1)
00068 #define CF_CALINE (1<<2)
00069
00070 class CapFace: public MaxHeapOperators {
00071 public:
00072 int va;
00073 int vb;
00074 int vc;
00075 DWORD flags;
00076 CapFace() {}
00077 CapFace(int a, int b, int c, DWORD f) { va=a; vb=b; vc=c; flags=f; }
00078 };
00079
00080
00081
00082
00083
00084 #define MCV_ORIGINAL 0
00085 #define MCV_FREE 1
00086
00087 class MeshCapVert: public MaxHeapOperators {
00088 public:
00089 int type;
00090 int poly;
00091 int index;
00092 int newVert;
00093 MeshCapVert() {}
00094 MeshCapVert(int t, int p, int i, int nv=0) { type=t; poly=p; index=i; newVert=nv; }
00095 };
00096
00097 typedef Tab<CapFace> CapFaceTab;
00098 typedef Tab<MeshCapVert> MeshCapVertTab;
00099
00100
00101
00116 class MeshCapInfo: public MaxHeapOperators {
00117 public:
00118 CapFaceTab faces;
00119 MeshCapVertTab verts;
00120 Point3Tab newVerts;
00122 MeshCapInfo &operator=(MeshCapInfo& from) { faces=from.faces; verts=from.verts; newVerts=from.newVerts; return *this; }
00124 CoreExport void Init(PolyShape* shape);
00128 CoreExport void FreeAll();
00129 };
00130
00131
00132
00133 class PolyLine;
00134
00145 class MeshCapPoly: public MaxHeapOperators {
00146 public:
00147 int numVerts;
00148 int *verts;
00150 MeshCapPoly() { verts = NULL; }
00152 CoreExport void Init(PolyLine &line);
00154 CoreExport ~MeshCapPoly();
00163 CoreExport void SetVert(int index, int vertex);
00164 };
00165
00166
00167
00168
00180 class MeshCapper: public MaxHeapOperators {
00181 public:
00182 int numPolys;
00183 MeshCapPoly *polys;
00189 CoreExport MeshCapper(PolyShape &shape);
00193 CoreExport ~MeshCapper();
00196 CoreExport MeshCapPoly &operator[](int index);
00225 CoreExport int CapMesh(Mesh& mesh, MeshCapInfo& capInfo, BOOL flip, DWORD smooth, Matrix3* tm = NULL, int mtlID = -1);
00226 };
00227
00228
00229
00230 class CapPatch: public MaxHeapOperators {
00231 public:
00232 int type;
00233 int verts[4];
00234 int vecs[8];
00235 int interior[4];
00236 CapPatch() {}
00237 CapPatch(int va, int vab, int vba, int vb, int vbc, int vcb, int vc, int vca, int vac, int i1, int i2, int i3) {
00238 type=PATCH_TRI; verts[0]=va; verts[1]=vb; verts[2]=vc; vecs[0]=vab; vecs[1]=vba; vecs[2]=vbc, vecs[3]=vcb;
00239 vecs[4]=vca; vecs[5]=vac; interior[0]=i1; interior[1]=i2; interior[2]=i3; }
00240 CapPatch(int va, int vab, int vba, int vb, int vbc, int vcb, int vc, int vcd, int vdc, int vd, int vda, int vad, int i1, int i2, int i3, int i4) {
00241 type=PATCH_QUAD; verts[0]=va; verts[1]=vb; verts[2]=vc; verts[3]=vd; vecs[0]=vab; vecs[1]=vba; vecs[2]=vbc, vecs[3]=vcb;
00242 vecs[4]=vcd; vecs[5]=vdc; vecs[6]=vda, vecs[7]=vad; interior[0]=i1; interior[1]=i2; interior[2]=i3; interior[3]=i4; }
00243 };
00244
00245
00246
00247
00248
00249 #define PCVERT_ORIGINAL 0
00250 #define PCVERT_FREE 1
00251
00264 class PatchCapVert: public MaxHeapOperators {
00265 public:
00266 int type;
00267 int poly;
00268 int index;
00270 PatchCapVert() {}
00273 PatchCapVert(int t, int p, int i) { type=t; poly=p; index=i; }
00274 };
00275
00276
00277
00278
00279
00280
00281 #define PCVEC_ORIGINAL 0
00282 #define PCVEC_NEW 1
00283
00298 class PatchCapVec: public MaxHeapOperators {
00299 public:
00300 int type;
00301 int poly;
00302 int index;
00304 PatchCapVec() {}
00307 PatchCapVec(int t, int p, int i) { type=t; poly=p; index=i; }
00308 };
00309
00310 typedef Tab<CapPatch> CapPatchTab;
00311 typedef Tab<PatchCapVert> PatchCapVertTab;
00312 typedef Tab<PatchCapVec> PatchCapVecTab;
00313
00314
00315
00334 class PatchCapInfo: public MaxHeapOperators {
00335 public:
00336 CapPatchTab patches;
00337 PatchCapVertTab verts;
00338 PatchCapVecTab vecs;
00339 Point3Tab newVerts;
00340 Point3Tab newVecs;
00342 PatchCapInfo &operator=(PatchCapInfo &from) { patches=from.patches; verts=from.verts; vecs=from.vecs; newVerts=from.newVerts; newVecs=from.newVecs; return *this; }
00344 CoreExport void Init(BezierShape *shape);
00348 CoreExport void FreeAll();
00349 };
00350
00351
00352
00353 class Spline3D;
00354
00371 class PatchCapPoly: public MaxHeapOperators {
00372 public:
00373 int numVerts;
00374 int numVecs;
00375 int *verts;
00376 int *vecs;
00379 PatchCapPoly() { verts = vecs = NULL; }
00381 CoreExport void Init(Spline3D &spline);
00384 CoreExport ~PatchCapPoly();
00393 CoreExport void SetVert(int index, int vertex);
00402 CoreExport void SetVec(int index, int vector);
00403 };
00404
00405
00406
00407
00420 class PatchCapper: public MaxHeapOperators {
00421 public:
00422 int numPolys;
00423 PatchCapPoly *polys;
00428 CoreExport PatchCapper(BezierShape &shape);
00430 CoreExport ~PatchCapper();
00432 CoreExport PatchCapPoly &operator[](int index);
00463 CoreExport int CapPatchMesh(PatchMesh& mesh, PatchCapInfo& capInfo, BOOL flip, DWORD smooth, Matrix3* tm = NULL, int mtlID = -1);
00464 };
00465
00466