00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GU_PrimTube_h__
00022 #define __GU_PrimTube_h__
00023
00024 #include "GU_API.h"
00025 #include <GEO/GEO_PrimTube.h>
00026 #include <GEO/GEO_SurfaceType.h>
00027 #include "GU_Cap.h"
00028 #include "GU_Prim.h"
00029
00030 class GEO_Hull;
00031 class GU_Detail;
00032 class GU_PrimPoly;
00033 class GEO_Face;
00034 class GU_PrimMesh;
00035 class GU_PrimNURBSurf;
00036 class GU_PrimRBezSurf;
00037 class GU_CapOptions;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 class GU_API GU_PrimTubeParms {
00052 public:
00053 GU_PrimTubeParms();
00054
00055
00056
00057
00058 void buildXform(const UT_Vector4 &p0, const UT_Vector4 &p1,
00059 float radius);
00060
00061 GU_Detail *gdp;
00062 GEO_Point *ppt;
00063 UT_Matrix4 xform;
00064 int rows, cols;
00065 int orderu;
00066 int orderv;
00067 int imperfect;
00068 float taper;
00069 GEO_SurfaceType type;
00070 };
00071
00072 class GU_API GU_PrimTube : public GEO_PrimTube, public GU_Primitive
00073 {
00074 public:
00075 GU_PrimTube(GU_Detail *gdp) : GEO_PrimTube(gdp), GU_Primitive() {}
00076 virtual ~GU_PrimTube();
00077
00078 virtual void *castTo() const;
00079 virtual const GEO_Primitive *castToGeo(void) const;
00080 virtual GU_DisplayMesh *getDisplayMesh(int noff, float lod);
00081
00082
00083 GEO_Primitive *convert(GU_ConvertParms &parms,
00084 GB_PointGroup *usedpts = 0);
00085 GEO_Primitive *convertNew(GU_ConvertParms &parms);
00086
00087 virtual void normal(int noff) const;
00088 virtual void normal(UT_Vector3Array &ouput) const;
00089 virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
00090 float tmax = 1E17F, float tol = 1E-12F,
00091 float *distance = 0, UT_Vector3 *pos = 0,
00092 UT_Vector3 *nml = 0, int accurate = 0,
00093 float *u = 0, float *v = 0,
00094 int ignoretrim = 1) const;
00095
00096 static GEO_Primitive *build(const GU_PrimTubeParms &parms,
00097 const GU_CapOptions &caps,
00098 unsigned type = GEOPRIMTUBE);
00099
00100
00101 virtual GU_RayIntersect *createRayCache(int &persistent);
00102
00103 private:
00104
00105 void create(const UT_Matrix4 &xform, float taper, int caps,
00106 GEO_Point *ppt = 0);
00107
00108
00109 void passAttributesToFaces(GEO_Face *dest,
00110 int preserve_groups) const;
00111
00112 void passAttributesToMesh(GEO_Primitive &dest,
00113 int preserve_groups) const;
00114 };
00115
00116 #endif