Exemple #1
0
        void Process()
        {
            GLTextuer2D i1 = (GLTextuer2D)input.Input.Data;

            if (i1 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            processor.TileX = 1;
            processor.TileY = 1;

            processor.Intensity = pintensity;
            processor.Process(width, height, i1, buffer);
            processor.Complete();

            previewProcessor.TileX = tileX;
            previewProcessor.TileY = tileY;

            previewProcessor.Process(width, height, buffer, buffer);
            previewProcessor.Complete();

            previewProcessor.TileY = 1;
            previewProcessor.TileX = 1;

            Updated();
            Output.Data = buffer;
            Output.Changed();
        }
        void Process()
        {
            if (!input.HasInput || !input1.HasInput)
            {
                return;
            }

            GLTextuer2D i1 = (GLTextuer2D)input.Reference.Data;
            GLTextuer2D i2 = (GLTextuer2D)input1.Reference.Data;

            if (i1 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }

            if (i2 == null)
            {
                return;
            }
            if (i2.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            if (processor == null || blur == null)
            {
                return;
            }

            processor.TileX     = tileX;
            processor.TileY     = TileY;
            processor.Angle     = pangle * (float)(Math.PI / 180.0f);
            processor.Intensity = pintensity;
            processor.Process(width, height, i1, i2, buffer);
            processor.Complete();

            blur.Intensity = Math.Max(0, bintensity);
            blur.Process(width, height, buffer, buffer);
            blur.Complete();

            output.Data = buffer;
            TriggerTextureChange();
        }
Exemple #3
0
        public override void Render(GLTextuer2D[] inputs, out GLTextuer2D[] outputs)
        {
            outputs = null;

            if (shader == null)
            {
                return;
            }

            if (inputs == null)
            {
                return;
            }

            if (inputs.Length < 2)
            {
                return;
            }

            blur.Intensity = Intensity;
            blur.Process(width, height, inputs[1], inputs[1]);
            blur.Complete();

            Vector2 tiling = new Vector2(1);

            shader.Use();
            shader.SetUniform("MainTex", 0);
            shader.SetUniform("Bloom", 1);
            shader.SetUniform2("tiling", ref tiling);

            IGL.Primary.ActiveTexture((int)TextureUnit.Texture0);
            inputs[0].Bind();

            IGL.Primary.ActiveTexture((int)TextureUnit.Texture1);
            inputs[1].Bind();

            //ensure polygon is actually rendered instead of wireframe during this step
            IGL.Primary.PolygonMode((int)MaterialFace.FrontAndBack, (int)PolygonMode.Fill);

            IGL.Primary.Disable((int)EnableCap.CullFace);

            quad.Draw();

            IGL.Primary.Enable((int)EnableCap.CullFace);

            GLTextuer2D.Unbind();
        }
Exemple #4
0
        void Process()
        {
            GLTextuer2D i1 = (GLTextuer2D)input.Input.Data;
            GLTextuer2D i2 = (GLTextuer2D)input1.Input.Data;

            if (i1 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }

            if (i2 == null)
            {
                return;
            }
            if (i2.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            if (processor == null || blur == null)
            {
                return;
            }

            processor.TileX     = tileX;
            processor.TileY     = TileY;
            processor.Intensity = pintensity;
            processor.Process(width, height, i1, i2, buffer);
            processor.Complete();

            blur.Intensity = Math.Max(0, bintensity);
            blur.Process(width, height, buffer, buffer);
            blur.Complete();

            Updated();
            output.Data = buffer;
            output.Changed();
        }
Exemple #5
0
        public override void Render(GLTextuer2D[] inputs, out GLTextuer2D[] outputs)
        {
            outputs = null;

            if (shader == null)
            {
                return;
            }

            if (inputs == null)
            {
                return;
            }

            if (inputs.Length < 2)
            {
                return;
            }

            blur.Intensity = Intensity;
            blur.Process(width, height, inputs[1], inputs[1]);
            blur.Complete();

            Vector2 tiling = new Vector2(1);

            shader.Use();
            shader.SetUniform("MainTex", 0);
            shader.SetUniform("Bloom", 1);
            shader.SetUniform2("tiling", ref tiling);

            IGL.Primary.ActiveTexture((int)TextureUnit.Texture0);
            inputs[0].Bind();

            IGL.Primary.ActiveTexture((int)TextureUnit.Texture1);
            inputs[1].Bind();

            IGL.Primary.Disable((int)EnableCap.CullFace);

            quad.Draw();

            IGL.Primary.Enable((int)EnableCap.CullFace);

            GLTextuer2D.Unbind();
        }
Exemple #6
0
        void Process()
        {
            GLTextuer2D i1 = (GLTextuer2D)input.Input.Data;

            if (i1 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            processor.TileX = 1;
            processor.TileY = 1;

            int pintensity = intensity;

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Intensity"))
            {
                pintensity = ParentGraph.GetParameterValue <int>(Id, "Intensity");
            }

            processor.Intensity = pintensity;
            processor.Process(width, height, i1, buffer);
            processor.Complete();

            previewProcessor.TileX = tileX;
            previewProcessor.TileY = tileY;

            previewProcessor.Process(width, height, buffer, buffer);
            previewProcessor.Complete();

            previewProcessor.TileY = 1;
            previewProcessor.TileX = 1;

            Updated();
            Output.Data = buffer;
            Output.Changed();
        }
Exemple #7
0
        void Process()
        {
            if (!input.HasInput)
            {
                return;
            }

            GLTextuer2D i1 = (GLTextuer2D)input.Reference.Data;

            if (i1 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            processor.TileX = 1;
            processor.TileY = 1;

            processor.Intensity = pintensity;
            processor.Process(width, height, i1, buffer);
            processor.Complete();

            previewProcessor.TileX = tileX;
            previewProcessor.TileY = tileY;

            previewProcessor.Process(width, height, buffer, buffer);
            previewProcessor.Complete();

            previewProcessor.TileY = 1;
            previewProcessor.TileX = 1;

            Output.Data = buffer;
            TriggerTextureChange();
        }
Exemple #8
0
        void Process()
        {
            GLTextuer2D i1 = (GLTextuer2D)input.Input.Data;

            if (i1 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            int prays = rays;

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Rays"))
            {
                prays = Convert.ToInt32(ParentGraph.GetParameterValue(Id, "Rays"));
            }

            blur.TileX     = 1;
            blur.TileY     = 1;
            blur.Intensity = prays;
            blur.Process(width, height, i1, buffer);
            blur.Complete();
            processor.TileX = tileX;
            processor.TileY = tileY;
            processor.Process(width, height, buffer, i1, buffer);
            processor.Complete();

            Updated();
            Output.Data = buffer;
            Output.Changed();
        }