public sealed class FoliageVolumeEvery instance in a scene, in its cells, with the palette they are instances of.
Remarks
What a FoliageVolume component names — [docs/plan/31 § What the scene sees]. Stored beside the scene rather than inside it, for the merge-conflict reason a heightfield is: a .vxscene is the file two people touch every day, and fifty thousand transforms in it is a file nobody can merge.
⚠ Cells are created on demand and destroyed when they empty. A world of a hundred square kilometres has a hundred thousand cells and instances in a few hundred of them; a dense grid would be the memory cost of a forest for a clearing.
Fields and properties (5)
public FoliageCellGrid GridHow the world is divided.
public IReadOnlyList<FoliageType> PaletteThe types instances here are of, in palette order.
public IEnumerable<FoliageChunk> ChunksEvery chunk that holds anything.
public int InstanceCountHow many instances there are in total.
public int CellCountHow many cells hold anything.
Methods (13)
public FoliageVolume(FoliageCellGrid grid = default(FoliageCellGrid))Creates an empty volume.
public int AddType(FoliageType type)Adds a type to the palette.
public void SetType(int type, FoliageType value)Changes what a palette entry is, keeping every instance of it.
public int CountOf(int type)How many instances of one type there are.
public FoliageChunk? ChunkOf(int type, FoliageCellKey cell)The chunk holding a type's instances in a cell, or null if there are none.
public FoliageAddress Add(int type, in FoliageInstance instance)Places an instance, in whichever cell its position falls in.
public int Remove(IEnumerable<FoliageAddress> addresses)Takes instances back out.
public FoliageAddress Move(FoliageAddress address, in FoliageInstance instance)Moves, turns or resizes one instance.
public FoliageInstance? At(FoliageAddress address)What is at an address, or null if nothing is.
public IEnumerable<FoliageAddress> Within(Vector2 centre, float radius, IReadOnlySet<int>? types = null)Every instance within a radius of a point, in world XZ.
public void Clear()Empties every cell, keeping the palette.
public int ClearType(int type)Empties one type's cells.
public int RemoveType(int type)Removes a palette entry, and every instance of it, renumbering the rest.
Used by (24)
- FoliageBlockerTestsVixen.Rendering.Terrain.Tests
- FoliageCollisionVixen.Foliage
- FoliageCollisionTestsVixen.Foliage.Tests
- FoliageCullPassVixen.Rendering.Terrain
- FoliageCullPassTestsVixen.Rendering.Terrain.Tests
- FoliageGrowthVixen.Foliage
- FoliageGrowthTestsVixen.Foliage.Tests
- FoliageRendererVixen.Rendering.Terrain
- FoliageRendererTestsVixen.Rendering.Terrain.Tests
- FoliageScatterVixen.Foliage
- FoliageScatterTestsVixen.Foliage.Tests
- FoliageStoreVixen.Foliage
- FoliageStreamerVixen.Rendering.Terrain
- FoliageStreamingTestsVixen.Rendering.Terrain.Tests
- FoliageVolumeTestsVixen.Foliage.Tests
- GrassCostsNothingTestsVixen.Foliage.Tests
- PaletteRemovalTestsVixen.Foliage.Tests
- AddFoliageTypeCommandVixen.Editor.Terrain
- FoliageEditVixen.Editor.Terrain
- FoliageModeVixen.Editor.Terrain
- FoliageModeTestsVixen.Editor.Terrain.Tests
- FoliageMoveCommandVixen.Editor.Terrain
- FoliageStrokeCommandVixen.Editor.Terrain
- TerrainModuleVixen.Editor.Terrain