载入中...
搜索中...
未找到
eve::procgen::TerrainMeshStampBuilder类 参考

Owning CPU mesh-to-heightfield builder; topmost Y wins regardless of winding. @ownership Owns copied positions and indices; never retains source/output references. @thread Serialize mutations; bake may run concurrently with other read-only bakes on distinct outputs. No callbacks, locks, RNG, renderer or ECS dependencies. 更多...

#include <TerrainMeshStamp.h>

Public 成员函数

Result< int > setSource (const MeshBuild &mesh)
 Validate and copy a CPU triangle mesh; failure preserves the prior source.
 
Result< int > bake (Heightmap &heights, Heightmap &coverage, double minX, double minZ, double width, double depth, double feather) const
 Bake the highest surface into two preallocated matching rasters, atomically.
 

详细描述

Owning CPU mesh-to-heightfield builder; topmost Y wins regardless of winding. @ownership Owns copied positions and indices; never retains source/output references. @thread Serialize mutations; bake may run concurrently with other read-only bakes on distinct outputs. No callbacks, locks, RNG, renderer or ECS dependencies.

注解
Apply model transforms before setSource. Undercuts, UVs and materials are discarded. Repeated bakes are deterministic on one toolchain; compare platforms with float tolerance.

在文件 TerrainMeshStamp.h 第 20 行定义.

成员函数说明

◆ bake()

Result< int > eve::procgen::TerrainMeshStampBuilder::bake ( Heightmap &  heights,
Heightmap &  coverage,
double  minX,
double  minZ,
double  width,
double  depth,
double  feather 
) const

Bake the highest surface into two preallocated matching rasters, atomically.

参数
heightsExclusive output, at least 2x2; no-hit samples become zero.
coverageExclusive distinct output; zero outside, one inside unless feathered.
minXFirst column's source-space X.
minZFirst row's source-space Z.
widthPositive finite X span from first to last column.
depthPositive finite Z span from first to last row.
featherNonnegative source-space distance from missing samples or raster boundary; uses grid Manhattan distance and cubic smoothstep. Zero disables feathering.
返回
Covered sample count before feathering; zero means no hits. InvalidArgument leaves both outputs unchanged, including when the work budget is exceeded. @cost Expensive: sum of triangle projected bounding-box sample counts plus raster size; bounded to 128M sample tests and 4M output samples. Bake once per mesh/resolution, then reuse heights/coverage for stamping. Vertical/degenerate triangles are ignored.
异常
std::bad_allocAllocation failure leaves both outputs unchanged.

在文件 TerrainMeshStamp.cpp 第 31 行定义.

引用了 a, b, bottom, c, columns, coverage, covered, cx, eve::procgen::Heightmap::data(), depth, dx, dz, eve::procgen::Heightmap::getHeight(), eve::procgen::Heightmap::getWidth(), index, eve::procgen::raster_detail::invalid(), eve::procgen::raster_detail::isRepresentable(), left, mask, px, pz, right, rows, eve::Result< T >::success(), t, top, triangle, eve::procgen::raster_detail::validRaster(), width, x, y , 以及 z.

◆ setSource()

Result< int > eve::procgen::TerrainMeshStampBuilder::setSource ( const MeshBuild &  mesh)

Validate and copy a CPU triangle mesh; failure preserves the prior source.

参数
meshBorrowed immutable mesh in the bake coordinate system, Y up.
返回
Copied triangle count, or InvalidArgument for malformed/nonfinite/oversized data. @cost Linear in vertices and indices, with owning copies; reuse the builder across bakes.
异常
std::bad_allocAllocation failure leaves the prior source unchanged.

在文件 TerrainMeshStamp.cpp 第 15 行定义.

引用了 indices, eve::procgen::raster_detail::invalid(), mesh, positions, eve::Result< T >::success() , 以及 v.


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