summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYRIGHT.txt52
-rw-r--r--core/math/matrix3.cpp7
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp9
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp224
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h2
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl56
-rw-r--r--drivers/gles3/shaders/scene.glsl68
-rw-r--r--editor/settings_config_dialog.cpp4
-rw-r--r--scene/3d/mesh_instance.cpp13
-rw-r--r--scene/resources/environment.cpp2
10 files changed, 331 insertions, 106 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 698e4b1dc8..84a57d2663 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -41,6 +41,7 @@ Upstream-Contact: Rémi Verschelde <contact@godotengine.org>
Source: https://github.com/godotengine/godot
Files: *
+Comment: Godot Engine
Copyright: 2007-2017, Juan Linietsky, Ariel Manzur.
2014-2017, Godot Engine contributors (cf. AUTHORS.md)
License: Expat
@@ -49,6 +50,7 @@ Files: ./icon.png
./icon.svg
./logo.png
./logo.svg
+Comment: Godot Engine logo
Copyright: Andrea Calabró
License: CC-BY-3.0
@@ -61,21 +63,25 @@ Files: ./platform/android/android_native_app_glue.c
./platform/android/java/src/org/godotengine/godot/input/InputManagerCompat.java
./platform/android/java/src/org/godotengine/godot/input/InputManagerV16.java
./platform/android/java/src/org/godotengine/godot/input/InputManagerV9.java
+Comment: The Android Open Source Project
Copyright: 2008-2013, The Android Open Source Project
License: Apache-2.0
Files: ./platform/android/cpu-features.c
./platform/android/cpu-features.h
+Comment: The Android Open Source Project
Copyright: 2010, The Android Open Source Project
License: BSD-2-clause
Files: ./platform/android/ifaddrs_android.cpp
./platform/android/ifaddrs_android.h
+Comment: The Android Open Source Project
Copyright: 2012-2013, Google Inc.
License: BSD-3-clause
Files: ./platform/android/java/src/com/android/vending/licensing/util/Base64.java
./platform/android/java/src/com/android/vending/licensing/util/Base64DecoderException.java
+Comment: The Android Open Source Project
Copyright: 2002, Google Inc.
License: Apache-2.0
@@ -83,12 +89,14 @@ Files: ./platform/android/power_android.cpp
./platform/osx/power_osx.cpp
./platform/windows/power_windows.cpp
./platform/x11/power_x11.cpp
+Comment: Simple DirectMedia Layer
Copyright: 1997-2017, Sam Lantinga
2007-2017, Juan Linietsky, Ariel Manzur.
2014-2017, Godot Engine contributors (cf. AUTHORS.md)
License: Expat and Zlib
Files: ./platform/uwp/export/export.cpp
+Comment: fb-util-for-appx
Copyright: 2016, Facebook, Inc. All rights reserved.
2007-2017, Juan Linietsky, Ariel Manzur.
2014-2017, Godot Engine contributors (cf. AUTHORS.md)
@@ -104,6 +112,7 @@ Files: ./servers/physics/gjk_epa.cpp
./servers/physics/joints/pin_joint_sw.h
./servers/physics/joints/slider_joint_sw.cpp
./servers/physics/joints/slider_joint_sw.h
+Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2003-2008, Erwin Coumans
2007-2017, Juan Linietsky, Ariel Manzur.
2014-2017, Godot Engine contributors (cf. AUTHORS.md)
@@ -111,79 +120,97 @@ License: Expat and Zlib
Files: ./servers/physics/joints/cone_twist_joint_sw.cpp
./servers/physics/joints/cone_twist_joint_sw.h
+Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2007, Starbreeze Studios
2007-2017, Juan Linietsky, Ariel Manzur.
2014-2017, Godot Engine contributors (cf. AUTHORS.md)
License: Expat and Zlib
Files: ./thirdparty/b2d_convexdecomp/
+Comment: Box2D (ConvexDecomp)
Copyright: 2007, Eric Jordan
Copyright: 2006-2009, Erin Catto
License: Zlib
Files: ./thirdparty/certs/ca-certificates.crt
+Comment: FIXME
Copyright: FIXME
License: FIXME
Files: ./thirdparty/enet/
+Comment: ENet
Copyright: 2002-2016, Lee Salzman
License: Expat
Files: ./thirdparty/fonts/DroidSans*.ttf
+Comment: DroidSans font
Copyright: 2008, The Android Open Source Project
License: Apache-2.0
Files: ./thirdparty/fonts/source_code_pro.otf
+Comment: Source Code Pro font
Copyright: 2010, 2012, Adobe Systems Incorporated
License: OFL-1.1
Files: ./thirdparty/freetype/
+Comment: The FreeType Project
Copyright: 1996-2016, David Turner, Robert Wilhelm, and Werner Lemberg.
License: FTL
Files: ./thirdparty/glad/
+Comment: glad
Copyright: 2013, David Herberth
License: Expat
Files: ./thirdparty/jpeg_compressor/
+Comment: jpeg-compressor
Copyright: 2012, Rich Geldreich
License: public-domain
Files: ./thirdparty/libogg/
+Comment: OggVorbis
Copyright: 2002, Xiph.org Foundation
License: BSD-3-clause
Files: ./thirdparty/libpng/
+Comment: libpng
Copyright: 1995-1996, Guy Eric Schalnat, Group 42, Inc.
1996-1997, Andreas Dilger
1998-2016, Glenn Randers-Pehrson
License: Zlib
Files: ./thirdparty/libsimplewebm/
+Comment: libsimplewebm
Copyright: 2016, Błażej Szczygieł
License: Expat
Files: ./thirdparty/libsimplewebm/libwebm/
+Comment: The WebM Project
Copyright: 2010, Google Inc.
License: BSD-3-clause
Files: ./thirdparty/libtheora/
+Comment: OggTheora
Copyright: 2002-2009, Xiph.org Foundation
License: BSD-3-clause
Files: ./thirdparty/libvorbis/
+Comment: OggVorbis
Copyright: 2002-2015, Xiph.org Foundation
License: BSD-3-clause
Files: ./thirdparty/libvpx/
+Comment: The WebM Project
Copyright: 2010, The WebM Project authors.
License: BSD-3-clause
-Files: ./thirdparty/libwebp/COPYING
+Files: ./thirdparty/libwebp/
+Comment: WebP codec
Copyright: 2010, Google Inc.
License: BSD-3-clause
Files: ./thirdparty/minizip/
+Comment: MiniZip
Copyright: 1998-2010, Gilles Vollant
2007-2008, Even Rouault
2009-2010, Mathias Svensson
@@ -193,68 +220,82 @@ Files: ./thirdparty/misc/aes256.cpp
./thirdparty/misc/aes256.h
./thirdparty/misc/sha256.c
./thirdparty/misc/sha256.h
+Comment: AES-256 and SHA-256 implementation
Copyright: 2007-2011, Ilya O. Levin
License: ISC
Files: ./thirdparty/misc/base64.c
./thirdparty/misc/base64.h
+Comment: BASE64 conversion methods
Copyright: Ari Edelkind
License: public-domain
Files: ./thirdparty/misc/curl_hostcheck.c
./thirdparty/misc/curl_hostcheck.h
+Comment: curl
Copyright: 1998-2012, Daniel Stenberg et al.
License: curl
Files: ./thirdparty/misc/fastlz.c
./thirdparty/misc/fastlz.h
+Comment: FastLZ
Copyright: 2005-2007, Ariya Hidayat
License: Expat
Files: ./thirdparty/misc/hq2x.cpp
./thirdparty/misc/hq2x.h
+Comment: hq2x implementation
Copyright: 2016, Bruno Ribeiro
License: Apache-2.0
Files: ./thirdparty/misc/md5.cpp
./thirdparty/misc/md5.h
+Comment: MD5 Message Digest Algorithm
Copyright: 1990, RSA Data Security, Inc.
License: RSA-MD
Files: ./thirdparty/misc/mikktspace.c
./thirdparty/misc/mikktspace.h
+Comment: Tangent Space Normal Maps implementation
Copyright: 2011, Morten S. Mikkelsen
License: Zlib
Files: ./thirdparty/misc/pcg.cpp
./thirdparty/misc/pcg.h
+Comment: Minimal PCG32 implementation
Copyright: 2014, M.E. O'Neill
License: Apache-2.0
Files: ./thirdparty/misc/smaz.c
./thirdparty/misc/smaz.h
+Comment: SMAZ
Copyright: 2006-2009, Salvatore Sanfilippo
License: BSD-3-clause
Files: ./thirdparty/misc/stb_truetype.h
./thirdparty/misc/stb_vorbis.c
+Comment: stb libraries
Copyright: 2007-2015, Sean Barrett
License: public-domain
Files: ./thirdparty/misc/triangulator.cpp
./thirdparty/misc/triangulator.h
+Comment: PolyPartition
Copyright: 2011, Ivan Fratric
License: Expat
Files: ./thirdparty/misc/yuv2rgb.h
+Comment: YUV2RGB
Copyright: 2008-2011, Robin Watts
License: BSD-2-clause
Files: ./thirdparty/openssl/
+Comment: The OpenSSL Project
Copyright: 1998-2016, The OpenSSL Project.
License: OpenSSL
Files: ./thirdparty/opus/
+Comment: Opus
Copyright: 2001-2011, Xiph.Org, Skype Limited, Octasic,
Jean-Marc Valin, Timothy B. Terriberry,
CSIRO, Gregory Maxwell, Mark Borgerding,
@@ -262,27 +303,28 @@ Copyright: 2001-2011, Xiph.Org, Skype Limited, Octasic,
License: BSD-3-clause
Files: ./thirdparty/pvrtccompressor/
+Comment: PvrTcCompressor
Copyright: 2014, Jeffrey Lim.
License: BSD-3-clause
-Files: ./thirdparty/rg-etc1/
-Copyright: 2012, Rich Geldreich
-License: Zlib
-
Files: ./thirdparty/rtaudio/
+Comment: RtAudio
Copyright: 2001-2016, Gary P. Scavone
License: Expat
Files: ./thirdparty/squish/
+Comment: libSquish
Copyright: 2006, Simon Brown
License: Expat
Files: ./thirdparty/tinyexr/
+Comment: TinyEXR
Copyright: 2014-2017, Syoyo Fujita
2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
License: BSD-3-Clause
Files: ./thirdparty/zlib/
+Comment: zlib
Copyright: 1995-2017, Jean-loup Gailly and Mark Adler
License: Zlib
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp
index c733251c3c..b59fecc196 100644
--- a/core/math/matrix3.cpp
+++ b/core/math/matrix3.cpp
@@ -451,9 +451,10 @@ Basis::operator String() const {
}
Basis::operator Quat() const {
-#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(is_rotation() == false, Quat());
-#endif
+ //commenting this check because precision issues cause it to fail when it shouldn't
+ //#ifdef MATH_CHECKS
+ //ERR_FAIL_COND_V(is_rotation() == false, Quat());
+ //#endif
real_t trace = elements[0][0] + elements[1][1] + elements[2][2];
real_t temp[4];
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 96c3da99f0..08ff51866d 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1884,14 +1884,21 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
if (p_base_env) {
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 2);
- glBindTexture(GL_TEXTURE_2D, p_base_env);
+ if (storage->config.use_texture_array_environment) {
+ glBindTexture(GL_TEXTURE_2D_ARRAY, p_base_env);
+ } else {
+ glBindTexture(GL_TEXTURE_2D, p_base_env);
+ }
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP, true);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP_ARRAY, storage->config.use_texture_array_environment);
} else {
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP, false);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP_ARRAY, false);
}
} else {
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP, false);
+ state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP_ARRAY, false);
}
state.cull_front = false;
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index b1dc32e1c0..8b86316da8 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1275,87 +1275,200 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
glActiveTexture(GL_TEXTURE1);
glGenTextures(1, &sky->radiance);
- glBindTexture(GL_TEXTURE_2D, sky->radiance);
- GLuint tmp_fb;
+ if (config.use_texture_array_environment) {
- glGenFramebuffers(1, &tmp_fb);
- glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb);
+ //texture3D
+ glBindTexture(GL_TEXTURE_2D_ARRAY, sky->radiance);
- int size = p_radiance_size;
+ GLuint tmp_fb;
- int lod = 0;
+ glGenFramebuffers(1, &tmp_fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb);
- int mipmaps = 6;
+ int size = p_radiance_size;
- int mm_level = mipmaps;
+ int array_level = 6;
- bool use_float = config.hdr_supported;
+ bool use_float = config.hdr_supported;
- GLenum internal_format = use_float ? GL_RGBA16F : GL_RGB10_A2;
- GLenum format = GL_RGBA;
- GLenum type = use_float ? GL_HALF_FLOAT : GL_UNSIGNED_INT_2_10_10_10_REV;
+ GLenum internal_format = use_float ? GL_RGBA16F : GL_RGB10_A2;
+ GLenum format = GL_RGBA;
+ GLenum type = use_float ? GL_HALF_FLOAT : GL_UNSIGNED_INT_2_10_10_10_REV;
- while (mm_level) {
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, internal_format, size, size * 2, array_level, 0, format, type, NULL);
- glTexImage2D(GL_TEXTURE_2D, lod, internal_format, size, size * 2, 0, format, type, NULL);
- lod++;
- mm_level--;
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- if (size > 1)
- size >>= 1;
- }
+ GLuint tmp_fb2;
+ GLuint tmp_tex;
+ {
+ //generate another one for rendering, as can't read and write from a single texarray it seems
+ glGenFramebuffers(1, &tmp_fb2);
+ glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb2);
+ glGenTextures(1, &tmp_tex);
+ glBindTexture(GL_TEXTURE_2D, tmp_tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size, size * 2, 0, format, type, NULL);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmp_tex, 0);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+#ifdef DEBUG_ENABLED
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
+#endif
+ }
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod - 1);
+ for (int j = 0; j < array_level; j++) {
- lod = 0;
- mm_level = mipmaps;
+ glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb2);
- size = p_radiance_size;
+ if (j == 0) {
- shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, true);
- shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_PANORAMA, true);
- shaders.cubemap_filter.bind();
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_PANORAMA, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DIRECT_WRITE, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_DUAL_PARABOLOID_ARRAY, false);
+ shaders.cubemap_filter.bind();
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(texture->target, texture->tex_id);
+ } else {
- while (mm_level) {
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_PANORAMA, false);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_DUAL_PARABOLOID_ARRAY, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DIRECT_WRITE, false);
+ shaders.cubemap_filter.bind();
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, sky->radiance);
+ shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::SOURCE_ARRAY_INDEX, j - 1); //read from previous to ensure better blur
+ }
+
+ for (int i = 0; i < 2; i++) {
+ glViewport(0, i * size, size, size);
+ glBindVertexArray(resources.quadie_array);
+
+ shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::Z_FLIP, i > 0);
+ shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS, j / float(array_level - 1));
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glBindVertexArray(0);
+ }
+
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, tmp_fb);
+ glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, sky->radiance, 0, j);
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, tmp_fb2);
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+ glBlitFramebuffer(0, 0, size, size * 2, 0, 0, size, size * 2, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ }
+
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_PANORAMA, false);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, false);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_DUAL_PARABOLOID_ARRAY, false);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DIRECT_WRITE, false);
+
+ //restore ranges
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, sky->radiance);
+
+ glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
+
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
+ glDeleteFramebuffers(1, &tmp_fb);
+ glDeleteFramebuffers(1, &tmp_fb2);
+ glDeleteTextures(1, &tmp_tex);
+
+ } else {
+ //regular single texture with mipmaps
+ glBindTexture(GL_TEXTURE_2D, sky->radiance);
+
+ GLuint tmp_fb;
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sky->radiance, lod);
+ glGenFramebuffers(1, &tmp_fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb);
+
+ int size = p_radiance_size;
+
+ int lod = 0;
+
+ int mipmaps = 6;
+
+ int mm_level = mipmaps;
+
+ bool use_float = config.hdr_supported;
+
+ GLenum internal_format = use_float ? GL_RGBA16F : GL_RGB10_A2;
+ 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;
+ }
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod - 1);
+
+ lod = 0;
+ mm_level = mipmaps;
+
+ size = p_radiance_size;
+
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_PANORAMA, true);
+ shaders.cubemap_filter.bind();
+
+ while (mm_level) {
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sky->radiance, lod);
#ifdef DEBUG_ENABLED
- GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- ERR_CONTINUE(status != GL_FRAMEBUFFER_COMPLETE);
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ ERR_CONTINUE(status != GL_FRAMEBUFFER_COMPLETE);
#endif
- for (int i = 0; i < 2; i++) {
- glViewport(0, i * size, size, size);
- glBindVertexArray(resources.quadie_array);
+ for (int i = 0; i < 2; i++) {
+ glViewport(0, i * size, size, size);
+ glBindVertexArray(resources.quadie_array);
- shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::Z_FLIP, i > 0);
- shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS, lod / float(mipmaps - 1));
+ shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::Z_FLIP, i > 0);
+ shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS, lod / float(mipmaps - 1));
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glBindVertexArray(0);
- }
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glBindVertexArray(0);
+ }
- if (size > 1)
- size >>= 1;
- lod++;
- mm_level--;
- }
- shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, false);
- shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_PANORAMA, false);
+ if (size > 1)
+ size >>= 1;
+ lod++;
+ mm_level--;
+ }
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, false);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_SOURCE_PANORAMA, false);
- //restore ranges
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod - 1);
+ //restore ranges
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod - 1);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
- glDeleteFramebuffers(1, &tmp_fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
+ glDeleteFramebuffers(1, &tmp_fb);
+ }
}
/* SHADER API */
@@ -6857,6 +6970,7 @@ void RasterizerStorageGLES3::initialize() {
frame.current_rt = NULL;
config.keep_original_textures = false;
config.generate_wireframes = false;
+ config.use_texture_array_environment = GLOBAL_DEF("rendering/quality/texture_array_environments", true);
}
void RasterizerStorageGLES3::finalize() {
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 3f8055d613..d317d27656 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -86,6 +86,8 @@ public:
bool generate_wireframes;
+ bool use_texture_array_environment;
+
Set<String> extensions;
bool keep_original_textures;
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index 2aec6380f5..88a97a04aa 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -19,9 +19,16 @@ void main() {
precision highp float;
precision highp int;
-#ifdef USE_PANORAMA
+#ifdef USE_SOURCE_PANORAMA
uniform sampler2D source_panorama; //texunit:0
-#else
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+uniform sampler2DArray source_dual_paraboloid_array; //texunit:0
+uniform int source_array_index;
+#endif
+
+#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
uniform samplerCube source_cube; //texunit:0
#endif
@@ -169,7 +176,7 @@ vec2 Hammersley(uint i, uint N) {
uniform bool z_flip;
-#ifdef USE_PANORAMA
+#ifdef USE_SOURCE_PANORAMA
vec4 texturePanorama(vec3 normal,sampler2D pano ) {
@@ -189,6 +196,21 @@ vec4 texturePanorama(vec3 normal,sampler2D pano ) {
#endif
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+
+
+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);
+ norm.y+=max(0.0,sign(-norm.z))*0.5;
+ return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index) ), 0.0);
+
+}
+
+#endif
+
void main() {
#ifdef USE_DUAL_PARABOLOID
@@ -198,7 +220,7 @@ void main() {
N = normalize(N);
if (!z_flip) {
- N.y=-N.y; //y is flipped to improve blending between both sides
+ //N.y=-N.y; //y is flipped to improve blending between both sides
} else {
N.z=-N.z;
}
@@ -212,13 +234,24 @@ void main() {
#ifdef USE_DIRECT_WRITE
-#ifdef USE_PANORAMA
+#ifdef USE_SOURCE_PANORAMA
frag_color=vec4(texturePanorama(N,source_panorama).rgb,1.0);
-#else
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+
+ frag_color=vec4(textureDualParaboloidArray(N).rgb,1.0);
+#endif
+
+#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
+
frag_color=vec4(texture(N,source_cube).rgb,1.0);
#endif
+
+
+
#else
vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);
@@ -233,9 +266,16 @@ void main() {
float ndotl = clamp(dot(N, L),0.0,1.0);
if (ndotl>0.0) {
-#ifdef USE_PANORAMA
+#ifdef USE_SOURCE_PANORAMA
sum.rgb += texturePanorama(H,source_panorama).rgb *ndotl;
-#else
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+
+ sum.rgb += textureDualParaboloidArray(H).rgb *ndotl;
+#endif
+
+#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
sum.rgb += textureLod(source_cube, H, 0.0).rgb *ndotl;
#endif
sum.a += ndotl;
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 40a295bc83..f94ca6fcba 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -405,7 +405,6 @@ uniform bool no_ambient_light;
#ifdef USE_RADIANCE_MAP
-uniform sampler2D radiance_map; //texunit:-2
layout(std140) uniform Radiance { //ubo:2
@@ -415,6 +414,49 @@ layout(std140) uniform Radiance { //ubo:2
};
+#define RADIANCE_MAX_LOD 5.0
+
+#ifdef USE_RADIANCE_MAP_ARRAY
+
+uniform sampler2DArray radiance_map; //texunit:-2
+
+vec3 textureDualParaboloid(sampler2DArray 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);
+
+ // 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;
+ norm.y+=max(0.0,sign(norm.z))*0.5;
+
+ // thanks to OpenGL spec using floor(layer + 0.5) for texture arrays,
+ // it's easy to have precision errors using fract() to interpolate layers
+ // as such, using fixed point to ensure it works.
+
+ float index = p_roughness * RADIANCE_MAX_LOD;
+ int indexi = int(index * 256.0);
+ vec3 base = textureGrad(p_tex, vec3(norm.xy, float(indexi/256)),dFdx(normg),dFdy(normg)).xyz;
+ vec3 next = textureGrad(p_tex, vec3(norm.xy, float(indexi/256+1)),dFdx(normg),dFdy(normg)).xyz;
+ return mix(base,next,float(indexi%256)/256.0);
+}
+
+#else
+
+uniform sampler2D radiance_map; //texunit:-2
+
+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);
+ norm.y+=max(0.0,sign(norm.z))*0.5;
+ return textureLod(p_tex, norm.xy, p_roughness * RADIANCE_MAX_LOD).xyz;
+}
+
+#endif
+
#endif
/* Material Uniforms */
@@ -1231,23 +1273,7 @@ void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_sp
#endif
-vec3 textureDualParabolod(sampler2D p_tex, vec3 p_vec,float p_lod) {
-
- vec3 norm = normalize(p_vec);
- float y_ofs=0.0;
- if (norm.z>=0.0) {
-
- norm.z+=1.0;
- y_ofs+=0.5;
- } else {
- norm.z=1.0 - norm.z;
- norm.y=-norm.y;
- }
- norm.xy/=norm.z;
- norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25+y_ofs);
- return textureLod(p_tex, norm.xy, p_lod).xyz;
-}
void main() {
@@ -1387,15 +1413,11 @@ FRAGMENT_SHADER_CODE
} else {
{
-
-#define RADIANCE_MAX_LOD 5.0
- float lod = roughness * RADIANCE_MAX_LOD;
-
{ //read radiance from dual paraboloid
vec3 ref_vec = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n);
ref_vec=normalize((radiance_inverse_xform * vec4(ref_vec,0.0)).xyz);
- vec3 radiance = textureDualParabolod(radiance_map,ref_vec,lod) * bg_energy;
+ vec3 radiance = textureDualParaboloid(radiance_map,ref_vec,roughness) * bg_energy;
specular_light = radiance;
}
@@ -1407,7 +1429,7 @@ FRAGMENT_SHADER_CODE
{
vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz);
- vec3 env_ambient=textureDualParabolod(radiance_map,ambient_dir,RADIANCE_MAX_LOD) * bg_energy;
+ vec3 env_ambient=textureDualParaboloid(radiance_map,ambient_dir,1.0) * bg_energy;
ambient_light=mix(ambient_light_color.rgb,env_ambient,radiance_ambient_contribution);
//ambient_light=vec3(0.0,0.0,0.0);
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 563de78415..6f613981b8 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -382,10 +382,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
press_a_key->add_child(l);
press_a_key->connect("gui_input", this, "_wait_for_key");
press_a_key->connect("confirmed", this, "_press_a_key_confirm");
- //Button *load = memnew( Button );
-
- //load->set_text("Load..");
- //hbc->add_child(load);
//get_ok()->set_text("Apply");
set_hide_on_ok(true);
diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp
index 14886f4b7a..62e1a95209 100644
--- a/scene/3d/mesh_instance.cpp
+++ b/scene/3d/mesh_instance.cpp
@@ -340,12 +340,13 @@ void MeshInstance::create_debug_tagents() {
mi->set_mesh(am);
mi->set_name("DebugTangents");
add_child(mi);
- if (get_parent()) {
- if (get_parent() == get_tree()->get_edited_scene_root())
- mi->set_owner(get_parent());
- else
- mi->set_owner(get_parent()->get_owner());
- }
+#ifdef TOOLS_ENABLED
+
+ if (this == get_tree()->get_edited_scene_root())
+ mi->set_owner(this);
+ else
+ mi->set_owner(get_owner());
+#endif
}
}
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 24e3977de8..b9dc428c2d 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -818,7 +818,7 @@ float Environment::get_fog_height_curve() const {
void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background);
- ClassDB::bind_method(D_METHOD("set_sky", "sky:CubeMap"), &Environment::set_sky);
+ ClassDB::bind_method(D_METHOD("set_sky", "sky:Sky"), &Environment::set_sky);
ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale);
ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color);
ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy);