j
This commit is contained in:
@@ -11,12 +11,14 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "VoxelTypes.h"
|
||||
#include "VoxelStrateTypes.h"
|
||||
#include "VoxelBiomeTypes.h"
|
||||
#include "VoxelGenerator.generated.h"
|
||||
|
||||
// Forward decls (évite les includes transitifs)
|
||||
class UVoxelSettings;
|
||||
class UVoxelStrateManager;
|
||||
class UVoxelDiffLayer;
|
||||
class UVoxelBiomeDefinition;
|
||||
|
||||
/**
|
||||
* UVoxelGenerator
|
||||
@@ -103,9 +105,18 @@ public:
|
||||
/**
|
||||
* Densité pour une strate SurfaceWorld — terrain à ciel ouvert (collines,
|
||||
* montagnes, plages) sous un plafond solide, avec nappe d'eau optionnelle.
|
||||
*
|
||||
* Biome output-blend: the heightfield is evaluated with ParamsD (the voxel's dominant
|
||||
* biome) and, when NeighborWeight > 0, also with ParamsN (its nearest neighbour); the
|
||||
* two surface HEIGHTS are lerped. This stays seamless across ANY param difference
|
||||
* (frequencies included). With no biomes, pass ParamsD == ParamsN and weight 0 →
|
||||
* bit-identical to the single-param terrain. Structural fields (Z bounds, seal, base,
|
||||
* water level) must be equal in both (forced from the strate).
|
||||
*/
|
||||
float GetSurfaceDensity(float WorldX, float WorldY, float WorldZ,
|
||||
const FSurfaceGenerationParams& Params) const;
|
||||
const FSurfaceGenerationParams& ParamsD,
|
||||
const FSurfaceGenerationParams& ParamsN,
|
||||
float NeighborWeight) const;
|
||||
|
||||
/**
|
||||
* Densité pour une strate VerticalShafts — puits verticaux pleine hauteur,
|
||||
@@ -120,4 +131,67 @@ public:
|
||||
*/
|
||||
float GetFloatingIslandDensity(float WorldX, float WorldY, float WorldZ,
|
||||
const FFloatingIslandParams& Params) const;
|
||||
|
||||
//=========================================================================
|
||||
// CLIMATE & BIOME FIELDS (pure XY, deterministic, window-invariant)
|
||||
//=========================================================================
|
||||
|
||||
/**
|
||||
* Relief ("elevation") field at a world XY → [0,1], contrast-shaped & smoothed.
|
||||
* The single source of truth for the relief map M: SurfaceWorld terrain and the
|
||||
* biome climate map both call this, so they agree when given the same freq/contrast.
|
||||
*/
|
||||
float SampleRelief(float WorldX, float WorldY, float Frequency, float Contrast) const;
|
||||
|
||||
/**
|
||||
* Moisture field at a world XY → [0,1]. The second climate axis for biome placement.
|
||||
*/
|
||||
float SampleMoisture(float WorldX, float WorldY, float Frequency) const;
|
||||
|
||||
/**
|
||||
* Resolve the biome at a world XY: dominant cell + nearest neighbour + blend weight.
|
||||
* Warped Voronoi over a jittered grid; each cell's biome is chosen by its site's
|
||||
* (relief, moisture) against the context's climate boxes. PURE function of (XY, seed,
|
||||
* Ctx) — no chunk-window dependence (CODEMAP §8.4). Returns an empty sample when the
|
||||
* context has no biomes. Used by the 2D preview bake and (next) the density path.
|
||||
*/
|
||||
FBiomeSample SampleBiomeAt(float WorldX, float WorldY, const FBiomeContext& Ctx) const;
|
||||
|
||||
/**
|
||||
* Hot-path biome resolve: the dominant + neighbour biome and blend weight at a world
|
||||
* XY for the given strate slice. Uses (and lazily rebuilds) Cache — a box-validated
|
||||
* per-chunk grid — so the noise-heavy cell classification happens once per chunk, not
|
||||
* per voxel. Bit-identical to SampleBiomeAt, so the baked preview matches the terrain.
|
||||
*/
|
||||
FBiomeSample ResolveBiomeSampleAt(float WorldX, float WorldY, int32 ChunkZ,
|
||||
const FBiomeContext& Ctx, FChunkBiomeCache& Cache) const;
|
||||
|
||||
/**
|
||||
* Dominant biome ASSET at a world XY for the given strate slice (chunk Z), or nullptr
|
||||
* when the strate has no biomes / the point is outside the strate range. Game-thread
|
||||
* helper for content + atmosphere selection — uses the same field as the density path.
|
||||
*/
|
||||
const UVoxelBiomeDefinition* GetDominantBiomeAt(float WorldX, float WorldY, int32 ChunkZ) const;
|
||||
|
||||
private:
|
||||
/** Pick the biome (index into Ctx.Biomes) for a Voronoi site, by its climate. */
|
||||
int32 ClassifyBiomeAtSite(float SiteX, float SiteY, const FBiomeContext& Ctx, uint32 SiteHash) const;
|
||||
|
||||
/** The SurfaceWorld heightfield: world XY → terrain surface Z (voxel coords). Pure
|
||||
* per-XY; the part that's evaluated per biome and blended in GetSurfaceDensity. */
|
||||
float ComputeSurfaceTerrainZ(float WorldX, float WorldY, const FSurfaceGenerationParams& Params) const;
|
||||
|
||||
/** The SurfaceWorld sky-cap ceiling surface Z at a world XY (also pure per-XY). */
|
||||
float ComputeSurfaceCeiling(float WorldX, float WorldY, const FSurfaceGenerationParams& Params) const;
|
||||
|
||||
/** Final SurfaceWorld density from a column's precomputed terrain Z + ceiling: the
|
||||
* cheap per-voxel Z-combine + origin spine + boundary seal + passage carving. The
|
||||
* XY-only work (terrain/ceiling) is done once per column and cached (T1.a). */
|
||||
float SurfaceDensityFromColumn(float WorldX, float WorldY, float WorldZ,
|
||||
float TerrainZ, float CeilSurf,
|
||||
const FSurfaceGenerationParams& Structural) const;
|
||||
|
||||
/** (Re)build the per-chunk biome cell grid covering chunk (X,Y) footprint + margin. */
|
||||
void RebuildBiomeGrid(int32 ChunkX, int32 ChunkY, int32 ChunkZ,
|
||||
const FBiomeContext& Ctx, FChunkBiomeCache& Cache) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user