00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GU_PrimMetaBall_h__
00022 #define __GU_PrimMetaBall_h__
00023
00024 #include "GU_API.h"
00025 #include <GEO/GEO_PrimMetaBall.h>
00026 #include "GU_Detail.h"
00027 #include "GU_Prim.h"
00028
00029 class GEO_Hull;
00030 class GU_PrimPoly;
00031 class GU_PrimMesh;
00032 class GU_PrimNURBSurf;
00033 class GU_PrimRBezSurf;
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class GU_API GU_PrimMetaBallParms
00047 {
00048 public:
00049 GU_PrimMetaBallParms(GU_Detail *gdp=NULL, GEO_Point *ppt=NULL,
00050 fpreal weight=2);
00051
00052 GU_Detail *gdp;
00053 GEO_Point *ppt;
00054 UT_Matrix4 xform;
00055 float weight;
00056 };
00057
00058 class GU_API GU_PrimMetaBall : public GEO_PrimMetaBall, public GU_Primitive
00059 {
00060 public:
00061
00062
00063 GU_PrimMetaBall(GU_Detail *gdp, GA_Offset offset=GA_INVALID_OFFSET)
00064 : GEO_PrimMetaBall(gdp, offset)
00065 , GU_Primitive()
00066 {
00067 gdp->incrementCacheables();
00068 }
00069 GU_PrimMetaBall(const GA_MergeMap &map,
00070 GU_Detail &detail,
00071 GA_Offset offset,
00072 const GU_PrimMetaBall &src)
00073 : GEO_PrimMetaBall(map, detail, offset, src)
00074 , GU_Primitive()
00075 {
00076 detail.incrementCacheables();
00077 }
00078
00079
00080 virtual ~GU_PrimMetaBall();
00081
00082 virtual const GA_PrimitiveDefinition &getTypeDef() const
00083 {
00084 UT_ASSERT(theDefinition);
00085 return *theDefinition;
00086 }
00087
00088
00089
00090 GEO_Primitive *convert(GU_ConvertParms &parms,
00091 GA_PointGroup *usedpts = 0);
00092 GEO_Primitive *convertNew(GU_ConvertParms &parms);
00093
00094 virtual void normal(NormalComp &output) const;
00095
00096 void *castTo() const;
00097
00098
00099 static GU_PrimMetaBall *build(const GU_PrimMetaBallParms &parms,
00100 const char *type = "wyvill");
00101
00102
00103
00104
00105 virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
00106 float tmax = 1E17F, float tol = 1E-12F,
00107 float *distance = 0, UT_Vector3 *pos = 0,
00108 UT_Vector3 *nml = 0, int accurate = 0,
00109 float *u = 0, float *v = 0,
00110 int ignoretrim = 1) const;
00111
00112
00113 virtual void notifyCache(int type);
00114 virtual void notifyCache(int type, const GEO_Point &ppt);
00115 virtual void notifyCache(int type, const GA_PointGroup &grp);
00116 virtual void notifyCache(int type, const UT_Matrix4 &xform,
00117 int push);
00118 virtual void notifyCache(int type, const UT_Vector3 &delta);
00119
00120
00121 virtual GU_RayIntersect *createRayCache(int &persistent);
00122
00123 virtual const GEO_Primitive *castToGeo(void) const;
00124
00125
00126 private:
00127 void create(const UT_Matrix4 &xform,
00128 float weight, const char *kernel = "wyvill",
00129 GEO_Point *ppt = 0);
00130
00131 static GA_PrimitiveDefinition *theDefinition;
00132 friend class GU_PrimitiveFactory;
00133 };
00134
00135 #endif