public sealed class FoliageDrawPassBinds the pipeline and the per-frame set a volume's foliage is drawn with.
Remarks
[docs/plan/31 § T5]'s draw, and the half FoliageCullPass deliberately does not do. That class owns the instance table, the two dispatches and the patched argument buffer, and exposes the three buffers a draw needs without binding any of them — a compute dispatch has no business knowing what a pine looks like. This is what knows: the pipeline built from Foliage.rvn, the constants, and set 2.
⚠ The instance id is the survivor slot, and that is the whole indirection. The cull patched each command's firstInstance to its batch's run, so the vertex stage reads survivors[SV_InstanceID] and then the instance it names — no transform is compacted, copied or re-uploaded between the cull and the draw.
⚠ The set is rung by frames in flight, for GrassDrawPass's reason: Prepare is an immediate host memcpy of the constants and a descriptor rewrite, and the frame still in flight is reading both. The storage bindings also move per frame — Commands is one slot of a ring.
⚠ One albedo for the pass, white by default, and that is this increment's honest ceiling. A .vxfoliage names a mesh and nothing about its material; resolving a model's materials into per-type textures is the impostor bake's problem too, and it is owed to the same increment. Until then a forest draws flat-shaded in its tint — which reads as "no material yet" rather than as foliage that is broken.
Fields and properties (5)
public const int VertexBytesHow many bytes one vertex is: position, normal, texcoord.
public TextureViewHandle AlbedoWhat the instances are textured with, or default for the built-in white.
public float AlphaCutoffThe alpha below which a texel is a hole rather than a colour, 0…1.
public int DrawsHow many indirect draws the last Record issued.
public int MissingMeshesHow many batches the last Record skipped for want of a mesh.
Methods (5)
public FoliageDrawPass(IGraphicsDevice device, TerrainShaders shaders, RenderOutput output)Creates the pass.
public void Prepare(ICommandList commands, FoliageCullPass cull, in TerrainView view, Vector2 tint = default(Vector2))Writes the frame's constants and points the set at the cull's buffers.
public int Record(ICommandList commands, FoliageCullPass cull, IReadOnlyDictionary<int, FoliageMesh> meshes)Binds everything the draws need and issues them.
public static FoliageMesh UploadMesh(IGraphicsDevice device, ReadOnlySpan<Vector3> positions, ReadOnlySpan<Vector3> normals, ReadOnlySpan<Vector2> texcoords, ReadOnlySpan<int> indices, string name = "foliage mesh")Interleaves a mesh's arrays into the layout the pipeline reads.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (4)
- FoliageDrawPassTestsVixen.Rendering.Terrain.Tests
- FoliageStandVixen.Rendering.Terrain
- FoliageVelocityPassVixen.Rendering.Terrain
- TerrainSceneRendererVixen.Rendering.Terrain