载入中...
搜索中...
未找到
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)
 Constructs a Chunk.
 
int cx () const
 Cx.
 
int cy () const
 Cy.
 
int cz () const
 Cz.
 
float originX () const
 Origin x.
 
float originY () const
 Origin y.
 
float originZ () const
 Origin z.
 
void worldAABB (float &minX, float &minY, float &minZ, float &maxX, float &maxY, float &maxZ) const
 World aabb.
 
uint8_t get (int x, int y, int z) const
 Returns the value.
 
void set (int x, int y, int z, uint8_t texId)
 Sets the value.
 
void fill (uint8_t texId)
 Fill.
 
void clear ()
 Clears .
 
void setVoxelData (const uint8_t *src)
 Sets the voxel data.
 
bool isDirty () const
 True when dirty.
 
void markDirty ()
 Mark dirty.
 
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
 Face rects.
 
int faceRectCount (FaceDir dir) const
 Face rect count.
 
const uint32_t * facePackedData (FaceDir dir) const
 Face packed data.
 
const uint32_t * faceAOPackedData (FaceDir dir) const
 Face ao packed data.
 
int totalRectCount () const
 Total rect count.
 
const uint8_t * rawVoxels () const
 Raw voxels.
 

详细描述

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.h 第 18 行定义.

构造及析构函数说明

◆ Chunk()

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

Constructs a Chunk.

Memset.

在文件 Chunk.h 第 21 行定义.

成员函数说明

◆ clear()

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

Clears .

在文件 Chunk.h 第 73 行定义.

引用了 fill().

◆ cx()

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

Cx.

在文件 Chunk.h 第 27 行定义.

◆ cy()

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

Cy.

在文件 Chunk.h 第 29 行定义.

◆ cz()

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

Cz.

在文件 Chunk.h 第 31 行定义.

◆ 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.h 第 101 行定义.

引用了 remesh() , 以及 sampler.

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

◆ faceAOPackedData()

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

Face ao packed data.

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

在文件 Chunk.h 第 126 行定义.

引用了 dir , 以及 v.

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

◆ facePackedData()

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

Face packed data.

在文件 Chunk.h 第 116 行定义.

引用了 dir , 以及 v.

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

◆ faceRectCount()

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

Face rect count.

在文件 Chunk.h 第 113 行定义.

引用了 dir , 以及 size.

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

◆ faceRects()

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

Face rects.

在文件 Chunk.h 第 108 行定义.

引用了 dir.

◆ fill()

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

Fill.

Memset.

在文件 Chunk.h 第 66 行定义.

被这些函数引用 clear().

◆ get()

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

Returns the value.

在文件 Chunk.h 第 52 行定义.

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

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

◆ isDirty()

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

True when dirty.

在文件 Chunk.h 第 84 行定义.

◆ markDirty()

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

Mark dirty.

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

在文件 Chunk.h 第 88 行定义.

◆ originX()

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

Origin x.

在文件 Chunk.h 第 34 行定义.

引用了 eve::voxel::kChunkSize.

被这些函数引用 worldAABB().

◆ originY()

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

Origin y.

在文件 Chunk.h 第 36 行定义.

引用了 eve::voxel::kChunkSize.

被这些函数引用 worldAABB().

◆ originZ()

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

Origin z.

在文件 Chunk.h 第 38 行定义.

引用了 eve::voxel::kChunkSize.

被这些函数引用 worldAABB().

◆ rawVoxels()

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

Raw voxels.

在文件 Chunk.h 第 139 行定义.

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

Mesh chunk.

在文件 Chunk.h 第 91 行定义.

引用了 eve::voxel::GreedyMesher::meshChunk() , 以及 sampler.

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

◆ set()

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

Sets the value.

在文件 Chunk.h 第 59 行定义.

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

◆ setVoxelData()

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

Sets the voxel data.

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

Memcpy.

在文件 Chunk.h 第 77 行定义.

◆ totalRectCount()

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

Total rect count.

在文件 Chunk.h 第 132 行定义.

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

◆ worldAABB()

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

World aabb.

在文件 Chunk.h 第 41 行定义.

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

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


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