#pragma once #include "CoreMinimal.h" #include "ProceduralMeshComponent.h" #include "World/TerrainChunk.h" namespace Descent::World { class FDescentWorldDef; struct FSurfaceNetsInput { const float* Data = nullptr; // P^3 densities const uint8* Cut = nullptr; // P^3 cut amounts FIntVector Key = FIntVector::ZeroValue; const FDescentWorldDef* Def = nullptr; TConstArrayView Deposits; // deposits that may touch the chunk TConstArrayView Exhausted; // parallel: 1 = mined out (its vein no longer shows) }; /** * The mesher (DESIGN_UE.md section 2.4; port of 04_terrain.js meshChunk): surface nets with the gradient normal * blended trilinearly from the eight corners. Static and thread-safe. The 2-sample padding makes neighbouring * chunks produce identical border vertices, so there are no seams. Vertex positions are chunk-local centimetres. */ struct THEDESCENT_API FSurfaceNets { /** Returns false (and an empty section) when the chunk has no surface. */ static bool Mesh(const FSurfaceNetsInput& In, FProcMeshSection& OutSection, int32& OutTriangles); /** Palette colour of the rock at a point (section 2.4), sRGB-encoded. N is the unit normal. */ static FColor RockColor(const FDescentWorldDef& Def, const FVector& Pm, const FVector& N); }; }