Panda3D
panda
src
physx
physxRaycastReport.cxx
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 physxRaycastReport.cxx
10
* @author enn0x
11
* @date 2009-10-21
12
*/
13
14
#include "
physxRaycastReport.h
"
15
#include "
physxRaycastHit.h
"
16
17
/**
18
*
19
*/
20
bool
PhysxRaycastReport::
21
onHit(
const
NxRaycastHit& hit) {
22
23
_hits.push_back(
PhysxRaycastHit
(hit));
24
return
true
;
25
}
26
27
/**
28
*
29
*/
30
unsigned
int
PhysxRaycastReport::
31
get_num_hits()
const
{
32
33
return
_hits.size();
34
}
35
36
/**
37
*
38
*/
39
PhysxRaycastHit
PhysxRaycastReport::
40
get_first_hit() {
41
42
_iterator = _hits.begin();
43
return
get_next_hit();
44
}
45
46
/**
47
*
48
*/
49
PhysxRaycastHit
PhysxRaycastReport::
50
get_next_hit() {
51
52
if
(_iterator != _hits.end()) {
53
return
*_iterator++;
54
}
55
56
// No more items. Return an empty hit.
57
NxRaycastHit hit;
58
hit.shape =
nullptr
;
59
return
PhysxRaycastHit
(hit);
60
}
61
62
/**
63
*
64
*/
65
PhysxRaycastHit
PhysxRaycastReport::
66
get_hit(
unsigned
int
idx) {
67
68
if
(!(idx < _hits.size()))
69
{
70
// Index out of bounds. Return an empty hit.
71
NxRaycastHit hit;
72
hit.shape =
nullptr
;
73
return
PhysxRaycastHit
(hit);
74
}
75
76
return
_hits[idx];
77
}
physxRaycastHit.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxRaycastReport.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PhysxRaycastHit
This structure captures results for a single raycast query.
Definition:
physxRaycastHit.h:28
Generated on Mon Sep 14 2020 15:07:04 for Panda3D by
1.8.20