Panda3D
 All Classes Functions Variables Enumerations
bulletConstraint.h
1 // Filename: bulletConstraint.h
2 // Created by: enn0x (01Mar10)
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 __BULLET_CONSTRAINT_H__
16 #define __BULLET_CONSTRAINT_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 
22 #include "typedReferenceCount.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : BulletConstraint
28 // Description :
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDABULLET BulletConstraint : public TypedReferenceCount {
31 
32 PUBLISHED:
33  INLINE virtual ~BulletConstraint();
34 
35  BulletRigidBodyNode *get_rigid_body_a();
36  BulletRigidBodyNode *get_rigid_body_b();
37 
38  void enable_feedback(bool value);
39  void set_debug_draw_size(PN_stdfloat size);
40 
41  PN_stdfloat get_applied_impulse() const;
42  PN_stdfloat get_debug_draw_size();
43 
44  INLINE void set_breaking_threshold(PN_stdfloat threshold);
45  INLINE PN_stdfloat set_breaking_threshold() const;
46  INLINE void set_enabled(bool enabled);
47  INLINE bool is_enabled() const;
48 
49  enum ConstraintParam {
50  CP_erp = 1,
51  CP_stop_erp,
52  CP_cfm,
53  CP_stop_cfm
54  };
55 
56  void set_param(ConstraintParam num, PN_stdfloat value, int axis=-1);
57  PN_stdfloat get_param(ConstraintParam num, int axis=-1);
58 
59 public:
60  virtual btTypedConstraint *ptr() const = 0;
61 
62 ////////////////////////////////////////////////////////////////////
63 public:
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  TypedReferenceCount::init_type();
69  register_type(_type_handle, "BulletConstraint",
70  TypedReferenceCount::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 "bulletConstraint.I"
85 
86 #endif // __BULLET_CONSTRAINT_H__
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85