Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
DelegateRenderer.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 using System;
4 
5 using SiliconStudio.Core;
6 
7 namespace SiliconStudio.Paradox.Effects
8 {
9  /// <summary>
10  /// A processor that updates camera view and projection along the setup of <see cref="RenderTargetSetter"/>
11  /// </summary>
12  public class DelegateRenderer : Renderer
13  {
14  /// <summary>
15  /// Gets or sets the action to perform when the renderer is loaded.
16  /// </summary>
17  public Action OnLoad { get; set; }
18 
19  /// <summary>
20  /// Gets or sets the action to perform when the renderer is unloaded.
21  /// </summary>
22  public Action OnUnload { get; set; }
23 
24  /// <summary>
25  /// Gets or sets the action to perform on rendering.
26  /// </summary>
27  public Action<RenderContext> Render { get; set; }
28 
29  /// <summary>
30  /// Initializes a new instance of the <see cref="Renderer" /> class.
31  /// </summary>
32  /// <param name="services">The services.</param>
34  : base(services)
35  {
36  }
37 
38  public override void Load()
39  {
40  base.Load();
41 
42  var handler = OnLoad;
43  if (handler != null)
44  handler();
45  }
46 
47  public override void Unload()
48  {
49  base.Unload();
50 
51  var handler = OnUnload;
52  if (handler != null)
53  handler();
54  }
55 
56  protected override void OnRendering(RenderContext context)
57  {
58  var handler = Render;
59  if (handler != null)
60  handler(context);
61  }
62  }
63 }
DelegateRenderer(IServiceRegistry services)
Initializes a new instance of the Renderer class.
Performs render pipeline transformations attached to a specific RenderPass.
Definition: Renderer.cs:13
A service registry is a IServiceProvider that provides methods to register and unregister services...
override void OnRendering(RenderContext context)
Thread-local storage context used during rendering.
override void Load()
Loads this instance. This method is called when a RenderPass is attached (directly or indirectly) to ...
A processor that updates camera view and projection along the setup of RenderTargetSetter ...
override void Unload()
Unloads this instance. This method is called when a RenderPass is de-attached (directly or indirectly...