Standalone/ (C++20, MSVC /O2 /arch:AVX2 /fp:precise, Build.ps1): copied density pipeline, op stack, cave morphology, passages, strate manager/composer, noise, DetSinCos, mesher, clipmap selection, with a UE compatibility layer (Compat/). Owner data exported once to Standalone/data/owner_world.json by a default-off explore-commandlet exporter (the only plugin-source change). 25 cm voxels. Parity: seed 0, 3,436 samples (strate edges, negative/far coords, rooms, tunnels, passages, landings): bit-identical. Viewer: full 7-level clipmap, per-level toggles 1-7, T = round winding tunnels (standalone option), N/P seed, F wireframe. Timing NOT yet a baseline: 515 s for 12,054 tiles (L0 70 s, L6 296 s); the compat TMap/TSet are vector-backed with linear lookup, which the plugin's caches do not expect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
160 lines
8.1 KiB
C++
160 lines
8.1 KiB
C++
// VoxelBiomeDefinition.h
|
|
// Data asset defining one biome: where it lives (climate), how it reshapes the base
|
|
// terrain (modulation), and what content/atmosphere it brings.
|
|
//
|
|
// HOW TO USE:
|
|
// -----------
|
|
// 1. Content Browser → Miscellaneous → Data Asset → "VoxelBiomeDefinition".
|
|
// 2. Set its climate box (ReliefMin/Max, MoistureMin/Max), its terrain override, and its
|
|
// Decorations / atmosphere / water.
|
|
// 3. Add it to a UVoxelStrateDefinition's Biomes[] list.
|
|
//
|
|
// A biome is generator-agnostic: the same asset works inside any archetype strate
|
|
// (surface biomes today, cave biomes later). The strate's base archetype params are
|
|
// the baseline; this asset modulates on top.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Engine/DataAsset.h"
|
|
#include "GameplayTagContainer.h"
|
|
#include "VoxelBiomeTypes.h"
|
|
#include "VoxelStrateTypes.h" // FStrateDecoration / FStrateAmbientActor
|
|
#include "VoxelBiomeDefinition.generated.h"
|
|
|
|
// IWYU : utilisé en pointeur seulement ⇒ déclaration avant. Le PCH partagé ne la fournit pas :
|
|
// `FPSemantics = Precise` nous en sort. / Pointer-only use, so a forward declaration is enough.
|
|
// The shared PCH does not provide it (FPSemantics = Precise opts this module out of it).
|
|
class UMaterialInterface;
|
|
|
|
/**
|
|
* UVoxelBiomeDefinition — one biome's identity, placement, terrain modulation and content.
|
|
*/
|
|
UCLASS(BlueprintType)
|
|
class VOXELFORGE_API UVoxelBiomeDefinition : public UPrimaryDataAsset
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
//=========================================================================
|
|
// IDENTITY
|
|
//=========================================================================
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Biome")
|
|
FText BiomeName;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Biome", meta = (MultiLine = true))
|
|
FText BiomeDescription;
|
|
|
|
// Colour used by the 2D biome-preview bake to identify this biome's regions.
|
|
// Pick something distinct per biome so the baked map is readable.
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome")
|
|
FLinearColor DebugColor = FLinearColor(0.5f, 0.5f, 0.5f, 1.0f);
|
|
|
|
//=========================================================================
|
|
// CLIMATE PLACEMENT
|
|
//=========================================================================
|
|
// A biome wins the Voronoi cells whose site climate (relief, moisture) falls inside
|
|
// — or, failing any match, nearest to — this box. Both axes are [0,1].
|
|
// Mountains / snow → high ReliefMin. Lush forest → high Moisture.
|
|
// Desert → low Moisture. Plains → mid relief, any moisture.
|
|
// Boxes may overlap; ties are broken deterministically per cell.
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Climate", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float ReliefMin = 0.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Climate", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float ReliefMax = 1.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Climate", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float MoistureMin = 0.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Climate", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float MoistureMax = 1.0f;
|
|
|
|
//=========================================================================
|
|
// TERRAIN OVERRIDE — a biome is a "mini-strate-variant"
|
|
//=========================================================================
|
|
// When enabled, this biome supplies its OWN archetype params for its regions,
|
|
// replacing the strate's. Heightfield archetypes (SurfaceWorld) blend the output
|
|
// across biome borders, so even frequency/shape differences stay seamless.
|
|
// Global/structural fields (strate Z bounds, boundary seal, base density, water
|
|
// level) are always forced from the strate — a biome can't break seals/connectivity.
|
|
//
|
|
// GeneratorType must match the strate this biome is used in; if it doesn't, the
|
|
// override is ignored and the strate's params are used. (Currently wired: SurfaceWorld.
|
|
// Other archetypes' param overrides arrive as each is hooked up — see CODEMAP §8.14.)
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Terrain")
|
|
bool bOverrideTerrain = false;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Terrain",
|
|
meta = (EditCondition = "bOverrideTerrain"))
|
|
ECaveGeneratorType GeneratorType = ECaveGeneratorType::SurfaceWorld;
|
|
|
|
// Open-sky terrain override (used when bOverrideTerrain && GeneratorType == SurfaceWorld).
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Terrain",
|
|
meta = (EditCondition = "bOverrideTerrain && GeneratorType == ECaveGeneratorType::SurfaceWorld"))
|
|
FSurfaceGenerationParams SurfaceParams;
|
|
|
|
//=========================================================================
|
|
// CONTENT PROFILE (consumed by the content / atmosphere managers)
|
|
//=========================================================================
|
|
|
|
// Decorations placed in this biome's regions. When set, these REPLACE the strate's
|
|
// decorations for chunks whose dominant biome is this one (falls back to the strate
|
|
// list when empty).
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Content")
|
|
TArray<FStrateDecoration> Decorations;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Content")
|
|
TArray<FStrateAmbientActor> AmbientActors;
|
|
|
|
//=========================================================================
|
|
// ATMOSPHERE OVERRIDE (optional — beats the strate's atmosphere for this biome)
|
|
//=========================================================================
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Atmosphere")
|
|
bool bOverrideAtmosphere = false;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Atmosphere", meta = (EditCondition = "bOverrideAtmosphere"))
|
|
FLinearColor FogColor = FLinearColor(0.05f, 0.05f, 0.1f, 1.0f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Atmosphere", meta = (EditCondition = "bOverrideAtmosphere", ClampMin = "0.0", ClampMax = "1.0"))
|
|
float FogDensity = 0.3f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Atmosphere", meta = (EditCondition = "bOverrideAtmosphere"))
|
|
FLinearColor AmbientLightColor = FLinearColor(0.1f, 0.1f, 0.15f, 1.0f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Atmosphere", meta = (EditCondition = "bOverrideAtmosphere", ClampMin = "0.0"))
|
|
float AmbientLightIntensity = 0.5f;
|
|
|
|
//=========================================================================
|
|
// WATER
|
|
//=========================================================================
|
|
|
|
// Water material override for this biome (null = use the strate's WaterMaterial).
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Water")
|
|
UMaterialInterface* WaterMaterial = nullptr;
|
|
|
|
//=========================================================================
|
|
// MATERIAL — F6 vertex-colour triplanar palette
|
|
//=========================================================================
|
|
// Which palette layer this biome's terrain uses in the master triplanar material.
|
|
// It is baked into the mesh vertex colour (R channel) at mesh time, so ONE material
|
|
// re-skins the terrain per biome and cross-fades across biome borders (the neighbour
|
|
// biome's index + a blend weight ride in the A/B channels). The terrain material is
|
|
// still the strate's OverrideMaterial / Settings->VoxelMaterial — author it as the
|
|
// master palette material and switch its layers on this index. 0 = default layer.
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Material", meta = (ClampMin = "0", ClampMax = "255"))
|
|
int32 MaterialPaletteIndex = 0;
|
|
|
|
//=========================================================================
|
|
// GAMEPLAY TAGS
|
|
//=========================================================================
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Biome|Gameplay")
|
|
FGameplayTagContainer GameplayTags;
|
|
};
|