public static class FoliageScatterTurning a brush stamp into instances, and the six rules that refuse one.
Remarks
[docs/plan/31 § The palette]'s placement rules, in one pass. A candidate is generated, the surface under it is sampled once, and then: is there ground, is the slope in range, is the altitude in range, is the filtered layer painted enough, and is there already an instance within the type's spacing. What survives is turned by the alignment and the random ranges.
⚠ Deterministic from the stamp and the candidate index, never from an iteration order — [§ D8]'s requirement, and it is what makes an undone-and-redone stroke produce the same forest. A counter-based identity would also make the CPU reference and the GPU scatter impossible to compare, which is the seam test the grass phase needs.
⚠ The spacing check is against what is already placed, including this stamp's own earlier candidates. Checking only the volume would let one stamp drop forty trees on one spot, because none of them was there when the others were tested.
Methods (6)
public static FoliageScatter.Result Stamp(FoliageVolume volume, int type, IFoliageSurface surface, Vector2 centre, float radius, float strength = 1, uint seed = 2654435769, ICollection<FoliageAddress>? placed = null)Scatters one stamp of one type into a volume.
public static FoliageScatter.Refusal Consider(FoliageVolume volume, int type, in FoliageType settings, IFoliageSurface surface, Vector2 at, IReadOnlyList<Vector2> pending, uint hash, out FoliageInstance instance)Whether one candidate would be placed, and what it would be.
public static FoliageInstance Place(in FoliageType settings, in FoliageSurface ground, uint hash)Turns a surface hit into an instance, with the type's randomness applied.
public static FoliageInstance Place(in FoliageSurface ground, uint hash, bool randomYaw, float maxPitch, float minScale, float maxScale, float alignToNormal)Turns a surface hit into an instance, from the ranges rather than from a type.
public static uint Hash(uint seed, int index)A hash of a stamp's seed and a candidate's index.
public static float Unit(uint hash, int stream)One of a hash's several independent 0…1 draws.
Used by (5)
- FoliageGrowthVixen.Foliage
- FoliageScatterTestsVixen.Foliage.Tests
- GrassScatterVixen.Foliage
- GrassScatterParityTestsVixen.Rendering.Terrain.Tests
- FoliageEditVixen.Editor.Terrain