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

#include <Chunk.h>

Public 成员函数

 Chunk (int cx=0, int cy=0, int cz=0)
 
int cx () const
 
int cy () const
 
int cz () const
 
float originX () const
 
float originY () const
 
float originZ () const
 
void worldAABB (float &minX, float &minY, float &minZ, float &maxX, float &maxY, float &maxZ) const
 
uint8_t get (int x, int y, int z) const
 
void set (int x, int y, int z, uint8_t texId)
 
void fill (uint8_t texId)
 
void clear ()
 
void setVoxelData (const uint8_t *src)
 
bool isDirty () const
 
void markDirty ()
 
void remesh (const CubeTypeRegistry &types=CubeTypeRegistry::empty(), ChunkSampler sampler=nullptr, void *samplerUserData=nullptr)
 Rebuild six face instance buffers via greedy meshing.
 
void ensureMeshed (const CubeTypeRegistry &types=CubeTypeRegistry::empty(), ChunkSampler sampler=nullptr, void *samplerUserData=nullptr)
 Ensure mesh is up to date; remesh if dirty.
 
const std::vector< PackedRect > & faceRects (FaceDir dir) const
 
int faceRectCount (FaceDir dir) const
 
const uint32_t * facePackedData (FaceDir dir) const
 
const uint32_t * faceAOPackedData (FaceDir dir) const
 
int totalRectCount () const
 
const uint8_t * rawVoxels () const
 

详细描述

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).

在文件 Chunk.h18 行定义.

构造及析构函数说明

◆ Chunk()

eve::voxel::Chunk::Chunk ( int  cx = 0,
int  cy = 0,
int  cz = 0 
)
inline

在文件 Chunk.h20 行定义.

成员函数说明

◆ clear()

void eve::voxel::Chunk::clear ( )
inline

在文件 Chunk.h59 行定义.

引用了 fill().

◆ cx()

int eve::voxel::Chunk::cx ( ) const
inline

在文件 Chunk.h24 行定义.

◆ cy()

int eve::voxel::Chunk::cy ( ) const
inline

在文件 Chunk.h25 行定义.

◆ cz()

int eve::voxel::Chunk::cz ( ) const
inline

在文件 Chunk.h26 行定义.

◆ ensureMeshed()

void eve::voxel::Chunk::ensureMeshed ( const CubeTypeRegistry types = CubeTypeRegistry::empty(),
ChunkSampler  sampler = nullptr,
void *  samplerUserData = nullptr 
)
inline

Ensure mesh is up to date; remesh if dirty.

在文件 Chunk.h82 行定义.

引用了 remesh().

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

◆ faceAOPackedData()

const uint32_t * eve::voxel::Chunk::faceAOPackedData ( FaceDir  dir) const
inline

Per-rect ambient-occlusion words (2 bits per corner, 0..3, shader corner order). Parallel to faceRects(dir).

在文件 Chunk.h103 行定义.

引用了 dir , 以及 v.

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

◆ facePackedData()

const uint32_t * eve::voxel::Chunk::facePackedData ( FaceDir  dir) const
inline

在文件 Chunk.h94 行定义.

引用了 dir , 以及 v.

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

◆ faceRectCount()

int eve::voxel::Chunk::faceRectCount ( FaceDir  dir) const
inline

在文件 Chunk.h92 行定义.

引用了 dir.

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

◆ faceRects()

const std::vector< PackedRect > & eve::voxel::Chunk::faceRects ( FaceDir  dir) const
inline

在文件 Chunk.h88 行定义.

引用了 dir.

◆ fill()

void eve::voxel::Chunk::fill ( uint8_t  texId)
inline

在文件 Chunk.h54 行定义.

被这些函数引用 clear().

◆ get()

uint8_t eve::voxel::Chunk::get ( int  x,
int  y,
int  z 
) const
inline

在文件 Chunk.h42 行定义.

引用了 eve::voxel::kChunkSize, x, y , 以及 z.

被这些函数引用 eve::voxel::VoxelWorld::getOrCreateChunk() , 以及 eve::voxel::VoxelWorld::selectVisible().

◆ isDirty()

bool eve::voxel::Chunk::isDirty ( ) const
inline

在文件 Chunk.h67 行定义.

◆ markDirty()

void eve::voxel::Chunk::markDirty ( )
inline

Explicitly invalidate the mesh (e.g. neighbor edit on a shared border).

在文件 Chunk.h70 行定义.

◆ originX()

float eve::voxel::Chunk::originX ( ) const
inline

在文件 Chunk.h28 行定义.

引用了 eve::voxel::kChunkSize.

被这些函数引用 worldAABB().

◆ originY()

float eve::voxel::Chunk::originY ( ) const
inline

在文件 Chunk.h29 行定义.

引用了 eve::voxel::kChunkSize.

被这些函数引用 worldAABB().

◆ originZ()

float eve::voxel::Chunk::originZ ( ) const
inline

在文件 Chunk.h30 行定义.

引用了 eve::voxel::kChunkSize.

被这些函数引用 worldAABB().

◆ rawVoxels()

const uint8_t * eve::voxel::Chunk::rawVoxels ( ) const
inline

在文件 Chunk.h114 行定义.

◆ remesh()

void eve::voxel::Chunk::remesh ( const CubeTypeRegistry types = CubeTypeRegistry::empty(),
ChunkSampler  sampler = nullptr,
void *  samplerUserData = nullptr 
)
inline

Rebuild six face instance buffers via greedy meshing.

在文件 Chunk.h73 行定义.

引用了 eve::voxel::GreedyMesher::meshChunk().

被这些函数引用 ensureMeshed().

◆ set()

void eve::voxel::Chunk::set ( int  x,
int  y,
int  z,
uint8_t  texId 
)
inline

在文件 Chunk.h48 行定义.

引用了 eve::voxel::kChunkSize, x, y , 以及 z.

◆ setVoxelData()

void eve::voxel::Chunk::setVoxelData ( const uint8_t *  src)
inline

Replace the whole 32³ voxel storage (e.g. deserialization).

在文件 Chunk.h62 行定义.

◆ totalRectCount()

int eve::voxel::Chunk::totalRectCount ( ) const
inline

在文件 Chunk.h108 行定义.

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

◆ worldAABB()

void eve::voxel::Chunk::worldAABB ( float &  minX,
float &  minY,
float &  minZ,
float &  maxX,
float &  maxY,
float &  maxZ 
) const
inline

在文件 Chunk.h32 行定义.

引用了 eve::voxel::kChunkSize, originX(), originY() , 以及 originZ().

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


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