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]
|
default |
Voxel world.
◆ ~VoxelWorld()
| eve::voxel::VoxelWorld::~VoxelWorld | ( | ) |
Voxel world.
在文件 VoxelWorld.cpp 第 20 行定义.
◆ VoxelWorld() [2/2]
|
explicit |
Voxel world.
在文件 VoxelWorld.cpp 第 19 行定义.
成员函数说明
◆ clear()
| void eve::voxel::VoxelWorld::clear | ( | ) |
◆ cubeTypes()
|
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 | ( | ) |
◆ 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 行定义.
被这些函数引用 getVoxel(), setVoxel() , 以及 streamAround().
◆ getChunk() [2/2]
| const Chunk * eve::voxel::VoxelWorld::getChunk | ( | int | cx, |
| int | cy, | ||
| int | cz | ||
| ) | const |
◆ getChunkCount()
|
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 |
◆ 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()
|
inline |
Monotonic content revision incremented by voxel/chunk mutations.
在文件 VoxelWorld.h 第 85 行定义.
◆ getStreamCacheChunks()
|
inline |
Returns the stream cache chunks.
在文件 VoxelWorld.h 第 102 行定义.
◆ getTerrainAssetResidentCount()
|
inline |
Returns the terrain asset resident count.
在文件 VoxelWorld.h 第 155 行定义.
◆ getVisibleBatch()
|
inline |
◆ getVisibleBatchCount()
|
inline |
Returns the visible batch count.
在文件 VoxelWorld.h 第 200 行定义.
◆ getVisibleChunkCoord()
| void eve::voxel::VoxelWorld::getVisibleChunkCoord | ( | int | index, |
| int & | cx, | ||
| int & | cy, | ||
| int & | cz | ||
| ) | const |
◆ getVisibleChunkCount()
|
inline |
Script accessors for the last selectVisible result.
在文件 VoxelWorld.h 第 205 行定义.
◆ getVisibleRectCount()
| int eve::voxel::VoxelWorld::getVisibleRectCount | ( | ) | const |
◆ 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 |
◆ lastRaycastFaceX()
|
inline |
Last raycast face x.
在文件 VoxelWorld.h 第 252 行定义.
◆ lastRaycastFaceY()
|
inline |
Last raycast face y.
在文件 VoxelWorld.h 第 254 行定义.
◆ lastRaycastFaceZ()
|
inline |
Last raycast face z.
在文件 VoxelWorld.h 第 256 行定义.
◆ lastRaycastHit()
|
inline |
Last raycast hit.
在文件 VoxelWorld.h 第 238 行定义.
◆ lastRaycastHitX()
|
inline |
Last raycast hit x.
在文件 VoxelWorld.h 第 240 行定义.
◆ lastRaycastHitY()
|
inline |
Last raycast hit y.
在文件 VoxelWorld.h 第 242 行定义.
◆ lastRaycastHitZ()
|
inline |
Last raycast hit z.
在文件 VoxelWorld.h 第 244 行定义.
◆ lastRaycastPrevX()
|
inline |
Last raycast prev x.
在文件 VoxelWorld.h 第 246 行定义.
◆ lastRaycastPrevY()
|
inline |
Last raycast prev y.
在文件 VoxelWorld.h 第 248 行定义.
◆ lastRaycastPrevZ()
|
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 | ) |
◆ 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 | ||
| ) |
◆ remeshDirty()
| int eve::voxel::VoxelWorld::remeshDirty | ( | int | maxThreads = 0, |
| int | maxChunks = 0 |
||
| ) |
Remesh dirty chunks.
- 参数
-
maxThreads 0 = auto (parallel up to an internal cap on desktop), 1 = serial, >1 = that many workers. Falls back to serial when threads are unavailable. maxChunks 0 = 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 | ||
| ) |
◆ 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.
- 参数
-
viewProj16 column-major 4x4 RH+ZO view-projection (16 floats) eyeX/Y/Z camera eye world position viewRange max distance from eye to chunk center (world units; ≤0 disables) faceCull when 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 行定义.
◆ 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 行定义.
◆ 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.
- 参数
-
maxCreates Maximum 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.
- 参数
-
generator Void.
在文件 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 行定义.
◆ terrainEnabled()
|
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 行定义.
被这些函数引用 streamAround().
该类的文档由以下文件生成:
- src/modules/voxel/VoxelWorld.h
- src/modules/voxel/VoxelWorld.cpp