Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
RenderStreamPlugin.cs
Go to the documentation of this file.
1 using System;
2 using SiliconStudio.Paradox.Effects.Modules;
3 using SiliconStudio.Paradox.Games;
4 using SiliconStudio.Paradox.Graphics;
6 
7 namespace SiliconStudio.Paradox.Effects
8 {
10  {
11  private DelegateHolder<ThreadContext>.DelegateType startPassAction;
12  private DelegateHolder<ThreadContext>.DelegateType endPassAction;
13 
15  {
16  EnableSetTargets = true;
17  Parameters.RegisterParameter(RenderTargetKeys.StreamTarget);
18  }
19 
20  /// <summary>
21  /// Gets or sets a value indicating whether [enable set targets].
22  /// </summary>
23  /// <value>
24  /// <c>true</c> if [enable set targets]; otherwise, <c>false</c>.
25  /// </value>
26  public bool EnableSetTargets { get; set; }
27 
28  public virtual Buffer StreamTarget
29  {
30  get
31  {
32  return Parameters.Get(RenderTargetKeys.StreamTarget);
33  }
34  set
35  {
36  Parameters.Set(RenderTargetKeys.StreamTarget, value);
37  }
38  }
39 
40 
41  public override void Load()
42  {
43  base.Load();
44 
45  if (OfflineCompilation)
46  return;
47 
48  if (EnableSetTargets)
49  {
50  startPassAction = (threadContext) => threadContext.GraphicsDevice.SetStreamTargets(StreamTarget);
51  endPassAction = (threadContext) => threadContext.GraphicsDevice.SetStreamTargets(null);
52 
53  RenderPass.StartPass += startPassAction;
54  RenderPass.EndPass += endPassAction;
55  }
56  }
57 
58  public override void Unload()
59  {
60  base.Unload();
61 
62  if (OfflineCompilation)
63  return;
64 
65  if (EnableSetTargets)
66  {
67  RenderPass.StartPass -= startPassAction;
68  RenderPass.EndPass -= endPassAction;
69 
70  startPassAction = null;
71  endPassAction = null;
72  }
73  }
74  }
75 }
All-in-One Buffer class linked SharpDX.Direct3D11.Buffer.
SiliconStudio.Paradox.Graphics.Buffer Buffer