diff options
author | Jannik Vogel <email@jannikvogel.de> | 2016-05-23 22:53:53 +0200 |
---|---|---|
committer | Jannik Vogel <email@jannikvogel.de> | 2016-05-23 23:28:13 +0200 |
commit | 068bd6f7286e551ac13853dea5a28377b3d286d9 (patch) | |
tree | 8e722ea5fb84f32a2e80a4224cb828183c8881b1 /src/video_core/renderer_opengl/gl_shader_gen.cpp | |
parent | Merge pull request #1837 from wwylele/sync-trap (diff) | |
download | yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.tar yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.tar.gz yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.tar.bz2 yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.tar.lz yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.tar.xz yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.tar.zst yuzu-068bd6f7286e551ac13853dea5a28377b3d286d9.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_gen.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 71d60e69c..8332e722d 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -439,9 +439,7 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) { // If enabled, compute distance attenuation value std::string dist_atten = "1.0"; if (light_config.dist_atten_enable) { - std::string scale = std::to_string(light_config.dist_atten_scale); - std::string bias = std::to_string(light_config.dist_atten_bias); - std::string index = "(" + scale + " * length(-view - " + light_src + ".position) + " + bias + ")"; + std::string index = "(" + light_src + ".dist_atten_scale * length(-view - " + light_src + ".position) + " + light_src + ".dist_atten_bias)"; index = "((clamp(" + index + ", 0.0, FLOAT_255)))"; const unsigned lut_num = ((unsigned)Regs::LightingSampler::DistanceAttenuation + light_config.num); dist_atten = GetLutValue((Regs::LightingSampler)lut_num, index); @@ -549,6 +547,8 @@ struct LightSrc { vec3 diffuse; vec3 ambient; vec3 position; + float dist_atten_bias; + float dist_atten_scale; }; layout (std140) uniform shader_data { |