Panda3D
physxBoxShape.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxBoxShape.h
10  * @author enn0x
11  * @date 2009-09-16
12  */
13 
14 #ifndef PHYSXBOXSHAPE_H
15 #define PHYSXBOXSHAPE_H
16 
17 #include "pandabase.h"
18 #include "luse.h"
19 
20 #include "physxShape.h"
21 #include "physx_includes.h"
22 
23 class PhysxBoxShapeDesc;
24 
25 /**
26  * A box shaped collision detection primitive. Each shape is owned by the
27  * actor which it is attached to.
28  *
29  * An instance can be created by calling the createShape() method of the
30  * PhysxActor object that will own it, with a PhysxBoxShapeDesc object as the
31  * parameter, or by adding the shape descriptor to the PhysxActorDesc class
32  * before creating the actor.
33  *
34  * The shape is deleted by calling release() on the shape itself.
35  */
36 class EXPCL_PANDAPHYSX PhysxBoxShape : public PhysxShape {
37 
38 PUBLISHED:
39  INLINE PhysxBoxShape();
40  INLINE ~PhysxBoxShape();
41 
42  void save_to_desc(PhysxBoxShapeDesc &shapeDesc) const;
43 
44  void set_dimensions(const LVector3f &dimensions);
45  LVector3f get_dimensions() const;
46 
47 public:
48  INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
49 
50  void link(NxShape *shapePtr);
51  void unlink();
52 
53 private:
54  NxBoxShape *_ptr;
55 
56 public:
57  static TypeHandle get_class_type() {
58  return _type_handle;
59  }
60  static void init_type() {
61  PhysxShape::init_type();
62  register_type(_type_handle, "PhysxBoxShape",
63  PhysxShape::get_class_type());
64  }
65  virtual TypeHandle get_type() const {
66  return get_class_type();
67  }
68  virtual TypeHandle force_init_type() {
69  init_type();
70  return get_class_type();
71  }
72 
73 private:
74  static TypeHandle _type_handle;
75 };
76 
77 #include "physxBoxShape.I"
78 
79 #endif // PHYSXBOXSHAPE_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Abstract base class for shapes.
Definition: physxShape.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A box shaped collision detection primitive.
Definition: physxBoxShape.h:36
Descriptor class for PhysxBoxShape.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81