Panda3D
|
00001 // Filename: physxJoint.h 00002 // Created by: enn0x (02Oct09) 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 PHYSXJOINT_H 00016 #define PHYSXJOINT_H 00017 00018 #include "pandabase.h" 00019 #include "pointerTo.h" 00020 #include "luse.h" 00021 00022 #include "physxObject.h" 00023 #include "physxEnums.h" 00024 #include "physx_includes.h" 00025 00026 class PhysxActor; 00027 class PhysxScene; 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : PhysxJoint 00031 // Description : Abstract base class for the different types of 00032 // joints. All joints are used to connect two dynamic 00033 // actors, or an actor and the environment. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDAPHYSX PhysxJoint : public PhysxObject, public PhysxEnums { 00036 00037 PUBLISHED: 00038 void release(); 00039 00040 PhysxActor *get_actor(unsigned int idx) const; 00041 PhysxScene *get_scene() const; 00042 00043 void purge_limit_planes(); 00044 00045 void set_name(const char *name); 00046 void set_global_anchor(const LPoint3f &anchor); 00047 void set_global_axis(const LVector3f &axis); 00048 void set_breakable(float maxForce, float maxTorque); 00049 void set_solver_extrapolation_factor(float factor); 00050 void set_use_acceleration_spring(bool value); 00051 void set_limit_point(const LPoint3f &pos, bool isOnActor2=true); 00052 void add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f); 00053 00054 const char *get_name() const; 00055 LPoint3f get_global_anchor() const; 00056 LVector3f get_global_axis() const; 00057 float get_solver_extrapolation_factor() const; 00058 bool get_use_acceleration_spring() const; 00059 00060 INLINE void ls() const; 00061 INLINE void ls(ostream &out, int indent_level=0) const; 00062 00063 public: 00064 static PhysxJoint *factory(NxJointType shapeType); 00065 00066 virtual NxJoint *ptr() const = 0; 00067 00068 virtual void link(NxJoint *shapePtr) = 0; 00069 virtual void unlink() = 0; 00070 00071 protected: 00072 INLINE PhysxJoint(); 00073 00074 private: 00075 string _name; 00076 00077 //////////////////////////////////////////////////////////////////// 00078 public: 00079 static TypeHandle get_class_type() { 00080 return _type_handle; 00081 } 00082 static void init_type() { 00083 PhysxObject::init_type(); 00084 register_type(_type_handle, "PhysxJoint", 00085 PhysxObject::get_class_type()); 00086 } 00087 virtual TypeHandle get_type() const { 00088 return get_class_type(); 00089 } 00090 virtual TypeHandle force_init_type() { 00091 init_type(); 00092 return get_class_type(); 00093 } 00094 00095 private: 00096 static TypeHandle _type_handle; 00097 }; 00098 00099 #include "physxJoint.I" 00100 00101 #endif // PHYSXJOINT_H