예제 #1
0
        public override void Draw ()
        {
            PrivateRendererContext.EnableDepthTest (false);

            if (InputSlots[0].SlotTexture == null)
                return;

            if (InputSlots[0].SlotTexture.Width != OutputTexture.Width ||
                InputSlots[0].SlotTexture.Height != OutputTexture.Height)
            {
                OutputTexture.Resize (InputSlots[0].SlotTexture.Width, InputSlots[0].SlotTexture.Height);
                //OutputTexture.Bind(0);
            }

            PrivateRendererContext.Clear (Math.Color4.Black);

            Sprite spr = new Sprite();
            spr.Init (InputSlots[0].SlotTexture);

            spr.CustomEffect = true;

            if (WarpTexture != null)
                WarpTexture.Bind (1);

            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("input"), 0);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("warpFactor"), WarpFactor);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("timer"),
                timer / 10000);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("warpTexture"), 1);

            PrivateRendererContext.DrawSpriteAbsolute (spr);

            PrivateRendererContext.EnableDepthTest (true);
        }
        public override void Draw()
        {
            PrivateRendererContext.EnableDepthTest(false);

            if (InputSlots[0].SlotTexture == null)
                return;

            if (InputSlots[1].SlotTexture.Width != OutputTexture.Width || InputSlots[1].SlotTexture.Height != OutputTexture.Height)
            {
                OutputTexture.Resize(InputSlots[1].SlotTexture.Width, InputSlots[1].SlotTexture.Height);
            }

            PrivateRendererContext.Clear(Math.Color4.Black);

            Sprite spr1 = new Sprite();
            spr1.Init(InputSlots[0].SlotTexture);

            Sprite spr2 = new Sprite();
            spr2.Init(InputSlots[1].SlotTexture);

            PrivateRendererContext.DrawSpriteAbsolute(spr1);
            PrivateRendererContext.DrawSpriteAbsolute(spr2);

            PrivateRendererContext.EnableDepthTest(true);
        }
        public override void Draw ()
        {
            PrivateRendererContext.EnableDepthTest (false);

            if (InputSlots[0].SlotTexture == null)
                return;

            if (InputSlots[0].SlotTexture.Width != OutputTexture.Width ||
                InputSlots[0].SlotTexture.Height != OutputTexture.Height)
            {
                OutputTexture.Resize (InputSlots[0].SlotTexture.Width, InputSlots[0].SlotTexture.Height);
                //OutputTexture.Bind(0);
            }

            PrivateRendererContext.Clear (Math.Color4.Black);

            Sprite spr = new Sprite();
            spr.Init (InputSlots[0].SlotTexture);

            spr.CustomEffect = true;

            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("input"), 0);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("hue"), Hue);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("saturation"), Saturation);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("lightness"), Lightness);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("gamma"), Gamma);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("contrast"), Contrast);
            NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("brightness"), Brightness);

            PrivateRendererContext.DrawSpriteAbsolute (spr);

            PrivateRendererContext.EnableDepthTest (true);
        }
예제 #4
0
        public Texture2D Copy()
        {
            Texture2D tex = Renderer.CreateTexture2D (this.Name + "_Copy", this.Width, this.Height, false, IntPtr.Zero);

            FrameBuffer framebuffer = Renderer.CreateFrameBuffer ("bla_temp_fb");
            framebuffer.AddTexture (tex, FrameBuffer.AttachmentUsage.Color0);

            framebuffer.UseAttachments (new FrameBuffer.AttachmentUsage[]{ FrameBuffer.AttachmentUsage.Color0 });
            framebuffer.Bind (FrameBuffer.FrameBufferTarget.Both);

            framebuffer.Unbind ();

            Sprite spr = new Sprite ();
            spr.Init (this);

            spr.RelativePosition = new FreezingArcher.Math.Vector2 (0.0f, 0.0f);

            Renderer.DrawSpriteRelative (spr);

            spr.Destroy ();

            framebuffer.Unbind ();

            Renderer.DeleteGraphicsResourceAsync (framebuffer);

            return tex;
        }
예제 #5
0
        public virtual void Bypass()
        {
            Begin();
            Sprite spr = new Sprite();
            spr.AbsolutePosition = new FreezingArcher.Math.Vector2(0, 0);
            spr.CustomEffect = false;

            try
            {
                spr.Init(InputSlots[0].SlotTexture);
            }catch{}

            PrivateRendererContext.DrawSpriteAbsolute(spr);

            End();

            Rendered = true;
        }
예제 #6
0
        public virtual void Draw()
        {
            PrivateRendererContext.Clear(FreezingArcher.Math.Color4.Black);

            Sprite spr = new Sprite();
            spr.AbsolutePosition = new FreezingArcher.Math.Vector2(0, 0);
            spr.CustomEffect = false;

            //Just stub texture.... all others need to be binded too
            spr.Init(InputSlots[0].SlotTexture);

            foreach(CompositorInputSlot cis in InputSlots)
            {
                if (cis.SlotTexture != null)
                    cis.SlotTexture.Bind(cis.SlotNumber);
            }

            PrivateRendererContext.DrawSpriteAbsolute(spr);
        }