Panda3D
Loading...
Searching...
No Matches
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 */
26
27public:
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
45private:
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
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
Utility class used in building links between a tetrahedron mesh (soft body) and a triangle mesh used ...
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.