public sealed class FoliageChunkEvery instance of one type inside one cell, and the bounds they occupy.
Remarks
What the instancing feature draws as one object. The bounds are maintained as instances arrive and are recomputed when one leaves, because a cull is only as good as the box it tests — and a cell whose bounds never shrank would keep a whole forest's worth of extent after an artist erased all but one tree.
⚠ One chunk per type per cell, not one per cell. A cell holding three kinds of tree is three batches, because a batch is one mesh — folding them together would mean a draw that has to switch mesh mid-instance, which is not a thing.
Fields and properties (6)
public FoliageCellKey CellWhich cell it is in.
public int TypeWhich type's instances it holds.
public IReadOnlyList<FoliageInstance> InstancesThe instances.
public int CountHow many there are.
public bool IsEmptyWhether there are none.
public BoundingBox BoundsWhere they are, as one box.
Methods (6)
public FoliageChunk(FoliageCellKey cell, int type)Creates an empty chunk.
public void Add(in FoliageInstance instance, float reach = 1)Adds an instance.
public void RemoveAt(int index, float reach = 1)Removes the instance at an index.
public int RemoveAll(Predicate<FoliageInstance> accept, float reach = 1)Removes every instance a predicate accepts.
public void Replace(int index, in FoliageInstance instance, float reach = 1)Replaces the instance at an index.
public void Clear()Empties it.
Used by (12)
- FoliageBlockerTestsVixen.Rendering.Terrain.Tests
- FoliageCullPassVixen.Rendering.Terrain
- FoliageGrowthTestsVixen.Foliage.Tests
- FoliageRendererVixen.Rendering.Terrain
- FoliageScatterTestsVixen.Foliage.Tests
- FoliageStoreVixen.Foliage
- FoliageStreamerVixen.Rendering.Terrain
- FoliageVolumeVixen.Foliage
- FoliageVolumeTestsVixen.Foliage.Tests
- PaletteRemovalTestsVixen.Foliage.Tests
- FoliageModeTestsVixen.Editor.Terrain.Tests
- FoliageStrokeCommandVixen.Editor.Terrain