// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using SharpDX.Mathematics.Interop;
namespace SharpDX.Direct3D10
{
public partial class RasterizerStage
{
///
/// Get the array of {{viewports}} bound to the {{rasterizer stage}}
///
/// An array of viewports (see ).
/// void RSGetViewports([InOut] int* NumViewports,[Out, Buffer, Optional] D3D10_VIEWPORT* pViewports)
public RawViewport[] GetViewports()
{
int numViewports = 0;
GetViewports(ref numViewports, null);
RawViewport[] viewports = new RawViewport[numViewports];
GetViewports(ref numViewports, viewports);
return viewports;
}
///
/// Get the array of {{viewports}} bound to the {{rasterizer stage}}
///
/// An array of viewports (see ).
/// void RSGetViewports([InOut] int* NumViewports,[Out, Buffer, Optional] D3D10_VIEWPORT* pViewports)
public void GetViewports(RawViewport[] viewports)
{
int numViewports = viewports.Length;
GetViewports(ref numViewports, viewports);
}
///
/// Get the array of {{scissor rectangles}} bound to the {{rasterizer stage}}.
///
/// An array of scissor rectangles (see ).
/// void RSGetScissorRects([InOut] int* NumRects,[Out, Buffer, Optional] D3D10_RECT* pRects)
public RawRectangle[] GetScissorRectangles()
{
int numRects = 0;
GetScissorRects(ref numRects, null);
RawRectangle[] scissorRectangles = new RawRectangle[numRects];
GetScissorRects(ref numRects, scissorRectangles);
return scissorRectangles;
}
///
/// Get the array of {{scissor rectangles}} bound to the {{rasterizer stage}}.
///
/// An array of scissor rectangles (see ).
/// void RSGetScissorRects([InOut] int* NumRects,[Out, Buffer, Optional] D3D10_RECT* pRects)
public void GetScissorRectangles(RawRectangle[] scissorRectangles)
{
int numRects = scissorRectangles.Length;
GetScissorRects(ref numRects, scissorRectangles);
}
///
/// Binds a single scissor rectangle to the rasterizer stage.
///
/// The scissor rectangle to bind.
public void SetScissorRectangles(RawRectangle scissorRectangle)
{
SetScissorRectangles(new RawRectangle[] { scissorRectangle });
}
///
/// Binds a set of scissor rectangles to the rasterizer stage.
///
/// The set of scissor rectangles to bind.
public void SetScissorRectangles(params RawRectangle[] scissorRectangles)
{
SetScissorRects(scissorRectangles.Length, scissorRectangles);
}
///
/// Binds a set of viewports to the rasterizer stage.
///
/// The set of viewports to bind.
public void SetViewports(params RawViewport[] viewports)
{
SetViewports(viewports.Length, viewports);
}
///
/// Binds a single viewport to the rasterizer stage.
///
/// The viewport to bind.
public void SetViewports(RawViewport viewport)
{
SetViewports(new RawViewport[] { viewport });
}
}
}