载入中...
搜索中...
未找到
eve::voxel 命名空间参考

方块类型定义:名字、各面图集纹理、方向性、组合声明。 方向性方块在注册时按 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.h18 行定义.

枚举类型说明

◆ FaceDir

enum class eve::voxel::FaceDir : uint8_t
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 

在文件 FaceDir.h17 行定义.

函数说明

◆ decodedSecondTriangleMatchesNormal()

bool eve::voxel::decodedSecondTriangleMatchesNormal ( const DecodedRect q)
inline

True when the second GPU triangle (0,3,2) also matches the outward normal.

在文件 VoxelRectDecode.h116 行定义.

引用了 eve::voxel::DecodedRect::corners, cx, cy , 以及 eve::voxel::DecodedRect::normal.

◆ decodedWindingMatchesNormal()

bool eve::voxel::decodedWindingMatchesNormal ( const DecodedRect q)
inline

True when triangle (0,2,1) winding matches outward normal (matches GPU index order).

在文件 VoxelRectDecode.h101 行定义.

引用了 eve::voxel::DecodedRect::corners, cx, cy , 以及 eve::voxel::DecodedRect::normal.

◆ decodePackedRect()

DecodedRect eve::voxel::decodePackedRect ( PackedRect  rect,
FaceDir  dir,
float  originX,
float  originY,
float  originZ,
int  tilesPerRow = 16,
uint32_t  aoWord = 0xFFu 
)
inline

◆ faceDirCount()

constexpr int eve::voxel::faceDirCount ( )
inlineconstexpr

◆ faceDirFromName()

bool eve::voxel::faceDirFromName ( const std::string &  name,
FaceDir out 
)
inline

在文件 FaceDir.h41 行定义.

引用了 name, NegX, NegY, NegZ, PosX, PosY , 以及 PosZ.

被这些函数引用 eve::voxel::VoxelWorld::getCubeTypeTex().

◆ faceDirName()

const char * eve::voxel::faceDirName ( FaceDir  d)
inline

在文件 FaceDir.h29 行定义.

引用了 d, NegX, NegY, NegZ, PosX, PosY , 以及 PosZ.

被这些函数引用 eve::voxel::VoxelWorld::drawVisible().

◆ faceNormal()

void eve::voxel::faceNormal ( FaceDir  d,
float &  nx,
float &  ny,
float &  nz 
)
inline

Outward unit normal for the face.

在文件 FaceDir.h85 行定义.

引用了 d, NegX, NegY, NegZ, PosX, PosY , 以及 PosZ.

被这些函数引用 eve::voxel::VoxelWorld::selectVisible().

◆ Module_IMPL()

eve::voxel::Module_IMPL ( Voxel  ,
new   Voxel() 
)

◆ resolveFaceTex()

uint8_t eve::voxel::resolveFaceTex ( const CubeTypeRegistry types,
uint8_t  id,
FaceDir  dir 
)
inline

求某个体素在某面方向上的实际图集纹理 id。 未注册的 id 退化为“所有面 = 原 id”(向后兼容:体素值即纹理 id)。

在文件 CubeTypeRegistry.h66 行定义.

引用了 dir, eve::voxel::CubeType::faceTex, eve::voxel::CubeTypeRegistry::find() , 以及 id.

被这些函数引用 eve::voxel::VoxelWorld::getCubeTypeTex() , 以及 eve::voxel::GreedyMesher::meshFace().

◆ rotateFaceY()

FaceDir eve::voxel::rotateFaceY ( FaceDir  dir,
int  quarterTurns 
)
inline

绕 Y 轴旋转一个面方向 quarterTurns 个 90°(右手定则:+X → -Z → -X → +Z)。 仅影响 4 个水平面(±X/±Z),±Y 顶/底保持不变。 供方向性方块在注册各面纹理时旋转使用。

在文件 FaceDir.h74 行定义.

引用了 dir, NegX, NegY, NegZ, PosX, PosY , 以及 PosZ.

变量说明

◆ kChunkSize