Panda3D
|
00001 // Filename: linearForce.h 00002 // Created by: charles (13Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef LINEARFORCE_H 00016 #define LINEARFORCE_H 00017 00018 #include "baseForce.h" 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Class : LinearForce 00022 // Description : A force that acts on a PhysicsObject by way of an 00023 // Integrator. This is a pure virtual base class. 00024 //////////////////////////////////////////////////////////////////// 00025 class EXPCL_PANDAPHYSICS LinearForce : public BaseForce { 00026 PUBLISHED: 00027 ~LinearForce(); 00028 00029 INLINE void set_amplitude(const PN_stdfloat a); 00030 INLINE void set_mass_dependent(bool m); 00031 00032 INLINE PN_stdfloat get_amplitude() const; 00033 INLINE bool get_mass_dependent() const; 00034 00035 INLINE void set_vector_masks(bool x, bool y, bool z); 00036 INLINE LVector3 get_vector_masks(); 00037 00038 LVector3 get_vector(const PhysicsObject *po); 00039 00040 virtual LinearForce *make_copy() = 0; 00041 00042 virtual bool is_linear() const; 00043 00044 virtual void output(ostream &out) const; 00045 virtual void write(ostream &out, unsigned int indent=0) const; 00046 00047 protected: 00048 LinearForce(PN_stdfloat a, bool mass); 00049 LinearForce(const LinearForce& copy); 00050 00051 private: 00052 PN_stdfloat _amplitude; 00053 bool _mass_dependent; 00054 00055 bool _x_mask; 00056 bool _y_mask; 00057 bool _z_mask; 00058 00059 virtual LVector3 get_child_vector(const PhysicsObject *po) = 0; 00060 00061 public: 00062 static TypeHandle get_class_type() { 00063 return _type_handle; 00064 } 00065 static void init_type() { 00066 BaseForce::init_type(); 00067 register_type(_type_handle, "LinearForce", 00068 BaseForce::get_class_type()); 00069 } 00070 virtual TypeHandle get_type() 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