00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LINEARDISTANCEFORCE_H
00020 #define LINEARDISTANCEFORCE_H
00021
00022 #include "linearForce.h"
00023
00024 class BamReader;
00025
00026
00027
00028
00029
00030 class EXPCL_PANDAPHYSICS LinearDistanceForce : public LinearForce {
00031 PUBLISHED:
00032 enum FalloffType {
00033 FT_ONE_OVER_R,
00034 FT_ONE_OVER_R_SQUARED,
00035 FT_ONE_OVER_R_CUBED
00036 };
00037
00038 INLINE void set_radius(float r);
00039 INLINE void set_falloff_type(FalloffType ft);
00040 INLINE void set_force_center(const LPoint3f& p);
00041
00042 INLINE float get_radius(void) const;
00043 INLINE FalloffType get_falloff_type(void) const;
00044 INLINE LPoint3f get_force_center(void) const;
00045
00046 INLINE float get_scalar_term(void) const;
00047
00048 private:
00049 LPoint3f _force_center;
00050
00051 FalloffType _falloff;
00052 float _radius;
00053
00054 virtual LinearForce *make_copy(void) = 0;
00055 virtual LVector3f get_child_vector(const PhysicsObject *po) = 0;
00056
00057 protected:
00058 LinearDistanceForce(const LPoint3f& p, FalloffType ft, float r, float a,
00059 bool m);
00060 LinearDistanceForce(const LinearDistanceForce ©);
00061 virtual ~LinearDistanceForce(void);
00062
00063 public:
00064 static TypeHandle get_class_type(void) {
00065 return _type_handle;
00066 }
00067 static void init_type(void) {
00068 LinearForce::init_type();
00069 register_type(_type_handle, "LinearDistanceForce",
00070 LinearForce::get_class_type());
00071 }
00072 virtual TypeHandle get_type(void) const {
00073 return get_class_type();
00074 }
00075 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00076
00077 private:
00078 static TypeHandle _type_handle;
00079 };
00080
00081 #include "linearDistanceForce.I"
00082
00083 #endif // LINEARDISTANCEFORCE_H