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