00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GEO_PasteSurfDAG_h__
00021 #define __GEO_PasteSurfDAG_h__
00022
00023 #include "GEO_API.h"
00024 #include <GB/GB_Parameterization.h>
00025 #include <GP/GP_DomainDAG.h>
00026 #include "GEO_PasteSurf.h"
00027
00028 class UT_Vector4;
00029 class GB_AttributeData;
00030 class GB_FloatOffsets;
00031 class GB_PointGroup;
00032 class GEO_Vertex;
00033 class GEO_AttributeHandleList;
00034 class UT_FloatArray;
00035 class UT_IStream;
00036
00037 class GEO_API GEO_PasteSurfDAG : public GP_DomainDAG
00038 {
00039 public:
00040
00041 GEO_PasteSurfDAG(void);
00042
00043
00044
00045 GEO_PasteSurfDAG(GEO_PasteSurf *root);
00046
00047
00048 GEO_PasteSurfDAG(const GEO_PasteSurfDAG &srcdag);
00049 GEO_PasteSurfDAG(const GP_DomainDAG &srcdag);
00050
00051
00052 virtual ~GEO_PasteSurfDAG(void);
00053
00054
00055
00056
00057
00058 virtual void clearAndDestroy(int total = 1);
00059
00060
00061
00062
00063 bool evaluate(float u, float v, GEO_Vertex &result,
00064 GEO_AttributeHandleList &hlist,
00065 unsigned du=0, unsigned dv=0) const;
00066 int evaluate(float origu, float origv, UT_Vector4 &pos,
00067 unsigned du = 0, unsigned dv = 0) const;
00068 int evaluateWAttrib(float origu, float origv,
00069 UT_Vector4 &pos, GB_AttributeData &adata,
00070 const GB_FloatOffsets &foffsets,
00071 unsigned du = 0, unsigned dv = 0) const;
00072
00073
00074
00075
00076 int evaluateNormal(float origu,float origv,
00077 UT_Vector3 &nml) const;
00078
00079
00080
00081
00082
00083
00084 int fillBreakMesh(int ustartidx, int ustopidx,
00085 int vstartidx, int vstopidx,
00086 int ulod, int vlod,
00087 UT_Vector4 *pos, int &vspans ,
00088 int vbreakidx = -1,
00089 unsigned du = 0, unsigned dv = 0,
00090 UT_FloatArray *uval = 0,
00091 UT_FloatArray *vval = 0) const;
00092 int fillBreakMesh(int ustartidx, int ustopidx,
00093 int vstartidx, int vstopidx,
00094 int ulod, int vlod,
00095 GEO_Vertex *result,
00096 GEO_AttributeHandleList &hlist,
00097 int &vspans, int vbreakidx,
00098 unsigned du, unsigned dv) const;
00099 int fillBreakMeshWAttrib(int ustartidx, int ustopidx,
00100 int vstartidx, int vstopidx,
00101 int ulod, int vlod,
00102 UT_Vector4 *pos, GB_AttributeData *adata,
00103 const GB_FloatOffsets &foffsets,
00104 int &vspans , int vbreakidx = -1,
00105 unsigned du = 0, unsigned dv = 0) const;
00106
00107
00108
00109
00110
00111
00112
00113
00114 int fillUCurves(int ustartidx, int ustopidx,
00115 int vstartidx, int vstopidx, int lod,
00116 UT_Vector4 *pos, int &uspans ,
00117 int ubreakidx = -1,
00118 unsigned du = 0, unsigned dv = 0) const;
00119 int fillVCurves(int ustartidx, int ustopidx,
00120 int vstartidx, int vstopidx, int lod,
00121 UT_Vector4 *pos, int &vspans ,
00122 int vbreakidx = -1,
00123 unsigned du = 0, unsigned dv = 0) const;
00124 int fillUCurves(int ustartidx, int ustopidx,
00125 int vstartidx, int vstopidx, int lod,
00126 GEO_Vertex *result,
00127 GEO_AttributeHandleList &hlist,
00128 int &uspans, int ubreakidx,
00129 unsigned du, unsigned dv) const;
00130 int fillVCurves(int ustartidx, int ustopidx,
00131 int vstartidx, int vstopidx, int lod,
00132 GEO_Vertex *result,
00133 GEO_AttributeHandleList &hlist,
00134 int &vspans, int vbreakidx,
00135 unsigned du, unsigned dv) const;
00136 int fillUCurvesWAttrib(int ustartidx, int ustopidx,
00137 int vstartidx, int vstopidx, int lod,
00138 UT_Vector4 *pos, GB_AttributeData *adata,
00139 const GB_FloatOffsets &foffsets,
00140 int &uspans , int ubreakidx = -1,
00141 unsigned du = 0, unsigned dv = 0) const;
00142 int fillVCurvesWAttrib(int ustartidx, int ustopidx,
00143 int vstartidx, int vstopidx, int lod,
00144 UT_Vector4 *pos, GB_AttributeData *adata,
00145 const GB_FloatOffsets &foffsets,
00146 int &vspans , int vbreakidx = -1,
00147 unsigned du = 0, unsigned dv = 0) const;
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 int applyBreakMesh(int ustartidx, int ustopidx,
00159 int vstartidx, int vstopidx,
00160 int ulod, int vlod, int &vspans ,
00161 int (*apply)(float ucrt, float vcrt,
00162 int arridx, void *data),
00163 void *data=0, int vbreakidx=-1) const;
00164
00165
00166
00167
00168 int raiseOrderU(GEO_PasteSurf &child, int neworder,
00169 GEO_AttributeHandleList &hlist);
00170 int raiseOrderU (GEO_PasteSurf &child, int neworder);
00171 int raiseOrderUWAttrib(GEO_PasteSurf &child, int neworder,
00172 const GB_FloatOffsets &foffsets);
00173 int raiseOrderV(GEO_PasteSurf &child, int neworder,
00174 GEO_AttributeHandleList &hlist);
00175 int raiseOrderV (GEO_PasteSurf &child, int neworder);
00176 int raiseOrderVWAttrib(GEO_PasteSurf &child, int neworder,
00177 const GB_FloatOffsets &foffsets);
00178
00179
00180 int refineU(GEO_PasteSurf &c, float k,
00181 GEO_AttributeHandleList &hlist, int r=1);
00182 int refineU (GEO_PasteSurf &c, float k, int r=1);
00183 int refineUWAttrib (GEO_PasteSurf &c, float k,
00184 const GB_FloatOffsets &foffsets,
00185 int r=1);
00186 int refineUWAttrib (GEO_PasteSurf &c, float k,
00187 const GB_FloatOffsets *ptoffsets,
00188 const GB_FloatOffsets *vtxoffsets,
00189 int r=1);
00190
00191 int refineV(GEO_PasteSurf &c, float k,
00192 GEO_AttributeHandleList &hlist, int r=1);
00193 int refineV (GEO_PasteSurf &c, float k, int r=1);
00194 int refineVWAttrib (GEO_PasteSurf &c, float k,
00195 const GB_FloatOffsets &foffsets,
00196 int r=1);
00197 int refineVWAttrib (GEO_PasteSurf &c, float k,
00198 const GB_FloatOffsets *ptoffsets,
00199 const GB_FloatOffsets *vtxoffsets,
00200 int r=1);
00201
00202
00203
00204 int refineBelt(GEO_PasteSurf &child,
00205 float ubwidth = 0.4F, float vbwidth = 0.4F,
00206 int ubdivs = 2, int vbdivs = 2);
00207
00208
00209
00210
00211 int unrefineU(GEO_PasteSurf &c, int kidx,
00212 GEO_AttributeHandleList &hlist,
00213 int mult=0, float tol=1e-4F,
00214 GB_PointGroup *delgroup = 0);
00215 int unrefineU (GEO_PasteSurf &c, int kidx,
00216 int mult=0, float tol=1e-4F,
00217 GB_PointGroup *delgroup = 0);
00218 int unrefineUWAttrib(GEO_PasteSurf &c, int kidx,
00219 const GB_FloatOffsets &foffsets,
00220 int mult=0, float tol=1e-4F,
00221 GB_PointGroup *delgroup = 0);
00222
00223 int unrefineV(GEO_PasteSurf &c, int kidx,
00224 GEO_AttributeHandleList &hlist,
00225 int mult=0, float tol=1e-4F,
00226 GB_PointGroup *delgroup = 0);
00227 int unrefineV (GEO_PasteSurf &c, int kidx,
00228 int mult=0, float tol=1e-4F,
00229 GB_PointGroup *delgroup = 0);
00230 int unrefineVWAttrib(GEO_PasteSurf &c, int kidx,
00231 const GB_FloatOffsets &foffsets,
00232 int mult=0, float tol = 1e-4F,
00233 GB_PointGroup *delgroup = 0);
00234
00235
00236
00237 int reverseU(GEO_PasteSurf &child);
00238 int reverseV(GEO_PasteSurf &child);
00239
00240
00241
00242
00243 int reparameterizeU(GEO_PasteSurf &child, GB_ParmType p);
00244 int reparameterizeV(GEO_PasteSurf &child, GB_ParmType p);
00245
00246
00247
00248
00249
00250
00251 GEO_PasteSurf *unpasteAt (GEO_PasteSurf &child, int preserveshape=0,
00252 int preservexform=0);
00253 GEO_PasteSurfDAG *unpasteFrom(GEO_PasteSurf &child, GP_NodeTree *ctree,
00254 int preserveshape=0,
00255 int preservexform=0);
00256
00257
00258
00259
00260 int offsetAt (GEO_PasteSurf &surf, float height);
00261 int offsetFrom(GEO_PasteSurf &surf, float height);
00262 int height(float newheight)
00263 {
00264 return (rootSurface())
00265 ? offsetAt(*rootSurface(),newheight) : -1;
00266 }
00267
00268
00269
00270
00271 int flipAt (GEO_PasteSurf &child);
00272 int flipFrom(GEO_PasteSurf &child);
00273 int flip (void)
00274 {
00275 return (rootSurface())?flipFrom(*rootSurface()):-1;
00276 }
00277
00278
00279
00280 void updateHierarchy(void);
00281
00282
00283
00284
00285 void optimizeDisplacements(int update = 1);
00286
00287
00288
00289 GEO_PasteSurfDAG &operator=(const GEO_PasteSurfDAG &src);
00290 GEO_PasteSurfDAG &operator=(const GP_DomainDAG &src);
00291
00292
00293
00294
00295
00296 virtual void link(GP_Domain &child, GP_NodeList &parents,
00297 int keepshape = 0);
00298 virtual void link(GP_Domain &child, GP_Domain &parent,
00299 int withcorrection = 1);
00300
00301
00302
00303
00304 virtual int updateDescendents(GP_Domain &child,
00305 int including_child = 0);
00306
00307
00308
00309
00310
00311 virtual int updateDisplacements(GP_Domain &child,
00312 int keepframes = 1);
00313
00314
00315
00316 int pasteInPlace(GEO_PasteSurf &ps, GEO_TPSurf &tpsurf);
00317
00318
00319
00320
00321
00322 int rowColTexture (int txtoff = -1, int ptattrib = 1);
00323 int uniformTexture (int txtoff = -1, int ptattrib = 1);
00324 int grevilleTexture(int txtoff = -1, int ptattrib = 1);
00325 int chordLenTexture(int txtoff = -1, int ptattrib = 1);
00326
00327
00328
00329 int traverse (int (*f)(const GEO_PasteSurf*,void*),
00330 void *d) const;
00331 int traverseBackward(int (*f)(const GEO_PasteSurf*,void*),
00332 void *d) const;
00333
00334
00335
00336 const GEO_PasteSurf *rootSurface() const
00337 {
00338 return (const GEO_PasteSurf*) root();
00339 }
00340
00341
00342
00343
00344
00345
00346
00347
00348 int outTo (ostream &os, int binary = 0) const;
00349 bool inFrom(UT_IStream &is);
00350
00351 protected:
00352
00353 virtual void changedRoot(void);
00354
00355
00356 GEO_PasteSurf *rootSurface() { return (GEO_PasteSurf*)root(); }
00357
00358
00359
00360 virtual GEO_PasteSurfDAG *newDAGSpecies(void) const;
00361
00362
00363 private:
00364
00365
00366
00367
00368 int fillUCurve(float v,int vidx, int ustartidx,int ustopidx,
00369 int density, UT_Vector4 *pos, int puoffset,
00370 int rbound, unsigned du, unsigned dv) const;
00371 int fillVCurve(float u,int uidx, int vstartidx,int vstopidx,
00372 int density, UT_Vector4 *pos, int pvoffset,
00373 int rbound, unsigned du, unsigned dv) const;
00374 int fillUCurve(float v, int vidx, int ustartidx,
00375 int ustopidx, int density,
00376 GEO_Vertex *result,
00377 GEO_AttributeHandleList &hlist,
00378 int puoffset, int rbound,
00379 unsigned du, unsigned dv) const;
00380 int fillVCurve(float u, int uidx, int vstartidx,
00381 int vstopidx, int density,
00382 GEO_Vertex *result,
00383 GEO_AttributeHandleList &hlist,
00384 int pvoffset, int rbound,
00385 unsigned du, unsigned dv) const;
00386 int fillUCurveWAttrib(float v, int vidx, int ustartidx,
00387 int ustopidx, int density, UT_Vector4 *pos,
00388 GB_AttributeData *adata,
00389 const GB_FloatOffsets &foffsets,
00390 int puoffset, int rbound,
00391 unsigned du, unsigned dv) const;
00392 int fillVCurveWAttrib(float u, int uidx, int vstartidx,
00393 int vstopidx, int density, UT_Vector4 *pos,
00394 GB_AttributeData *adata,
00395 const GB_FloatOffsets &foffsets,
00396 int pvoffset, int rbound,
00397 unsigned du, unsigned dv) const;
00398
00399 };
00400
00401 #endif