00001 // Filename: linearUserDefinedForce.h 00002 // Created by: charles (31Jul00) 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 LINEARUSERDEFINEDFORCE_H 00020 #define LINEARUSERDEFINEDFORCE_H 00021 00022 #include "linearForce.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : LinearUserDefinedForce 00026 // Description : a programmable force that takes an evaluator fn. 00027 // 00028 // NOTE : AS OF Interrogate => Squeak, this class does NOT 00029 // get FFI'd due to the function pointer bug, and is 00030 // currently NOT getting interrogated. Change this 00031 // in the makefile when the time is right or this class 00032 // becomes needed... 00033 //////////////////////////////////////////////////////////////////// 00034 class LinearUserDefinedForce : public LinearForce { 00035 private: 00036 LVector3f (*_proc)(const PhysicsObject *po); 00037 00038 virtual LVector3f get_child_vector(const PhysicsObject *po); 00039 virtual LinearForce *make_copy(void); 00040 00041 PUBLISHED: 00042 LinearUserDefinedForce(LVector3f (*proc)(const PhysicsObject *) = NULL, 00043 float a = 1.0f, 00044 bool md = false); 00045 LinearUserDefinedForce(const LinearUserDefinedForce ©); 00046 virtual ~LinearUserDefinedForce(void); 00047 00048 INLINE void set_proc(LVector3f (*proc)(const PhysicsObject *)); 00049 00050 public: 00051 static TypeHandle get_class_type(void) { 00052 return _type_handle; 00053 } 00054 static void init_type(void) { 00055 LinearForce::init_type(); 00056 register_type(_type_handle, "LinearUserDefinedForce", 00057 LinearForce::get_class_type()); 00058 } 00059 virtual TypeHandle get_type(void) 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 "linearUserDefinedForce.I" 00069 00070 #endif // LINEARUSERDEFINEDFORCE_H