Panda3D
 All Classes Functions Variables Enumerations
bulletAllHitsRayResult.h
1 // Filename: bulletAllHitsRayResult.h
2 // Created by: enn0x (21Feb10)
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_ALL_HITS_RAY_RESULT_H__
16 #define __BULLET_ALL_HITS_RAY_RESULT_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 #include "bullet_utils.h"
22 
23 #include "luse.h"
24 #include "pandaNode.h"
25 #include "collideMask.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : BulletRayHit
29 // Description :
30 ////////////////////////////////////////////////////////////////////
31 struct EXPCL_PANDABULLET BulletRayHit {
32 
33 PUBLISHED:
34  INLINE static BulletRayHit empty();
35 
36  const PandaNode *get_node() const;
37  LPoint3 get_hit_pos() const;
38  LVector3 get_hit_normal() const;
39  PN_stdfloat get_hit_fraction() const;
40 
41  int get_shape_part() const;
42  int get_triangle_index() const;
43 
44 private:
45  const btCollisionObject *_object;
46  btVector3 _normal;
47  btVector3 _pos;
48  btScalar _fraction;
49 
50  int _shapePart;
51  int _triangleIndex;
52 
53  friend struct BulletAllHitsRayResult;
54 };
55 
56 ////////////////////////////////////////////////////////////////////
57 // Class : BulletAllHitsRayResult
58 // Description :
59 ////////////////////////////////////////////////////////////////////
60 struct EXPCL_PANDABULLET BulletAllHitsRayResult : public btCollisionWorld::AllHitsRayResultCallback {
61 
62 PUBLISHED:
63  INLINE static BulletAllHitsRayResult empty();
64 
65  LPoint3 get_from_pos() const;
66  LPoint3 get_to_pos() const;
67 
68  bool has_hits() const;
69  PN_stdfloat get_closest_hit_fraction() const;
70 
71  int get_num_hits() const;
72  const BulletRayHit get_hit(int idx) const;
73  MAKE_SEQ(get_hits, get_num_hits, get_hit);
74 
75 public:
76  virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
77  virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);
78 
79 private:
80  BulletAllHitsRayResult(const btVector3 &from_pos, const btVector3 &to_pos, const CollideMask &mask);
81 
82  CollideMask _mask;
83 
84  btAlignedObjectArray<int> _shapePart;
85  btAlignedObjectArray<int> _triangleIndex;
86 
87  friend class BulletWorld;
88 };
89 
90 #include "bulletAllHitsRayResult.I"
91 
92 #endif // __BULLET_ALL_HITS_RAY_RESULT_H__
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99