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