Binary space partition tree (kd-style AABB splits) for 3D culling. Alternating X/Y/Z splits at node midplanes. 更多...
#include <BSPTree3D.h>
Public 成员函数 | |
| BSPTree3D (float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int maxDepth=12, int maxPerNode=8) | |
| Creates a 3D BSP/kd tree covering the given bounds. | |
| ~BSPTree3D ()=default | |
| Releases tree nodes. | |
| BSPTree3D (const BSPTree3D &)=delete | |
| BSPTree3D & | operator= (const BSPTree3D &)=delete |
| void | clear () |
| Removes all stored entries. | |
| bool | insert (int id, float minX, float minY, float minZ, float maxX, float maxY, float maxZ) |
| Inserts an item AABB; false if out of bounds or id already present. | |
| bool | remove (int id) |
| Removes an item by id; false if unknown. | |
| bool | update (int id, float minX, float minY, float minZ, float maxX, float maxY, float maxZ) |
| Moves an existing item to a new AABB; false if unknown or out of bounds. | |
| bool | contains (int id) const |
| True if the id is currently stored. | |
| int | getCount () const |
| Number of stored ids. | |
| int | queryPoint (float x, float y, float z) |
| Finds items overlapping a point; fills the result buffer. | |
| int | queryAABB (float minX, float minY, float minZ, float maxX, float maxY, float maxZ) |
| Finds items overlapping an AABB; fills the result buffer. | |
| int | querySphere (float cx, float cy, float cz, float radius) |
| Finds items overlapping a sphere; fills the result buffer. | |
| int | getResultCount () const |
| Number of hits from the last query*. | |
| int | getResultId (int index) const |
| Hit id at dense index from the last query*, or -1. | |
| float | getMinX () const |
| Root/world minimum X. | |
| float | getMinY () const |
| Root/world minimum Y. | |
| float | getMinZ () const |
| Root/world minimum Z. | |
| float | getMaxX () const |
| Root/world maximum X. | |
| float | getMaxY () const |
| Root/world maximum Y. | |
| float | getMaxZ () const |
| Root/world maximum Z. | |
| int | getMaxDepth () const |
| Maximum subdivision depth. | |
| int | getMaxPerNode () const |
| Item capacity before a node splits. | |
详细描述
Binary space partition tree (kd-style AABB splits) for 3D culling. Alternating X/Y/Z splits at node midplanes.
在文件 BSPTree3D.h 第 18 行定义.
构造及析构函数说明
◆ BSPTree3D() [1/2]
| eve::spatial::BSPTree3D::BSPTree3D | ( | float | minX, |
| float | minY, | ||
| float | minZ, | ||
| float | maxX, | ||
| float | maxY, | ||
| float | maxZ, | ||
| int | maxDepth = 12, |
||
| int | maxPerNode = 8 |
||
| ) |
Creates a 3D BSP/kd tree covering the given bounds.
在文件 BSPTree3D.cpp 第 7 行定义.
引用了 eve::spatial::AABB3::depth(), eve::spatial::AABB3::height(), eve::spatial::AABB3::valid() , 以及 eve::spatial::AABB3::width().
◆ ~BSPTree3D()
|
default |
Releases tree nodes.
◆ BSPTree3D() [2/2]
|
delete |
成员函数说明
◆ clear()
| void eve::spatial::BSPTree3D::clear | ( | ) |
◆ contains()
| bool eve::spatial::BSPTree3D::contains | ( | int | id | ) | const |
True if the id is currently stored.
在文件 BSPTree3D.cpp 第 36 行定义.
◆ getCount()
|
inline |
Number of stored ids.
在文件 BSPTree3D.h 第 40 行定义.
◆ getMaxDepth()
|
inline |
Maximum subdivision depth.
在文件 BSPTree3D.h 第 67 行定义.
◆ getMaxPerNode()
|
inline |
Item capacity before a node splits.
在文件 BSPTree3D.h 第 69 行定义.
◆ getMaxX()
|
inline |
Root/world maximum X.
在文件 BSPTree3D.h 第 61 行定义.
◆ getMaxY()
|
inline |
Root/world maximum Y.
在文件 BSPTree3D.h 第 63 行定义.
◆ getMaxZ()
|
inline |
Root/world maximum Z.
在文件 BSPTree3D.h 第 65 行定义.
◆ getMinX()
|
inline |
Root/world minimum X.
在文件 BSPTree3D.h 第 55 行定义.
◆ getMinY()
|
inline |
Root/world minimum Y.
在文件 BSPTree3D.h 第 57 行定义.
◆ getMinZ()
|
inline |
Root/world minimum Z.
在文件 BSPTree3D.h 第 59 行定义.
◆ getResultCount()
|
inline |
Number of hits from the last query*.
在文件 BSPTree3D.h 第 50 行定义.
◆ getResultId()
|
inline |
◆ insert()
| bool eve::spatial::BSPTree3D::insert | ( | int | id, |
| float | minX, | ||
| float | minY, | ||
| float | minZ, | ||
| float | maxX, | ||
| float | maxY, | ||
| float | maxZ | ||
| ) |
Inserts an item AABB; false if out of bounds or id already present.
在文件 BSPTree3D.cpp 第 38 行定义.
引用了 b, contains(), id, eve::spatial::makeAABB3() , 以及 remove().
被这些函数引用 update().
◆ operator=()
◆ queryAABB()
| int eve::spatial::BSPTree3D::queryAABB | ( | float | minX, |
| float | minY, | ||
| float | minZ, | ||
| float | maxX, | ||
| float | maxY, | ||
| float | maxZ | ||
| ) |
Finds items overlapping an AABB; fills the result buffer.
- 返回
- Hit count.
在文件 BSPTree3D.cpp 第 200 行定义.
引用了 eve::spatial::QueryIds::clear(), eve::spatial::QueryIds::getCount() , 以及 eve::spatial::makeAABB3().
◆ queryPoint()
| int eve::spatial::BSPTree3D::queryPoint | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Finds items overlapping a point; fills the result buffer.
- 返回
- Hit count.
在文件 BSPTree3D.cpp 第 194 行定义.
引用了 eve::spatial::QueryIds::clear(), eve::spatial::QueryIds::getCount(), x, y , 以及 z.
◆ querySphere()
| int eve::spatial::BSPTree3D::querySphere | ( | float | cx, |
| float | cy, | ||
| float | cz, | ||
| float | radius | ||
| ) |
Finds items overlapping a sphere; fills the result buffer.
- 返回
- Hit count.
在文件 BSPTree3D.cpp 第 207 行定义.
引用了 eve::spatial::QueryIds::clear(), cx, cy, eve::spatial::QueryIds::getCount() , 以及 radius.
◆ remove()
| bool eve::spatial::BSPTree3D::remove | ( | int | id | ) |
Removes an item by id; false if unknown.
在文件 BSPTree3D.cpp 第 50 行定义.
引用了 contains().
被这些函数引用 insert().
◆ update()
| bool eve::spatial::BSPTree3D::update | ( | int | id, |
| float | minX, | ||
| float | minY, | ||
| float | minZ, | ||
| float | maxX, | ||
| float | maxY, | ||
| float | maxZ | ||
| ) |
Moves an existing item to a new AABB; false if unknown or out of bounds.
在文件 BSPTree3D.cpp 第 57 行定义.
引用了 contains() , 以及 insert().
该类的文档由以下文件生成:
- src/modules/spatial/BSPTree3D.h
- src/modules/spatial/BSPTree3D.cpp