Render via an intermediate frame buffer.

This commit is contained in:
Paul Chote
2019-08-28 00:31:08 +01:00
committed by teinarss
parent d2298b6f04
commit c0ee346c1c
5 changed files with 63 additions and 21 deletions

View File

@@ -41,6 +41,8 @@ namespace OpenRA
Size WindowSize { get; }
float WindowScale { get; }
Size SurfaceSize { get; }
event Action<float, float> OnWindowScaleChanged;
void PumpInput(IInputHandler inputHandler);
@@ -62,7 +64,7 @@ namespace OpenRA
IFrameBuffer CreateFrameBuffer(Size s);
IFrameBuffer CreateFrameBuffer(Size s, Color clearColor);
IShader CreateShader(string name);
void EnableScissor(int left, int top, int width, int height);
void EnableScissor(int x, int y, int width, int height);
void DisableScissor();
void SaveScreenshot(string path);
void Present();

View File

@@ -160,9 +160,9 @@ namespace OpenRA.Graphics
shader.SetVec("Scroll", scroll.X, scroll.Y, scroll.Y);
shader.SetVec("r1",
zoom * 2f / screen.Width,
-zoom * 2f / screen.Height,
zoom * 2f / screen.Height,
-depthScale * zoom / screen.Height);
shader.SetVec("r2", -1, 1, 1 - depthOffset);
shader.SetVec("r2", -1, -1, 1 - depthOffset);
// Texture index is sampled as a float, so convert to pixels then scale
shader.SetVec("DepthTextureScale", 128 * depthScale * zoom / screen.Height);