00001 // Filename: baseForce.h 00002 // Created by: charles (08Aug00) 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 BASEFORCE_H 00020 #define BASEFORCE_H 00021 00022 #include <pandabase.h> 00023 #include <typedReferenceCount.h> 00024 #include <luse.h> 00025 00026 #include "physicsObject.h" 00027 00028 class ForceNode; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : BaseForce 00032 // Description : pure virtual base class for all forces that could 00033 // POSSIBLY exist. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDAPHYSICS BaseForce : public TypedReferenceCount { 00036 private: 00037 ForceNode *_force_node; 00038 bool _active; 00039 00040 virtual LVector3f get_child_vector(const PhysicsObject *po) = 0; 00041 00042 protected: 00043 BaseForce(bool active = true); 00044 BaseForce(const BaseForce ©); 00045 00046 PUBLISHED: 00047 virtual ~BaseForce(void); 00048 00049 INLINE bool get_active(void) const; 00050 INLINE void set_active(bool active); 00051 virtual bool is_linear(void) const = 0; 00052 00053 INLINE ForceNode *get_force_node(void) const; 00054 00055 virtual LVector3f get_vector(const PhysicsObject *po) = 0; 00056 00057 public: 00058 static TypeHandle get_class_type(void) { 00059 return _type_handle; 00060 } 00061 static void init_type(void) { 00062 TypedReferenceCount::init_type(); 00063 register_type(_type_handle, "BaseForce", 00064 TypedReferenceCount::get_class_type()); 00065 } 00066 virtual TypeHandle get_type(void) const { 00067 return get_class_type(); 00068 } 00069 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00070 00071 private: 00072 static TypeHandle _type_handle; 00073 00074 friend class ForceNode; 00075 }; 00076 00077 #include "baseForce.I" 00078 00079 #endif // BASEFORCE_H