4 using System.Collections.Generic;
6 using SiliconStudio.Paradox.DataModel;
7 using SiliconStudio.Paradox.Effects.Modules;
8 using SiliconStudio.Paradox.Graphics;
9 using SiliconStudio.Core;
10 using SiliconStudio.Core.Mathematics;
11 using SiliconStudio.Paradox.Shaders;
15 namespace SiliconStudio.
Paradox.Effects
34 SkyBoxColor = skyBoxComposition;
41 internal EffectOld skyboxEffect;
47 return Parameters.Get(TexturingKeys.Texture0);
51 Parameters.Set(TexturingKeys.Texture0, value);
57 public override void Load()
61 skyboxEffect = this.EffectSystemOld.BuildEffect(
"Skybox")
63 .Using(
new BasicShaderPlugin(
66 Compositions =
new Dictionary<string, ShaderSource>() { {
"color", SkyBoxColor}}
68 .InstantiatePermutation();
70 if (OfflineCompilation)
73 Parameters.AddSources(MainPlugin.ViewParameters);
75 var zBackgroundValue = MainTargetPlugin.ClearDepth;
79 -1.0f, 1.0f, zBackgroundValue, 1.0f,
80 1.0f, 1.0f, zBackgroundValue, 1.0f,
81 -1.0f, -1.0f, zBackgroundValue, 1.0f,
82 1.0f, -1.0f, zBackgroundValue, 1.0f,
85 Parameters.RegisterParameter(EffectPlugin.DepthStencilStateKey);
86 Parameters.Set(TexturingKeys.Sampler, GraphicsDevice.SamplerStates.LinearWrap);
89 var quadData =
new Mesh();
100 RenderPass.StartPass += (context) =>
103 context.GraphicsDevice.SetViewport(MainTargetPlugin.Viewport);
106 context.GraphicsDevice.SetRenderTarget(MainTargetPlugin.DepthStencil, MainTargetPlugin.RenderTarget);
109 RenderPass.EndPass += (context) => context.GraphicsDevice.UnsetRenderTargets();
111 var skyboxMesh =
new EffectMesh(skyboxEffect, quadData).KeepAliveBy(
this);
113 if (!MainTargetPlugin.EnableClearTarget && !MainTargetPlugin.EnableClearDepth)
116 description.DepthBufferFunction = CompareFunction.Always;
117 var alwaysWrite = DepthStencilState.New(
GraphicsDevice, description);
118 skyboxMesh.Parameters.Set(EffectPlugin.DepthStencilStateKey, alwaysWrite);
122 skyboxMesh.Parameters.Set(EffectPlugin.DepthStencilStateKey, MainTargetPlugin.DepthStencilState);
125 skyboxMesh.Parameters.AddSources(this.Parameters);
126 RenderSystem.GlobalMeshes.AddMesh(skyboxMesh);
The layout of a vertex buffer with a set of VertexElement.
A mixin performing a combination of ShaderClassSource and other mixins.
Basic shader plugin built directly from shader source file.
SiliconStudio.Paradox.Graphics.Buffer Buffer
All-in-One Buffer class linked SharpDX.Direct3D11.Buffer.
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 Buffer New(GraphicsDevice device, BufferDescription description, PixelFormat viewFormat=PixelFormat.None)
Creates a new Buffer instance.
Represents a four dimensional mathematical vector.
Plugin used for the main rendering view.
static VertexElement Position(PixelFormat format, int offsetInBytes=AppendAligned)
Declares a VertexElement with the semantic "POSITION".
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
SkyBoxPlugin(string name, ShaderSource skyBoxComposition)
SkyBoxPlugin(string name)
Level10 render pass using a depth buffer and a render target.
Describes a depth stencil state.
PrimitiveType
Defines how vertex data is ordered.
A description of a single element for the input-assembler stage. This structure is related to Direct3...
A shader class used for mixin.
Base class for texture resources.
Binding structure that specifies a vertex buffer and other per-vertex parameters (such as offset and ...