Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
RenderPipelineFactory.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 using SiliconStudio.Core;
5 using SiliconStudio.Core.Mathematics;
6 using SiliconStudio.Paradox.Graphics;
7 
8 namespace SiliconStudio.Paradox.Effects
9 {
10  /// <summary>
11  /// Helper class to easily setup various predefined <see cref="RenderPipeline"/>, using <see cref="RenderPipeline.Pipeline"/>.
12  /// </summary>
13  public static class RenderPipelineFactory
14  {
15  public static void CreateSimple(IServiceRegistry serviceRegistry, string effectName, Color clearColor)
16  {
17  if (serviceRegistry == null) throw new ArgumentNullException("serviceRegistry");
18  if (effectName == null) throw new ArgumentNullException("effectName");
19 
20  var renderSystem = serviceRegistry.GetSafeServiceAs<RenderSystem>();
21  var graphicsService = serviceRegistry.GetSafeServiceAs<IGraphicsDeviceService>();
22 
23  var mainPipeline = renderSystem.Pipeline;
24 
25  mainPipeline.Renderers.Add(new CameraSetter(serviceRegistry));
26  mainPipeline.Renderers.Add(new RenderTargetSetter(serviceRegistry)
27  {
28  ClearColor = clearColor,
29  RenderTarget = graphicsService.GraphicsDevice.BackBuffer,
30  DepthStencil = graphicsService.GraphicsDevice.DepthStencilBuffer
31  });
32  mainPipeline.Renderers.Add(new ModelRenderer(serviceRegistry, effectName));
33  mainPipeline.Renderers.Add(new SpriteRenderer(serviceRegistry));
34  }
35 
36  public static void CreateSimple(Game game, string effectName, Color clearColor)
37  {
38  CreateSimple(game.Services, effectName, clearColor);
39  }
40  }
41 }
Helper class to easily setup various predefined RenderPipeline, using RenderPipeline.Pipeline.
Service providing method to access GraphicsDevice life-cycle.
This Renderer is responsible to prepare and render sprites for a specific pass.
A service registry is a IServiceProvider that provides methods to register and unregister services...
A processor that updates camera view and projection along the setup of RenderTargetSetter ...
Definition: CameraSetter.cs:16
Main Game class system.
Definition: Game.cs:32
ServiceRegistry Services
Gets the service container.
Definition: GameBase.cs:308
Renders its RenderSystem.Pipeline, which will usually result in drawing all meshes, UI, etc...
Definition: RenderSystem.cs:18
Represents a 32-bit color (4 bytes) in the form of RGBA (in byte order: R, G, B, A).
Definition: Color.cs:16
This Renderer is responsible to prepare and render meshes for a specific pass.
static void CreateSimple(Game game, string effectName, Color clearColor)
A processor that setup a RenderTarget and a DepthStencil on a RenderPass.
static void CreateSimple(IServiceRegistry serviceRegistry, string effectName, Color clearColor)