00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __SIM_ColliderPoint_h__
00015 #define __SIM_ColliderPoint_h__
00016
00017 #include "SIM_API.h"
00018 #include <UT/UT_IntArray.h>
00019 #include <UT/UT_PtrArray.h>
00020 #include <UT/UT_RefArray.h>
00021 #include <UT/UT_DMatrix4.h>
00022 #include "SIM_Collider.h"
00023
00024 class GU_SDF;
00025 class GU_RayIntersect;
00026 class SIM_Geometry;
00027 class SIM_Position;
00028 class SIM_Impacts;
00029
00030
00031
00032
00033 class SIM_API SIM_ColliderPoint : public SIM_Collider
00034 {
00035 public:
00036 GETSET_DATA_FUNCS_F(SIM_NAME_TOLERANCE, Tolerance);
00037 GETSET_DATA_FUNCS_F(SIM_NAME_VOLUMEOFFSET, VolumeOffset);
00038 GETSET_DATA_FUNCS_B("usepointvelocity", UsePointVelocity);
00039 GETSET_DATA_FUNCS_B("usesdfvelocity", UseSDFVelocity);
00040
00041 protected:
00042
00043 explicit SIM_ColliderPoint(const SIM_DataFactory *factory);
00044
00045 virtual ~SIM_ColliderPoint();
00046
00047
00048 virtual bool collideObjectsSubclass(SIM_Engine &engine,
00049 SIM_Object &object,
00050 SIM_Object &affector,
00051 const SIM_Time &starttime,
00052 const SIM_Time &endtime,
00053 SIM_ImpactApplyType impactapplytype,
00054 int impactflags) const;
00055
00056 private:
00057 bool doCollide(SIM_Object &object,
00058 SIM_Object &affector,
00059 const SIM_Time &starttime,
00060 const SIM_Time &endtime,
00061 SIM_Impacts *impacts,
00062 SIM_Impacts *affimpacts,
00063 int impactflags) const;
00064
00065
00066
00067
00068
00069 void calculateCollisionPrimUV(
00070 const SIM_Geometry &affsimgeo,
00071 GU_RayIntersect *&affintersect,
00072 const UT_Vector3 &hitpos,
00073 const UT_Vector3 &hitnormal,
00074 fpreal tolerance,
00075 int &primnum,
00076 fpreal &primu, fpreal &primv) const;
00077 bool addCollisions(const int objid,
00078 const SIM_Geometry &oldsimgeo,
00079 const SIM_Geometry &simgeo,
00080 const SIM_Geometry &affsimgeo,
00081 const UT_DMatrix4 &oldxform,
00082 const UT_DMatrix4 &xform,
00083 SIM_Impacts *impacts,
00084 const int affobjid,
00085 const UT_DMatrix4 &oldaffixform,
00086 const UT_DMatrix4 &affixform,
00087 const UT_DMatrix4 &oldaffxform,
00088 const UT_DMatrix4 &affxform,
00089 SIM_Impacts *affimpacts,
00090 const SIM_Time &starttime,
00091 const SIM_Time &endtime,
00092 const GU_SDF &affsdf,
00093 const SIM_Object &obj,
00094 const SIM_Object &affobj,
00095 int impactflags) const;
00096
00097 static SIM_DopDescription *getPointColliderDopDescription();
00098
00099 DECLARE_STANDARD_GETCASTTOTYPE();
00100 DECLARE_DATAFACTORY(SIM_ColliderPoint,
00101 SIM_Collider,
00102 "Point Collider",
00103 getPointColliderDopDescription());
00104 };
00105
00106 #endif
00107