Пример #1
0
        public bool RenderTransition(IFrameBuffer from, IFrameBuffer to)
        {
            if (_tween.Task.IsCompleted)
            {
                return(false);
            }
            _visitTween();
            var oldShader = AGSGame.Shader;

            _screenVectors.Render(to.Texture);
            var shader = GLShader.FromText(_graphics.GetStandardVertexShader(), FRAGMENT_SHADER, _graphics).Compile();

            if (shader == null)
            {
                return(false);
            }
            shader.Bind();
            if (!shader.SetVariable("time", _time))
            {
                shader.Unbind();
                return(false);
            }
            _screenVectors.Render(from.Texture);

            if (oldShader != null)
            {
                oldShader.Bind();
            }
            else
            {
                shader.Unbind();
            }

            return(true);
        }
Пример #2
0
 public void Start()
 {
     _previousShader       = getActiveShader();
     _taskCompletionSource = new TaskCompletionSource <object> (null);
     _shakeShader          = GLShader.FromText(VERTEX_SHADER_SHAKE,
                                               _graphics.GetStandardFragmentShader(), _graphics);
     AGSGame.Game.Events.OnBeforeRender.Subscribe(onBeforeRender);
     setActiveShader(_shakeShader);
 }
Пример #3
0
		private static void unbindVignetteShader()
		{
			var shader = _vignetteShader;
			if (shader == null) return;
			AGSGame.Game.Events.OnScreenResize.Unsubscribe(onVignetteShaderResize);
			_vignetteShader = null;
		}
Пример #4
0
		public static void SetVignetteShader()
		{
			_vignetteShader = GLShader.FromText(getVertexShader(), FRAGMENT_SHADER_VIGNETTE);
			AGSGame.Game.Events.OnBeforeRender.Subscribe(firstSetupVignette);
			AGSGame.Shader = _vignetteShader;
		}