Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GraphicsDeviceExtensions.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 
4 using System;
5 
6 using SiliconStudio.Paradox.Effects;
7 
8 namespace SiliconStudio.Paradox.Graphics
9 {
10  /// <summary>
11  /// Extensions for the <see cref="GraphicsDevice"/>
12  /// </summary>
13  public static class GraphicsDeviceExtensions
14  {
15  /// <summary>
16  /// Draws a fullscreen quad with the specified effect and parameters.
17  /// </summary>
18  /// <param name="device">The device.</param>
19  /// <param name="effect">The effect.</param>
20  /// <param name="parameters">The parameters.</param>
21  /// <exception cref="System.ArgumentNullException">effect</exception>
22  public static void DrawQuad(this GraphicsDevice device, Effect effect, ParameterCollection parameters = null)
23  {
24  if (effect == null) throw new ArgumentNullException("effect");
25 
26  // Apply the effect
27  if (parameters != null)
28  {
29  effect.Apply(device, parameters, false);
30  }
31  else
32  {
33  effect.Apply(device, false);
34  }
35 
36  // Draw a full screen quad
37  device.DrawQuad();
38 
39  // Unapply
40  effect.UnbindResources(device);
41  }
42  }
43 }
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
static void DrawQuad(this GraphicsDevice device, Effect effect, ParameterCollection parameters=null)
Draws a fullscreen quad with the specified effect and parameters.
A container to handle a hierarchical collection of effect variables.