Esempio n. 1
0
 private void DebugTex(RenderImage src, RenderImage dst)
 {
     CluwneLib.ResetShader();
     dst.BeginDrawing();
     src.Blit(0, 0, dst.Width, dst.Height, BlitterSizeMode.Scale);
     dst.EndDrawing();
 }
Esempio n. 2
0
        private void ApplyHorizontalReduction(RenderImage source, RenderImage destination)
        {
            int         step = reductionChainCount - 1;
            RenderImage src  = source;
            RenderImage HorizontalReduction = reductionRT[step];

            reductionEffectTechnique["HorizontalReduction"].setAsCurrentShader();
            // Disabled GLTexture stuff for now just to get the pipeline working.
            // The only side effect is that floating point precision will be low,
            // making light borders and shit have jaggy edges.
            //GLTexture GLHorizontalReduction = new GLTexture("desto", (int)source.Width, (int)source.Height, ImageBufferFormats.BufferGR1616F);
            //Debug.DebugRendertarget(source);
            while (step >= 0)
            {
                HorizontalReduction = reductionRT[step]; // next step

                HorizontalReduction.BeginDrawing();
                HorizontalReduction.Clear(Color.White);

                //reductionEffectTechnique["HorizontalReduction"].SetParameter("secondTexture", src);
                reductionEffectTechnique["HorizontalReduction"].SetParameter("TextureDimensions", 1.0f / src.Width);

                // Sourcetexture not needed... just blit!
                src.Blit(0, 0, HorizontalReduction.Width, HorizontalReduction.Height, BlitterSizeMode.Scale); // draw SRC to HR
                                                                                                              //fix
                                                                                                              //GLHorizontalReduction.Blit(src.Texture, CluwneLib.CurrentShader);

                HorizontalReduction.EndDrawing();
                src = HorizontalReduction; // hr becomes new src
                //Debug.DebugRendertarget(HorizontalReduction);
                step--;
            }


            CluwneLib.ResetShader();
            //copy to destination
            destination.BeginDrawing();
            destination.Clear(Color.White);

            HorizontalReduction.Blit(0, 0, destination.Height, destination.Width);
            //GLHorizontalReduction.Blit(HorizontalReduction.Texture, CluwneLib.CurrentShader);
            destination.EndDrawing();
            //Debug.DebugRendertarget(destination);
            CluwneLib.ResetRenderTarget();
        }
Esempio n. 3
0
        private void ApplyHorizontalReduction(RenderImage source, RenderImage destination)
        {
            var step = reductionChainCount - 1;
            var src  = source;
            var HorizontalReduction = reductionRT[step];

            reductionEffectTechnique["HorizontalReduction"].setAsCurrentShader();
            // Disabled GLTexture stuff for now just to get the pipeline working.
            // The only side effect is that floating point precision will be low,
            // making light borders and shit have jaggy edges.
            while (step >= 0)
            {
                HorizontalReduction = reductionRT[step]; // next step

                HorizontalReduction.BeginDrawing();
                HorizontalReduction.Clear(Color.White);

                reductionEffectTechnique["HorizontalReduction"].SetUniform("TextureDimensions", 1.0f / src.Width);

                // Sourcetexture not needed... just blit!
                src.Blit(0, 0, HorizontalReduction.Width, HorizontalReduction.Height, BlitterSizeMode.Scale); // draw SRC to HR
                //fix

                HorizontalReduction.EndDrawing();
                src = HorizontalReduction; // hr becomes new src
                step--;
            }

            CluwneLib.ResetShader();
            //copy to destination
            destination.BeginDrawing();
            destination.Clear(Color.White);

            HorizontalReduction.Blit(0, 0, destination.Height, destination.Width);
            destination.EndDrawing();
            CluwneLib.ResetRenderTarget();
        }