public sealed class GrassDrawPassBinds the pipeline, the blade and the material a grass field is drawn with.
Remarks
[docs/plan/31 § T6]'s draw, and the half GrassDispatch deliberately does not do. That class owns the scatter, the cull and the argument buffer, and its RecordDraws binds nothing on purpose — a compute dispatch has no business knowing what a blade looks like. This is what knows: the pipeline built from Grass.rvn, the blade mesh, the albedo, and set 2.
⚠ The blades buffer is rebound every frame rather than once. GrassDispatch writes into a ring and the buffer handle is stable, but the descriptor set is per frame-in-flight for the same reason the terrain's is: writing a set a frame in flight is still reading is a race the validation layers catch and the driver does not.
⚠ Two-sided, and that is not a default worth inheriting. A blade is a flat quad seen from both sides as its instance rotates; culling its back faces makes half a field vanish depending on where a person stands, which reads as the scatter being wrong rather than as the raster state being wrong.
Fields and properties (5)
public int DefaultBladeIndicesHow many indices the built-in blade is.
public GrassBladeMesh BladeWhat every instance is drawn from.
public TextureViewHandle AlbedoWhat the blades are textured with, or default for the built-in white.
public int DrawsHow many draws the last Record issued.
public bool HasBladeWhether the last Record had a mesh to draw with.
Methods (4)
public GrassDrawPass(IGraphicsDevice device, TerrainShaders shaders, RenderOutput output)Creates the pass.
public void Prepare(ICommandList commands, GrassDispatch dispatch, in TerrainView view, in GrassWind wind = default(GrassWind), float time = 0, Vector2 tint = default(Vector2), Vector2 fade = default(Vector2))Writes the frame's constants and points the set at this frame's blades.
public int Record(ICommandList commands, GrassDispatch dispatch)Binds everything the draw needs and issues it.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (1)
- GrassDrawPassTestsVixen.Rendering.Terrain.Tests