Beispiel #1
0
        public override List <RenderCommand> getCommands()
        {
            List <RenderCommand>   ret = new List <RenderCommand>();
            StatelessRenderCommand cmd;

            ret.Add(new PushDebugMarkerCommand("fisheye effect"));

            RenderTarget target1;

            target1 = postPass.nextRenderTarget();

            //target a new render target
            ret.Add(new SetRenderTargetCommand(target1));

            //blur the input image in the horizontal direction
            cmd = new PostEffectRenderCommand(myShader, postPass.view.viewport.width, postPass.view.viewport.height);
            cmd.renderState.setTexture(postPass.previousEffectOutput(this).id(), 0, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            cmd.renderState.setUniform(new UniformData(21, Uniform.UniformType.Float, 180.0f));
            ret.Add(cmd);

            output = target1.buffers[FramebufferAttachment.ColorAttachment0];

            ret.Add(new PopDebugMarkerCommand());

            return(ret);
        }
Beispiel #2
0
        public override List <RenderCommand> getCommands()
        {
            List <RenderCommand>   ret = new List <RenderCommand>();
            StatelessRenderCommand cmd;

            ret.Add(new PushDebugMarkerCommand("fog effect"));

            RenderTarget targetFbo = postPass.nextRenderTarget();

            output = targetFbo.buffers[FramebufferAttachment.ColorAttachment0];
            ret.Add(new SetRenderTargetCommand(targetFbo));

            cmd = new PostEffectRenderCommand(myShader, postPass.view.viewport.width, postPass.view.viewport.height);
            cmd.renderState.setTexture(postPass.previousEffectOutput(this).id(), 0, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            cmd.renderState.setTexture(postPass.sourceDepthBuffer().id(), 1, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(21, Uniform.UniformType.Int, 1));
            cmd.renderState.setUniform(new UniformData(22, Uniform.UniformType.Vec3, fogColor));
            cmd.renderState.setUniform(new UniformData(23, Uniform.UniformType.Float, maxDistance));

            ret.Add(cmd);

            ret.Add(new PopDebugMarkerCommand());
            return(ret);
        }
        public override void getCommands(List <RenderCommand> cmds)
        {
            cmds.Add(new PushDebugMarkerCommand("underwater effect"));
            StatelessRenderCommand cmd;

            RenderTarget targetFbo = postPass.nextRenderTarget();

            output = targetFbo.buffers[FramebufferAttachment.ColorAttachment0];
            cmds.Add(new SetRenderTargetCommand(targetFbo));

            cmd = new PostEffectRenderCommand(myShader, postPass.view.viewport.width, postPass.view.viewport.height);
            cmd.renderState.setTexture(postPass.previousEffectOutput(this).id(), 0, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            cmds.Add(cmd);

            cmds.Add(new PopDebugMarkerCommand());
        }
Beispiel #4
0
        public override void getCommands(List <RenderCommand> cmds)
        {
            StatelessRenderCommand cmd;

            cmds.Add(new PushDebugMarkerCommand("blur effect"));

            RenderTarget target1;
            RenderTarget target2;

            target1 = postPass.nextRenderTarget();
            target2 = postPass.nextRenderTarget();

            //target a new render target
            cmds.Add(new SetRenderTargetCommand(target1));

            //blur the input image in the horizontal direction
            cmd = new PostEffectRenderCommand(myShader, postPass.view.viewport.width, postPass.view.viewport.height);
            cmd.renderState.setTexture(postPass.previousEffectOutput(this).id(), 0, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            cmd.renderState.setTexture(postPass.sourceDepthBuffer().id(), 1, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(21, Uniform.UniformType.Int, 1));
            cmd.renderState.setUniform(new UniformData(22, Uniform.UniformType.Int, 0)); //blur horizontal
            cmds.Add(cmd);

            //target a new render target
            cmds.Add(new SetRenderTargetCommand(target2));

            //blur the previous render target in the vertical direction
            cmd = new PostEffectRenderCommand(myShader, postPass.view.viewport.width, postPass.view.viewport.height);
            cmd.renderState.setTexture(target1.buffers[FramebufferAttachment.ColorAttachment0].id(), 0, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            cmd.renderState.setTexture(postPass.sourceDepthBuffer().id(), 1, TextureTarget.Texture2D);
            cmd.renderState.setUniform(new UniformData(21, Uniform.UniformType.Int, 1));
            cmd.renderState.setUniform(new UniformData(22, Uniform.UniformType.Int, 1)); //blur vertical
            cmds.Add(cmd);

            output = target2.buffers[FramebufferAttachment.ColorAttachment0];

            cmds.Add(new PopDebugMarkerCommand());
        }