summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp9
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp117
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h8
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp132
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h11
-rw-r--r--drivers/gles3/shader_gles3.cpp1
-rw-r--r--drivers/gles3/shaders/copy.glsl13
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl2
-rw-r--r--drivers/gles3/shaders/effect_blur.glsl3
-rw-r--r--drivers/gles3/shaders/particles.glsl4
-rw-r--r--drivers/gles3/shaders/resolve.glsl3
-rw-r--r--drivers/gles3/shaders/scene.glsl293
-rw-r--r--drivers/gles3/shaders/tonemap.glsl4
-rw-r--r--editor/editor_export.cpp2
-rw-r--r--editor/editor_node.cpp15
-rw-r--r--editor/editor_plugin.cpp4
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/import/resource_importer_obj.cpp4
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp7
-rw-r--r--editor/plugins/script_editor_plugin.cpp12
-rw-r--r--editor/plugins/script_editor_plugin.h4
-rw-r--r--editor/project_manager.cpp18
-rw-r--r--main/main.cpp5
-rw-r--r--platform/android/export/export.cpp6
-rw-r--r--scene/gui/item_list.cpp34
-rw-r--r--scene/gui/item_list.h8
-rw-r--r--scene/gui/range.cpp4
-rw-r--r--scene/main/scene_tree.cpp14
-rw-r--r--scene/main/scene_tree.h3
-rw-r--r--scene/resources/dynamic_font.cpp4
-rw-r--r--scene/resources/material.cpp10
-rw-r--r--scene/resources/material.h1
-rw-r--r--scene/resources/sky_box.cpp20
-rw-r--r--scene/resources/sky_box.h5
-rw-r--r--servers/visual/shader_types.cpp3
-rw-r--r--servers/visual_server.cpp8
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/libpng/arm/filter_neon.S6
-rw-r--r--thirdparty/libpng/png.c71
-rw-r--r--thirdparty/libpng/png.h42
-rw-r--r--thirdparty/libpng/pngconf.h2
-rw-r--r--thirdparty/libpng/pngerror.c8
-rw-r--r--thirdparty/libpng/pngget.c18
-rw-r--r--thirdparty/libpng/pnginfo.h5
-rw-r--r--thirdparty/libpng/pnglibconf.h7
-rw-r--r--thirdparty/libpng/pngpriv.h43
-rw-r--r--thirdparty/libpng/pngread.c15
-rw-r--r--thirdparty/libpng/pngrtran.c5
-rw-r--r--thirdparty/libpng/pngrutil.c44
-rw-r--r--thirdparty/libpng/pngset.c35
-rw-r--r--thirdparty/libpng/pngstruct.h3
-rw-r--r--thirdparty/libpng/pngtrans.c2
-rw-r--r--thirdparty/libpng/pngwrite.c10
-rw-r--r--thirdparty/libpng/pngwutil.c31
55 files changed, 867 insertions, 279 deletions
diff --git a/.travis.yml b/.travis.yml
index 8aa21a4de4..371c965db4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -88,8 +88,8 @@ script:
sh ./misc/travis/clang-format.sh;
else
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
- scons platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX openssl=builtin;
+ scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX openssl=builtin;
else
- scons platform=$GODOT_TARGET progress=no verbose=yes bits=64 CXX=$CXX openssl=builtin;
+ scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes bits=64 CXX=$CXX openssl=builtin;
fi
fi
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index 4f0d9a03c4..bb7b85e653 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -30,8 +30,8 @@
#include "rasterizer_gles3.h"
#include "gl_context/context_gl.h"
-#include "project_settings.h"
#include "os/os.h"
+#include "project_settings.h"
#include <string.h>
RasterizerStorage *RasterizerGLES3::get_storage() {
@@ -186,6 +186,9 @@ void RasterizerGLES3::initialize() {
GL_DEBUG_SEVERITY_HIGH_ARB,5, "hello");
*/
+
+ const GLubyte *renderer = glGetString(GL_RENDERER);
+ print_line("OpenGL ES 3.0 Renderer: " + String((const char *)renderer));
storage->initialize();
canvas->initialize();
scene->initialize();
@@ -336,6 +339,10 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, rt->color);
+ //glBindTexture(GL_TEXTURE_2D, rt->effects.mip_maps[0].color);
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, storage->resources.normal_tex);
+
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 5d884fff11..56bd3ca2ef 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -521,13 +521,7 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas, int p_size
glBindTexture(GL_TEXTURE_2D, reflection_atlas->color);
int mmsize = reflection_atlas->size;
-
- for (int i = 0; i < 6; i++) {
- glTexImage2D(GL_TEXTURE_2D, i, internal_format, mmsize, mmsize, 0,
- format, type, NULL);
-
- mmsize >>= 1;
- }
+ glTexStorage2DCustom(GL_TEXTURE_2D, 6, internal_format, mmsize, mmsize, format, type);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -537,8 +531,6 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas, int p_size
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
- mmsize = reflection_atlas->size;
-
for (int i = 0; i < 6; i++) {
glGenFramebuffers(1, &reflection_atlas->fbo[i]);
glBindFramebuffer(GL_FRAMEBUFFER, reflection_atlas->fbo[i]);
@@ -1962,6 +1954,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS, true);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING, false);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_VERTEX_LIGHTING, false);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL, false);
state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW, false);
state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4, false);
@@ -1972,6 +1965,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13, false);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_GI_PROBES, false);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP, false);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_CONTACT_SHADOWS, false);
//state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true);
} else {
@@ -1979,7 +1973,10 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::USE_GI_PROBES, e->instance->gi_probe_instances.size() > 0);
state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS, false);
+
state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING, !p_directional_add);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_VERTEX_LIGHTING, (e->sort_key & SORT_KEY_VERTEX_LIT_FLAG));
+
state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL, false);
state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW, false);
state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4, false);
@@ -1988,6 +1985,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5, shadow_filter_mode == SHADOW_FILTER_PCF5);
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13, shadow_filter_mode == SHADOW_FILTER_PCF13);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP, use_radiance_map);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_CONTACT_SHADOWS, state.used_contact_shadows);
if (p_directional_add || (directional_light && (e->sort_key & SORT_KEY_NO_DIRECTIONAL_FLAG) == 0)) {
state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL, true);
@@ -2136,6 +2134,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5, false);
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13, false);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_GI_PROBES, false);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_CONTACT_SHADOWS, false);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_VERTEX_LIGHTING, false);
}
void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_shadow) {
@@ -2281,6 +2281,11 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= SORT_KEY_UNSHADED_FLAG;
}
+
+ if (!shadow && (m->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) {
+
+ e->sort_key |= SORT_KEY_VERTEX_LIT_FLAG;
+ }
}
void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy) {
@@ -2912,7 +2917,19 @@ void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_resul
glBindBufferBase(GL_UNIFORM_BUFFER, 6, state.reflection_array_ubo);
}
-void RasterizerSceneGLES3::_copy_screen() {
+void RasterizerSceneGLES3::_copy_screen(bool p_invalidate_color, bool p_invalidate_depth) {
+
+#ifndef GLES_OVER_GL
+ if (p_invalidate_color) {
+
+ GLenum attachments[2] = {
+ GL_COLOR_ATTACHMENT0,
+ GL_DEPTH_STENCIL_ATTACHMENT
+ };
+
+ glInvalidateFramebuffer(GL_FRAMEBUFFER, p_invalidate_depth ? 2 : 1, attachments);
+ }
+#endif
glBindVertexArray(storage->resources.quadie_array);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -3080,7 +3097,7 @@ void RasterizerSceneGLES3::_blur_effect_buffer() {
glActiveTexture(GL_TEXTURE0);
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();
+ _copy_screen(true);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_HORIZONTAL, false);
//vertical pass
@@ -3091,7 +3108,7 @@ void RasterizerSceneGLES3::_blur_effect_buffer() {
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();
+ _copy_screen(true);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_VERTICAL, false);
}
}
@@ -3139,7 +3156,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->effects.ssao.depth_mipmap_fbos[i]); //copy to front first
glViewport(0, 0, ss[0], ss[1]);
- _copy_screen();
+ _copy_screen(true);
}
ss[0] = storage->frame.current_rt->width;
ss[1] = storage->frame.current_rt->height;
@@ -3191,7 +3208,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
Color white(1, 1, 1, 1);
glClearBufferfv(GL_COLOR, 0, white.components); // specular
- _copy_screen();
+ _copy_screen(true);
//do the batm, i mean blur
@@ -3212,7 +3229,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
if (i == 0) {
glClearBufferfv(GL_COLOR, 0, white.components); // specular
}
- _copy_screen();
+ _copy_screen(true);
}
}
@@ -3229,7 +3246,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.ssao.blur_red[0]); //previous level, since mipmaps[0] starts one level bigger
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level
- _copy_screen();
+ _copy_screen(true);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SSAO_MERGE, false);
} else {
@@ -3278,14 +3295,14 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); //copy to front first
- _copy_screen();
+ _copy_screen(true);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::DIR, Vector2(0, 1));
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level
- _copy_screen();
+ _copy_screen(true);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.mip_maps[0].color); //restore filter
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -3337,7 +3354,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[1].sizes[0].fbo);
glViewport(0, 0, ssr_w, ssr_h);
- _copy_screen();
+ _copy_screen(true);
glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height);
}
@@ -3368,7 +3385,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE); //use additive to accumulate one over the other
- _copy_screen();
+ _copy_screen(true);
glDisable(GL_BLEND); //end additive
@@ -3392,7 +3409,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.mip_maps[0].color);
- _copy_screen();
+ _copy_screen(true);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SIMPLE_COPY, false);
}
@@ -3413,13 +3430,16 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
//copy specular to front buffer
//copy diffuse to effect buffer
- glReadBuffer(GL_COLOR_ATTACHMENT0);
- glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo);
- glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ if (storage->frame.current_rt->buffers.active) {
+ //transfer to effect buffer if using buffers, also resolve MSAA
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo);
+ glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
- glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ }
if (!env || storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
//no environment or transparent render, simply return and convert to SRGB
@@ -3431,7 +3451,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]);
storage->shaders.copy.bind();
- _copy_screen();
+ _copy_screen(true);
storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, false);
storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, false); //compute luminance
@@ -3487,7 +3507,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); //copy to front first
- _copy_screen();
+ _copy_screen(true);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
@@ -3574,7 +3594,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->buffers.diffuse);
}
- _copy_screen();
+ _copy_screen(true);
if (composite_from != storage->frame.current_rt->buffers.diffuse) {
@@ -3614,7 +3634,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
glBindFramebuffer(GL_FRAMEBUFFER, exposure_shrink[0].fbo);
glViewport(0, 0, exposure_shrink_size, exposure_shrink_size);
- _copy_screen();
+ _copy_screen(true);
//second step, shrink to 2x2 pixels
state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_BEGIN, false);
@@ -3658,7 +3678,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
state.exposure_shader.set_uniform(ExposureShaderGLES3::MAX_LUMINANCE, env->auto_exposure_max);
state.exposure_shader.set_uniform(ExposureShaderGLES3::MIN_LUMINANCE, env->auto_exposure_min);
- _copy_screen();
+ _copy_screen(true);
state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_FORCE_SET, false);
state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_END, false);
@@ -3729,7 +3749,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
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();
+ _copy_screen(true);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_GAUSSIAN_HORIZONTAL, false);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_FIRST_PASS, false);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_USE_AUTO_EXPOSURE, false);
@@ -3837,7 +3857,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
state.tonemap_shader.set_uniform(TonemapShaderGLES3::BCS, Vector3(env->adjustments_brightness, env->adjustments_contrast, env->adjustments_saturation));
}
- _copy_screen();
+ _copy_screen(true, true);
//turn off everything used
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_AUTO_EXPOSURE, false);
@@ -3913,7 +3933,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
state.used_contact_shadows = true;
- if (storage->frame.current_rt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW) { //detect with state.used_contact_shadows too
+ if (!storage->config.no_depth_prepass && storage->frame.current_rt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW) { //detect with state.used_contact_shadows too
//pre z pass
glDisable(GL_BLEND);
@@ -3927,7 +3947,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glColorMask(0, 0, 0, 0);
glClearDepth(1.0f);
- glClear(GL_DEPTH_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
render_list.clear();
_fill_render_list(p_cull_result, p_cull_count, true);
@@ -3953,6 +3973,9 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
fb_cleared = true;
render_pass++;
+ state.using_contact_shadows = true;
+ } else {
+ state.using_contact_shadows = false;
}
_setup_lights(p_light_cull_result, p_light_cull_count, p_cam_transform.affine_inverse(), p_cam_projection, p_shadow_atlas);
@@ -4034,8 +4057,13 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
} else {
- current_fbo = storage->frame.current_rt->buffers.fbo;
- glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
+ if (storage->frame.current_rt->buffers.active) {
+ current_fbo = storage->frame.current_rt->buffers.fbo;
+ } else {
+ current_fbo = storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo;
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS, false);
Vector<GLenum> draw_buffers;
@@ -4045,8 +4073,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
}
if (!fb_cleared) {
- glClearDepth(1.0f);
- glClear(GL_DEPTH_BUFFER_BIT);
+ glClearBufferfi(GL_DEPTH_STENCIL, 0, 1.0, 0);
}
Color clear_color(0, 0, 0, 0);
@@ -4111,7 +4138,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
storage->shaders.copy.bind();
- _copy_screen();
+ _copy_screen(true, true);
//turn off everything used
storage->shaders.copy.set_conditional(CopyShaderGLES3::SRGB_TO_LINEAR, false);
@@ -4178,7 +4205,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
_render_mrts(env, p_cam_projection);
} else {
//FIXME: check that this is possible to use
- if (storage->frame.current_rt && state.used_screen_texture) {
+ if (storage->frame.current_rt && storage->frame.current_rt->buffers.active && state.used_screen_texture) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo);
@@ -4192,7 +4219,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
}
}
- if (storage->frame.current_rt && state.used_screen_texture) {
+ if (storage->frame.current_rt && state.used_screen_texture && storage->frame.current_rt->buffers.active) {
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 7);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.mip_maps[0].color);
}
@@ -4273,6 +4300,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
+
+ //disable all stuff
}
void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {
@@ -4297,6 +4326,8 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
float bias = 0;
float normal_bias = 0;
+ state.using_contact_shadows = false;
+
CameraMatrix light_projection;
Transform light_transform;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index a03e3dbe3d..f6509e0041 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -187,6 +187,7 @@ public:
bool cull_front;
bool used_sss;
bool used_screen_texture;
+ bool using_contact_shadows;
VS::ViewportDebugDraw debug_draw;
} state;
@@ -645,8 +646,9 @@ public:
#define SORT_KEY_UNSHADED_FLAG (uint64_t(1) << 59)
#define SORT_KEY_NO_DIRECTIONAL_FLAG (uint64_t(1) << 58)
#define SORT_KEY_GI_PROBES_FLAG (uint64_t(1) << 57)
- SORT_KEY_SHADING_SHIFT = 57,
- SORT_KEY_SHADING_MASK = 7,
+#define SORT_KEY_VERTEX_LIT_FLAG (uint64_t(1) << 56)
+ SORT_KEY_SHADING_SHIFT = 56,
+ SORT_KEY_SHADING_MASK = 15,
SORT_KEY_MATERIAL_INDEX_SHIFT = 40,
SORT_KEY_GEOMETRY_INDEX_SHIFT = 20,
SORT_KEY_GEOMETRY_TYPE_SHIFT = 15,
@@ -795,7 +797,7 @@ public:
void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_shadow_atlas);
void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_reflection_atlas, Environment *p_env);
- void _copy_screen();
+ void _copy_screen(bool p_invalidate_color = false, bool p_invalidate_depth = false);
void _copy_to_front_buffer(Environment *env);
void _copy_texture_to_front_buffer(GLuint p_texture); //used for debug
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 17e77aed89..263b0cc641 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -99,6 +99,21 @@
#define _EXT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
#define _EXT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
+void glTexStorage2DCustom(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type) {
+
+#ifdef GLES_OVER_GL
+
+ for (int i = 0; i < levels; i++) {
+ glTexImage2D(target, i, internalformat, width, height, 0, format, type, NULL);
+ width = MAX(1, (width / 2));
+ height = MAX(1, (height / 2));
+ }
+
+#else
+ glTexStorage2D(target, levels, internalformat, width, height);
+#endif
+}
+
GLuint RasterizerStorageGLES3::system_fbo = 0;
Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool &srgb) {
@@ -1412,18 +1427,10 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
GLenum format = GL_RGBA;
GLenum type = use_float ? GL_HALF_FLOAT : GL_UNSIGNED_INT_2_10_10_10_REV;
- while (mm_level) {
-
- glTexImage2D(GL_TEXTURE_2D, lod, internal_format, size, size * 2, 0, format, type, NULL);
- lod++;
- mm_level--;
-
- if (size > 1)
- size >>= 1;
- }
+ glTexStorage2DCustom(GL_TEXTURE_2D, mipmaps, internal_format, size, size * 2.0, format, type);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod - 1);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmaps - 1);
lod = 0;
mm_level = mipmaps;
@@ -1593,6 +1600,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->spatial.unshaded = false;
p_shader->spatial.ontop = false;
p_shader->spatial.uses_sss = false;
+ p_shader->spatial.uses_vertex_lighting = false;
p_shader->spatial.uses_screen_texture = false;
p_shader->spatial.uses_vertex = false;
p_shader->spatial.writes_modelview_or_projection = false;
@@ -1614,6 +1622,8 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
shaders.actions_scene.render_mode_flags["unshaded"] = &p_shader->spatial.unshaded;
shaders.actions_scene.render_mode_flags["ontop"] = &p_shader->spatial.ontop;
+ shaders.actions_scene.render_mode_flags["vertex_lighting"] = &p_shader->spatial.uses_vertex_lighting;
+
shaders.actions_scene.usage_flag_pointers["ALPHA"] = &p_shader->spatial.uses_alpha;
shaders.actions_scene.usage_flag_pointers["VERTEX"] = &p_shader->spatial.uses_vertex;
@@ -5818,17 +5828,20 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
rt->fbo = 0;
}
- if (rt->buffers.fbo) {
+ if (rt->buffers.active) {
glDeleteFramebuffers(1, &rt->buffers.fbo);
glDeleteRenderbuffers(1, &rt->buffers.depth);
glDeleteRenderbuffers(1, &rt->buffers.diffuse);
- glDeleteRenderbuffers(1, &rt->buffers.specular);
- glDeleteRenderbuffers(1, &rt->buffers.normal_rough);
- glDeleteRenderbuffers(1, &rt->buffers.sss);
- glDeleteFramebuffers(1, &rt->buffers.effect_fbo);
- glDeleteTextures(1, &rt->buffers.effect);
+ if (rt->buffers.effects_active) {
+ glDeleteRenderbuffers(1, &rt->buffers.specular);
+ glDeleteRenderbuffers(1, &rt->buffers.normal_rough);
+ glDeleteRenderbuffers(1, &rt->buffers.sss);
+ glDeleteFramebuffers(1, &rt->buffers.effect_fbo);
+ glDeleteTextures(1, &rt->buffers.effect);
+ }
- rt->buffers.fbo = 0;
+ rt->buffers.effects_active = false;
+ rt->buffers.active = false;
}
if (rt->depth) {
@@ -5866,13 +5879,15 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
tex->active = false;
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);
- }
+ if (rt->effects.mip_maps[i].color) {
+ 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;
+ glDeleteTextures(1, &rt->effects.mip_maps[i].color);
+ rt->effects.mip_maps[i].sizes.clear();
+ rt->effects.mip_maps[i].levels = 0;
+ }
}
/*
@@ -5899,10 +5914,20 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
if (!hdr || rt->flags[RENDER_TARGET_NO_3D]) {
- color_internal_format = GL_RGBA8;
- color_format = GL_RGBA;
- color_type = GL_UNSIGNED_BYTE;
- image_format = Image::FORMAT_RGBA8;
+ if (rt->flags[RENDER_TARGET_NO_3D_EFFECTS] && !rt->flags[RENDER_TARGET_TRANSPARENT]) {
+ //if this is not used, linear colorspace looks pretty bad
+ //this is the default mode used for mobile
+ color_internal_format = GL_RGB10_A2;
+ color_format = GL_RGBA;
+ color_type = GL_UNSIGNED_INT_2_10_10_10_REV;
+ image_format = Image::FORMAT_RGBA8;
+ } else {
+
+ color_internal_format = GL_RGBA8;
+ color_format = GL_RGBA;
+ color_type = GL_UNSIGNED_BYTE;
+ image_format = Image::FORMAT_RGBA8;
+ }
} else {
color_internal_format = GL_RGBA16F;
color_format = GL_RGBA;
@@ -5967,7 +5992,9 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
/* BACK FBO */
- if (!rt->flags[RENDER_TARGET_NO_3D]) {
+ if (!rt->flags[RENDER_TARGET_NO_3D] && (!rt->flags[RENDER_TARGET_NO_3D_EFFECTS] || rt->msaa != VS::VIEWPORT_MSAA_DISABLED)) {
+
+ rt->buffers.active = true;
static const int msaa_value[] = { 0, 2, 4, 8, 16 };
int msaa = msaa_value[rt->msaa];
@@ -5997,6 +6024,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
if (!rt->flags[RENDER_TARGET_NO_3D_EFFECTS]) {
+ rt->buffers.effects_active = true;
glGenRenderbuffers(1, &rt->buffers.specular);
glBindRenderbuffer(GL_RENDERBUFFER, rt->buffers.specular);
@@ -6140,7 +6168,12 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
_render_target_clear(rt);
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
}
+ } else {
+ rt->buffers.effects_active = false;
}
+ } else {
+ rt->buffers.active = false;
+ rt->buffers.effects_active = true;
}
if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) {
@@ -6164,8 +6197,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
while (true) {
RenderTarget::Effects::MipMaps::Size mm;
-
- glTexImage2D(GL_TEXTURE_2D, level, color_internal_format, w, h, 0, color_format, color_type, NULL);
mm.width = w;
mm.height = h;
rt->effects.mip_maps[i].sizes.push_back(mm);
@@ -6179,8 +6210,13 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
level++;
}
+ glTexStorage2DCustom(GL_TEXTURE_2D, level + 1, color_internal_format, rt->width, rt->height, color_format, color_type);
+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
+ glDisable(GL_SCISSOR_TEST);
+ glColorMask(1, 1, 1, 1);
+ glDepthMask(GL_TRUE);
for (int j = 0; j < rt->effects.mip_maps[i].sizes.size(); j++) {
@@ -6189,6 +6225,11 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
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);
+ bool used_depth = false;
+ if (j == 0 && i == 0 && rt->buffers.active == false && !rt->flags[RENDER_TARGET_NO_3D]) { //will use this one for rendering 3D
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
+ used_depth = true;
+ }
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
@@ -6197,7 +6238,12 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
}
float zero[4] = { 1, 0, 1, 0 };
+ glViewport(0, 0, rt->effects.mip_maps[i].sizes[j].width, rt->effects.mip_maps[i].sizes[j].height);
+
glClearBufferfv(GL_COLOR, 0, zero);
+ if (used_depth) {
+ glClearBufferfi(GL_DEPTH_STENCIL, 0, 1.0, 0);
+ }
}
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
@@ -6838,7 +6884,6 @@ void RasterizerStorageGLES3::initialize() {
int max_extensions = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &max_extensions);
- print_line("GLES3: max extensions: " + itos(max_extensions));
for (int i = 0; i < max_extensions; i++) {
const GLubyte *s = glGetStringi(GL_EXTENSIONS, i);
if (!s)
@@ -6864,7 +6909,6 @@ void RasterizerStorageGLES3::initialize() {
config.hdr_supported = false;
#endif
- print_line("hdr supported: " + itos(config.hdr_supported));
config.pvrtc_supported = config.extensions.has("GL_IMG_texture_compression_pvrtc");
config.srgb_decode_supported = config.extensions.has("GL_EXT_texture_sRGB_decode");
@@ -6997,6 +7041,8 @@ void RasterizerStorageGLES3::initialize() {
}
shaders.cubemap_filter.init();
+ bool ggx_hq = GLOBAL_GET("rendering/quality/reflections/high_quality_ggx.mobile");
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::LOW_QUALITY, !ggx_hq);
shaders.particles.init();
#ifdef GLES_OVER_GL
@@ -7010,6 +7056,28 @@ void RasterizerStorageGLES3::initialize() {
config.keep_original_textures = false;
config.generate_wireframes = false;
config.use_texture_array_environment = GLOBAL_GET("rendering/quality/reflections/texture_array_reflections");
+
+ config.force_vertex_shading = GLOBAL_GET("rendering/quality/shading/force_vertex_shading");
+
+ GLOBAL_DEF("rendering/quality/depth_prepass/disable", false);
+
+ String renderer = (const char *)glGetString(GL_RENDERER);
+
+ config.no_depth_prepass = !bool(GLOBAL_GET("rendering/quality/depth_prepass/enable"));
+ if (!config.no_depth_prepass) {
+
+ String vendors = GLOBAL_GET("rendering/quality/depth_prepass/disable_for_vendors");
+ Vector<String> vendor_match = vendors.split(",");
+ for (int i = 0; i < vendor_match.size(); i++) {
+ String v = vendor_match[i].strip_edges();
+ if (v == String())
+ continue;
+
+ if (renderer.findn(v) != -1) {
+ config.no_depth_prepass = true;
+ }
+ }
+ }
}
void RasterizerStorageGLES3::finalize() {
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index b24da44afd..7d0f3e5745 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -48,6 +48,8 @@ class RasterizerSceneGLES3;
#define _DECODE_EXT 0x8A49
#define _SKIP_DECODE_EXT 0x8A4A
+void glTexStorage2DCustom(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type);
+
class RasterizerStorageGLES3 : public RasterizerStorage {
public:
RasterizerCanvasGLES3 *canvas;
@@ -91,6 +93,9 @@ public:
Set<String> extensions;
bool keep_original_textures;
+
+ bool no_depth_prepass;
+ bool force_vertex_shading;
} config;
mutable struct Shaders {
@@ -444,6 +449,7 @@ public:
bool uses_sss;
bool uses_screen_texture;
bool writes_modelview_or_projection;
+ bool uses_vertex_lighting;
} spatial;
@@ -1193,6 +1199,9 @@ public:
GLuint depth;
struct Buffers {
+
+ bool active;
+ bool effects_active;
GLuint fbo;
GLuint depth;
GLuint specular;
@@ -1282,6 +1291,8 @@ public:
flags[RENDER_TARGET_NO_3D] = false;
flags[RENDER_TARGET_NO_SAMPLING] = false;
flags[RENDER_TARGET_HDR] = true;
+ buffers.active = false;
+ buffers.effects_active = false;
last_exposure_tick = 0;
}
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index 33a7c9a22f..f1077e2d20 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -208,6 +208,7 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
Vector<const char *> strings;
#ifdef GLES_OVER_GL
strings.push_back("#version 330\n");
+ strings.push_back("#define GLES_OVER_GL\n");
#else
strings.push_back("#version 300 es\n");
#endif
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl
index a7c388815d..d33193ee50 100644
--- a/drivers/gles3/shaders/copy.glsl
+++ b/drivers/gles3/shaders/copy.glsl
@@ -49,6 +49,9 @@ void main() {
#define M_PI 3.14159265359
+#if !defined(USE_GLES_OVER_GL)
+precision mediump float;
+#endif
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
in vec3 cube_interp;
@@ -87,14 +90,6 @@ vec4 texturePanorama(vec3 normal,sampler2D pano ) {
#endif
-float sRGB_gamma_correct(float c){
- float a = 0.055;
- if(c < 0.0031308)
- return 12.92*c;
- else
- return (1.0+a)*pow(c, 1.0/2.4) - a;
-}
-
uniform float stuff;
uniform vec2 pixel_size;
@@ -131,7 +126,7 @@ void main() {
vec4 color = texture( source_cube, normalize(cube_interp) );
#else
- vec4 color = texture( source, uv_interp );
+ vec4 color = textureLod( source, uv_interp,0.0 );
#endif
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index ac4e47a440..485fbb6ee0 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -204,7 +204,7 @@ vec4 textureDualParaboloidArray(vec3 normal) {
vec3 norm = normalize(normal);
norm.xy/=1.0+abs(norm.z);
norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
- if (norm.z<0) {
+ if (norm.z<0.0) {
norm.y=0.5-norm.y+0.5;
}
return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index) ), 0.0);
diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl
index 2550335174..09e522866c 100644
--- a/drivers/gles3/shaders/effect_blur.glsl
+++ b/drivers/gles3/shaders/effect_blur.glsl
@@ -25,6 +25,9 @@ void main() {
[fragment]
+#if !defined(GLES_OVER_GL)
+precision mediump float;
+#endif
in vec2 uv_interp;
uniform sampler2D source_color; //texunit:0
diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl
index 6a977a201e..a62c124dfe 100644
--- a/drivers/gles3/shaders/particles.glsl
+++ b/drivers/gles3/shaders/particles.glsl
@@ -178,7 +178,7 @@ VERTEX_SHADER_CODE
#if !defined(DISABLE_FORCE)
- if (true) {
+ if (false) {
vec3 force = vec3(0.0);
for(int i=0;i<attractor_count;i++) {
@@ -187,7 +187,7 @@ VERTEX_SHADER_CODE
float dist = length(rel_vec);
if (attractors[i].radius < dist)
continue;
- if (attractors[i].eat_radius>0 && attractors[i].eat_radius > dist) {
+ if (attractors[i].eat_radius>0.0 && attractors[i].eat_radius > dist) {
out_velocity_active.a=0.0;
}
diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl
index 181a3c99ec..0b50a9c57b 100644
--- a/drivers/gles3/shaders/resolve.glsl
+++ b/drivers/gles3/shaders/resolve.glsl
@@ -15,6 +15,9 @@ void main() {
[fragment]
+#if !defined(GLES_OVER_GL)
+precision mediump float;
+#endif
in vec2 uv_interp;
uniform sampler2D source_specular; //texunit:0
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 9d474d3902..acece2e639 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -64,44 +64,45 @@ layout(std140) uniform SceneData { //ubo:0
highp mat4 camera_inverse_matrix;
highp mat4 camera_matrix;
- highp vec4 ambient_light_color;
- highp vec4 bg_color;
+ mediump vec4 ambient_light_color;
+ mediump vec4 bg_color;
- vec4 fog_color_enabled;
- vec4 fog_sun_color_amount;
+ mediump vec4 fog_color_enabled;
+ mediump vec4 fog_sun_color_amount;
- float ambient_energy;
- float bg_energy;
+ mediump float ambient_energy;
+ mediump float bg_energy;
- float z_offset;
- float z_slope_scale;
- float shadow_dual_paraboloid_render_zfar;
- float shadow_dual_paraboloid_render_side;
+ mediump float z_offset;
+ mediump float z_slope_scale;
+ highp float shadow_dual_paraboloid_render_zfar;
+ highp float shadow_dual_paraboloid_render_side;
highp vec2 screen_pixel_size;
- vec2 shadow_atlas_pixel_size;
- vec2 directional_shadow_pixel_size;
+ highp vec2 shadow_atlas_pixel_size;
+ highp vec2 directional_shadow_pixel_size;
- float time;
- float z_far;
- float reflection_multiplier;
- float subsurface_scatter_width;
- float ambient_occlusion_affect_light;
+ highp float time;
+ highp float z_far;
+ mediump float reflection_multiplier;
+ mediump float subsurface_scatter_width;
+ mediump float ambient_occlusion_affect_light;
bool fog_depth_enabled;
- float fog_depth_begin;
- float fog_depth_curve;
+ highp float fog_depth_begin;
+ highp float fog_depth_curve;
bool fog_transmit_enabled;
- float fog_transmit_curve;
+ highp float fog_transmit_curve;
bool fog_height_enabled;
- float fog_height_min;
- float fog_height_max;
- float fog_height_curve;
+ highp float fog_height_min;
+ highp float fog_height_max;
+ highp float fog_height_curve;
};
uniform highp mat4 world_transform;
+
#ifdef USE_LIGHT_DIRECTIONAL
layout(std140) uniform DirectionalLightData { //ubo:3
@@ -121,6 +122,90 @@ layout(std140) uniform DirectionalLightData { //ubo:3
#endif
+#ifdef USE_VERTEX_LIGHTING
+//omni and spot
+
+struct LightData {
+
+ highp vec4 light_pos_inv_radius;
+ mediump vec4 light_direction_attenuation;
+ mediump vec4 light_color_energy;
+ mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled,
+ mediump vec4 light_clamp;
+ mediump vec4 shadow_color_contact;
+ highp mat4 shadow_matrix;
+
+};
+
+
+layout(std140) uniform OmniLightData { //ubo:4
+
+ LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
+};
+
+layout(std140) uniform SpotLightData { //ubo:5
+
+ LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
+};
+
+#ifdef USE_FORWARD_LIGHTING
+
+
+uniform int omni_light_indices[MAX_FORWARD_LIGHTS];
+uniform int omni_light_count;
+
+uniform int spot_light_indices[MAX_FORWARD_LIGHTS];
+uniform int spot_light_count;
+
+#endif
+
+out vec4 diffuse_light_interp;
+out vec4 specular_light_interp;
+
+void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color,float roughness,inout vec3 diffuse, inout vec3 specular) {
+
+ float dotNL = max(dot(N,L), 0.0 );
+ diffuse += dotNL * light_color;
+
+ if (roughness > 0.0) {
+
+ vec3 H = normalize(V + L);
+ float dotNH = max(dot(N,H), 0.0 );
+ float intensity = pow( dotNH, (1.0-roughness) * 256.0);
+ specular += light_color * intensity;
+
+ }
+}
+
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal, float roughness,inout vec3 diffuse, inout vec3 specular) {
+
+ vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex;
+ float light_length = length( light_rel_vec );
+ float normalized_distance = light_length*omni_lights[idx].light_pos_inv_radius.w;
+ vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w ));
+
+ light_compute(normal,normalize(light_rel_vec),eye_vec,omni_lights[idx].light_color_energy.rgb * light_attenuation,roughness,diffuse,specular);
+
+}
+
+void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) {
+
+ vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex;
+ float light_length = length( light_rel_vec );
+ float normalized_distance = light_length*spot_lights[idx].light_pos_inv_radius.w;
+ vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w ));
+ vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz;
+ float spot_cutoff=spot_lights[idx].light_params.y;
+ float scos = max(dot(-normalize(light_rel_vec), spot_dir),spot_cutoff);
+ float spot_rim = (1.0 - scos) / (1.0 - spot_cutoff);
+ light_attenuation *= 1.0 - pow( max(spot_rim,0.001), spot_lights[idx].light_params.x);
+
+
+ light_compute(normal,normalize(light_rel_vec),eye_vec,spot_lights[idx].light_color_energy.rgb*light_attenuation,roughness,diffuse,specular);
+}
+
+
+#endif
/* Varyings */
@@ -288,6 +373,8 @@ void main() {
#endif
#endif
+ float roughness=0.0;
+
//defines that make writing custom shaders easier
#define projection_matrix local_projection
#define world_transform world_matrix
@@ -376,6 +463,54 @@ VERTEX_SHADER_CODE
#endif
position_interp=gl_Position;
+
+#ifdef USE_VERTEX_LIGHTING
+
+ diffuse_light_interp=vec4(0.0);
+ specular_light_interp=vec4(0.0);
+
+#ifdef USE_FORWARD_LIGHTING
+
+ for(int i=0;i<omni_light_count;i++) {
+ light_process_omni(omni_light_indices[i],vertex_interp,-normalize( vertex_interp ),normal_interp,roughness,diffuse_light_interp.rgb,specular_light_interp.rgb);
+ }
+
+ for(int i=0;i<spot_light_count;i++) {
+ light_process_spot(spot_light_indices[i],vertex_interp,-normalize( vertex_interp ),normal_interp,roughness,diffuse_light_interp.rgb,specular_light_interp.rgb);
+ }
+#endif
+
+#ifdef USE_LIGHT_DIRECTIONAL
+
+ vec3 directional_diffuse = vec3(0.0);
+ vec3 directional_specular = vec3(0.0);
+ light_compute(normal_interp,-light_direction_attenuation.xyz,-normalize( vertex_interp ),normal_interp,roughness,directional_diffuse,directional_specular);
+
+ float diff_avg = dot(diffuse_light_interp.rgb,vec3(0.33333));
+ float diff_dir_avg = dot(directional_diffuse,vec3(0.33333));
+ if (diff_avg>0.0) {
+ diffuse_light_interp.a=diff_dir_avg/(diff_avg+diff_dir_avg);
+ } else {
+ diffuse_light_interp.a=1.0;
+ }
+
+ diffuse_light_interp.rgb+=directional_diffuse;
+
+ float spec_avg = dot(specular_light_interp.rgb,vec3(0.33333));
+ float spec_dir_avg = dot(directional_specular,vec3(0.33333));
+ if (spec_avg>0.0) {
+ specular_light_interp.a=spec_dir_avg/(spec_avg+spec_dir_avg);
+ } else {
+ specular_light_interp.a=1.0;
+ }
+
+ specular_light_interp.rgb+=directional_specular;
+
+#endif //USE_LIGHT_DIRECTIONAL
+
+
+#endif // USE_VERTEX_LIGHTING
+
}
@@ -455,7 +590,7 @@ vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) {
// we need to lie the derivatives (normg) and assume that DP side is always the same
// to get proper texure filtering
vec2 normg=norm.xy;
- if (norm.z>0) {
+ if (norm.z>0.0) {
norm.y=0.5-norm.y+0.5;
}
@@ -479,7 +614,7 @@ vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) {
vec3 norm = normalize(p_vec);
norm.xy/=1.0+abs(norm.z);
norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
- if (norm.z>0) {
+ if (norm.z>0.0) {
norm.y=0.5-norm.y+0.5;
}
return textureLod(p_tex, norm.xy, p_roughness * RADIANCE_MAX_LOD).xyz;
@@ -511,39 +646,39 @@ layout(std140) uniform SceneData {
highp mat4 camera_inverse_matrix;
highp mat4 camera_matrix;
- highp vec4 ambient_light_color;
- highp vec4 bg_color;
+ mediump vec4 ambient_light_color;
+ mediump vec4 bg_color;
- vec4 fog_color_enabled;
- vec4 fog_sun_color_amount;
+ mediump vec4 fog_color_enabled;
+ mediump vec4 fog_sun_color_amount;
- float ambient_energy;
- float bg_energy;
+ mediump float ambient_energy;
+ mediump float bg_energy;
- float z_offset;
- float z_slope_scale;
- float shadow_dual_paraboloid_render_zfar;
- float shadow_dual_paraboloid_render_side;
+ mediump float z_offset;
+ mediump float z_slope_scale;
+ highp float shadow_dual_paraboloid_render_zfar;
+ highp float shadow_dual_paraboloid_render_side;
highp vec2 screen_pixel_size;
- vec2 shadow_atlas_pixel_size;
- vec2 directional_shadow_pixel_size;
+ highp vec2 shadow_atlas_pixel_size;
+ highp vec2 directional_shadow_pixel_size;
- float time;
- float z_far;
- float reflection_multiplier;
- float subsurface_scatter_width;
- float ambient_occlusion_affect_light;
+ highp float time;
+ highp float z_far;
+ mediump float reflection_multiplier;
+ mediump float subsurface_scatter_width;
+ mediump float ambient_occlusion_affect_light;
bool fog_depth_enabled;
- float fog_depth_begin;
- float fog_depth_curve;
+ highp float fog_depth_begin;
+ highp float fog_depth_curve;
bool fog_transmit_enabled;
- float fog_transmit_curve;
+ highp float fog_transmit_curve;
bool fog_height_enabled;
- float fog_height_min;
- float fog_height_max;
- float fog_height_curve;
+ highp float fog_height_min;
+ highp float fog_height_max;
+ highp float fog_height_curve;
};
//directional light data
@@ -570,6 +705,10 @@ uniform highp sampler2DShadow directional_shadow; //texunit:-4
#endif
+#ifdef USE_VERTEX_LIGHTING
+in vec4 diffuse_light_interp;
+in vec4 specular_light_interp;
+#endif
//omni and spot
struct LightData {
@@ -655,6 +794,8 @@ layout(location=0) out vec4 frag_color;
in highp vec4 position_interp;
uniform highp sampler2D depth_buffer; //texunit:-8
+#ifdef USE_CONTACT_SHADOWS
+
float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
if (abs(dir.z)>0.99)
@@ -715,6 +856,8 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
return 1.0;
}
+#endif
+
// GGX Specular
// Source: http://www.filmicworlds.com/images/ggx-opt/optimized-ggx.hlsl
float G1V(float dotNV, float k)
@@ -1010,13 +1153,16 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino
splane.xy = clamp_rect.xy+splane.xy*clamp_rect.zw;
float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,clamp_rect);
+
+#ifdef USE_CONTACT_SHADOWS
+
if (shadow>0.01 && omni_lights[idx].shadow_color_contact.a>0.0) {
float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,omni_lights[idx].shadow_color_contact.a));
shadow=min(shadow,contact_shadow);
-
}
+#endif
light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
}
@@ -1043,13 +1189,14 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp);
+#ifdef USE_CONTACT_SHADOWS
if (shadow>0.01 && spot_lights[idx].shadow_color_contact.a>0.0) {
float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,spot_lights[idx].shadow_color_contact.a));
shadow=min(shadow,contact_shadow);
}
-
+#endif
light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
}
@@ -1097,7 +1244,7 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta
vec3 norm = normalize(local_ref_vec);
norm.xy/=1.0+abs(norm.z);
norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
- if (norm.z>0) {
+ if (norm.z>0.0) {
norm.y=0.5-norm.y+0.5;
}
@@ -1460,9 +1607,18 @@ FRAGMENT_SHADER_CODE
//apply energy conservation
+#ifdef USE_VERTEX_LIGHTING
+
+ vec3 specular_light = specular_light_interp.rgb;
+ vec3 diffuse_light = diffuse_light_interp.rgb;
+#else
+
vec3 specular_light = vec3(0.0,0.0,0.0);
- vec3 ambient_light;
vec3 diffuse_light = vec3(0.0,0.0,0.0);
+
+#endif
+
+ vec3 ambient_light;
vec3 env_reflection_light = vec3(0.0,0.0,0.0);
vec3 eye_vec = -normalize( vertex_interp );
@@ -1515,7 +1671,7 @@ FRAGMENT_SHADER_CODE
specular_blob_intensity*=specular * 2.0;
#endif
-#ifdef USE_LIGHT_DIRECTIONAL
+#if defined(USE_LIGHT_DIRECTIONAL)
vec3 light_attenuation=vec3(1.0);
@@ -1640,13 +1796,14 @@ FRAGMENT_SHADER_CODE
}
#endif
+#ifdef USE_CONTACT_SHADOWS
if (shadow>0.01 && shadow_color_contact.a>0.0) {
float contact_shadow = contact_shadow_compute(vertex,-light_direction_attenuation.xyz,shadow_color_contact.a);
shadow=min(shadow,contact_shadow);
}
-
+#endif
light_attenuation=mix(shadow_color_contact.rgb,vec3(1.0),shadow);
@@ -1654,7 +1811,13 @@ FRAGMENT_SHADER_CODE
#endif //LIGHT_DIRECTIONAL_SHADOW
+#ifdef USE_VERTEX_LIGHTING
+ diffuse_light*=mix(vec3(1.0),light_attenuation,diffuse_light_interp.a);
+ specular_light*=mix(vec3(1.0),light_attenuation,specular_light_interp.a);
+
+#else
light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb*light_attenuation,albedo,light_params.z*specular_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+#endif
#endif //#USE_LIGHT_DIRECTIONAL
@@ -1664,12 +1827,11 @@ FRAGMENT_SHADER_CODE
#endif
-
#ifdef USE_FORWARD_LIGHTING
+
highp vec4 reflection_accum = vec4(0.0,0.0,0.0,0.0);
highp vec4 ambient_accum = vec4(0.0,0.0,0.0,0.0);
-
for(int i=0;i<reflection_count;i++) {
reflection_process(reflection_indices[i],vertex,normal,binormal,tangent,roughness,anisotropy,ambient_light,env_reflection_light,reflection_accum,ambient_accum);
}
@@ -1684,6 +1846,13 @@ FRAGMENT_SHADER_CODE
ambient_light+=ambient_accum.rgb/ambient_accum.a;
}
+
+
+#ifdef USE_VERTEX_LIGHTING
+
+ diffuse_light*=albedo;
+#else
+
for(int i=0;i<omni_light_count;i++) {
light_process_omni(omni_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light);
}
@@ -1692,15 +1861,13 @@ FRAGMENT_SHADER_CODE
light_process_spot(spot_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light);
}
-
+#endif //USE_VERTEX_LIGHTING
#endif
-
-
#ifdef RENDER_DEPTH
//nothing happens, so a tree-ssa optimizer will result in no fragment shader :)
#else
@@ -1713,13 +1880,11 @@ FRAGMENT_SHADER_CODE
#endif
-
-
-
-
//energu conservation
diffuse_light=mix(diffuse_light,vec3(0.0),metallic);
ambient_light=mix(ambient_light,vec3(0.0),metallic);
+
+
{
#if defined(DIFFUSE_TOON)
@@ -1744,7 +1909,7 @@ FRAGMENT_SHADER_CODE
if (fog_color_enabled.a > 0.5) {
- float fog_amount=0;
+ float fog_amount=0.0;
diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl
index 3ce2edf4e9..c6dfc6917d 100644
--- a/drivers/gles3/shaders/tonemap.glsl
+++ b/drivers/gles3/shaders/tonemap.glsl
@@ -18,6 +18,10 @@ void main() {
[fragment]
+#if !defined(GLES_OVER_GL)
+precision mediump float;
+#endif
+
in vec2 uv_interp;
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index abbce0199a..6bf92ddd2d 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -716,7 +716,7 @@ void EditorExport::_save() {
config->set_value(section, "name", preset->get_name());
config->set_value(section, "platform", preset->get_platform()->get_name());
config->set_value(section, "runnable", preset->is_runnable());
- config->set_value(section, "custom_feaures", preset->get_custom_features());
+ config->set_value(section, "custom_features", preset->get_custom_features());
bool save_files = false;
switch (preset->get_export_filter()) {
case EditorExportPreset::EXPORT_ALL_RESOURCES: {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ea4cbd4853..990628d6af 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -58,6 +58,7 @@
#include "servers/physics_2d_server.h"
#include "translation.h"
#include "version.h"
+#include "version_hash.gen.h"
#include <stdio.h>
// plugins
#include "asset_library_editor_plugin.h"
@@ -5986,14 +5987,18 @@ EditorNode::EditorNode() {
logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
hbc->add_child(logo);
+ String hash = String(VERSION_HASH);
+ if (hash.length() != 0)
+ hash = "." + hash.left(7);
+
Label *about_text = memnew(Label);
about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
- about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
+ about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
TTR("Godot Engine contributors") + "\n");
hbc->add_child(about_text);
TabContainer *tc = memnew(TabContainer);
- tc->set_custom_minimum_size(Size2(600, 240) * EDSCALE);
+ tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE);
tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(tc);
@@ -6021,14 +6026,14 @@ EditorNode::EditorNode() {
dev_vbc->add_child(lbl);
ItemList *il = memnew(ItemList);
- il->set_max_columns(32);
+ il->set_max_columns(16);
il->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- il->set_custom_minimum_size(Size2(0, i == 3 ? DEV_NAMES_COUNT * 7.6 : 30) * EDSCALE);
+ il->set_fixed_column_width(230 * EDSCALE);
+ il->set_auto_height(true);
const char **dev_names_ptr = dev_src[i];
while (*dev_names_ptr)
il->add_item(String::utf8(*dev_names_ptr++), NULL, false);
dev_vbc->add_child(il);
- il->set_fixed_column_width(240 * EDSCALE);
HSeparator *hs = memnew(HSeparator);
hs->set_modulate(Color(0, 0, 0, 0));
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 968be43946..c65065db43 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -175,7 +175,7 @@ Node *EditorPlugin::get_edited_scene_root() {
return EditorNode::get_singleton()->get_edited_scene();
}
-Array EditorPlugin::get_opened_scenes_list() const {
+Array EditorPlugin::get_open_scenes() const {
Array ret;
Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
@@ -440,7 +440,7 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin);
ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin);
ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled);
- ClassDB::bind_method(D_METHOD("get_opened_scenes_list"), &EditorPlugin::get_opened_scenes_list);
+ ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorPlugin::get_open_scenes);
ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root);
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 2c920323a1..a0f64fb1ea 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -118,7 +118,7 @@ public:
bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; }
Node *get_edited_scene_root();
- Array get_opened_scenes_list() const;
+ Array get_open_scenes() const;
ScriptEditor *get_script_editor();
void notify_main_screen_changed(const String &screen_name);
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 9bb598ec92..25548f7899 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -395,6 +395,10 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (!material_map.has(current_material_library)) {
Map<String, Ref<SpatialMaterial> > lib;
Error err = _parse_material_library(current_material_library, lib, r_missing_deps);
+ if (err == ERR_CANT_OPEN) {
+ String dir = p_path.get_base_dir();
+ err = _parse_material_library(dir.plus_file(current_material_library), lib, r_missing_deps);
+ }
if (err == OK) {
material_map[current_material_library] = lib;
}
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 58948071fd..156a74144c 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "animation_tree_editor_plugin.h"
-#include "core/project_settings.h"
#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "scene/gui/menu_button.h"
@@ -371,6 +371,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->mix_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -383,6 +384,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend2_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -398,6 +400,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(-1);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend3_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -411,6 +414,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend4_node_get_amount(edited_node).x);
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -419,6 +423,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[1]->show();
edit_scroll[1]->set_min(0);
edit_scroll[1]->set_max(1);
+ edit_scroll[1]->set_step(0.01);
edit_scroll[1]->set_value(anim_tree->blend4_node_get_amount(edited_node).y);
edit_scroll[1]->set_begin(Point2(15, 75));
edit_scroll[1]->show();
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index aeb16f13ee..c90d66f914 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -793,10 +793,10 @@ Ref<Script> ScriptEditor::_get_current_script() {
}
}
-Array ScriptEditor::_get_opened_script_list() const {
+Array ScriptEditor::_get_open_scripts() const {
Array ret;
- Vector<Ref<Script> > scripts = get_opened_scripts();
+ Vector<Ref<Script> > scripts = get_open_scripts();
int scrits_amount = scripts.size();
for (int idx_script = 0; idx_script < scrits_amount; idx_script++) {
ret.push_back(scripts[idx_script]);
@@ -1159,7 +1159,7 @@ void ScriptEditor::notify_script_close(const Ref<Script> &p_script) {
}
void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
- emit_signal("script_changed", p_script);
+ emit_signal("editor_script_changed", p_script);
}
static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) {
@@ -2104,7 +2104,7 @@ void ScriptEditor::_history_back() {
}
}
-Vector<Ref<Script> > ScriptEditor::get_opened_scripts() const {
+Vector<Ref<Script> > ScriptEditor::get_open_scripts() const {
Vector<Ref<Script> > out_scripts = Vector<Ref<Script> >();
@@ -2213,9 +2213,9 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
- ClassDB::bind_method(D_METHOD("get_opened_scripts_list"), &ScriptEditor::_get_opened_script_list);
+ ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
- ADD_SIGNAL(MethodInfo("script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
+ ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String")));
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 3d03eb0f49..d8a9415df1 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -322,7 +322,7 @@ class ScriptEditor : public PanelContainer {
void _file_dialog_action(String p_file);
Ref<Script> _get_current_script();
- Array _get_opened_script_list() const;
+ Array _get_open_scripts() const;
static void _open_script_request(const String &p_path);
@@ -357,7 +357,7 @@ public:
void get_window_layout(Ref<ConfigFile> p_layout);
void set_scene_root_script(Ref<Script> p_script);
- Vector<Ref<Script> > get_opened_scripts() const;
+ Vector<Ref<Script> > get_open_scripts() const;
bool script_goto_method(Ref<Script> p_script, const String &p_method);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index e3f22c833e..acf5fe02cc 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -202,10 +202,10 @@ private:
f->store_line("\n");
f->store_line("[application]");
f->store_line("\n");
- f->store_line("name=\"" + project_name->get_text() + "\"");
- f->store_line("icon=\"res://icon.png\"");
+ f->store_line("config/name=\"" + project_name->get_text() + "\"");
+ f->store_line("config/icon=\"res://icon.png\"");
f->store_line("[rendering]");
- f->store_line("viewport/default_environment=\"res://default_env.tres\"");
+ f->store_line("environment/default_environment=\"res://default_env.tres\"");
memdelete(f);
ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
@@ -811,16 +811,16 @@ void ProjectManager::_load_recent_projects() {
String project_name = TTR("Unnamed Project");
- if (cf->has_section_key("application", "name")) {
- project_name = static_cast<String>(cf->get_value("application", "name")).xml_unescape();
+ if (cf->has_section_key("application", "config/name")) {
+ project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape();
}
if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1)
continue;
Ref<Texture> icon;
- if (cf->has_section_key("application", "icon")) {
- String appicon = cf->get_value("application", "icon");
+ if (cf->has_section_key("application", "config/icon")) {
+ String appicon = cf->get_value("application", "config/icon");
if (appicon != "") {
Ref<Image> img;
img.instance();
@@ -840,8 +840,8 @@ void ProjectManager::_load_recent_projects() {
}
String main_scene;
- if (cf->has_section_key("application", "main_scene")) {
- main_scene = cf->get_value("application", "main_scene");
+ if (cf->has_section_key("application", "run/main_scene")) {
+ main_scene = cf->get_value("application", "run/main_scene");
}
selected_list_copy.erase(project);
diff --git a/main/main.cpp b/main/main.cpp
index 98c8b59ebc..5fef3658b9 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1260,6 +1260,7 @@ bool Main::start() {
String stretch_mode = GLOBAL_DEF("display/window/stretch/mode", "disabled");
String stretch_aspect = GLOBAL_DEF("display/window/stretch/aspect", "ignore");
Size2i stretch_size = Size2(GLOBAL_DEF("display/window/size/width", 0), GLOBAL_DEF("display/window/size/height", 0));
+ int stretch_shrink = GLOBAL_DEF("display/window/stretch/shrink", 1);
SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED;
if (stretch_mode == "2d")
@@ -1275,7 +1276,7 @@ bool Main::start() {
else if (stretch_aspect == "keep_height")
sml_aspect = SceneTree::STRETCH_ASPECT_KEEP_HEIGHT;
- sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size);
+ sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size, stretch_shrink);
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
@@ -1302,6 +1303,8 @@ bool Main::start() {
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
GLOBAL_DEF("display/window/stretch/aspect", "ignore");
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height"));
+ GLOBAL_DEF("display/window/stretch/shrink", 1);
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/shrink", PropertyInfo(Variant::STRING, "display/window/stretch/shrink", PROPERTY_HINT_RANGE, "1,8,1"));
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index cb9d0c8b53..97f239c4da 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -2830,7 +2830,11 @@ public:
public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
- r_features->push_back("etc");
+ int api = p_preset->get("graphics/api");
+ if (api == 0)
+ r_features->push_back("etc");
+ else
+ r_features->push_back("etc2");
}
virtual void get_export_options(List<ExportOption> *r_options) {
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index eff9d801b6..97f49da2be 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "item_list.h"
-#include "project_settings.h"
#include "os/os.h"
+#include "project_settings.h"
void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, bool p_selectable) {
@@ -743,12 +743,10 @@ void ItemList::_notification(int p_what) {
Size2 size = get_size();
- float page = size.height - bg->get_minimum_size().height;
int width = size.width - bg->get_minimum_size().width;
if (scroll_bar->is_visible()) {
width -= mw + bg->get_margin(MARGIN_RIGHT);
}
- scroll_bar->set_page(page);
draw_style_box(bg, Rect2(Point2(), size));
@@ -883,8 +881,12 @@ void ItemList::_notification(int p_what) {
}
if (all_fit) {
+ float page = size.height - bg->get_minimum_size().height;
float max = MAX(page, ofs.y + max_h);
+ if (auto_height)
+ auto_height_value = ofs.y + max_h + bg->get_minimum_size().height;
scroll_bar->set_max(max);
+ scroll_bar->set_page(page);
//print_line("max: "+rtos(max)+" page "+rtos(page));
if (max <= page) {
scroll_bar->set_value(0);
@@ -1253,6 +1255,26 @@ Array ItemList::_get_items() const {
return items;
}
+Size2 ItemList::get_minimum_size() const {
+
+ if (auto_height) {
+ return Size2(0, auto_height_value);
+ }
+ return Size2();
+}
+
+void ItemList::set_auto_height(bool p_enable) {
+
+ auto_height = p_enable;
+ shape_changed = true;
+ update();
+}
+
+bool ItemList::has_auto_height() const {
+
+ return auto_height;
+}
+
void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_item", "text", "icon:Texture", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true));
@@ -1323,6 +1345,9 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_rmb_select", "allow"), &ItemList::set_allow_rmb_select);
ClassDB::bind_method(D_METHOD("get_allow_rmb_select"), &ItemList::get_allow_rmb_select);
+ ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
+ ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
+
ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos", "exact"), &ItemList::get_item_at_pos, DEFVAL(false));
ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible);
@@ -1340,6 +1365,7 @@ void ItemList::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_text_lines"), "set_max_text_lines", "get_max_text_lines");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height");
ADD_GROUP("Columns", "");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_columns"), "set_max_columns", "get_max_columns");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "same_column_width"), "set_same_column_width", "is_same_column_width");
@@ -1372,6 +1398,8 @@ ItemList::ItemList() {
same_column_width = false;
max_text_lines = 1;
max_columns = 1;
+ auto_height = false;
+ auto_height_value = 0.0f;
scroll_bar = memnew(VScrollBar);
add_child(scroll_bar);
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 9cb7016b60..137eff8885 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -78,6 +78,9 @@ private:
bool ensure_selected_visible;
bool same_column_width;
+ bool auto_height;
+ float auto_height_value;
+
Vector<Item> items;
Vector<int> separators;
@@ -198,6 +201,11 @@ public:
void set_icon_scale(real_t p_scale);
real_t get_icon_scale() const;
+ void set_auto_height(bool p_enable);
+ bool has_auto_height() const;
+
+ Size2 get_minimum_size() const;
+
VScrollBar *get_v_scroll() { return scroll_bar; }
ItemList();
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 7158592bb1..68afe8150a 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -273,8 +273,8 @@ Range::Range() {
shared = memnew(Shared);
shared->min = 0;
shared->max = 100;
- shared->val =
- shared->step = 1;
+ shared->val = 0;
+ shared->step = 1;
shared->page = 0;
shared->owners.insert(this);
shared->exp_ratio = false;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index c5278b8595..8f0467afc3 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1153,7 +1153,7 @@ void SceneTree::_update_root_rect() {
if (stretch_mode == STRETCH_MODE_DISABLED) {
- root->set_size(last_screen_size);
+ root->set_size((last_screen_size / stretch_shrink).floor());
root->set_attach_to_screen_rect(Rect2(Point2(), last_screen_size));
root->set_size_override_stretch(false);
root->set_size_override(false, Size2());
@@ -1231,15 +1231,15 @@ void SceneTree::_update_root_rect() {
switch (stretch_mode) {
case STRETCH_MODE_2D: {
- root->set_size(screen_size);
+ root->set_size((screen_size / stretch_shrink).floor());
root->set_attach_to_screen_rect(Rect2(margin, screen_size));
root->set_size_override_stretch(true);
- root->set_size_override(true, viewport_size);
+ root->set_size_override(true, (viewport_size / stretch_shrink).floor());
} break;
case STRETCH_MODE_VIEWPORT: {
- root->set_size(viewport_size);
+ root->set_size((viewport_size / stretch_shrink).floor());
root->set_attach_to_screen_rect(Rect2(margin, screen_size));
root->set_size_override_stretch(false);
root->set_size_override(false, Size2());
@@ -1248,11 +1248,12 @@ void SceneTree::_update_root_rect() {
}
}
-void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize) {
+void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize, int p_shrink) {
stretch_mode = p_mode;
stretch_aspect = p_aspect;
stretch_min = p_minsize;
+ stretch_shrink = p_shrink;
_update_root_rect();
}
@@ -2207,7 +2208,7 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_frame"), &SceneTree::get_frame);
ClassDB::bind_method(D_METHOD("quit"), &SceneTree::quit);
- ClassDB::bind_method(D_METHOD("set_screen_stretch", "mode", "aspect", "minsize"), &SceneTree::set_screen_stretch);
+ ClassDB::bind_method(D_METHOD("set_screen_stretch", "mode", "aspect", "minsize", "shrink"), &SceneTree::set_screen_stretch, DEFVAL(1));
ClassDB::bind_method(D_METHOD("queue_delete", "obj"), &SceneTree::queue_delete);
@@ -2395,6 +2396,7 @@ SceneTree::SceneTree() {
stretch_mode = STRETCH_MODE_DISABLED;
stretch_aspect = STRETCH_ASPECT_IGNORE;
+ stretch_shrink = 1;
last_screen_size = Size2(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height);
_update_root_rect();
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 76a4becdbc..90d42ef01b 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -149,6 +149,7 @@ private:
StretchMode stretch_mode;
StretchAspect stretch_aspect;
Size2i stretch_min;
+ int stretch_shrink;
void _update_root_rect();
@@ -420,7 +421,7 @@ public:
void get_nodes_in_group(const StringName &p_group, List<Node *> *p_list);
bool has_group(const StringName &p_identifier) const;
- void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize);
+ void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize, int p_shrink = 1);
//void change_scene(const String& p_path);
//Node *get_loaded_scene();
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index d2848076a0..2fdc4c9e24 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -338,7 +338,7 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharT
cpos.y += ch->v_align;
ERR_FAIL_COND_V(ch->texture_idx < -1 || ch->texture_idx >= fb->textures.size(), 0);
if (ch->texture_idx != -1)
- VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), fb->textures[ch->texture_idx].texture->get_rid(), ch->rect, p_modulate);
+ VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), fb->textures[ch->texture_idx].texture->get_rid(), ch->rect, p_modulate, false, RID(), false);
advance = ch->advance;
used_fallback = true;
break;
@@ -360,7 +360,7 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharT
cpos.y += c->v_align;
ERR_FAIL_COND_V(c->texture_idx < -1 || c->texture_idx >= textures.size(), 0);
if (c->texture_idx != -1)
- VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx].texture->get_rid(), c->rect, p_modulate);
+ VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx].texture->get_rid(), c->rect, p_modulate, false, RID(), false);
advance = c->advance;
//textures[c->texture_idx].texture->draw(p_canvas_item,Vector2());
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index a0b192259b..805385ccaf 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -334,6 +334,9 @@ void SpatialMaterial::_update_shader() {
if (flags[FLAG_ONTOP]) {
code += ",ontop";
}
+ if (flags[FLAG_USE_VERTEX_LIGHTING]) {
+ code += ",vertex_lighting";
+ }
if (flags[FLAG_UV1_USE_TRIPLANAR] || flags[FLAG_UV2_USE_TRIPLANAR]) {
code += ",world_vertex_coords";
@@ -444,6 +447,11 @@ void SpatialMaterial::_update_shader() {
code += "\tPOINT_SIZE=point_size;\n";
}
+ if (flags[FLAG_USE_VERTEX_LIGHTING]) {
+
+ code += "\tROUGHNESS=roughness;\n";
+ }
+
if (!flags[FLAG_UV1_USE_TRIPLANAR]) {
code += "\tUV=UV*uv1_scale.xy+uv1_offset.xy;\n";
}
@@ -1450,6 +1458,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Flags", "flags_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_transparent"), "set_feature", "get_feature", FEATURE_TRANSPARENT);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_unshaded"), "set_flag", "get_flag", FLAG_UNSHADED);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_vertex_lighting"), "set_flag", "get_flag", FLAG_USE_VERTEX_LIGHTING);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_on_top"), "set_flag", "get_flag", FLAG_ONTOP);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_use_point_size"), "set_flag", "get_flag", FLAG_USE_POINT_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE);
@@ -1605,6 +1614,7 @@ void SpatialMaterial::_bind_methods() {
BIND_CONSTANT(CULL_DISABLED);
BIND_CONSTANT(FLAG_UNSHADED);
+ BIND_CONSTANT(FLAG_USE_VERTEX_LIGHTING);
BIND_CONSTANT(FLAG_ONTOP);
BIND_CONSTANT(FLAG_ALBEDO_FROM_VERTEX_COLOR);
BIND_CONSTANT(FLAG_SRGB_VERTEX_COLOR)
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 276064bce4..7587fc7927 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -155,6 +155,7 @@ public:
enum Flags {
FLAG_UNSHADED,
+ FLAG_USE_VERTEX_LIGHTING,
FLAG_ONTOP,
FLAG_ALBEDO_FROM_VERTEX_COLOR,
FLAG_SRGB_VERTEX_COLOR,
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index c373ad67ee..b1ca72571e 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -47,8 +47,11 @@ void Sky::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radiance_size", "size"), &Sky::set_radiance_size);
ClassDB::bind_method(D_METHOD("get_radiance_size"), &Sky::get_radiance_size);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "radiance_size", PROPERTY_HINT_ENUM, "256,512,1024,2048"), "set_radiance_size", "get_radiance_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "radiance_size", PROPERTY_HINT_ENUM, "32,64,128,256,512,1024,2048"), "set_radiance_size", "get_radiance_size");
+ BIND_CONSTANT(RADIANCE_SIZE_32);
+ BIND_CONSTANT(RADIANCE_SIZE_64);
+ BIND_CONSTANT(RADIANCE_SIZE_128);
BIND_CONSTANT(RADIANCE_SIZE_256);
BIND_CONSTANT(RADIANCE_SIZE_512);
BIND_CONSTANT(RADIANCE_SIZE_1024);
@@ -66,7 +69,7 @@ void PanoramaSky::_radiance_changed() {
if (panorama.is_valid()) {
static const int size[RADIANCE_SIZE_MAX] = {
- 256, 512, 1024, 2048
+ 32, 64, 128, 256, 512, 1024, 2048
};
VS::get_singleton()->sky_set_texture(sky, panorama->get_rid(), size[get_radiance_size()]);
}
@@ -120,7 +123,7 @@ void ProceduralSky::_radiance_changed() {
return; //do nothing yet
static const int size[RADIANCE_SIZE_MAX] = {
- 256, 512, 1024, 2048
+ 32, 64, 128, 256, 512, 1024, 2048
};
VS::get_singleton()->sky_set_texture(sky, texture, size[get_radiance_size()]);
}
@@ -132,7 +135,7 @@ void ProceduralSky::_update_sky() {
PoolVector<uint8_t> imgdata;
static const int size[TEXTURE_SIZE_MAX] = {
- 1024, 2048, 4096
+ 256, 512, 1024, 2048, 4096
};
int w = size[texture_size];
@@ -465,7 +468,14 @@ void ProceduralSky::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_sun_energy", "get_sun_energy");
ADD_GROUP("Texture", "texture_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_size", PROPERTY_HINT_ENUM, "1024,2048,4096"), "set_texture_size", "get_texture_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_size", PROPERTY_HINT_ENUM, "256,512,1024,2048,4096"), "set_texture_size", "get_texture_size");
+
+ BIND_CONSTANT(TEXTURE_SIZE_256);
+ BIND_CONSTANT(TEXTURE_SIZE_512);
+ BIND_CONSTANT(TEXTURE_SIZE_1024);
+ BIND_CONSTANT(TEXTURE_SIZE_2048);
+ BIND_CONSTANT(TEXTURE_SIZE_4096);
+ BIND_CONSTANT(TEXTURE_SIZE_MAX);
}
ProceduralSky::ProceduralSky() {
diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h
index 7b707af3a6..8298d1b3c0 100644
--- a/scene/resources/sky_box.h
+++ b/scene/resources/sky_box.h
@@ -37,6 +37,9 @@ class Sky : public Resource {
public:
enum RadianceSize {
+ RADIANCE_SIZE_32,
+ RADIANCE_SIZE_64,
+ RADIANCE_SIZE_128,
RADIANCE_SIZE_256,
RADIANCE_SIZE_512,
RADIANCE_SIZE_1024,
@@ -85,6 +88,8 @@ class ProceduralSky : public Sky {
public:
enum TextureSize {
+ TEXTURE_SIZE_256,
+ TEXTURE_SIZE_512,
TEXTURE_SIZE_1024,
TEXTURE_SIZE_2048,
TEXTURE_SIZE_4096,
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 599a6419a7..3de0841f2a 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -66,6 +66,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["INSTANCE_ID"] = ShaderLanguage::TYPE_INT;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["INSTANCE_CUSTOM"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
//builtins
shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;
@@ -147,6 +148,8 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].modes.insert("skip_vertex_transform");
shader_modes[VS::SHADER_SPATIAL].modes.insert("world_vertex_coords");
+ shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_lighting");
+
/************ CANVAS ITEM **************************/
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["SRC_VERTEX"] = ShaderLanguage::TYPE_VEC2;
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index fc274fa8e1..277b401d49 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1592,6 +1592,14 @@ VisualServer::VisualServer() {
GLOBAL_DEF("rendering/quality/reflections/texture_array_reflections", true);
GLOBAL_DEF("rendering/quality/reflections/texture_array_reflections.mobile", false);
+ GLOBAL_DEF("rendering/quality/reflections/high_quality_ggx", true);
+ GLOBAL_DEF("rendering/quality/reflections/high_quality_ggx.mobile", false);
+
+ GLOBAL_DEF("rendering/quality/shading/force_vertex_shading", false);
+ GLOBAL_DEF("rendering/quality/shading/force_vertex_shading.mobile", true);
+
+ GLOBAL_DEF("rendering/quality/depth_prepass/enable", true);
+ GLOBAL_DEF("rendering/quality/depth_prepass/disable_for_vendors", "PowerVR,Mali,Adreno");
}
VisualServer::~VisualServer() {
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 0067f0ff26..0078f15821 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -107,7 +107,7 @@ Files extracted from upstream source:
## libpng
- Upstream: http://libpng.org/pub/png/libpng.html
-- Version: 1.6.30
+- Version: 1.6.31rc01
- License: libpng/zlib
Files extracted from upstream source:
diff --git a/thirdparty/libpng/arm/filter_neon.S b/thirdparty/libpng/arm/filter_neon.S
index 3b061d6bbf..09267c6030 100644
--- a/thirdparty/libpng/arm/filter_neon.S
+++ b/thirdparty/libpng/arm/filter_neon.S
@@ -1,9 +1,9 @@
/* filter_neon.S - NEON optimised filter functions
*
- * Copyright (c) 2014 Glenn Randers-Pehrson
+ * Copyright (c) 2014,2017 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
- * Last changed in libpng 1.6.16 [December 22, 2014]
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -16,7 +16,7 @@
#define PNG_VERSION_INFO_ONLY
#include "../pngpriv.h"
-#if defined(__linux__) && defined(__ELF__)
+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
#endif
diff --git a/thirdparty/libpng/png.c b/thirdparty/libpng/png.c
index 40688be123..87fda0b306 100644
--- a/thirdparty/libpng/png.c
+++ b/thirdparty/libpng/png.c
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -14,7 +14,27 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_30 Your_png_h_is_not_version_1_6_30;
+typedef png_libpng_version_1_6_31rc01 Your_png_h_is_not_version_1_6_31rc01;
+
+#ifdef __GNUC__
+/* The version tests may need to be added to, but the problem warning has
+ * consistently been fixed in GCC versions which obtain wide-spread release.
+ * The problem is that many versions of GCC rearrange comparison expressions in
+ * the optimizer in such a way that the results of the comparison will change
+ * if signed integer overflow occurs. Such comparisons are not permitted in
+ * ANSI C90, however GCC isn't clever enough to work out that that do not occur
+ * below in png_ascii_from_fp and png_muldiv, so it produces a warning with
+ * -Wextra. Unfortunately this is highly dependent on the optimizer and the
+ * machine architecture so the warning comes and goes unpredictably and is
+ * impossible to "fix", even were that a good idea.
+ */
+#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
+#define GCC_STRICT_OVERFLOW 1
+#endif /* GNU 7.1.x */
+#endif /* GNU */
+#ifndef GCC_STRICT_OVERFLOW
+#define GCC_STRICT_OVERFLOW 0
+#endif
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -595,6 +615,16 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
}
#endif
+#ifdef PNG_eXIf_SUPPORTED
+ /* Free any eXIf entry */
+ if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->exif);
+ info_ptr->exif = NULL;
+ info_ptr->valid &= ~PNG_INFO_eXIf;
+ }
+#endif
+
#ifdef PNG_hIST_SUPPORTED
/* Free any hIST entry */
if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
@@ -776,14 +806,14 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.30 - June 28, 2017" PNG_STRING_NEWLINE \
+ "libpng version 1.6.31rc01 - July 19, 2017" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
- return "libpng version 1.6.30 - June 28, 2017\
+ return "libpng version 1.6.31rc01 - July 19, 2017\
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -2857,6 +2887,14 @@ png_pow10(int power)
/* Function to format a floating point value in ASCII with a given
* precision.
*/
+#if GCC_STRICT_OVERFLOW
+#pragma GCC diagnostic push
+/* The problem arises below with exp_b10, which can never overflow because it
+ * comes, originally, from frexp and is therefore limited to a range which is
+ * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
+ */
+#pragma GCC diagnostic warning "-Wstrict-overflow=2"
+#endif /* GCC_STRICT_OVERFLOW */
void /* PRIVATE */
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
double fp, unsigned int precision)
@@ -2946,7 +2984,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
{
- czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
+ czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */
exp_b10 = 0; /* Dot added below before first output. */
}
else
@@ -3087,7 +3125,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At
- * this point exp_b10==(-1) is effectively if flag - it got
+ * this point exp_b10==(-1) is effectively a flag - it got
* to '-1' because of the decrement after outputting
* the decimal point above (the exponent required is
* *not* -1!)
@@ -3101,7 +3139,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
* zeros were *not* output, so this doesn't increase
* the output count.
*/
- while (--exp_b10 >= 0) *ascii++ = 48;
+ while (exp_b10-- > 0) *ascii++ = 48;
*ascii = 0;
@@ -3131,11 +3169,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
if (exp_b10 < 0)
{
*ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
- uexp_b10 = (unsigned int)(-exp_b10);
+ uexp_b10 = 0U-exp_b10;
}
else
- uexp_b10 = (unsigned int)exp_b10;
+ uexp_b10 = 0U+exp_b10;
cdigits = 0;
@@ -3178,6 +3216,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
}
+#if GCC_STRICT_OVERFLOW
+#pragma GCC diagnostic pop
+#endif /* GCC_STRICT_OVERFLOW */
# endif /* FLOATING_POINT */
@@ -3291,6 +3332,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
* the nearest .00001). Overflow and divide by zero are signalled in
* the result, a boolean - true on success, false on overflow.
*/
+#if GCC_STRICT_OVERFLOW /* from above */
+/* It is not obvious which comparison below gets optimized in such a way that
+ * signed overflow would change the result; looking through the code does not
+ * reveal any tests which have the form GCC complains about, so presumably the
+ * optimizer is moving an add or subtract into the 'if' somewhere.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wstrict-overflow=2"
+#endif /* GCC_STRICT_OVERFLOW */
int
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
png_int_32 divisor)
@@ -3405,6 +3455,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
return 0;
}
+#if GCC_STRICT_OVERFLOW
+#pragma GCC diagnostic pop
+#endif /* GCC_STRICT_OVERFLOW */
#endif /* READ_GAMMA || INCH_CONVERSIONS */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
diff --git a/thirdparty/libpng/png.h b/thirdparty/libpng/png.h
index c2c4fdf251..80ecc82c3a 100644
--- a/thirdparty/libpng/png.h
+++ b/thirdparty/libpng/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.6.30, June 28, 2017
+ * libpng version 1.6.31rc01, July 19, 2017
*
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -12,7 +12,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.6.30, June 28, 2017:
+ * libpng versions 0.97, January 1998, through 1.6.31rc01, July 19, 2017:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@@ -25,7 +25,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are
+ * libpng versions 1.0.7, July 1, 2000 through 1.6.31rc01, July 19, 2017 are
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
* derived from libpng-1.0.6, and are distributed according to the same
* disclaimer and license as libpng-1.0.6 with the following individuals
@@ -213,7 +213,7 @@
* ...
* 1.5.28 15 10527 15.so.15.28[.0]
* ...
- * 1.6.30 16 10630 16.so.16.30[.0]
+ * 1.6.31 16 10631 16.so.16.31[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -241,13 +241,13 @@
* Y2K compliance in libpng:
* =========================
*
- * June 28, 2017
+ * July 19, 2017
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.6.30 are Y2K compliant. It is my belief that
+ * upward through 1.6.31rc01 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -309,8 +309,8 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.30"
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.30 - June 28, 2017\n"
+#define PNG_LIBPNG_VER_STRING "1.6.31rc01"
+#define PNG_HEADER_VERSION_STRING " libpng version 1.6.31rc01 - July 19, 2017\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -318,13 +318,13 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
-#define PNG_LIBPNG_VER_RELEASE 30
+#define PNG_LIBPNG_VER_RELEASE 31
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
-#define PNG_LIBPNG_VER_BUILD 0
+#define PNG_LIBPNG_VER_BUILD 01
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@@ -341,7 +341,7 @@
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
PNG_LIBPNG_BUILD_PRIVATE */
-#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
+#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_RC
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@@ -349,7 +349,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
-#define PNG_LIBPNG_VER 10630 /* 1.6.30 */
+#define PNG_LIBPNG_VER 10631 /* 1.6.31 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -459,7 +459,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef char* png_libpng_version_1_6_30;
+typedef char* png_libpng_version_1_6_31rc01;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -776,6 +776,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
+#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -1788,7 +1789,8 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
#define PNG_FREE_PLTE 0x1000U
#define PNG_FREE_TRNS 0x2000U
#define PNG_FREE_TEXT 0x4000U
-#define PNG_FREE_ALL 0x7fffU
+#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
+#define PNG_FREE_ALL 0xffffU
#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
#ifdef PNG_USER_MEM_SUPPORTED
@@ -2007,6 +2009,13 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
png_fixed_point int_blue_Z))
#endif
+#ifdef PNG_eXIf_SUPPORTED
+PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
+ png_inforp info_ptr, png_bytep *exif));
+PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
+ png_inforp info_ptr, const png_bytep exif));
+#endif
+
#ifdef PNG_gAMA_SUPPORTED
PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *file_gamma))
@@ -2025,9 +2034,6 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
#ifdef PNG_hIST_SUPPORTED
PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
png_inforp info_ptr, png_uint_16p *hist));
-#endif
-
-#ifdef PNG_hIST_SUPPORTED
PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
png_inforp info_ptr, png_const_uint_16p hist));
#endif
@@ -3253,7 +3259,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
- PNG_EXPORT_LAST_ORDINAL(245);
+ PNG_EXPORT_LAST_ORDINAL(247);
#endif
#ifdef __cplusplus
diff --git a/thirdparty/libpng/pngconf.h b/thirdparty/libpng/pngconf.h
index f64592acd7..9308d6a60a 100644
--- a/thirdparty/libpng/pngconf.h
+++ b/thirdparty/libpng/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.6.30, June 28, 2017
+ * libpng version 1.6.31rc01, July 19, 2017
*
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/thirdparty/libpng/pngerror.c b/thirdparty/libpng/pngerror.c
index 00d76f7c05..37f26c6558 100644
--- a/thirdparty/libpng/pngerror.c
+++ b/thirdparty/libpng/pngerror.c
@@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
+ * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_02u:
/* Expects at least 2 digits. */
mincount = 2;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_u:
*--end = digits[number % 10];
@@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_02x:
/* This format expects at least two digits */
mincount = 2;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_x:
*--end = digits[number & 0xf];
diff --git a/thirdparty/libpng/pngget.c b/thirdparty/libpng/pngget.c
index 141c393330..ace9e6351f 100644
--- a/thirdparty/libpng/pngget.c
+++ b/thirdparty/libpng/pngget.c
@@ -773,6 +773,24 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
}
#endif
+#ifdef PNG_eXIf_SUPPORTED
+png_uint_32 PNGAPI
+png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_bytep *exif)
+{
+ png_debug1(1, "in %s retrieval function", "eXIf");
+
+ if (png_ptr != NULL && info_ptr != NULL &&
+ (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
+ {
+ *exif = info_ptr->exif;
+ return (PNG_INFO_eXIf);
+ }
+
+ return (0);
+}
+#endif
+
#ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
diff --git a/thirdparty/libpng/pnginfo.h b/thirdparty/libpng/pnginfo.h
index 361ed8be70..6e6d46a62b 100644
--- a/thirdparty/libpng/pnginfo.h
+++ b/thirdparty/libpng/pnginfo.h
@@ -185,6 +185,11 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
+#ifdef PNG_eXIf_SUPPORTED
+ int num_exif;
+ png_bytep exif;
+#endif
+
#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
diff --git a/thirdparty/libpng/pnglibconf.h b/thirdparty/libpng/pnglibconf.h
index da3d8359f4..8738ebdfc2 100644
--- a/thirdparty/libpng/pnglibconf.h
+++ b/thirdparty/libpng/pnglibconf.h
@@ -1,8 +1,8 @@
-/* libpng 1.6.30 STANDARD API DEFINITION */
+/* libpng 1.6.31rc01 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
-/* Libpng version 1.6.30 - June 28, 2017 */
+/* Libpng version 1.6.31rc01 - July 19, 2017 */
/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
@@ -84,6 +84,7 @@
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
+#define PNG_READ_eXIf_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
@@ -153,6 +154,7 @@
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED
+#define PNG_WRITE_eXIf_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED
@@ -170,6 +172,7 @@
#define PNG_WRITE_zTXt_SUPPORTED
#define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED
+#define PNG_eXIf_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
diff --git a/thirdparty/libpng/pngpriv.h b/thirdparty/libpng/pngpriv.h
index 77d30420a5..7c273bd5e3 100644
--- a/thirdparty/libpng/pngpriv.h
+++ b/thirdparty/libpng/pngpriv.h
@@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
- * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -35,7 +35,9 @@
* Windows/Visual Studio) there is no effect; the OS specific tests below are
* still required (as of 2011-05-02.)
*/
-#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Standard library headers not required by png.h: */
@@ -452,6 +454,21 @@
# define png_fixed_error(s1,s2) png_err(s1)
#endif
+/* Some fixed point APIs are still required even if not exported because
+ * they get used by the corresponding floating point APIs. This magic
+ * deals with this:
+ */
+#ifdef PNG_FIXED_POINT_SUPPORTED
+# define PNGFAPI PNGAPI
+#else
+# define PNGFAPI /* PRIVATE */
+#endif
+
+#ifndef PNG_VERSION_INFO_ONLY
+/* Other defines specific to compilers can go here. Try to keep
+ * them inside an appropriate ifdef/endif pair for portability.
+ */
+
/* C allows up-casts from (void*) to any pointer and (const void*) to any
* pointer to a const object. C++ regards this as a type error and requires an
* explicit, static, cast and provides the static_cast<> rune to ensure that
@@ -464,7 +481,7 @@
static_cast<type>(static_cast<void*>(value))
# define png_aligncastconst(type, value) \
static_cast<type>(static_cast<const void*>(value))
-#elif !defined(__ASSEMBLER__)
+#else
# define png_voidcast(type, value) (value)
# ifdef _WIN64
# ifdef __GNUC__
@@ -480,20 +497,6 @@
# define png_aligncastconst(type, value) ((const void*)(value))
#endif /* __cplusplus */
-/* Some fixed point APIs are still required even if not exported because
- * they get used by the corresponding floating point APIs. This magic
- * deals with this:
- */
-#ifdef PNG_FIXED_POINT_SUPPORTED
-# define PNGFAPI PNGAPI
-#else
-# define PNGFAPI /* PRIVATE */
-#endif
-
-#ifndef PNG_VERSION_INFO_ONLY
-/* Other defines specific to compilers can go here. Try to keep
- * them inside an appropriate ifdef/endif pair for portability.
- */
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of
@@ -839,6 +842,7 @@
#define png_PLTE PNG_U32( 80, 76, 84, 69)
#define png_bKGD PNG_U32( 98, 75, 71, 68)
#define png_cHRM PNG_U32( 99, 72, 82, 77)
+#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
#define png_gAMA PNG_U32(103, 65, 77, 65)
#define png_gIFg PNG_U32(103, 73, 70, 103)
@@ -1438,6 +1442,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif
+#ifdef PNG_READ_eXIf_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+#endif
+
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
diff --git a/thirdparty/libpng/pngread.c b/thirdparty/libpng/pngread.c
index 106a80588c..b44d4dfbb5 100644
--- a/thirdparty/libpng/pngread.c
+++ b/thirdparty/libpng/pngread.c
@@ -1,8 +1,8 @@
/* pngread.c - read a PNG file
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
+ * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -1883,7 +1883,7 @@ png_create_colormap_entry(png_image_read_control *display,
{
case 4:
entry[afirst ? 0 : 3] = (png_uint_16)alpha;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 3:
if (alpha < 65535)
@@ -1905,7 +1905,7 @@ png_create_colormap_entry(png_image_read_control *display,
case 2:
entry[1 ^ afirst] = (png_uint_16)alpha;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 1:
if (alpha < 65535)
@@ -1934,6 +1934,7 @@ png_create_colormap_entry(png_image_read_control *display,
{
case 4:
entry[afirst ? 0 : 3] = (png_byte)alpha;
+ /* FALLTHROUGH */
case 3:
entry[afirst + (2 ^ bgr)] = (png_byte)blue;
entry[afirst + 1] = (png_byte)green;
@@ -1942,6 +1943,7 @@ png_create_colormap_entry(png_image_read_control *display,
case 2:
entry[1 ^ afirst] = (png_byte)alpha;
+ /* FALLTHROUGH */
case 1:
entry[afirst] = (png_byte)green;
break;
@@ -2861,7 +2863,7 @@ png_image_read_colormap(png_voidp argument)
case P_sRGB:
/* Change to 8-bit sRGB */
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case P_FILE:
if (png_ptr->bit_depth > 8)
@@ -3179,8 +3181,7 @@ png_image_read_colormapped(png_voidp argument)
image->colormap_entries == 244 /* 216 + 1 + 27 */)
break;
- /* goto bad_output; */
- /* FALL THROUGH */
+ goto bad_output;
default:
bad_output:
diff --git a/thirdparty/libpng/pngrtran.c b/thirdparty/libpng/pngrtran.c
index 3886833af0..9285983848 100644
--- a/thirdparty/libpng/pngrtran.c
+++ b/thirdparty/libpng/pngrtran.c
@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr,
"Can't discard critical data on CRC error");
+ /* FALLTHROUGH */
case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT:
@@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
default:
case 8:
- /* FALL THROUGH (Already 8 bits) */
+ /* FALLTHROUGH */ /* (Already 8 bits) */
case 16:
/* Already a full 16 bits */
diff --git a/thirdparty/libpng/pngrutil.c b/thirdparty/libpng/pngrutil.c
index f60545bf90..9cde64845c 100644
--- a/thirdparty/libpng/pngrutil.c
+++ b/thirdparty/libpng/pngrutil.c
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -2009,6 +2009,44 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
}
#endif
+#ifdef PNG_READ_eXIf_SUPPORTED
+void /* PRIVATE */
+png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+{
+ unsigned int i;
+ png_bytep eXIf_buf;
+
+ png_debug(1, "in png_handle_eXIf");
+
+ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
+ png_chunk_error(png_ptr, "missing IHDR");
+
+ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_eXIf) != 0)
+ {
+ png_crc_finish(png_ptr, length);
+ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+ eXIf_buf = png_voidcast(png_bytep,
+ png_malloc_warn(png_ptr, length));
+
+ for (i = 0; i < length; i++)
+ {
+ png_byte buf[1];
+ png_crc_read(png_ptr, buf, 1);
+ eXIf_buf[i] = buf[0];
+ }
+
+ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ info_ptr->num_exif = length;
+
+ png_set_eXIf(png_ptr, info_ptr, eXIf_buf);
+}
+#endif
+
#ifdef PNG_READ_hIST_SUPPORTED
void /* PRIVATE */
png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
@@ -2978,7 +3016,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
case 2:
png_ptr->user_chunk_cache_max = 1;
png_chunk_benign_error(png_ptr, "no space in chunk cache");
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 1:
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
* chunk being skipped, now there will be a hard error below.
@@ -2987,7 +3025,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
default: /* not at limit */
--(png_ptr->user_chunk_cache_max);
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 0: /* no limit */
# endif /* USER_LIMITS */
/* Here when the limit isn't reached or when limits are compiled
diff --git a/thirdparty/libpng/pngset.c b/thirdparty/libpng/pngset.c
index fb495ac3fb..998473557f 100644
--- a/thirdparty/libpng/pngset.c
+++ b/thirdparty/libpng/pngset.c
@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.30 [June 28, 2017]
* Copyright (c) 1998-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -134,6 +134,39 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
#endif /* cHRM */
+#ifdef PNG_eXIf_SUPPORTED
+void PNGAPI
+png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
+ const png_bytep eXIf_buf)
+{
+ int i;
+
+ png_debug1(1, "in %s storage function", "eXIf");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+ png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
+
+ info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
+ info_ptr->num_exif));
+
+ if (info_ptr->exif == NULL)
+ {
+ png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
+
+ return;
+ }
+
+ info_ptr->free_me |= PNG_FREE_EXIF;
+
+ for (i = 0; i < info_ptr->num_exif; i++)
+ info_ptr->exif[i] = eXIf_buf[i];
+
+ info_ptr->valid |= PNG_INFO_eXIf;
+}
+#endif /* eXIf */
+
#ifdef PNG_gAMA_SUPPORTED
void PNGFAPI
png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
diff --git a/thirdparty/libpng/pngstruct.h b/thirdparty/libpng/pngstruct.h
index 749d7e35b1..44b79dea74 100644
--- a/thirdparty/libpng/pngstruct.h
+++ b/thirdparty/libpng/pngstruct.h
@@ -479,5 +479,8 @@ struct png_struct_def
png_colorspace colorspace;
#endif
#endif
+
+/* New member added in libpng-1.6.31 */
+ int num_exif;
};
#endif /* PNGSTRUCT_H */
diff --git a/thirdparty/libpng/pngtrans.c b/thirdparty/libpng/pngtrans.c
index 6c8c646239..326ac33f0e 100644
--- a/thirdparty/libpng/pngtrans.c
+++ b/thirdparty/libpng/pngtrans.c
@@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.30 [June 28, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/thirdparty/libpng/pngwrite.c b/thirdparty/libpng/pngwrite.c
index 07088ee75e..8c2952e794 100644
--- a/thirdparty/libpng/pngwrite.c
+++ b/thirdparty/libpng/pngwrite.c
@@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.31 [(PENDING RELEASE)]
+ * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -1007,8 +1007,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
case 5:
case 6:
case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
- /* FALL THROUGH */
#endif /* WRITE_FILTER */
+ /* FALLTHROUGH */
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
@@ -1875,7 +1875,7 @@ png_image_set_PLTE(png_image_write_control *display)
tRNS[i] = entry[afirst ? 0 : 3];
if (tRNS[i] < 255)
num_trans = i+1;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 3:
palette[i].blue = entry[afirst + (2 ^ bgr)];
palette[i].green = entry[afirst + 1];
@@ -1886,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display)
tRNS[i] = entry[1 ^ afirst];
if (tRNS[i] < 255)
num_trans = i+1;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 1:
palette[i].blue = palette[i].red = palette[i].green =
entry[afirst];
diff --git a/thirdparty/libpng/pngwutil.c b/thirdparty/libpng/pngwutil.c
index dd800586be..348bb524dd 100644
--- a/thirdparty/libpng/pngwutil.c
+++ b/thirdparty/libpng/pngwutil.c
@@ -1473,6 +1473,37 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
}
#endif
+#ifdef PNG_WRITE_eXIf_SUPPORTED
+/* Write the Exif data */
+void /* PRIVATE */
+png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
+{
+ int i;
+ png_byte buf[3];
+
+ png_debug(1, "in png_write_eXIf");
+
+ if (num_exif > (int)png_ptr->num_exif)
+ {
+ png_debug2(3, "num_exif = %d, png_ptr->num_exif = %d", num_exif,
+ png_ptr->num_exif);
+
+ png_warning(png_ptr, "Invalid number of exif bytes specified");
+ return;
+ }
+
+ png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif));
+
+ for (i = 0; i < num_exif; i++)
+ {
+ buf[i] = exif[i];
+ png_write_chunk_data(png_ptr, buf, (png_size_t)1);
+ }
+
+ png_write_chunk_end(png_ptr);
+}
+#endif
+
#ifdef PNG_WRITE_hIST_SUPPORTED
/* Write the histogram */
void /* PRIVATE */