Vixen
02b45cc4
csharp
public sealed class FoliageStreamer

Which cells of a foliage volume a frame uploads.

Read the guide page for this →

Remarks

⚠ The window is derived from the volume rather than declared, because a foliage grid has no edges. FoliageCellGrid indexes cells with signed integers and a forest is wherever somebody painted one; StreamingGrid is a rectangle of cells with an origin. So the rectangle is the bounding box of the chunks that exist, recomputed by Rebuild whenever the volume grows past it.

⚠ A cell outside the window is uploaded rather than skipped. That is the safe direction: the window is stale only when somebody has just painted beyond it, and a tree that appears and then is culled normally is a frame of extra work — where the other choice is a tree an artist just placed and cannot see.

Fields and properties (5)

  • public const int PageSource

    What page source a volume's cells are filed under.

  • public int Cells

    How many cells may be uploaded at once.

  • public PageResidency Residency

    The residency service, for its counters.

  • public StreamingGrid Grid

    The grid the cells are decided on, for its lead.

  • public bool Changed

    Whether the resident set moved since it was last accepted.

Methods (6)

  • public FoliageStreamer(FoliageVolume volume, int cells = 512)

    Streams a volume's cells around whatever moves through it.

  • public void Accept()

    Says the resident set has been acted on, so Changed is false again.

  • public bool IsResident(FoliageCellKey cell)

    Whether a cell's instances should be uploaded.

  • public void Rebuild(FoliageVolume volume)

    Rebuilds the window from a volume whose extent has changed.

  • public int Update(ReadOnlySpan<StreamingSource> sources, int maxLoads = 64)

    Tells the pool what this frame's sources want, and services what it can.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (2)

  • FoliageCullPassVixen.Rendering.Terrain
  • FoliageStreamingTestsVixen.Rendering.Terrain.Tests