00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LINEARNOISEFORCE_H
00020 #define LINEARNOISEFORCE_H
00021
00022 #include "pandabase.h"
00023 #include "linearRandomForce.h"
00024
00025
00026
00027
00028
00029 class EXPCL_PANDAPHYSICS LinearNoiseForce : public LinearRandomForce {
00030 private:
00031 static unsigned char _prn_table[256];
00032 static LVector3f _gradient_table[256];
00033 static bool _initialized;
00034
00035 INLINE float cubic_step(const float x) const;
00036 INLINE LVector3f vlerp(const float t, const LVector3f& v0, const LVector3f& v1) const;
00037
00038 INLINE unsigned char get_prn_entry(const LPoint3f& point) const;
00039 INLINE unsigned char get_prn_entry(const float x, const float y, const float z) const;
00040
00041 INLINE LVector3f& get_lattice_entry(const LPoint3f& point);
00042 INLINE LVector3f& get_lattice_entry(const float x, const float y, const float z);
00043
00044 INLINE unsigned char prn_lookup(int index) const;
00045
00046 virtual LVector3f get_child_vector(const PhysicsObject *po);
00047 virtual LinearForce *make_copy(void);
00048
00049 public:
00050 static int _random_seed;
00051 static void init_noise_tables(void);
00052
00053 PUBLISHED:
00054 LinearNoiseForce(float a = 1.0f, bool m = false);
00055 LinearNoiseForce(const LinearNoiseForce ©);
00056 virtual ~LinearNoiseForce(void);
00057
00058 public:
00059 static TypeHandle get_class_type(void) {
00060 return _type_handle;
00061 }
00062 static void init_type(void) {
00063 LinearRandomForce::init_type();
00064 register_type(_type_handle, "LinearNoiseForce",
00065 LinearRandomForce::get_class_type());
00066 }
00067 virtual TypeHandle get_type(void) const {
00068 return get_class_type();
00069 }
00070 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00071
00072 private:
00073 static TypeHandle _type_handle;
00074 };
00075
00076 #include "linearNoiseForce.I"
00077
00078 #endif // LINEARNOISEFORCE_H