diff options
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 6 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_gles2.h | 4 | ||||
-rw-r--r-- | drivers/gles2/shaders/copy.glsl | 30 |
3 files changed, 18 insertions, 22 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 3c543365f0..25c0f8925d 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -4199,7 +4199,7 @@ void RasterizerGLES2::set_camera(const Transform &p_world, const CameraMatrix &p void RasterizerGLES2::add_light(RID p_light_instance) { -#define LIGHT_FADE_TRESHOLD 0.05 +#define LIGHT_FADE_THRESHOLD 0.05 ERR_FAIL_COND(light_instance_count >= MAX_SCENE_LIGHTS); @@ -6481,7 +6481,7 @@ void RasterizerGLES2::_process_glow_bloom() { copy_shader.bind(); copy_shader.set_uniform(CopyShaderGLES2::BLOOM, float(current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM])); - copy_shader.set_uniform(CopyShaderGLES2::BLOOM_TRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD])); + copy_shader.set_uniform(CopyShaderGLES2::BLOOM_THRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_THRESHOLD])); glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE), 0); if (current_vd && current_env->fx_enabled[VS::ENV_FX_HDR]) { @@ -6491,7 +6491,7 @@ void RasterizerGLES2::_process_glow_bloom() { copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_EXPOSURE, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE])); copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_WHITE])); //copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,1.0); - copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_TRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD])); + copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_THRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_THRESHOLD])); copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_SCALE, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE])); glActiveTexture(GL_TEXTURE0); diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index e6b76a4e92..e86d3ba298 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -689,14 +689,14 @@ class RasterizerGLES2 : public Rasterizer { fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH] = 1.0; fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE] = 0; fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM] = 0.0; - fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD] = 0.5; + fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_THRESHOLD] = 0.5; fx_param[VS::ENV_FX_PARAM_DOF_BLUR_PASSES] = 1; fx_param[VS::ENV_FX_PARAM_DOF_BLUR_BEGIN] = 100.0; fx_param[VS::ENV_FX_PARAM_DOF_BLUR_RANGE] = 10.0; fx_param[VS::ENV_FX_PARAM_HDR_TONEMAPPER] = VS::ENV_FX_HDR_TONE_MAPPER_LINEAR; fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE] = 0.4; fx_param[VS::ENV_FX_PARAM_HDR_WHITE] = 1.0; - fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD] = 0.95; + fx_param[VS::ENV_FX_PARAM_HDR_GLOW_THRESHOLD] = 0.95; fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE] = 0.2; fx_param[VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE] = 0.4; fx_param[VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE] = 8.0; diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index cb42970921..23680ffe91 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -16,6 +16,7 @@ attribute vec2 uv_in; // attrib:4 #endif attribute vec2 uv2_in; // attrib:5 + #ifdef USE_CUBEMAP varying vec3 cube_interp; #else @@ -58,7 +59,9 @@ float sRGB_gamma_correct(float c){ #define LUM_RANGE 4.0 -#ifdef USE_CUBEMAP +#ifdef USE_ARRAY +uniform sampler2DArray source; +#elif defined(USE_CUBEMAP) varying vec3 cube_interp; uniform samplerCube source_cube; #else @@ -84,7 +87,7 @@ uniform sampler2D glow_source; #if defined(USE_HDR) && defined(USE_GLOW_COPY) -uniform highp float hdr_glow_treshold; +uniform highp float hdr_glow_threshold; uniform highp float hdr_glow_scale; #endif @@ -104,7 +107,7 @@ uniform vec3 bcs; #ifdef USE_GLOW_COPY uniform float bloom; -uniform float bloom_treshold; +uniform float bloom_threshold; #endif @@ -145,23 +148,17 @@ uniform float custom_alpha; void main() { //vec4 color = color_interp; -#ifdef USE_HIGHP_SOURCE -#ifdef USE_CUBEMAP + +#ifdef USE_ARRAY + highp vec4 color = textureLod( source, vec3(uv_interp,0.0),0.0 ); +#elif defined(USE_CUBEMAP) highp vec4 color = textureCube( source_cube, normalize(cube_interp) ); #else highp vec4 color = texture2D( source, uv_interp ); #endif -#else - -#ifdef USE_CUBEMAP - vec4 color = textureCube( source_cube, normalize(cube_interp) ); - -#else - vec4 color = texture2D( source, uv_interp ); -#endif #endif @@ -377,11 +374,11 @@ void main() { #ifdef USE_GLOW_COPY - highp vec3 glowcol = color.rgb*color.a+step(bloom_treshold,dot(vec3(0.3333,0.3333,0.3333),color.rgb))*bloom*color.rgb; + highp vec3 glowcol = color.rgb*color.a+step(bloom_threshold,dot(vec3(0.3333,0.3333,0.3333),color.rgb))*bloom*color.rgb; #ifdef USE_HDR highp float collum = max(color.r,max(color.g,color.b)); - glowcol+=color.rgb*max(collum-hdr_glow_treshold,0.0)*hdr_glow_scale; + glowcol+=color.rgb*max(collum-hdr_glow_threshold,0.0)*hdr_glow_scale; #endif color.rgb=glowcol; color.a=0.0; @@ -503,7 +500,7 @@ void main() { //lum_accum=exp(lum_accum); -#ifdef USE_8BIT_HDR +#ifdef USE_8BIT_HDR highp float vd_lum = dot(texture2D( source_vd_lum, vec2(0.0) ), _multcv ); lum_accum = clamp( vd_lum + (lum_accum-vd_lum)*hdr_time_delta*hdr_exp_adj_speed,min_luminance*(1.0/LUM_RANGE),max_luminance*(1.0/LUM_RANGE)); @@ -558,4 +555,3 @@ void main() { #endif } - |