summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles2/shaders/copy.glsl10
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp6
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp172
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h27
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp169
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h37
-rw-r--r--drivers/gles3/shader_gles3.cpp4
-rw-r--r--drivers/gles3/shaders/SCsub3
-rw-r--r--drivers/gles3/shaders/copy.glsl19
-rw-r--r--drivers/gles3/shaders/resolve.glsl45
-rw-r--r--drivers/gles3/shaders/resolve.glsl.h166
-rw-r--r--drivers/gles3/shaders/scene.glsl6
-rw-r--r--drivers/gles3/shaders/screen_space.glsl.h183
-rw-r--r--drivers/gles3/shaders/screen_space_reflection.glsl350
-rw-r--r--scene/resources/environment.cpp120
-rw-r--r--scene/resources/environment.h29
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/visual_server_raster.h1
-rw-r--r--servers/visual_server.h2
-rw-r--r--tools/collada/collada.cpp12
21 files changed, 1284 insertions, 81 deletions
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
index ae7185a1d6..cb42970921 100644
--- a/drivers/gles2/shaders/copy.glsl
+++ b/drivers/gles2/shaders/copy.glsl
@@ -71,6 +71,11 @@ uniform sampler2D source;
#endif
varying vec2 uv2_interp;
+
+#ifdef USE_DEPTH
+uniform highp sampler2D source_depth; //texunit:1
+#endif
+
#ifdef USE_GLOW
uniform sampler2D glow_source;
@@ -547,5 +552,10 @@ void main() {
gl_FragColor = color;
+
+#ifdef USE_DEPTH
+ gl_FragDepth = texture(source_depth,uv_interp).r;
+#endif
+
}
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 1f23387516..3c6094a41d 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -1349,7 +1349,7 @@ void RasterizerCanvasGLES3::reset_canvas() {
if (storage->frame.current_rt) {
- glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->front.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
glColorMask(1,1,1,1); //don't touch alpha
}
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index 9046028705..3924ffb75f 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -178,7 +178,7 @@ void RasterizerGLES3::set_current_render_target(RID p_render_target){
if (!p_render_target.is_valid() && storage->frame.current_rt && storage->frame.clear_request) {
//handle pending clear request, if the framebuffer was not cleared
- glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo);
print_line("unbind clear of: "+storage->frame.clear_request_color);
glClearColor(
storage->frame.clear_request_color.r,
@@ -213,7 +213,7 @@ void RasterizerGLES3::restore_render_target() {
ERR_FAIL_COND(storage->frame.current_rt==NULL);
RasterizerStorageGLES3::RenderTarget * rt = storage->frame.current_rt;
- glBindFramebuffer(GL_FRAMEBUFFER,rt->front.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER,rt->fbo);
glViewport(0,0,rt->width,rt->height);
}
@@ -238,7 +238,7 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target,const Rec
glDisable(GL_BLEND);
glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo);
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D,rt->front.color);
+ glBindTexture(GL_TEXTURE_2D,rt->color);
canvas->draw_generic_textured_rect(p_screen_rect,Rect2(0,0,1,-1));
glBindTexture(GL_TEXTURE_2D,0);
canvas->canvas_end();
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 9de441c2bb..16784246f6 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -857,6 +857,21 @@ void RasterizerSceneGLES3::environment_set_fog(RID p_env,bool p_enable,float p_b
}
+void RasterizerSceneGLES3::environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness) {
+
+ Environment *env=environment_owner.getornull(p_env);
+ ERR_FAIL_COND(!env);
+
+ env->ssr_enabled=p_enable;
+ env->ssr_max_steps=p_max_steps;
+ env->ssr_accel=p_accel;
+ env->ssr_fade=p_fade;
+ env->ssr_depth_tolerance=p_depth_tolerance;
+ env->ssr_smooth=p_smooth;
+ env->ssr_roughness=p_roughness;
+
+}
+
void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, bool p_enable, float p_exposure, float p_white, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale, VS::EnvironmentToneMapper p_tone_mapper){
}
@@ -2538,7 +2553,7 @@ void RasterizerSceneGLES3::_copy_screen() {
void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) {
//copy to front buffer
- glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
@@ -2575,7 +2590,7 @@ void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) {
void RasterizerSceneGLES3::_copy_texture_to_front_buffer(GLuint p_texture) {
//copy to front buffer
- glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
@@ -2660,6 +2675,127 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase** p_cull_result,int p_
}
+void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_cam_projection) {
+
+
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+
+ if (env->ssr_enabled) {
+ //blur diffuse into effect mipmaps using separatable convolution
+ //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true);
+ for(int i=0;i<storage->frame.current_rt->effects.mip_maps[1].sizes.size();i++) {
+
+
+ int vp_w = storage->frame.current_rt->effects.mip_maps[1].sizes[i].width;
+ int vp_h = storage->frame.current_rt->effects.mip_maps[1].sizes[i].height;
+ glViewport(0,0,vp_w,vp_h);
+ //horizontal pass
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_HORIZONTAL,true);
+ state.effect_blur_shader.bind();
+ state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h));
+ state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i));
+ glActiveTexture(GL_TEXTURE0);
+ if (i==0) {
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse);
+ } else {
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); //previous level, since mipmaps[0] starts one level bigger
+ }
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[i].fbo);
+ _copy_screen();
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_HORIZONTAL,false);
+
+ //vertical pass
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_VERTICAL,true);
+ state.effect_blur_shader.bind();
+ state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h));
+ state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i));
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color);
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[i+1].fbo); //next level, since mipmaps[0] starts one level bigger
+ _copy_screen();
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_VERTICAL,false);
+ }
+
+
+ //perform SSR
+
+ state.ssr_shader.set_conditional(ScreenSpaceReflectionShaderGLES3::SMOOTH_ACCEL,env->ssr_accel>0 && env->ssr_smooth);
+ state.ssr_shader.set_conditional(ScreenSpaceReflectionShaderGLES3::REFLECT_ROUGHNESS,env->ssr_accel>0 && env->ssr_roughness);
+
+ state.ssr_shader.bind();
+
+ int ssr_w = storage->frame.current_rt->effects.mip_maps[1].sizes[0].width;
+ int ssr_h = storage->frame.current_rt->effects.mip_maps[1].sizes[0].height;
+
+
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::PIXEL_SIZE,Vector2(1.0/(ssr_w*0.5),1.0/(ssr_h*0.5)));
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near());
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far());
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::PROJECTION,p_cam_projection);
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::INVERSE_PROJECTION,p_cam_projection.inverse());
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::VIEWPORT_SIZE,Size2(ssr_w,ssr_h));
+ //state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::FRAME_INDEX,int(render_pass));
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::FILTER_MIPMAP_LEVELS,float(storage->frame.current_rt->effects.mip_maps[0].sizes.size()));
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::NUM_STEPS,env->ssr_max_steps);
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::ACCELERATION,env->ssr_accel);
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::DEPTH_TOLERANCE,env->ssr_depth_tolerance);
+ state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::DISTANCE_FADE,env->ssr_fade);
+
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse);
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_sr);
+ glActiveTexture(GL_TEXTURE2);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
+ glActiveTexture(GL_TEXTURE3);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color);
+
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[0].fbo);
+ glViewport(0,0,ssr_w,ssr_h);
+
+ _copy_screen();
+ glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height);
+
+ }
+
+
+ state.resolve_shader.set_conditional(ResolveShaderGLES3::USE_SSR,env->ssr_enabled);
+ state.resolve_shader.bind();
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse);
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.specular);
+ if (env->ssr_enabled) {
+ glActiveTexture(GL_TEXTURE2);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color);
+ }
+
+
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo);
+ //glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo);
+ _copy_screen();
+
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SIMPLE_COPY,true);
+ state.effect_blur_shader.bind();
+ state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(0));
+
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color);
+
+ _copy_screen();
+
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SIMPLE_COPY,false);
+
+
+}
+
+
void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass){
//first of all, make a new render pass
@@ -2700,7 +2836,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
render_list.clear();
- bool use_mrt=false;
+ bool use_mrt=true;
_fill_render_list(p_cull_result,p_cull_count,false);
@@ -2712,10 +2848,11 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
glEnable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
-
+ //rendering to a probe cubemap side
ReflectionProbeInstance *probe = reflection_probe_instance_owner.getornull(p_reflection_probe);
GLuint current_fbo;
+
if (probe) {
ReflectionAtlas *ref_atlas = reflection_atlas_owner.getptr(probe->atlas);
@@ -2739,6 +2876,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
glViewport(0,0,reflection_cubemaps[cubemap_index].size,reflection_cubemaps[cubemap_index].size);
glBindFramebuffer(GL_FRAMEBUFFER,current_fbo);
+
} else {
glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height);
@@ -2750,6 +2888,13 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,true);
+
+ Vector<GLenum> draw_buffers;
+ draw_buffers.push_back(GL_COLOR_ATTACHMENT0);
+ draw_buffers.push_back(GL_COLOR_ATTACHMENT1);
+ draw_buffers.push_back(GL_COLOR_ATTACHMENT2);
+ glDrawBuffers(draw_buffers.size(),draw_buffers.ptr());
+
Color black(0,0,0,0);
glClearBufferfv(GL_COLOR,1,black.components); // specular
glClearBufferfv(GL_COLOR,2,black.components); // normal metal rough
@@ -2760,6 +2905,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false);
+
}
}
@@ -2841,6 +2987,11 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false);
+ if (use_mrt) {
+ GLenum gldb = GL_COLOR_ATTACHMENT0;
+ glDrawBuffers(1,&gldb);
+ }
+
if (env && env->bg_mode==VS::ENV_BG_SKYBOX) {
if (use_mrt) {
@@ -2859,16 +3010,17 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
// state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false);
+
+ if (use_mrt) {
+ _render_mrts(env,p_cam_projection);
+ }
+
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glEnable(GL_BLEND);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- if (use_mrt) {
- glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo);
- }
-
render_list.sort_by_depth(true);
if (state.directional_light_count==0) {
@@ -3812,6 +3964,10 @@ void RasterizerSceneGLES3::initialize() {
glEnable(GL_PROGRAM_POINT_SIZE);
#endif
+
+ state.resolve_shader.init();
+ state.ssr_shader.init();
+ state.effect_blur_shader.init();
}
void RasterizerSceneGLES3::iteration() {
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 929b01e373..0b934085ed 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -4,6 +4,9 @@
#include "rasterizer_storage_gles3.h"
#include "drivers/gles3/shaders/scene.glsl.h"
#include "drivers/gles3/shaders/cube_to_dp.glsl.h"
+#include "drivers/gles3/shaders/resolve.glsl.h"
+#include "drivers/gles3/shaders/screen_space_reflection.glsl.h"
+#include "drivers/gles3/shaders/effect_blur.glsl.h"
class RasterizerSceneGLES3 : public RasterizerScene {
public:
@@ -45,6 +48,9 @@ public:
SceneShaderGLES3 scene_shader;
CubeToDpShaderGLES3 cube_to_dp_shader;
+ ResolveShaderGLES3 resolve_shader;
+ ScreenSpaceReflectionShaderGLES3 ssr_shader;
+ EffectBlurShaderGLES3 effect_blur_shader;
struct SceneDataUBO {
@@ -289,6 +295,15 @@ public:
int canvas_max_layer;
+ bool ssr_enabled;
+ int ssr_max_steps;
+ float ssr_accel;
+ float ssr_fade;
+ float ssr_depth_tolerance;
+ bool ssr_smooth;
+ bool ssr_roughness;
+
+
Environment() {
bg_mode=VS::ENV_BG_CLEAR_COLOR;
@@ -298,6 +313,15 @@ public:
ambient_energy=1.0;
ambient_skybox_contribution=0.0;
canvas_max_layer=0;
+
+ ssr_enabled=false;
+ ssr_max_steps=64;
+ ssr_accel=0.04;
+ ssr_fade=2.0;
+ ssr_depth_tolerance=0.2;
+ ssr_smooth=true;
+ ssr_roughness=true;
+
}
};
@@ -316,6 +340,8 @@ public:
virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode);
virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture);
+ virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness);
+
virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper);
virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp);
@@ -551,6 +577,7 @@ public:
void _fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow);
+ void _render_mrts(Environment *env, const CameraMatrix &p_cam_projection);
virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass);
virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count);
virtual bool free(RID p_rid);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index e9d9136a0b..01668e728c 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -4760,16 +4760,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce
void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
- if (rt->front.fbo) {
- glDeleteFramebuffers(1,&rt->front.fbo);
- glDeleteTextures(1,&rt->front.color);
- rt->front.fbo=0;
- }
-
- if (rt->back.fbo) {
- glDeleteFramebuffers(1,&rt->back.fbo);
- glDeleteTextures(1,&rt->back.color);
- rt->back.fbo=0;
+ if (rt->fbo) {
+ glDeleteFramebuffers(1,&rt->fbo);
+ glDeleteTextures(1,&rt->color);
+ rt->fbo=0;
}
if (rt->buffers.fbo) {
@@ -4783,7 +4777,7 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
}
if (rt->depth) {
- glDeleteRenderbuffers(1,&rt->depth);
+ glDeleteTextures(1,&rt->depth);
rt->depth=0;
}
@@ -4793,6 +4787,22 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
tex->width=0;
tex->height=0;
+ for(int i=0;i<2;i++) {
+ for(int j=0;j<rt->effects.mip_maps[i].sizes.size();j++) {
+ glDeleteFramebuffers(1,&rt->effects.mip_maps[i].sizes[j].fbo);
+ }
+
+ glDeleteTextures(1,&rt->effects.mip_maps[i].color);
+ rt->effects.mip_maps[i].sizes.clear();
+ rt->effects.mip_maps[i].levels=0;
+ }
+/*
+ if (rt->effects.screen_space_depth) {
+ glDeleteTextures(1,&rt->effects.screen_space_depth);
+ rt->effects.screen_space_depth=0;
+
+ }
+*/
}
void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
@@ -4833,21 +4843,24 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
glActiveTexture(GL_TEXTURE0);
- glGenFramebuffers(1, &rt->front.fbo);
- glBindFramebuffer(GL_FRAMEBUFFER, rt->front.fbo);
-
-
- glGenRenderbuffers(1, &rt->depth);
- glBindRenderbuffer(GL_RENDERBUFFER, rt->depth );
+ glGenFramebuffers(1, &rt->fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
- glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8, rt->width, rt->height);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
- glBindRenderbuffer(GL_RENDERBUFFER, 0 );
+ glGenTextures(1, &rt->depth);
+ glBindTexture(GL_TEXTURE_2D, rt->depth);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, rt->width, rt->height, 0,
+ GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D, rt->depth, 0);
- glGenTextures(1, &rt->front.color);
- glBindTexture(GL_TEXTURE_2D, rt->front.color);
+ glGenTextures(1, &rt->color);
+ glBindTexture(GL_TEXTURE_2D, rt->color);
glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
@@ -4855,7 +4868,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->front.color, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
@@ -4867,7 +4880,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
tex->gl_format_cache=color_format;
tex->gl_type_cache=color_type;
tex->gl_internal_format_cache=color_internal_format;
- tex->tex_id=rt->front.color;
+ tex->tex_id=rt->color;
tex->width=rt->width;
tex->alloc_width=rt->width;
tex->height=rt->height;
@@ -4881,32 +4894,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
/* BACK FBO */
- if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) {
-
- glGenFramebuffers(1, &rt->back.fbo);
- glBindFramebuffer(GL_FRAMEBUFFER, rt->back.fbo);
- glBindRenderbuffer(GL_RENDERBUFFER, rt->depth );
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
-
- glGenTextures(1, &rt->back.color);
- glBindTexture(GL_TEXTURE_2D, rt->back.color);
- glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->back.color, 0);
-
- GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
-
- if (status != GL_FRAMEBUFFER_COMPLETE) {
- _render_target_clear(rt);
- ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE );
- }
- }
-
if (config.render_arch==RENDER_ARCH_DESKTOP && !rt->flags[RENDER_TARGET_NO_3D]) {
@@ -4915,11 +4902,12 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
glGenFramebuffers(1, &rt->buffers.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.fbo);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D, rt->depth, 0);
glGenTextures(1, &rt->buffers.diffuse);
glBindTexture(GL_TEXTURE_2D, rt->buffers.diffuse);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, rt->width, rt->height, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -4958,7 +4946,9 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
glGenFramebuffers(1, &rt->buffers.alpha_fbo);
glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.alpha_fbo);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D, rt->depth, 0);
+
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->buffers.diffuse, 0);
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@@ -4969,9 +4959,80 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE );
}
- }
+ for(int i=0;i<2;i++) {
+
+ ERR_FAIL_COND( rt->effects.mip_maps[i].sizes.size() );
+ int w=rt->width;
+ int h=rt->height;
+
+
+ if (i>0) {
+ w>>=1;
+ h>>=1;
+ }
+
+
+ glGenTextures(1, &rt->effects.mip_maps[i].color);
+ glBindTexture(GL_TEXTURE_2D, rt->effects.mip_maps[i].color);
+ int level=0;
+
+ while(true) {
+
+ RenderTarget::Effects::MipMaps::Size mm;
+
+ glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA16F, w, h, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
+ mm.width=w;
+ mm.height=h;
+ rt->effects.mip_maps[i].sizes.push_back(mm);
+
+ w>>=1;
+ h>>=1;
+
+ if (w<32 || h<32)
+ break; //going less than 32 is pointless
+
+ level++;
+
+ }
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
+
+
+ for(int j=0;j<rt->effects.mip_maps[i].sizes.size();j++) {
+
+ RenderTarget::Effects::MipMaps::Size &mm=rt->effects.mip_maps[i].sizes[j];
+
+ glGenFramebuffers(1, &mm.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, mm.fbo);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,rt->effects.mip_maps[i].color ,j);
+
+ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ _render_target_clear(rt);
+ ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE );
+ }
+
+
+ float zero[4]={1,0,1,0};
+ glClearBufferfv(GL_COLOR,0,zero);
+
+
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ rt->effects.mip_maps[i].levels=level;
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+
+ }
}
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 62199b10ff..1eba8b42c9 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -877,11 +877,8 @@ public:
struct RenderTarget : public RID_Data {
- struct Color {
- GLuint fbo;
- GLuint color;
- } front,back;
-
+ GLuint fbo;
+ GLuint color;
GLuint depth;
struct Buffers {
@@ -890,8 +887,35 @@ public:
GLuint specular;
GLuint diffuse;
GLuint normal_sr;
+ GLuint temporal;
} buffers;
+ struct Effects {
+
+ struct MipMaps {
+
+ struct Size {
+ GLuint fbo;
+ int width;
+ int height;
+ };
+
+ Vector<Size> sizes;
+ GLuint color;
+ int levels;
+
+ MipMaps() { color=0; levels=0;}
+ };
+
+ MipMaps mip_maps[2]; //first mipmap chain starts from full-screen
+ //GLuint depth2; //depth for the second mipmap chain, in case of desiring upsampling
+
+ Effects() {
+
+ }
+
+ } effects;
+
int width,height;
bool flags[RENDER_TARGET_FLAG_MAX];
@@ -905,8 +929,7 @@ public:
width=0;
height=0;
depth=0;
- front.fbo=0;
- back.fbo=0;
+ fbo=0;
buffers.fbo=0;
buffers.alpha_fbo=0;
used_in_frame=false;
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index d29927b137..778d3b23ec 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -393,8 +393,8 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() {
strings.resize(strings_base_size);
//fragment precision is medium
- strings.push_back("precision mediump float;\n");
- strings.push_back("precision mediump int;\n");
+ strings.push_back("precision highp float;\n");
+ strings.push_back("precision highp int;\n");
#if 0
if (cc) {
diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub
index a9808dcbcf..66a19eefd1 100644
--- a/drivers/gles3/shaders/SCsub
+++ b/drivers/gles3/shaders/SCsub
@@ -2,10 +2,13 @@ Import('env')
if env['BUILDERS'].has_key('GLES3_GLSL'):
env.GLES3_GLSL('copy.glsl');
+ env.GLES3_GLSL('resolve.glsl');
env.GLES3_GLSL('canvas.glsl');
env.GLES3_GLSL('canvas_shadow.glsl');
env.GLES3_GLSL('scene.glsl');
env.GLES3_GLSL('cubemap_filter.glsl');
env.GLES3_GLSL('cube_to_dp.glsl');
env.GLES3_GLSL('blend_shape.glsl');
+ env.GLES3_GLSL('screen_space_reflection.glsl');
+ env.GLES3_GLSL('effect_blur.glsl');
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl
index 79982ecf25..a87d62f2d7 100644
--- a/drivers/gles3/shaders/copy.glsl
+++ b/drivers/gles3/shaders/copy.glsl
@@ -50,6 +50,7 @@ float sRGB_gamma_correct(float c){
uniform float stuff;
+uniform vec2 pixel_size;
in vec2 uv2_interp;
@@ -81,6 +82,24 @@ void main() {
color.a=1.0;
#endif
+
+#ifdef GAUSSIAN_HORIZONTAL
+ color*=0.38774;
+ color+=texture( source, uv_interp+vec2( 1.0, 0.0)*pixel_size )*0.24477;
+ color+=texture( source, uv_interp+vec2( 2.0, 0.0)*pixel_size )*0.06136;
+ color+=texture( source, uv_interp+vec2(-1.0, 0.0)*pixel_size )*0.24477;
+ color+=texture( source, uv_interp+vec2(-2.0, 0.0)*pixel_size )*0.06136;
+#endif
+
+#ifdef GAUSSIAN_VERTICAL
+ color*=0.38774;
+ color+=texture( source, uv_interp+vec2( 0.0, 1.0)*pixel_size )*0.24477;
+ color+=texture( source, uv_interp+vec2( 0.0, 2.0)*pixel_size )*0.06136;
+ color+=texture( source, uv_interp+vec2( 0.0,-1.0)*pixel_size )*0.24477;
+ color+=texture( source, uv_interp+vec2( 0.0,-2.0)*pixel_size )*0.06136;
+#endif
+
+
frag_color = color;
}
diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl
new file mode 100644
index 0000000000..4ca6297303
--- /dev/null
+++ b/drivers/gles3/shaders/resolve.glsl
@@ -0,0 +1,45 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+}
+
+[fragment]
+
+
+in vec2 uv_interp;
+uniform sampler2D source_diffuse; //texunit:0
+uniform sampler2D source_specular; //texunit:1
+
+
+uniform sampler2D source_ssr_ssao; //texunit:2
+
+uniform float stuff;
+
+in vec2 uv2_interp;
+
+layout(location = 0) out vec4 frag_color;
+
+void main() {
+
+ vec4 diffuse = texture( source_diffuse, uv_interp );
+ vec4 specular = texture( source_specular, uv_interp );
+
+#ifdef USE_SSR
+
+ vec4 ssr = textureLod(source_ssr_ssao,uv_interp,0.0);
+ specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a);
+#endif
+
+ frag_color = vec4(diffuse.rgb,1.0)+vec4(specular.rgb,1.0);
+}
+
diff --git a/drivers/gles3/shaders/resolve.glsl.h b/drivers/gles3/shaders/resolve.glsl.h
new file mode 100644
index 0000000000..72baf50716
--- /dev/null
+++ b/drivers/gles3/shaders/resolve.glsl.h
@@ -0,0 +1,166 @@
+/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */
+#ifndef RESOLVE_GLSL_HGLES3_120
+#define RESOLVE_GLSL_HGLES3_120
+
+
+#include "drivers/gles3/shader_gles3.h"
+
+
+class ResolveShaderGLES3 : public ShaderGLES3 {
+
+ virtual String get_shader_name() const { return "ResolveShaderGLES3"; }
+public:
+
+ enum Conditionals {
+ USE_SSR,
+ };
+
+ enum Uniforms {
+ STUFF,
+ };
+
+ _FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }
+
+ _FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }
+
+ #define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
+
+ const Transform &tr = p_transform;
+
+ GLfloat matrix[16]={ /* build a 16x16 matrix */
+ tr.basis.elements[0][0],
+ tr.basis.elements[1][0],
+ tr.basis.elements[2][0],
+ 0,
+ tr.basis.elements[0][1],
+ tr.basis.elements[1][1],
+ tr.basis.elements[2][1],
+ 0,
+ tr.basis.elements[0][2],
+ tr.basis.elements[1][2],
+ tr.basis.elements[2][2],
+ 0,
+ tr.origin.x,
+ tr.origin.y,
+ tr.origin.z,
+ 1
+ };
+
+
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+
+
+ }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
+
+ const Matrix32 &tr = p_transform;
+
+ GLfloat matrix[16]={ /* build a 16x16 matrix */
+ tr.elements[0][0],
+ tr.elements[0][1],
+ 0,
+ 0,
+ tr.elements[1][0],
+ tr.elements[1][1],
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ tr.elements[2][0],
+ tr.elements[2][1],
+ 0,
+ 1
+ };
+
+
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+
+
+ }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
+
+ GLfloat matrix[16];
+
+ for (int i=0;i<4;i++) {
+ for (int j=0;j<4;j++) {
+
+ matrix[i*4+j]=p_matrix.matrix[i][j];
+ }
+ }
+
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+ };
+
+#undef _FU
+
+
+ virtual void init() {
+
+ static const Enum *_enums=NULL;
+ static const EnumValue *_enum_values=NULL;
+ static const char* _conditional_strings[]={
+ "#define USE_SSR\n",
+ };
+
+ static const char* _uniform_strings[]={
+ "stuff",
+ };
+
+ static AttributePair *_attribute_pairs=NULL;
+ static const Feedback* _feedbacks=NULL;
+ static TexUnitPair _texunit_pairs[]={
+ {"source_diffuse",0},
+ {"source_specular",1},
+ {"source_ssr_ssao",2},
+ };
+
+ static UBOPair *_ubo_pairs=NULL;
+ static const char _vertex_code[]={
+10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,52,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,52,41,32,105,110,32,118,101,99,50,32,117,118,95,105,110,59,10,10,111,117,116,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,117,118,95,105,110,116,101,114,112,32,61,32,117,118,95,105,110,59,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,125,10,10, 0};
+
+ static const int _vertex_code_start=1;
+ static const char _fragment_code[]={
+10,10,105,110,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,59,32,47,47,116,101,120,117,110,105,116,58,48,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,115,112,101,99,117,108,97,114,59,32,47,47,116,101,120,117,110,105,116,58,49,10,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,115,115,114,95,115,115,97,111,59,32,47,47,116,101,120,117,110,105,116,58,50,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,115,116,117,102,102,59,10,10,105,110,32,118,101,99,50,32,117,118,50,95,105,110,116,101,114,112,59,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,111,117,116,32,118,101,99,52,32,102,114,97,103,95,99,111,108,111,114,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,118,101,99,52,32,100,105,102,102,117,115,101,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,9,118,101,99,52,32,115,112,101,99,117,108,97,114,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,115,112,101,99,117,108,97,114,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,10,35,105,102,100,101,102,32,85,83,69,95,83,83,82,10,10,9,118,101,99,52,32,115,115,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,115,115,114,95,115,115,97,111,44,117,118,95,105,110,116,101,114,112,44,48,46,48,41,59,10,9,115,112,101,99,117,108,97,114,46,114,103,98,32,61,32,109,105,120,40,115,112,101,99,117,108,97,114,46,114,103,98,44,115,115,114,46,114,103,98,42,115,112,101,99,117,108,97,114,46,97,44,115,115,114,46,97,41,59,10,35,101,110,100,105,102,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,46,114,103,98,44,49,46,48,41,43,118,101,99,52,40,115,112,101,99,117,108,97,114,46,114,103,98,44,49,46,48,41,59,10,125,10,10, 0};
+
+ static const int _fragment_code_start=16;
+ setup(_conditional_strings,1,_uniform_strings,1,_attribute_pairs,0, _texunit_pairs,3,_ubo_pairs,0,_feedbacks,0,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);
+ };
+
+};
+
+#endif
+
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index c198534728..192042192e 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1189,8 +1189,10 @@ LIGHT_SHADER_CODE
#endif //ENABLE_AO
diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale);
- specular_buffer=vec4(specular_light,0.0);
- normal_mr_buffer=vec4(normal.x,normal.y,max(specular.r,max(specular.g,specular.b)),roughness);
+ specular_buffer=vec4(specular_light,max(specular.r,max(specular.g,specular.b)));
+
+
+ normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness);
#else
diff --git a/drivers/gles3/shaders/screen_space.glsl.h b/drivers/gles3/shaders/screen_space.glsl.h
new file mode 100644
index 0000000000..f39d04429d
--- /dev/null
+++ b/drivers/gles3/shaders/screen_space.glsl.h
@@ -0,0 +1,183 @@
+/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */
+#ifndef SCREEN_SPACE_GLSL_HGLES3_120
+#define SCREEN_SPACE_GLSL_HGLES3_120
+
+
+#include "drivers/gles3/shader_gles3.h"
+
+
+class ScreenSpaceShaderGLES3 : public ShaderGLES3 {
+
+ virtual String get_shader_name() const { return "ScreenSpaceShaderGLES3"; }
+public:
+
+ enum Conditionals {
+ BLEND_ACCEL,
+ REFLECT_ROUGHNESS,
+ };
+
+ enum Uniforms {
+ CAMERA_Z_NEAR,
+ CAMERA_Z_FAR,
+ VIEWPORT_SIZE,
+ PIXEL_SIZE,
+ FILTER_MIPMAP_LEVELS,
+ INVERSE_PROJECTION,
+ PROJECTION,
+ FRAME_INDEX,
+ };
+
+ _FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }
+
+ _FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }
+
+ #define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
+
+ const Transform &tr = p_transform;
+
+ GLfloat matrix[16]={ /* build a 16x16 matrix */
+ tr.basis.elements[0][0],
+ tr.basis.elements[1][0],
+ tr.basis.elements[2][0],
+ 0,
+ tr.basis.elements[0][1],
+ tr.basis.elements[1][1],
+ tr.basis.elements[2][1],
+ 0,
+ tr.basis.elements[0][2],
+ tr.basis.elements[1][2],
+ tr.basis.elements[2][2],
+ 0,
+ tr.origin.x,
+ tr.origin.y,
+ tr.origin.z,
+ 1
+ };
+
+
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+
+
+ }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
+
+ const Matrix32 &tr = p_transform;
+
+ GLfloat matrix[16]={ /* build a 16x16 matrix */
+ tr.elements[0][0],
+ tr.elements[0][1],
+ 0,
+ 0,
+ tr.elements[1][0],
+ tr.elements[1][1],
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ tr.elements[2][0],
+ tr.elements[2][1],
+ 0,
+ 1
+ };
+
+
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+
+
+ }
+
+ _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
+
+ GLfloat matrix[16];
+
+ for (int i=0;i<4;i++) {
+ for (int j=0;j<4;j++) {
+
+ matrix[i*4+j]=p_matrix.matrix[i][j];
+ }
+ }
+
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+ };
+
+#undef _FU
+
+
+ virtual void init() {
+
+ static const Enum *_enums=NULL;
+ static const EnumValue *_enum_values=NULL;
+ static const char* _conditional_strings[]={
+ "#define BLEND_ACCEL\n",
+ "#define REFLECT_ROUGHNESS\n",
+ };
+
+ static const char* _uniform_strings[]={
+ "camera_z_near",
+ "camera_z_far",
+ "viewport_size",
+ "pixel_size",
+ "filter_mipmap_levels",
+ "inverse_projection",
+ "projection",
+ "frame_index",
+ };
+
+ static AttributePair *_attribute_pairs=NULL;
+ static const Feedback* _feedbacks=NULL;
+ static TexUnitPair _texunit_pairs[]={
+ {"source_diffuse",0},
+ {"source_normal_roughness",1},
+ {"source_depth",2},
+ {"source_diffuse_mipmaps",3},
+ };
+
+ static UBOPair *_ubo_pairs=NULL;
+ static const char _vertex_code[]={
+10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,52,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,52,41,32,105,110,32,118,101,99,50,32,117,118,95,105,110,59,10,10,111,117,116,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,111,117,116,32,118,101,99,50,32,112,111,115,95,105,110,116,101,114,112,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,117,118,95,105,110,116,101,114,112,32,61,32,117,118,95,105,110,59,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,9,112,111,115,95,105,110,116,101,114,112,46,120,121,61,103,108,95,80,111,115,105,116,105,111,110,46,120,121,59,10,125,10,10, 0};
+
+ static const int _vertex_code_start=1;
+ static const char _fragment_code[]={
+10,10,105,110,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,105,110,32,118,101,99,50,32,112,111,115,95,105,110,116,101,114,112,59,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,59,32,47,47,116,101,120,117,110,105,116,58,48,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,59,32,47,47,116,101,120,117,110,105,116,58,49,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,101,112,116,104,59,32,47,47,116,101,120,117,110,105,116,58,50,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,95,109,105,112,109,97,112,115,59,32,47,47,116,101,120,117,110,105,116,58,51,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,99,97,109,101,114,97,95,122,95,110,101,97,114,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,99,97,109,101,114,97,95,122,95,102,97,114,59,10,10,117,110,105,102,111,114,109,32,118,101,99,50,32,118,105,101,119,112,111,114,116,95,115,105,122,101,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,112,105,120,101,108,95,115,105,122,101,59,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,102,105,108,116,101,114,95,109,105,112,109,97,112,95,108,101,118,101,108,115,59,10,10,117,110,105,102,111,114,109,32,109,97,116,52,32,105,110,118,101,114,115,101,95,112,114,111,106,101,99,116,105,111,110,59,10,117,110,105,102,111,114,109,32,109,97,116,52,32,112,114,111,106,101,99,116,105,111,110,59,10,10,117,110,105,102,111,114,109,32,105,110,116,32,102,114,97,109,101,95,105,110,100,101,120,59,10,10,118,101,99,50,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,99,51,32,118,105,101,119,95,112,111,115,44,111,117,116,32,102,108,111,97,116,32,119,41,32,123,10,32,32,32,32,118,101,99,52,32,112,114,111,106,101,99,116,101,100,32,61,32,112,114,111,106,101,99,116,105,111,110,32,42,32,118,101,99,52,40,118,105,101,119,95,112,111,115,44,32,49,46,48,41,59,10,32,32,32,32,112,114,111,106,101,99,116,101,100,46,120,121,122,32,47,61,32,112,114,111,106,101,99,116,101,100,46,119,59,10,32,32,32,32,112,114,111,106,101,99,116,101,100,46,120,121,32,61,32,112,114,111,106,101,99,116,101,100,46,120,121,32,42,32,48,46,53,32,43,32,48,46,53,59,10,32,32,32,32,119,61,112,114,111,106,101,99,116,101,100,46,119,59,10,32,32,32,32,114,101,116,117,114,110,32,112,114,111,106,101,99,116,101,100,46,120,121,59,10,125,10,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,111,117,116,32,118,101,99,52,32,102,114,97,103,95,99,111,108,111,114,59,10,10,35,100,101,102,105,110,101,32,78,85,77,95,82,65,89,68,73,82,95,82,69,84,82,73,69,83,32,51,10,10,47,47,102,114,111,109,32,104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,116,111,98,115,112,114,44,32,105,102,32,105,116,32,119,111,114,107,115,32,102,111,114,32,121,111,117,44,32,100,117,100,101,46,46,10,118,101,99,51,32,114,97,110,100,95,114,103,98,40,118,101,99,50,32,99,111,41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,97,98,115,40,102,114,97,99,116,40,115,105,110,40,100,111,116,40,99,111,46,120,121,44,32,118,101,99,50,40,51,52,46,52,56,51,53,44,32,56,57,46,54,51,55,50,41,41,41,32,42,10,9,118,101,99,51,40,50,57,49,53,54,46,52,55,54,53,44,32,51,56,50,55,51,46,53,54,51,57,51,44,32,52,55,56,52,51,46,55,53,52,54,56,41,41,41,32,42,32,50,32,45,32,49,59,10,125,10,10,35,100,101,102,105,110,101,32,77,95,80,73,32,51,46,49,52,49,53,57,50,54,53,51,53,57,10,10,118,101,99,51,32,105,109,112,111,114,116,97,110,99,101,95,115,97,109,112,108,101,95,103,103,120,40,118,101,99,50,32,120,105,44,32,102,108,111,97,116,32,114,111,117,103,104,110,101,115,115,41,10,123,10,32,32,32,32,102,108,111,97,116,32,114,95,115,113,117,97,114,101,32,61,32,114,111,117,103,104,110,101,115,115,32,42,32,114,111,117,103,104,110,101,115,115,59,10,32,32,32,32,102,108,111,97,116,32,112,104,105,32,61,32,50,32,42,32,77,95,80,73,32,42,32,120,105,46,120,59,10,32,32,32,32,102,108,111,97,116,32,99,111,115,95,116,104,101,116,97,32,61,32,115,113,114,116,40,40,49,32,45,32,120,105,46,121,41,32,47,32,40,49,32,43,32,40,114,95,115,113,117,97,114,101,32,42,32,114,95,115,113,117,97,114,101,32,45,32,49,41,32,42,32,120,105,46,121,41,41,59,10,32,32,32,32,102,108,111,97,116,32,115,105,110,95,116,104,101,116,97,32,61,32,115,113,114,116,40,49,32,45,32,99,111,115,95,116,104,101,116,97,32,42,32,99,111,115,95,116,104,101,116,97,41,59,10,10,32,32,32,32,114,101,116,117,114,110,32,118,101,99,51,40,115,105,110,95,116,104,101,116,97,32,42,32,99,111,115,40,112,104,105,41,44,32,115,105,110,95,116,104,101,116,97,32,42,32,115,105,110,40,112,104,105,41,44,32,99,111,115,95,116,104,101,116,97,41,59,10,125,10,10,118,111,105,100,32,102,105,110,100,95,97,114,98,105,116,114,97,114,121,95,116,97,110,103,101,110,116,40,118,101,99,51,32,110,111,114,109,97,108,44,32,111,117,116,32,118,101,99,51,32,116,97,110,103,101,110,116,44,32,111,117,116,32,118,101,99,51,32,98,105,116,97,110,103,101,110,116,41,32,123,10,32,32,32,32,118,101,99,51,32,118,48,32,61,32,97,98,115,40,110,111,114,109,97,108,46,122,41,32,60,32,48,46,57,57,57,32,63,32,118,101,99,51,40,48,46,48,44,32,48,46,48,44,32,49,46,48,41,32,58,32,118,101,99,51,40,48,46,48,44,32,49,46,48,44,32,48,46,48,41,59,10,32,32,32,32,116,97,110,103,101,110,116,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,118,48,44,32,110,111,114,109,97,108,41,41,59,10,32,32,32,32,98,105,116,97,110,103,101,110,116,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,116,97,110,103,101,110,116,44,32,110,111,114,109,97,108,41,41,59,10,125,10,10,98,111,111,108,32,112,111,105,110,116,95,98,101,116,119,101,101,110,95,112,108,97,110,101,115,40,102,108,111,97,116,32,122,44,32,102,108,111,97,116,32,122,95,97,44,32,102,108,111,97,116,32,122,95,98,44,32,102,108,111,97,116,32,116,114,97,99,101,95,108,101,110,103,116,104,44,32,111,117,116,32,98,111,111,108,32,104,105,116,95,102,97,99,116,111,114,41,32,123,10,10,32,32,32,32,47,47,32,84,104,105,115,32,116,114,97,99,101,115,32,99,111,114,114,101,99,116,44,32,98,117,116,32,108,111,111,107,115,32,119,101,105,114,100,32,98,101,99,97,117,115,101,32,103,97,112,115,32,97,114,101,32,110,111,116,32,102,105,108,108,101,100,10,32,32,32,32,47,47,32,114,101,116,117,114,110,32,122,32,43,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,62,61,32,109,105,110,40,122,95,97,44,32,122,95,98,41,32,45,32,48,46,48,48,48,49,53,32,38,38,32,122,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,60,61,32,109,97,120,40,122,95,97,44,32,122,95,98,41,59,10,10,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,102,97,108,115,101,59,10,10,32,32,32,32,47,47,32,84,104,105,115,32,116,114,97,99,101,115,32,34,105,110,99,111,114,114,101,99,116,34,44,32,98,117,116,32,108,111,111,107,115,32,98,101,116,116,101,114,32,98,101,99,97,117,115,101,32,103,97,112,115,32,97,114,101,32,103,101,116,116,105,110,103,32,102,105,108,108,101,100,32,116,104,101,110,10,32,32,32,32,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,61,48,46,48,48,48,49,59,10,32,32,32,32,99,111,110,115,116,32,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,98,97,99,107,102,97,99,101,32,61,32,48,46,48,48,48,48,48,49,59,10,32,32,32,32,105,102,32,40,122,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,42,32,116,114,97,99,101,95,108,101,110,103,116,104,32,60,61,32,109,97,120,40,122,95,97,44,32,122,95,98,41,41,32,123,10,10,32,32,32,32,32,105,102,32,40,116,114,117,101,41,32,123,10,9,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,40,122,32,43,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,42,32,116,114,97,99,101,95,108,101,110,103,116,104,41,32,62,61,10,9,9,9,32,32,32,32,109,105,110,40,122,95,97,44,32,122,95,98,41,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,98,97,99,107,102,97,99,101,59,10,32,32,32,32,32,125,32,101,108,115,101,32,123,10,9,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,116,114,117,101,59,10,32,32,32,32,32,32,125,10,10,9,114,101,116,117,114,110,32,116,114,117,101,59,10,32,32,32,32,125,10,10,32,32,32,32,114,101,116,117,114,110,32,102,97,108,115,101,59,10,125,10,10,98,111,111,108,32,111,117,116,95,111,102,95,115,99,114,101,101,110,40,118,101,99,50,32,116,99,111,111,114,100,41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,116,99,111,111,114,100,46,120,32,60,32,48,46,48,32,124,124,32,116,99,111,111,114,100,46,121,32,60,32,48,46,48,32,124,124,32,116,99,111,111,114,100,46,120,32,62,32,49,46,48,32,124,124,32,116,99,111,111,114,100,46,121,32,62,32,49,46,48,59,10,125,10,10,102,108,111,97,116,32,100,105,115,116,97,110,99,101,83,113,117,97,114,101,100,40,118,101,99,50,32,97,44,32,118,101,99,50,32,98,41,32,123,32,97,32,45,61,32,98,59,32,114,101,116,117,114,110,32,100,111,116,40,97,44,32,97,41,59,32,125,10,10,118,101,99,51,32,99,111,109,112,117,116,101,67,108,105,112,73,110,102,111,40,102,108,111,97,116,32,122,110,44,32,102,108,111,97,116,32,122,102,41,32,123,10,32,114,101,116,117,114,110,32,118,101,99,51,40,122,110,32,32,42,32,122,102,44,32,122,110,32,45,32,122,102,44,32,122,102,41,59,10,10,125,10,10,10,102,108,111,97,116,32,114,101,99,111,110,115,116,114,117,99,116,67,83,90,40,102,108,111,97,116,32,100,101,112,116,104,66,117,102,102,101,114,86,97,108,117,101,44,32,118,101,99,51,32,99,41,32,123,10,32,32,32,32,32,32,114,101,116,117,114,110,32,99,91,48,93,32,47,32,40,100,101,112,116,104,66,117,102,102,101,114,86,97,108,117,101,32,42,32,99,91,49,93,32,43,32,99,91,50,93,41,59,10,125,10,10,10,98,111,111,108,32,116,114,97,99,101,83,99,114,101,101,110,83,112,97,99,101,82,97,121,49,10,32,32,32,40,118,101,99,51,32,32,32,32,32,32,32,32,32,32,99,115,79,114,105,103,105,110,44,10,32,32,32,32,118,101,99,51,32,32,32,32,32,32,32,32,32,99,115,68,105,114,101,99,116,105,111,110,44,10,32,32,32,32,109,97,116,52,120,52,32,32,32,32,32,32,32,32,32,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,44,10,32,32,32,32,115,97,109,112,108,101,114,50,68,32,32,32,32,32,32,32,99,115,90,66,117,102,102,101,114,44,10,32,32,32,32,118,101,99,50,32,32,32,32,32,32,32,32,32,32,99,115,90,66,117,102,102,101,114,83,105,122,101,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,99,115,90,84,104,105,99,107,110,101,115,115,44,10,32,32,32,32,99,111,110,115,116,32,105,110,32,98,111,111,108,32,32,32,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,44,10,32,32,32,32,118,101,99,51,32,32,32,32,32,32,32,32,32,32,99,108,105,112,73,110,102,111,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,110,101,97,114,80,108,97,110,101,90,44,10,32,32,32,32,102,108,111,97,116,9,9,9,115,116,114,105,100,101,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,109,97,120,83,116,101,112,115,44,10,32,32,32,32,105,110,32,102,108,111,97,116,32,32,32,32,32,32,32,32,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,44,10,32,32,32,32,111,117,116,32,118,101,99,50,32,32,32,32,32,32,104,105,116,80,105,120,101,108,44,10,32,32,32,32,111,117,116,32,105,110,116,32,32,32,32,32,32,32,32,32,119,104,105,99,104,44,10,9,111,117,116,32,118,101,99,51,9,9,99,115,72,105,116,80,111,105,110,116,41,32,123,10,10,9,47,47,32,67,108,105,112,32,114,97,121,32,116,111,32,97,32,110,101,97,114,32,112,108,97,110,101,32,105,110,32,51,68,32,40,100,111,101,115,110,39,116,32,104,97,118,101,32,116,111,32,98,101,32,42,116,104,101,42,32,110,101,97,114,32,112,108,97,110,101,44,32,97,108,116,104,111,117,103,104,32,116,104,97,116,32,119,111,117,108,100,32,98,101,32,97,32,103,111,111,100,32,105,100,101,97,41,10,9,102,108,111,97,116,32,114,97,121,76,101,110,103,116,104,32,61,32,40,40,99,115,79,114,105,103,105,110,46,122,32,43,32,99,115,68,105,114,101,99,116,105,111,110,46,122,32,42,32,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,41,32,62,32,110,101,97,114,80,108,97,110,101,90,41,32,63,10,9,9,9,9,40,110,101,97,114,80,108,97,110,101,90,32,45,32,99,115,79,114,105,103,105,110,46,122,41,32,47,32,99,115,68,105,114,101,99,116,105,111,110,46,122,32,58,10,9,9,9,9,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,59,10,9,118,101,99,51,32,99,115,69,110,100,80,111,105,110,116,32,61,32,99,115,68,105,114,101,99,116,105,111,110,32,42,32,114,97,121,76,101,110,103,116,104,32,43,32,99,115,79,114,105,103,105,110,59,10,10,9,47,47,32,80,114,111,106,101,99,116,32,105,110,116,111,32,115,99,114,101,101,110,32,115,112,97,99,101,10,9,118,101,99,52,32,72,48,32,61,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,32,42,32,118,101,99,52,40,99,115,79,114,105,103,105,110,44,32,49,46,48,41,59,10,9,118,101,99,52,32,72,49,32,61,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,32,42,32,118,101,99,52,40,99,115,69,110,100,80,111,105,110,116,44,32,49,46,48,41,59,10,10,9,47,47,32,84,104,101,114,101,32,97,114,101,32,97,32,108,111,116,32,111,102,32,100,105,118,105,115,105,111,110,115,32,98,121,32,119,32,116,104,97,116,32,99,97,110,32,98,101,32,116,117,114,110,101,100,32,105,110,116,111,32,109,117,108,116,105,112,108,105,99,97,116,105,111,110,115,10,9,47,47,32,97,116,32,115,111,109,101,32,109,105,110,111,114,32,112,114,101,99,105,115,105,111,110,32,108,111,115,115,46,46,46,97,110,100,32,119,101,32,110,101,101,100,32,116,111,32,105,110,116,101,114,112,111,108,97,116,101,32,116,104,101,115,101,32,49,47,119,32,118,97,108,117,101,115,10,9,47,47,32,97,110,121,119,97,121,46,10,9,47,47,10,9,47,47,32,66,101,99,97,117,115,101,32,116,104,101,32,99,97,108,108,101,114,32,119,97,115,32,114,101,113,117,105,114,101,100,32,116,111,32,99,108,105,112,32,116,111,32,116,104,101,32,110,101,97,114,32,112,108,97,110,101,44,10,9,47,47,32,116,104,105,115,32,104,111,109,111,103,101,110,101,111,117,115,32,100,105,118,105,115,105,111,110,32,40,112,114,111,106,101,99,116,105,110,103,32,102,114,111,109,32,52,68,32,116,111,32,50,68,41,32,105,115,32,103,117,97,114,97,110,116,101,101,100,10,9,47,47,32,116,111,32,115,117,99,99,101,101,100,46,10,9,102,108,111,97,116,32,107,48,32,61,32,49,46,48,32,47,32,72,48,46,119,59,10,9,102,108,111,97,116,32,107,49,32,61,32,49,46,48,32,47,32,72,49,46,119,59,10,10,9,47,47,32,83,119,105,116,99,104,32,116,104,101,32,111,114,105,103,105,110,97,108,32,112,111,105,110,116,115,32,116,111,32,118,97,108,117,101,115,32,116,104,97,116,32,105,110,116,101,114,112,111,108,97,116,101,32,108,105,110,101,97,114,108,121,32,105,110,32,50,68,10,9,118,101,99,51,32,81,48,32,61,32,99,115,79,114,105,103,105,110,32,42,32,107,48,59,10,9,118,101,99,51,32,81,49,32,61,32,99,115,69,110,100,80,111,105,110,116,32,42,32,107,49,59,10,10,9,47,47,32,83,99,114,101,101,110,45,115,112,97,99,101,32,101,110,100,112,111,105,110,116,115,10,9,118,101,99,50,32,80,48,32,61,32,72,48,46,120,121,32,42,32,107,48,59,10,9,118,101,99,50,32,80,49,32,61,32,72,49,46,120,121,32,42,32,107,49,59,10,10,9,47,47,32,91,79,112,116,105,111,110,97,108,32,99,108,105,112,112,105,110,103,32,116,111,32,102,114,117,115,116,117,109,32,115,105,100,101,115,32,104,101,114,101,93,10,10,9,47,47,32,73,110,105,116,105,97,108,105,122,101,32,116,111,32,111,102,102,32,115,99,114,101,101,110,10,9,104,105,116,80,105,120,101,108,32,61,32,118,101,99,50,40,45,49,46,48,44,32,45,49,46,48,41,59,10,9,119,104,105,99,104,32,61,32,48,59,32,47,47,32,79,110,108,121,32,111,110,101,32,108,97,121,101,114,10,10,9,47,47,32,73,102,32,116,104,101,32,108,105,110,101,32,105,115,32,100,101,103,101,110,101,114,97,116,101,44,32,109,97,107,101,32,105,116,32,99,111,118,101,114,32,97,116,32,108,101,97,115,116,32,111,110,101,32,112,105,120,101,108,10,9,47,47,32,116,111,32,97,118,111,105,100,32,104,97,110,100,108,105,110,103,32,122,101,114,111,45,112,105,120,101,108,32,101,120,116,101,110,116,32,97,115,32,97,32,115,112,101,99,105,97,108,32,99,97,115,101,32,108,97,116,101,114,10,9,80,49,32,43,61,32,118,101,99,50,40,40,100,105,115,116,97,110,99,101,83,113,117,97,114,101,100,40,80,48,44,32,80,49,41,32,60,32,48,46,48,48,48,49,41,32,63,32,48,46,48,49,32,58,32,48,46,48,41,59,10,10,9,118,101,99,50,32,100,101,108,116,97,32,61,32,80,49,32,45,32,80,48,59,10,10,9,47,47,32,80,101,114,109,117,116,101,32,115,111,32,116,104,97,116,32,116,104,101,32,112,114,105,109,97,114,121,32,105,116,101,114,97,116,105,111,110,32,105,115,32,105,110,32,120,32,116,111,32,114,101,100,117,99,101,10,9,47,47,32,108,97,114,103,101,32,98,114,97,110,99,104,101,115,32,108,97,116,101,114,10,9,98,111,111,108,32,112,101,114,109,117,116,101,32,61,32,102,97,108,115,101,59,10,9,105,102,32,40,97,98,115,40,100,101,108,116,97,46,120,41,32,60,32,97,98,115,40,100,101,108,116,97,46,121,41,41,32,123,10,9,9,47,47,32,77,111,114,101,45,118,101,114,116,105,99,97,108,32,108,105,110,101,46,32,67,114,101,97,116,101,32,97,32,112,101,114,109,117,116,97,116,105,111,110,32,116,104,97,116,32,115,119,97,112,115,32,120,32,97,110,100,32,121,32,105,110,32,116,104,101,32,111,117,116,112,117,116,10,9,9,112,101,114,109,117,116,101,32,61,32,116,114,117,101,59,10,10,9,9,47,47,32,68,105,114,101,99,116,108,121,32,115,119,105,122,122,108,101,32,116,104,101,32,105,110,112,117,116,115,10,9,9,100,101,108,116,97,32,61,32,100,101,108,116,97,46,121,120,59,10,9,9,80,49,32,61,32,80,49,46,121,120,59,10,9,9,80,48,32,61,32,80,48,46,121,120,59,10,9,125,10,10,9,47,47,32,70,114,111,109,32,110,111,119,32,111,110,44,32,34,120,34,32,105,115,32,116,104,101,32,112,114,105,109,97,114,121,32,105,116,101,114,97,116,105,111,110,32,100,105,114,101,99,116,105,111,110,32,97,110,100,32,34,121,34,32,105,115,32,116,104,101,32,115,101,99,111,110,100,97,114,121,32,111,110,101,10,10,9,102,108,111,97,116,32,115,116,101,112,68,105,114,101,99,116,105,111,110,32,61,32,115,105,103,110,40,100,101,108,116,97,46,120,41,59,10,9,102,108,111,97,116,32,105,110,118,100,120,32,61,32,115,116,101,112,68,105,114,101,99,116,105,111,110,32,47,32,100,101,108,116,97,46,120,59,10,9,118,101,99,50,32,100,80,32,61,32,118,101,99,50,40,115,116,101,112,68,105,114,101,99,116,105,111,110,44,32,105,110,118,100,120,32,42,32,100,101,108,116,97,46,121,41,59,10,10,9,47,47,32,84,114,97,99,107,32,116,104,101,32,100,101,114,105,118,97,116,105,118,101,115,32,111,102,32,81,32,97,110,100,32,107,10,9,118,101,99,51,32,100,81,32,61,32,40,81,49,32,45,32,81,48,41,32,42,32,105,110,118,100,120,59,10,9,102,108,111,97,116,32,32,32,100,107,32,61,32,40,107,49,32,45,32,107,48,41,32,42,32,105,110,118,100,120,59,10,10,9,47,47,32,83,99,97,108,101,32,100,101,114,105,118,97,116,105,118,101,115,32,98,121,32,116,104,101,32,100,101,115,105,114,101,100,32,112,105,120,101,108,32,115,116,114,105,100,101,10,9,100,80,32,42,61,32,115,116,114,105,100,101,59,32,100,81,32,42,61,32,115,116,114,105,100,101,59,32,100,107,32,42,61,32,115,116,114,105,100,101,59,10,10,9,47,47,32,79,102,102,115,101,116,32,116,104,101,32,115,116,97,114,116,105,110,103,32,118,97,108,117,101,115,32,98,121,32,116,104,101,32,106,105,116,116,101,114,32,102,114,97,99,116,105,111,110,10,9,80,48,32,43,61,32,100,80,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,32,81,48,32,43,61,32,100,81,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,32,107,48,32,43,61,32,100,107,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,10,10,9,47,47,32,83,108,105,100,101,32,80,32,102,114,111,109,32,80,48,32,116,111,32,80,49,44,32,40,110,111,119,45,104,111,109,111,103,101,110,101,111,117,115,41,32,81,32,102,114,111,109,32,81,48,32,116,111,32,81,49,44,32,97,110,100,32,107,32,102,114,111,109,32,107,48,32,116,111,32,107,49,10,9,118,101,99,51,32,81,32,61,32,81,48,59,10,9,102,108,111,97,116,32,32,107,32,61,32,107,48,59,10,10,9,47,47,32,87,101,32,116,114,97,99,107,32,116,104,101,32,114,97,121,32,100,101,112,116,104,32,97,116,32,43,47,45,32,49,47,50,32,112,105,120,101,108,32,116,111,32,116,114,101,97,116,32,112,105,120,101,108,115,32,97,115,32,99,108,105,112,45,115,112,97,99,101,32,115,111,108,105,100,10,9,47,47,32,118,111,120,101,108,115,46,32,66,101,99,97,117,115,101,32,116,104,101,32,100,101,112,116,104,32,97,116,32,45,49,47,50,32,102,111,114,32,97,32,103,105,118,101,110,32,112,105,120,101,108,32,119,105,108,108,32,98,101,32,116,104,101,32,115,97,109,101,32,97,115,32,97,116,10,9,47,47,32,43,49,47,50,32,102,111,114,32,116,104,101,32,112,114,101,118,105,111,117,115,32,105,116,101,114,97,116,105,111,110,44,32,119,101,32,97,99,116,117,97,108,108,121,32,111,110,108,121,32,104,97,118,101,32,116,111,32,99,111,109,112,117,116,101,32,111,110,101,32,118,97,108,117,101,10,9,47,47,32,112,101,114,32,105,116,101,114,97,116,105,111,110,46,10,9,102,108,111,97,116,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,32,61,32,99,115,79,114,105,103,105,110,46,122,59,10,9,102,108,111,97,116,32,115,116,101,112,67,111,117,110,116,32,61,32,48,46,48,59,10,9,102,108,111,97,116,32,114,97,121,90,77,97,120,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,44,32,114,97,121,90,77,105,110,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,59,10,9,102,108,111,97,116,32,115,99,101,110,101,90,77,97,120,32,61,32,114,97,121,90,77,97,120,32,43,32,49,101,52,59,10,10,9,47,47,32,80,49,46,120,32,105,115,32,110,101,118,101,114,32,109,111,100,105,102,105,101,100,32,97,102,116,101,114,32,116,104,105,115,32,112,111,105,110,116,44,32,115,111,32,112,114,101,45,115,99,97,108,101,32,105,116,32,98,121,10,9,47,47,32,116,104,101,32,115,116,101,112,32,100,105,114,101,99,116,105,111,110,32,102,111,114,32,97,32,115,105,103,110,101,100,32,99,111,109,112,97,114,105,115,111,110,10,9,102,108,111,97,116,32,101,110,100,32,61,32,80,49,46,120,32,42,32,115,116,101,112,68,105,114,101,99,116,105,111,110,59,10,10,9,47,47,32,87,101,32,111,110,108,121,32,97,100,118,97,110,99,101,32,116,104,101,32,122,32,102,105,101,108,100,32,111,102,32,81,32,105,110,32,116,104,101,32,105,110,110,101,114,32,108,111,111,112,44,32,115,105,110,99,101,10,9,47,47,32,81,46,120,121,32,105,115,32,110,101,118,101,114,32,117,115,101,100,32,117,110,116,105,108,32,97,102,116,101,114,32,116,104,101,32,108,111,111,112,32,116,101,114,109,105,110,97,116,101,115,46,10,10,10,9,102,111,114,32,40,118,101,99,50,32,80,32,61,32,80,48,59,10,9,32,32,32,32,32,40,40,80,46,120,32,42,32,115,116,101,112,68,105,114,101,99,116,105,111,110,41,32,60,61,32,101,110,100,41,32,38,38,10,9,32,32,32,32,32,40,115,116,101,112,67,111,117,110,116,32,60,32,109,97,120,83,116,101,112,115,41,32,38,38,10,9,32,32,32,32,32,40,40,114,97,121,90,77,97,120,32,60,32,115,99,101,110,101,90,77,97,120,32,45,32,99,115,90,84,104,105,99,107,110,101,115,115,41,32,124,124,10,9,32,32,32,32,32,32,40,114,97,121,90,77,105,110,32,62,32,115,99,101,110,101,90,77,97,120,41,41,32,38,38,10,9,32,32,32,32,32,40,115,99,101,110,101,90,77,97,120,32,33,61,32,48,46,48,41,59,10,9,32,32,32,32,32,80,32,43,61,32,100,80,44,32,81,46,122,32,43,61,32,100,81,46,122,44,32,107,32,43,61,32,100,107,44,32,115,116,101,112,67,111,117,110,116,32,43,61,32,49,46,48,41,32,123,10,10,9,9,104,105,116,80,105,120,101,108,32,61,32,112,101,114,109,117,116,101,32,63,32,80,46,121,120,32,58,32,80,59,10,10,9,9,47,47,32,84,104,101,32,100,101,112,116,104,32,114,97,110,103,101,32,116,104,97,116,32,116,104,101,32,114,97,121,32,99,111,118,101,114,115,32,119,105,116,104,105,110,32,116,104,105,115,32,108,111,111,112,10,9,9,47,47,32,105,116,101,114,97,116,105,111,110,46,32,32,65,115,115,117,109,101,32,116,104,97,116,32,116,104,101,32,114,97,121,32,105,115,32,109,111,118,105,110,103,32,105,110,32,105,110,99,114,101,97,115,105,110,103,32,122,10,9,9,47,47,32,97,110,100,32,115,119,97,112,32,105,102,32,98,97,99,107,119,97,114,100,115,46,32,32,66,101,99,97,117,115,101,32,111,110,101,32,101,110,100,32,111,102,32,116,104,101,32,105,110,116,101,114,118,97,108,32,105,115,10,9,9,47,47,32,115,104,97,114,101,100,32,98,101,116,119,101,101,110,32,97,100,106,97,99,101,110,116,32,105,116,101,114,97,116,105,111,110,115,44,32,119,101,32,116,114,97,99,107,32,116,104,101,32,112,114,101,118,105,111,117,115,10,9,9,47,47,32,118,97,108,117,101,32,97,110,100,32,116,104,101,110,32,115,119,97,112,32,97,115,32,110,101,101,100,101,100,32,116,111,32,101,110,115,117,114,101,32,99,111,114,114,101,99,116,32,111,114,100,101,114,105,110,103,10,9,9,114,97,121,90,77,105,110,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,59,10,10,9,9,47,47,32,67,111,109,112,117,116,101,32,116,104,101,32,118,97,108,117,101,32,97,116,32,49,47,50,32,112,105,120,101,108,32,105,110,116,111,32,116,104,101,32,102,117,116,117,114,101,10,9,9,114,97,121,90,77,97,120,32,61,32,40,100,81,46,122,32,42,32,48,46,53,32,43,32,81,46,122,41,32,47,32,40,100,107,32,42,32,48,46,53,32,43,32,107,41,59,10,9,9,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,32,61,32,114,97,121,90,77,97,120,59,10,9,9,105,102,32,40,114,97,121,90,77,105,110,32,62,32,114,97,121,90,77,97,120,41,32,123,10,9,9,9,102,108,111,97,116,32,97,117,120,32,61,32,114,97,121,90,77,105,110,59,10,9,9,9,114,97,121,90,77,105,110,61,114,97,121,90,77,97,120,59,10,9,9,9,114,97,121,90,77,97,120,61,97,117,120,59,10,10,9,9,125,10,10,10,9,9,47,47,32,67,97,109,101,114,97,45,115,112,97,99,101,32,122,32,111,102,32,116,104,101,32,98,97,99,107,103,114,111,117,110,100,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,116,101,120,101,108,70,101,116,99,104,40,99,115,90,66,117,102,102,101,114,44,32,105,118,101,99,50,40,104,105,116,80,105,120,101,108,41,44,32,48,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,10,9,9,47,47,32,84,104,105,115,32,99,111,109,112,105,108,101,115,32,97,119,97,121,32,119,104,101,110,32,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,32,61,32,102,97,108,115,101,10,9,9,47,42,105,102,32,40,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,41,32,123,10,9,9,9,115,99,101,110,101,90,77,97,120,32,61,32,114,101,99,111,110,115,116,114,117,99,116,67,83,90,40,115,99,101,110,101,90,77,97,120,44,32,99,108,105,112,73,110,102,111,41,59,10,9,9,125,42,47,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,115,99,101,110,101,90,77,97,120,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,45,115,99,101,110,101,90,77,97,120,59,10,10,10,10,9,125,32,47,47,32,112,105,120,101,108,32,111,110,32,114,97,121,10,10,10,10,9,81,46,120,121,32,43,61,32,100,81,46,120,121,32,42,32,115,116,101,112,67,111,117,110,116,59,10,9,99,115,72,105,116,80,111,105,110,116,32,61,32,81,32,42,32,40,49,46,48,32,47,32,107,41,59,10,10,9,47,47,32,77,97,116,99,104,101,115,32,116,104,101,32,110,101,119,32,108,111,111,112,32,99,111,110,100,105,116,105,111,110,58,10,9,114,101,116,117,114,110,32,40,114,97,121,90,77,97,120,32,62,61,32,115,99,101,110,101,90,77,97,120,32,45,32,99,115,90,84,104,105,99,107,110,101,115,115,41,32,38,38,32,40,114,97,121,90,77,105,110,32,60,61,32,115,99,101,110,101,90,77,97,120,41,59,10,125,10,10,118,111,105,100,32,115,119,97,112,102,40,105,110,111,117,116,32,102,108,111,97,116,32,97,44,105,110,111,117,116,32,102,108,111,97,116,32,98,41,32,123,10,9,102,108,111,97,116,32,97,117,120,61,97,59,10,9,97,61,98,59,10,9,98,61,97,117,120,59,10,125,10,102,108,111,97,116,32,114,97,110,100,40,118,101,99,50,32,99,111,41,123,10,32,32,32,32,114,101,116,117,114,110,32,102,114,97,99,116,40,115,105,110,40,100,111,116,40,99,111,46,120,121,32,44,118,101,99,50,40,49,50,46,57,56,57,56,44,55,56,46,50,51,51,41,41,41,32,42,32,52,51,55,53,56,46,53,52,53,51,41,59,10,125,10,10,102,108,111,97,116,32,115,112,101,99,117,108,97,114,80,111,119,101,114,84,111,67,111,110,101,65,110,103,108,101,40,102,108,111,97,116,32,115,112,101,99,117,108,97,114,80,111,119,101,114,41,32,123,10,9,102,108,111,97,116,32,101,120,112,111,110,101,110,116,32,61,32,49,46,48,102,32,47,32,40,115,112,101,99,117,108,97,114,80,111,119,101,114,32,43,32,49,46,48,102,41,59,10,9,114,101,116,117,114,110,32,97,99,111,115,40,112,111,119,40,48,46,50,52,52,102,44,32,101,120,112,111,110,101,110,116,41,41,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,79,112,112,111,115,105,116,101,40,102,108,111,97,116,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,44,32,102,108,111,97,116,32,99,111,110,101,84,104,101,116,97,41,10,123,10,9,47,47,32,115,105,109,112,108,101,32,116,114,105,103,32,97,110,100,32,97,108,103,101,98,114,97,32,45,32,115,111,104,44,32,99,97,104,44,32,116,111,97,32,45,32,116,97,110,40,116,104,101,116,97,41,32,61,32,111,112,112,47,97,100,106,44,32,111,112,112,32,61,32,116,97,110,40,116,104,101,116,97,41,32,42,32,97,100,106,44,32,116,104,101,110,32,109,117,108,116,105,112,108,121,32,42,32,50,46,48,102,32,102,111,114,32,105,115,111,115,99,101,108,101,115,32,116,114,105,97,110,103,108,101,32,98,97,115,101,10,9,114,101,116,117,114,110,32,50,46,48,102,32,42,32,116,97,110,40,99,111,110,101,84,104,101,116,97,41,32,42,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,73,110,82,97,100,105,117,115,40,102,108,111,97,116,32,97,44,32,102,108,111,97,116,32,104,41,10,123,10,9,102,108,111,97,116,32,97,50,32,61,32,97,32,42,32,97,59,10,9,102,108,111,97,116,32,102,104,50,32,61,32,52,46,48,102,32,42,32,104,32,42,32,104,59,10,9,114,101,116,117,114,110,32,40,97,32,42,32,40,115,113,114,116,40,97,50,32,43,32,102,104,50,41,32,45,32,97,41,41,32,47,32,40,52,46,48,102,32,42,32,104,41,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,78,101,120,116,65,100,106,97,99,101,110,116,40,102,108,111,97,116,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,44,32,102,108,111,97,116,32,105,110,99,105,114,99,108,101,82,97,100,105,117,115,41,10,123,10,9,47,47,32,115,117,98,116,114,97,99,116,32,116,104,101,32,100,105,97,109,101,116,101,114,32,111,102,32,116,104,101,32,105,110,99,105,114,99,108,101,32,116,111,32,103,101,116,32,116,104,101,32,97,100,106,97,99,101,110,116,32,115,105,100,101,32,111,102,32,116,104,101,32,110,101,120,116,32,108,101,118,101,108,32,111,110,32,116,104,101,32,99,111,110,101,10,9,114,101,116,117,114,110,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,32,45,32,40,105,110,99,105,114,99,108,101,82,97,100,105,117,115,32,42,32,50,46,48,102,41,59,10,125,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,10,9,102,108,111,97,116,32,110,117,109,95,115,116,101,112,115,61,54,52,59,10,9,102,108,111,97,116,32,105,110,105,116,105,97,108,95,98,105,97,115,61,48,46,49,59,10,9,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,61,48,46,49,59,10,10,9,47,47,47,47,10,10,9,118,101,99,52,32,100,105,102,102,117,115,101,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,9,118,101,99,52,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,44,32,117,118,95,105,110,116,101,114,112,41,59,10,10,9,118,101,99,51,32,110,111,114,109,97,108,59,10,10,9,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,120,121,122,42,50,46,48,45,49,46,48,59,10,10,9,105,102,32,40,102,97,108,115,101,41,32,123,10,9,32,32,32,32,102,108,111,97,116,32,115,99,97,108,101,32,61,32,49,46,55,55,55,55,59,10,9,32,32,32,32,118,101,99,51,32,110,110,32,61,10,9,9,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,120,121,122,42,118,101,99,51,40,50,46,48,42,115,99,97,108,101,44,50,46,48,42,115,99,97,108,101,44,48,46,48,41,32,43,10,9,9,118,101,99,51,40,45,115,99,97,108,101,44,45,115,99,97,108,101,44,49,46,48,41,59,10,9,32,32,32,32,102,108,111,97,116,32,103,32,61,32,50,46,48,32,47,32,100,111,116,40,110,110,46,120,121,122,44,110,110,46,120,121,122,41,59,10,9,32,32,32,32,118,101,99,51,32,110,59,10,9,32,32,32,32,110,46,120,121,32,61,32,103,42,110,110,46,120,121,59,10,9,32,32,32,32,110,46,122,32,61,32,103,45,49,46,48,59,10,9,32,32,32,110,111,114,109,97,108,61,110,59,10,9,125,10,10,9,118,101,99,51,32,116,97,110,103,101,110,116,59,10,9,118,101,99,51,32,98,105,110,111,114,109,97,108,59,10,9,102,105,110,100,95,97,114,98,105,116,114,97,114,121,95,116,97,110,103,101,110,116,40,110,111,114,109,97,108,44,32,116,97,110,103,101,110,116,44,32,98,105,110,111,114,109,97,108,41,59,10,10,9,102,108,111,97,116,32,114,111,117,103,104,110,101,115,115,32,61,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,119,59,10,10,9,102,108,111,97,116,32,100,101,112,116,104,95,116,101,120,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,117,118,95,105,110,116,101,114,112,41,46,114,59,10,10,9,118,101,99,52,32,119,111,114,108,100,95,112,111,115,32,61,32,105,110,118,101,114,115,101,95,112,114,111,106,101,99,116,105,111,110,32,42,32,118,101,99,52,40,32,117,118,95,105,110,116,101,114,112,42,50,46,48,45,49,46,48,44,32,100,101,112,116,104,95,116,101,120,42,50,46,48,45,49,46,48,44,32,49,46,48,32,41,59,10,9,118,101,99,51,32,118,101,114,116,101,120,32,61,32,119,111,114,108,100,95,112,111,115,46,120,121,122,47,119,111,114,108,100,95,112,111,115,46,119,59,10,10,9,118,101,99,51,32,118,105,101,119,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,101,114,116,101,120,41,59,10,9,118,101,99,51,32,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,114,101,102,108,101,99,116,40,118,105,101,119,95,100,105,114,44,32,110,111,114,109,97,108,41,41,59,10,10,9,47,47,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,105,101,119,95,100,105,114,32,45,32,110,111,114,109,97,108,32,42,32,100,111,116,40,110,111,114,109,97,108,44,118,105,101,119,95,100,105,114,41,32,42,32,50,46,48,41,59,10,10,9,47,47,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,101,99,51,40,49,44,49,44,45,49,41,41,59,10,10,10,9,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,10,10,10,9,47,47,109,97,107,101,32,114,97,121,32,108,101,110,103,116,104,32,97,110,100,32,99,108,105,112,32,105,116,32,97,103,97,105,110,115,116,32,116,104,101,32,110,101,97,114,32,112,108,97,110,101,32,40,100,111,110,39,116,32,119,97,110,116,32,116,111,32,116,114,97,99,101,32,98,101,121,111,110,100,32,118,105,115,105,98,108,101,41,10,9,102,108,111,97,116,32,114,97,121,95,108,101,110,32,61,32,40,118,101,114,116,101,120,46,122,32,43,32,114,97,121,95,100,105,114,46,122,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,41,32,62,32,45,99,97,109,101,114,97,95,122,95,110,101,97,114,32,63,32,40,45,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,118,101,114,116,101,120,46,122,41,32,47,32,114,97,121,95,100,105,114,46,122,32,58,32,99,97,109,101,114,97,95,122,95,102,97,114,59,10,9,118,101,99,51,32,114,97,121,95,101,110,100,32,61,32,118,101,114,116,101,120,32,43,32,114,97,121,95,100,105,114,42,114,97,121,95,108,101,110,59,10,10,9,102,108,111,97,116,32,119,95,98,101,103,105,110,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,98,101,103,105,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,44,119,95,98,101,103,105,110,41,59,10,9,102,108,111,97,116,32,119,95,101,110,100,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,101,110,100,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,32,114,97,121,95,101,110,100,44,32,119,95,101,110,100,41,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,100,105,114,32,61,32,118,112,95,108,105,110,101,95,101,110,100,45,118,112,95,108,105,110,101,95,98,101,103,105,110,59,10,10,10,9,119,95,98,101,103,105,110,32,61,32,49,46,48,47,119,95,98,101,103,105,110,59,10,9,119,95,101,110,100,32,61,32,49,46,48,47,119,95,101,110,100,59,10,10,10,9,102,108,111,97,116,32,122,95,98,101,103,105,110,32,61,32,118,101,114,116,101,120,46,122,42,119,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,95,101,110,100,32,61,32,114,97,121,95,101,110,100,46,122,42,119,95,101,110,100,59,10,10,9,118,101,99,50,32,108,105,110,101,95,98,101,103,105,110,32,61,32,118,112,95,108,105,110,101,95,98,101,103,105,110,47,112,105,120,101,108,95,115,105,122,101,59,10,9,118,101,99,50,32,108,105,110,101,95,100,105,114,32,61,32,118,112,95,108,105,110,101,95,100,105,114,47,112,105,120,101,108,95,115,105,122,101,59,10,9,102,108,111,97,116,32,122,95,100,105,114,32,61,32,122,95,101,110,100,32,45,32,122,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,119,95,100,105,114,32,61,32,119,95,101,110,100,32,45,32,119,95,98,101,103,105,110,59,10,10,10,9,47,47,32,99,108,105,112,32,116,104,101,32,108,105,110,101,32,116,111,32,116,104,101,32,118,105,101,119,112,111,114,116,32,101,100,103,101,115,10,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,120,41,32,47,32,109,97,120,40,49,101,45,53,44,32,118,112,95,108,105,110,101,95,100,105,114,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,121,41,32,47,32,109,97,120,40,49,101,45,53,44,32,118,112,95,108,105,110,101,95,100,105,114,46,121,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,120,32,47,32,109,97,120,40,49,101,45,53,44,32,45,118,112,95,108,105,110,101,95,100,105,114,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,121,32,47,32,109,97,120,40,49,101,45,53,44,32,45,118,112,95,108,105,110,101,95,100,105,114,46,121,41,41,59,10,9,102,108,111,97,116,32,108,105,110,101,95,99,108,105,112,32,61,32,109,105,110,40,115,99,97,108,101,95,109,97,120,95,120,44,32,115,99,97,108,101,95,109,97,120,95,121,41,32,42,32,109,105,110,40,115,99,97,108,101,95,109,105,110,95,120,44,32,115,99,97,108,101,95,109,105,110,95,121,41,59,10,9,108,105,110,101,95,100,105,114,32,42,61,32,108,105,110,101,95,99,108,105,112,59,10,9,122,95,100,105,114,32,42,61,32,108,105,110,101,95,99,108,105,112,59,10,9,119,95,100,105,114,32,42,61,108,105,110,101,95,99,108,105,112,59,10,10,10,9,118,101,99,50,32,108,105,110,101,95,97,100,118,97,110,99,101,32,61,32,110,111,114,109,97,108,105,122,101,40,108,105,110,101,95,100,105,114,41,59,32,47,47,100,111,119,110,32,116,111,32,112,105,120,101,108,10,9,102,108,111,97,116,32,115,116,101,112,95,115,105,122,101,32,61,32,108,101,110,103,116,104,40,108,105,110,101,95,97,100,118,97,110,99,101,41,47,108,101,110,103,116,104,40,108,105,110,101,95,100,105,114,41,59,10,9,102,108,111,97,116,32,122,95,97,100,118,97,110,99,101,32,61,32,122,95,100,105,114,42,115,116,101,112,95,115,105,122,101,59,32,47,47,32,97,100,97,112,116,32,122,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,9,102,108,111,97,116,32,119,95,97,100,118,97,110,99,101,32,61,32,119,95,100,105,114,42,115,116,101,112,95,115,105,122,101,59,32,47,47,32,97,100,97,112,116,32,119,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,10,9,102,108,111,97,116,32,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,32,61,32,49,46,48,47,109,97,120,40,97,98,115,40,108,105,110,101,95,97,100,118,97,110,99,101,46,120,41,44,97,98,115,40,108,105,110,101,95,97,100,118,97,110,99,101,46,121,41,41,59,32,47,47,109,97,107,101,32,105,116,32,103,111,32,102,97,115,116,101,114,32,116,104,101,32,99,108,111,115,101,114,32,116,111,32,52,53,100,10,9,108,105,110,101,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,32,47,47,32,97,100,97,112,116,32,122,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,9,122,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,10,9,119,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,10,10,9,118,101,99,50,32,112,111,115,32,61,32,108,105,110,101,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,32,61,32,122,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,119,32,61,32,119,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,95,102,114,111,109,61,122,47,119,59,10,9,102,108,111,97,116,32,122,95,116,111,61,122,95,102,114,111,109,59,10,9,102,108,111,97,116,32,100,101,112,116,104,59,10,9,118,101,99,50,32,112,114,101,118,95,112,111,115,61,112,111,115,59,10,10,9,98,111,111,108,32,102,111,117,110,100,61,102,97,108,115,101,59,10,10,9,102,108,111,97,116,32,97,99,99,101,108,61,49,46,48,52,59,47,47,43,114,97,110,100,40,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,41,42,48,46,48,48,48,49,59,10,9,102,108,111,97,116,32,115,116,101,112,115,95,116,97,107,101,110,61,48,59,10,10,9,102,111,114,40,102,108,111,97,116,32,105,61,48,59,105,60,110,117,109,95,115,116,101,112,115,59,105,43,43,41,32,123,10,10,9,9,112,111,115,43,61,108,105,110,101,95,97,100,118,97,110,99,101,59,10,9,9,122,43,61,122,95,97,100,118,97,110,99,101,59,10,9,9,119,43,61,119,95,97,100,118,97,110,99,101,59,10,10,9,9,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,32,112,111,115,42,112,105,120,101,108,95,115,105,122,101,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,100,101,112,116,104,61,45,100,101,112,116,104,59,10,10,9,9,122,95,102,114,111,109,32,61,32,122,95,116,111,59,10,9,9,122,95,116,111,32,61,32,122,47,119,59,10,10,9,9,105,102,32,40,100,101,112,116,104,62,122,95,116,111,41,32,123,10,10,9,9,9,105,102,32,40,100,101,112,116,104,60,61,109,97,120,40,122,95,116,111,44,122,95,102,114,111,109,41,43,48,46,56,41,32,123,10,9,9,9,9,102,111,117,110,100,61,116,114,117,101,59,10,9,9,9,125,10,9,9,9,98,114,101,97,107,59,10,9,9,125,10,10,9,9,115,116,101,112,115,95,116,97,107,101,110,43,61,49,46,48,59,10,9,9,112,114,101,118,95,112,111,115,61,112,111,115,59,10,9,9,122,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,9,119,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,9,108,105,110,101,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,125,10,10,9,105,102,32,40,102,111,117,110,100,41,32,123,10,10,10,9,9,118,101,99,50,32,102,105,110,97,108,95,112,111,115,59,10,9,9,102,108,111,97,116,32,103,114,97,100,59,10,35,100,101,102,105,110,101,32,66,76,69,78,68,95,65,67,67,69,76,10,35,105,102,100,101,102,32,66,76,69,78,68,95,65,67,67,69,76,10,10,9,9,118,101,99,50,32,98,108,101,110,100,95,100,105,114,32,61,32,112,111,115,32,45,32,112,114,101,118,95,112,111,115,59,10,9,9,102,108,111,97,116,32,115,116,101,112,115,32,61,32,109,105,110,40,56,46,48,44,108,101,110,103,116,104,40,98,108,101,110,100,95,100,105,114,41,41,59,10,9,9,105,102,32,40,115,116,101,112,115,62,50,46,48,41,32,123,10,9,9,9,118,101,99,50,32,98,108,101,110,100,95,115,116,101,112,32,61,32,98,108,101,110,100,95,100,105,114,47,115,116,101,112,115,59,10,9,9,9,102,108,111,97,116,32,98,108,101,110,100,95,122,32,61,32,40,122,95,116,111,45,122,95,102,114,111,109,41,47,115,116,101,112,115,59,10,9,9,9,118,101,99,50,32,110,101,119,95,112,111,115,59,10,9,9,9,102,108,111,97,116,32,115,117,98,103,114,97,100,61,48,46,48,59,10,9,9,9,102,111,114,40,102,108,111,97,116,32,105,61,48,46,48,59,105,60,115,116,101,112,115,59,105,43,43,41,32,123,10,10,9,9,9,9,110,101,119,95,112,111,115,32,61,32,40,112,114,101,118,95,112,111,115,43,98,108,101,110,100,95,115,116,101,112,42,105,41,59,10,9,9,9,9,102,108,111,97,116,32,122,32,61,32,122,95,102,114,111,109,43,98,108,101,110,100,95,122,42,105,59,10,10,9,9,9,9,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,32,110,101,119,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,9,9,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,9,9,100,101,112,116,104,61,45,100,101,112,116,104,59,10,10,9,9,9,9,115,117,98,103,114,97,100,61,105,47,115,116,101,112,115,59,10,9,9,9,9,105,102,32,40,100,101,112,116,104,62,122,41,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,125,10,10,9,9,9,102,105,110,97,108,95,112,111,115,32,61,32,110,101,119,95,112,111,115,59,10,9,9,9,103,114,97,100,61,40,115,116,101,112,115,95,116,97,107,101,110,43,115,117,98,103,114,97,100,41,47,110,117,109,95,115,116,101,112,115,59,10,9,9,9,47,47,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,118,101,99,51,40,103,114,97,100,41,44,49,46,48,41,59,10,9,9,125,32,101,108,115,101,32,123,10,35,101,110,100,105,102,10,9,9,9,103,114,97,100,61,115,116,101,112,115,95,116,97,107,101,110,47,110,117,109,95,115,116,101,112,115,59,10,9,9,9,102,105,110,97,108,95,112,111,115,61,112,111,115,59,10,35,105,102,100,101,102,32,66,76,69,78,68,95,65,67,67,69,76,10,9,9,125,10,10,35,101,110,100,105,102,10,10,35,100,101,102,105,110,101,32,82,69,70,76,69,67,84,95,82,79,85,71,72,78,69,83,83,10,35,105,102,100,101,102,32,82,69,70,76,69,67,84,95,82,79,85,71,72,78,69,83,83,10,10,10,9,9,118,101,99,52,32,102,105,110,97,108,95,99,111,108,111,114,59,10,10,9,9,105,102,32,40,114,111,117,103,104,110,101,115,115,32,62,32,48,46,48,48,49,41,32,123,10,9,9,9,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,10,9,9,9,47,47,117,115,101,32,97,32,98,108,117,114,114,101,100,32,118,101,114,115,105,111,110,32,40,105,110,32,99,111,110,115,101,99,117,116,105,118,101,32,109,105,112,109,97,112,115,41,32,111,102,32,116,104,101,32,115,99,114,101,101,110,32,116,111,32,115,105,109,117,108,97,116,101,32,114,111,117,103,104,110,101,115,115,10,10,9,9,9,102,108,111,97,116,32,103,108,111,115,115,32,61,32,49,46,48,45,114,111,117,103,104,110,101,115,115,59,10,9,9,9,102,108,111,97,116,32,99,111,110,101,95,97,110,103,108,101,32,61,32,114,111,117,103,104,110,101,115,115,32,42,32,77,95,80,73,32,42,32,48,46,53,59,10,9,9,9,118,101,99,50,32,99,111,110,101,95,100,105,114,32,61,32,102,105,110,97,108,95,112,111,115,32,45,32,108,105,110,101,95,98,101,103,105,110,59,10,9,9,9,102,108,111,97,116,32,99,111,110,101,95,108,101,110,32,61,32,108,101,110,103,116,104,40,99,111,110,101,95,100,105,114,41,59,10,9,9,9,99,111,110,101,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,99,111,110,101,95,100,105,114,41,59,32,47,47,119,105,108,108,32,98,101,32,117,115,101,100,32,110,111,114,109,97,108,105,122,101,100,32,102,114,111,109,32,110,111,119,32,111,110,10,9,9,9,102,108,111,97,116,32,109,97,120,95,109,105,112,109,97,112,32,61,32,102,105,108,116,101,114,95,109,105,112,109,97,112,95,108,101,118,101,108,115,32,45,49,59,10,9,9,9,102,108,111,97,116,32,103,108,111,115,115,95,109,117,108,116,61,103,108,111,115,115,59,10,10,9,9,9,102,108,111,97,116,32,114,101,109,95,97,108,112,104,97,61,49,46,48,59,10,9,9,9,102,105,110,97,108,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,48,41,59,10,10,9,9,9,102,111,114,40,105,110,116,32,105,61,48,59,105,60,55,59,105,43,43,41,32,123,10,10,9,9,9,9,102,108,111,97,116,32,111,112,95,108,101,110,32,61,32,50,46,48,32,42,32,116,97,110,40,99,111,110,101,95,97,110,103,108,101,41,32,42,32,99,111,110,101,95,108,101,110,59,32,47,47,111,112,111,115,105,116,101,32,115,105,100,101,32,111,102,32,105,115,111,32,116,114,105,97,110,103,108,101,10,9,9,9,9,102,108,111,97,116,32,114,97,100,105,117,115,59,10,9,9,9,9,123,10,9,9,9,9,9,47,47,102,105,116,32,116,111,32,115,112,104,101,114,101,32,105,110,115,105,100,101,32,99,111,110,101,32,40,115,112,104,101,114,101,32,101,110,100,115,32,97,116,32,101,110,100,32,111,102,32,99,111,110,101,41,44,32,115,111,109,101,116,104,105,110,103,32,108,105,107,101,32,116,104,105,115,58,10,9,9,9,9,9,47,47,32,95,95,95,10,9,9,9,9,9,47,47,32,92,79,47,10,9,9,9,9,9,47,47,32,32,86,10,9,9,9,9,9,47,47,10,9,9,9,9,9,47,47,32,97,115,32,105,116,32,97,118,111,105,100,115,32,98,108,101,101,100,105,110,103,32,102,114,111,109,32,98,101,121,111,110,100,32,116,104,101,32,114,101,102,108,101,99,116,105,111,110,32,97,115,32,109,117,99,104,32,97,115,32,112,111,115,115,105,98,108,101,46,32,65,115,32,97,32,112,108,117,115,10,9,9,9,9,9,47,47,32,105,116,32,97,108,115,111,32,109,97,107,101,115,32,116,104,101,32,114,111,117,103,104,32,114,101,102,108,101,99,116,105,111,110,32,109,111,114,101,32,101,108,111,110,103,97,116,101,100,46,10,9,9,9,9,9,102,108,111,97,116,32,97,32,61,32,111,112,95,108,101,110,59,10,9,9,9,9,9,102,108,111,97,116,32,104,32,61,32,99,111,110,101,95,108,101,110,59,10,9,9,9,9,9,102,108,111,97,116,32,97,50,32,61,32,97,32,42,32,97,59,10,9,9,9,9,9,102,108,111,97,116,32,102,104,50,32,61,32,52,46,48,102,32,42,32,104,32,42,32,104,59,10,9,9,9,9,9,114,97,100,105,117,115,32,61,32,40,97,32,42,32,40,115,113,114,116,40,97,50,32,43,32,102,104,50,41,32,45,32,97,41,41,32,47,32,40,52,46,48,102,32,42,32,104,41,59,10,9,9,9,9,125,10,10,9,9,9,9,47,47,102,105,110,100,32,116,104,101,32,112,108,97,99,101,32,119,104,101,114,101,32,115,99,114,101,101,110,32,109,117,115,116,32,98,101,32,115,97,109,112,108,101,100,10,9,9,9,9,118,101,99,50,32,115,97,109,112,108,101,95,112,111,115,32,61,32,40,32,108,105,110,101,95,98,101,103,105,110,32,43,32,99,111,110,101,95,100,105,114,32,42,32,40,99,111,110,101,95,108,101,110,32,45,32,114,97,100,105,117,115,41,32,41,32,42,32,112,105,120,101,108,95,115,105,122,101,59,10,9,9,9,9,47,47,114,97,100,105,117,115,32,105,115,32,105,110,32,112,105,120,101,108,115,44,32,115,111,32,105,116,39,115,32,110,97,116,117,114,97,108,32,116,104,97,116,32,108,111,103,50,40,114,97,100,105,117,115,41,32,109,97,112,115,32,116,111,32,116,104,101,32,114,105,103,104,116,32,109,105,112,109,97,112,32,102,111,114,32,116,104,101,32,97,109,111,117,110,116,32,111,102,32,112,105,120,101,108,115,10,9,9,9,9,102,108,111,97,116,32,109,105,112,109,97,112,32,61,32,99,108,97,109,112,40,32,108,111,103,50,40,32,114,97,100,105,117,115,32,41,44,32,48,46,48,44,32,109,97,120,95,109,105,112,109,97,112,32,41,59,10,10,9,9,9,9,47,47,109,105,112,109,97,112,32,61,32,109,97,120,40,109,105,112,109,97,112,45,49,46,48,44,48,46,48,41,59,10,9,9,9,9,47,47,100,111,32,115,97,109,112,108,105,110,103,10,10,9,9,9,9,118,101,99,52,32,115,97,109,112,108,101,95,99,111,108,111,114,59,10,9,9,9,9,123,10,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,95,109,105,112,109,97,112,115,44,115,97,109,112,108,101,95,112,111,115,44,109,97,120,40,49,46,48,44,109,105,112,109,97,112,41,41,59,10,9,9,9,9,9,105,102,32,40,109,105,112,109,97,112,60,49,46,48,41,32,123,32,47,47,119,101,32,117,115,101,32,97,110,111,116,104,101,114,32,105,109,97,103,101,32,97,115,32,98,97,115,101,32,116,111,32,97,118,111,105,100,32,99,111,112,121,105,110,103,32,97,108,108,32,116,104,101,32,115,99,114,101,101,110,32,117,110,110,101,99,101,115,97,114,105,108,121,10,9,9,9,9,9,9,118,101,99,52,32,98,97,115,101,95,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,115,97,109,112,108,101,95,112,111,115,44,48,46,48,41,59,10,9,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,109,105,120,40,98,97,115,101,95,115,97,109,112,108,101,95,99,111,108,111,114,44,115,97,109,112,108,101,95,99,111,108,111,114,44,109,105,112,109,97,112,41,59,10,9,9,9,9,9,125,10,9,9,9,9,125,10,10,9,9,9,9,47,47,109,117,108,116,105,112,108,121,32,98,121,32,103,108,111,115,115,10,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,114,103,98,42,61,103,108,111,115,115,95,109,117,108,116,59,10,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,97,61,103,108,111,115,115,95,109,117,108,116,59,10,10,9,9,9,9,114,101,109,95,97,108,112,104,97,32,45,61,32,115,97,109,112,108,101,95,99,111,108,111,114,46,97,59,10,9,9,9,9,105,102,40,114,101,109,95,97,108,112,104,97,32,60,32,48,46,48,41,32,123,10,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,114,103,98,32,42,61,32,40,49,46,48,32,45,32,97,98,115,40,114,101,109,95,97,108,112,104,97,41,41,59,10,9,9,9,9,125,10,10,9,9,9,9,102,105,110,97,108,95,99,111,108,111,114,43,61,115,97,109,112,108,101,95,99,111,108,111,114,59,10,10,9,9,9,9,105,102,32,40,102,105,110,97,108,95,99,111,108,111,114,46,97,62,61,48,46,57,53,41,32,123,10,9,9,9,9,9,47,47,32,84,104,105,115,32,99,111,100,101,32,111,102,32,97,99,99,117,109,117,108,97,116,105,110,103,32,103,108,111,115,115,32,97,110,100,32,97,98,111,114,116,105,110,103,32,111,110,32,110,101,97,114,32,111,110,101,10,9,9,9,9,9,47,47,32,109,97,107,101,115,32,115,101,110,115,101,32,119,104,101,110,32,121,111,117,32,116,104,105,110,107,32,111,102,32,99,111,110,101,32,116,114,97,99,105,110,103,46,10,9,9,9,9,9,47,47,32,84,104,105,110,107,32,111,102,32,105,116,32,97,115,32,105,102,32,114,111,117,103,104,110,101,115,115,32,119,97,115,32,48,44,32,116,104,101,110,32,119,101,32,99,111,117,108,100,32,97,98,111,114,116,32,111,110,32,116,104,101,32,102,105,114,115,116,10,9,9,9,9,9,47,47,32,105,116,101,114,97,116,105,111,110,46,32,70,111,114,32,108,101,115,115,101,114,32,114,111,117,103,104,110,101,115,115,32,118,97,108,117,101,115,44,32,119,101,32,110,101,101,100,32,109,111,114,101,32,105,116,101,114,97,116,105,111,110,115,44,32,98,117,116,10,9,9,9,9,9,47,47,32,101,97,99,104,32,110,101,101,100,115,32,116,111,32,104,97,118,101,32,108,101,115,115,32,105,110,102,108,117,101,110,99,101,32,103,105,118,101,110,32,116,104,101,32,115,112,104,101,114,101,32,105,115,32,115,109,97,108,108,101,114,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,111,110,101,95,108,101,110,45,61,114,97,100,105,117,115,42,50,46,48,59,32,47,47,103,111,32,116,111,32,110,101,120,116,32,40,115,109,97,108,108,101,114,41,32,99,105,114,99,108,101,46,10,10,9,9,9,9,103,108,111,115,115,95,109,117,108,116,42,61,103,108,111,115,115,59,10,10,10,9,9,9,125,10,9,9,125,32,101,108,115,101,32,123,10,9,9,9,102,105,110,97,108,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,102,105,110,97,108,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,44,99,108,97,109,112,40,49,46,48,45,103,114,97,100,44,48,46,48,44,49,46,48,41,41,59,10,9,9,125,10,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,102,105,110,97,108,95,99,111,108,111,114,46,114,103,98,44,109,97,120,40,48,46,48,44,49,46,48,45,103,114,97,100,41,41,59,10,10,35,101,108,115,101,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,102,105,110,97,108,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,44,48,46,48,41,46,114,103,98,44,99,108,97,109,112,40,49,46,48,45,103,114,97,100,44,48,46,48,44,49,46,48,41,41,59,10,35,101,110,100,105,102,10,10,10,10,9,125,32,101,108,115,101,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,49,46,48,44,48,46,48,44,48,46,48,44,48,46,48,41,59,10,9,125,10,10,9,47,47,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,108,105,110,101,95,100,105,114,41,32,42,32,48,46,53,32,43,32,48,46,53,44,48,46,48,44,49,46,48,41,59,10,10,47,42,10,9,118,101,99,50,32,104,105,116,95,112,105,120,101,108,59,10,9,118,101,99,51,32,104,105,116,95,112,111,105,110,116,59,10,9,105,110,116,32,119,104,105,99,104,59,10,9,109,97,116,52,32,98,105,97,115,95,109,97,116,32,61,32,109,97,116,52,40,118,101,99,52,40,48,46,53,44,48,46,48,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,53,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,53,44,48,46,53,44,48,46,48,44,49,46,48,41,41,59,10,9,109,97,116,52,32,112,105,120,101,108,95,109,97,116,32,61,32,109,97,116,52,40,118,101,99,52,40,118,105,101,119,112,111,114,116,95,115,105,122,101,46,120,44,48,46,48,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,118,105,101,119,112,111,114,116,95,115,105,122,101,46,121,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,48,46,48,44,49,46,48,41,41,59,10,10,10,10,10,9,109,97,116,52,32,100,116,32,61,32,112,105,120,101,108,95,109,97,116,32,42,40,32,98,105,97,115,95,109,97,116,32,42,32,112,114,111,106,101,99,116,105,111,110,41,59,10,9,118,101,99,52,32,118,112,32,61,32,100,116,32,42,32,118,101,99,52,40,118,101,114,116,101,120,44,49,46,48,41,59,10,9,118,112,46,120,121,122,47,61,118,112,46,119,59,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,116,101,120,101,108,70,101,116,99,104,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,105,118,101,99,50,40,118,112,46,120,121,41,44,48,32,41,59,10,9,114,101,116,117,114,110,59,10,42,47,10,47,42,9,98,111,111,108,32,104,105,116,32,61,32,116,114,97,99,101,83,99,114,101,101,110,83,112,97,99,101,82,97,121,49,40,118,101,114,116,101,120,44,114,97,121,95,100,105,114,44,32,112,105,120,101,108,95,109,97,116,32,42,40,32,98,105,97,115,95,109,97,116,32,42,32,112,114,111,106,101,99,116,105,111,110,41,44,115,111,117,114,99,101,95,100,101,112,116,104,44,118,105,101,119,112,111,114,116,95,115,105,122,101,44,48,46,48,49,44,116,114,117,101,44,99,111,109,112,117,116,101,67,108,105,112,73,110,102,111,40,45,99,97,109,101,114,97,95,122,95,110,101,97,114,44,45,99,97,109,101,114,97,95,122,95,102,97,114,41,44,45,99,97,109,101,114,97,95,122,95,110,101,97,114,44,49,46,50,44,48,46,48,44,54,52,46,48,44,99,97,109,101,114,97,95,122,95,102,97,114,44,104,105,116,95,112,105,120,101,108,44,119,104,105,99,104,44,104,105,116,95,112,111,105,110,116,41,59,10,10,10,10,9,105,102,32,40,104,105,116,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,101,108,70,101,116,99,104,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,105,118,101,99,50,40,104,105,116,95,112,105,120,101,108,41,44,48,41,46,114,103,98,44,49,46,48,41,59,10,9,125,32,101,108,115,101,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,49,44,48,46,48,44,48,46,48,44,48,46,48,41,59,10,9,125,10,42,47,10,10,10,9,47,42,10,9,102,108,111,97,116,32,112,105,120,101,108,100,105,115,116,32,61,32,108,101,110,103,116,104,40,118,101,114,116,101,120,41,59,10,10,10,9,47,47,32,83,107,105,112,32,115,107,121,98,111,120,32,97,110,100,32,100,105,115,116,97,110,116,32,112,105,120,101,108,115,10,9,105,102,32,40,112,105,120,101,108,100,105,115,116,32,62,32,99,97,109,101,114,97,95,122,95,102,97,114,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,118,101,114,116,101,120,43,61,110,111,114,109,97,108,42,48,46,49,59,10,10,9,47,47,32,82,97,121,32,110,111,116,32,105,110,32,118,105,101,119,10,9,105,102,32,40,100,111,116,40,114,97,121,95,100,105,114,44,32,118,105,101,119,95,100,105,114,41,32,60,32,49,101,45,53,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,48,44,49,46,48,44,48,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,10,9,102,108,111,97,116,32,109,97,120,95,114,97,121,95,108,101,110,32,61,32,49,46,48,32,42,32,112,105,120,101,108,100,105,115,116,59,10,10,10,9,102,108,111,97,116,32,114,97,121,95,108,101,110,32,61,32,40,10,40,118,101,114,116,101,120,46,122,32,43,32,114,97,121,95,100,105,114,46,122,32,42,32,109,97,120,95,114,97,121,95,108,101,110,41,32,62,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,32,63,32,40,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,118,101,114,116,101,120,46,122,41,32,47,32,114,97,121,95,100,105,114,46,122,32,58,32,109,97,120,95,114,97,121,95,108,101,110,59,10,10,10,9,47,47,32,67,111,110,118,101,114,116,32,115,116,97,114,116,32,97,110,100,32,101,110,100,32,112,111,115,32,102,114,111,109,32,118,105,101,119,32,116,111,32,115,99,114,101,101,110,32,115,112,97,99,101,10,9,118,101,99,51,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,41,59,10,9,118,101,99,51,32,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,32,43,32,114,97,121,95,108,101,110,32,42,32,114,97,121,95,100,105,114,41,59,10,10,9,118,101,99,51,32,114,97,121,95,112,111,115,32,61,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,59,10,9,118,101,99,51,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,61,32,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,59,10,10,9,47,47,32,77,97,107,101,32,115,117,114,101,32,116,104,101,32,114,97,121,32,100,111,101,115,32,110,111,116,32,108,101,97,118,101,32,116,104,101,32,115,99,114,101,101,110,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,120,41,32,47,32,109,97,120,40,49,101,45,53,44,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,121,41,32,47,32,109,97,120,40,49,101,45,53,44,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,121,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,120,32,47,32,109,97,120,40,49,101,45,53,44,32,45,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,121,32,47,32,109,97,120,40,49,101,45,53,44,32,45,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,121,41,41,59,10,9,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,42,61,32,109,105,110,40,115,99,97,108,101,95,109,97,120,95,120,44,32,115,99,97,108,101,95,109,97,120,95,121,41,59,10,9,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,42,61,32,109,105,110,40,115,99,97,108,101,95,109,105,110,95,120,44,32,115,99,97,108,101,95,109,105,110,95,121,41,59,10,10,9,118,101,99,51,32,114,97,121,95,115,116,101,112,32,61,32,40,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,41,32,47,32,110,117,109,95,115,116,101,112,115,59,10,10,9,102,108,111,97,116,32,100,105,115,116,97,110,99,101,95,115,99,97,108,101,32,61,32,49,46,48,32,43,32,48,46,48,48,48,48,49,32,42,32,112,105,120,101,108,100,105,115,116,59,10,10,9,102,108,111,97,116,32,106,105,116,116,101,114,32,61,32,48,46,48,59,47,47,97,98,115,40,114,97,110,100,40,105,118,101,99,50,40,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,41,32,37,32,56,32,43,32,40,77,97,105,110,83,99,101,110,101,68,97,116,97,46,102,114,97,109,101,95,105,110,100,101,120,32,37,32,71,69,84,95,83,69,84,84,73,78,71,40,115,115,114,44,32,104,105,115,116,111,114,121,95,108,101,110,103,116,104,41,41,32,42,32,48,46,49,41,41,59,10,10,9,47,47,32,82,111,117,103,104,32,115,111,117,114,102,97,99,101,115,32,110,101,101,100,32,109,111,114,101,32,106,105,116,116,101,114,10,9,106,105,116,116,101,114,32,42,61,32,109,97,120,40,48,46,53,44,32,114,111,117,103,104,110,101,115,115,41,59,10,10,9,114,97,121,95,112,111,115,32,43,61,32,106,105,116,116,101,114,32,42,32,114,97,121,95,115,116,101,112,59,10,10,10,9,105,110,116,32,105,32,61,32,48,59,10,9,102,108,111,97,116,32,105,110,116,101,114,115,101,99,116,105,111,110,95,119,101,105,103,104,116,32,61,32,48,46,48,59,10,9,98,111,111,108,32,104,105,116,95,102,97,99,116,111,114,32,61,32,102,97,108,115,101,59,10,10,9,118,101,99,50,32,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,118,101,99,50,40,45,49,46,48,41,59,10,10,9,102,111,114,32,40,105,32,61,32,49,59,32,105,32,60,32,110,117,109,95,115,116,101,112,115,59,32,43,43,105,41,32,123,10,9,9,114,97,121,95,112,111,115,32,43,61,32,114,97,121,95,115,116,101,112,59,10,10,9,9,47,47,32,67,117,114,114,101,110,116,32,99,111,111,114,100,105,110,97,116,101,32,105,115,32,105,110,32,116,104,101,32,109,105,100,32,111,102,32,116,119,111,32,115,97,109,112,108,101,115,44,32,110,111,116,32,97,116,32,116,104,101,32,101,110,100,44,32,115,111,10,9,9,47,47,32,115,117,98,115,116,114,97,99,116,32,104,97,108,102,32,111,102,32,97,32,115,116,101,112,10,9,9,118,101,99,50,32,99,117,114,114,95,99,111,111,114,100,32,61,32,114,97,121,95,112,111,115,46,120,121,32,45,32,48,46,53,32,42,32,114,97,121,95,115,116,101,112,46,120,121,59,10,10,10,9,9,47,47,32,73,110,99,114,101,97,115,101,32,114,97,121,32,98,105,97,115,32,97,115,32,119,101,32,97,100,118,97,110,99,101,32,116,104,101,32,114,97,121,10,9,9,102,108,111,97,116,32,116,114,97,99,101,95,108,101,110,32,61,32,105,110,105,116,105,97,108,95,98,105,97,115,32,42,32,49,48,46,48,32,43,10,9,9,9,9,49,48,48,46,48,32,42,32,100,111,116,40,99,117,114,114,95,99,111,111,114,100,45,117,118,95,105,110,116,101,114,112,44,99,117,114,114,95,99,111,111,114,100,45,117,118,95,105,110,116,101,114,112,41,59,10,10,9,9,116,114,97,99,101,95,108,101,110,32,42,61,32,49,46,48,32,43,32,49,46,48,32,42,32,114,111,117,103,104,110,101,115,115,59,10,10,9,9,47,47,32,67,104,101,99,107,32,102,111,114,32,105,110,116,101,114,115,101,99,116,105,111,110,10,10,9,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,99,117,114,114,95,99,111,111,114,100,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,102,108,111,97,116,32,108,105,110,101,97,114,95,100,101,112,116,104,61,100,101,112,116,104,59,10,9,9,47,47,102,108,111,97,116,32,108,105,110,101,97,114,95,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,47,47,108,105,110,101,97,114,95,100,101,112,116,104,32,61,32,45,108,105,110,101,97,114,95,100,101,112,116,104,59,10,10,10,9,9,105,102,32,40,112,111,105,110,116,95,98,101,116,119,101,101,110,95,112,108,97,110,101,115,40,108,105,110,101,97,114,95,100,101,112,116,104,44,32,114,97,121,95,112,111,115,46,122,44,10,9,9,9,9,9,32,114,97,121,95,112,111,115,46,122,32,45,32,114,97,121,95,115,116,101,112,46,122,44,32,116,114,97,99,101,95,108,101,110,44,32,104,105,116,95,102,97,99,116,111,114,41,41,32,123,10,9,9,9,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,99,117,114,114,95,99,111,111,114,100,59,10,9,9,9,98,114,101,97,107,59,10,9,9,125,10,9,125,10,10,9,47,47,32,77,97,107,101,32,115,117,114,101,32,119,101,32,104,105,116,32,101,120,97,99,116,108,121,32,111,110,101,32,112,105,120,101,108,10,9,47,47,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,116,114,117,110,99,97,116,101,95,99,111,111,114,100,105,110,97,116,101,40,105,110,116,101,114,115,101,99,116,105,111,110,41,59,10,10,9,47,47,32,67,104,101,99,107,32,105,102,32,119,101,32,104,105,116,32,115,111,109,101,116,104,105,110,103,10,9,105,102,32,40,109,105,110,40,105,110,116,101,114,115,101,99,116,105,111,110,46,120,44,32,105,110,116,101,114,115,101,99,116,105,111,110,46,121,41,32,60,61,32,48,46,48,32,124,124,32,111,117,116,95,111,102,95,115,99,114,101,101,110,40,105,110,116,101,114,115,101,99,116,105,111,110,41,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,49,46,48,44,48,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,105,102,32,40,33,104,105,116,95,102,97,99,116,111,114,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,48,46,48,44,49,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,105,110,116,101,114,115,101,99,116,105,111,110,41,46,114,103,98,44,49,46,48,41,59,10,42,47,10,10,125,10,10, 0};
+
+ static const int _fragment_code_start=17;
+ setup(_conditional_strings,2,_uniform_strings,8,_attribute_pairs,0, _texunit_pairs,4,_ubo_pairs,0,_feedbacks,0,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);
+ };
+
+};
+
+#endif
+
diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl
new file mode 100644
index 0000000000..5b24013c07
--- /dev/null
+++ b/drivers/gles3/shaders/screen_space_reflection.glsl
@@ -0,0 +1,350 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+out vec2 pos_interp;
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+ pos_interp.xy=gl_Position.xy;
+}
+
+[fragment]
+
+
+in vec2 uv_interp;
+in vec2 pos_interp;
+
+uniform sampler2D source_diffuse; //texunit:0
+uniform sampler2D source_normal_roughness; //texunit:1
+uniform sampler2D source_depth; //texunit:2
+uniform sampler2D source_diffuse_mipmaps; //texunit:3
+
+uniform float camera_z_near;
+uniform float camera_z_far;
+
+uniform vec2 viewport_size;
+uniform vec2 pixel_size;
+
+uniform float filter_mipmap_levels;
+
+uniform mat4 inverse_projection;
+uniform mat4 projection;
+
+uniform int num_steps;
+uniform float depth_tolerance;
+uniform float distance_fade;
+uniform float acceleration;
+
+layout(location = 0) out vec4 frag_color;
+
+
+vec2 view_to_screen(vec3 view_pos,out float w) {
+ vec4 projected = projection * vec4(view_pos, 1.0);
+ projected.xyz /= projected.w;
+ projected.xy = projected.xy * 0.5 + 0.5;
+ w=projected.w;
+ return projected.xy;
+}
+
+
+
+#define M_PI 3.14159265359
+
+
+void main() {
+
+
+ ////
+
+ vec4 diffuse = texture( source_diffuse, uv_interp );
+ vec4 normal_roughness = texture( source_normal_roughness, uv_interp);
+
+ vec3 normal;
+
+ normal = normal_roughness.xyz*2.0-1.0;
+
+ float roughness = normal_roughness.w;
+
+ float depth_tex = texture(source_depth,uv_interp).r;
+
+ vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 );
+ vec3 vertex = world_pos.xyz/world_pos.w;
+
+ vec3 view_dir = normalize(vertex);
+ vec3 ray_dir = normalize(reflect(view_dir, normal));
+
+ if (dot(ray_dir,normal)<0.001) {
+ frag_color=vec4(0.0);
+ return;
+ }
+ //ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0);
+
+ //ray_dir = normalize(vec3(1,1,-1));
+
+
+ ////////////////
+
+
+ //make ray length and clip it against the near plane (don't want to trace beyond visible)
+ float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far;
+ vec3 ray_end = vertex + ray_dir*ray_len;
+
+ float w_begin;
+ vec2 vp_line_begin = view_to_screen(vertex,w_begin);
+ float w_end;
+ vec2 vp_line_end = view_to_screen( ray_end, w_end);
+ vec2 vp_line_dir = vp_line_end-vp_line_begin;
+
+ //we need to interpolate w along the ray, to generate perspective correct reflections
+
+ w_begin = 1.0/w_begin;
+ w_end = 1.0/w_end;
+
+
+ float z_begin = vertex.z*w_begin;
+ float z_end = ray_end.z*w_end;
+
+ vec2 line_begin = vp_line_begin/pixel_size;
+ vec2 line_dir = vp_line_dir/pixel_size;
+ float z_dir = z_end - z_begin;
+ float w_dir = w_end - w_begin;
+
+
+ // clip the line to the viewport edges
+
+ float scale_max_x = min(1, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x));
+ float scale_max_y = min(1, 0.99 * (1.0 - vp_line_begin.y) / max(1e-5, vp_line_dir.y));
+ float scale_min_x = min(1, 0.99 * vp_line_begin.x / max(1e-5, -vp_line_dir.x));
+ float scale_min_y = min(1, 0.99 * vp_line_begin.y / max(1e-5, -vp_line_dir.y));
+ float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y);
+ line_dir *= line_clip;
+ z_dir *= line_clip;
+ w_dir *=line_clip;
+
+ //clip z and w advance to line advance
+ vec2 line_advance = normalize(line_dir); //down to pixel
+ float step_size = length(line_advance)/length(line_dir);
+ float z_advance = z_dir*step_size; // adapt z advance to line advance
+ float w_advance = w_dir*step_size; // adapt w advance to line advance
+
+ //make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice)
+ float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y));
+ line_advance*=advance_angle_adj; // adapt z advance to line advance
+ z_advance*=advance_angle_adj;
+ w_advance*=advance_angle_adj;
+
+ vec2 pos = line_begin;
+ float z = z_begin;
+ float w = w_begin;
+ float z_from=z/w;
+ float z_to=z_from;
+ float depth;
+ vec2 prev_pos=pos;
+
+ bool found=false;
+
+ //if acceleration > 0, distance between pixels gets larger each step. This allows covering a larger area
+ float accel=1.0+acceleration;
+ float steps_taken=0;
+
+ for(float i=0;i<num_steps;i++) {
+
+ pos+=line_advance;
+ z+=z_advance;
+ w+=w_advance;
+
+ //convert to linear depth
+ depth = texture(source_depth, pos*pixel_size).r * 2.0 - 1.0;
+ depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
+ depth=-depth;
+
+ z_from = z_to;
+ z_to = z/w;
+
+ if (depth>z_to) {
+ //if depth was surpassed
+ if (depth<=max(z_to,z_from)+depth_tolerance) {
+ //check the depth tolerance
+ found=true;
+ }
+ break;
+ }
+
+ steps_taken+=1.0;
+ prev_pos=pos;
+ z_advance*=accel;
+ w_advance*=accel;
+ line_advance*=accel;
+ }
+
+
+
+
+ if (found) {
+
+ float margin_blend=1.0;
+
+
+ vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin
+ if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) {
+ //clip outside screen + margin
+ frag_color=vec4(0.0);
+ return;
+ }
+
+ {
+ //blend fading out towards external margin
+ vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0)));
+ margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y));
+ //margin_blend=1.0;
+
+ }
+
+ vec2 final_pos;
+ float grad;
+
+#ifdef SMOOTH_ACCEL
+ //if the distance between point and prev point is >1, then take some samples in the middle for smoothing out the image
+ vec2 blend_dir = pos - prev_pos;
+ float steps = min(8.0,length(blend_dir));
+ if (steps>2.0) {
+ vec2 blend_step = blend_dir/steps;
+ float blend_z = (z_to-z_from)/steps;
+ vec2 new_pos;
+ float subgrad=0.0;
+ for(float i=0.0;i<steps;i++) {
+
+ new_pos = (prev_pos+blend_step*i);
+ float z = z_from+blend_z*i;
+
+ depth = texture(source_depth, new_pos*pixel_size).r * 2.0 - 1.0;
+ depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
+ depth=-depth;
+
+ subgrad=i/steps;
+ if (depth>z)
+ break;
+ }
+
+ final_pos = new_pos;
+ grad=(steps_taken+subgrad)/num_steps;
+
+ } else {
+#endif
+ grad=steps_taken/num_steps;
+ final_pos=pos;
+#ifdef SMOOTH_ACCEL
+ }
+
+#endif
+
+
+
+#ifdef REFLECT_ROUGHNESS
+
+
+ vec4 final_color;
+ //if roughness is enabled, do screen space cone tracing
+ if (roughness > 0.001) {
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //use a blurred version (in consecutive mipmaps) of the screen to simulate roughness
+
+ float gloss = 1.0-roughness;
+ float cone_angle = roughness * M_PI * 0.5;
+ vec2 cone_dir = final_pos - line_begin;
+ float cone_len = length(cone_dir);
+ cone_dir = normalize(cone_dir); //will be used normalized from now on
+ float max_mipmap = filter_mipmap_levels -1;
+ float gloss_mult=gloss;
+
+ float rem_alpha=1.0;
+ final_color = vec4(0.0);
+
+ for(int i=0;i<7;i++) {
+
+ float op_len = 2.0 * tan(cone_angle) * cone_len; //oposite side of iso triangle
+ float radius;
+ {
+ //fit to sphere inside cone (sphere ends at end of cone), something like this:
+ // ___
+ // \O/
+ // V
+ //
+ // as it avoids bleeding from beyond the reflection as much as possible. As a plus
+ // it also makes the rough reflection more elongated.
+ float a = op_len;
+ float h = cone_len;
+ float a2 = a * a;
+ float fh2 = 4.0f * h * h;
+ radius = (a * (sqrt(a2 + fh2) - a)) / (4.0f * h);
+ }
+
+ //find the place where screen must be sampled
+ vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size;
+ //radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels
+ float mipmap = clamp( log2( radius ), 0.0, max_mipmap );
+
+ //mipmap = max(mipmap-1.0,0.0);
+ //do sampling
+
+ vec4 sample_color;
+ {
+ sample_color = textureLod(source_diffuse_mipmaps,sample_pos,max(1.0,mipmap));
+ if (mipmap<1.0) { //we use another image as base to avoid copying all the screen unnecesarily
+ vec4 base_sample_color = textureLod(source_diffuse,sample_pos,0.0);
+ sample_color = mix(base_sample_color,sample_color,mipmap);
+ }
+ }
+
+ //multiply by gloss
+ sample_color.rgb*=gloss_mult;
+ sample_color.a=gloss_mult;
+
+ rem_alpha -= sample_color.a;
+ if(rem_alpha < 0.0) {
+ sample_color.rgb *= (1.0 - abs(rem_alpha));
+ }
+
+ final_color+=sample_color;
+
+ if (final_color.a>=0.95) {
+ // This code of accumulating gloss and aborting on near one
+ // makes sense when you think of cone tracing.
+ // Think of it as if roughness was 0, then we could abort on the first
+ // iteration. For lesser roughness values, we need more iterations, but
+ // each needs to have less influence given the sphere is smaller
+ break;
+ }
+
+ cone_len-=radius*2.0; //go to next (smaller) circle.
+
+ gloss_mult*=gloss;
+
+
+ }
+ } else {
+ final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0);
+ }
+
+ frag_color = vec4(final_color.rgb,pow(clamp(1.0-grad,0.0,1.0),distance_fade)*margin_blend);
+
+#else
+ frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,pow(clamp(1.0-grad,0.0,1.0),distance_fade)*margin_blend);
+#endif
+
+
+
+ } else {
+ frag_color = vec4(0.0,0.0,0.0,0.0);
+ }
+
+
+
+}
+
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index d35200d98c..578a8ae50a 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -300,6 +300,84 @@ void Environment::_validate_property(PropertyInfo& property) const {
}
+void Environment::set_ssr_enabled(bool p_enable) {
+
+ ssr_enabled=p_enable;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+}
+
+bool Environment::is_ssr_enabled() const{
+
+ return ssr_enabled;
+}
+
+void Environment::set_ssr_max_steps(int p_steps){
+
+ ssr_max_steps=p_steps;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+
+}
+int Environment::get_ssr_max_steps() const {
+
+ return ssr_max_steps;
+}
+
+void Environment::set_ssr_accel(float p_accel) {
+
+ ssr_accel=p_accel;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+
+}
+float Environment::get_ssr_accel() const {
+
+ return ssr_accel;
+}
+
+void Environment::set_ssr_fade(float p_fade) {
+
+ ssr_fade=p_fade;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+
+}
+float Environment::get_ssr_fade() const {
+
+ return ssr_fade;
+}
+
+void Environment::set_ssr_depth_tolerance(float p_depth_tolerance) {
+
+ ssr_depth_tolerance=p_depth_tolerance;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+
+}
+float Environment::get_ssr_depth_tolerance() const {
+
+ return ssr_depth_tolerance;
+}
+
+void Environment::set_ssr_smooth(bool p_enable) {
+
+ ssr_smooth=p_enable;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+
+}
+bool Environment::is_ssr_smooth() const {
+
+ return ssr_smooth;
+}
+
+void Environment::set_ssr_rough(bool p_enable) {
+
+ ssr_roughness=p_enable;
+ VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness);
+
+}
+bool Environment::is_ssr_rough() const {
+
+ return ssr_roughness;
+}
+
+
void Environment::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_background","mode"),&Environment::set_background);
@@ -334,6 +412,37 @@ void Environment::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") );
ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_contribution",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_ambient_light_skybox_contribution"),_SCS("get_ambient_light_skybox_contribution") );
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_enabled","enabled"),&Environment::set_ssr_enabled);
+ ObjectTypeDB::bind_method(_MD("is_ssr_enabled"),&Environment::is_ssr_enabled);
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_max_steps","max_steps"),&Environment::set_ssr_max_steps);
+ ObjectTypeDB::bind_method(_MD("get_ssr_max_steps"),&Environment::get_ssr_max_steps);
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_accel","accel"),&Environment::set_ssr_accel);
+ ObjectTypeDB::bind_method(_MD("get_ssr_accel"),&Environment::get_ssr_accel);
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_fade","fade"),&Environment::set_ssr_fade);
+ ObjectTypeDB::bind_method(_MD("get_ssr_fade"),&Environment::get_ssr_fade);
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_depth_tolerance","depth_tolerance"),&Environment::set_ssr_depth_tolerance);
+ ObjectTypeDB::bind_method(_MD("get_ssr_depth_tolerance"),&Environment::get_ssr_depth_tolerance);
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_smooth","smooth"),&Environment::set_ssr_smooth);
+ ObjectTypeDB::bind_method(_MD("is_ssr_smooth"),&Environment::is_ssr_smooth);
+
+ ObjectTypeDB::bind_method(_MD("set_ssr_rough","rough"),&Environment::set_ssr_rough);
+ ObjectTypeDB::bind_method(_MD("is_ssr_rough"),&Environment::is_ssr_rough);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/enable"),_SCS("set_ssr_enabled"),_SCS("is_ssr_enabled") );
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"ss_reflections/max_steps",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_ssr_max_steps"),_SCS("get_ssr_max_steps") );
+ ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/accel",PROPERTY_HINT_RANGE,"0,4,0.01"),_SCS("set_ssr_accel"),_SCS("get_ssr_accel") );
+ ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/fade",PROPERTY_HINT_EXP_EASING),_SCS("set_ssr_fade"),_SCS("get_ssr_fade") );
+ ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/depth_tolerance",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_ssr_depth_tolerance"),_SCS("get_ssr_depth_tolerance") );
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/accel_smooth"),_SCS("set_ssr_smooth"),_SCS("is_ssr_smooth") );
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/roughness"),_SCS("set_ssr_rough"),_SCS("is_ssr_rough") );
+
+
ObjectTypeDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper);
ObjectTypeDB::bind_method(_MD("get_tonemapper"),&Environment::get_tonemapper);
@@ -358,6 +467,9 @@ void Environment::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_scale","exposure_scale"),&Environment::set_tonemap_auto_exposure_scale);
ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_scale"),&Environment::get_tonemap_auto_exposure_scale);
+
+
+
ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Log,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") );
ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") );
ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") );
@@ -441,6 +553,14 @@ Environment::Environment() {
environment = VS::get_singleton()->environment_create();
+ ssr_enabled=false;
+ ssr_max_steps=64;
+ ssr_accel=0.04;
+ ssr_fade=2.0;
+ ssr_depth_tolerance=0.2;
+ ssr_smooth=true;
+ ssr_roughness=true;
+
}
Environment::~Environment() {
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index ca55b51b20..f4610ada47 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -94,6 +94,14 @@ private:
float adjustment_brightness;
Ref<Texture> adjustment_color_correction;
+ bool ssr_enabled;
+ int ssr_max_steps;
+ float ssr_accel;
+ float ssr_fade;
+ float ssr_depth_tolerance;
+ bool ssr_smooth;
+ bool ssr_roughness;
+
protected:
static void _bind_methods();
@@ -162,6 +170,27 @@ public:
void set_adjustment_color_correction(const Ref<Texture>& p_ramp);
Ref<Texture> get_adjustment_color_correction() const;
+ void set_ssr_enabled(bool p_enable);
+ bool is_ssr_enabled() const;
+
+ void set_ssr_max_steps(int p_steps);
+ int get_ssr_max_steps() const;
+
+ void set_ssr_accel(float p_accel);
+ float get_ssr_accel() const;
+
+ void set_ssr_fade(float p_fade);
+ float get_ssr_fade() const;
+
+ void set_ssr_depth_tolerance(float p_depth_tolerance);
+ float get_ssr_depth_tolerance() const;
+
+ void set_ssr_smooth(bool p_enable);
+ bool is_ssr_smooth() const;
+
+ void set_ssr_rough(bool p_enable);
+ bool is_ssr_rough() const;
+
virtual RID get_rid() const;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 21cf391af5..0d36706468 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -64,6 +64,8 @@ public:
virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0;
virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0;
+ virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0;
+
virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper)=0;
virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0;
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index c3afadb393..e7594278f2 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -875,6 +875,7 @@ public:
BIND2(environment_set_bg_energy,RID,float )
BIND2(environment_set_canvas_max_layer,RID,int )
BIND4(environment_set_ambient_light,RID,const Color& ,float,float )
+ BIND8(environment_set_ssr,RID,bool,int,float,float,float,bool,bool )
BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode )
BIND5(environment_set_fog,RID,bool ,float ,float ,RID )
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 0fd0733727..4c9e04a782 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -555,7 +555,7 @@ public:
virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,EnvironmentToneMapper p_tone_mapper)=0;
virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0;
-
+ virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0;
/* SCENARIO API */
diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp
index 268d42a613..431c2b1874 100644
--- a/tools/collada/collada.cpp
+++ b/tools/collada/collada.cpp
@@ -463,7 +463,7 @@ Transform Collada::_read_transform(XMLParser& parser) {
if (parser.is_empty())
return Transform();
- Vector<float> array;
+ Vector<String> array;
while(parser.read()==OK) {
// TODO: check for comments inside the element
// and ignore them.
@@ -471,7 +471,7 @@ Transform Collada::_read_transform(XMLParser& parser) {
if (parser.get_node_type() == XMLParser::NODE_TEXT) {
// parse float data
String str = parser.get_node_data();
- array=str.split_floats(" ",false);
+ array=str.split_spaces();
}
else
if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END)
@@ -479,7 +479,13 @@ Transform Collada::_read_transform(XMLParser& parser) {
}
ERR_FAIL_COND_V(array.size()!=16,Transform());
- return _read_transform_from_array(array);
+ Vector<float> farr;
+ farr.resize(16);
+ for(int i=0;i<16;i++) {
+ farr[i]=array[i].to_double();
+ }
+
+ return _read_transform_from_array(farr);
}
String Collada::_read_empty_draw_type(XMLParser& parser) {