patch.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // FILE:        patch.h
00012 // DESCRIPTION: Main include file for bezier patches
00013 // AUTHOR:      Tom Hudson
00014 // HISTORY:     Created June 21, 1995
00015 //              June 17, 1997 TH -- Added second texture mapping channel
00016 //              12-10-98 Peter Watje added hide interior edge support and hidding patches
00017 //              12-31-98 Peter Watje added hook patches, patch extrusion and bevels
00018 //**************************************************************************/
00019 
00020 #pragma once
00021 
00022 #include "maxheap.h"
00023 #include "coreexp.h"
00024 #include "meshlib.h"
00025 #include "hitdata.h"
00026 #include "maxtess.h"
00027 #include "PatchTypeConstants.h"
00028 
00029 // Uncomment the following to check for missed triangular patch 'aux' computation
00030 //#define CHECK_TRI_PATCH_AUX
00031 
00032 // Value for undefined patches and vertices
00033 #define PATCH_UNDEFINED -1
00034 
00035 // TH 5/17/99 -- Commented out MULTI_PROCESSING, it wasn't being used and was causing
00036 // am obscure memory leak (Defect 180889)
00037 //#define MULTI_PROCESSING  TRUE        // TRUE turns on mp vertex transformation
00038 
00039 class HookPoint: public MaxHeapOperators 
00040     {
00041 public:
00042     int upperPoint, lowerPoint;
00043     int upperVec,lowerVec;
00044     int upperHookVec, lowerHookVec;
00045     int hookPoint;
00046     int upperPatch, lowerPatch, hookPatch;
00047     int hookEdge, upperEdge, lowerEdge;
00048     };
00049 
00050 class ExtrudeData: public MaxHeapOperators
00051 {
00052 public:
00053     int u,l,uvec,lvec;
00054 //3-10-99 watje
00055     Point3 edge;
00056     Point3 bevelDir;
00057 };
00058 
00059 class ISave;
00060 class ILoad;
00061 class PatchMesh;
00062 
00063 #define NEWPATCH
00064 
00065 class PRVertex: public MaxHeapOperators {
00066     public:
00067         PRVertex()  { rFlags = 0; /*ern = NULL;*/ }
00068         CoreExport ~PRVertex(); 
00069 
00070         DWORD       rFlags;     
00071         int         pos[3]; 
00072     };                    
00073 
00074 // Patch vector flags
00075 #define PVEC_INTERIOR   (1<<0)
00076 #define PVEC_INTERIOR_MASK  0xfffffffe
00077 
00078 // Vector flag processing tables
00079 #define NUM_PATCH_VEC_FLAGS 1
00080 const DWORD PatchVecFlagMasks[] = {1};
00081 const int PatchVecFlagShifts[] = {0};
00082 
00083 // Patch vectors
00084 
00111 class PatchVec: public MaxHeapOperators {
00112     public:
00113         Point3 p;           // Location
00114         int vert;           // Vertex which owns this vector
00115         IntTab patches;     // List of patches using this vector
00116         DWORD flags;
00117         int aux1;           // Used to track topo changes during editing (Edit Patch)
00118         int aux2;           // Used to track topo changes during editing (PatchMesh)
00122         CoreExport PatchVec();
00128         CoreExport PatchVec(PatchVec &from);
00131         void ResetData() { vert = PATCH_UNDEFINED; patches.Delete(0,patches.Count());}
00138         CoreExport BOOL AddPatch(int index);
00143         CoreExport PatchVec& operator=(PatchVec& from);
00150         void Transform(Matrix3 &tm) { p = p * tm; }
00151 
00154         CoreExport IOResult Save(ISave* isave);
00159         CoreExport IOResult Load(ILoad* iload);
00160     };
00161 
00162 // Patch vertex flags
00163 #define PVERT_COPLANAR  (1<<0)
00164 #define PVERT_CORNER (0)
00165 #define PVERT_TYPE_MASK 0xfffffffe
00166 //watje 12-10-98
00167 #define PVERT_HIDDEN    (1<<1)
00168 #define PVERT_HIDDEN_MASK 0xfffffffd
00169 // CAL-04/28/03
00170 #define PVERT_RESET     (1<<2)
00171 
00172 // Vertex flag processing tables
00173 #define NUM_PATCH_VERT_FLAGS 2
00174 const DWORD PatchVertFlagMasks[] = {1, 1};
00175 const int PatchVertFlagShifts[] = {0, 1};
00176 
00177 // Patch vertex
00178 
00221 class PatchVert: public MaxHeapOperators {
00222     public:
00223         Point3 p;           // Location
00224         IntTab vectors;     // List of vectors attached to this vertex
00225         IntTab patches;     // List of patches using this vertex
00226         IntTab edges;       // List of edges using this vertex
00227         DWORD flags;
00228         int aux1;           // Used to track topo changes during editing (Edit Patch)
00229         int aux2;           // Used to track topo changes during editing (PatchMesh)
00232         CoreExport PatchVert();
00238         CoreExport PatchVert(PatchVert &from);
00241         ~PatchVert() { ResetData(); }
00246         CoreExport PatchVert& operator=(PatchVert& from);
00249         CoreExport void ResetData();
00256         CoreExport int FindVector(int index);
00262         CoreExport void AddVector(int index);
00268         CoreExport void DeleteVector(int index);
00275         CoreExport int FindPatch(int index);
00281         CoreExport void AddPatch(int index);
00287         CoreExport void DeletePatch(int index);
00294         CoreExport int FindEdge(int index);
00300         CoreExport void AddEdge(int index);
00306         CoreExport void DeleteEdge(int index);
00313         void Transform(Matrix3 &tm) { p = p * tm; }
00314 
00315 //watje  12-10-98
00322         CoreExport void SetHidden(BOOL sw = TRUE)
00323             {
00324             if(sw)
00325                 flags |= PVERT_HIDDEN;
00326             else
00327                 flags &= ~PVERT_HIDDEN;
00328             }
00329 //watje  12-10-98
00333         BOOL IsHidden() { return (flags & PVERT_HIDDEN) ? TRUE : FALSE; }
00334 
00337         CoreExport IOResult Save(ISave* isave);
00342         CoreExport IOResult Load(ILoad* iload);
00343     };
00344 
00356 class PatchTVert: public MaxHeapOperators {
00357     public:
00358         UVVert p;           // Location
00359         int aux1;           // Used to track topo changes during editing (Edit Patch)
00362         CoreExport PatchTVert() { p = UVVert(0,0,0); aux1 = -1; }
00370         CoreExport PatchTVert(float u, float v, float w) { p=UVVert(u,v,w); aux1 = -1; }
00372         CoreExport operator UVVert&() { return p; }
00377         CoreExport PatchTVert& operator=(const UVVert &from) { p=from; return *this; }
00378     };
00379 
00402 class PatchEdge: public MaxHeapOperators {
00403     public:
00404         int v1;     // Index of first vertex
00405         int vec12;  // Vector from v1 to v2
00406         int vec21;  // Vector from v2 to v1
00407         int v2;     // Index of second vertex
00408         IntTab patches; // List of patches using this edge
00409         int aux1;   // Used to track topo changes during editing (Edit Patch)
00410         int aux2;   // Used to track topo changes during editing (PatchMesh)
00413         CoreExport PatchEdge();
00416         CoreExport PatchEdge(const PatchEdge &from);
00419         CoreExport PatchEdge(int v1, int vec12, int vec21, int v2, int p1, int p2, int aux1=-1, int aux2=-1);
00420         // Dump the patch edge structure via DebugPrints
00424         CoreExport void Dump();
00427         CoreExport IOResult Save(ISave* isave);
00430         CoreExport IOResult Load(ILoad* iload);
00431     };
00432 
00433 // Patch Flags:
00434 // WARNING:  If you add flags here, you'll need to update the table below...
00435 #define PATCH_AUTO          (1<<0)  // Interior verts computed automatically if set
00436 #define PATCH_MANUAL        (0)     // Interior verts stored in 'interior' array
00437 #define PATCH_INTERIOR_MASK 0xfffffffe
00438 //watje 12-10-98
00439 #define PATCH_HIDDEN        (1<<1)  //patch is hidden
00440 
00441 //watje new patch mapping
00442 #define PATCH_LINEARMAPPING     (1<<2)  //patch uses the old liunear mapping scheme else use the new mapping
00443 
00444 #define PATCH_USE_CURVED_MAPPING_ON_VERTEX_COLOR        (1<<3)  //patch will use the new curved mapping for vertex colors also
00445 
00446 // The mat ID is stored in the HIWORD of the patch flags
00447 #define PATCH_MATID_SHIFT   16
00448 #define PATCH_MATID_MASK    0xFFFF
00449 
00450 // Patch flag processing tables
00451 #define NUM_PATCH_PATCH_FLAGS 5
00452 const DWORD PatchPatchFlagMasks[] = {1, 1, 1, 1, 0xffff};
00453 const int PatchPatchFlagShifts[] = {0, 1, 2, 3, 16};
00454 
00513 class Patch : public BaseInterfaceServer {  
00514     public:
00515         int type;           // See types, above
00516         int v[4];           // Can have three or four vertices
00517         int vec[8];         // Can have six or eight vector points
00518         int interior[4];    // Can have one or four interior vertices
00519         Point3 aux[9];      // Used for triangular patches only -- Degree 4 control points
00520         int edge[4];        // Pointers into edge list -- Can have three or four
00521         DWORD   smGroup;    // Defaults to 1 -- All patches smoothed in a PatchMesh
00522         DWORD   flags;      // See flags, above
00523         int aux1;           // Used to track topo changes during editing (Edit Patch)
00524         int aux2;           // Used to track topo changes during editing (PatchMesh)
00525 
00526 #ifdef CHECK_TRI_PATCH_AUX
00527         Point3 auxSource[9];
00528         CoreExport void CheckTriAux(PatchMesh *pMesh);
00529 #endif //CHECK_TRI_PATCH_AUX
00530 
00535         CoreExport Patch(); // WARNING: This does not allocate arrays -- Use SetType(type) or Patch(type)
00536         CoreExport Patch(int type);
00539         CoreExport Patch(Patch& fromPatch);
00541         CoreExport ~Patch();
00544         CoreExport void Init();
00551         CoreExport void setVerts(int *vrt);
00557         void    setVerts(int a, int b, int c)  { assert(type == PATCH_TRI); v[0]=a; v[1]=b; v[2]=c; }
00563         void    setVerts(int a, int b, int c, int d)  { assert(type == PATCH_QUAD); v[0]=a; v[1]=b; v[2]=c; v[3]=d; }
00570         void    setVecs(int ab, int ba, int bc, int cb, int ca, int ac) {
00571             assert(type == PATCH_TRI);
00572             vec[0]=ab; vec[1]=ba; vec[2]=bc; vec[3]=cb; vec[4]=ca; vec[5]=ac;
00573             }
00582         void    setVecs(int ab, int ba, int bc, int cb, int cd, int dc, int da, int ad) {
00583             assert(type == PATCH_QUAD);
00584             vec[0]=ab; vec[1]=ba; vec[2]=bc; vec[3]=cb; vec[4]=cd; vec[5]=dc; vec[6]=da, vec[7]=ad;
00585             }
00591         void    setInteriors(int a, int b, int c) {
00592             assert(type == PATCH_TRI);
00593             interior[0]=a; interior[1]=b; interior[2]=c;
00594             }
00601         void    setInteriors(int a, int b, int c, int d) {
00602             assert(type == PATCH_QUAD);
00603             interior[0]=a; interior[1]=b; interior[2]=c; interior[3]=d;
00604             }
00610         int     getVert(int index)  { return v[index]; }
00612         int *   getAllVerts(void)   { return v; }
00613         MtlID   getMatID() {return (int)((flags>>FACE_MATID_SHIFT)&FACE_MATID_MASK);}
00614         void    setMatID(MtlID id) {flags &= 0xFFFF; flags |= (DWORD)(id<<FACE_MATID_SHIFT);}
00615         Point3  getUVW(int index) const;        // UVW of a Triangle's i-th vertex
00616         Point2  getUV(int index) const;         // UV of a Quadrilateral's i-th vertex
00617         bool    getVertUVW(int vert, Point3 &uvw) const;    // UVW of a Triangle's vertex
00618         bool    getVertUV(int vert, Point2 &uv) const;      // UV of a Quadrilateral's vertex
00619         Point3 BicubicSurface(PatchMesh *pMesh, const float *uu, const float *vv);
00633         CoreExport Point3 interp(PatchMesh *pMesh, float u, float v, float w);  // Triangle
00647         CoreExport Point3 interp(PatchMesh *pMesh, float u, float v);           // Quadrilateral
00648         CoreExport Point3 WUTangent(PatchMesh *pMesh, float u, float v, float w);   // Triangle WU Tangent
00649         CoreExport Point3 UVTangent(PatchMesh *pMesh, float u, float v, float w);   // Triangle UV Tangent
00650         CoreExport Point3 VWTangent(PatchMesh *pMesh, float u, float v, float w);   // Triangle VW Tangent
00651         CoreExport Point3 UTangent(PatchMesh *pMesh, float u, float v); // Quadrilateral U Tangent
00652         CoreExport Point3 VTangent(PatchMesh *pMesh, float u, float v); // Quadrilateral V Tangent
00653         CoreExport Point3 Normal(PatchMesh *pMesh, float u, float v, float w);  // Triangle Surface Normal
00654         CoreExport Point3 Normal(PatchMesh *pMesh, float u, float v);           // Quadrilateral Surface Normal
00657         CoreExport void ComputeAux(PatchMesh *pMesh, int index);
00658         CoreExport void ComputeAux(PatchMesh *pMesh);   // Do all degree-4 points
00667         CoreExport void computeInteriors(PatchMesh* pMesh);
00678         CoreExport void SetType(int type, BOOL init = FALSE);
00683         CoreExport Patch& operator=(Patch& from);
00689         CoreExport void SetAuto(BOOL sw = TRUE);
00692         BOOL IsAuto() { return (flags & PATCH_AUTO) ? TRUE : FALSE; }
00693 
00694 //watje 12-10-98
00701         CoreExport void SetHidden(BOOL sw = TRUE);
00702 //watje 12-10-98
00706         BOOL IsHidden() { return (flags & PATCH_HIDDEN) ? TRUE : FALSE; }
00707         // Tell the caller which edge uses the two supplied vert indexes (-1 if error)
00721         int WhichEdge(int v1, int v2);
00722         // Tell the caller which vertex uses the supplied vert index (-1 if error)
00736         int WhichVert(int v);
00737 
00738         // Dump the patch mesh structure via DebugPrints
00739 
00745         CoreExport void Dump();
00746 
00747         CoreExport IOResult Save(ISave* isave);
00748         CoreExport IOResult Load(ILoad* iload);
00749     };
00750 
00751 // Separate class for patch texture verts
00765 class TVPatch: public MaxHeapOperators {    
00766     public:
00767         int tv[4];          // Texture verts (always 4 here, even for tri patches)
00768 //watje new patch mapping
00769         int handles[8];
00770         int interiors[4];
00771 
00773         CoreExport TVPatch();
00776         CoreExport TVPatch(const TVPatch& fromPatch);
00779         CoreExport void Init();
00786         CoreExport void setTVerts(int *vrt, int count);
00791         CoreExport void setTVerts(int a, int b, int c, int d = 0);
00792 
00793 //watje new patch mapping
00794 //sets the indices of the patch handles
00801         CoreExport void setTHandles(int *vrt, int count);
00809         CoreExport void setTHandles(int a, int b, int c, int d ,
00810                                    int e, int f, int g = 0 , int h = 0);
00811 //sets the indices of the patch interior handles
00819         CoreExport void setTInteriors(int *vrt, int count);
00825         CoreExport void setTInteriors(int a, int b, int c, int d = 0);
00826 
00831         int     getTVert(int index) { return tv[index]; }
00833         int *   getAllTVerts(void)  { return tv; }
00838         CoreExport TVPatch& operator=(const TVPatch& from);
00839 
00842         CoreExport IOResult Save(ISave* isave);
00847         CoreExport IOResult Load(ILoad* iload);
00848     };
00849 
00850 CoreExport void setPatchIntrFunc(INTRFUNC fn);
00851 
00852 // Special types for patch vertex hits -- Allows us to distinguish what they hit on a pick
00853 #define PATCH_HIT_PATCH     0
00854 #define PATCH_HIT_EDGE      1
00855 #define PATCH_HIT_VERTEX    2
00856 #define PATCH_HIT_VECTOR    3
00857 #define PATCH_HIT_INTERIOR  4
00858 
00880 class PatchSubHitRec: public MaxHeapOperators {
00881     private:        
00882         PatchSubHitRec *next;
00883     public:
00884         DWORD   dist;
00885         PatchMesh *patch;
00886         int     index;
00887         int     type;
00888 
00891         PatchSubHitRec( DWORD dist, PatchMesh *patch, int index, int type, PatchSubHitRec *next ) 
00892             { this->dist = dist; this->patch = patch; this->index = index; this->type = type; this->next = next; }
00893 
00895         PatchSubHitRec *Next() { return next; }     
00896     };
00897 
00903 class SubPatchHitList: public MaxHeapOperators {
00904     private:
00905         PatchSubHitRec *first;
00906     public:
00908         SubPatchHitList() { first = NULL; }
00910         CoreExport ~SubPatchHitList();
00911 
00913         PatchSubHitRec *First() { return first; }
00933         CoreExport void AddHit( DWORD dist, PatchMesh *patch, int index, int type );
00934     };
00935 
00936 
00937 // Special storage class for hit records so we can know which object was hit
00955 class PatchHitData : public HitData {
00956     public:
00957         PatchMesh *patch;
00958         int index;
00959         int type;
00962         PatchHitData(PatchMesh *patch, int index, int type)
00963             { this->patch = patch; this->index = index; this->type = type; }
00964         ~PatchHitData() {}
00965     };
00966 
00967 // Flags for sub object hit test
00968 
00969 // NOTE: these are the same bits used for object level.
00970 #define SUBHIT_PATCH_SELONLY    (1<<0)
00971 #define SUBHIT_PATCH_UNSELONLY  (1<<2)
00972 #define SUBHIT_PATCH_ABORTONHIT (1<<3)
00973 #define SUBHIT_PATCH_SELSOLID   (1<<4)
00974 
00975 #define SUBHIT_PATCH_VERTS      (1<<24)
00976 #define SUBHIT_PATCH_VECS       (1<<25)
00977 #define SUBHIT_PATCH_PATCHES    (1<<26)
00978 #define SUBHIT_PATCH_EDGES      (1<<27)
00979 #define SUBHIT_PATCH_TYPEMASK   (SUBHIT_PATCH_VERTS|SUBHIT_PATCH_VECS|SUBHIT_PATCH_EDGES|SUBHIT_PATCH_PATCHES)
00980 #define SUBHIT_PATCH_IGNORE_BACKFACING (1<<28)
00981 
00982 
00983 
00984 // Selection level bits.
00985 #define PATCH_OBJECT        (1<<0)
00986 #define PATCH_VERTEX        (1<<1)
00987 #define PATCH_PATCH         (1<<2)
00988 #define PATCH_EDGE          (1<<3)
00989 #define PATCH_HANDLE        (1<<4)
00990 
00991 // Types for Subdivision, below:
00992 #define SUBDIV_EDGES 0
00993 #define SUBDIV_PATCHES 1
00994 
00995 // Relax defaults
00996 #define DEF_PM_RELAX FALSE
00997 #define DEF_PM_RELAX_VIEWPORTS  TRUE
00998 #define DEF_PM_RELAX_VALUE  0.0f
00999 #define DEF_PM_ITER 1
01000 #define DEF_PM_BOUNDARY TRUE
01001 #define DEF_PM_SADDLE   FALSE
01002 
01003 // PatchMesh flags
01004 #define PM_HITTEST_REQUIRE_ALL (1<<0)   // Force faces to be hit only if all triangles are hit.  (Internal use.)
01005 
01006 namespace MaxGraphics {
01007     class IPatchMeshInternal;
01008 }
01009 
01090 class PatchMesh : public BaseInterfaceServer {
01091     friend class Patch;
01092     friend class MaxGraphics::IPatchMeshInternal;
01093 
01094     private:
01095 #if MULTI_PROCESSING
01096         static int      refCount;
01097         static HANDLE   xfmThread;
01098         static HANDLE   xfmMutex;
01099         static HANDLE   xfmStartEvent;
01100         static HANDLE   xfmEndEvent;
01101         friend DWORD WINAPI xfmFunc(LPVOID ptr);
01102 #endif
01103         // derived data-- can be regenerated
01104         PRVertex        *rVerts;        // <<< instance specific.
01105         PRVertex        *rVecs;         // <<< instance specific.
01106         GraphicsWindow  *cacheGW;       // identifies rVerts cache
01107         Box3            bdgBox;         // object space--depends on geom+topo
01108  
01109         // The number of interpolations this patch will use for mesh conversion
01110         int         meshSteps;
01111 //3-18-99 watje to support render steps
01112         int         meshStepsRender;
01113         BOOL        showInterior;
01114         BOOL        usePatchNormals;    // CAL-05/15/03: use true patch normals. (FID #1760)
01115 
01116         BOOL        adaptive;
01117         // GAP tessellation
01118         TessApprox  viewTess;   // tessellation control for the interactive renderer
01119         TessApprox  prodTess;   // tessellation control for the production renderer
01120         TessApprox  dispTess;   // displacment tessellation control for the production renderer
01121         BOOL        mViewTessNormals;   // use normals from the tesselator
01122         BOOL        mProdTessNormals;   // use normals from the tesselator
01123         BOOL        mViewTessWeld;  // Weld the mesh after tessellation
01124         BOOL        mProdTessWeld;  // Weld the mesh after tessellation
01125 
01126         // Vertex and patch work arrays -- for snap code
01127         int         snapVCt;
01128         int         snapPCt;
01129         char        *snapV;
01130         char        *snapP;
01131 
01132         // -------------------------------------
01133         //
01134         DWORD       flags;          // work flags- 
01135 
01136         // Hidden Map Channels
01137         // Texture Coord assignment 
01138         Tab<int> numHTVerts;
01139         Tab<PatchTVert *> htVerts;
01140         Tab<TVPatch *> htvPatches;       
01141 
01142         // relax options
01143         BOOL relax;
01144         BOOL relaxViewports;
01145         float relaxValue;
01146         int relaxIter;
01147         BOOL relaxBoundary;
01148         BOOL relaxSaddle;
01149         
01150         void SetFlag(DWORD fl, bool val=TRUE) { if (val) flags |= fl; else flags &= ~fl; }
01151         void ClearFlag(DWORD fl) { flags &= ~fl; }
01152         bool GetFlag(DWORD fl) const { return (flags & fl) ? true : false; }
01153 
01154         int         renderPatch( GraphicsWindow *gw, int index);
01155         int         renderEdge( GraphicsWindow *gw, int index, HitRegion *hr);
01156         void        checkRVertsAlloc(void);
01157         void        setCacheGW(GraphicsWindow *gw)  { cacheGW = gw; }
01158         GraphicsWindow *getCacheGW(void)            { return cacheGW; }
01159 
01160         void        freeVerts();
01161         void        freeTVerts(int channel=0);
01162         void        freeVecs();
01163         void        freePatches();
01164         void        freeTVPatches(int channel=0);
01165         void        freeEdges();
01166         void        freeRVerts();
01167         void        freeSnapData();
01168         int         buildSnapData(GraphicsWindow *gw,int verts,int edges);
01169 
01170         // Mesh caches
01171         Mesh        unrelaxedMesh;  // Unrelaxed
01172         Mesh        relaxedMesh;    // Relaxed
01173 
01174         // CAL-03/06/03: Store the mapping of the faces on the cached mesh to the patches. (FID #832)
01175         Tab<int>    mappingFaceToPatch;
01176 
01177     public:
01178         // Topology
01179         int         numVerts;
01180         int         numVecs;
01181         int         numPatches;
01182         int         numEdges;
01183         Patch *     patches;
01184         PatchVec *  vecs;
01185         PatchEdge * edges;
01186         Tab<HookPoint> hooks;
01187 
01188 //watje 4-16-99 to handle hooks and changes in topology
01189         Tab<Point3> hookTopoMarkers;
01190         Tab<Point3> hookTopoMarkersA;
01191         Tab<Point3> hookTopoMarkersB;
01192         CoreExport int HookFixTopology() ;
01193 
01194         // Normals
01195         Point3 *    normals;
01196         BOOL        normalsBuilt;
01197 
01198         // Geometry
01199         PatchVert * verts;
01200 
01201         // Texture Coord assignment 
01202         Tab<int> numTVerts;
01203         Tab<PatchTVert *> tVerts;
01204         Tab<TVPatch *> tvPatches;    
01205 
01206         // Material assignment
01207         MtlID       mtlIndex;     // object material
01208 
01209         // Selection
01210         BitArray    vecSel;         // selected vectors // CAL-06/10/03: (FID #1914)
01211         BitArray    vertSel;        // selected vertices
01212         BitArray    edgeSel;        // selected edges
01213         BitArray    patchSel;       // selected patches
01214 
01215         // If hit bezier vector, this is its info:
01216         int bezVecVert;
01217 
01218         // Display attribute flags
01219         DWORD       dispFlags;
01220 
01221         // Selection level
01222         DWORD       selLevel;
01223 
01224         // Mesh cache flags
01225         int cacheSteps;     // meshSteps used for the cache
01226         BOOL cacheAdaptive; // adaptive switch used for cache
01227         BOOL unrelaxedMeshValid;
01228         BOOL relaxedMeshValid;
01229 
01232         CoreExport PatchMesh();
01235         CoreExport PatchMesh(PatchMesh& fromPatch);
01236 
01283         CoreExport void Init();
01284 
01286         CoreExport ~PatchMesh();
01287 
01289         CoreExport PatchMesh&       operator=(PatchMesh& fromPatchMesh);
01300         CoreExport PatchMesh&       operator=(Mesh& fromMesh);
01301 
01302         // The following is similar to operator=, but just takes the major components,
01303         // not the display flags, selection level, etc.
01311         CoreExport void CopyPatchDataFrom(PatchMesh &fromPatchMesh);
01312 
01322         CoreExport BOOL setNumVerts(int ct, BOOL keep = FALSE);
01324         int             getNumVerts(void)   { return numVerts; }
01325         
01333         CoreExport BOOL setNumVecs(int ct, BOOL keep = FALSE);
01335         int             getNumVecs(void)    { return numVecs; }
01336         
01344         CoreExport BOOL setNumPatches(int ct, BOOL keep = FALSE);
01346         int             getNumPatches(void)     { return numPatches; }
01347 
01355         CoreExport BOOL setNumEdges(int ct, BOOL keep = FALSE);
01357         int             getNumEdges(void)       { return numEdges; }
01358         
01365         void        setVert(int i, const Point3 &xyz)   { verts[i].p = xyz; }
01372         void        setVert(int i, float x, float y, float z)   { verts[i].p.x=x; verts[i].p.y=y; verts[i].p.z=z; }
01379         void        setVec(int i, const Point3 &xyz)    { vecs[i].p = xyz; }
01386         void        setVec(int i, float x, float y, float z)    { vecs[i].p.x=x; vecs[i].p.y=y; vecs[i].p.z=z; }
01387         
01392         PatchVert & getVert(int i)                  { return verts[i];  }
01397         PatchVert * getVertPtr(int i)               { return verts+i; }
01402         PatchVec &  getVec(int i)                   { return vecs[i];  }
01407         PatchVec *  getVecPtr(int i)                { return vecs+i; }
01409         PRVertex &  getRVert(int i)                 { return rVerts[i]; }
01411         PRVertex *  getRVertPtr(int i)              { return rVerts+i; }
01412         PRVertex &  getRVec(int i)                  { return rVecs[i]; }
01413         PRVertex *  getRVecPtr(int i)               { return rVecs+i; }
01414         
01415         // Two versions of following methods, to cope with necessary change in map indexing between 2.5 and 3.
01416         // Old TV/VC methods are given with "TV" in the name.  For these methods, channel 0 is the original map
01417         // channel, 1, while any nonzero channel is vertex colors.  (No higher channels!)
01432         BOOL    setNumTVertsChannel(int mp, int ct, BOOL keep=FALSE) { return setNumMapVerts (mp?0:1, ct, keep); }
01441         BOOL setNumTVerts(int ct, BOOL keep=FALSE) { return setNumMapVerts (1, ct, keep); }
01451         int getNumTVertsChannel(int mp) const { return numTVerts[mp?0:1]; }
01454         int getNumTVerts() const { return getNumMapVerts(1); }
01455 
01456         // New methods have "Map" in the name, and accept normal Object-level map indexing: 0 is VC channel, 1 or more
01457         // are map channels.
01472         CoreExport BOOL setNumMapVerts (int mp, int ct, BOOL keep = FALSE);
01480         CoreExport int getNumMapVerts (int mp) const;
01489         CoreExport PatchTVert *mapVerts (int mp) const;
01490         CoreExport TVPatch *mapPatches (int mp) const;
01491 
01492         // These are parallel to patches
01493         // These are called from setNumPatches() to maintain the same count.
01494         //
01495         // If they are NULL and keep = TRUE they stay NULL.
01496         // If they are NULL and keep = FALSE they are allocated (3D verts also init themselves from the main vert array)
01497         // If they are non-NULL and ct = 0 they are set to NULL (and freed)
01498         // Old version: nonzero = vc channel
01526         BOOL setNumTVPatchesChannel(int channel, int ct, BOOL keep=FALSE, int oldCt=0) { return setNumMapPatches (channel?0:1, ct, keep, oldCt); }
01549         BOOL setNumTVPatches(int ct, BOOL keep=FALSE, int oldCt=0) { return setNumMapPatches (1, ct, keep, oldCt); }
01550         // New version: 0 = vc channel
01577         CoreExport BOOL     setNumMapPatches (int channel, int ct, BOOL keep=FALSE, int oldCt=0);
01578 
01590         void        setTVertChannel(int channel, int i, const UVVert &xyz)  { tVerts[channel?0:1][i] = xyz; }
01597         void        setTVert(int i, const UVVert &xyz)  { tVerts[1][i] = xyz; }
01609         void        setTVertChannel(int channel, int i, float x, float y, float z)  { tVerts[channel?0:1][i].p.x=x; tVerts[channel?0:1][i].p.y=y; tVerts[channel?0:1][i].p.z=z; }
01616         void        setTVert(int i, float x, float y, float z)  { tVerts[1][i].p.x=x; tVerts[1][i].p.y=y; tVerts[1][i].p.z=z; }
01628         void        setTVPatchChannel(int channel, int i, TVPatch &tvp) { tvPatches[channel?0:1][i] = tvp; }
01637         void        setTVPatch(int i, TVPatch &tvp) { tvPatches[1][i] = tvp; }
01648         PatchTVert &    getTVertChannel(int channel, int i) { return tVerts[channel?0:1][i];  }
01654         PatchTVert &    getTVert(int i) { return tVerts[1][i];  }
01665         PatchTVert *    getTVertPtrChannel(int channel, int i)  { return tVerts[channel?0:1]+i; }
01671         PatchTVert *    getTVertPtr(int i)  { return tVerts[1]+i; }
01681         TVPatch &   getTVPatchChannel(int channel, int i)   { return tvPatches[channel?0:1][i];  }
01688         TVPatch &   getTVPatch(int i)   { return tvPatches[1][i];  }
01689 
01690         // New map methods: for these, channel 0 is v.c. channel, and anything higher is a map channel.
01702         void setMapVert (int mp, int i, const UVVert &xyz) { mapVerts(mp)[i] = xyz; }
01718         void setMapVert (int mp, int i, float x, float y, float z) { Point3 MV(x,y,z); setMapVert (mp, i, MV); }
01730         void setMapPatch (int mp, int i, const TVPatch &tvp) { mapPatches(mp)[i] = tvp; }
01742         PatchTVert & getMapVert (int mp, int i) { return mapVerts(mp)[i]; }
01754         PatchTVert * getMapVertPtr (int mp, int i) { return mapVerts(mp) + i; }
01765         TVPatch & getMapPatch (int mp, int i) { return mapPatches(mp)[i];  }
01767         void        setMtlIndex(MtlID i)    { mtlIndex = i; }
01769         MtlID       getMtlIndex(void)       { return mtlIndex; }
01770         CoreExport MtlID        getPatchMtlIndex(int i);
01771         CoreExport void     setPatchMtlIndex(int i, MtlID id);  
01772 
01773         // Automatically update all the adjacency info, etc.
01774         // Returns TRUE if patch mesh is valid, FALSE if it's not!
01775         // MAXr4: New option, can update linkages for single new patch by supplying
01776         // the 'patch' index.  Recomputes linkages for entire patch mesh if no index supplied.
01792         CoreExport BOOL     buildLinkages(int patch=-1);
01793         
01794         // Compute the interior bezier points for each patch in the mesh
01800         CoreExport void     computeInteriors();
01801 
01802         // Compute the degree-4 bezier points for each triangular patch in the mesh
01803         CoreExport void     computeAux();
01804 
01836         CoreExport void     render(GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1);
01846         CoreExport void     renderGizmo(GraphicsWindow *gw);
01863         CoreExport BOOL     select(GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE, int numMat=1);
01877         CoreExport void     snap(GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm);
01915         CoreExport BOOL     SubObjectHitTest(GraphicsWindow *gw, Material *ma, HitRegion *hr,
01916                                 DWORD flags, SubPatchHitList& hitList, int numMat=1 );
01917 
01921         CoreExport void     buildBoundingBox(void);
01926         CoreExport Box3     getBoundingBox(Matrix3 *tm=NULL); // RB: optional TM allows the box to be calculated in any space.
01927                                                       // NOTE: this will be slower becuase all the points must be transformed.
01928         CoreExport void     GetDeformBBox(Box3& box, Matrix3 *tm=NULL, BOOL useSel=FALSE);
01929         
01932         CoreExport void     InvalidateGeomCache();
01933         CoreExport void     InvalidateMesh();       // Also invalidates relaxed mesh
01934         CoreExport void     InvalidateRelaxedMesh();
01936         CoreExport void     FreeAll(); //DS
01937                 
01938         // functions for use in data flow evaluation
01940         CoreExport void     ShallowCopy(PatchMesh *amesh, ChannelMask channels);
01942         CoreExport void     DeepCopy(PatchMesh *amesh, ChannelMask channels);
01944         CoreExport void   NewAndCopyChannels(ChannelMask channels);
01946         CoreExport void     FreeChannels(ChannelMask channels, int zeroOthers=1);
01947 
01948         // Display flags
01953         void        SetDispFlag(DWORD f) { dispFlags |= f; }
01958         DWORD       GetDispFlag(DWORD f) { return dispFlags & f; }
01963         void        ClearDispFlag(DWORD f) { dispFlags &= ~f; }
01964 
01965         // Selection access
01966         BitArray&   VecSel() { return vecSel; }     // CAL-06/10/03: (FID #1914)
01970         BitArray&   VertSel() { return vertSel; }
01973         BitArray&   EdgeSel() { return edgeSel; }
01976         BitArray&   PatchSel() { return patchSel; }
01977 
01978         // Constructs a vertex selection list based on the current selection level.
01983         CoreExport BitArray     VertexTempSel();
01984 
01985         // Apply the coplanar constraints to the patch mesh
01986         // (Optionally only apply it to selected vertices)
02002         CoreExport void ApplyConstraints(BOOL selOnly = FALSE);
02003 
02004         // Create triangular or quadrilateral patch
02029         CoreExport BOOL MakeQuadPatch(int index, 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, DWORD sm);
02050         CoreExport BOOL MakeTriPatch(int index, int va, int vab, int vba, int vb, int vbc, int vcb, int vc, int vca, int vac, int i1, int i2, int i3, DWORD sm);
02051 
02052         // Get/Set mesh steps, adaptive switch
02058         CoreExport void SetMeshSteps(int steps);
02060         CoreExport int GetMeshSteps();
02061 #ifndef NO_OUTPUTRENDERER
02062 //3-18-99 watje to support render steps
02069         CoreExport void SetMeshStepsRender(int steps);
02073         CoreExport int GetMeshStepsRender();
02074 #endif // NO_OUTPUTRENDERER
02075 
02081         CoreExport void SetShowInterior(BOOL si);
02085         CoreExport BOOL GetShowInterior();
02086 
02087         CoreExport void SetUsePatchNormals(BOOL usePatchNorm);
02088         CoreExport BOOL GetUsePatchNormals();
02089 
02091         CoreExport void SetAdaptive(BOOL sw);
02093         CoreExport BOOL GetAdaptive();
02094 
02102         CoreExport void SetViewTess(TessApprox tess);
02107         CoreExport TessApprox GetViewTess();
02116         CoreExport void SetProdTess(TessApprox tess);
02121         CoreExport TessApprox GetProdTess();
02129         CoreExport void SetDispTess(TessApprox tess);
02134         CoreExport TessApprox GetDispTess();
02139         CoreExport BOOL GetViewTessNormals();
02146         CoreExport void SetViewTessNormals(BOOL use);
02151         CoreExport BOOL GetProdTessNormals();
02155         CoreExport void SetProdTessNormals(BOOL use);
02160         CoreExport BOOL GetViewTessWeld();
02167         CoreExport void SetViewTessWeld(BOOL weld);
02172         CoreExport BOOL GetProdTessWeld();
02180         CoreExport void SetProdTessWeld(BOOL weld);
02181 
02182         // Find the edge index for a given vertex-vector-vector-vertex sequence
02184         int GetEdge(int v1, int v12, int v21, int v2, int p);
02185         // Find the edge indices for two given vertices
02186         CoreExport Tab<int> GetEdge(int v1, int v2) const;
02187 
02188         // Find all of the patch indices for two given vertices
02189         CoreExport Tab<int> GetPatches(int v1, int v2) const;
02190 
02191         // find the indices for the patches that depend on the given vertex
02192         CoreExport Tab<int> GetPatches(int vert) const;
02193 
02194         // find the indices for the edges that depend on the given vertex
02195         CoreExport Tab<int> GetEdges(int vert) const;
02196 
02197         // find the indices for the vectors that depend on the given vertex
02198         CoreExport Tab<int> GetVectors(int vert) const;
02199 
02200 
02201         // Apply mapping to the patch mesh
02212         CoreExport void setNumMaps (int ct, BOOL keep=TRUE);
02216         int getNumMaps () { return numTVerts.Count(); }
02232         CoreExport void setMapSupport(int chan, BOOL init=TRUE);    // Make sure map support is there for this channel, optionally init
02242         BOOL getMapSupport (int mp) { return ((mp<tvPatches.Count()) && tvPatches[mp]) ? TRUE : FALSE; }
02246         int NumMapChannels () { return MAX_MESHMAPS; }
02282         CoreExport void ApplyUVWMap(int type,
02283             float utile, float vtile, float wtile,
02284             int uflip, int vflip, int wflip, int cap,
02285             const Matrix3 &tm,int channel=1);
02286 
02287         // Tag the points in the patch components to record our topology (This stores
02288         // identifying values in the various aux2 fields in the Patch)
02289         // This info can be used after topology-changing operations to remap information
02290         // tied to vertices, edges and patches.
02291         // Returns TRUE if tagged successfully
02298         CoreExport BOOL RecordTopologyTags();
02299 
02308         CoreExport void Transform(Matrix3 &tm);
02309 
02310         // Weld the vertices
02314         CoreExport BOOL Weld(float thresh, BOOL weldIdentical=FALSE, int startVert=0);
02315 
02316         // weld one selected vertex to another selected vertex
02317         CoreExport BOOL PatchMesh::Weld(int fromVert, int toVert);
02318 
02319         // Weld selected edges
02325         CoreExport BOOL WeldEdges();
02326 
02327         // General-purpose deletion
02336         CoreExport void DeletePatchParts(BitArray &delVerts, BitArray &delPatches);
02337 
02338         // Clone specified patch geometry (or selected patches if 'patches' == NULL)
02348         CoreExport void ClonePatchParts(BitArray *patches = NULL);
02349 
02350         // Subdivision
02363         CoreExport void Subdivide(int type, BOOL propagate);
02364 
02365         // Add patch to selected single-patch edges
02375         CoreExport void AddPatch(int type);
02376 
02377         // Hooks a vertex to a patch edge
02381         CoreExport int AddHook();
02382         //tries to add hook patch at the specified vert
02386         CoreExport int AddHook(int index);
02390         CoreExport int AddHook(int vertIndex, int segIndex) ;
02391 
02395         CoreExport int RemoveHook();
02396         //goes through and looks for invalid hooks and tries to fix them used when topology changes
02400         CoreExport int UpdateHooks();
02401 
02402         Tab<Point3> extrudeDeltas;
02403         Tab<ExtrudeData> extrudeData;
02404         Tab<Point3> edgeNormals;
02405         Tab<int> newEdges;
02406         Tab<int> newVerts;
02407 //creates initial extrude faces and temporary data used in move normal
02408 //type = PATCH_PATCH or PATCH_EDGE only
02409 //edgeClone: Only for edge mode, clones edges before extrusion
02425         CoreExport void CreateExtrusion(int type = PATCH_PATCH, BOOL edgeClone=FALSE);
02426 //computes the average normals of the selected patches or selected edges
02437         CoreExport Point3 AverageNormals(int type = PATCH_PATCH);
02441         CoreExport Point3 PatchNormal(int index);
02442         CoreExport void BuildPatchNormals();        // Only builds normals if necessary
02443         CoreExport void InvalidatePatchNormals();
02444         CoreExport Point3 EdgeNormal(int index);
02446         CoreExport void MoveNormal(float amount, BOOL useLocalNorms, int type/* = PATCH_PATCH*/);
02447         // Flip normal of indicated patch, or selected patches if -1, or all patches if -2
02456         CoreExport void FlipPatchNormal(int index);
02467         CoreExport void UnifyNormals(BOOL useSel);
02468 //creates temporary data used in Bevel
02469         BitArray bevelEdges;
02470         Tab<float> edgeDistances;
02474         CoreExport void CreateBevel();
02478         CoreExport void Bevel(float amount, int smoothStart, int smoothEnd);
02479 //computes the bevel direction of patch based on which edges are open
02483         Point3 GetBevelDir(int patchVertID);
02484 
02485         // Attach a second PatchMesh, adjusting materials
02486         CoreExport void Attach(PatchMesh *attPatch, int mtlOffset);
02487 
02488         // Change the interior type of a patch or selected patches (index < 0)
02489         CoreExport void ChangePatchInterior(int index, int type);
02490 
02491         // Change the type of a vertex or selected vertices (index < 0)
02492         CoreExport void ChangeVertType(int index, int type);
02493 
02494         CoreExport BOOL SelVertsSameType(); // Are all selected vertices the same type?
02495         CoreExport BOOL SelPatchesSameType();   // Are all selected patches the same type?
02496 
02497         // CAL-04/28/03: reset vertex tangents (FID #827)
02498         CoreExport BOOL ResetVertexTangents(int index);
02499         CoreExport BOOL ResetVertexTangents(bool useSel=true, const BitArray *vSel=NULL);
02500 
02501         // CAL-04/23/03: patch smooth (FID #1419)
02502         CoreExport BOOL PatchSmoothVector(bool useSel=true, const BitArray *vSel=NULL);
02503         CoreExport BOOL PatchSmoothVertex(bool useSel=true, const BitArray *vSel=NULL);
02504         CoreExport BOOL PatchSmoothEdge(bool useSel=true, const BitArray *eSel=NULL);
02505         CoreExport BOOL PatchSmoothPatch(bool useSel=true, const BitArray *pSel=NULL);
02506 
02507         // CAL-04/23/03: Shrink/Grow, Edge Ring/Loop selection. (FID #1419)
02508         CoreExport void ShrinkSelection(int type);
02509         CoreExport void GrowSelection(int type);
02510         CoreExport void SelectEdgeRing(BitArray &eSel);
02511         CoreExport void SelectEdgeLoop(BitArray &eSel);
02512 
02513         // Dump the patch mesh structure via DebugPrints
02517         CoreExport void Dump();
02518 #ifdef CHECK_TRI_PATCH_AUX
02519         CoreExport void CheckTriAux();
02520 #endif //CHECK_TRI_PATCH_AUX
02521 
02522         // Ready the mesh cache
02523         CoreExport void PrepareMesh();
02524         CoreExport void PrepareUnrelaxedMesh();
02525 
02526         // Get the Mesh version
02527         CoreExport Mesh& GetMesh();
02528         CoreExport Mesh& GetUnrelaxedMesh();
02529 
02530         // Actual mesh tessellation used by above methods; optionally allows calling
02531         // routine to propegate selection from the patch to the mesh.
02549         CoreExport void ComputeMesh (Mesh & m, DWORD convertFlags);
02550 
02567         CoreExport int IntersectRay(Ray& ray, float& at, Point3& norm);
02568 
02569         CoreExport IOResult Save(ISave* isave);
02570         CoreExport IOResult Load(ILoad* iload);
02571 
02572         // TH 6/12/00 -- Added AutoSmooth method for Smooth modifier
02597         CoreExport void AutoSmooth(float angle,BOOL useSel,BOOL preventIndirectSmoothing);
02598 
02599         // Change/Get the mapping type of a patch or selected patches (index < 0)
02600 //watje new patch mapping
02610         CoreExport void ChangePatchToLinearMapping(int index);
02620         CoreExport void ChangePatchToCurvedMapping(int index);
02631         CoreExport BOOL ArePatchesLinearMapped(int index); 
02642         CoreExport BOOL ArePatchesCurvedMapped(int index); 
02649         CoreExport BOOL SingleEdgesOnly();  // Returns TRUE if all selected edges are used by only 1 edge
02659         CoreExport BitArray& GetElement(int index);
02660 
02661         // --- from InterfaceServer
02662         CoreExport BaseInterface* GetInterface(Interface_ID id);
02663 
02664     
02665 
02666 // soft selection support
02667 // should these be  private?:
02668 
02669 //5-25-00 support for soft selections (tb)
02670         private:
02671 
02672         int     mVertexWeightSelectLevel;
02673         float * mpVertexWeights;
02674         int     numVertexWeights;
02675         int   * mpVertexEdgeDists;
02676         float * mpVertexDists;
02677 
02678         public:
02679         // NOTE: There is no int GetVertexWeightCount(); but there should be.  Developers can
02680         // generally count on the number of weights being = numVerts + numVecs.  The order in
02681         // the array is all the vertices, then all the vectors.
02682         CoreExport void  SetVertexWeightCount( int i ); // destroys existing weights, sets all weights = 0.0.
02683         CoreExport void  SetVertexWeight( int i, float w ) { assert( mpVertexWeights ); if ( i >= numVertexWeights ) return; mpVertexWeights[i] = w; }
02684         CoreExport float VertexWeight( int i ) { if ( !mpVertexWeights ) return 0.0f; if ( i >= numVertexWeights ) return 0.0f; return mpVertexWeights[i]; }
02685         CoreExport bool  VertexWeightSupport() { if ( mpVertexWeights ) return true; return false; }
02693         CoreExport float *GetVSelectionWeights() { return mpVertexWeights; }
02699         CoreExport void  SupportVSelectionWeights();        // Allocate a weight table if none 
02700         CoreExport int   VertexWeightSelectLevel() { return mVertexWeightSelectLevel; } 
02701 
02702         float mFalloff, mPinch, mBubble;
02703         int   mEdgeDist, mUseEdgeDist, mAffectBackface, mUseSoftSelections;
02704 
02705         CoreExport int  UseEdgeDists( );
02706         CoreExport void SetUseEdgeDists( int edgeDist );
02707 
02708         CoreExport int  EdgeDist( );
02709         CoreExport void SetEdgeDist( int edgeDist );
02710 
02711         CoreExport int  UseSoftSelections();
02712         CoreExport void SetUseSoftSelections( int useSoftSelections );
02713 
02714         CoreExport int AffectBackface( );
02715         CoreExport void SetAffectBackface( int affectBackface );
02716 
02717         CoreExport float Falloff( );
02718         CoreExport void SetFalloff( float falloff );
02719 
02720         CoreExport float Pinch( );
02721         CoreExport void SetPinch( float pinch );
02722 
02723         CoreExport float Bubble( );
02724         CoreExport void SetBubble( float bubble );
02725 
02726         CoreExport void InvalidateVertexWeights();
02727 
02728         CoreExport void UpdateVertexDists();
02729         CoreExport void UpdateEdgeDists( );
02730         CoreExport void UpdateVertexWeights();
02731 
02732         CoreExport Point3 VertexNormal( int vIndex ); 
02733 
02734         CoreExport BOOL Relaxing();     // returns TRUE if Relax && RelaxValue != 0 && RelaxIter != 0
02735         CoreExport BOOL SetRelax(BOOL v);           // All "Set" ops return TRUE if option changed
02736         CoreExport BOOL SetRelaxViewports(BOOL v);
02737         CoreExport BOOL SetRelaxValue(float v);
02738         CoreExport BOOL SetRelaxIter(int v);
02739         CoreExport BOOL SetRelaxBoundary(BOOL v);
02740         CoreExport BOOL SetRelaxSaddle(BOOL v);
02741         CoreExport BOOL GetRelax();
02742         CoreExport BOOL GetRelaxViewports();
02743         CoreExport float GetRelaxValue();
02744         CoreExport int GetRelaxIter();
02745         CoreExport BOOL GetRelaxBoundary();
02746         CoreExport BOOL GetRelaxSaddle();
02747 };
02748 
02752 #define CONVERT_KEEPSEL                 0x0001
02753 #define CONVERT_USESOFTSEL          0x0002
02754 #define CONVERT_SEL_LEVEL               0x0004
02755 #define CONVERT_PATCH_USEQUADS  0x0010
02756 #define CONVERT_NO_RELAX                0x0020
02757 
02758 
02759 // Conversion methods:
02760 CoreExport void ConvertMeshToPatch (Mesh &m, PatchMesh &pm, DWORD flags=0);
02761 CoreExport void ConvertPatchToMesh (PatchMesh &pm, Mesh &m, DWORD flags=0);
02762 
02764 
02770 CoreExport void ConvertPatchToMeshWithMapping (PatchMesh &pm, Mesh &m, Tab<int> *mapping, DWORD flags=0);
02771 CoreExport void RelaxMesh(Mesh &mesh, float value, int iter, BOOL boundary, BOOL saddle);
02772