/// <summary> /// Function to clear the contents of the texture for this view. /// </summary> /// <param name="color">Color to use when clearing the texture unordered access view.</param> /// <param name="rectangles">[Optional] Specifies which regions on the view to clear.</param> /// <remarks> /// <para> /// This will clear the texture unordered access view to the specified <paramref name="color"/>. If a specific region should be cleared, one or more <paramref name="rectangles"/> should be passed /// to the method. /// </para> /// <para> /// If the <paramref name="rectangles"/> parameter is <b>null</b>, or has a zero length, the entirety of the view is cleared. /// </para> /// <para> /// If this method is called with a 3D texture bound to the view, and with regions specified, then the regions are ignored. /// </para> /// </remarks> public void Clear(GorgonColor color, DX.Rectangle[] rectangles) { if ((rectangles == null) || (rectangles.Length == 0)) { Clear(color.Red, color.Green, color.Blue, color.Alpha); return; } if ((_clearRects == null) || (_clearRects.Length < rectangles.Length)) { _clearRects = new RawRectangle[rectangles.Length]; } for (int i = 0; i < rectangles.Length; ++i) { _clearRects[i] = rectangles[i]; } Resource.Graphics.D3DDeviceContext.ClearView(Native, color.ToRawColor4(), _clearRects, rectangles.Length); }
/// <summary> /// Function to clear the contents of the render target for this view. /// </summary> /// <param name="color">Color to use when clearing the render target view.</param> /// <remarks> /// <para> /// This will clear the render target view to the specified <paramref name="color"/>. /// </para> /// </remarks> public void Clear(GorgonColor color) => Graphics.D3DDeviceContext.ClearRenderTargetView(Native, color.ToRawColor4());