Panda3D
bulletShape.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 bulletShape.h
10  * @author enn0x
11  * @date 2010-01-23
12  */
13 
14 #ifndef __BULLET_SHAPE_H__
15 #define __BULLET_SHAPE_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 
22 #include "boundingSphere.h"
23 
24 /**
25  *
26  */
27 class EXPCL_PANDABULLET BulletShape : public TypedWritableReferenceCount {
28 protected:
29  INLINE BulletShape() {};
30 
31 PUBLISHED:
32  INLINE virtual ~BulletShape();
33 
34  bool is_polyhedral() const;
35  bool is_convex() const;
36  bool is_convex_2d() const;
37  bool is_concave() const;
38  bool is_infinite() const;
39  bool is_non_moving() const;
40  bool is_soft_body() const;
41 
42  void set_margin(PN_stdfloat margin);
43  const char *get_name() const;
44 
45  PN_stdfloat get_margin() const;
46 
47  BoundingSphere get_shape_bounds() const;
48 
49  MAKE_PROPERTY(polyhedral, is_polyhedral);
50  MAKE_PROPERTY(convex, is_convex);
51  MAKE_PROPERTY(convex_2d, is_convex_2d);
52  MAKE_PROPERTY(concave, is_concave);
53  MAKE_PROPERTY(infinite, is_infinite);
54  MAKE_PROPERTY(non_moving, is_non_moving);
55  MAKE_PROPERTY(soft_body, is_soft_body);
56  MAKE_PROPERTY(margin, get_margin, set_margin);
57  MAKE_PROPERTY(name, get_name);
58  MAKE_PROPERTY(shape_bounds, get_shape_bounds);
59 
60 public:
61  virtual btCollisionShape *ptr() const = 0;
62  LVecBase3 get_local_scale() const;
63  void set_local_scale(const LVecBase3 &scale);
64  void do_set_local_scale(const LVecBase3 &scale);
65 
66 public:
67  static TypeHandle get_class_type() {
68  return _type_handle;
69  }
70  static void init_type() {
71  TypedWritableReferenceCount::init_type();
72  register_type(_type_handle, "BulletShape",
73  TypedWritableReferenceCount::get_class_type());
74  }
75  virtual TypeHandle get_type() const {
76  return get_class_type();
77  }
78  virtual TypeHandle force_init_type() {
79  init_type();
80  return get_class_type();
81  }
82 
83 private:
84  static TypeHandle _type_handle;
85 };
86 
87 #include "bulletShape.I"
88 
89 #endif // __BULLET_SHAPE_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.
This defines a bounding sphere, consisting of a center and a radius.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
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.