00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GU_TrimPatch_h__
00021 #define __GU_TrimPatch_h__
00022
00023 #include "GU_API.h"
00024 #include <UT/UT_RefArray.h>
00025 #include <UT/UT_PtrArray.h>
00026 #include <UT/UT_IntArray.h>
00027 #include <UT/UT_Convex.h>
00028 #include "GU_TrimBasePatch.h"
00029
00030 class UT_BoundingRect;
00031 class GD_TrimLoop;
00032 class GU_TPSurfCache;
00033 class GEO_TPSurf;
00034
00035
00036
00037
00038 class GU_API GU_TrimTriangle {
00039 public:
00040 int operator==( const GU_TrimTriangle &tri )
00041 {
00042 return (myP[0] == tri.myP[0] &&
00043 myP[1] == tri.myP[1] &&
00044 myP[2] == tri.myP[2]);
00045 }
00046 int myP[3];
00047 };
00048
00049 class GU_API GU_TrimStrip {
00050 public:
00051 int operator==( const GU_TrimStrip &strip )
00052 {
00053 return (myP == strip.myP);
00054 }
00055 UT_IntArray myP;
00056 };
00057
00058
00059
00060
00061
00062 class GU_API GU_TrimTesselator : public GU_TrimBaseTesselator,
00063 protected UT_Convex {
00064 public:
00065 GU_TrimTesselator();
00066 virtual ~GU_TrimTesselator();
00067
00068
00069 virtual void reset();
00070
00071
00072 virtual void startPoly();
00073 virtual void endPoly();
00074 virtual void cancelPoly();
00075 virtual void addPolyPoint(GU_TrimBasePoint *point);
00076
00077
00078 virtual void startTStrip();
00079 virtual void endTStrip();
00080 virtual void addTStripPoints(GU_TrimBasePoint *p1,
00081 GU_TrimBasePoint *p2);
00082
00083
00084 virtual int getPointCount() const;
00085 virtual void getPoint(int num, float &x, float &y) const;
00086
00087 virtual void beginPolygon(int npoint, int lastone);
00088 virtual void polyVertex(int num);
00089 virtual void endPolygon();
00090
00091
00092
00093 void resetRetrieval();
00094
00095
00096
00097
00098 int getTriangle(int &p1, int &p2, int &p3);
00099
00100
00101 int getStrip();
00102 int getStripPointCount();
00103 int getStripPoints(int &p1, int &p2);
00104 void getStripPoint(int idx, int &p1, int &p2);
00105 int nextStrip();
00106 protected:
00107
00108 UT_PtrArray<GU_TrimBasePoint *> myPolyPoints;
00109 GU_TrimBasePoint *myLastPolyPoint, *myFirstPolyPoint;
00110
00111
00112 UT_RefArray<GU_TrimTriangle> myTriangles;
00113 UT_RefArray<GU_TrimStrip> myStrips;
00114
00115
00116 int myTriIdx, myStripIdx;
00117 int myStripOffset;
00118
00119 int myCurVertex, myCurPoly;
00120 };
00121
00122
00123
00124
00125 class GU_API GU_TrimPatch : public GU_TrimBasePatch {
00126 public:
00127 GU_TrimPatch(GU_TPSurfCache *parent, GEO_TPSurf *surf);
00128 virtual ~GU_TrimPatch();
00129
00130
00131 virtual void refreshCells(GEO_TPSurf *surf, int umin, int umax,
00132 int vmin, int vmax);
00133
00134
00135 void startUIsoWalk(int uiso);
00136 int getUIsoSpan(int &trimtype);
00137 int getUIsoSpanPoint(int &point);
00138
00139 void startVIsoWalk(int viso);
00140 int getVIsoSpan(int &trimtype);
00141 int getVIsoSpanPoint(int &point);
00142
00143 void startTrimCurveWalk();
00144 int getTrimCurveSpan();
00145 int getTrimCurveSpanPoint(int &point);
00146
00147 protected:
00148
00149 virtual void fillPoint(GU_TrimPatchPoint *p);
00150
00151
00152
00153
00154
00155 virtual void fillCornerPoints();
00156
00157
00158
00159
00160
00161 protected:
00162
00163 GU_TPSurfCache *myParent;
00164 GEO_TPSurf *mySurf;
00165
00166
00167 int myCurIsoIdx, myCurIsoOffset, myCurIsoTrim;
00168 int mySpanStart, myLastWasEnd;
00169 GU_TrimPatchPoint *myCurIsoPoint;
00170
00171 GU_TrimPatchPoint *myTrimCurve, *myTrimCurvePoint;
00172
00173 GU_TrimPatchPoint *myCurTrimCurveStart;
00174 };
00175
00176 #endif
00177