From 23d0b42b5f055a4777c758b12dc9b774a2126543 Mon Sep 17 00:00:00 2001 From: vincentlj Date: Tue, 14 Jan 2014 01:24:28 +0000 Subject: [PATCH] Light: Simplify slightly shader git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@15069 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/shaders/pointlight.frag | 5 +++-- src/graphics/post_processing.cpp | 6 +----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/data/shaders/pointlight.frag b/data/shaders/pointlight.frag index b60cb1005..929b2323d 100644 --- a/data/shaders/pointlight.frag +++ b/data/shaders/pointlight.frag @@ -5,12 +5,13 @@ uniform vec4 center[16]; uniform vec4 col[16]; uniform float energy[16]; uniform float spec; -uniform vec2 screen; uniform mat4 invproj; uniform mat4 viewm; +in vec2 uv; + void main() { - vec2 texc = gl_FragCoord.xy / screen; + vec2 texc = uv; float z = texture2D(ntex, texc).a; vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0f; diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 72f3c88ad..b82356bcb 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -337,7 +337,7 @@ namespace PointLightShader { GLuint Program = 0; GLuint attrib_position, attrib_texcoord; - GLuint uniform_ntex, uniform_center, uniform_col, uniform_energy, uniform_spec, uniform_screen, uniform_invproj, uniform_viewm; + GLuint uniform_ntex, uniform_center, uniform_col, uniform_energy, uniform_spec, uniform_invproj, uniform_viewm; GLuint vao = 0; @@ -352,7 +352,6 @@ namespace PointLightShader uniform_col = glGetUniformLocation(Program, "col[0]"); uniform_energy = glGetUniformLocation(Program, "energy[0]"); uniform_spec = glGetUniformLocation(Program, "spec"); - uniform_screen = glGetUniformLocation(Program, "screen"); uniform_invproj = glGetUniformLocation(Program, "invproj"); uniform_viewm = glGetUniformLocation(Program, "viewm"); @@ -743,8 +742,6 @@ void renderColorLevel(ITexture *in) void PostProcessing::renderPointlight(ITexture *in, const std::vector &positions, const std::vector &colors, const std::vector &energy) { - float width = (float)UserConfigParams::m_width; - float height = (float)UserConfigParams::m_height; if (!PointLightShader::Program) PointLightShader::init(); glEnable(GL_BLEND); @@ -759,7 +756,6 @@ void PostProcessing::renderPointlight(ITexture *in, const std::vector &po glUniform4fv(PointLightShader::uniform_col, 16, colors.data()); glUniform1fv(PointLightShader::uniform_energy, 16, energy.data()); glUniform1f(PointLightShader::uniform_spec, 200); - glUniform2f(PointLightShader::uniform_screen, width, height); glUniformMatrix4fv(PointLightShader::uniform_invproj, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer()); glUniformMatrix4fv(PointLightShader::uniform_viewm, 1, GL_FALSE, irr_driver->getViewMatrix().pointer());