00001 // Filename: linearForce.h 00002 // Created by: charles (13Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef LINEARFORCE_H 00020 #define LINEARFORCE_H 00021 00022 #include "baseForce.h" 00023 00024 /////////////////////////////////////////////////////////////////// 00025 // Class : LinearForce 00026 // Description : A force that acts on a PhysicsObject by way of an 00027 // Integrator. This is a pure virtual base class. 00028 /////////////////////////////////////////////////////////////////// 00029 class EXPCL_PANDAPHYSICS LinearForce : public BaseForce { 00030 private: 00031 float _amplitude; 00032 bool _mass_dependent; 00033 00034 bool _x_mask; 00035 bool _y_mask; 00036 bool _z_mask; 00037 00038 virtual LVector3f get_child_vector(const PhysicsObject *po) = 0; 00039 00040 protected: 00041 LinearForce(float a, bool mass); 00042 LinearForce(const LinearForce& copy); 00043 00044 PUBLISHED: 00045 ~LinearForce(void); 00046 00047 INLINE void set_amplitude(const float a); 00048 INLINE void set_mass_dependent(bool m); 00049 00050 INLINE float get_amplitude(void) const; 00051 INLINE bool get_mass_dependent(void) const; 00052 00053 INLINE void set_vector_masks(bool x, bool y, bool z); 00054 00055 virtual LVector3f get_vector(const PhysicsObject *po); 00056 00057 virtual LinearForce *make_copy(void) = 0; 00058 00059 virtual bool is_linear(void) const; 00060 00061 public: 00062 static TypeHandle get_class_type(void) { 00063 return _type_handle; 00064 } 00065 static void init_type(void) { 00066 BaseForce::init_type(); 00067 register_type(_type_handle, "LinearForce", 00068 BaseForce::get_class_type()); 00069 } 00070 virtual TypeHandle get_type(void) const { 00071 return get_class_type(); 00072 } 00073 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00074 00075 private: 00076 static TypeHandle _type_handle; 00077 }; 00078 00079 #include "linearForce.I" 00080 00081 #endif // BASELINEARFORCE_H