Beispiel #1
0
 public BatchedPositionedSpriteRenderer(IRenderCallback <TRenderTile, TContext> parent)
 {
     this.parent       = parent ?? throw new ArgumentNullException(nameof(parent));
     spritesPreOffset  = new BatchBuffer <PositionedSprite>(new PositionedSpriteComparer());
     spritesPostOffset = new BatchBuffer <PositionedSprite>(new PositionedSpriteComparer());
     drawDelegate      = DrawTile;
 }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public LightManager()
        {
            Lights = new List <Light>();
            Walls  = new List <Wall>();


            Buffer = BatchBuffer.CreatePositionColorBuffer();
        }
Beispiel #3
0
        public BaseEffect(Backend backend, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
        {
            if (backend == null)
                throw new ArgumentNullException("backend");
            if (resourceManager == null)
                throw new ArgumentNullException("resourceManager");
            if (quadMesh == null)
                throw new ArgumentNullException("quadMesh");

            Backend = backend;
            ResourceManager = resourceManager;
            QuadMesh = quadMesh;
        }
Beispiel #4
0
        public PostEffectManager(Common.IO.FileSystem fileSystem, Common.ResourceManager resourceManager, Backend backend, int width, int height)
        {
            if (fileSystem == null)
                throw new ArgumentNullException("fileSystem");
            if (resourceManager == null)
                throw new ArgumentNullException("resourceManager");
            if (backend == null)
                throw new ArgumentNullException("backend");

            ResourceManager = resourceManager;
            Backend = backend;

            RenderTargetManager = new Post.RenderTargetManager(Backend);

            TemporaryRenderTargets[0] = Backend.CreateRenderTarget("post_0", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0)
            }));

            TemporaryRenderTargets[1] = Backend.CreateRenderTarget("post_1", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0)
            }));

            QuadMesh = Backend.CreateBatchBuffer();
            QuadMesh.Begin();
            QuadMesh.AddQuad(new Vector2(-1, -1), new Vector2(2, 2), Vector2.Zero, new Vector2(1, 1));
            QuadMesh.End();

            Sprite = Backend.CreateSpriteBatch();

            // Setup effects
            ScreenSpaceReflections = new Effects.ScreenSpaceReflections(Backend, ResourceManager, QuadMesh);
            AdaptLuminance = new Effects.AdaptLuminance(Backend, ResourceManager, QuadMesh);
            Bloom = new Effects.Bloom(Backend, ResourceManager, QuadMesh);
            LensFlares = new Effects.LensFlares(Backend, ResourceManager, QuadMesh);
            Tonemap = new Effects.Tonemap(Backend, ResourceManager, QuadMesh);
            Gamma = new Effects.Gamma(Backend, ResourceManager, QuadMesh);
            FXAA = new Effects.FXAA(Backend, ResourceManager, QuadMesh);
            SMAA = new Effects.SMAA(Backend, fileSystem, ResourceManager, QuadMesh);

            // Default settings
            HDRSettings.KeyValue = 0.115f;
            HDRSettings.AdaptationRate = 0.5f;
            HDRSettings.BlurSigma = 3.0f;
            HDRSettings.BloomThreshold = 9.0f;
            HDRSettings.EnableBloom = true;
            HDRSettings.EnableLensFlares = true;

            ScreenSpaceReflectionsSettings.Enable = false;
        }
Beispiel #5
0
        public Tonemap(Backend backend, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
            : base(backend, resourceManager, quadMesh)
        {
            Shader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/tonemap");

            BlurSampler = Backend.RenderSystem.CreateSampler(new Dictionary<SamplerParameterName, int>
            {
                { SamplerParameterName.TextureMinFilter, (int)TextureMinFilter.Linear },
                { SamplerParameterName.TextureMagFilter, (int)TextureMagFilter.Linear },
                { SamplerParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge },
                { SamplerParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge }
            });

            Samplers = new int[] { Backend.DefaultSamplerNoFiltering, Backend.DefaultSamplerNoFiltering, BlurSampler, BlurSampler };
        }
Beispiel #6
0
        public SMAA(Backend backend, Common.IO.FileSystem fileSystem, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
            : base(backend, resourceManager, quadMesh)
        {
            var width = Backend.Width;
            var height = Backend.Height;

            var pixelSizeDefine = string.Format("SMAA_PIXEL_SIZE float2(1.0 / {0}, 1.0 / {1})", Common.StringConverter.ToString(width), Common.StringConverter.ToString(height));
            var qualities = new string[] { "SMAA_PRESET_LOW", "SMAA_PRESET_MEDIUM", "SMAA_PRESET_HIGH", "SMAA_PRESET_ULTRA" };

            for (var i = 0; i < 4; i++ )
            {
                var defines = pixelSizeDefine + ";" + qualities[i] + " 1";

                EdgeShader[i] = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/smaa_edge", defines);
                BlendShader[i] = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/smaa_blend", defines);
                NeighborhoodShader[i] = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/smaa_neighborhood", defines);
            }

            LinearClampSampler = Backend.RenderSystem.CreateSampler(new Dictionary<SamplerParameterName, int>
            {
                { SamplerParameterName.TextureMinFilter, (int)TextureMinFilter.Linear },
                { SamplerParameterName.TextureMagFilter, (int)TextureMagFilter.Linear },
                { SamplerParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge },
                { SamplerParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge }
            });

            NearClampSampler = Backend.RenderSystem.CreateSampler(new Dictionary<SamplerParameterName, int>
            {
                { SamplerParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest },
                { SamplerParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest },
                { SamplerParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge },
                { SamplerParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge }
            });

            AreaTexture = Backend.CreateTexture("/textures/smaa_area", 160, 560, PixelFormat.Rg, PixelInternalFormat.Rg8, PixelType.UnsignedByte, GetRawTexture(fileSystem, "/textures/smaa_area.raw"), false);
            SearchTexture = Backend.CreateTexture("/textures/smaa_search", 66, 33, PixelFormat.Red, PixelInternalFormat.R8, PixelType.UnsignedByte, GetRawTexture(fileSystem, "/textures/smaa_search.raw"), false);

            EdgeRenderTarget = Backend.CreateRenderTarget("smaa_edge", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
            }));

            BlendRenderTarget = Backend.CreateRenderTarget("smaa_blend", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
            }));
        }
Beispiel #7
0
        public LensFlares(Backend backend, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
            : base(backend, resourceManager, quadMesh)
        {
            HighPassShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/highpass");
            BlurHorizontalShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/blur", "BLUR_HORIZONTAL");
            BlurVerticalShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/blur", "BLUR_VERTICAL");
            QuadShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/quad");
            LensFlaresShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/lensflares");

            // Setup rendertargets
            var width = backend.Width;
            var height = backend.Height;

            BlurTargets = new RenderTarget[]
            {
                Backend.CreateRenderTarget("blur_down_src", new Definition(width, height, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("blur_down_2", new Definition(width / 2, height / 2, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("blur_down_4", new Definition(width / 4, height / 4, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("blur_down8_1", new Definition(width / 8, height / 8, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("blur_down8_2", new Definition(width / 8, height / 8, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                })),
            };

            BlurSampler = Backend.RenderSystem.CreateSampler(new Dictionary<SamplerParameterName, int>
            {
                { SamplerParameterName.TextureMinFilter, (int)TextureMinFilter.Linear },
                { SamplerParameterName.TextureMagFilter, (int)TextureMagFilter.Linear },
                { SamplerParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge },
                { SamplerParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge }
            });
        }
Beispiel #8
0
        /// <summary>
        /// Draws the light
        /// </summary>
        public void Render(BatchBuffer buffer)
        {
            if (buffer == null)
            {
                return;
            }

            buffer.AddPoint(Location, Color);

            Point point = Point.Empty;

            for (int i = 0; i <= Resolution; i++)
            {
                float angle = i * 2.0f * (float)Math.PI / Resolution;

                point.X = (int)(Location.X + Math.Cos(angle) * Radius);
                point.Y = (int)(Location.Y + Math.Sin(angle) * Radius);

                buffer.AddPoint(point, Color.FromArgb(0, Color));
            }
            int count = buffer.Update();

            Display.DrawBatch(buffer, PrimitiveType.TriangleFan, 0, count);
        }
Beispiel #9
0
        public AdaptLuminance(Backend backend, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
            : base(backend, resourceManager, quadMesh)
        {
            LuminanceMapShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/luminance_map");
            AdaptLuminanceShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/adapt_luminance");

            // Setup render targets
            LuminanceTarget = Backend.CreateRenderTarget("avg_luminance", new Definition(1024, 1024, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.R32f, Renderer.PixelType.Float, 0, true),
            }));

            AdaptLuminanceTargets = new RenderTarget[]
            {
                Backend.CreateRenderTarget("adapted_luminance_0", new Definition(1, 1, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.R16f, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("adapted_luminance_1", new Definition(1, 1, false, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.R16f, Renderer.PixelType.Float, 0),
                }))
            };
        }
Beispiel #10
0
 public Gamma(Backend backend, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
     : base(backend, resourceManager, quadMesh)
 {
     Shader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/gamma");
 }
Beispiel #11
0
        /// <summary>
        /// Loads contents
        /// </summary>
        public override void LoadContent()
        {
            Display.RenderState.ClearColor = Color.CornflowerBlue;



            // Shader
            Shader         = Shader.CreateTextureShader();
            Display.Shader = Shader;


            #region Texture

            // Loads a texture and binds it to TUI 2
            Texture = new Texture2D("data/texture.png");
            Texture.HorizontalWrap = TextureWrapFilter.Repeat;
            Texture.VerticalWrap   = TextureWrapFilter.Repeat;
            Display.TextureUnit    = 2;
            Display.Texture        = Texture;

            #endregion

            // Matrices
            ModelViewMatrix  = Matrix4.LookAt(new Vector3(0, 0, 1), new Vector3(0, 0, 0), new Vector3(0, 1, 0));;
            ProjectionMatrix = Matrix4.CreateOrthographicOffCenter(0, Display.ViewPort.Width, Display.ViewPort.Height, 0, -1.0f, 1.0f);
            TextureMatrix    = Matrix4.Scale(1.0f / Texture.Size.Width, 1.0f / Texture.Size.Height, 1.0f);

            #region Buffer


            // Indices
            uint[] indices = new uint[]
            {
                0, 1, 2,
                1, 2, 3
            };

            Index = new IndexBuffer();
            Index.Update(indices);


            // Creates a position, color, texture buffer
            Buffer = BatchBuffer.CreatePositionColorTextureBuffer();


            // Vertex elements
            float[] vertices = new float[]
            {
                // Coord						Color							Texture
                100.0f, 100.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
                500.0f, 100.0f, 0.0f, 1.0f, 0.0f, 1.0f, 256.0f, 0.0f,
                100.0f, 500.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 256.0f,
                500.0f, 500.0f, 1.0f, 1.0f, 1.0f, 1.0f, 256.0f, 256.0f
            };
            Buffer.SetVertices(vertices);


            // Or set data one by one
            Buffer.AddPoint(new Point(100, 100), Color.FromArgb(255, 0, 0), new Point(0, 0));
            Buffer.AddPoint(new Point(500, 100), Color.FromArgb(0, 255, 0), new Point(256, 0));
            Buffer.AddPoint(new Point(100, 500), Color.FromArgb(0, 0, 255), new Point(0, 256));
            Buffer.AddPoint(new Point(500, 500), Color.FromArgb(255, 255, 255), new Point(256, 256));
            Buffer.Update();


            #region VAO

            //Batch = new BatchBuffer();


            //VertexBuffer.Bind(0, 2);
            //Shader.BindAttrib(0, "in_position");

            //ColorBuffer.Bind(1, 4);
            //Shader.BindAttrib(1, "in_color");


            //GL.BindVertexArray(0);

            #endregion

            #endregion


            #region Font

            SpriteBatch = new Graphic.SpriteBatch();
            Font        = BitmapFont.CreateFromTTF("c:\\windows\\fonts\\verdana.ttf", 16, FontStyle.Regular);

            #endregion
        }
Beispiel #12
0
        public DeferredRenderer(Common.ResourceManager resourceManager, Backend backend, int width, int height)
        {
            if (resourceManager == null)
                throw new ArgumentNullException("resourceManager");
            if (backend == null)
                throw new ArgumentNullException("backend");

            Settings.ShadowQuality = ShadowQuality.High;
            Settings.EnableShadows = true;
            Settings.ShadowRenderDistance = 128.0f;

            ResourceManager = resourceManager;
            Backend = backend;

            ScreenSize = new Vector2(width, height);

            GBuffer = Backend.CreateRenderTarget("gbuffer", new Definition(width, height, true, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.UnsignedByte, 1),
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 2),
                new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent24, Renderer.PixelType.Float, 0)
            }));

            LightAccumulation = Backend.CreateRenderTarget("light_accumulation", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0),
                new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent24, Renderer.PixelType.Float, 0)
            }));

            Temporary = Backend.CreateRenderTarget("deferred_temp", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0)
            }));

            Output = Backend.CreateRenderTarget("deferred_output", new Definition(width, height, false, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Color, Renderer.PixelFormat.Rgba, Renderer.PixelInternalFormat.Rgba16f, Renderer.PixelType.Float, 0)
            }));

            SpotShadowsRenderTarget = Backend.CreateRenderTarget("spot_shadows", new Definition(512, 512, true, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent16, Renderer.PixelType.Float, 0),
            }));

            PointShadowsRenderTarget = Backend.CreateRenderTarget("point_shadows", new Definition(512, 512, true, new List<Definition.Attachment>()
            {
                new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent16, Renderer.PixelType.Float, 0),
            }, true));

            int cascadeResolution = 2048;
            DirectionalShadowsRenderTarget = new RenderTarget[]
            {
                Backend.CreateRenderTarget("directional_shadows_csm0", new Definition(cascadeResolution, cascadeResolution, true, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent16, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("directional_shadows_csm1", new Definition(cascadeResolution, cascadeResolution, true, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent16, Renderer.PixelType.Float, 0),
                })),
                Backend.CreateRenderTarget("directional_shadows_csm2", new Definition(cascadeResolution, cascadeResolution, true, new List<Definition.Attachment>()
                {
                    new Definition.Attachment(Definition.AttachmentPoint.Depth, Renderer.PixelFormat.DepthComponent, Renderer.PixelInternalFormat.DepthComponent16, Renderer.PixelType.Float, 0),
                }))
            };

            AmbientLightShader = ResourceManager.Load<Triton.Graphics.Resources.ShaderProgram>("/shaders/deferred/ambient");

            // Init light shaders
            var lightTypes = new string[] { "DIRECTIONAL_LIGHT", "POINT_LIGHT", "SPOT_LIGHT" };
            var lightPermutations = new string[] { "NO_SHADOWS", "SHADOWS;SHADOW_QUALITY_LOWEST", "SHADOWS;SHADOW_QUALITY_LOW", "SHADOWS;SHADOW_QUALITY_MEDIUM", "SHADOWS;SHADOW_QUALITY_HIGH" };

            LightShaders = new Resources.ShaderProgram[lightTypes.Length * lightPermutations.Length];
            LightParams = new LightParams[lightTypes.Length * lightPermutations.Length];

            for (var l = 0; l < lightTypes.Length; l++)
            {
                var lightType = lightTypes[l];
                for (var p = 0; p < lightPermutations.Length; p++)
                {
                    var index = l * lightPermutations.Length + p;
                    var defines = lightType + ";" + lightPermutations[p];

                    if (lightType == "POINT_LIGHT")
                        defines += ";SHADOWS_CUBE";

                    LightShaders[index] = ResourceManager.Load<Triton.Graphics.Resources.ShaderProgram>("/shaders/deferred/light", defines);
                    LightParams[index] = new LightParams();
                }
            }

            DirectionalShaderOffset = 0;
            PointLightShaderOffset = 1 * lightPermutations.Length;
            SpotLightShaderOffset = 2 * lightPermutations.Length;

            CombineShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/deferred/combine");
            RenderShadowsShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/deferred/render_shadows");
            RenderShadowsSkinnedShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/deferred/render_shadows", "SKINNED");
            RenderShadowsCubeShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/deferred/render_shadows_cube");
            RenderShadowsSkinnedCubeShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/deferred/render_shadows_cube", "SKINNED");
            FogShader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/deferred/fog");

            RandomNoiseTexture = ResourceManager.Load<Triton.Graphics.Resources.Texture>("/textures/random_n");

            QuadMesh = Backend.CreateBatchBuffer();
            QuadMesh.Begin();
            QuadMesh.AddQuad(new Vector2(-1, -1), new Vector2(2, 2), Vector2.Zero, new Vector2(1, 1));
            QuadMesh.End();

            UnitSphere = ResourceManager.Load<Triton.Graphics.Resources.Mesh>("/models/unit_sphere");
            UnitCone = ResourceManager.Load<Triton.Graphics.Resources.Mesh>("/models/unit_cone");

            AmbientRenderState = Backend.CreateRenderState(true, false, false, Triton.Renderer.BlendingFactorSrc.One, Triton.Renderer.BlendingFactorDest.One);
            LightAccumulatinRenderState = Backend.CreateRenderState(true, false, false, Triton.Renderer.BlendingFactorSrc.One, Triton.Renderer.BlendingFactorDest.One);
            ShadowsRenderState = Backend.CreateRenderState(false, true, true);
            DirectionalRenderState = Backend.CreateRenderState(true, false, false, Triton.Renderer.BlendingFactorSrc.One, Triton.Renderer.BlendingFactorDest.One, Renderer.CullFaceMode.Back, true, Triton.Renderer.DepthFunction.Lequal);
            LightInsideRenderState = Backend.CreateRenderState(true, false, false, Triton.Renderer.BlendingFactorSrc.One, Triton.Renderer.BlendingFactorDest.One, Triton.Renderer.CullFaceMode.Front, true, Renderer.DepthFunction.Gequal);
            LightOutsideRenderState = Backend.CreateRenderState(true, false, false, Triton.Renderer.BlendingFactorSrc.One, Triton.Renderer.BlendingFactorDest.One, Renderer.CullFaceMode.Back, true, Triton.Renderer.DepthFunction.Lequal);

            ShadowSampler = Backend.RenderSystem.CreateSampler(new Dictionary<Renderer.SamplerParameterName, int>
            {
                { SamplerParameterName.TextureMinFilter, (int)TextureMinFilter.Linear },
                { SamplerParameterName.TextureMagFilter, (int)TextureMinFilter.Linear },
                { SamplerParameterName.TextureCompareFunc, (int)DepthFunction.Lequal },
                { SamplerParameterName.TextureCompareMode, (int)TextureCompareMode.CompareRToTexture },
                { SamplerParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge },
                { SamplerParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge }
            });
        }
 public ScreenSpaceReflections(Backend backend, Common.ResourceManager resourceManager, BatchBuffer quadMesh)
     : base(backend, resourceManager, quadMesh)
 {
     Shader = ResourceManager.Load<Resources.ShaderProgram>("/shaders/post/screenspacereflections");
 }