Panda3D
physxSphereShape.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 physxSphereShape.h
10  * @author enn0x
11  * @date 2009-09-16
12  */
13 
14 #ifndef PHYSXSPHERESHAPE_H
15 #define PHYSXSPHERESHAPE_H
16 
17 #include "pandabase.h"
18 #include "luse.h"
19 
20 #include "physxShape.h"
21 #include "physx_includes.h"
22 
24 
25 /**
26  * A sphere shaped collision detection primitive. Each shape is owned by an
27  * actor that it is attached to.
28  *
29  * An instance can be created by calling the createShape() method of the
30  * PhysxActor object that should own it, with a PhysxSphereShapeDesc object as
31  * the parameter, or by adding the shape descriptor into the PhysxActorDesc
32  * class before creating the actor.
33  *
34  * The shape is deleted by calling release() on the shape itself.
35  */
36 class EXPCL_PANDAPHYSX PhysxSphereShape : public PhysxShape {
37 
38 PUBLISHED:
39  INLINE PhysxSphereShape();
40  INLINE ~PhysxSphereShape();
41 
42  void save_to_desc(PhysxSphereShapeDesc &shapeDesc) const;
43 
44  void set_radius(float radius);
45 
46  float get_radius() const;
47 
48 public:
49  INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
50 
51  void link(NxShape *shapePtr);
52  void unlink();
53 
54 private:
55  NxSphereShape *_ptr;
56 
57 public:
58  static TypeHandle get_class_type() {
59  return _type_handle;
60  }
61  static void init_type() {
62  PhysxShape::init_type();
63  register_type(_type_handle, "PhysxSphereShape",
64  PhysxShape::get_class_type());
65  }
66  virtual TypeHandle get_type() const {
67  return get_class_type();
68  }
69  virtual TypeHandle force_init_type() {
70  init_type();
71  return get_class_type();
72  }
73 
74 private:
75  static TypeHandle _type_handle;
76 };
77 
78 #include "physxSphereShape.I"
79 
80 #endif // PHYSXSPHERESHAPE_H
Descriptor class for PhysxSphereShape.
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
A sphere shaped collision detection primitive.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81