Vixen
02b45cc4
csharp
public sealed class TerrainSurface

A heightfield answering the question a scatter asks.

Read the guide page for this →

Remarks

The adapter [docs/plan/31 § D1] leaves out of both kernels on purpose. Vixen.Foliage cannot name a terrain — a roof of moss would then depend on a heightfield — and Vixen.Terrain has never heard of a blade of grass. So the join lives in the one assembly that already references both, and it is thirty lines rather than an assembly of its own.

⚠ Outside the terrain is Missed, and the explicit bounds test is not redundant. TerrainPick.HeightAt clamps rather than refusing, which is right for a brush that has to aim somewhere; used unguarded here it would answer for every position in the world, so a field would stretch to the horizon at the height of the terrain's border.

⚠ A layer whose name is not in the stack answers a weight of zero. Nothing grows, which is a field somebody notices and fixes; answering one instead would carpet a whole terrain because of a typo, and would do it on the same day the layer was renamed.

Fields and properties (2)

  • public Vector3 Origin

    Where the terrain's low corner is in world space.

  • public Terrain Terrain

    The terrain being answered for.

Methods (3)

  • public TerrainSurface(Terrain terrain, Vector3 origin = default(Vector3))

    Wraps a terrain.

  • public void Rebind()

    Re-reads the layer names.

  • public FoliageSurface SampleAt(Vector2 position, string layer)

    What the ground is under a world XZ position.

Used by (2)

  • TerrainSurfaceTestsVixen.Rendering.Terrain.Tests
  • TerrainModuleVixen.Editor.Terrain