Panda3D
physxBoxShape.h
1 // Filename: physxBoxShape.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 PHYSXBOXSHAPE_H
16 #define PHYSXBOXSHAPE_H
17 
18 #include "pandabase.h"
19 #include "luse.h"
20 
21 #include "physxShape.h"
22 #include "physx_includes.h"
23 
24 class PhysxBoxShapeDesc;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : PhysxBoxShape
28 // Description : A box shaped collision detection primitive. Each
29 // shape is owned by the actor which it is attached
30 // to.
31 //
32 // An instance can be created by calling the
33 // createShape() method of the PhysxActor object that
34 // will own it, with a PhysxBoxShapeDesc object as the
35 // parameter, or by adding the shape descriptor to the
36 // PhysxActorDesc class before creating the actor.
37 //
38 // The shape is deleted by calling release() on the
39 // shape itself.
40 ////////////////////////////////////////////////////////////////////
41 class EXPCL_PANDAPHYSX PhysxBoxShape : public PhysxShape {
42 
43 PUBLISHED:
44  INLINE PhysxBoxShape();
45  INLINE ~PhysxBoxShape();
46 
47  void save_to_desc(PhysxBoxShapeDesc &shapeDesc) const;
48 
49  void set_dimensions(const LVector3f &dimensions);
50  LVector3f get_dimensions() const;
51 
52 ////////////////////////////////////////////////////////////////////
53 public:
54  INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
55 
56  void link(NxShape *shapePtr);
57  void unlink();
58 
59 private:
60  NxBoxShape *_ptr;
61 
62 ////////////////////////////////////////////////////////////////////
63 public:
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  PhysxShape::init_type();
69  register_type(_type_handle, "PhysxBoxShape",
70  PhysxShape::get_class_type());
71  }
72  virtual TypeHandle get_type() const {
73  return get_class_type();
74  }
75  virtual TypeHandle force_init_type() {
76  init_type();
77  return get_class_type();
78  }
79 
80 private:
81  static TypeHandle _type_handle;
82 };
83 
84 #include "physxBoxShape.I"
85 
86 #endif // PHYSXBOXSHAPE_H
Abstract base class for shapes.
Definition: physxShape.h:41
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
A box shaped collision detection primitive.
Definition: physxBoxShape.h:41
Descriptor class for PhysxBoxShape.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85