00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GU_PrimPasteDAG_h__
00021 #define __GU_PrimPasteDAG_h__
00022
00023 #include "GU_API.h"
00024 #include <GEO/GEO_PrimPasteDAG.h>
00025 #include "GU_Prim.h"
00026
00027 class GU_ConvertMethod;
00028 class UT_Vector4Array;
00029
00030
00031 class GU_API GU_PasteParms
00032 {
00033 public:
00034 GU_PasteParms()
00035 {
00036 method = 0;
00037 up = 0;
00038 trim = 0; trimscale = 1;
00039 height = 0;
00040 ubeltwidth = vbeltwidth = 0;
00041 keepshape = 0;
00042 }
00043
00044 int method;
00045
00046
00047
00048
00049 int up;
00050 int trim;
00051 float trimscale;
00052 float height;
00053 UT_Vector3 axis;
00054 float rtol;
00055 int keepshape;
00056
00057 float umin;
00058 float umax;
00059 float vmin;
00060 float vmax;
00061
00062 float ubeltwidth;
00063 float vbeltwidth;
00064 int ubeltdivs;
00065 int vbeltdivs;
00066 };
00067
00068 class GU_API GU_PrimPasteDAG : public GEO_PrimPasteDAG, public GU_Primitive
00069 {
00070 public:
00071 GU_PrimPasteDAG(GU_Detail *d);
00072 virtual ~GU_PrimPasteDAG();
00073
00074
00075
00076
00077
00078
00079 static GU_PrimPasteDAG *build(GU_Detail *gudp, GEO_TPSurf &root,
00080 int chkpaste = 0);
00081 static GU_PrimPasteDAG *build(GU_Detail *gudp, GEO_PasteSurf &root,
00082 int chkpaste = 0);
00083
00084
00085 virtual GEO_Primitive *convert(GU_ConvertParms &parms,
00086 GB_PointGroup *usedpts = 0);
00087 virtual GEO_Primitive *convertNew(GU_ConvertParms &parms);
00088
00089 virtual void *castTo (void) const;
00090 virtual const GEO_Primitive *castToGeo(void) const;
00091
00092 virtual void normal(int noff) const;
00093 virtual void normal(UT_Vector3Array &output) const;
00094
00095
00096 virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
00097 float tmax = 1E17F, float tol = 1E-12F,
00098 float *distance = 0, UT_Vector3 *pos = 0,
00099 UT_Vector3 *nml = 0, int accurate = 0,
00100 float *u = 0, float *v = 0,
00101 int ignoretrim = 1) const;
00102
00103
00104 virtual int minimum(const UT_Vector3 &p, float distmax = 1E17F,
00105 float *distance = 0, float *u = 0,
00106 float *v = 0, int accurate = 1);
00107
00108
00109
00110 virtual int minimum(GU_Primitive &prim, float distmax = 1E17F,
00111 float *distance = 0, float *u1 = 0,
00112 float *v1 = 0, float *u2 = 0, float *v2 = 0,
00113 int accurate = 1);
00114
00115 virtual GU_RayIntersect *createRayCache(int &persistent);
00116
00117
00118 GEO_PasteSurf *paste (GU_PrimPasteDAG &dag, const GU_PasteParms &);
00119 GEO_PasteSurf *overlay(GEO_PasteSurf &child, GU_PrimPasteDAG &dag,
00120 const GU_PasteParms &parms, int at = 1);
00121 GEO_PasteSurf *replace(GEO_PasteSurf &child, GU_PrimPasteDAG &dag,
00122 int at = 1, int up = 1, float height = 0.0f);
00123 GEO_PasteSurf *spawn (GEO_PasteSurf &child, const GU_PasteParms &);
00124
00125
00126 protected:
00127
00128
00129 virtual GEO_PasteSurfDAG *newDAGSpecies(void) const;
00130
00131 private:
00132
00133 int evaluateSurface(GU_ConvertMethod &method,
00134 int featurecoord,
00135 UT_Vector4Array &pos,
00136 int &nu, int &nv) const;
00137 int evaluateSurface(GU_ConvertMethod &method,
00138 int featurecoord, int featureattrib,
00139 UT_Vector4Array &pos,
00140 GB_AttributeData *&adata,
00141 int &vtxattr, int &nu, int &nv) const;
00142
00143 int getUVInterval (const GEO_PasteSurf &surf,
00144 float &umin, float &vmin,
00145 float &umax, float &vmax) const;
00146
00147
00148 int getProjectionUV(const UT_Vector3 &axis, float tol,
00149 int vecproj, GU_PrimPasteDAG &dag,
00150 GP_Point &b1, GP_Point &b2,
00151 GP_Point &b3, GP_Point &b4);
00152
00153
00154
00155 void toWorld(const GEO_PasteSurf &surf,
00156 GP_Point &b1, GP_Point &b2,
00157 GP_Point &b3, GP_Point &b4) const;
00158 };
00159
00160 #endif