Skip to content

RenderTarget

Namespace Nfty.Model.Render in assembly Nfty.Model.

public sealed class RenderTarget

A plain pixel-and-depth surface Raster writes into: one background-filled color per pixel and a z-buffer initialized to "nothing here yet". The array references are fixed at construction (D7); their contents mutate freely as Raster draws. Single owner; not thread-safe.

Constructors

RenderTarget(int, int)

public RenderTarget(int width, int height);

Allocates a RenderTarget.Width × RenderTarget.Height surface. Both dimensions must be positive.

Parameters

  • width (int) - Width in pixels; must be positive.
  • height (int) - Height in pixels; must be positive.

Exceptions

  • ArgumentOutOfRangeException - A dimension is not positive.

Properties

Color

public Rgba32[] Color { get; }

One color per pixel, row-major, length RenderTarget.Width × RenderTarget.Height.

Depth

public float[] Depth { get; }

One depth value per pixel, same shape as RenderTarget.Color. Smaller is closer; PositiveInfinity means nothing has drawn there yet.

Height

public int Height { get; }

Pixels down.

Width

public int Width { get; }

Pixels across.

Methods

Clear(Rgba32)

public void Clear(Rgba32 background);

Resets every pixel to background and every depth to infinity.

Parameters

  • background (Rgba32) - The color to fill with.