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