8#include <unordered_map>
9#include <unordered_set>
28 void setCellSize(
float cellSize);
33 bool insert(
int id,
float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ);
37 bool update(
int id,
float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ);
39 bool contains(
int id)
const;
41 int getCount()
const {
return static_cast<int>(items_.size()); }
44 int queryPoint(
float x,
float y,
float z);
46 int queryAABB(
float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ);
48 int querySphere(
float cx,
float cy,
float cz,
float radius);
56 void cellRange(
const AABB3 &
b,
int &minCX,
int &minCY,
int &minCZ,
int &maxCX,
int &maxCY,
58 void insertCells(
int id,
const AABB3 &
b);
59 void eraseCells(
int id,
const AABB3 &
b);
60 void queryCells(
int minCX,
int minCY,
int minCZ,
int maxCX,
int maxCY,
int maxCZ,
61 const AABB3 *box,
float cx,
float cy,
float cz,
float radius,
bool useSphere,
64 float cellSize_ = 64.f;
65 std::unordered_map<int, AABB3> items_;
66 std::unordered_map<uint64_t, std::vector<int>> cells_;
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Last-query hit buffer shared by spatial indexes. Script pattern: call query* → getResultCount / getRe...
Uniform-grid spatial hash for 3D AABB / sphere queries.
SpatialHash3D & operator=(const SpatialHash3D &)=delete
int getCount() const
Number of stored ids.
SpatialHash3D(const SpatialHash3D &)=delete
int getResultId(int index) const
Hit id at dense index from the last query*, or -1.
float getCellSize() const
Current uniform cell size.
~SpatialHash3D()=default
Releases hash buckets.
int getResultCount() const
Number of hits from the last query*.
Axis-aligned 3D bounding box (min/max inclusive).