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

#include <VoxelWorld.h>

Public 成员函数

 VoxelWorld ()
 Voxel world.
 
 ~VoxelWorld ()
 Voxel world.
 
 VoxelWorld (const CubeTypeRegistry &types)
 Voxel world.
 
Chunk * getOrCreateChunk (int cx, int cy, int cz)
 Returns the or create chunk.
 
Chunk * getChunk (int cx, int cy, int cz)
 Returns the chunk.
 
const Chunk * getChunk (int cx, int cy, int cz) const
 Returns the chunk.
 
bool hasChunk (int cx, int cy, int cz) const
 True when chunk.
 
void removeChunk (int cx, int cy, int cz)
 Removes chunk.
 
void clear ()
 Clears .
 
int getChunkCount () const
 Returns the chunk count.
 
uint64_t getRevision () const
 Monotonic content revision incremented by voxel/chunk mutations.
 
int unloadChunksOutside (int centerX, int centerY, int centerZ, int radiusChunks)
 Streaming eviction: drop chunks whose center is farther than radiusChunks chunk units from (centerX, centerY, centerZ). Radius < 0 is a no-op. Returns the number of chunks evicted.
 
void setStreamCacheChunks (int extraChunks)
 Extra chunk radius kept after leaving the stream sphere. streamAround still creates only inside radiusChunks, but does not unload or drop in-flight jobs until distance exceeds radius plus this value. 0 (default) matches the old immediately-evict behaviour.
 
int getStreamCacheChunks () const
 Returns the stream cache chunks.
 
StreamStats streamAround (int centerX, int centerY, int centerZ, int radiusChunks, const std::function< void(Chunk &, int, int, int)> &generator={}, int maxCreates=0)
 Player-centered streaming: fill missing chunks inside radiusChunks, unload only past radius + getStreamCacheChunks() (hysteresis cache). generator is called for each new chunk (chunk, cx, cy, cz); when null the stored terrain sampler (procgen::TerrainSampler) is used if enabled, otherwise chunks stay empty. Radius < 0 is a no-op.
 
void setTerrainParams (uint32_t seed, uint8_t top, uint8_t sub, uint8_t stone, float baseHeight, float amplitude, float scale)
 Configure the built-in terrain generator used by streamAround(). The sampling itself lives in procgen::TerrainSampler (deterministic Perlin fBm); voxel only adapts it to 32³ chunk filling.
 
void setTerrainParam (const std::string &key, float value)
 细粒度地形参数配置(脚本用)。key 支持: seed/top/sub/stone/sand/base/amplitude/scale(=frequency)/ octaves/lacunarity/gain/ridge/warp/exponent/continent/island/coast/ worldWidth/worldHeight/sandLevel/enable 所有参数以 float 传入(整数在内部取整)。sandLevel ∈ (0,1] 时, 采样高度 ≤ sandLevel 的柱子顶层用 sand 纹理(沙滩带);0 或负值关闭。 enable=1 打开地形(默认流式生成开启),enable=0 关闭。
 
void disableTerrain ()
 Disables terrain.
 
bool terrainEnabled () const
 Terrain enabled.
 
bool loadTerrainAsset (data::ByteData *bytes, float heightOffset=0.f, float heightScale=1.f)
 Compatibility operation that opens baked EVTR terrain data.
 
procgen::TerrainStreamStats streamTerrainAssetAround (int worldX, int worldZ, int radiusChunks, int maxLoads=0)
 Decode/evict EVTR chunks around a world-space column with an optional load budget.
 
void setTerrainAssetMaterials (uint8_t vegetation, uint8_t sand, uint8_t snow, uint8_t alpine, uint8_t riverbed)
 Configure biome surface ids: vegetation, sand, snow, alpine rock, river bed.
 
int getTerrainAssetResidentCount () const
 Returns the terrain asset resident count.
 
int terrainHeightAt (int wx, int wz) const
 Terrain height (world blocks) at a column for the configured seed.
 
void serializeWorld (std::vector< uint8_t > &out) const
 Persistence: serialize every chunk (coords + raw voxels) into out. Format is portable little-endian: "EVVX" + version + count + per-chunk (cx, cy, cz, 32³ voxels). Meshes are rebuilt on demand after loading.
 
bool deserializeWorld (const uint8_t *data, size_t size)
 Deserialize world.
 
data::ByteData * saveWorld () const
 Script-facing wrappers around serialize/deserialize.
 
bool loadWorld (data::ByteData *bytes)
 Loads world.
 
int remeshDirty (int maxThreads=0, int maxChunks=0)
 Remesh dirty chunks.
 
int getDirtyCount () const
 Number of chunks whose mesh is stale.
 
int getInflightStreamCount () const
 Terrain jobs still running (not yet inserted into the world).
 
void selectVisible (const float *viewProj16, float eyeX, float eyeY, float eyeZ, float viewRange, bool faceCull=true)
 Select chunks/faces to draw.
 
int getVisibleBatchCount () const
 Returns the visible batch count.
 
const DrawBatch & getVisibleBatch (int index) const
 Returns the visible batch.
 
int getVisibleChunkCount () const
 Script accessors for the last selectVisible result.
 
void getVisibleChunkCoord (int index, int &cx, int &cy, int &cz) const
 Returns the visible chunk coord.
 
int getVisibleRectCount () const
 Returns the visible rect count.
 
void drawVisible (graphics::Graphics *gfx, graphics::Texture *atlas, int tilesPerRow=16)
 Issue Graphics::drawVoxelFaceInstances for every visible batch. Requires begin3DFrame + setMesh3DViewProj already done. 参数用主类 Graphics*(而非 IGraphics3D*):脚本绑定对接口指针 不做次基类偏移调整,经接口的虚调用会错位到别的 vtable 槽位。
 
uint8_t getVoxel (int wx, int wy, int wz) const
 World-space voxel get/set. Air (0) never allocates a chunk; a border edit also invalidates the adjacent chunk's mesh.
 
void setVoxel (int wx, int wy, int wz, uint8_t texId)
 Sets the voxel.
 
bool raycast (float ox, float oy, float oz, float dx, float dy, float dz, float maxDist, int &hitX, int &hitY, int &hitZ, int &prevX, int &prevY, int &prevZ, int &faceX, int &faceY, int &faceZ) const
 Voxel raycast (Amanatides & Woo DDA). Returns true when a solid voxel is found within maxDist world units along the ray; fills hit/prev coords and the face normal of the surface the ray entered. prev is the last air voxel before the hit (equals hit when the ray starts inside solid).
 
bool raycastScript (float ox, float oy, float oz, float dx, float dy, float dz, float maxDist)
 Script-facing raycast: stores the last result, returns hit/miss.
 
bool lastRaycastHit () const
 Last raycast hit.
 
int lastRaycastHitX () const
 Last raycast hit x.
 
int lastRaycastHitY () const
 Last raycast hit y.
 
int lastRaycastHitZ () const
 Last raycast hit z.
 
int lastRaycastPrevX () const
 Last raycast prev x.
 
int lastRaycastPrevY () const
 Last raycast prev y.
 
int lastRaycastPrevZ () const
 Last raycast prev z.
 
int lastRaycastFaceX () const
 Last raycast face x.
 
int lastRaycastFaceY () const
 Last raycast face y.
 
int lastRaycastFaceZ () const
 Last raycast face z.
 
void setVoxelByName (int wx, int wy, int wz, const std::string &name, int orientation=0)
 按方块名 + orientation(0..3) 设置体素;内部解析为具体类型 id 后写 Chunk。 未注册的名字按空气(0)处理。
 
std::string getCubeTypeName (int wx, int wy, int wz) const
 该体素所属方块类型名(未注册或空气返回空串)。
 
uint8_t getCubeTypeTex (int wx, int wy, int wz, const std::string &faceDir) const
 该体素在某面方向上的纹理 id(faceDir 如 "posX"/"+y"/"negZ")。
 
const CubeTypeRegistry & cubeTypes () const
 本世界持有的方块类型注册表(副本)。
 

详细描述

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.

在文件 VoxelWorld.h 第 60 行定义.

构造及析构函数说明

◆ VoxelWorld() [1/2]

eve::voxel::VoxelWorld::VoxelWorld ( )
default

Voxel world.

◆ ~VoxelWorld()

eve::voxel::VoxelWorld::~VoxelWorld ( )

Voxel world.

在文件 VoxelWorld.cpp 第 20 行定义.

◆ VoxelWorld() [2/2]

eve::voxel::VoxelWorld::VoxelWorld ( const CubeTypeRegistry &  types)
explicit

Voxel world.

在文件 VoxelWorld.cpp 第 19 行定义.

成员函数说明

◆ clear()

void eve::voxel::VoxelWorld::clear ( )

Clears .

在文件 VoxelWorld.cpp 第 146 行定义.

被这些函数引用 deserializeWorld().

◆ cubeTypes()

const CubeTypeRegistry & eve::voxel::VoxelWorld::cubeTypes ( ) const
inline

本世界持有的方块类型注册表(副本)。

在文件 VoxelWorld.h 第 270 行定义.

◆ deserializeWorld()

bool eve::voxel::VoxelWorld::deserializeWorld ( const uint8_t *  data,
size_t  size 
)

Deserialize world.

在文件 VoxelWorld.cpp 第 456 行定义.

引用了 c, clear(), count, cx, cy, end, getOrCreateChunk(), eve::voxel::kChunkSize, p , 以及 size.

被这些函数引用 loadWorld().

◆ disableTerrain()

void eve::voxel::VoxelWorld::disableTerrain ( )

Disables terrain.

在文件 VoxelWorld.cpp 第 87 行定义.

引用了 eve::procgen::TerrainStreamingCache::clear().

◆ drawVisible()

void eve::voxel::VoxelWorld::drawVisible ( graphics::Graphics *  gfx,
graphics::Texture *  atlas,
int  tilesPerRow = 16 
)

Issue Graphics::drawVoxelFaceInstances for every visible batch. Requires begin3DFrame + setMesh3DViewProj already done. 参数用主类 Graphics*(而非 IGraphics3D*):脚本绑定对接口指针 不做次基类偏移调整,经接口的虚调用会错位到别的 vtable 槽位。

在文件 VoxelWorld.cpp 第 736 行定义.

引用了 b, eve::graphics::Graphics::drawVoxelFaceInstances() , 以及 eve::voxel::faceDirName().

◆ getChunk() [1/2]

Chunk * eve::voxel::VoxelWorld::getChunk ( int  cx,
int  cy,
int  cz 
)

Returns the chunk.

在文件 VoxelWorld.cpp 第 128 行定义.

引用了 cx, cy , 以及 key.

被这些函数引用 getVoxel(), setVoxel() , 以及 streamAround().

◆ getChunk() [2/2]

const Chunk * eve::voxel::VoxelWorld::getChunk ( int  cx,
int  cy,
int  cz 
) const

Returns the chunk.

在文件 VoxelWorld.cpp 第 133 行定义.

引用了 cx, cy , 以及 key.

◆ getChunkCount()

int eve::voxel::VoxelWorld::getChunkCount ( ) const
inline

Returns the chunk count.

在文件 VoxelWorld.h 第 83 行定义.

◆ getCubeTypeName()

std::string eve::voxel::VoxelWorld::getCubeTypeName ( int  wx,
int  wy,
int  wz 
) const

该体素所属方块类型名(未注册或空气返回空串)。

在文件 VoxelWorld.cpp 第 890 行定义.

引用了 eve::voxel::CubeTypeRegistry::find(), getVoxel(), eve::voxel::CubeType::name, t, wx, wy , 以及 wz.

◆ getCubeTypeTex()

uint8_t eve::voxel::VoxelWorld::getCubeTypeTex ( int  wx,
int  wy,
int  wz,
const std::string &  faceDir 
) const

该体素在某面方向上的纹理 id(faceDir 如 "posX"/"+y"/"negZ")。

在文件 VoxelWorld.cpp 第 895 行定义.

引用了 d, eve::voxel::faceDirFromName(), getVoxel(), eve::voxel::resolveFaceTex(), wx, wy , 以及 wz.

◆ getDirtyCount()

int eve::voxel::VoxelWorld::getDirtyCount ( ) const

Number of chunks whose mesh is stale.

在文件 VoxelWorld.cpp 第 490 行定义.

引用了 n.

◆ getInflightStreamCount()

int eve::voxel::VoxelWorld::getInflightStreamCount ( ) const

Terrain jobs still running (not yet inserted into the world).

在文件 VoxelWorld.cpp 第 498 行定义.

被这些函数引用 streamAround().

◆ getOrCreateChunk()

Chunk * eve::voxel::VoxelWorld::getOrCreateChunk ( int  cx,
int  cy,
int  cz 
)

Returns the or create chunk.

在文件 VoxelWorld.cpp 第 118 行定义.

引用了 cx, cy, eve::voxel::Chunk::get() , 以及 key.

被这些函数引用 deserializeWorld(), setVoxel() , 以及 streamAround().

◆ getRevision()

uint64_t eve::voxel::VoxelWorld::getRevision ( ) const
inline

Monotonic content revision incremented by voxel/chunk mutations.

在文件 VoxelWorld.h 第 85 行定义.

被这些函数引用 eve::voxel_editing::VoxelWorldTarget::revision().

◆ getStreamCacheChunks()

int eve::voxel::VoxelWorld::getStreamCacheChunks ( ) const
inline

Returns the stream cache chunks.

在文件 VoxelWorld.h 第 102 行定义.

◆ getTerrainAssetResidentCount()

int eve::voxel::VoxelWorld::getTerrainAssetResidentCount ( ) const
inline

Returns the terrain asset resident count.

在文件 VoxelWorld.h 第 155 行定义.

◆ getVisibleBatch()

const DrawBatch & eve::voxel::VoxelWorld::getVisibleBatch ( int  index) const
inline

Returns the visible batch.

在文件 VoxelWorld.h 第 202 行定义.

引用了 index.

◆ getVisibleBatchCount()

int eve::voxel::VoxelWorld::getVisibleBatchCount ( ) const
inline

Returns the visible batch count.

在文件 VoxelWorld.h 第 200 行定义.

◆ getVisibleChunkCoord()

void eve::voxel::VoxelWorld::getVisibleChunkCoord ( int  index,
int &  cx,
int &  cy,
int &  cz 
) const

Returns the visible chunk coord.

在文件 VoxelWorld.cpp 第 722 行定义.

引用了 cx, cy , 以及 index.

◆ getVisibleChunkCount()

int eve::voxel::VoxelWorld::getVisibleChunkCount ( ) const
inline

Script accessors for the last selectVisible result.

在文件 VoxelWorld.h 第 205 行定义.

◆ getVisibleRectCount()

int eve::voxel::VoxelWorld::getVisibleRectCount ( ) const

Returns the visible rect count.

在文件 VoxelWorld.cpp 第 730 行定义.

引用了 b , 以及 n.

◆ getVoxel()

uint8_t eve::voxel::VoxelWorld::getVoxel ( int  wx,
int  wy,
int  wz 
) const

World-space voxel get/set. Air (0) never allocates a chunk; a border edit also invalidates the adjacent chunk's mesh.

在文件 VoxelWorld.cpp 第 746 行定义.

引用了 c, cx, cy, getChunk(), eve::voxel::kChunkSize, wx, wy , 以及 wz.

被这些函数引用 getCubeTypeName(), getCubeTypeTex(), raycast() , 以及 eve::voxel_editing::VoxelWorldTarget::readInt3().

◆ hasChunk()

bool eve::voxel::VoxelWorld::hasChunk ( int  cx,
int  cy,
int  cz 
) const

True when chunk.

在文件 VoxelWorld.cpp 第 138 行定义.

引用了 cx, cy , 以及 key.

被这些函数引用 streamAround().

◆ lastRaycastFaceX()

int eve::voxel::VoxelWorld::lastRaycastFaceX ( ) const
inline

Last raycast face x.

在文件 VoxelWorld.h 第 252 行定义.

◆ lastRaycastFaceY()

int eve::voxel::VoxelWorld::lastRaycastFaceY ( ) const
inline

Last raycast face y.

在文件 VoxelWorld.h 第 254 行定义.

◆ lastRaycastFaceZ()

int eve::voxel::VoxelWorld::lastRaycastFaceZ ( ) const
inline

Last raycast face z.

在文件 VoxelWorld.h 第 256 行定义.

◆ lastRaycastHit()

bool eve::voxel::VoxelWorld::lastRaycastHit ( ) const
inline

Last raycast hit.

在文件 VoxelWorld.h 第 238 行定义.

◆ lastRaycastHitX()

int eve::voxel::VoxelWorld::lastRaycastHitX ( ) const
inline

Last raycast hit x.

在文件 VoxelWorld.h 第 240 行定义.

◆ lastRaycastHitY()

int eve::voxel::VoxelWorld::lastRaycastHitY ( ) const
inline

Last raycast hit y.

在文件 VoxelWorld.h 第 242 行定义.

◆ lastRaycastHitZ()

int eve::voxel::VoxelWorld::lastRaycastHitZ ( ) const
inline

Last raycast hit z.

在文件 VoxelWorld.h 第 244 行定义.

◆ lastRaycastPrevX()

int eve::voxel::VoxelWorld::lastRaycastPrevX ( ) const
inline

Last raycast prev x.

在文件 VoxelWorld.h 第 246 行定义.

◆ lastRaycastPrevY()

int eve::voxel::VoxelWorld::lastRaycastPrevY ( ) const
inline

Last raycast prev y.

在文件 VoxelWorld.h 第 248 行定义.

◆ lastRaycastPrevZ()

int eve::voxel::VoxelWorld::lastRaycastPrevZ ( ) const
inline

Last raycast prev z.

在文件 VoxelWorld.h 第 250 行定义.

◆ loadTerrainAsset()

bool eve::voxel::VoxelWorld::loadTerrainAsset ( data::ByteData *  bytes,
float  heightOffset = 0.f,
float  heightScale = 1.f 
)

Compatibility operation that opens baked EVTR terrain data.

在文件 VoxelWorld.cpp 第 155 行定义.

引用了 bytes, error , 以及 eve::procgen::TerrainStreamingCache::open().

◆ loadWorld()

bool eve::voxel::VoxelWorld::loadWorld ( data::ByteData *  bytes)

Loads world.

在文件 VoxelWorld.cpp 第 485 行定义.

引用了 bytes , 以及 deserializeWorld().

◆ raycast()

bool eve::voxel::VoxelWorld::raycast ( float  ox,
float  oy,
float  oz,
float  dx,
float  dy,
float  dz,
float  maxDist,
int &  hitX,
int &  hitY,
int &  hitZ,
int &  prevX,
int &  prevY,
int &  prevZ,
int &  faceX,
int &  faceY,
int &  faceZ 
) const

Voxel raycast (Amanatides & Woo DDA). Returns true when a solid voxel is found within maxDist world units along the ray; fills hit/prev coords and the face normal of the surface the ray entered. prev is the last air voxel before the hit (equals hit when the ray starts inside solid).

在文件 VoxelWorld.cpp 第 798 行定义.

引用了 dx, dy, dz, getVoxel(), ox, oy , 以及 t.

被这些函数引用 raycastScript().

◆ raycastScript()

bool eve::voxel::VoxelWorld::raycastScript ( float  ox,
float  oy,
float  oz,
float  dx,
float  dy,
float  dz,
float  maxDist 
)

Script-facing raycast: stores the last result, returns hit/miss.

在文件 VoxelWorld.cpp 第 875 行定义.

引用了 dx, dy, dz, ox, oy , 以及 raycast().

◆ remeshDirty()

int eve::voxel::VoxelWorld::remeshDirty ( int  maxThreads = 0,
int  maxChunks = 0 
)

Remesh dirty chunks.

参数
maxThreads0 = auto (parallel up to an internal cap on desktop), 1 = serial, >1 = that many workers. Falls back to serial when threads are unavailable.
maxChunks0 = all dirty chunks; >0 remesh at most that many (so a streaming world can finish meshes across frames).

在文件 VoxelWorld.cpp 第 642 行定义.

引用了 dirty.

被这些函数引用 streamAround().

◆ removeChunk()

void eve::voxel::VoxelWorld::removeChunk ( int  cx,
int  cy,
int  cz 
)

Removes chunk.

在文件 VoxelWorld.cpp 第 142 行定义.

引用了 cx, cy , 以及 key.

◆ saveWorld()

data::ByteData * eve::voxel::VoxelWorld::saveWorld ( ) const

Script-facing wrappers around serialize/deserialize.

在文件 VoxelWorld.cpp 第 479 行定义.

引用了 bytes , 以及 serializeWorld().

◆ selectVisible()

void eve::voxel::VoxelWorld::selectVisible ( const float *  viewProj16,
float  eyeX,
float  eyeY,
float  eyeZ,
float  viewRange,
bool  faceCull = true 
)

Select chunks/faces to draw.

参数
viewProj16column-major 4x4 RH+ZO view-projection (16 floats)
eyeX/Y/Zcamera eye world position
viewRangemax distance from eye to chunk center (world units; ≤0 disables)
faceCullwhen true, conservatively drop face-direction buffers that are back-facing from every possible face plane in the chunk

在文件 VoxelWorld.cpp 第 654 行定义.

引用了 eve::voxel::DrawBatch::ao, eve::voxel::DrawBatch::chunk, count, eve::voxel::Count, eve::voxel::DrawBatch::count, cx, cy, dir, eve::voxel::DrawBatch::dir, dx, dy, dz, eve::voxel::Chunk::ensureMeshed(), eve::voxel::Chunk::faceAOPackedData(), eve::voxel::faceDirCount(), eve::voxel::Chunk::facePackedData(), eve::voxel::Chunk::faceRectCount(), eve::voxel::Frustum::fromViewProjColumnMajor(), frustum, eve::voxel::Chunk::get(), eve::voxel::NegX, eve::voxel::NegY, eve::voxel::NegZ, eve::voxel::DrawBatch::packed, eve::voxel::PosX, eve::voxel::PosY, eve::voxel::PosZ , 以及 eve::voxel::Chunk::worldAABB().

◆ serializeWorld()

void eve::voxel::VoxelWorld::serializeWorld ( std::vector< uint8_t > &  out) const

Persistence: serialize every chunk (coords + raw voxels) into out. Format is portable little-endian: "EVVX" + version + count + per-chunk (cx, cy, cz, 32³ voxels). Meshes are rebuilt on demand after loading.

在文件 VoxelWorld.cpp 第 432 行定义.

引用了 cx, cy, eve::voxel::kChunkSize , 以及 key.

被这些函数引用 saveWorld().

◆ setStreamCacheChunks()

void eve::voxel::VoxelWorld::setStreamCacheChunks ( int  extraChunks)

Extra chunk radius kept after leaving the stream sphere. streamAround still creates only inside radiusChunks, but does not unload or drop in-flight jobs until distance exceeds radius plus this value. 0 (default) matches the old immediately-evict behaviour.

在文件 VoxelWorld.cpp 第 218 行定义.

◆ setTerrainAssetMaterials()

void eve::voxel::VoxelWorld::setTerrainAssetMaterials ( uint8_t  vegetation,
uint8_t  sand,
uint8_t  snow,
uint8_t  alpine,
uint8_t  riverbed 
)

Configure biome surface ids: vegetation, sand, snow, alpine rock, river bed.

在文件 VoxelWorld.cpp 第 174 行定义.

◆ setTerrainParam()

void eve::voxel::VoxelWorld::setTerrainParam ( const std::string &  key,
float  value 
)

细粒度地形参数配置(脚本用)。key 支持: seed/top/sub/stone/sand/base/amplitude/scale(=frequency)/ octaves/lacunarity/gain/ridge/warp/exponent/continent/island/coast/ worldWidth/worldHeight/sandLevel/enable 所有参数以 float 传入(整数在内部取整)。sandLevel ∈ (0,1] 时, 采样高度 ≤ sandLevel 的柱子顶层用 sand 纹理(沙滩带);0 或负值关闭。 enable=1 打开地形(默认流式生成开启),enable=0 关闭。

在文件 VoxelWorld.cpp 第 39 行定义.

引用了 key , 以及 value.

◆ setTerrainParams()

void eve::voxel::VoxelWorld::setTerrainParams ( uint32_t  seed,
uint8_t  top,
uint8_t  sub,
uint8_t  stone,
float  baseHeight,
float  amplitude,
float  scale 
)

Configure the built-in terrain generator used by streamAround(). The sampling itself lives in procgen::TerrainSampler (deterministic Perlin fBm); voxel only adapts it to 32³ chunk filling.

在文件 VoxelWorld.cpp 第 22 行定义.

引用了 scale, seed , 以及 top.

◆ setVoxel()

void eve::voxel::VoxelWorld::setVoxel ( int  wx,
int  wy,
int  wz,
uint8_t  texId 
)

Sets the voxel.

在文件 VoxelWorld.cpp 第 755 行定义.

引用了 c, cx, cy, getChunk(), getOrCreateChunk(), eve::voxel::kChunkSize, wx, wy , 以及 wz.

被这些函数引用 setVoxelByName() , 以及 eve::voxel_editing::VoxelWorldTarget::writeInt3().

◆ setVoxelByName()

void eve::voxel::VoxelWorld::setVoxelByName ( int  wx,
int  wy,
int  wz,
const std::string &  name,
int  orientation = 0 
)

按方块名 + orientation(0..3) 设置体素;内部解析为具体类型 id 后写 Chunk。 未注册的名字按空气(0)处理。

在文件 VoxelWorld.cpp 第 883 行定义.

引用了 eve::voxel::CubeTypeRegistry::find(), name, setVoxel(), t, eve::voxel::CubeTypeRegistry::variantId(), wx, wy , 以及 wz.

◆ streamAround()

StreamStats eve::voxel::VoxelWorld::streamAround ( int  centerX,
int  centerY,
int  centerZ,
int  radiusChunks,
const std::function< void(Chunk &, int, int, int)> &  generator = {},
int  maxCreates = 0 
)

Player-centered streaming: fill missing chunks inside radiusChunks, unload only past radius + getStreamCacheChunks() (hysteresis cache). generator is called for each new chunk (chunk, cx, cy, cz); when null the stored terrain sampler (procgen::TerrainSampler) is used if enabled, otherwise chunks stay empty. Radius < 0 is a no-op.

参数
maxCreatesMaximum new chunks to start or harvest this call; nearest first. 0 means unlimited synchronous fill (tests / one-shot). >0 runs terrain fill+mesh on JobSystem workers; this call only enqueues work and inserts chunks that are already ready, so eve_update stays off the generation cost.
参数
generatorVoid.

在文件 VoxelWorld.cpp 第 272 行定义.

引用了 a, eve::procgen::TerrainStreamingCache::asset(), b, c, created, d, dx, dy, dz, eve::procgen::TerrainStreamStats::evicted, eve::voxel::Chunk::get(), getChunk(), eve::procgen::TerrainAsset::getChunkSize(), getInflightStreamCount(), getOrCreateChunk(), hasChunk(), eve::thread::JobSystem::isRunning(), eve::voxel::kChunkSize, key, m, n, nx, ny, nz, eve::voxel::Chunk::remesh(), remeshDirty(), stats, eve::procgen::TerrainStreamingCache::streamAround(), eve::thread::JobSystem::submit() , 以及 unloadChunksOutside().

◆ streamTerrainAssetAround()

procgen::TerrainStreamStats eve::voxel::VoxelWorld::streamTerrainAssetAround ( int  worldX,
int  worldZ,
int  radiusChunks,
int  maxLoads = 0 
)

Decode/evict EVTR chunks around a world-space column with an optional load budget.

在文件 VoxelWorld.cpp 第 167 行定义.

引用了 eve::procgen::TerrainStreamingCache::streamAround().

◆ terrainEnabled()

bool eve::voxel::VoxelWorld::terrainEnabled ( ) const
inline

Terrain enabled.

在文件 VoxelWorld.h 第 144 行定义.

◆ terrainHeightAt()

int eve::voxel::VoxelWorld::terrainHeightAt ( int  wx,
int  wz 
) const

Terrain height (world blocks) at a column for the configured seed.

在文件 VoxelWorld.cpp 第 183 行定义.

引用了 eve::procgen::TerrainStreamingCache::sampleHeight(), wx , 以及 wz.

◆ unloadChunksOutside()

int eve::voxel::VoxelWorld::unloadChunksOutside ( int  centerX,
int  centerY,
int  centerZ,
int  radiusChunks 
)

Streaming eviction: drop chunks whose center is farther than radiusChunks chunk units from (centerX, centerY, centerZ). Radius < 0 is a no-op. Returns the number of chunks evicted.

在文件 VoxelWorld.cpp 第 222 行定义.

引用了 cx, cy, dx, dy , 以及 dz.

被这些函数引用 streamAround().


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