Commit graph

548 commits

Author SHA1 Message Date
Rémi Verschelde 1148a33b20 GLES2: Define LIGHT Spatial shader builtin
Fixes #25421.
2019-01-28 17:27:20 +01:00
Juan Linietsky 2e5ede7a4e Properly discard fragments during depth prepass opaque pass, fixes #23321 2019-01-27 20:20:07 -03:00
Juan Linietsky 0c60d4c682 Properly get proxy texture size for canvas light, fixes #17067 2019-01-27 16:57:05 -03:00
Juan Linietsky 953cd03ea6 Use transparent framebuffer only when set to transparent, closes #21827 2019-01-27 15:47:17 -03:00
muiroc d1e399a971 fix s3tc support detection for webgl 2019-01-26 22:25:03 +01:00
Juan Linietsky 18c3ed245a Further fixes to avoid memory corruption, closes #25336 2019-01-26 10:47:04 -03:00
Juan Linietsky 973b68f396 Properly dispose of custom shaders, closes #19300 2019-01-25 19:28:27 -03:00
Juan Linietsky 5b5db08a51 Fix depth prepass in GLES2, closes #23321 2019-01-25 09:41:25 -03:00
Juan Linietsky b32298a660 Ensure WebGL uses highp by default, and fix some wrong mediump usages. Fixes #22962. 2019-01-24 18:58:42 -03:00
Juan Linietsky fb7c526ec4 Fix crash with cube shadows in gles2, closes #22635 2019-01-24 17:51:49 -03:00
Juan Linietsky 7fa41f17a6 Makes screen texture work in GLES2 (2D for now), fixes #23604 2019-01-24 17:00:33 -03:00
Juan Linietsky 2d57ec2460 Fix problem with texture2Dlod, closes #25263 2019-01-23 17:06:37 -03:00
Rémi Verschelde 2a45b298c1 Remove unused method in RasterizerStorageGLES2
Added in 4f4e46edd5 but not used in the end.
2019-01-23 10:31:05 +01:00
Juan Linietsky 4f4e46edd5 Implement unpacking for compressed vertex formats on GLES2 when not supported, fixes #22957 2019-01-22 21:57:09 -03:00
Juan Linietsky 4333a68ca0 Do not use shadow cubemaps if depth write is not supported to avoid errors, closes #25219 2019-01-22 11:07:26 -03:00
Juan Linietsky 46af4b0a4b Changes to GLES2 renderer to not use cube shadows if not available, fixes #25132 2019-01-22 10:05:23 -03:00
santouits 3c1cd2873b WebGL1 some changes
glRenderBufferStorage doesn't accept the _DEPTH_COMPONENT24_OES so I changed it to GL_DEPTH_COMPONENT16
https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/renderbufferStorage
https://www.khronos.org/registry/webgl/extensions/rejected/OES_depth24/

Enabled ext_shader_texture_lod extension. I guess it does the same like the GL_ARB_shader_texture_lod extension, but in WebGL1
https://www.khronos.org/registry/webgl/extensions/EXT_shader_texture_lod/

And last WebGL1 doesn't allow indexes not constant, so I changed it into a loop reading this:
https://stackoverflow.com/questions/19529690/index-expression-must-be-constant-webgl-glsl-error
2019-01-22 13:40:28 +02:00
santouits e7e9a7cc6c webgl1 doesn't like backslashes in #define
According to
https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf
, backslashes aren't necessary supported as line continuation characters
in preprocessor directives
2019-01-21 21:41:39 +02:00
Stanislav dc7d9f8868 Check for null pointer in RasterizerSceneGLES2::render_shadow
Fixes #25131
2019-01-19 16:48:43 +03:00
Juan Linietsky 682fdf0f74 Use 16 bit indices on phones that dont support 32, fixes #19797 2019-01-18 17:30:12 -03:00
RedMser a285a1cfdf Fix shader compile error line numbers starting at 0. 2019-01-17 19:25:08 +01:00
Juan Linietsky 7478f468b2 Fixes to 2D lights, closes #24750 2019-01-17 10:40:36 -03:00
Juan Linietsky ffcb5cd18c Ensure texture hints are obeyed, fixes #24875 2019-01-16 00:37:00 -03:00
Rémi Verschelde 72f501de13 GLES2: Fix typo in project setting
It used a different name than the equivalent GLES3 parameter.
2019-01-15 13:26:54 +01:00
Juan Linietsky ee3eadf345 Implement black margins in GLES2, which was missing, fixes #24556 2019-01-14 19:00:36 -03:00
Rémi Verschelde 02ffc59270 GLES2: Make Nvidia flicker workaround opt-in
It has a big impact on 2D and text rendering performance (cf. #24466)
so the solution seems worse than the bug it aims to work around.

It's now opt-in via "rendering/quality/2d/gles2_use_nvidia_rect_flicker_workaround"
for those who need it and have a simple enough game for the performance
drop not to be an issue.

Fixes #24466.
2019-01-14 19:02:07 +01:00
Juan Linietsky b3dc02b5df Was not properly re-setting light uniforms, fixes #24976 2019-01-14 12:04:26 -03:00
Juan Linietsky 6d8083ea65 Do not use the workaround for desktop nvidia on mobile and html5. 2019-01-14 11:24:00 -03:00
Rémi Verschelde 1185f4c4ac GLES2: Clarify why we exclude debug code on iOS
Supersedes and closes #24873.
2019-01-11 20:04:13 +01:00
Juan Linietsky a3a537c2cf Fix background color rendering on GLES2 (linear should not be used) 2019-01-07 10:52:24 -03:00
Daeil Kim ecf520b70e Change blend equation for canvasitems 2019-01-06 00:57:52 +09:00
Rémi Verschelde 1504c96112
Merge pull request #24539 from BastiaanOlij/override_gl_position
Override GL_position
2019-01-04 15:40:05 +01:00
Marcin Zawiejski 4e73274837
Fix negative size rectangle drawing
Fixes rectangle being drawn as it was a non-negative size in case it actually is. This can be observed e.g. when drawing a negative size selection rectangle (i.e. press mouse button and move cursor up and left).
2019-01-02 14:47:28 +01:00
Rémi Verschelde c7c87a0624
Merge pull request #24687 from DavidSichma/draw-rect-rot
fix draw_rect rotation
2019-01-01 19:01:18 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde d1f3b622f0 Fix missing/malformed license headers 2019-01-01 12:46:36 +01:00
David Sichma 9ba6849cf4 fix draw_rect rotation 2018-12-31 20:56:10 +01:00
Rémi Verschelde 6a07d7f83f
Merge pull request #24661 from humblers/fix-unshaded-gles2
Fix unshaded light mode on GLES2
2018-12-30 13:48:01 +01:00
Rémi Verschelde 6c67ca3f5b
Merge pull request #24653 from avril-gh/fixes-syntax-error-in-scene-glsl
fixes glsl syntax error
2018-12-30 13:07:12 +01:00
Daeil Kim 8c99b6fb2f Change unshaded logic to match with GLES3 2018-12-30 02:02:37 +09:00
Avril 971c05dc5e fixes glsl syntax error 2018-12-29 15:37:50 +01:00
Bastiaan Olij 9f266cf7e5 Override GL_position 2018-12-29 23:56:50 +11:00
Bastiaan Olij 9055386de9 Fix texture type not being initialised 2018-12-29 23:44:28 +11:00
Juan Linietsky a366d45856 -Implented 2D Mesh support for GLES2
-Implemented 2D Skeleton deform for GLES2
-Implement Multimesh support for GLES2, closes #20524, closes #21839
2018-12-27 20:41:04 -03:00
Rémi Verschelde 57416bfbce GLES2: Define 'lowp' for OpenGL 2.1
Precision qualifiers are only used on OpenGL ES 2.0 and 3.0,
and while OpenGL 3.3 defines them for compatibility (but without
practical effect), they're missing from OpenGL 2.1, so we define
them to prevent compilation errors.

Fixes #24521.
2018-12-21 15:14:58 +01:00
Juan Linietsky 7b1cbe9874 Reverse RGBA shadow test on GLES2 2018-12-21 10:02:43 -03:00
Juan Linietsky 7535c5a56a Further GLES2 fixes 2018-12-21 10:01:16 -03:00
Juan Linietsky 9ea27ec032 Fixes to framebuffer formats for GLES2, closes #24518 2018-12-21 09:50:57 -03:00
Juan Linietsky f3cb236f9d Remove usage of VAO, which does not work in GLES2 2018-12-20 17:28:01 -03:00
Juan Linietsky 3bdd1ff387 Support lights and shadows in GLES2, fixes #21853 2018-12-20 10:10:30 -03:00
Rémi Verschelde b3f6e54cc6 Style: Fix formatting in GLES2 shaders 2018-12-20 10:33:48 +01:00
Gitea 9f48094982 fix gles2 spotlight problem 2018-12-20 15:01:59 +08:00
Juan Linietsky aa819a8538 Properly support light shaders in GLES2, fixes #21651 2018-12-19 10:25:45 -03:00
Juan Linietsky bec76cfa19 Change how rects are drawn (and also will help batching eventually), to workaround problem in #9913 2018-12-18 17:50:35 -03:00
Juan Linietsky 89abfd40ed Reduce considerably the cubemap sizes on sky, to better match GLES3, fixes #21551 2018-12-18 13:01:46 -03:00
Juan Linietsky 85d44dd7b6 Actually respect the low quality cubemap filter on mobile, should fix crashes on mobile for #21551 but not sure on intel. 2018-12-18 12:52:50 -03:00
Rémi Verschelde 20379119c3
Merge pull request #24366 from BastiaanOlij/adjust_sky_orientation
Adding option to re-orient our sky
2018-12-16 22:56:43 +01:00
Bastiaan Olij 205bcff279 Fix highp issue in lens shader on gles2 2018-12-16 08:47:47 +11:00
Bastiaan Olij f3dd3c0830 Adding option to re-orient our sky 2018-12-15 19:41:34 +11:00
Rémi Verschelde c8a5400654
Merge pull request #24241 from Rubonnek/move-to-initializer-list
Moved member variables to initializer list
2018-12-12 09:25:34 +01:00
Wilson E. Alvarez 08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Rémi Verschelde 37e198c320
Merge pull request #23483 from clayjohn/fragment_camera_view
Make VIEW vector available in fragment shader
2018-12-11 20:44:41 +01:00
clayjohn 2042d6214e make VIEW vector available in fragment 2018-12-11 09:44:38 -08:00
muiroc 2827ee77d0 gles2 implemented VIEWPORT_SIZE builtin for spatial shader 2018-12-11 18:11:07 +01:00
Rémi Verschelde e2caaf1b6d
Merge pull request #23899 from BastiaanOlij/fix_particle_active
Remapped ACTIVE to shader_active, now works
2018-12-02 21:26:12 +01:00
Rémi Verschelde f8bb7e0673
Merge pull request #24089 from clayjohn/gles2_camera_matrix_bug
Fixed gles2 camera_matrix bug
2018-12-02 20:48:08 +01:00
Bastiaan Olij 0b4b477674 Remapped ACTIVE to shader_active, now works 2018-12-01 21:10:04 +11:00
clayjohn fd7607bf82 fixed gles2 camera_matrix bug 2018-11-30 10:20:16 -08:00
Rémi Verschelde a741f83811
Merge pull request #23945 from DavidSichma/gles2artifact
Fixed black artifacts on SpatialMaterial [GLES2]
2018-11-28 16:21:59 +01:00
Rémi Verschelde c7dd58a4d5
Merge pull request #23981 from khairul169/fix_gles2_clearcolor
GLES2: Set clear color based on env background mode when rendering scene and fix viewport transparent bg flag
2018-11-28 15:10:28 +01:00
Aaron Franke cb01268562 Fix many errors found by PVS-Studio
Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.
2018-11-28 05:03:24 -05:00
Rémi Verschelde dd06f6ee70 Fix style issues and signature mismatch 2018-11-28 10:21:07 +01:00
Juan Linietsky af8d941c55 Added luminance capping to avoid glitches on small dots. closes #17996 2018-11-28 01:22:20 -03:00
khairul169 797bcfd44d GLES2: clear color on scene render 2018-11-27 01:47:34 +07:00
David Sichma 1a7d1d88f8 Fixed black artifacts on SpatialMaterial [GLES2] 2018-11-24 16:51:32 +01:00
Rémi Verschelde c5ebf38490 Prevent GLAPIENTRY redefine in rasterizer, now included in glad.h
We otherwise had conflicting defines since 1a41daf3.
2018-11-23 21:19:59 +01:00
Juan Linietsky 78eae047c6 Fixed how floats are printed to the GLSL shader, closes #19803 2018-11-19 23:41:18 -03:00
Juan Linietsky d304228003 Do not draw particles if they are not processing at all, fixes #19507 2018-11-19 20:34:29 -03:00
Rémi Verschelde 60ee61c7ff
Merge pull request #23742 from JFonS/fix_23698
Use hint_color when getting shader default params
2018-11-18 12:05:02 +01:00
Wilson E. Alvarez f8e0051420 Removed unnecessary assignments 2018-11-17 20:40:55 -05:00
Juan Linietsky e77afb8507 Ensure environment radiance is not used on refprobe interiors, fixes #17868 2018-11-16 11:46:21 -03:00
Juan Linietsky bb9127a78b Removed unnecesary normal multiplication (only culling was really needed), fixes #17776 2018-11-16 10:52:31 -03:00
JFonS fb92c7b0fa Use hint_color when getting shader default params 2018-11-16 12:20:23 +01:00
Juan Linietsky 4d88721e62 Do not error on empty shader, just treat it as invalid by default. Fixes #15998. 2018-11-14 10:58:16 -03:00
Juan Linietsky 55f5f4757e
Merge pull request #23248 from dlasalle/fog
Add parameters for fog end depth and use alpha as density.
2018-11-14 10:24:55 -03:00
Juan Linietsky 984063cf0b Cleaned up and fixed the base_changed function in rasterizers, also fixes #15617 2018-11-14 09:32:39 -03:00
Dominique LaSalle 6eae6247e4 Add parameter for fog max depth and use alpha as density. 2018-11-13 17:19:11 -08:00
Rémi Verschelde 8849d3b47d
Merge pull request #22639 from tagcup/opt
Avoid some unnecessary calculations in scene.glsl.
2018-11-12 21:22:57 +01:00
Rémi Verschelde 3bc7dfc856
Merge pull request #23254 from ibrahn/gles2-var-init-cleanup
Cleaning up some uninitialised variables in GLES2 stuff.
2018-11-12 20:47:19 +01:00
Juan Linietsky 3e128a6d8a Was missing calling _mkid() in shader_gles2.cpp, regarding fix for #12880 2018-11-10 10:52:24 -03:00
Juan Linietsky f00b522705 Avoid double underscore from breaking glsl compiler, fixes #12880 2018-11-10 10:48:18 -03:00
Rémi Verschelde 17b776e549
Merge pull request #23502 from Rubonnek/simplified-logic
Simplified boolean logic in GLES2/3 rasterizers
2018-11-05 08:31:14 +01:00
JFonS 85ce4a67ed Remove animation loop from ParticlesMaterial + improvements to CPUParticles2D
Remove animation loop from ParticlesMaterial and move it to
SpatialMaterial for 3D particles and Particles2D for the 2D case.

Added animation to CPUParticles2D as well as the "Convert to
CPUParticles2D" to the PAarticles2D menu.
2018-11-04 15:58:12 +01:00
Wilson E. Alvarez e4884cfc75
Simplified boolean logic in GLES2/3 rasterizers 2018-11-04 09:14:50 +00:00
Ibrahn Sahir 352b3c9c93 Cleaning up some uninitialised variables in GLES2 stuff.
Initialise keep_original_textures and use_fast_texture_filter in storage
config. Removed any other variables from storage config that were both unused
and uninitialised to avoid future confusion (if they're needed it's
easier to spot an uninitialised variable problem in a PR that adds the
variable again rather than just uses it).

Copied storage Texture struct constructor from GLES3 implementation
(except where variables were already initialised with different values).
Gives us sensible tested defaults for previously uninitialised vars.

Added assignments for state.current_main_tex based on same in GLES3.
2018-11-02 14:09:32 +00:00
Juan Linietsky 9c195b57a0
Merge pull request #23125 from JFonS/fix_texture_get_data
Implement rasterizer texture_get_data on OpenGL ES
2018-11-01 12:56:31 -03:00
JFonS edcccaf8c1 Implement rasterizer texture_get_data on OpenGL ES 2018-11-01 11:30:49 +01:00
Pedro J. Estébanez 11815a23dc Fix GLES2 automatic texture lookup in canvas
After this change the color will only be fetched if the shader code doesn't use it explicitly, to match the GLES3 behaviour.

Fixes #23179.
2018-10-28 02:37:34 +01:00
Rémi Verschelde b9eb3a048e GLES2: Fix shadows shader error for SpotLights
Fixes #23268.
2018-10-25 12:14:02 +02:00
Rémi Verschelde 1169196f04
Merge pull request #22779 from Superwaitsum/LimitSettings
Limit several project settings
2018-10-25 11:38:06 +02:00
Superwaitsum e5041ad0f5 Add some limits on the Editor Settings 2018-10-24 19:46:33 -05:00
Rémi Verschelde cfa8ef1f77
Merge pull request #23186 from BastiaanOlij/fix_gles2_stereo_sky
Fixed stereoscopic (VR) sky in GLES2
2018-10-24 15:16:36 +02:00
Rémi Verschelde 053da2b487 GLES2: Fix typo in tangent calculation
Thanks @tagcup for the find.

Fixes #23234.
2018-10-24 11:10:16 +02:00
Bastiaan Olij ef06079ad1 Fixed stereoscopic (VR) sky in GLES2 2018-10-21 11:36:01 +11:00
Dualtagh Murray b902a2f2a7 Fixing warnings generated by MSVC
Fixes #22684.
2018-10-19 11:45:24 +02:00
M. Huri 55c8fda884 Removed duplication of include(s):
- "collision_solver_sat.h".
- "shaders/copy.glsl.gen.h"
2018-10-13 20:25:34 +07:00
Ferenc Arn 35ea827e83 Avoid some unnecessary calculations in scene.glsl. 2018-10-11 10:34:37 -04:00
Leon Krause 7a4d5ddb4d Format GLES2 scene.glsl 2018-10-06 02:17:24 +02:00
Leon Krause e869d53e6d Fix GLES2 uniform precision 2018-10-06 02:15:04 +02:00
Rémi Verschelde 97b9697ea2 Fix some OSX and iOS Clang warnings
Fixes the following XCode 9.4.1 warnings:
```
core/os/memory.cpp:175:13: warning: unused variable 's' [-Wunused-variable]
drivers/coremidi/core_midi.cpp:68:14: warning: comparison between NULL and non-pointer ('MIDIEndpointRef' (aka 'unsigned int') and NULL) [-Wnull-arithmetic]
drivers/gles2/rasterizer_gles2.cpp:77:24: warning: unused function '_gl_debug_print' [-Wunused-function,34]
drivers/unix/thread_posix.cpp:106:12: warning: unused variable 'running_thread' [-Wunused-variable,34]
modules/gdnative/nativescript/nativescript.h:371:16: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
platform/iphone/gl_view.mm:56:14: warning: unused variable 'video_previous_volume' [-Wunused-variable,34]
platform/iphone/gl_view.mm:251:12: warning: unused function 'get_first_id' [-Wunused-function,34]
platform/iphone/main.m:45:15: warning: unused variable 'app' [-Wunused-variable,34]
platform/osx/os_osx.mm:79:15: warning: unused function 'convertRectToBacking' [-Wunused-function]
```
2018-10-04 11:50:16 +02:00
Jean-François Michaud 700d5d26c9 Fix #22591: shader failed to compile when shadow enabled because of incompatible assignment of vec3 to a vec4. 2018-10-03 13:42:17 -04:00
Juan Linietsky 286b70839e vertex lit optimization for fog. 2018-10-02 19:08:33 -03:00
Juan Linietsky 11f088279d Implemented FOG support in GLES2. 2018-10-02 18:53:16 -03:00
Rémi Verschelde 45842c0ea9
Merge pull request #22627 from akien-mga/gles2-pixel-snap
GLES2: Implement pixel snap 2D option
2018-10-02 19:09:34 +02:00
Ferenc Arn 658c2b6eee Bring accidentally commented out lines back.
Oversight by me in #22483. GLES2 doesn't seem to be supporting anisotropy at the moment anyway ---in case it gets revived.
2018-10-02 12:44:31 -04:00
Rémi Verschelde 63e1c6dce3 Disable GLES2 debugging on iOS, fixes build
Could be readded by someone who knows how to access an API
similar to EGL on iOS.
2018-10-02 16:34:31 +02:00
Rémi Verschelde ac2a4771d5 GLES2: Implement pixel snap 2D option 2018-10-02 15:53:24 +02:00
Rémi Verschelde 4d693fc3f0
Merge pull request #22455 from Calinou/reverse-cull-face-update-light
Update lights when their reverse cull face mode is toggled
2018-10-02 15:23:24 +02:00
Rémi Verschelde 9c93a401b9
Merge pull request #22483 from tagcup/fresnel
Restore the Fresnel term in the BRDF.
2018-10-02 15:18:31 +02:00
Rémi Verschelde 6e619ccb24
Merge pull request #22562 from muiroc/gles2_canvas_skip_transform
Uses skip_vertex_transform in GLES2 canvas shader
2018-10-02 15:12:50 +02:00
Rémi Verschelde 123931f7eb
Merge pull request #22574 from BastiaanOlij/mobile_vr_gles2
Moving lens distortion shader into drivers and adding GLES2 support
2018-10-02 15:08:59 +02:00
Juan Linietsky bad991ea83 Many more fixes for GLES2 mobile export. Also added ability to turn on OpenGL debugging on Android export. 2018-10-02 10:00:15 -03:00
Bastiaan Olij a6df366b23 Moving lens distortion shader into drivers and adding GLES2 support 2018-10-02 17:14:43 +10:00
Rémi Verschelde 85bb1c445c Style: Run clang-format on shaders again 2018-10-02 08:34:08 +02:00
Rémi Verschelde 6bfb7944d9 SCons: Remove avoidable defines from main env's CPPPATH
Also finally move freetype to its own env and disable warnings for it.
Still needs some work to fix the awkward situation of the freetype and
svg modules used in scene/ and editor/ respectively.
2018-10-01 11:59:22 +02:00
Juan Linietsky c24277a520 -Many GLES2 optimizations
-Android export fixes (use ETC if GLES2 backend in use)
-revert to thekla atlas because xatlas is not working well
2018-09-30 23:11:24 -03:00
tagcup 9f4e9fcb81 Optimized GGX G function for GLES2.
Also changed the mapping of anisotropy to match the common definition.
2018-09-30 16:33:50 -04:00
Ferenc Arn e94f6aacee Restore the Fresnel term in the BRDF.
Was uncommented in 65fd37c, mostly likely by mistake since its important.

Also made a few corrections of specular -> specular_blob_intensity (gles2).
2018-09-30 12:17:48 -04:00
muiroc 9a5d867210 Uses skip_transform in gles2 canvas shader 2018-09-30 18:10:58 +02:00
Rémi Verschelde d3f01a2281 Style: Run clang-format on recent shader changes 2018-09-30 16:31:46 +02:00
Juan Linietsky ce8294986d Some more GLES2 tuning.. 2018-09-29 23:47:24 -03:00
Juan Linietsky 3333166b07 Many more GLES2 fixes 2018-09-29 19:17:52 -03:00
Juan Linietsky 4115e6d179 This fixes a bug in refprobe blending, but I have no idea when I fixed it. It just started working all of sudden.. 2018-09-29 17:03:35 -03:00
Juan Linietsky 0de8309b2c Many fixes to GLES2 renderer, fixed compilation issues in GLES3 shaders. 2018-09-29 13:49:34 -03:00
Juan Linietsky c83742ba86 -Lightmap and lightmap capture support for GLES2
-Added hint to not show some properties when running on low end gfx
2018-09-28 20:33:18 -03:00
Juan Linietsky f2ed26d71e Reflection probe support in GLES2 back-end. 2018-09-28 16:42:47 -03:00
Rémi Verschelde 3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Rémi Verschelde 7b081a7fc8 Fix warnings about unhandled enum value in switch [-Wswitch]
Fixes GCC 5 warnings of the form:

core/io/http_client.cpp:288:9: warning: enumeration value 'STATUS_SSL_HANDSHAKE_ERROR' not handled in switch [-Wswitch]
core/io/marshalls.cpp:806:9: warning: enumeration value 'AABB' not handled in switch [-Wswitch]

Those can be trivial cases where adding a default fallback is the solution,
or more complex issues/hidden bugs where missed values are actually meant
to be handled.
2018-09-27 18:34:30 +02:00
Rémi Verschelde cdc411fd54 Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more
Fixes the following GCC 5 warnings:
```
core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress]
servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress]

drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith]

modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr]

editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive
modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file

editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed
modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed
scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed
scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed
```
2018-09-27 16:33:52 +02:00
Rémi Verschelde d95bbb8922 Fix warnings about set but unused variables [-Wunused-but-set-variable]
Fixes the following GCC 5 warnings:
```
drivers/gles2/rasterizer_canvas_gles2.cpp:814:8: warning: variable 'rt_size' set but not used [-Wunused-but-set-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:2270:11: warning: variable 'vp_height' set but not used [-Wunused-but-set-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:2673:22: warning: variable 'e' set but not used [-Wunused-but-set-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:715:7: warning: variable 'no_cull' set but not used [-Wunused-but-set-variable]
drivers/gles2/shader_gles2.cpp:693:14: warning: variable 'cc' set but not used [-Wunused-but-set-variable]
drivers/gles3/rasterizer_canvas_gles3.cpp:1226:8: warning: variable 'rt_size' set but not used [-Wunused-but-set-variable]
drivers/gles3/rasterizer_scene_gles3.cpp:3039:10: warning: variable 'contrib' set but not used [-Wunused-but-set-variable]
drivers/gles3/rasterizer_scene_gles3.cpp:4504:32: warning: variable 'vp_height' set but not used [-Wunused-but-set-variable]
editor/editor_inspector.cpp:272:9: warning: variable 'guide_color' set but not used [-Wunused-but-set-variable]
editor/editor_themes.cpp:1067:14: warning: variable 'alpha3' set but not used [-Wunused-but-set-variable]
editor/editor_themes.cpp:263:8: warning: variable 'script_bg_color' set but not used [-Wunused-but-set-variable]
editor/plugins/collision_shape_2d_editor_plugin.cpp:326:11: warning: variable 'cpoint' set but not used [-Wunused-but-set-variable]
editor/plugins/mesh_editor_plugin.cpp:72:9: warning: variable 'size' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:471:12: warning: variable 'mpos' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:89:8: warning: variable 'basetype_color' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:90:8: warning: variable 'type_color' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:92:8: warning: variable 'string_color' set but not used [-Wunused-but-set-variable]
modules/visual_script/visual_script_editor.cpp:2521:7: warning: variable 'seq_connect' set but not used [-Wunused-but-set-variable]
platform/android/export/export.cpp:580:12: warning: variable 'styles_count' set but not used [-Wunused-but-set-variable]
platform/android/export/export.cpp:584:12: warning: variable 'styles_offset' set but not used [-Wunused-but-set-variable]
platform/osx/export/export.cpp:464:9: warning: variable 'zerr' set but not used [-Wunused-but-set-variable]
scene/2d/tile_map.cpp:260:10: warning: variable 'tcenter' set but not used [-Wunused-but-set-variable]
scene/3d/light.cpp:166:7: warning: variable 'editor_ok' set but not used [-Wunused-but-set-variable]
scene/3d/navigation.cpp:566:11: warning: variable 'closest_navmesh' set but not used [-Wunused-but-set-variable]
scene/gui/rich_text_label.cpp:869:8: warning: variable 'size' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:705:14: warning: variable 'xform' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:706:8: warning: variable 'ss' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:726:14: warning: variable 'xform' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:727:8: warning: variable 'ss' set but not used [-Wunused-but-set-variable]
scene/resources/material.cpp:430:7: warning: variable 'using_world' set but not used [-Wunused-but-set-variable]
servers/visual/shader_language.cpp:2026:7: warning: variable 'all_const' set but not used [-Wunused-but-set-variable]
servers/visual/visual_server_scene.cpp:1383:28: warning: variable 'z_max_cam' set but not used [-Wunused-but-set-variable]
```

Also fixes two [-Wunused-value] warnings:
```
scene/gui/text_edit.cpp:4405:20: warning: statement has no effect [-Wunused-value]
servers/visual/visual_server_scene.cpp:905:48: warning: value computed is not used [-Wunused-value]
```

Some of those are bugs and need further work, they are identified with
`// FIXME` comments.
2018-09-27 16:25:24 +02:00
Rémi Verschelde cda5b0bfe1 Fix warnings about unused variables [-Wunused-variable]
Fixes the following GCC 5 warnings:
```
drivers/gles2/rasterizer_scene_gles2.cpp:1139:15: warning: unused variable 'offset' [-Wunused-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:1205:39: warning: unused variable 'multi_mesh' [-Wunused-variable]
drivers/gles2/rasterizer_storage_gles2.cpp:359:7: warning: unused variable 'srgb' [-Wunused-variable]
drivers/gles2/shader_gles2.cpp:1016:45: warning: unused variable 'texture_hints' [-Wunused-variable]
editor/animation_track_editor.cpp:776:9: warning: unused variable 'keys_to' [-Wunused-variable]
editor/editor_inspector.cpp:273:7: warning: unused variable 'vs_height' [-Wunused-variable]
editor/editor_themes.cpp:202:10: warning: unused variable 'begin_time' [-Wunused-variable]
editor/editor_themes.cpp:239:10: warning: unused variable 'end_time' [-Wunused-variable]
editor/plugins/animation_blend_tree_editor_plugin.cpp:726:17: warning: unused variable 'an' [-Wunused-variable]
editor/plugins/script_text_editor.cpp:1278:8: warning: unused variable 'fold_state' [-Wunused-variable]
main/main.cpp:132:13: warning: 'use_vsync' defined but not used [-Wunused-variable]
modules/cvtt/image_compress_cvtt.cpp:231:8: warning: unused variable 'y_end' [-Wunused-variable]
modules/cvtt/image_compress_cvtt.cpp:311:6: warning: unused variable 'shift' [-Wunused-variable]
modules/gdscript/gdscript_editor.cpp:58:7: warning: unused variable 'th' [-Wunused-variable]
modules/gridmap/grid_map.cpp:1084:6: warning: unused variable 'ofs' [-Wunused-variable]
modules/theora/video_stream_theora.cpp:442:9: warning: unused variable 'tr' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2606:6: warning: unused variable 'count' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2829:6: warning: unused variable 'seq_count' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2844:24: warning: unused variable 'vnode_function' [-Wunused-variable]
modules/websocket/lws_peer.cpp:122:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:135:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:63:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:91:12: warning: unused variable 'peer_data' [-Wunused-variable]
platform/android/export/export.cpp:763:16: warning: unused variable 'node_size' [-Wunused-variable]
scene/gui/rich_text_label.cpp:850:10: warning: unused variable 'x_ofs' [-Wunused-variable]
scene/gui/text_edit.cpp:653:8: warning: unused variable 'tab_w' [-Wunused-variable]
scene/resources/bit_mask.cpp:186:6: warning: unused variable 'i' [-Wunused-variable]
scene/resources/mesh.cpp:549:20: warning: '_array_name' defined but not used [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:107:10: warning: unused variable 'v2' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:108:10: warning: unused variable 'v3' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:109:10: warning: unused variable 'v4' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:110:10: warning: unused variable 'v5' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:111:10: warning: unused variable 'v0n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:112:10: warning: unused variable 'v1n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:113:10: warning: unused variable 'v2n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:114:10: warning: unused variable 'v3n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:115:10: warning: unused variable 'v4n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:116:10: warning: unused variable 'v5n' [-Wunused-variable]
servers/visual/default_mouse_cursor.xpm:2:21: warning: 'default_mouse_cursor_xpm' defined but not used [-Wunused-variable]
```
2018-09-27 16:25:24 +02:00
Rémi Verschelde e5bbcb8bcf Fix warnings for comparison between signed and unsigned integers [-Wsign-compare]
Also turn off -Wsign-compare warnings in the future, we do not consider them important.

Fixes the following GCC 5 warnings:
```
core/node_path.cpp:279:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
core/oa_hash_map.h:169:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
core/oa_hash_map.h:314:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/gles2/shader_gles2.cpp:985:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/gles3/rasterizer_storage_gles3.cpp:1075:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/pulseaudio/audio_driver_pulseaudio.cpp:343:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
editor/editor_plugin.cpp:525:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
editor/editor_properties_array_dict.cpp:747:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
editor/plugins/spatial_editor_plugin.cpp:2078:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
editor/plugins/spatial_editor_plugin.cpp:4096:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
editor/plugins/sprite_editor_plugin.cpp💯20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/cvtt/image_compress_cvtt.cpp:122:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/cvtt/image_compress_cvtt.cpp:134:77: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/cvtt/image_compress_cvtt.cpp:339:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/etc/image_etc.cpp:222:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/gdnative/register_types.cpp:242:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/gdnative/register_types.cpp:258:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/opensimplex/simplex_noise.cpp:200:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/opensimplex/simplex_noise.cpp:222:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
modules/opensimplex/simplex_noise.cpp:246:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/android/export/export.cpp:1085:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/android/export/export.cpp:1489:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/android/export/export.cpp:1623:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/iphone/export/export.cpp:206:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/iphone/export/export.cpp:356:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/iphone/export/export.cpp:406:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
platform/iphone/export/export.cpp:493:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/3d/audio_stream_player_3d.cpp:420:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/resources/audio_stream_sample.cpp:565:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/resources/audio_stream_sample.cpp:571:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
servers/audio/audio_rb_resampler.cpp:156:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
```

The following warnings were not fixed, as they implied casting for no gain:
```
core/io/packet_peer.cpp:228:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
core/io/resource_format_binary.cpp:109:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/gles2/rasterizer_scene_gles2.cpp:144:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/unix/file_access_unix.cpp:249:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/3d/voxel_light_baker.cpp:889:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/3d/voxel_light_baker.cpp:1020:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/3d/voxel_light_baker.cpp:1154:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/3d/voxel_light_baker.cpp:2255:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
scene/resources/bit_mask.cpp:336:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
servers/audio/audio_stream.cpp:141:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
servers/audio/audio_stream.cpp:150:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
servers/audio/audio_stream.cpp:154:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
servers/audio_server.cpp:86:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
servers/audio_server.cpp:89:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
```
2018-09-27 16:25:23 +02:00
Hugo Locurcio b8bd5d0354
Update lights when their reverse cull face mode is toggled 2018-09-26 21:52:41 +02:00
Juan Linietsky 2005b0c820 Fix gizmo handles in GLES2 backend 2018-09-25 10:36:54 -03:00
Rémi Verschelde 60312915dc Fix build after 65fd37c1, using Math_PI
Also fix style in shaders.
2018-09-23 18:26:57 +02:00
Juan Linietsky 65fd37c149 -Rewrote GLES2 lighting and shadows and optimized state changes, did many optimizations, added vertex lighting.
-Did some fixes to GLES3 too
2018-09-23 12:14:50 -03:00
JFonS 3cedec5f75 Set uniform default values in inspector 2018-09-13 23:05:33 +02:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00