Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
RecursiveRenderer.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.Collections.Generic;
4 
5 using SiliconStudio.Core;
6 
7 namespace SiliconStudio.Paradox.Effects
8 {
9  /// <summary>
10  /// This <see cref="Renderer"/> recursively render another <see cref="RenderPass"/>.
11  /// </summary>
12  public class RecursiveRenderer : Renderer
13  {
14  public RecursiveRenderer(IServiceRegistry services, RenderPipeline recursivePipeline) : base(services)
15  {
16  RecursivePipeline = recursivePipeline;
17  }
18 
19  public RenderPipeline RecursivePipeline { get; set; }
20 
21  public override void Load()
22  {
23  base.Load();
24 
25  // Register pipeline
26  RenderSystem.Pipelines.Add(RecursivePipeline);
27  }
28 
29  public override void Unload()
30  {
31  base.Unload();
32 
33  // Unregister pipeline
34  RenderSystem.Pipelines.Remove(RecursivePipeline);
35  }
36 
37  protected override void OnRendering(RenderContext context)
38  {
39  // Save RenderPass
40  var currentPass = context.CurrentPass;
41 
42  RenderSystem.Draw(RecursivePipeline, context);
43 
44  // Restore RenderPass
45  context.CurrentPass = currentPass;
46  }
47  }
48 }
Performs render pipeline transformations attached to a specific RenderPass.
Definition: Renderer.cs:13
RecursiveRenderer(IServiceRegistry services, RenderPipeline recursivePipeline)
A service registry is a IServiceProvider that provides methods to register and unregister services...
This Renderer recursively render another RenderPass.
Thread-local storage context used during rendering.
override void Unload()
Unloads this instance. This method is called when a RenderPass is de-attached (directly or indirectly...
Defines an entry point for mesh instantiation and recursive rendering.
override void OnRendering(RenderContext context)
override void Load()
Loads this instance. This method is called when a RenderPass is attached (directly or indirectly) to ...