Panda3D
bulletConstraint.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 bulletConstraint.h
10  * @author enn0x
11  * @date 2010-03-01
12  */
13 
14 #ifndef __BULLET_CONSTRAINT_H__
15 #define __BULLET_CONSTRAINT_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 
21 #include "typedReferenceCount.h"
22 
24 
25 /**
26  *
27  */
28 class EXPCL_PANDABULLET BulletConstraint : public TypedReferenceCount {
29 
30 PUBLISHED:
31  INLINE virtual ~BulletConstraint();
32 
33  BulletRigidBodyNode *get_rigid_body_a();
34  BulletRigidBodyNode *get_rigid_body_b();
35 
36  void enable_feedback(bool value);
37 
38  void set_debug_draw_size(PN_stdfloat size);
39  PN_stdfloat get_debug_draw_size();
40 
41  PN_stdfloat get_applied_impulse() const;
42  INLINE void set_breaking_threshold(PN_stdfloat threshold);
43  INLINE PN_stdfloat get_breaking_threshold() const;
44  INLINE void set_enabled(bool enabled);
45  INLINE bool is_enabled() const;
46 
47  enum ConstraintParam {
48  CP_erp = 1,
49  CP_stop_erp,
50  CP_cfm,
51  CP_stop_cfm
52  };
53 
54  void set_param(ConstraintParam num, PN_stdfloat value, int axis=-1);
55  PN_stdfloat get_param(ConstraintParam num, int axis=-1);
56 
57  MAKE_PROPERTY(rigid_body_a, get_rigid_body_a);
58  MAKE_PROPERTY(rigid_body_b, get_rigid_body_b);
59  MAKE_PROPERTY(debug_draw_size, get_debug_draw_size, set_debug_draw_size);
60  MAKE_PROPERTY(applied_impulse, get_applied_impulse);
61  MAKE_PROPERTY(breaking_threshold, get_breaking_threshold, set_breaking_threshold);
62  MAKE_PROPERTY(enabled, is_enabled, set_enabled);
63 
64 public:
65  virtual btTypedConstraint *ptr() const = 0;
66 
67 public:
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  TypedReferenceCount::init_type();
73  register_type(_type_handle, "BulletConstraint",
74  TypedReferenceCount::get_class_type());
75  }
76  virtual TypeHandle get_type() const {
77  return get_class_type();
78  }
79  virtual TypeHandle force_init_type() {
80  init_type();
81  return get_class_type();
82  }
83 
84 private:
85  static TypeHandle _type_handle;
86 };
87 
88 #include "bulletConstraint.I"
89 
90 #endif // __BULLET_CONSTRAINT_H__
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.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81