Panda3D

physxJoint.h

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