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