Panda3D
 All Classes Functions Variables Enumerations
physxShape.h
00001 // Filename: physxShape.h
00002 // Created by:  enn0x (16Sep09)
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 PHYSXSHAPE_H
00016 #define PHYSXSHAPE_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 PhysxMaterial;
00028 class PhysxGroupsMask;
00029 class PhysxBounds3;
00030 class PhysxSphere;
00031 class PhysxBox;
00032 class PhysxCapsule;
00033 class PhysxRay;
00034 class PhysxRaycastHit;
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //       Class : PhysxShape
00038 // Description : Abstract base class for shapes.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDAPHYSX PhysxShape : public PhysxObject, public PhysxEnums {
00041 
00042 PUBLISHED:
00043   void release();
00044 
00045   PhysxActor *get_actor() const;
00046 
00047   void set_name(const char *name);
00048   void set_flag(const PhysxShapeFlag flag, bool value);
00049   void set_skin_width(float skinWidth);
00050   void set_group(unsigned short group);
00051   void set_local_pos(const LPoint3f &pos);
00052   void set_local_mat(const LMatrix4f &mat);
00053   void set_material(const PhysxMaterial &material);
00054   void set_material_index(unsigned short idx);
00055   void set_groups_mask(const PhysxGroupsMask &mask);
00056 
00057   const char *get_name() const;
00058   bool get_flag(const PhysxShapeFlag flag) const;
00059   float get_skin_width() const;
00060   unsigned short get_group() const;
00061   LPoint3f get_local_pos() const;
00062   LMatrix4f get_local_mat() const;
00063   unsigned short get_material_index() const;
00064   PhysxGroupsMask get_groups_mask() const;
00065   PhysxBounds3 get_world_bounds() const;
00066 
00067   bool check_overlap_aabb(const PhysxBounds3 &world_bounds) const;
00068   bool check_overlap_capsule(const PhysxCapsule &world_capsule) const;
00069   bool check_overlap_obb(const PhysxBox &world_box) const;
00070   bool check_overlap_sphere(const PhysxSphere &world_sphere) const;
00071   PhysxRaycastHit raycast(const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const;
00072 
00073   INLINE void ls() const;
00074   INLINE void ls(ostream &out, int indent_level=0) const;
00075 
00076 public:
00077   static PhysxShape *factory(NxShapeType shapeType);
00078 
00079   virtual NxShape *ptr() const = 0;
00080 
00081   virtual void link(NxShape *shapePtr) = 0;
00082   virtual void unlink() = 0;
00083 
00084 protected:
00085   INLINE PhysxShape();
00086 
00087 private:
00088   string _name;
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 public:
00092   static TypeHandle get_class_type() {
00093     return _type_handle;
00094   }
00095   static void init_type() {
00096     PhysxObject::init_type();
00097     register_type(_type_handle, "PhysxShape", 
00098                   PhysxObject::get_class_type());
00099   }
00100   virtual TypeHandle get_type() const {
00101     return get_class_type();
00102   }
00103   virtual TypeHandle force_init_type() {
00104     init_type();
00105     return get_class_type();
00106   }
00107 
00108 private:
00109   static TypeHandle _type_handle;
00110 };
00111 
00112 #include "physxShape.I"
00113 
00114 #endif // PHYSXSHAPE_H
 All Classes Functions Variables Enumerations