方块类型定义:名字、各面图集纹理、方向性、组合声明。 方向性方块在注册时按 orientation 绕 Y 轴展开成多个"具体类型"变体, 每个变体持有旋转后的各面纹理;渲染端只消费纹理 id,不接触 orientation。 更多...
类 | |
| class | Chunk |
| One 32³ voxel chunk with six direction-sorted packed-rect instance buffers. Coordinates: chunk (cx,cy,cz) → world origin (cx*32, cy*32, cz*32). 更多... | |
| struct | CubeType |
| class | CubeTypeRegistry |
| struct | DecodedRect |
| One decoded face rectangle in world space (mirrors voxel_rect.vert). 更多... | |
| struct | DrawBatch |
| One draw batch: all packed rects of one face direction for one chunk. 更多... | |
| struct | Frustum |
| Six frustum planes in ax+by+cz+d >= 0 form (normals point inward). 更多... | |
| class | GreedyMesher |
| Greedy rectangle mesher for one 32³ dense voxel volume. Voxel storage: index = x + y*32 + z*32*32. Value 0 = air; 1..255 = type id. 更多... | |
| struct | PackedRect |
| Packed face-rectangle instance (exactly 32 bits): bits 0..4 : x (0..31) bits 5..9 : y (0..31) bits 10..14 : z (0..31) bits 15..19 : width - 1 (0..31 → size 1..32) bits 20..24 : height - 1 (0..31 → size 1..32) bits 25..31 : texture index (0..127) 更多... | |
| struct | StreamStats |
| Result of a streaming pass. 更多... | |
| class | Voxel |
| High-performance voxel rendering module. 更多... | |
| class | VoxelWorld |
| Sparse chunk map + visibility selection (frustum + distance + face orientation). Meshing is neighbor-aware (cross-chunk seam culling), parallel-capable and script-friendly via getVisible getters and raycast helpers. 更多... | |
类型定义 | |
| using | ChunkSampler = uint8_t(*)(void *userData, int chunkX, int chunkY, int chunkZ, int localX, int localY, int localZ) |
| Optional out-of-chunk neighbor sampler for seam culling. Receives chunk coordinates plus the (possibly out-of-range) local voxel coords and returns the voxel id there (0 = air / unknown). Null sampler → out-of-chunk neighbors are treated as air (old behavior). | |
枚举 | |
| enum class | FaceDir : uint8_t { PosX = 0 , NegX = 1 , PosY = 2 , NegY = 3 , PosZ = 4 , NegZ = 5 , Count = 6 } |
| Six axis-aligned face directions. Each chunk keeps a separate instance buffer per direction so camera-facing sides can be culled / batched independently. 更多... | |
函数 | |
| uint8_t | resolveFaceTex (const CubeTypeRegistry &types, uint8_t id, FaceDir dir) |
| 求某个体素在某面方向上的实际图集纹理 id。 未注册的 id 退化为“所有面 = 原 id”(向后兼容:体素值即纹理 id)。 | |
| constexpr int | faceDirCount () |
| const char * | faceDirName (FaceDir d) |
| bool | faceDirFromName (const std::string &name, FaceDir &out) |
| FaceDir | rotateFaceY (FaceDir dir, int quarterTurns) |
绕 Y 轴旋转一个面方向 quarterTurns 个 90°(右手定则:+X → -Z → -X → +Z)。 仅影响 4 个水平面(±X/±Z),±Y 顶/底保持不变。 供方向性方块在注册各面纹理时旋转使用。 | |
| void | faceNormal (FaceDir d, float &nx, float &ny, float &nz) |
| Outward unit normal for the face. | |
| Module_IMPL (Voxel, new Voxel()) | |
| DecodedRect | decodePackedRect (PackedRect rect, FaceDir dir, float originX, float originY, float originZ, int tilesPerRow=16, uint32_t aoWord=0xFFu) |
| CPU mirror of the instanced voxel vertex shader placement / UV logic. Used by unit tests to validate packing ↔ geometry without a GPU. | |
| bool | decodedWindingMatchesNormal (const DecodedRect &q) |
| True when triangle (0,2,1) winding matches outward normal (matches GPU index order). | |
| bool | decodedSecondTriangleMatchesNormal (const DecodedRect &q) |
| True when the second GPU triangle (0,3,2) also matches the outward normal. | |
变量 | |
| constexpr int | kChunkSize = 32 |
| Chunk edge length in voxels (fixed). | |
详细描述
方块类型定义:名字、各面图集纹理、方向性、组合声明。 方向性方块在注册时按 orientation 绕 Y 轴展开成多个"具体类型"变体, 每个变体持有旋转后的各面纹理;渲染端只消费纹理 id,不接触 orientation。
类型定义说明
◆ ChunkSampler
| using eve::voxel::ChunkSampler = typedef uint8_t (*)(void *userData, int chunkX, int chunkY, int chunkZ, int localX, int localY, int localZ) |
Optional out-of-chunk neighbor sampler for seam culling. Receives chunk coordinates plus the (possibly out-of-range) local voxel coords and returns the voxel id there (0 = air / unknown). Null sampler → out-of-chunk neighbors are treated as air (old behavior).
在文件 GreedyMesher.h 第 18 行定义.
枚举类型说明
◆ FaceDir
|
strong |
Six axis-aligned face directions. Each chunk keeps a separate instance buffer per direction so camera-facing sides can be culled / batched independently.
Tangent axes for packed width/height: ±X : width along Z, height along Y ±Y : width along X, height along Z ±Z : width along X, height along Y
| 枚举值 | |
|---|---|
| PosX | |
| NegX | |
| PosY | |
| NegY | |
| PosZ | |
| NegZ | |
| Count | |
函数说明
◆ decodedSecondTriangleMatchesNormal()
|
inline |
True when the second GPU triangle (0,3,2) also matches the outward normal.
在文件 VoxelRectDecode.h 第 116 行定义.
引用了 eve::voxel::DecodedRect::corners, cx, cy , 以及 eve::voxel::DecodedRect::normal.
◆ decodedWindingMatchesNormal()
|
inline |
True when triangle (0,2,1) winding matches outward normal (matches GPU index order).
在文件 VoxelRectDecode.h 第 101 行定义.
引用了 eve::voxel::DecodedRect::corners, cx, cy , 以及 eve::voxel::DecodedRect::normal.
◆ decodePackedRect()
|
inline |
CPU mirror of the instanced voxel vertex shader placement / UV logic. Used by unit tests to validate packing ↔ geometry without a GPU.
在文件 VoxelRectDecode.h 第 23 行定义.
引用了 eve::voxel::DecodedRect::ao, eve::voxel::DecodedRect::corners, dir, h, eve::voxel::PackedRect::height(), eve::voxel::DecodedRect::height, NegX, NegY, NegZ, eve::voxel::DecodedRect::normal, PosX, PosY, PosZ, eve::voxel::PackedRect::tex(), eve::voxel::DecodedRect::tex, tiles, eve::voxel::DecodedRect::uv, w, eve::voxel::PackedRect::width(), eve::voxel::DecodedRect::width, x, eve::voxel::PackedRect::x(), y, eve::voxel::PackedRect::y(), z , 以及 eve::voxel::PackedRect::z().
◆ faceDirCount()
|
inlineconstexpr |
◆ faceDirFromName()
|
inline |
◆ faceDirName()
|
inline |
◆ faceNormal()
|
inline |
◆ Module_IMPL()
| eve::voxel::Module_IMPL | ( | Voxel | , |
| new | Voxel() | ||
| ) |
◆ resolveFaceTex()
|
inline |
求某个体素在某面方向上的实际图集纹理 id。 未注册的 id 退化为“所有面 = 原 id”(向后兼容:体素值即纹理 id)。
在文件 CubeTypeRegistry.h 第 66 行定义.
引用了 dir, eve::voxel::CubeType::faceTex, eve::voxel::CubeTypeRegistry::find() , 以及 id.
被这些函数引用 eve::voxel::VoxelWorld::getCubeTypeTex() , 以及 eve::voxel::GreedyMesher::meshFace().
◆ rotateFaceY()
变量说明
◆ kChunkSize
|
constexpr |
Chunk edge length in voxels (fixed).
在文件 VoxelPack.h 第 8 行定义.
被这些函数引用 eve::voxel::VoxelWorld::deserializeWorld(), eve::voxel::Chunk::get(), eve::voxel::Voxel::getChunkSize(), eve::voxel::VoxelWorld::getVoxel(), eve::voxel::GreedyMesher::meshFace(), eve::voxel::Chunk::originX(), eve::voxel::Chunk::originY(), eve::voxel::Chunk::originZ(), eve::voxel::VoxelWorld::serializeWorld(), eve::voxel::Chunk::set(), eve::voxel::VoxelWorld::setVoxel(), eve::voxel::VoxelWorld::streamAround() , 以及 eve::voxel::Chunk::worldAABB().