00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GU_PolyWire__
00021 #define __GU_PolyWire__
00022
00023 #include "GU_API.h"
00024 #include <UT/UT_RefArray.h>
00025 #include <UT/UT_Vector3Array.h>
00026
00027 class GU_Detail;
00028 class GB_PrimitiveGroup;
00029 class gu_ConnectionGraph;
00030 class GEO_Point;
00031 class UT_HashTable;
00032 class gu_EdgeHashEntry;
00033
00034 class GU_API gu_JunctionPoint
00035 {
00036 public:
00037 GEO_Point *pt;
00038 UT_Vector3 pos;
00039 float scaletotal;
00040 int numpts;
00041 };
00042
00043 class GU_API GU_PolyWire
00044 {
00045 public:
00046 GU_PolyWire();
00047 virtual ~GU_PolyWire();
00048
00049
00050 void setPtWidths(float *widths) { myPtWidths = widths; }
00051 void setJointScale(float *scale) { myJointScale = scale; }
00052 void setPtSmooth(int *smooth) { myPtSmooth = smooth; }
00053
00054 void setDivisions(int *div);
00055 void setSegments(const GEO_Point *pt1,
00056 const GEO_Point *pt2, int segments);
00057 void setV(const GEO_Point *pt1, const GEO_Point *pt2,
00058 float v1, float v2);
00059 void setU(const GEO_Point *pt1, const GEO_Point *pt2,
00060 float uoff, float u1, float u2);
00061 void setSegScales(const GEO_Point *pt1,
00062 const GEO_Point *pt2, float segscale1,
00063 float segscale2);
00064
00065 void setGdp(GU_Detail *gdp) { myGdp = gdp; }
00066 void setGrp(GB_PrimitiveGroup *grp) { myPrimGroup = grp; }
00067 void setJointCorrection(int jc) { myJointCorrection = jc; }
00068 void setDoTextures(int dotext) { myDoTextures = dotext; }
00069 void setUseUpVector(int up) { myUseUpVector = up; }
00070 void setUpVectors(UT_Vector3 *up) { myUpVectors = up; }
00071
00072
00073 GU_Detail *getGdp() const { return myGdp; }
00074 int getSmooth(int pt) const { return myPtSmooth[pt]; }
00075 float getWidth(int pt) const { return myPtWidths[pt]; }
00076 float getMaxScale(int pt) const { return myJointScale[pt]; }
00077 int getSegments(int pt1, int pt2) const;
00078 void getV(int pt1, int pt2, float &v1, float &v2) const;
00079 void getU(int pt1, int pt2, float &uoff, float &u1,
00080 float &u2) const;
00081 void getSegScales(int pt1, int pt2, float &segscale1,
00082 float &segscale2) const;
00083 int getDivisions(int pt) const { return myDivs[pt]; }
00084 UT_Vector3 getUpVector(int pt) const { return myUpVectors[pt]; }
00085 int doJointCorrection() const { return myJointCorrection; }
00086 int doTextures() const { return myDoTextures; }
00087 int useUpVector() const { return myUseUpVector; }
00088
00089
00090 float getPtTexU(int idx);
00091 void setPtTexU(int idx, float val);
00092 float getPtTexV(int idx);
00093 void setPtTexV(int idx, float val);
00094 float getGlbPtTexU(int idx);
00095 int hasGlbPtTexU(int idx) const;
00096 void setGlbPtTexU(int idx, float val);
00097
00098
00099
00100
00101 UT_Vector3 getCirclePos(int idx, int div)
00102 { buildCircleCache(div);
00103 return (*myCircleCache(div))(idx); }
00104
00105
00106 void buildWire();
00107
00108 GEO_Point *getJunctionPoint(const UT_Vector3 &stdpos,
00109 const UT_Vector3 ¢er, float scale);
00110
00111 void evaluateJunctionPoints(const UT_Vector3 ¢er,
00112 float scale, GEO_Point *cpt);
00113 void clearJunctionPoints();
00114
00115
00116 void textureClampPolys(const UT_PtrArray<GEO_PrimPoly *>
00117 &polylist,
00118 float ubase, float uwidth);
00119
00120
00121 protected:
00122 void buildCircleCache(int div);
00123
00124
00125
00126
00127
00128
00129 float *myPtWidths;
00130 float *myJointScale;
00131 int *myPtSmooth;
00132 int *myDivs;
00133 UT_Vector3 *myUpVectors;
00134 int myJointCorrection;
00135 int myDoTextures;
00136 int myUseUpVector;
00137
00138 UT_FloatArray myTexU;
00139 UT_FloatArray myTexV;
00140
00141 UT_FloatArray myGlbTexU;
00142
00143
00144
00145
00146
00147 UT_PtrArray<UT_Vector3Array *> myCircleCache;
00148
00149
00150 GU_Detail *myGdp;
00151 GB_PrimitiveGroup *myPrimGroup;
00152
00153
00154 gu_ConnectionGraph *myGraph;
00155
00156
00157 UT_HashTable *myEdgeHash;
00158
00159
00160 UT_RefArray<gu_JunctionPoint> myJunctionPoints;
00161
00162
00163 UT_PtrArray<gu_EdgeHashEntry *> myEdgeHashEntries;
00164 };
00165
00166 #endif
00167