Panda3D
 All Classes Functions Variables Enumerations
physxPlaneShape.h
1 // Filename: physxPlaneShape.h
2 // Created by: enn0x (16Sep09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PHYSXPLANESHAPE_H
16 #define PHYSXPLANESHAPE_H
17 
18 #include "pandabase.h"
19 #include "luse.h"
20 
21 #include "physxShape.h"
22 #include "physx_includes.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : PhysxPlaneShape
28 // Description : A plane collision detection primitive. By default
29 // it is configured to be the y == 0 plane. You can
30 // then set a normal and a d to specify an arbitrary
31 // plane. d is the distance of the plane from the
32 // origin along the normal, assuming the normal is
33 // normalized. Thus the plane equation is:
34 // normal.x * X + normal.y * Y + normal.z * Z = d
35 //
36 // Note: the plane does not represent an infinitely
37 // thin object, but rather a completely solid
38 // negative half space (all points p for which
39 // normal.dot(p) - d < 0 are inside the solid region.)
40 //
41 // Each shape is owned by an actor that it is attached
42 // to.
43 //
44 // An instance can be created by calling the
45 // createShape() method of the PhysxActor object that
46 // should own it, with a PhysxPlaneShapeDesc object as
47 // the parameter, or by adding the shape descriptor
48 // into the PhysxActorDesc class before creating the
49 // actor.
50 //
51 // The shape is deleted by calling release() on the
52 // shape itself.
53 ////////////////////////////////////////////////////////////////////
54 class EXPCL_PANDAPHYSX PhysxPlaneShape : public PhysxShape {
55 
56 PUBLISHED:
57  INLINE PhysxPlaneShape();
58  INLINE ~PhysxPlaneShape();
59 
60  void save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const;
61 
62  void set_plane(const LVector3f &normal, float d);
63 
64 ////////////////////////////////////////////////////////////////////
65 public:
66  INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
67 
68  void link(NxShape *shapePtr);
69  void unlink();
70 
71 private:
72  NxPlaneShape *_ptr;
73 
74 ////////////////////////////////////////////////////////////////////
75 public:
76  static TypeHandle get_class_type() {
77  return _type_handle;
78  }
79  static void init_type() {
80  PhysxShape::init_type();
81  register_type(_type_handle, "PhysxPlaneShape",
82  PhysxShape::get_class_type());
83  }
84  virtual TypeHandle get_type() const {
85  return get_class_type();
86  }
87  virtual TypeHandle force_init_type() {
88  init_type();
89  return get_class_type();
90  }
91 
92 private:
93  static TypeHandle _type_handle;
94 };
95 
96 #include "physxPlaneShape.I"
97 
98 #endif // PHYSXPLANESHAPE_H
Abstract base class for shapes.
Definition: physxShape.h:41
A plane collision detection primitive.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
Descriptor class for PhysxPlaneShape.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85