Panda3D
|
00001 // Filename: linearVectorForce.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 LINEARVECTORFORCE_H 00016 #define LINEARVECTORFORCE_H 00017 00018 #include "linearForce.h" 00019 00020 //////////////////////////////////////////////////////////////// 00021 // Class : LinearVectorForce 00022 // Description : Simple directed vector force. Suitable for 00023 // gravity, non-turbulent wind, etc... 00024 //////////////////////////////////////////////////////////////// 00025 class EXPCL_PANDAPHYSICS LinearVectorForce : public LinearForce { 00026 PUBLISHED: 00027 LinearVectorForce(const LVector3& vec, PN_stdfloat a = 1.0f, bool mass = false); 00028 LinearVectorForce(const LinearVectorForce ©); 00029 LinearVectorForce(PN_stdfloat x = 0.0f, PN_stdfloat y = 0.0f, PN_stdfloat z = 0.0f, 00030 PN_stdfloat a = 1.0f, bool mass = false); 00031 virtual ~LinearVectorForce(); 00032 00033 INLINE void set_vector(const LVector3& v); 00034 INLINE void set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00035 00036 INLINE LVector3 get_local_vector() const; 00037 00038 virtual void output(ostream &out) const; 00039 virtual void write(ostream &out, unsigned int indent=0) const; 00040 00041 public: 00042 INLINE LinearVectorForce& operator += (const LinearVectorForce &other); 00043 00044 private: 00045 LVector3 _fvec; 00046 00047 virtual LinearForce *make_copy(); 00048 virtual LVector3 get_child_vector(const PhysicsObject *po); 00049 00050 public: 00051 static TypeHandle get_class_type() { 00052 return _type_handle; 00053 } 00054 static void init_type() { 00055 LinearForce::init_type(); 00056 register_type(_type_handle, "LinearVectorForce", 00057 LinearForce::get_class_type()); 00058 } 00059 virtual TypeHandle get_type() const { 00060 return get_class_type(); 00061 } 00062 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00063 00064 private: 00065 static TypeHandle _type_handle; 00066 }; 00067 00068 #include "linearVectorForce.I" 00069 00070 #endif // LINEARVECTORFORCE_H