00001 // Filename: linearUserDefinedForce.cxx 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 #include "linearUserDefinedForce.h" 00020 00021 TypeHandle LinearUserDefinedForce::_type_handle; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function : LinearUserDefinedForce 00025 // Access : public 00026 // Description : constructor 00027 //////////////////////////////////////////////////////////////////// 00028 LinearUserDefinedForce:: 00029 LinearUserDefinedForce(LVector3f (*proc)(const PhysicsObject *), 00030 float a, bool md) : 00031 LinearForce(a, md), 00032 _proc(proc) 00033 { 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function : LinearUserDefinedForce 00038 // Access : public 00039 // Description : copy constructor 00040 //////////////////////////////////////////////////////////////////// 00041 LinearUserDefinedForce:: 00042 LinearUserDefinedForce(const LinearUserDefinedForce ©) : 00043 LinearForce(copy) { 00044 _proc = copy._proc; 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function : ~LinearUserDefinedForce 00049 // Access : public 00050 // Description : destructor 00051 //////////////////////////////////////////////////////////////////// 00052 LinearUserDefinedForce:: 00053 ~LinearUserDefinedForce(void) { 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function : make_copy 00058 // Access : private, virtual 00059 // Description : child copier 00060 //////////////////////////////////////////////////////////////////// 00061 LinearForce *LinearUserDefinedForce:: 00062 make_copy(void) { 00063 return new LinearUserDefinedForce(*this); 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function : get_child_vector 00068 // Access : private, virtual 00069 // Description : force builder 00070 //////////////////////////////////////////////////////////////////// 00071 LVector3f LinearUserDefinedForce:: 00072 get_child_vector(const PhysicsObject *po) { 00073 return _proc(po); 00074 }