This release brings terrain optimizations, faster build times, and the ability to build chunks on the fly.
Changelog:
Terrain
- Added new struct
BBMOD_TerrainInfofor configuring aBBMOD_Terrainat construction time. Every public property ofBBMOD_Terrainhas a corresponding field inBBMOD_TerrainInfowith a sensible default. - The constructor of
BBMOD_Terrainnow accepts an optionalBBMOD_TerrainInfoas its argument. Positional_heightmap,_subimage, and_chunkSizearguments are still supported for backward compatibility. - Added new properties
EnableLazyBuild,LazyBuildBudget,LazyBuildInterval, andLazyBuildForceReflectionCaptureto structBBMOD_Terrainfor controlling lazy chunk build scheduling and per-frame time budgets. - Missing terrain chunks within the visible range are now built lazily during submission in nearest-first order, respecting the configured frame interval and time budget.
- Added new methods
reset_build_profiler()andget_build_profiler()to structBBMOD_Terrainfor measuring per-chunk build time broken down by stage (smooth normals, vertex data, freeze, and bounds). - Methods
build_normals([_chunkI[, _chunkJ]])andbuild_smooth_normals([_chunkI[, _chunkJ]])of structBBMOD_Terrainnow accept optional chunk coordinates to rebuild only a specific chunk instead of the whole terrain. Results are cached per-chunk and reused on subsequent calls. - Added new method
get_smooth_normal(_x, _y)to structBBMOD_Terrain, which returns the bilinearly interpolated smooth normal at a world-space coordinate. - Method
get_normal(_x, _y)of structBBMOD_Terrainnow computes the face normal analytically using terrain scale and returns a properly normalized world-space vector. - Terrain chunk meshes are now generated as triangle strips instead of triangle lists, reducing vertex count and eliminating per-vertex temporary struct allocations during chunk builds.
- Struct
BBMOD_Terrainnow correctly invalidates all cached chunk data when height or smoothing is modified, and disposes lazy-build resources ondestroy(). - Method
smooth_height([_range])of structBBMOD_Terrainnow accepts an optional_rangeargument controlling the averaging kernel radius, and invalidates chunk caches after smoothing. - Optimized chunk bounding sphere computation in
build_chunk()of structBBMOD_Terrainto use built-in grid min/max queries instead of a manual per-vertex loop.