Panda3D
panda
src
physx
physxMeshHash.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 physxMeshHash.h
10
* @author enn0x
11
* @date 2010-09-13
12
*/
13
14
#ifndef PHYSXMESHHASH_H
15
#define PHYSXMESHHASH_H
16
17
#include "
config_physx.h
"
18
19
#include "
pvector.h
"
20
21
/**
22
* Utility class used in building links between a tetrahedron mesh (soft body)
23
* and a triangle mesh used for rendering the soft body.
24
*/
25
class
PhysxMeshHash
{
26
27
public
:
28
PhysxMeshHash
();
29
~
PhysxMeshHash
();
30
31
void
reset();
32
33
void
set_grid_spacing(
float
spacing);
34
INLINE NxF32 get_grid_spacing()
const
;
35
36
void
add(
const
NxBounds3 &bounds,
int
itemIndex);
37
void
add(
const
NxVec3 &pos,
int
itemIndex);
38
39
void
query(
const
NxBounds3 &bounds,
pvector<int>
&itemIndices,
int
maxIndices=-1);
40
void
query_unique(
const
NxBounds3 &bounds,
pvector<int>
&itemIndices,
int
maxIndices=-1);
41
42
void
query(
const
NxVec3 &pos,
pvector<int>
&itemIndices,
int
maxIndices=-1);
43
void
query_unique(
const
NxVec3 &pos,
pvector<int>
&itemIndices,
int
maxIndices=-1);
44
45
private
:
46
struct
MeshHashRoot {
47
int
first;
48
int
timeStamp;
49
};
50
51
struct
MeshHashEntry {
52
int
itemIndex;
53
int
next;
54
};
55
56
NxI32 _time;
57
NxF32 _spacing;
58
NxF32 _invSpacing;
59
60
static
const
int
_hashIndexSize = 17011;
61
MeshHashRoot _hashIndex[_hashIndexSize];
62
63
pvector<MeshHashEntry>
_entries;
64
65
INLINE
int
hash_function(
int
xi,
int
yi,
int
zi)
const
;
66
INLINE
void
cell_coord_of(
const
NxVec3 &v,
int
&xi,
int
&yi,
int
&zi)
const
;
67
68
void
compress_indices(
pvector<int>
&itemIndices);
69
void
quick_sort(
pvector<int>
&itemIndices,
int
l,
int
r);
70
71
};
72
73
#include "
physxMeshHash.I
"
74
75
#endif // PHYSXMESHHASH_H
PhysxMeshHash
Utility class used in building links between a tetrahedron mesh (soft body) and a triangle mesh used ...
Definition:
physxMeshHash.h:25
pvector< int >
pvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxMeshHash.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
config_physx.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Sun Dec 27 2020 13:23:13 for Panda3D by
1.8.20