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();
00050
00051 GU_Detail *gdp;
00052 GEO_Point *ppt;
00053 UT_Matrix4 xform;
00054 float weight;
00055 };
00056
00057 class GU_API GU_PrimMetaBall : public GEO_PrimMetaBall, public GU_Primitive
00058 {
00059 public:
00060
00061
00062 GU_PrimMetaBall(GU_Detail *gdp) : GEO_PrimMetaBall(gdp), GU_Primitive()
00063 {
00064 gdp->incrementCacheables();
00065 }
00066
00067
00068 virtual ~GU_PrimMetaBall();
00069
00070
00071
00072 GEO_Primitive *convert(GU_ConvertParms &parms,
00073 GB_PointGroup *usedpts = 0);
00074 GEO_Primitive *convertNew(GU_ConvertParms &parms);
00075
00076 virtual void normal(int noff) const;
00077 virtual void normal(UT_Vector3Array &output) const;
00078
00079 void *castTo() const;
00080
00081
00082 static GU_PrimMetaBall *build(const GU_PrimMetaBallParms &parms,
00083 const char *type = "wyvill");
00084
00085
00086
00087
00088 virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
00089 float tmax = 1E17F, float tol = 1E-12F,
00090 float *distance = 0, UT_Vector3 *pos = 0,
00091 UT_Vector3 *nml = 0, int accurate = 0,
00092 float *u = 0, float *v = 0,
00093 int ignoretrim = 1) const;
00094
00095
00096 virtual void notifyCache(int type);
00097 virtual void notifyCache(int type, const GEO_Point &ppt);
00098 virtual void notifyCache(int type, const GB_PointGroup &grp);
00099 virtual void notifyCache(int type, const UT_Matrix4 &xform,
00100 int push);
00101 virtual void notifyCache(int type, const UT_Vector3 &delta);
00102
00103
00104 virtual GU_RayIntersect *createRayCache(int &persistent);
00105
00106 virtual const GEO_Primitive *castToGeo(void) const;
00107
00108
00109 private:
00110 void create(const UT_Matrix4 &xform,
00111 float weight, const char *kernel = "wyvill",
00112 GEO_Point *ppt = 0);
00113 };
00114
00115 #endif