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