physxPlaneShape.h
```00001 // Filename: physxPlaneShape.h
00002 // Created by:  enn0x (16Sep09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014
00015 #ifndef PHYSXPLANESHAPE_H
00016 #define PHYSXPLANESHAPE_H
00017
00018 #include "pandabase.h"
00019 #include "luse.h"
00020
00021 #include "physxShape.h"
00022 #include "physx_includes.h"
00023
00024 class PhysxPlaneShapeDesc;
00025
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : PhysxPlaneShape
00028 // Description : A plane collision detection primitive. By default
00029 //               it is configured to be the y == 0 plane. You can
00030 //               then set a normal and a d to specify an arbitrary
00031 //               plane. d is the distance of the plane from the
00032 //               origin along the normal, assuming the normal is
00033 //               normalized. Thus the plane equation is:
00034 //               normal.x * X + normal.y * Y + normal.z * Z = d
00035 //
00036 //               Note: the plane does not represent an infinitely
00037 //               thin object, but rather a completely solid
00038 //               negative half space (all points p for which
00039 //               normal.dot(p) - d < 0 are inside the solid region.)
00040 //
00041 //               Each shape is owned by an actor that it is attached
00042 //               to.
00043 //
00044 //               An instance can be created by calling the
00045 //               createShape() method of the PhysxActor object that
00046 //               should own it, with a PhysxPlaneShapeDesc object as
00047 //               the parameter, or by adding the shape descriptor
00048 //               into the PhysxActorDesc class before creating the
00049 //               actor.
00050 //
00051 //               The shape is deleted by calling release() on the
00052 //               shape itself.
00053 ////////////////////////////////////////////////////////////////////
00054 class EXPCL_PANDAPHYSX PhysxPlaneShape : public PhysxShape {
00055
00056 PUBLISHED:
00057   INLINE PhysxPlaneShape();
00058   INLINE ~PhysxPlaneShape();
00059
00060   void save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const;
00061
00062   void set_plane(const LVector3f &normal, float d);
00063
00064 ////////////////////////////////////////////////////////////////////
00065 public:
00066   INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
00067
00070
00071 private:
00072   NxPlaneShape *_ptr;
00073
00074 ////////////////////////////////////////////////////////////////////
00075 public:
00076   static TypeHandle get_class_type() {
00077     return _type_handle;
00078   }
00079   static void init_type() {
00080     PhysxShape::init_type();
00081     register_type(_type_handle, "PhysxPlaneShape",
00082                   PhysxShape::get_class_type());
00083   }
00084   virtual TypeHandle get_type() const {
00085     return get_class_type();
00086   }
00087   virtual TypeHandle force_init_type() {
00088     init_type();
00089     return get_class_type();
00090   }
00091
00092 private:
00093   static TypeHandle _type_handle;
00094 };
00095
00096 #include "physxPlaneShape.I"
00097
00098 #endif // PHYSXPLANESHAPE_H
```