Expand height brush table for DSL terrain

This commit is contained in:
Meta Vens 2026-05-18 03:05:24 +01:00
commit fa90f95da7
5 changed files with 72 additions and 7 deletions

View file

@ -13,6 +13,14 @@ internal record struct D3D12HeightFieldBrushConstants(
Vector4 CenterRadius5,
Vector4 CenterRadius6,
Vector4 CenterRadius7,
Vector4 CenterRadius8,
Vector4 CenterRadius9,
Vector4 CenterRadius10,
Vector4 CenterRadius11,
Vector4 CenterRadius12,
Vector4 CenterRadius13,
Vector4 CenterRadius14,
Vector4 CenterRadius15,
Vector4 Shape0,
Vector4 Shape1,
Vector4 Shape2,
@ -21,6 +29,14 @@ internal record struct D3D12HeightFieldBrushConstants(
Vector4 Shape5,
Vector4 Shape6,
Vector4 Shape7,
Vector4 Shape8,
Vector4 Shape9,
Vector4 Shape10,
Vector4 Shape11,
Vector4 Shape12,
Vector4 Shape13,
Vector4 Shape14,
Vector4 Shape15,
Vector4 Wave0,
Vector4 Wave1,
Vector4 Wave2,
@ -28,9 +44,17 @@ internal record struct D3D12HeightFieldBrushConstants(
Vector4 Wave4,
Vector4 Wave5,
Vector4 Wave6,
Vector4 Wave7)
Vector4 Wave7,
Vector4 Wave8,
Vector4 Wave9,
Vector4 Wave10,
Vector4 Wave11,
Vector4 Wave12,
Vector4 Wave13,
Vector4 Wave14,
Vector4 Wave15)
{
public const int MaxBrushCount = 8;
public const int MaxBrushCount = 16;
public static D3D12HeightFieldBrushConstants FromBrushes(IReadOnlyList<AquariumHeightFieldBrush> brushes)
{
@ -94,6 +118,46 @@ internal record struct D3D12HeightFieldBrushConstants(
Shape7 = shape;
Wave7 = wave;
break;
case 8:
CenterRadius8 = centerRadius;
Shape8 = shape;
Wave8 = wave;
break;
case 9:
CenterRadius9 = centerRadius;
Shape9 = shape;
Wave9 = wave;
break;
case 10:
CenterRadius10 = centerRadius;
Shape10 = shape;
Wave10 = wave;
break;
case 11:
CenterRadius11 = centerRadius;
Shape11 = shape;
Wave11 = wave;
break;
case 12:
CenterRadius12 = centerRadius;
Shape12 = shape;
Wave12 = wave;
break;
case 13:
CenterRadius13 = centerRadius;
Shape13 = shape;
Wave13 = wave;
break;
case 14:
CenterRadius14 = centerRadius;
Shape14 = shape;
Wave14 = wave;
break;
case 15:
CenterRadius15 = centerRadius;
Shape15 = shape;
Wave15 = wave;
break;
default:
throw new ArgumentOutOfRangeException(nameof(index), index, "Height Field brush index is outside the fixed brush table.");
}

View file

@ -22,9 +22,9 @@ cbuffer AquariumFrame : register(b0)
cbuffer HeightFieldBrushes : register(b1)
{
float4 brushCenterRadius[8];
float4 brushShape[8];
float4 brushWave[8];
float4 brushCenterRadius[16];
float4 brushShape[16];
float4 brushWave[16];
};
struct VertexOut

View file

@ -13,7 +13,7 @@ public static class ZyphosFractalTerrain
# Zyphos first Aquarium fractal terrain DSL proof.
tile PositiveZ 0 0 0 zyphos/first-fractal-terrain
height basin 0 0 30 30 0 3 1 -0.12 7 basin
ifs crater 2 2 -5 3 6 2.5 0.48 2.6 0.42 4 0.85 -0.10 19 crater
ifs crater 3 2 -5 3 6 2.5 0.48 2.6 0.42 4 0.85 -0.10 19 crater
ifs ridge 2 3 6 -4 5 1.35 0.45 3.2 -0.27 3.6 0.72 0.075 31 ridge
""";