Panda3D
bulletContactResult.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 bulletContactResult.h
10  * @author enn0x
11  * @date 2010-03-08
12  */
13 
14 #ifndef __BULLET_CONTACT_RESULT_H__
15 #define __BULLET_CONTACT_RESULT_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bulletManifoldPoint.h"
21 
22 #include "pvector.h"
23 
24 /**
25  *
26  */
27 struct EXPCL_PANDABULLET BulletContact {
28 
29 public:
30  BulletContact();
31  BulletContact(const BulletContact &other);
32 
33 PUBLISHED:
34  INLINE BulletManifoldPoint &get_manifold_point();
35  INLINE PandaNode *get_node0() const;
36  INLINE PandaNode *get_node1() const;
37  INLINE int get_idx0() const;
38  INLINE int get_idx1() const;
39  INLINE int get_part_id0() const;
40  INLINE int get_part_id1() const;
41 
42  MAKE_PROPERTY(manifold_point, get_manifold_point);
43  MAKE_PROPERTY(node0, get_node0);
44  MAKE_PROPERTY(node1, get_node1);
45  MAKE_PROPERTY(idx0, get_idx0);
46  MAKE_PROPERTY(idx1, get_idx1);
47  MAKE_PROPERTY(part_id0, get_part_id0);
48  MAKE_PROPERTY(part_id1, get_part_id1);
49 
50 private:
51  static btManifoldPoint _empty;
52 
54 
55  PT(PandaNode) _node0;
56  PT(PandaNode) _node1;
57 
58  int _part_id0;
59  int _part_id1;
60  int _idx0;
61  int _idx1;
62 
63  friend struct BulletContactResult;
64 };
65 
66 /**
67  *
68  */
69 struct EXPCL_PANDABULLET BulletContactResult : public btCollisionWorld::ContactResultCallback {
70 
71 PUBLISHED:
72  INLINE int get_num_contacts() const;
73  INLINE BulletContact get_contact(int idx);
74  MAKE_SEQ(get_contacts, get_num_contacts, get_contact);
75  MAKE_SEQ_PROPERTY(contacts, get_num_contacts, get_contact);
76 
77 public:
78 #if BT_BULLET_VERSION >= 281
79  virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
80 
81  virtual btScalar addSingleResult(btManifoldPoint &mp,
82  const btCollisionObjectWrapper *wrap0, int part_id0, int idx0,
83  const btCollisionObjectWrapper *wrap1, int part_id1, int idx1);
84 #else
85  virtual btScalar addSingleResult(btManifoldPoint &mp,
86  const btCollisionObject *obj0, int part_id0, int idx0,
87  const btCollisionObject *obj1, int part_id1, int idx1);
88 #endif
89 
90 protected:
92 
93 #if BT_BULLET_VERSION >= 281
94  void use_filter(btOverlapFilterCallback *cb, btBroadphaseProxy *proxy);
95 #endif
96 
97 private:
98  static BulletContact _empty;
99 
100  btAlignedObjectArray<BulletContact> _contacts;
101 
102 #if BT_BULLET_VERSION >= 281
103  bool _filter_set;
104  btOverlapFilterCallback *_filter_cb;
105  btBroadphaseProxy *_filter_proxy;
106 #endif
107 
108  friend class BulletWorld;
109 };
110 
111 #include "bulletContactResult.I"
112 
113 #endif // __BULLET_CONTACT_RESULT_H__
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.