载入中...
搜索中...
未找到
eve::voxel::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. 更多...

#include <GreedyMesher.h>

静态 Public 成员函数

static void meshChunk (const uint8_t *voxels, std::vector< PackedRect > outFaces[6], const CubeTypeRegistry &types=CubeTypeRegistry::empty(), ChunkSampler sampler=nullptr, void *samplerUserData=nullptr, int chunkX=0, int chunkY=0, int chunkZ=0, std::vector< uint32_t > aoOut[6]=nullptr)
 Mesh all six faces. Clears and fills outFaces[6].
 
static void meshFace (const uint8_t *voxels, FaceDir dir, std::vector< PackedRect > &out, const CubeTypeRegistry &types=CubeTypeRegistry::empty(), ChunkSampler sampler=nullptr, void *samplerUserData=nullptr, int chunkX=0, int chunkY=0, int chunkZ=0, std::vector< uint32_t > *aoOut=nullptr)
 Mesh a single face direction into out (appended; caller may clear).
 

详细描述

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.

每个体素的类型 id 通过注册表解析为“各面纹理 id”后合并;输出 PackedRect.tex 始终是纹理 id(0..127),渲染端无需感知“类型”概念。 空注册表下 resolveFaceTex 退化为 id,行为与旧的“体素值 == 纹理 id”一致。

Emits packed rects into six face buffers (caller-provided). Out-of-chunk neighbors consult the optional ChunkSampler so shared faces between adjacent chunks are culled (no duplicate interior faces).

在文件 GreedyMesher.h33 行定义.

成员函数说明

◆ meshChunk()

void eve::voxel::GreedyMesher::meshChunk ( const uint8_t *  voxels,
std::vector< PackedRect outFaces[6],
const CubeTypeRegistry types = CubeTypeRegistry::empty(),
ChunkSampler  sampler = nullptr,
void *  samplerUserData = nullptr,
int  chunkX = 0,
int  chunkY = 0,
int  chunkZ = 0,
std::vector< uint32_t >  aoOut[6] = nullptr 
)
static

Mesh all six faces. Clears and fills outFaces[6].

在文件 GreedyMesher.cpp254 行定义.

引用了 eve::voxel::faceDirCount() , 以及 meshFace().

被这些函数引用 eve::voxel::Chunk::remesh().

◆ meshFace()

void eve::voxel::GreedyMesher::meshFace ( const uint8_t *  voxels,
FaceDir  dir,
std::vector< PackedRect > &  out,
const CubeTypeRegistry types = CubeTypeRegistry::empty(),
ChunkSampler  sampler = nullptr,
void *  samplerUserData = nullptr,
int  chunkX = 0,
int  chunkY = 0,
int  chunkZ = 0,
std::vector< uint32_t > *  aoOut = nullptr 
)
static

Mesh a single face direction into out (appended; caller may clear).

在文件 GreedyMesher.cpp160 行定义.

引用了 a, b, dir, eve::voxel::kChunkSize, eve::voxel::NegX, eve::voxel::NegY, eve::voxel::NegZ, eve::voxel::PosX, eve::voxel::PosY, eve::voxel::PosZ, eve::voxel::resolveFaceTex(), s, u, v, x, y , 以及 z.

被这些函数引用 meshChunk().


该类的文档由以下文件生成: