Panda3D

Loading...
Searching...
No Matches
bulletAllHitsRayResult.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 bulletAllHitsRayResult.h
10 * @author enn0x
11 * @date 2010-02-21
12 */
13
14#ifndef __BULLET_ALL_HITS_RAY_RESULT_H__
15#define __BULLET_ALL_HITS_RAY_RESULT_H__
16
17#include "pandabase.h"
18
19#include "bullet_includes.h"
20#include "bullet_utils.h"
21
22#include "luse.h"
23#include "pandaNode.h"
24#include "collideMask.h"
25
26/**
27 *
28 */
29 struct EXPCL_PANDABULLET BulletRayHit {
30
31PUBLISHED:
32 INLINE static BulletRayHit empty();
33
34 PandaNode *get_node() const;
35 LPoint3 get_hit_pos() const;
36 LVector3 get_hit_normal() const;
37 PN_stdfloat get_hit_fraction() const;
38
39 int get_shape_part() const;
40 int get_triangle_index() const;
41
42 MAKE_PROPERTY(node, get_node);
43 MAKE_PROPERTY(hit_pos, get_hit_pos);
44 MAKE_PROPERTY(hit_normal, get_hit_normal);
45 MAKE_PROPERTY(hit_fraction, get_hit_fraction);
46 MAKE_PROPERTY(shape_part, get_shape_part);
47 MAKE_PROPERTY(triangle_index, get_triangle_index);
48
49 private:
50 const btCollisionObject *_object;
51 btVector3 _normal;
52 btVector3 _pos;
53 btScalar _fraction;
54
55 int _shapePart;
56 int _triangleIndex;
57
58 friend struct BulletAllHitsRayResult;
59};
60
61/**
62 *
63 */
64 struct EXPCL_PANDABULLET BulletAllHitsRayResult : public btCollisionWorld::AllHitsRayResultCallback {
65
66PUBLISHED:
67 INLINE static BulletAllHitsRayResult empty();
68
69 LPoint3 get_from_pos() const;
70 LPoint3 get_to_pos() const;
71
72 bool has_hits() const;
73 PN_stdfloat get_closest_hit_fraction() const;
74
75 int get_num_hits() const;
76 const BulletRayHit get_hit(int idx) const;
77 MAKE_SEQ(get_hits, get_num_hits, get_hit);
78
79 MAKE_PROPERTY(from_pos, get_from_pos);
80 MAKE_PROPERTY(to_pos, get_to_pos);
81 MAKE_PROPERTY(closest_hit_fraction, get_closest_hit_fraction);
82 MAKE_SEQ_PROPERTY(hits, get_num_hits, get_hit);
83
84 public:
85 virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
86 virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);
87
88 private:
89 BulletAllHitsRayResult(const btVector3 &from_pos, const btVector3 &to_pos, const CollideMask &mask);
90
91 CollideMask _mask;
92
93 btAlignedObjectArray<int> _shapePart;
94 btAlignedObjectArray<int> _triangleIndex;
95
96 friend class BulletWorld;
97};
98
99#include "bulletAllHitsRayResult.I"
100
101#endif // __BULLET_ALL_HITS_RAY_RESULT_H__
bulletAllHitsRayResult.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_utils.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
collideMask.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletAllHitsRayResult::empty
static BulletAllHitsRayResult empty()
Named constructor intended to be used for asserts with have to return a concrete value.
Definition bulletAllHitsRayResult.I:19
BulletAllHitsRayResult::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Override default implementation.
Definition bulletAllHitsRayResult.cxx:29
BulletAllHitsRayResult::addSingleResult
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
Override default implementation.
Definition bulletAllHitsRayResult.cxx:42
BulletRayHit
Definition bulletAllHitsRayResult.h:29
BulletRayHit::empty
static BulletRayHit empty()
Named constructor intended to be used for asserts with have to return a concrete value.
Definition bulletAllHitsRayResult.I:29