From 788cc80121ab1fabe6039eb75e7ef39b71874c36 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Thu, 25 Feb 2016 15:56:34 +0200 Subject: [PATCH] light shader now takes into account map size in pixels --- data/shaders/srlight_blur.frag | 4 +++- xmain_d2d.d | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/data/shaders/srlight_blur.frag b/data/shaders/srlight_blur.frag index 6eb9a94..32d7389 100644 --- a/data/shaders/srlight_blur.frag +++ b/data/shaders/srlight_blur.frag @@ -5,6 +5,7 @@ uniform sampler2D tex0; // 1D distance uniform sampler2D tex1; // background uniform vec2 lightTexSize; +uniform vec2 mapPixSize; #define SHADOW_DO_BLUR @@ -18,7 +19,8 @@ uniform vec2 lightTexSize; void main (void) { vec2 vTexCoord0 = gl_TexCoord[0].xy; - vec2 btxy = gl_FragCoord.xy/(100.0*8.0); + //vec2 btxy = gl_FragCoord.xy/(100.0*8.0); + vec2 btxy = gl_FragCoord.xy/mapPixSize; float ltsxi = 1.0/lightTexSize.x; // rectangular to polar diff --git a/xmain_d2d.d b/xmain_d2d.d index 87ddcb7..0fb7652 100644 --- a/xmain_d2d.d +++ b/xmain_d2d.d @@ -90,6 +90,10 @@ void initOpenGL () { fboLevel = new FBO(map.width*8, map.height*8, Texture.Option.Nearest); // final level render will be here fboOrigBack = new FBO(map.width*8, map.height*8, Texture.Option.Nearest); // original background + shadBlur.exec({ + shadBlur["mapPixSize"] = SVec2F(map.width*8, map.height*8); + }); + // build noise texture for liquid shaders /* glActiveTexture(GL_TEXTURE0+1); -- 2.11.4.GIT