summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp10
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/compressed_translation.cpp23
-rw-r--r--core/io/file_access_encrypted.cpp1
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/file_access_pack.h1
-rw-r--r--core/io/resource_loader.cpp17
-rw-r--r--core/io/stream_peer_ssl.cpp2
-rw-r--r--core/math/expression.cpp5
-rw-r--r--core/math/geometry.cpp10
-rw-r--r--core/math/quat.cpp2
-rw-r--r--core/math/quick_hull.cpp9
-rw-r--r--core/message_queue.cpp19
-rw-r--r--core/oa_hash_map.h2
-rw-r--r--core/object.cpp13
-rw-r--r--core/object.h6
-rw-r--r--core/os/dir_access.cpp6
-rw-r--r--core/os/os.cpp12
-rw-r--r--core/os/os.h4
-rw-r--r--core/print_string.cpp7
-rw-r--r--core/print_string.h1
-rw-r--r--core/project_settings.cpp2
-rw-r--r--core/reference.cpp29
-rw-r--r--core/script_debugger_remote.cpp5
-rw-r--r--core/script_language.h2
-rw-r--r--core/string_db.cpp5
-rw-r--r--core/translation.cpp1
-rw-r--r--core/ustring.cpp2
-rw-r--r--doc/classes/Particles.xml2
-rw-r--r--doc/classes/Particles2D.xml2
-rw-r--r--doc/classes/ProjectSettings.xml3
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp4
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp73
-rw-r--r--drivers/coremidi/core_midi.cpp19
-rw-r--r--drivers/coremidi/core_midi.h2
-rw-r--r--drivers/dummy/rasterizer_dummy.h4
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp8
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp35
-rw-r--r--drivers/gles2/rasterizer_gles2.h3
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp19
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp3
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp3
-rw-r--r--drivers/gles2/shader_gles2.cpp1
-rw-r--r--drivers/gles2/shaders/blend_shape.glsl43
-rw-r--r--drivers/gles2/shaders/canvas.glsl29
-rw-r--r--drivers/gles2/shaders/canvas_shadow.glsl23
-rw-r--r--drivers/gles2/shaders/copy.glsl25
-rw-r--r--drivers/gles2/shaders/cube_to_dp.glsl64
-rw-r--r--drivers/gles2/shaders/cubemap_filter.glsl57
-rw-r--r--drivers/gles2/shaders/effect_blur.glsl182
-rw-r--r--drivers/gles2/shaders/exposure.glsl64
-rw-r--r--drivers/gles2/shaders/particles.glsl122
-rw-r--r--drivers/gles2/shaders/resolve.glsl20
-rw-r--r--drivers/gles2/shaders/scene.glsl374
-rw-r--r--drivers/gles2/shaders/screen_space_reflection.glsl199
-rw-r--r--drivers/gles2/shaders/ssao.glsl164
-rw-r--r--drivers/gles2/shaders/ssao_blur.glsl55
-rw-r--r--drivers/gles2/shaders/ssao_minify.glsl21
-rw-r--r--drivers/gles2/shaders/stdlib.glsl13
-rw-r--r--drivers/gles2/shaders/subsurf_scattering.glsl168
-rw-r--r--drivers/gles2/shaders/tonemap.glsl168
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp23
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp27
-rw-r--r--drivers/gles3/rasterizer_gles3.h3
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp5
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp5
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--drivers/gles3/shader_gles3.cpp9
-rw-r--r--drivers/gles3/shaders/blend_shape.glsl43
-rw-r--r--drivers/gles3/shaders/canvas.glsl442
-rw-r--r--drivers/gles3/shaders/canvas_shadow.glsl28
-rw-r--r--drivers/gles3/shaders/copy.glsl96
-rw-r--r--drivers/gles3/shaders/cube_to_dp.glsl72
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl253
-rw-r--r--drivers/gles3/shaders/effect_blur.glsl182
-rw-r--r--drivers/gles3/shaders/exposure.glsl64
-rw-r--r--drivers/gles3/shaders/particles.glsl125
-rw-r--r--drivers/gles3/shaders/resolve.glsl24
-rw-r--r--drivers/gles3/shaders/scene.glsl1317
-rw-r--r--drivers/gles3/shaders/screen_space_reflection.glsl244
-rw-r--r--drivers/gles3/shaders/ssao.glsl176
-rw-r--r--drivers/gles3/shaders/ssao_blur.glsl61
-rw-r--r--drivers/gles3/shaders/ssao_minify.glsl21
-rw-r--r--drivers/gles3/shaders/subsurf_scattering.glsl168
-rw-r--r--drivers/gles3/shaders/tonemap.glsl338
-rw-r--r--drivers/png/image_loader_png.cpp1
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp10
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp5
-rw-r--r--drivers/unix/file_access_unix.cpp7
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp6
-rw-r--r--drivers/windows/file_access_windows.cpp20
-rw-r--r--drivers/winmidi/win_midi.cpp6
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.h2
-rw-r--r--editor/animation_track_editor_plugins.cpp3
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/dependency_editor.cpp8
-rw-r--r--editor/doc/doc_data.cpp1
-rw-r--r--editor/editor_asset_installer.cpp1
-rw-r--r--editor/editor_audio_buses.cpp2
-rw-r--r--editor/editor_export.cpp2
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/editor_node.cpp1
-rw-r--r--editor/editor_plugin.cpp4
-rw-r--r--editor/editor_profiler.cpp5
-rw-r--r--editor/editor_resource_preview.cpp2
-rw-r--r--editor/editor_run.cpp4
-rw-r--r--editor/editor_settings.cpp11
-rw-r--r--editor/editor_themes.cpp2
-rw-r--r--editor/fileserver/editor_file_server.cpp16
-rw-r--r--editor/filesystem_dock.cpp18
-rw-r--r--editor/find_in_files.cpp12
-rw-r--r--editor/import/editor_import_collada.cpp42
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp36
-rw-r--r--editor/import/resource_importer_layered_texture.cpp1
-rw-r--r--editor/import/resource_importer_obj.cpp10
-rw-r--r--editor/import/resource_importer_scene.cpp15
-rw-r--r--editor/import/resource_importer_wav.cpp11
-rw-r--r--editor/plugin_config_dialog.cpp1
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp1
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp1
-rw-r--r--editor/plugins/material_editor_plugin.cpp6
-rw-r--r--editor/plugins/material_editor_plugin.h6
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp16
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h2
-rw-r--r--editor/plugins/particles_editor_plugin.cpp2
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp9
-rw-r--r--editor/plugins/script_text_editor.cpp1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/shader_graph_editor_plugin.cpp2932
-rw-r--r--editor/plugins/shader_graph_editor_plugin.h248
-rw-r--r--editor/plugins/skeleton_editor_plugin.cpp8
-rw-r--r--editor/plugins/skeleton_editor_plugin.h1
-rw-r--r--editor/plugins/sprite_editor_plugin.cpp24
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp157
-rw-r--r--editor/plugins/texture_region_editor_plugin.h3
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp109
-rw-r--r--editor/plugins/tile_map_editor_plugin.h8
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp2
-rw-r--r--editor/project_manager.cpp8
-rw-r--r--editor/project_settings_editor.cpp1
-rw-r--r--editor/property_editor.cpp5
-rw-r--r--editor/property_selector.cpp1
-rw-r--r--editor/scene_tree_dock.cpp1
-rw-r--r--editor/scene_tree_editor.cpp1
-rw-r--r--editor/script_editor_debugger.cpp11
-rw-r--r--editor/spatial_editor_gizmos.cpp8
-rw-r--r--editor/translations/af.po128
-rw-r--r--editor/translations/ar.po131
-rw-r--r--editor/translations/bg.po128
-rw-r--r--editor/translations/bn.po224
-rw-r--r--editor/translations/ca.po224
-rw-r--r--editor/translations/cs.po164
-rw-r--r--editor/translations/da.po128
-rw-r--r--editor/translations/de.po224
-rw-r--r--editor/translations/de_CH.po128
-rw-r--r--editor/translations/editor.pot128
-rw-r--r--editor/translations/el.po224
-rw-r--r--editor/translations/es.po224
-rw-r--r--editor/translations/es_AR.po224
-rw-r--r--editor/translations/fa.po128
-rw-r--r--editor/translations/fi.po224
-rw-r--r--editor/translations/fr.po224
-rw-r--r--editor/translations/he.po140
-rw-r--r--editor/translations/hi.po128
-rw-r--r--editor/translations/hu.po173
-rw-r--r--editor/translations/id.po128
-rw-r--r--editor/translations/is.po128
-rw-r--r--editor/translations/it.po224
-rw-r--r--editor/translations/ja.po256
-rw-r--r--editor/translations/ka.po128
-rw-r--r--editor/translations/ko.po224
-rw-r--r--editor/translations/lt.po128
-rw-r--r--editor/translations/lv.po128
-rw-r--r--editor/translations/ms.po128
-rw-r--r--editor/translations/nb.po134
-rw-r--r--editor/translations/nl.po226
-rw-r--r--editor/translations/pl.po198
-rw-r--r--editor/translations/pr.po128
-rw-r--r--editor/translations/pt_BR.po224
-rw-r--r--editor/translations/pt_PT.po224
-rw-r--r--editor/translations/ro.po131
-rw-r--r--editor/translations/ru.po224
-rw-r--r--editor/translations/sk.po128
-rw-r--r--editor/translations/sl.po128
-rw-r--r--editor/translations/sr_Cyrl.po224
-rw-r--r--editor/translations/sr_Latn.po128
-rw-r--r--editor/translations/sv.po133
-rw-r--r--editor/translations/ta.po128
-rw-r--r--editor/translations/th.po224
-rw-r--r--editor/translations/tr.po224
-rw-r--r--editor/translations/uk.po224
-rw-r--r--editor/translations/ur_PK.po128
-rw-r--r--editor/translations/vi.po128
-rw-r--r--editor/translations/zh_CN.po224
-rw-r--r--editor/translations/zh_HK.po128
-rw-r--r--editor/translations/zh_TW.po128
-rw-r--r--main/input_default.cpp3
-rw-r--r--main/main.cpp14
-rwxr-xr-xmisc/hooks/pre-commit-clang-format2
-rwxr-xr-xmisc/travis/clang-format.sh2
-rw-r--r--modules/bullet/area_bullet.cpp4
-rw-r--r--modules/bullet/bullet_physics_server.cpp8
-rw-r--r--modules/bullet/cone_twist_joint_bullet.cpp27
-rw-r--r--modules/bullet/cone_twist_joint_bullet.h8
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp67
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.h4
-rw-r--r--modules/bullet/hinge_joint_bullet.cpp12
-rw-r--r--modules/bullet/pin_joint_bullet.cpp3
-rw-r--r--modules/bullet/space_bullet.cpp4
-rw-r--r--modules/csg/csg_shape.cpp4
-rw-r--r--modules/dds/texture_loader_dds.cpp2
-rw-r--r--modules/etc/image_etc.cpp4
-rw-r--r--modules/gdscript/gdscript.cpp62
-rw-r--r--modules/gdscript/gdscript_compiler.cpp13
-rw-r--r--modules/gdscript/gdscript_editor.cpp17
-rw-r--r--modules/gdscript/gdscript_functions.cpp6
-rw-r--r--modules/gdscript/gdscript_parser.cpp3
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp1
-rw-r--r--modules/gridmap/grid_map.cpp6
-rw-r--r--modules/mobile_vr/shaders/lens_distorted.glsl67
-rw-r--r--modules/mono/csharp_script.cpp81
-rw-r--r--modules/mono/csharp_script.h2
-rw-r--r--modules/mono/editor/bindings_generator.cpp22
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp8
-rw-r--r--modules/mono/glue/collections_glue.cpp56
-rw-r--r--modules/mono/glue/cs_files/Array.cs2
-rw-r--r--modules/mono/glue/cs_files/Attributes/ExportAttribute.cs17
-rw-r--r--modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs (renamed from modules/mono/glue/cs_files/GodotMethodAttribute.cs)0
-rw-r--r--modules/mono/glue/cs_files/Attributes/RPCAttributes.cs (renamed from modules/mono/glue/cs_files/RPCAttributes.cs)0
-rw-r--r--modules/mono/glue/cs_files/Attributes/SignalAttribute.cs (renamed from modules/mono/glue/cs_files/SignalAttribute.cs)0
-rw-r--r--modules/mono/glue/cs_files/Attributes/ToolAttribute.cs7
-rw-r--r--modules/mono/glue/cs_files/Basis.cs2
-rw-r--r--modules/mono/glue/cs_files/Dictionary.cs2
-rw-r--r--modules/mono/glue/cs_files/ExportAttribute.cs17
-rw-r--r--modules/mono/glue/cs_files/Extensions/NodeExtensions.cs (renamed from modules/mono/glue/cs_files/NodeExtensions.cs)0
-rw-r--r--modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs (renamed from modules/mono/glue/cs_files/ObjectExtensions.cs)0
-rw-r--r--modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs (renamed from modules/mono/glue/cs_files/ResourceLoaderExtensions.cs)0
-rw-r--r--modules/mono/glue/cs_files/IAwaiter.cs18
-rw-r--r--modules/mono/glue/cs_files/Interfaces/IAwaitable.cs (renamed from modules/mono/glue/cs_files/IAwaitable.cs)0
-rw-r--r--modules/mono/glue/cs_files/Interfaces/IAwaiter.cs18
-rw-r--r--modules/mono/glue/cs_files/MarshalUtils.cs1
-rw-r--r--modules/mono/glue/cs_files/Quat.cs97
-rw-r--r--modules/mono/glue/cs_files/StringExtensions.cs14
-rw-r--r--modules/mono/glue/cs_files/ToolAttribute.cs7
-rw-r--r--modules/mono/godotsharp_defs.h1
-rw-r--r--modules/mono/mono_gc_handle.cpp7
-rw-r--r--modules/mono/mono_gc_handle.h15
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp46
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp3
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp13
-rw-r--r--modules/mono/signal_awaiter_utils.cpp7
-rw-r--r--modules/mono/signal_awaiter_utils.h2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp16
-rw-r--r--modules/regex/regex.cpp6
-rw-r--r--modules/squish/image_compress_squish.cpp2
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/theora/video_stream_theora.cpp10
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp81
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp5
-rw-r--r--modules/visual_script/visual_script_editor.cpp1
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp1
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp1
-rw-r--r--platform/android/audio_driver_jandroid.cpp4
-rw-r--r--platform/android/export/export.cpp35
-rw-r--r--platform/android/godot_android.cpp2
-rw-r--r--platform/android/java_class_wrapper.cpp5
-rw-r--r--platform/android/os_android.cpp66
-rw-r--r--platform/iphone/export/export.cpp3
-rw-r--r--platform/iphone/os_iphone.cpp5
-rw-r--r--platform/javascript/os_javascript.cpp62
-rw-r--r--platform/osx/export/export.cpp7
-rw-r--r--platform/osx/os_osx.mm56
-rw-r--r--platform/uwp/os_uwp.cpp88
-rw-r--r--platform/windows/context_gl_win.cpp21
-rw-r--r--platform/windows/detect.py1
-rw-r--r--platform/windows/joypad.cpp4
-rw-r--r--platform/windows/os_windows.cpp148
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/context_gl_x11.cpp76
-rw-r--r--platform/x11/os_x11.cpp243
-rw-r--r--scene/2d/navigation2d.cpp11
-rw-r--r--scene/2d/navigation_polygon.cpp2
-rw-r--r--scene/2d/particles_2d.cpp18
-rw-r--r--scene/2d/particles_2d.h2
-rw-r--r--scene/2d/physics_body_2d.cpp7
-rw-r--r--scene/2d/polygon_2d.cpp3
-rw-r--r--scene/3d/baked_lightmap.cpp3
-rw-r--r--scene/3d/cpu_particles.cpp4
-rw-r--r--scene/3d/navigation.cpp9
-rw-r--r--scene/3d/particles.cpp2
-rw-r--r--scene/3d/physics_joint.cpp15
-rw-r--r--scene/3d/vehicle_body.cpp10
-rw-r--r--scene/3d/voxel_light_baker.cpp26
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/animation/animation_tree.cpp46
-rw-r--r--scene/animation/animation_tree.h2
-rw-r--r--scene/animation/skeleton_ik.cpp20
-rw-r--r--scene/animation/skeleton_ik.h2
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/button.cpp3
-rw-r--r--scene/gui/control.cpp3
-rw-r--r--scene/gui/file_dialog.cpp16
-rw-r--r--scene/gui/file_dialog.h1
-rw-r--r--scene/gui/item_list.cpp2
-rw-r--r--scene/gui/line_edit.cpp5
-rw-r--r--scene/gui/link_button.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp1
-rw-r--r--scene/gui/text_edit.cpp57
-rw-r--r--scene/gui/texture_progress.cpp2
-rw-r--r--scene/main/node.cpp10
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/main/viewport.cpp25
-rw-r--r--scene/main/viewport.h3
-rw-r--r--scene/register_scene_types.cpp8
-rw-r--r--scene/resources/animation.cpp2
-rw-r--r--scene/resources/bit_mask.cpp16
-rw-r--r--scene/resources/dynamic_font.cpp4
-rw-r--r--scene/resources/dynamic_font_stb.cpp5
-rw-r--r--scene/resources/mesh.cpp11
-rw-r--r--scene/resources/packed_scene.cpp13
-rw-r--r--scene/resources/shader_graph.cpp2596
-rw-r--r--scene/resources/shader_graph.h446
-rw-r--r--scene/resources/surface_tool.cpp10
-rw-r--r--scene/resources/texture.cpp32
-rw-r--r--scene/resources/tile_set.cpp10
-rw-r--r--scene/resources/visual_shader.cpp2
-rw-r--r--servers/arvr_server.cpp6
-rw-r--r--servers/physics/collision_solver_sat.cpp22
-rw-r--r--servers/physics/collision_solver_sw.cpp4
-rw-r--r--servers/physics/joints/hinge_joint_sw.cpp6
-rw-r--r--servers/physics/space_sw.cpp14
-rw-r--r--servers/physics/step_sw.cpp1
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.cpp1
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.cpp45
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp7
-rw-r--r--servers/physics_2d/space_2d_sw.cpp14
-rw-r--r--servers/physics_2d/step_2d_sw.cpp2
-rw-r--r--servers/visual/shader_language.cpp1
-rw-r--r--servers/visual/visual_server_scene.cpp18
-rw-r--r--servers/visual/visual_server_viewport.cpp3
-rw-r--r--servers/visual/visual_server_wrap_mt.cpp6
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/cvtt/ConvectionKernels.cpp106
-rw-r--r--thirdparty/tinyexr/tinyexr.h1286
351 files changed, 7253 insertions, 17816 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 26ba28370f..2bd271205a 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -240,6 +240,14 @@ PoolStringArray _OS::get_connected_midi_inputs() {
return OS::get_singleton()->get_connected_midi_inputs();
}
+void _OS::open_midi_inputs() {
+ return OS::get_singleton()->open_midi_inputs();
+}
+
+void _OS::close_midi_inputs() {
+ return OS::get_singleton()->close_midi_inputs();
+}
+
void _OS::set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen) {
OS::VideoMode vm;
@@ -1085,6 +1093,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count);
ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name);
ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &_OS::get_connected_midi_inputs);
+ ClassDB::bind_method(D_METHOD("open_midi_inputs"), &_OS::open_midi_inputs);
+ ClassDB::bind_method(D_METHOD("close_midi_inputs"), &_OS::close_midi_inputs);
ClassDB::bind_method(D_METHOD("get_screen_count"), &_OS::get_screen_count);
ClassDB::bind_method(D_METHOD("get_current_screen"), &_OS::get_current_screen);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index b587b9257f..21aea12b23 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -157,6 +157,8 @@ public:
virtual String get_audio_driver_name(int p_driver) const;
virtual PoolStringArray get_connected_midi_inputs();
+ virtual void open_midi_inputs();
+ virtual void close_midi_inputs();
virtual int get_screen_count() const;
virtual int get_current_screen() const;
diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp
index 5c1fd26e2a..46df63066b 100644
--- a/core/compressed_translation.cpp
+++ b/core/compressed_translation.cpp
@@ -50,7 +50,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
int size = Math::larger_prime(keys.size());
- print_line("compressing keys: " + itos(keys.size()));
Vector<Vector<Pair<int, CharString> > > buckets;
Vector<Map<uint32_t, int> > table;
Vector<uint32_t> hfunc_table;
@@ -107,7 +106,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
}
int bucket_table_size = 0;
- print_line("total compressed string size: " + itos(total_compression_size) + " (" + itos(total_string_size) + " uncompressed).");
for (int i = 0; i < size; i++) {
@@ -117,8 +115,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
if (b.size() == 0)
continue;
- //print_line("bucket: "+itos(i)+" - elements: "+itos(b.size()));
-
int d = 1;
int item = 0;
@@ -140,9 +136,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
bucket_table_size += 2 + b.size() * 4;
}
- print_line("bucket table size: " + itos(bucket_table_size * 4));
- print_line("hash table size: " + itos(size * 4));
-
hash_table.resize(size);
bucket_table.resize(bucket_table_size);
@@ -178,8 +171,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
}
}
- print_line("total collisions: " + itos(collisions));
-
strings.resize(total_compression_size);
PoolVector<uint8_t>::Write cw = strings.write();
@@ -198,15 +189,11 @@ bool PHashTranslation::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name.operator String();
if (name == "hash_table") {
hash_table = p_value;
- //print_line("translation: loaded hash table of size: "+itos(hash_table.size()));
} else if (name == "bucket_table") {
bucket_table = p_value;
- //print_line("translation: loaded bucket table of size: "+itos(bucket_table.size()));
} else if (name == "strings") {
strings = p_value;
- //print_line("translation: loaded string table of size: "+itos(strings.size()));
} else if (name == "load_from") {
- //print_line("generating");
generate(p_value);
} else
return false;
@@ -248,11 +235,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
uint32_t p = htptr[h % htsize];
- //print_line("String: "+p_src_text.operator String());
- //print_line("Hash: "+itos(p));
-
if (p == 0xFFFFFFFF) {
- //print_line("GETMSG: Nothing!");
return StringName(); //nothing
}
@@ -271,9 +254,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
}
}
- //print_line("bucket pos: "+itos(idx));
if (idx == -1) {
- //print_line("GETMSG: Not in Bucket!");
return StringName();
}
@@ -281,8 +262,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
String rstr;
rstr.parse_utf8(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].uncomp_size);
- //print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size));
- //print_line("Return: "+rstr);
return rstr;
} else {
@@ -292,8 +271,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size);
String rstr;
rstr.parse_utf8(uncomp.get_data());
- //print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size));
- //print_line("Return: "+rstr);
return rstr;
}
}
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index bb7a444ccc..812e881114 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -43,7 +43,6 @@
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
- //print_line("open and parse!");
ERR_FAIL_COND_V(file != NULL, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index e0a2dbf507..d72d3ca9f1 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -93,8 +93,6 @@ void FileAccessNetworkClient::_thread_func() {
DEBUG_TIME("sem_unlock");
//DEBUG_PRINT("semwait returned "+itos(werr));
DEBUG_PRINT("MUTEX LOCK " + itos(lockcount));
- DEBUG_PRINT("POPO");
- DEBUG_PRINT("PEPE");
lock_mutex();
DEBUG_PRINT("MUTEX PASS");
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 8a40e6d78c..f29e431d9a 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -175,7 +175,6 @@ public:
FileAccess *PackedData::try_open_path(const String &p_path) {
- //print_line("try open path " + p_path);
PathMD5 pmd5(p_path.md5_buffer());
Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
if (!E)
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 8b0655deb0..c01aff9144 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -204,8 +204,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
if (!p_no_cache && ResourceCache::has(local_path)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: " + local_path + " (cached)");
+ print_verbose("Loading resource: " + local_path + " (cached)");
if (r_error)
*r_error = OK;
return RES(ResourceCache::get(local_path));
@@ -216,9 +215,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
ERR_FAIL_COND_V(path == "", RES());
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: " + path);
-
+ print_verbose("Loading resource: " + path);
RES res = _load(path, local_path, p_type_hint, p_no_cache, r_error);
if (res.is_null()) {
@@ -286,9 +283,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
if (!p_no_cache && ResourceCache::has(local_path)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: " + local_path + " (cached)");
-
+ print_verbose("Loading resource: " + local_path + " (cached)");
Ref<Resource> res_cached = ResourceCache::get(local_path);
Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault));
@@ -298,14 +293,10 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
bool xl_remapped = false;
String path = _path_remap(local_path, &xl_remapped);
-
ERR_FAIL_COND_V(path == "", Ref<ResourceInteractiveLoader>());
-
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: ");
+ print_verbose("Loading resource: " + path);
bool found = false;
-
for (int i = 0; i < loader_count; i++) {
if (!loader[i]->recognize_path(path, p_type_hint))
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index e7e9662d24..25adb6a6ee 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -81,7 +81,7 @@ PoolByteArray StreamPeerSSL::get_project_cert_array() {
memdelete(f);
#ifdef DEBUG_ENABLED
- print_line("Loaded certs from '" + certs_path);
+ print_verbose(vformat("Loaded certs from '%s'.", certs_path));
#endif
}
}
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 1a79385a29..ba40cb4586 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -622,15 +622,12 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
case TEXT_PRINTERR: {
String str = *p_inputs[0];
-
- //str+="\n";
print_error(str);
} break;
case TEXT_PRINTRAW: {
- String str = *p_inputs[0];
- //str+="\n";
+ String str = *p_inputs[0];
OS::get_singleton()->print("%s", str.utf8().get_data());
} break;
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 7ab28daf20..d8cb657b5e 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -626,7 +626,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
voxelsize.z /= div_z;
// create and initialize cells to zero
- //print_line("Wrapper: Initializing Cells");
uint8_t ***cell_status = memnew_arr(uint8_t **, div_x);
for (int i = 0; i < div_x; i++) {
@@ -645,7 +644,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
}
// plot faces into cells
- //print_line("Wrapper (1/6): Plotting Faces");
for (int i = 0; i < face_count; i++) {
@@ -659,8 +657,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
// determine which cells connect to the outside by traversing the outside and recursively flood-fill marking
- //print_line("Wrapper (2/6): Flood Filling");
-
for (int i = 0; i < div_x; i++) {
for (int j = 0; j < div_y; j++) {
@@ -690,8 +686,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
// build faces for the inside-outside cell divisors
- //print_line("Wrapper (3/6): Building Faces");
-
PoolVector<Face3> wrapped_faces;
for (int i = 0; i < div_x; i++) {
@@ -705,8 +699,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
}
}
- //print_line("Wrapper (4/6): Transforming Back Vertices");
-
// transform face vertices to global coords
int wrapped_faces_count = wrapped_faces.size();
@@ -724,7 +716,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
}
// clean up grid
- //print_line("Wrapper (5/6): Grid Cleanup");
for (int i = 0; i < div_x; i++) {
@@ -740,7 +731,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
if (p_error)
*p_error = voxelsize.length();
- //print_line("Wrapper (6/6): Finished.");
return wrapped_faces;
}
diff --git a/core/math/quat.cpp b/core/math/quat.cpp
index 67c9048a41..2251571146 100644
--- a/core/math/quat.cpp
+++ b/core/math/quat.cpp
@@ -134,7 +134,7 @@ Quat Quat::normalized() const {
}
bool Quat::is_normalized() const {
- return Math::is_equal_approx(length(), 1.0);
+ return Math::is_equal_approx(length_squared(), 1.0);
}
Quat Quat::inverse() const {
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 45c106102e..9d4f4f66b7 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -62,7 +62,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
Vector3 sp = p_points[i].snapped(Vector3(0.0001, 0.0001, 0.0001));
if (valid_cache.has(sp)) {
valid_points.write[i] = false;
- //print_line("INVALIDATED: "+itos(i));
} else {
valid_points.write[i] = true;
valid_cache.insert(sp);
@@ -455,7 +454,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
//fill mesh
r_mesh.faces.clear();
r_mesh.faces.resize(ret_faces.size());
- //print_line("FACECOUNT: "+itos(r_mesh.faces.size()));
int idx = 0;
for (List<Geometry::MeshData::Face>::Element *E = ret_faces.front(); E; E = E->next()) {
@@ -473,12 +471,5 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
r_mesh.vertices = p_points;
- //r_mesh.optimize_vertices();
- /*
- print_line("FACES: "+itos(r_mesh.faces.size()));
- print_line("EDGES: "+itos(r_mesh.edges.size()));
- print_line("VERTICES: "+itos(r_mesh.vertices.size()));
-*/
-
return OK;
}
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index 3adaad868a..97ee236a46 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -50,9 +50,9 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const V
String type;
if (ObjectDB::get_instance(p_id))
type = ObjectDB::get_instance(p_id)->get_class();
- print_line("failed method: " + type + ":" + p_method + " target ID: " + itos(p_id));
+ print_line("Failed method: " + type + ":" + p_method + " target ID: " + itos(p_id));
statistics();
- ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings");
+ ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings.");
ERR_FAIL_V(ERR_OUT_OF_MEMORY);
}
@@ -101,9 +101,9 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari
String type;
if (ObjectDB::get_instance(p_id))
type = ObjectDB::get_instance(p_id)->get_class();
- print_line("failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id));
+ print_line("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id));
statistics();
- ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings");
+ ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings.");
ERR_FAIL_V(ERR_OUT_OF_MEMORY);
}
@@ -134,9 +134,9 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
String type;
if (ObjectDB::get_instance(p_id))
type = ObjectDB::get_instance(p_id)->get_class();
- print_line("failed notification: " + itos(p_notification) + " target ID: " + itos(p_id));
+ print_line("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id));
statistics();
- ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings");
+ ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings.");
ERR_FAIL_V(ERR_OUT_OF_MEMORY);
}
@@ -210,8 +210,7 @@ void MessageQueue::statistics() {
}
//object was deleted
- //WARN_PRINT("Object was deleted while awaiting a callback")
- //should it print a warning?
+ print_line("Object was deleted while awaiting a callback");
} else {
null_count++;
@@ -226,17 +225,14 @@ void MessageQueue::statistics() {
print_line("NULL count: " + itos(null_count));
for (Map<StringName, int>::Element *E = set_count.front(); E; E = E->next()) {
-
print_line("SET " + E->key() + ": " + itos(E->get()));
}
for (Map<StringName, int>::Element *E = call_count.front(); E; E = E->next()) {
-
print_line("CALL " + E->key() + ": " + itos(E->get()));
}
for (Map<int, int>::Element *E = notify_count.front(); E; E = E->next()) {
-
print_line("NOTIFY " + itos(E->key()) + ": " + itos(E->get()));
}
}
@@ -268,7 +264,6 @@ void MessageQueue::flush() {
if (buffer_end > buffer_max_used) {
buffer_max_used = buffer_end;
- //statistics();
}
uint32_t read_pos = 0;
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index 0b3b40f30c..3a17fc21f3 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -320,7 +320,7 @@ public:
memdelete_arr(keys);
memdelete_arr(values);
- memdelete(hashes);
+ memdelete_arr(hashes);
}
};
diff --git a/core/object.cpp b/core/object.cpp
index 76226d113a..24a31930a0 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1916,7 +1916,11 @@ void *Object::get_script_instance_binding(int p_script_language_index) {
//as it should not really affect performance much (won't be called too often), as in far most caes the condition below will be false afterwards
if (!_script_instance_bindings[p_script_language_index]) {
- _script_instance_bindings[p_script_language_index] = ScriptServer::get_language(p_script_language_index)->alloc_instance_binding_data(this);
+ void *script_data = ScriptServer::get_language(p_script_language_index)->alloc_instance_binding_data(this);
+ if (script_data) {
+ atomic_increment(&instance_binding_count);
+ _script_instance_bindings[p_script_language_index] = script_data;
+ }
}
return _script_instance_bindings[p_script_language_index];
@@ -1931,6 +1935,7 @@ Object::Object() {
_instance_ID = ObjectDB::add_instance(this);
_can_translate = true;
_is_queued_for_deletion = false;
+ instance_binding_count = 0;
memset(_script_instance_bindings, 0, sizeof(void *) * MAX_SCRIPT_INSTANCE_BINDINGS);
script_instance = NULL;
#ifdef TOOLS_ENABLED
@@ -2080,10 +2085,10 @@ void ObjectDB::cleanup() {
String node_name;
if (instances[*K]->is_class("Node"))
- node_name = " - Node Name: " + String(instances[*K]->call("get_name"));
+ node_name = " - Node name: " + String(instances[*K]->call("get_name"));
if (instances[*K]->is_class("Resource"))
- node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
- print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
+ node_name = " - Resource name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
+ print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
}
}
}
diff --git a/core/object.h b/core/object.h
index d741371306..43e1cf4785 100644
--- a/core/object.h
+++ b/core/object.h
@@ -490,10 +490,12 @@ private:
void _set_indexed_bind(const NodePath &p_name, const Variant &p_value);
Variant _get_indexed_bind(const NodePath &p_name) const;
- void *_script_instance_bindings[MAX_SCRIPT_INSTANCE_BINDINGS];
-
void property_list_changed_notify();
+ friend class Reference;
+ uint32_t instance_binding_count;
+ void *_script_instance_bindings[MAX_SCRIPT_INSTANCE_BINDINGS];
+
protected:
virtual void _initialize_classv() { initialize_class(); }
virtual bool _setv(const StringName &p_name, const Variant &p_property) { return false; };
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 330a9153ef..e631d6e994 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -98,22 +98,18 @@ static Error _erase_recursive(DirAccess *da) {
err = _erase_recursive(da);
if (err) {
- print_line("err recurso " + E->get());
da->change_dir("..");
return err;
}
err = da->change_dir("..");
if (err) {
- print_line("no go back " + E->get());
return err;
}
err = da->remove(da->get_current_dir().plus_file(E->get()));
if (err) {
- print_line("no remove dir" + E->get());
return err;
}
} else {
- print_line("no change to " + E->get());
return err;
}
}
@@ -122,8 +118,6 @@ static Error _erase_recursive(DirAccess *da) {
Error err = da->remove(da->get_current_dir().plus_file(E->get()));
if (err) {
-
- print_line("no remove file" + E->get());
return err;
}
}
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 97dae05919..e90d714450 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -689,6 +689,18 @@ PoolStringArray OS::get_connected_midi_inputs() {
return list;
}
+void OS::open_midi_inputs() {
+
+ if (MIDIDriver::get_singleton())
+ MIDIDriver::get_singleton()->open();
+}
+
+void OS::close_midi_inputs() {
+
+ if (MIDIDriver::get_singleton())
+ MIDIDriver::get_singleton()->close();
+}
+
OS::OS() {
void *volatile stack_bottom;
diff --git a/core/os/os.h b/core/os/os.h
index 12c0222ad4..100af95ef1 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -190,6 +190,8 @@ public:
virtual const char *get_audio_driver_name(int p_driver) const;
virtual PoolStringArray get_connected_midi_inputs();
+ virtual void open_midi_inputs();
+ virtual void close_midi_inputs();
virtual int get_screen_count() const { return 1; }
virtual int get_current_screen() const { return 0; }
@@ -254,7 +256,7 @@ public:
virtual String get_executable_path() const;
virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false) = 0;
- virtual Error kill(const ProcessID &p_pid, const int p_max_wait_msec = -1) = 0;
+ virtual Error kill(const ProcessID &p_pid) = 0;
virtual int get_process_id() const;
virtual Error shell_open(String p_uri);
diff --git a/core/print_string.cpp b/core/print_string.cpp
index 0355154488..e1e42d2b56 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -107,3 +107,10 @@ void print_error(String p_string) {
_global_unlock();
}
+
+void print_verbose(String p_string) {
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line(p_string);
+ }
+}
diff --git a/core/print_string.h b/core/print_string.h
index 3465888d4c..c1d2d0ff3a 100644
--- a/core/print_string.h
+++ b/core/print_string.h
@@ -58,5 +58,6 @@ extern bool _print_line_enabled;
extern bool _print_error_enabled;
extern void print_line(String p_string);
extern void print_error(String p_string);
+extern void print_verbose(String p_string);
#endif
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 87a5c3e493..890789ec6f 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -191,7 +191,7 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const {
name = feature_overrides[name];
}
if (!props.has(name)) {
- print_line("WARNING: not found: " + String(name));
+ WARN_PRINTS("Property not found: " + String(name));
return false;
}
r_ret = props[name].variant;
diff --git a/core/reference.cpp b/core/reference.cpp
index c33a7c683c..6e1520d81d 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -66,8 +66,17 @@ int Reference::reference_get_count() const {
bool Reference::reference() {
bool success = refcount.ref();
- if (success && get_script_instance()) {
- get_script_instance()->refcount_incremented();
+ if (success && refcount.get() <= 2 /* higher is not relevant */) {
+ if (get_script_instance()) {
+ get_script_instance()->refcount_incremented();
+ }
+ if (instance_binding_count > 0) {
+ for (int i = 0; i < MAX_SCRIPT_INSTANCE_BINDINGS; i++) {
+ if (_script_instance_bindings[i]) {
+ ScriptServer::get_language(i)->refcount_incremented_instance_binding(this);
+ }
+ }
+ }
}
return success;
@@ -77,9 +86,19 @@ bool Reference::unreference() {
bool die = refcount.unref();
- if (get_script_instance()) {
- bool script_ret = get_script_instance()->refcount_decremented();
- die = die && script_ret;
+ if (refcount.get() <= 1 /* higher is not relevant */) {
+ if (get_script_instance()) {
+ bool script_ret = get_script_instance()->refcount_decremented();
+ die = die && script_ret;
+ }
+ if (instance_binding_count > 0) {
+ for (int i = 0; i < MAX_SCRIPT_INSTANCE_BINDINGS; i++) {
+ if (_script_instance_bindings[i]) {
+ bool script_ret = ScriptServer::get_language(i)->refcount_decremented_instance_binding(this);
+ die = die && script_ret;
+ }
+ }
+ }
}
return die;
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index c5daaeea47..2b9b5d6037 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -82,17 +82,16 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por
const int ms = waits[i];
OS::get_singleton()->delay_usec(ms * 1000);
- print_line("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
+ ERR_PRINTS("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
};
};
if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
- print_line("Remote Debugger: Unable to connect");
+ ERR_PRINTS("Remote Debugger: Unable to connect.");
return FAILED;
};
- // print_line("Remote Debugger: Connection OK!");
packet_peer_stream->set_stream_peer(tcp_client);
return OK;
diff --git a/core/script_language.h b/core/script_language.h
index 71b705e960..573e7b4fa1 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -311,6 +311,8 @@ public:
virtual void *alloc_instance_binding_data(Object *p_object) { return NULL; } //optional, not used by all languages
virtual void free_instance_binding_data(void *p_data) {} //optional, not used by all languages
+ virtual void refcount_incremented_instance_binding(Object *p_object) {} //optional, not used by all languages
+ virtual bool refcount_decremented_instance_binding(Object *p_object) { return true; } //return true if it can die //optional, not used by all languages
virtual void frame();
diff --git a/core/string_db.cpp b/core/string_db.cpp
index 2475cbe3e8..067e4493a1 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -73,7 +73,6 @@ void StringName::cleanup() {
_Data *d = _table[i];
lost_strings++;
if (OS::get_singleton()->is_stdout_verbose()) {
-
if (d->cname) {
print_line("Orphan StringName: " + String(d->cname));
} else {
@@ -85,8 +84,8 @@ void StringName::cleanup() {
memdelete(d);
}
}
- if (OS::get_singleton()->is_stdout_verbose() && lost_strings) {
- print_line("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
+ if (lost_strings) {
+ print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
}
lock->unlock();
diff --git a/core/translation.cpp b/core/translation.cpp
index 78115c3749..82a16d0b17 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -1098,7 +1098,6 @@ bool TranslationServer::_load_translations(const String &p_from) {
for (int i = 0; i < tcount; i++) {
- //print_line( "Loading translation from " + r[i] );
Ref<Translation> tr = ResourceLoader::load(r[i]);
if (tr.is_valid())
add_translation(tr);
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 35cd27f7f3..96e3a3d784 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -1340,7 +1340,7 @@ String String::utf8(const char *p_utf8, int p_len) {
bool String::parse_utf8(const char *p_utf8, int p_len) {
-#define _UNICERROR(m_err) print_line("unicode error: " + String(m_err));
+#define _UNICERROR(m_err) print_line("Unicode error: " + String(m_err));
String aux;
diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml
index b03cf6cadb..2e30750bf9 100644
--- a/doc/classes/Particles.xml
+++ b/doc/classes/Particles.xml
@@ -77,7 +77,7 @@
Emission randomness ratio. Default value: [code]0[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
- Speed scaling ratio. Default value: [code]1[/code].
+ Speed scaling ratio. Default value: [code]1[/code]. A value of [code]0[/code] can be used to pause the particles.
</member>
<member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb">
The [AABB] that determines the area of the world part of which needs to be visible on screen for the particle system to be active.
diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml
index 47265054b0..f872552a49 100644
--- a/doc/classes/Particles2D.xml
+++ b/doc/classes/Particles2D.xml
@@ -66,7 +66,7 @@
Emission lifetime randomness ratio. Default value: [code]0[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
- Particle system's running speed scaling ratio. Default value: [code]1[/code].
+ Particle system's running speed scaling ratio. Default value: [code]1[/code]. A value of [code]0[/code] can be used to pause the particles.
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
Particle texture. If [code]null[/code] particles will be squares.
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 358b7292a5..5f828550b9 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -658,6 +658,9 @@
</member>
<member name="rendering/quality/driver/driver_name" type="String" setter="" getter="">
</member>
+ <member name="rendering/quality/driver/driver_fallback" type="String" setter="" getter="">
+ Whether to allow falling back to other graphics drivers if the preferred driver is not available. Best means use the best working driver (this is the default). Never means never fall back to another driver even if it does not work. This means the project will not run if the preferred driver does not function.
+ </member>
<member name="rendering/quality/filters/anisotropic_filter_level" type="int" setter="" getter="">
Maximum Anisotropic filter level used for textures when anisotropy enabled.
</member>
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index a44a11a46d..1f53d52951 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -116,9 +116,7 @@ Error AudioDriverALSA::init_device() {
status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, NULL);
CHECK_FAIL(status < 0);
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms");
- }
+ print_verbose("Audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms");
status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, NULL);
CHECK_FAIL(status < 0);
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index e1f47cb8c2..45d62e797f 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -178,10 +178,8 @@ Error AudioDriverCoreAudio::init() {
input_position = 0;
input_size = 0;
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("CoreAudio: detected " + itos(channels) + " channels");
- print_line("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
- }
+ print_verbose("CoreAudio: detected " + itos(channels) + " channels");
+ print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
@@ -333,55 +331,57 @@ bool AudioDriverCoreAudio::try_lock() {
}
void AudioDriverCoreAudio::finish() {
- OSStatus result;
-
- lock();
+ if (audio_unit) {
+ OSStatus result;
- AURenderCallbackStruct callback;
- zeromem(&callback, sizeof(AURenderCallbackStruct));
- result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
- if (result != noErr) {
- ERR_PRINT("AudioUnitSetProperty failed");
- }
+ lock();
- if (active) {
- result = AudioOutputUnitStop(audio_unit);
+ AURenderCallbackStruct callback;
+ zeromem(&callback, sizeof(AURenderCallbackStruct));
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
if (result != noErr) {
- ERR_PRINT("AudioOutputUnitStop failed");
+ ERR_PRINT("AudioUnitSetProperty failed");
}
- active = false;
- }
+ if (active) {
+ result = AudioOutputUnitStop(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT("AudioOutputUnitStop failed");
+ }
- result = AudioUnitUninitialize(audio_unit);
- if (result != noErr) {
- ERR_PRINT("AudioUnitUninitialize failed");
- }
+ active = false;
+ }
+
+ result = AudioUnitUninitialize(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT("AudioUnitUninitialize failed");
+ }
#ifdef OSX_ENABLED
- AudioObjectPropertyAddress prop;
- prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
- prop.mScope = kAudioObjectPropertyScopeGlobal;
- prop.mElement = kAudioObjectPropertyElementMaster;
+ AudioObjectPropertyAddress prop;
+ prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
+ prop.mScope = kAudioObjectPropertyScopeGlobal;
+ prop.mElement = kAudioObjectPropertyElementMaster;
- result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
- if (result != noErr) {
- ERR_PRINT("AudioObjectRemovePropertyListener failed");
- }
+ result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
+ if (result != noErr) {
+ ERR_PRINT("AudioObjectRemovePropertyListener failed");
+ }
#endif
- result = AudioComponentInstanceDispose(audio_unit);
- if (result != noErr) {
- ERR_PRINT("AudioComponentInstanceDispose failed");
- }
+ result = AudioComponentInstanceDispose(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT("AudioComponentInstanceDispose failed");
+ }
- unlock();
+ unlock();
+ }
if (mutex) {
memdelete(mutex);
mutex = NULL;
}
-};
+}
Error AudioDriverCoreAudio::capture_start() {
@@ -578,6 +578,7 @@ String AudioDriverCoreAudio::capture_get_device() {
#endif
AudioDriverCoreAudio::AudioDriverCoreAudio() {
+ audio_unit = NULL;
active = false;
mutex = NULL;
diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp
index 3619be4a8e..6d4624e05b 100644
--- a/drivers/coremidi/core_midi.cpp
+++ b/drivers/coremidi/core_midi.cpp
@@ -92,6 +92,25 @@ void MIDIDriverCoreMidi::close() {
}
}
+PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() {
+
+ PoolStringArray list;
+
+ for (int i = 0; i < connected_sources.size(); i++) {
+ MIDIEndpointRef source = connected_sources[i];
+ CFStringRef ref = NULL;
+ char name[256];
+
+ MIDIObjectGetStringProperty(source, kMIDIPropertyDisplayName, &ref);
+ CFStringGetCString(ref, name, sizeof(name), kCFStringEncodingUTF8);
+ CFRelease(ref);
+
+ list.push_back(name);
+ }
+
+ return list;
+}
+
MIDIDriverCoreMidi::MIDIDriverCoreMidi() {
client = 0;
diff --git a/drivers/coremidi/core_midi.h b/drivers/coremidi/core_midi.h
index fd35e12f4b..c6b443764f 100644
--- a/drivers/coremidi/core_midi.h
+++ b/drivers/coremidi/core_midi.h
@@ -53,6 +53,8 @@ public:
virtual Error open();
virtual void close();
+ PoolStringArray get_connected_inputs();
+
MIDIDriverCoreMidi();
virtual ~MIDIDriverCoreMidi();
};
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index e39ec915fc..0381d3f0c1 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -789,6 +789,10 @@ public:
void end_frame(bool p_swap_buffers) {}
void finalize() {}
+ static Error is_viable() {
+ return OK;
+ }
+
static Rasterizer *_create_current() {
return memnew(RasterizerDummy);
}
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 5b04517394..9a9ede761a 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -486,7 +486,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
RasterizerStorageGLES2::Texture *tex = _bind_canvas_texture(np->texture, np->normal_map);
if (!tex) {
- print_line("TODO: ninepatch without texture");
+ // FIXME: Handle textureless ninepatch gracefully
+ WARN_PRINT("NinePatch without texture not supported yet in GLES2 backend, skipping.");
continue;
}
@@ -612,8 +613,6 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
buffer[(3 * 4 * 4) + 14] = (source.position.x + source.size.x) * texpixel_size.x;
buffer[(3 * 4 * 4) + 15] = (source.position.y + source.size.y) * texpixel_size.y;
-
- // print_line(String::num((source.position.y + source.size.y) * texpixel_size.y));
}
glBindBuffer(GL_ARRAY_BUFFER, data.ninepatch_vertices);
@@ -789,7 +788,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
} break;
default: {
- print_line("other");
+ // FIXME: Proper error handling if relevant
+ //print_line("other");
} break;
}
}
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 8815205054..76ee80aa07 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -136,28 +136,21 @@ RasterizerScene *RasterizerGLES2::get_scene() {
return scene;
}
-void RasterizerGLES2::initialize() {
-
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("Using GLES2 video driver");
- }
+Error RasterizerGLES2::is_viable() {
#ifdef GLAD_ENABLED
if (!gladLoadGL()) {
ERR_PRINT("Error initializing GLAD");
+ return ERR_UNAVAILABLE;
}
// GLVersion seems to be used for both GL and GL ES, so we need different version checks for them
#ifdef OPENGL_ENABLED // OpenGL 2.1 Profile required
- if (GLVersion.major < 2) {
-#else // OpenGL ES 3.0
+ if (GLVersion.major < 2 || (GLVersion.major == 2 && GLVersion.minor < 1)) {
+#else // OpenGL ES 2.0
if (GLVersion.major < 2) {
#endif
- ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
- OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n"
- "Godot Engine will self-destruct as soon as you acknowledge this error message.",
- "Fatal error: Insufficient OpenGL / GLES driver support");
+ return ERR_UNAVAILABLE;
}
#ifdef GLES_OVER_GL
@@ -183,14 +176,21 @@ void RasterizerGLES2::initialize() {
glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
glGenerateMipmap = glGenerateMipmapEXT;
} else {
- ERR_PRINT("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
- OS::get_singleton()->alert("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n"
- "Godot Engine will self-destruct as soon as you acknowledge this error message.",
- "Fatal error: Insufficient OpenGL / GLES driver support");
+ return ERR_UNAVAILABLE;
}
}
#endif
+
+#endif // GLAD_ENABLED
+
+ return OK;
+}
+
+void RasterizerGLES2::initialize() {
+
+ print_verbose("Using GLES2 video driver");
+
+#ifdef GLAD_ENABLED
if (true || OS::get_singleton()->is_stdout_verbose()) {
if (GLAD_GL_ARB_debug_output) {
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
@@ -200,7 +200,6 @@ void RasterizerGLES2::initialize() {
print_line("OpenGL debugging not supported!");
}
}
-
#endif // GLAD_ENABLED
// For debugging
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index f727af39dd..98c73b776b 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -61,9 +61,10 @@ public:
virtual void end_frame(bool p_swap_buffers);
virtual void finalize();
+ static Error is_viable();
static void make_current();
-
static void register_config();
+
RasterizerGLES2();
~RasterizerGLES2();
};
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 1655f55bfa..e21998d55e 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -107,7 +107,7 @@ void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) {
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &shadow_atlas->depth);
glBindTexture(GL_TEXTURE_2D, shadow_atlas->depth);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -1216,6 +1216,12 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
glDisableVertexAttribArray(15); // color
glDisableVertexAttribArray(8); // custom data
+ if (!s->attribs[VS::ARRAY_COLOR].enabled) {
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+
+ glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ }
+
glVertexAttrib4f(15, 1, 1, 1, 1);
glVertexAttrib4f(8, 0, 0, 0, 0);
@@ -1259,7 +1265,12 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
}
if (multi_mesh->color_floats) {
- glVertexAttrib4fv(15, buffer + color_ofs);
+ if (multi_mesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ uint8_t *color_data = (uint8_t *)(buffer + color_ofs);
+ glVertexAttrib4f(15, color_data[0] / 255.0, color_data[1] / 255.0, color_data[2] / 255.0, color_data[3] / 255.0);
+ } else {
+ glVertexAttrib4fv(15, buffer + color_ofs);
+ }
}
if (multi_mesh->custom_data_floats) {
@@ -2415,7 +2426,7 @@ void RasterizerSceneGLES2::initialize() {
glBindTexture(GL_TEXTURE_CUBE_MAP, cube.cubemap);
for (int i = 0; i < 6; i++) {
- glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT16, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);
+ glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -2449,7 +2460,7 @@ void RasterizerSceneGLES2::initialize() {
glGenTextures(1, &directional_shadow.depth);
glBindTexture(GL_TEXTURE_2D, directional_shadow.depth);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 262add1cc3..3cee42983d 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "rasterizer_storage_gles2.h"
+
#include "project_settings.h"
#include "rasterizer_canvas_gles2.h"
#include "rasterizer_scene_gles2.h"
@@ -601,8 +602,6 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
- //print_line("GET FORMAT: " + Image::get_format_name(texture->format) + " mipmaps: " + itos(texture->mipmaps));
-
for (int i = 0; i < texture->mipmaps; i++) {
int ofs = 0;
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 5ac2af6e5c..1c87b3ffb5 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -161,7 +161,7 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
return text.as_string();
} break;
- case SL::TYPE_FLOAT: return f2sp0(p_values[0].real) + "f";
+ case SL::TYPE_FLOAT: return f2sp0(p_values[0].real);
case SL::TYPE_VEC2:
case SL::TYPE_VEC3:
case SL::TYPE_VEC4: {
@@ -596,6 +596,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
default: {
SL::DataType type = op_node->arguments[3]->get_datatype();
+ // FIXME: Proper error print or graceful handling
print_line(String("uhhhh invalid mix with type: ") + itos(type));
} break;
}
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 5cdbdf84e0..3b2a29d3ee 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -231,7 +231,6 @@ static String _fix_error_code_line(const String &p_error, int p_code_start, int
continue;
String numstr = error.substr(last_find_pos + 1, (end_pos - last_find_pos) - 1);
- print_line("numstr: " + numstr);
String begin = error.substr(0, last_find_pos + 1);
String end = error.substr(end_pos, error.length());
int num = numstr.to_int() + p_code_start - p_offset;
diff --git a/drivers/gles2/shaders/blend_shape.glsl b/drivers/gles2/shaders/blend_shape.glsl
index 4e0d066823..a1e954e33d 100644
--- a/drivers/gles2/shaders/blend_shape.glsl
+++ b/drivers/gles2/shaders/blend_shape.glsl
@@ -1,6 +1,6 @@
+/* clang-format off */
[vertex]
-
/*
from VisualServer:
@@ -23,56 +23,57 @@ ARRAY_INDEX=8,
/* INPUT ATTRIBS */
-layout(location=0) in highp VFORMAT vertex_attrib;
-layout(location=1) in vec3 normal_attrib;
+layout(location = 0) in highp VFORMAT vertex_attrib;
+/* clang-format on */
+layout(location = 1) in vec3 normal_attrib;
#ifdef ENABLE_TANGENT
-layout(location=2) in vec4 tangent_attrib;
+layout(location = 2) in vec4 tangent_attrib;
#endif
#ifdef ENABLE_COLOR
-layout(location=3) in vec4 color_attrib;
+layout(location = 3) in vec4 color_attrib;
#endif
#ifdef ENABLE_UV
-layout(location=4) in vec2 uv_attrib;
+layout(location = 4) in vec2 uv_attrib;
#endif
#ifdef ENABLE_UV2
-layout(location=5) in vec2 uv2_attrib;
+layout(location = 5) in vec2 uv2_attrib;
#endif
#ifdef ENABLE_SKELETON
-layout(location=6) in ivec4 bone_attrib;
-layout(location=7) in vec4 weight_attrib;
+layout(location = 6) in ivec4 bone_attrib;
+layout(location = 7) in vec4 weight_attrib;
#endif
/* BLEND ATTRIBS */
#ifdef ENABLE_BLEND
-layout(location=8) in highp VFORMAT vertex_attrib_blend;
-layout(location=9) in vec3 normal_attrib_blend;
+layout(location = 8) in highp VFORMAT vertex_attrib_blend;
+layout(location = 9) in vec3 normal_attrib_blend;
#ifdef ENABLE_TANGENT
-layout(location=10) in vec4 tangent_attrib_blend;
+layout(location = 10) in vec4 tangent_attrib_blend;
#endif
#ifdef ENABLE_COLOR
-layout(location=11) in vec4 color_attrib_blend;
+layout(location = 11) in vec4 color_attrib_blend;
#endif
#ifdef ENABLE_UV
-layout(location=12) in vec2 uv_attrib_blend;
+layout(location = 12) in vec2 uv_attrib_blend;
#endif
#ifdef ENABLE_UV2
-layout(location=13) in vec2 uv2_attrib_blend;
+layout(location = 13) in vec2 uv2_attrib_blend;
#endif
#ifdef ENABLE_SKELETON
-layout(location=14) in ivec4 bone_attrib_blend;
-layout(location=15) in vec4 weight_attrib_blend;
+layout(location = 14) in ivec4 bone_attrib_blend;
+layout(location = 15) in vec4 weight_attrib_blend;
#endif
#endif
@@ -110,7 +111,6 @@ uniform float blend_amount;
void main() {
-
#ifdef ENABLE_BLEND
vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount;
@@ -140,7 +140,6 @@ void main() {
uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount;
#endif
-
#ifdef ENABLE_SKELETON
bone_out = bone_attrib_blend;
@@ -149,7 +148,6 @@ void main() {
#else //ENABLE_BLEND
-
vertex_out = vertex_attrib * blend_amount;
#ifdef ENABLE_NORMAL
@@ -177,7 +175,6 @@ void main() {
uv2_out = uv2_attrib * blend_amount;
#endif
-
#ifdef ENABLE_SKELETON
bone_out = bone_attrib;
@@ -188,10 +185,10 @@ void main() {
gl_Position = vec4(0.0);
}
+/* clang-format off */
[fragment]
-
void main() {
}
-
+/* clang-format on */
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index e97822f9bf..ba69ca9b6e 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
uniform highp mat4 projection_matrix;
+/* clang-format on */
uniform highp mat4 modelview_matrix;
uniform highp mat4 extra_matrix;
attribute highp vec2 vertex; // attrib:0
@@ -29,8 +31,12 @@ uniform vec4 src_rect;
uniform highp float time;
+/* clang-format off */
+
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
vec2 select(vec2 a, vec2 b, bvec2 c) {
vec2 ret;
@@ -74,18 +80,21 @@ void main() {
#endif
-{
- vec2 src_vtx=outvec.xy;
+ {
+ vec2 src_vtx = outvec.xy;
+ /* clang-format off */
+
VERTEX_SHADER_CODE
-}
+ /* clang-format on */
+ }
color_interp = color;
gl_Position = projection_matrix * modelview_matrix * outvec;
-
}
+/* clang-format off */
[fragment]
#ifdef USE_GLES_OVER_GL
@@ -97,6 +106,7 @@ precision mediump int;
#endif
uniform sampler2D color_texture; // texunit:-1
+/* clang-format on */
uniform highp vec2 color_texpixel_size;
uniform mediump sampler2D normal_texture; // texunit:-2
@@ -119,8 +129,11 @@ uniform vec2 screen_pixel_size;
#endif
+/* clang-format off */
+
FRAGMENT_SHADER_GLOBALS
+/* clang-format on */
void main() {
@@ -131,15 +144,15 @@ void main() {
#ifdef SCREEN_UV_USED
vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
-{
+ {
+ /* clang-format off */
FRAGMENT_SHADER_CODE
-
-}
+ /* clang-format on */
+ }
color *= final_modulate;
gl_FragColor = color;
-
}
diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl
index c757990de0..e3c8140e31 100644
--- a/drivers/gles2/shaders/canvas_shadow.glsl
+++ b/drivers/gles2/shaders/canvas_shadow.glsl
@@ -1,49 +1,50 @@
+/* clang-format off */
[vertex]
-
-
uniform highp mat4 projection_matrix;
+/* clang-format on */
uniform highp mat4 light_matrix;
uniform highp mat4 world_matrix;
uniform highp float distance_norm;
-layout(location=0) in highp vec3 vertex;
+layout(location = 0) in highp vec3 vertex;
out highp vec4 position_interp;
void main() {
- gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0)));
- position_interp=gl_Position;
+ gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0)));
+ position_interp = gl_Position;
}
+/* clang-format off */
[fragment]
in highp vec4 position_interp;
+/* clang-format on */
#ifdef USE_RGBA_SHADOWS
-layout(location=0) out lowp vec4 distance_buf;
+layout(location = 0) out lowp vec4 distance_buf;
#else
-layout(location=0) out highp float distance_buf;
+layout(location = 0) out highp float distance_buf;
#endif
void main() {
- highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias;
+ highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; //bias;
#ifdef USE_RGBA_SHADOWS
highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
- distance_buf=comp;
+ distance_buf = comp;
#else
- distance_buf=depth;
+ distance_buf = depth;
#endif
}
-
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
index feaeb2152b..16bbde196d 100644
--- a/drivers/gles2/shaders/copy.glsl
+++ b/drivers/gles2/shaders/copy.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
attribute vec3 cube_in; // attrib:4
@@ -46,6 +48,7 @@ void main() {
#endif
}
+/* clang-format off */
[fragment]
#define M_PI 3.14159265359
@@ -63,6 +66,7 @@ varying vec3 cube_interp;
#else
varying vec2 uv_interp;
#endif
+/* clang-format on */
#ifdef USE_CUBEMAP
uniform samplerCube source_cube; // texunit:0
@@ -85,17 +89,15 @@ uniform float custom_alpha;
vec4 texturePanorama(sampler2D pano, vec3 normal) {
vec2 st = vec2(
- atan(normal.x, normal.z),
- acos(normal.y)
- );
+ atan(normal.x, normal.z),
+ acos(normal.y));
- if(st.x < 0.0)
- st.x += M_PI*2.0;
+ if (st.x < 0.0)
+ st.x += M_PI * 2.0;
- st/=vec2(M_PI*2.0,M_PI);
-
- return texture2D(pano,st);
+ st /= vec2(M_PI * 2.0, M_PI);
+ return texture2D(pano, st);
}
#endif
@@ -109,16 +111,15 @@ void main() {
#elif defined(USE_CUBEMAP)
vec4 color = textureCube(source_cube, normalize(cube_interp));
#else
- vec4 color = texture2D( source, uv_interp );
+ vec4 color = texture2D(source, uv_interp);
#endif
-
#ifdef USE_NO_ALPHA
- color.a=1.0;
+ color.a = 1.0;
#endif
#ifdef USE_CUSTOM_ALPHA
- color.a=custom_alpha;
+ color.a = custom_alpha;
#endif
#ifdef USE_MULTIPLIER
diff --git a/drivers/gles2/shaders/cube_to_dp.glsl b/drivers/gles2/shaders/cube_to_dp.glsl
index 0b3f53a870..3d24c36336 100644
--- a/drivers/gles2/shaders/cube_to_dp.glsl
+++ b/drivers/gles2/shaders/cube_to_dp.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
attribute vec2 uv_in; // attrib:4
varying vec2 uv_interp;
@@ -19,6 +21,7 @@ void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
#ifdef USE_GLES_OVER_GL
@@ -30,6 +33,7 @@ precision mediump int;
#endif
uniform highp samplerCube source_cube; //texunit:0
+/* clang-format on */
varying vec2 uv_interp;
uniform bool z_flip;
@@ -39,55 +43,53 @@ uniform highp float bias;
void main() {
- highp vec3 normal = vec3( uv_interp * 2.0 - 1.0, 0.0 );
-/*
- if(z_flip) {
- normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ highp vec3 normal = vec3(uv_interp * 2.0 - 1.0, 0.0);
+ /*
+ if (z_flip) {
+ normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
} else {
- normal.z = -0.5 + 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ normal.z = -0.5 + 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
}
-*/
+ */
- //normal.z = sqrt(1.0-dot(normal.xy,normal.xy));
- //normal.xy*=1.0+normal.z;
+ //normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
+ //normal.xy *= 1.0 + normal.z;
- normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
normal = normalize(normal);
+ /*
+ normal.z = 0.5;
+ normal = normalize(normal);
+ */
-/*
- normal.z=0.5;
- normal=normalize(normal);
-*/
if (!z_flip) {
- normal.z=-normal.z;
+ normal.z = -normal.z;
}
//normal = normalize(vec3( uv_interp * 2.0 - 1.0, 1.0 ));
- float depth = textureCube(source_cube,normal).r;
+ float depth = textureCube(source_cube, normal).r;
// absolute values for direction cosines, bigger value equals closer to basis axis
vec3 unorm = abs(normal);
- if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) {
- // x code
- unorm = normal.x > 0.0 ? vec3( 1.0, 0.0, 0.0 ) : vec3( -1.0, 0.0, 0.0 ) ;
- } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) {
- // y code
- unorm = normal.y > 0.0 ? vec3( 0.0, 1.0, 0.0 ) : vec3( 0.0, -1.0, 0.0 ) ;
- } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) {
- // z code
- unorm = normal.z > 0.0 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 0.0, 0.0, -1.0 ) ;
+ if ((unorm.x >= unorm.y) && (unorm.x >= unorm.z)) {
+ // x code
+ unorm = normal.x > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(-1.0, 0.0, 0.0);
+ } else if ((unorm.y > unorm.x) && (unorm.y >= unorm.z)) {
+ // y code
+ unorm = normal.y > 0.0 ? vec3(0.0, 1.0, 0.0) : vec3(0.0, -1.0, 0.0);
+ } else if ((unorm.z > unorm.x) && (unorm.z > unorm.y)) {
+ // z code
+ unorm = normal.z > 0.0 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 0.0, -1.0);
} else {
- // oh-no we messed up code
- // has to be
- unorm = vec3( 1.0, 0.0, 0.0 );
+ // oh-no we messed up code
+ // has to be
+ unorm = vec3(1.0, 0.0, 0.0);
}
- float depth_fix = 1.0 / dot(normal,unorm);
-
+ float depth_fix = 1.0 / dot(normal, unorm);
depth = 2.0 * depth - 1.0;
float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near));
- gl_FragDepth = (linear_depth*depth_fix+bias) / z_far;
+ gl_FragDepth = (linear_depth * depth_fix + bias) / z_far;
}
-
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
index 62ecd9471b..2a1ad8d8f2 100644
--- a/drivers/gles2/shaders/cubemap_filter.glsl
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,19 +10,26 @@ precision mediump int;
#endif
attribute highp vec2 vertex; // attrib:0
+/* clang-format on */
attribute highp vec2 uv; // attrib:4
varying highp vec2 uv_interp;
void main() {
- uv_interp=uv;
- gl_Position=vec4(vertex,0,1);
+ uv_interp = uv;
+ gl_Position = vec4(vertex, 0, 1);
}
+/* clang-format off */
[fragment]
-#extension GL_ARB_shader_texture_lod : require
+#extension GL_ARB_shader_texture_lod : enable
+
+#ifndef GL_ARB_shader_texture_lod
+#define texture2DLod(img, coord, lod) texture2D(img, coord)
+#define textureCubeLod(img, coord, lod) textureCube(img, coord)
+#endif
#ifdef USE_GLES_OVER_GL
#define mediump
@@ -36,6 +44,7 @@ uniform sampler2D source_panorama; //texunit:0
#else
uniform samplerCube source_cube; //texunit:0
#endif
+/* clang-format on */
uniform int face_id;
uniform float roughness;
@@ -60,17 +69,15 @@ uniform sampler2D radical_inverse_vdc_cache; // texunit:1
vec4 texturePanorama(sampler2D pano, vec3 normal) {
vec2 st = vec2(
- atan(normal.x, normal.z),
- acos(normal.y)
- );
+ atan(normal.x, normal.z),
+ acos(normal.y));
- if(st.x < 0.0)
- st.x += M_PI*2.0;
+ if (st.x < 0.0)
+ st.x += M_PI * 2.0;
- st/=vec2(M_PI*2.0,M_PI);
-
- return texture2DLod(pano,st,0.0);
+ st /= vec2(M_PI * 2.0, M_PI);
+ return texture2DLod(pano, st, 0.0);
}
#endif
@@ -79,24 +86,24 @@ vec3 texelCoordToVec(vec2 uv, int faceID) {
mat3 faceUvVectors[6];
// -x
- faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z
+ faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z
faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face
// +x
faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z
faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face
+ faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face
// -y
- faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z
faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face
// +y
- faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z
- faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face
+ faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z
+ faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face
// -z
faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
@@ -104,9 +111,9 @@ vec3 texelCoordToVec(vec2 uv, int faceID) {
faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face
// +z
- faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x
faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face
+ faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face
// out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2].
vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2];
@@ -118,7 +125,7 @@ vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) {
// Compute distribution direction
float Phi = 2.0 * M_PI * Xi.x;
- float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));
+ float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y));
float SinTheta = sqrt(1.0 - CosTheta * CosTheta);
// Convert to spherical direction
@@ -167,21 +174,17 @@ void main() {
if (NdotL > 0.0) {
#ifdef USE_SOURCE_PANORAMA
- sum.rgb += texturePanorama(source_panorama, H).rgb * NdotL;
+ sum.rgb += texturePanorama(source_panorama, L).rgb * NdotL;
#else
- H.y = -H.y;
- sum.rgb += textureCubeLod(source_cube, H, 0.0).rgb * NdotL;
+ L.y = -L.y;
+ sum.rgb += textureCubeLod(source_cube, L, 0.0).rgb * NdotL;
#endif
sum.a += NdotL;
-
}
-
}
sum /= sum.a;
gl_FragColor = vec4(sum.rgb, 1.0);
-
}
-
diff --git a/drivers/gles2/shaders/effect_blur.glsl b/drivers/gles2/shaders/effect_blur.glsl
index b5f98a1244..a531802c75 100644
--- a/drivers/gles2/shaders/effect_blur.glsl
+++ b/drivers/gles2/shaders/effect_blur.glsl
@@ -1,8 +1,9 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -23,6 +24,7 @@ void main() {
#endif
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
@@ -30,6 +32,7 @@ precision mediump float;
#endif
in vec2 uv_interp;
+/* clang-format on */
uniform sampler2D source_color; //texunit:0
#ifdef SSAO_MERGE
@@ -39,7 +42,6 @@ uniform sampler2D source_ssao; //texunit:1
uniform float lod;
uniform vec2 pixel_size;
-
layout(location = 0) out vec4 frag_color;
#ifdef SSAO_MERGE
@@ -48,31 +50,31 @@ uniform vec4 ssao_color;
#endif
-#if defined (GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL)
+#if defined(GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL)
uniform float glow_strength;
#endif
-#if defined(DOF_FAR_BLUR) || defined (DOF_NEAR_BLUR)
+#if defined(DOF_FAR_BLUR) || defined(DOF_NEAR_BLUR)
#ifdef DOF_QUALITY_LOW
-const int dof_kernel_size=5;
-const int dof_kernel_from=2;
-const float dof_kernel[5] = float[] (0.153388,0.221461,0.250301,0.221461,0.153388);
+const int dof_kernel_size = 5;
+const int dof_kernel_from = 2;
+const float dof_kernel[5] = float[](0.153388, 0.221461, 0.250301, 0.221461, 0.153388);
#endif
#ifdef DOF_QUALITY_MEDIUM
-const int dof_kernel_size=11;
-const int dof_kernel_from=5;
-const float dof_kernel[11] = float[] (0.055037,0.072806,0.090506,0.105726,0.116061,0.119726,0.116061,0.105726,0.090506,0.072806,0.055037);
+const int dof_kernel_size = 11;
+const int dof_kernel_from = 5;
+const float dof_kernel[11] = float[](0.055037, 0.072806, 0.090506, 0.105726, 0.116061, 0.119726, 0.116061, 0.105726, 0.090506, 0.072806, 0.055037);
#endif
#ifdef DOF_QUALITY_HIGH
-const int dof_kernel_size=21;
-const int dof_kernel_from=10;
-const float dof_kernel[21] = float[] (0.028174,0.032676,0.037311,0.041944,0.046421,0.050582,0.054261,0.057307,0.059587,0.060998,0.061476,0.060998,0.059587,0.057307,0.054261,0.050582,0.046421,0.041944,0.037311,0.032676,0.028174);
+const int dof_kernel_size = 21;
+const int dof_kernel_from = 10;
+const float dof_kernel[21] = float[](0.028174, 0.032676, 0.037311, 0.041944, 0.046421, 0.050582, 0.054261, 0.057307, 0.059587, 0.060998, 0.061476, 0.060998, 0.059587, 0.057307, 0.054261, 0.050582, 0.046421, 0.041944, 0.037311, 0.032676, 0.028174);
#endif
uniform sampler2D dof_source_depth; //texunit:1
@@ -88,7 +90,6 @@ uniform sampler2D source_dof_original; //texunit:2
#endif
-
#ifdef GLOW_FIRST_PASS
uniform float exposure;
@@ -112,53 +113,51 @@ uniform float camera_z_near;
void main() {
-
-
#ifdef GAUSSIAN_HORIZONTAL
vec2 pix_size = pixel_size;
- pix_size*=0.5; //reading from larger buffer, so use more samples
- vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.214607;
- color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.189879;
- color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.157305;
- color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.071303;
- color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.189879;
- color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.157305;
- color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.071303;
+ pix_size *= 0.5; //reading from larger buffer, so use more samples
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.214607;
+ color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.189879;
+ color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.157305;
+ color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.071303;
+ color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.189879;
+ color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.157305;
+ color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.071303;
frag_color = color;
#endif
#ifdef GAUSSIAN_VERTICAL
- vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774;
- color+=textureLod( source_color, uv_interp+vec2( 0.0, 1.0)*pixel_size,lod )*0.24477;
- color+=textureLod( source_color, uv_interp+vec2( 0.0, 2.0)*pixel_size,lod )*0.06136;
- color+=textureLod( source_color, uv_interp+vec2( 0.0,-1.0)*pixel_size,lod )*0.24477;
- color+=textureLod( source_color, uv_interp+vec2( 0.0,-2.0)*pixel_size,lod )*0.06136;
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.38774;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.24477;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.06136;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.24477;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.06136;
frag_color = color;
#endif
-//glow uses larger sigma for a more rounded blur effect
+ //glow uses larger sigma for a more rounded blur effect
#ifdef GLOW_GAUSSIAN_HORIZONTAL
vec2 pix_size = pixel_size;
- pix_size*=0.5; //reading from larger buffer, so use more samples
- vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.174938;
- color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.165569;
- color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.140367;
- color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.106595;
- color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.165569;
- color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.140367;
- color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.106595;
- color*=glow_strength;
+ pix_size *= 0.5; //reading from larger buffer, so use more samples
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.174938;
+ color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.165569;
+ color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.140367;
+ color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.106595;
+ color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.165569;
+ color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.140367;
+ color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.106595;
+ color *= glow_strength;
frag_color = color;
#endif
#ifdef GLOW_GAUSSIAN_VERTICAL
- vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.288713;
- color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.233062;
- color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.122581;
- color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.233062;
- color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.122581;
- color*=glow_strength;
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.288713;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.233062;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.122581;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.233062;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.122581;
+ color *= glow_strength;
frag_color = color;
#endif
@@ -166,47 +165,45 @@ void main() {
vec4 color_accum = vec4(0.0);
- float depth = textureLod( dof_source_depth, uv_interp, 0.0).r;
+ float depth = textureLod(dof_source_depth, uv_interp, 0.0).r;
depth = depth * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
#endif
- float amount = smoothstep(dof_begin,dof_end,depth);
- float k_accum=0.0;
+ float amount = smoothstep(dof_begin, dof_end, depth);
+ float k_accum = 0.0;
- for(int i=0;i<dof_kernel_size;i++) {
+ for (int i = 0; i < dof_kernel_size; i++) {
- int int_ofs = i-dof_kernel_from;
+ int int_ofs = i - dof_kernel_from;
vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * amount * dof_radius;
float tap_k = dof_kernel[i];
- float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r;
+ float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r;
tap_depth = tap_depth * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near));
#endif
- float tap_amount = mix(smoothstep(dof_begin,dof_end,tap_depth),1.0,int_ofs==0);
- tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect
-
- vec4 tap_color = textureLod( source_color, tap_uv, 0.0) * tap_k;
-
- k_accum+=tap_k*tap_amount;
- color_accum+=tap_color*tap_amount;
+ float tap_amount = mix(smoothstep(dof_begin, dof_end, tap_depth), 1.0, int_ofs == 0);
+ tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect
+ vec4 tap_color = textureLod(source_color, tap_uv, 0.0) * tap_k;
+ k_accum += tap_k * tap_amount;
+ color_accum += tap_color * tap_amount;
}
- if (k_accum>0.0) {
- color_accum/=k_accum;
+ if (k_accum > 0.0) {
+ color_accum /= k_accum;
}
- frag_color = color_accum;///k_accum;
+ frag_color = color_accum; ///k_accum;
#endif
@@ -214,47 +211,45 @@ void main() {
vec4 color_accum = vec4(0.0);
- float max_accum=0;
+ float max_accum = 0;
- for(int i=0;i<dof_kernel_size;i++) {
+ for (int i = 0; i < dof_kernel_size; i++) {
- int int_ofs = i-dof_kernel_from;
+ int int_ofs = i - dof_kernel_from;
vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * dof_radius;
- float ofs_influence = max(0.0,1.0-float(abs(int_ofs))/float(dof_kernel_from));
+ float ofs_influence = max(0.0, 1.0 - float(abs(int_ofs)) / float(dof_kernel_from));
float tap_k = dof_kernel[i];
- vec4 tap_color = textureLod( source_color, tap_uv, 0.0);
+ vec4 tap_color = textureLod(source_color, tap_uv, 0.0);
- float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r;
+ float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r;
tap_depth = tap_depth * 2.0 - 1.0;
-#ifdef USE_ORTHOGONAL_PROJECTION
- tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near));
#endif
- float tap_amount = 1.0-smoothstep(dof_end,dof_begin,tap_depth);
- tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect
+ float tap_amount = 1.0 - smoothstep(dof_end, dof_begin, tap_depth);
+ tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect
#ifdef DOF_NEAR_FIRST_TAP
- tap_color.a= 1.0-smoothstep(dof_end,dof_begin,tap_depth);
+ tap_color.a = 1.0 - smoothstep(dof_end, dof_begin, tap_depth);
#endif
- max_accum=max(max_accum,tap_amount*ofs_influence);
-
- color_accum+=tap_color*tap_k;
+ max_accum = max(max_accum, tap_amount * ofs_influence);
+ color_accum += tap_color * tap_k;
}
- color_accum.a=max(color_accum.a,sqrt(max_accum));
-
+ color_accum.a = max(color_accum.a, sqrt(max_accum));
#ifdef DOF_NEAR_BLUR_MERGE
- vec4 original = textureLod( source_dof_original, uv_interp, 0.0);
- color_accum = mix(original,color_accum,color_accum.a);
+ vec4 original = textureLod(source_dof_original, uv_interp, 0.0);
+ color_accum = mix(original, color_accum, color_accum.a);
#endif
@@ -265,37 +260,32 @@ void main() {
#endif
-
-
#ifdef GLOW_FIRST_PASS
#ifdef GLOW_USE_AUTO_EXPOSURE
- frag_color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey;
+ frag_color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey;
#endif
- frag_color*=exposure;
+ frag_color *= exposure;
- float luminance = max(frag_color.r,max(frag_color.g,frag_color.b));
- float feedback = max( smoothstep(glow_hdr_threshold,glow_hdr_threshold+glow_hdr_scale,luminance), glow_bloom );
+ float luminance = max(frag_color.r, max(frag_color.g, frag_color.b));
+ float feedback = max(smoothstep(glow_hdr_threshold, glow_hdr_threshold + glow_hdr_scale, luminance), glow_bloom);
frag_color *= feedback;
#endif
-
#ifdef SIMPLE_COPY
- vec4 color =textureLod( source_color, uv_interp,0.0);
+ vec4 color = textureLod(source_color, uv_interp, 0.0);
frag_color = color;
#endif
#ifdef SSAO_MERGE
- vec4 color =textureLod( source_color, uv_interp,0.0);
- float ssao =textureLod( source_ssao, uv_interp,0.0).r;
+ vec4 color = textureLod(source_color, uv_interp, 0.0);
+ float ssao = textureLod(source_ssao, uv_interp, 0.0).r;
- frag_color = vec4( mix(color.rgb,color.rgb*mix(ssao_color.rgb,vec3(1.0),ssao),color.a), 1.0 );
+ frag_color = vec4(mix(color.rgb, color.rgb * mix(ssao_color.rgb, vec3(1.0), ssao), color.a), 1.0);
#endif
-
-
}
diff --git a/drivers/gles2/shaders/exposure.glsl b/drivers/gles2/shaders/exposure.glsl
index 001b90a0f1..759adcda06 100644
--- a/drivers/gles2/shaders/exposure.glsl
+++ b/drivers/gles2/shaders/exposure.glsl
@@ -1,19 +1,19 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
-
}
+/* clang-format off */
[fragment]
-
uniform highp sampler2D source_exposure; //texunit:0
+/* clang-format on */
#ifdef EXPOSURE_BEGIN
@@ -33,66 +33,56 @@ uniform highp float max_luminance;
layout(location = 0) out highp float exposure;
-
-
void main() {
-
-
#ifdef EXPOSURE_BEGIN
-
- ivec2 src_pos = ivec2(gl_FragCoord.xy)*source_render_size/target_size;
+ ivec2 src_pos = ivec2(gl_FragCoord.xy) * source_render_size / target_size;
#if 1
//more precise and expensive, but less jittery
- ivec2 next_pos = ivec2(gl_FragCoord.xy+ivec2(1))*source_render_size/target_size;
- next_pos = max(next_pos,src_pos+ivec2(1)); //so it at least reads one pixel
- highp vec3 source_color=vec3(0.0);
- for(int i=src_pos.x;i<next_pos.x;i++) {
- for(int j=src_pos.y;j<next_pos.y;j++) {
- source_color += texelFetch(source_exposure,ivec2(i,j),0).rgb;
+ ivec2 next_pos = ivec2(gl_FragCoord.xy + ivec2(1)) * source_render_size / target_size;
+ next_pos = max(next_pos, src_pos + ivec2(1)); //so it at least reads one pixel
+ highp vec3 source_color = vec3(0.0);
+ for (int i = src_pos.x; i < next_pos.x; i++) {
+ for (int j = src_pos.y; j < next_pos.y; j++) {
+ source_color += texelFetch(source_exposure, ivec2(i, j), 0).rgb;
}
}
- source_color/=float( (next_pos.x-src_pos.x)*(next_pos.y-src_pos.y) );
+ source_color /= float((next_pos.x - src_pos.x) * (next_pos.y - src_pos.y));
#else
- highp vec3 source_color = texelFetch(source_exposure,src_pos,0).rgb;
+ highp vec3 source_color = texelFetch(source_exposure, src_pos, 0).rgb;
#endif
- exposure = max(source_color.r,max(source_color.g,source_color.b));
+ exposure = max(source_color.r, max(source_color.g, source_color.b));
#else
ivec2 coord = ivec2(gl_FragCoord.xy);
- exposure = texelFetch(source_exposure,coord*3+ivec2(0,0),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(1,0),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(2,0),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(0,1),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(1,1),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(2,1),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(0,2),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(1,2),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(2,2),0).r;
- exposure *= (1.0/9.0);
+ exposure = texelFetch(source_exposure, coord * 3 + ivec2(0, 0), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 0), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 0), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 1), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 1), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 1), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 2), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 2), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 2), 0).r;
+ exposure *= (1.0 / 9.0);
#ifdef EXPOSURE_END
#ifdef EXPOSURE_FORCE_SET
//will stay as is
#else
- highp float prev_lum = texelFetch(prev_exposure,ivec2(0,0),0).r; //1 pixel previous exposure
- exposure = clamp( prev_lum + (exposure-prev_lum)*exposure_adjust,min_luminance,max_luminance);
+ highp float prev_lum = texelFetch(prev_exposure, ivec2(0, 0), 0).r; //1 pixel previous exposure
+ exposure = clamp(prev_lum + (exposure - prev_lum) * exposure_adjust, min_luminance, max_luminance);
#endif //EXPOSURE_FORCE_SET
-
#endif //EXPOSURE_END
#endif //EXPOSURE_BEGIN
-
-
}
-
-
diff --git a/drivers/gles2/shaders/particles.glsl b/drivers/gles2/shaders/particles.glsl
index a62c124dfe..5974050fc1 100644
--- a/drivers/gles2/shaders/particles.glsl
+++ b/drivers/gles2/shaders/particles.glsl
@@ -1,14 +1,13 @@
+/* clang-format off */
[vertex]
-
-
-layout(location=0) in highp vec4 color;
-layout(location=1) in highp vec4 velocity_active;
-layout(location=2) in highp vec4 custom;
-layout(location=3) in highp vec4 xform_1;
-layout(location=4) in highp vec4 xform_2;
-layout(location=5) in highp vec4 xform_3;
-
+layout(location = 0) in highp vec4 color;
+/* clang-format on */
+layout(location = 1) in highp vec4 velocity_active;
+layout(location = 2) in highp vec4 custom;
+layout(location = 3) in highp vec4 xform_1;
+layout(location = 4) in highp vec4 xform_2;
+layout(location = 5) in highp vec4 xform_3;
struct Attractor {
@@ -39,7 +38,6 @@ uniform float lifetime;
uniform mat4 emission_transform;
uniform uint random_seed;
-
out highp vec4 out_color; //tfb:
out highp vec4 out_velocity_active; //tfb:
out highp vec4 out_custom; //tfb:
@@ -47,20 +45,24 @@ out highp vec4 out_xform_1; //tfb:
out highp vec4 out_xform_2; //tfb:
out highp vec4 out_xform_3; //tfb:
-
#if defined(USE_MATERIAL)
+/* clang-format off */
layout(std140) uniform UniformData { //ubo:0
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
uint hash(uint x) {
x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
@@ -69,13 +71,12 @@ uint hash(uint x) {
return x;
}
-
void main() {
#ifdef PARTICLES_COPY
- out_color=color;
- out_velocity_active=velocity_active;
+ out_color = color;
+ out_velocity_active = velocity_active;
out_custom = custom;
out_xform_1 = xform_1;
out_xform_2 = xform_2;
@@ -83,34 +84,34 @@ void main() {
#else
- bool apply_forces=true;
- bool apply_velocity=true;
- float local_delta=delta;
+ bool apply_forces = true;
+ bool apply_velocity = true;
+ float local_delta = delta;
float mass = 1.0;
- float restart_phase = float(gl_VertexID)/float(total_particles);
+ float restart_phase = float(gl_VertexID) / float(total_particles);
- if (randomness>0.0) {
+ if (randomness > 0.0) {
uint seed = cycle;
if (restart_phase >= system_phase) {
- seed-=uint(1);
+ seed -= uint(1);
}
- seed*=uint(total_particles);
- seed+=uint(gl_VertexID);
+ seed *= uint(total_particles);
+ seed += uint(gl_VertexID);
float random = float(hash(seed) % uint(65536)) / 65536.0;
- restart_phase+=randomness * random * 1.0 / float(total_particles);
+ restart_phase += randomness * random * 1.0 / float(total_particles);
}
- restart_phase*= (1.0-explosiveness);
- bool restart=false;
+ restart_phase *= (1.0 - explosiveness);
+ bool restart = false;
bool shader_active = velocity_active.a > 0.5;
if (system_phase > prev_system_phase) {
// restart_phase >= prev_system_phase is used so particles emit in the first frame they are processed
- if (restart_phase >= prev_system_phase && restart_phase < system_phase ) {
- restart=true;
+ if (restart_phase >= prev_system_phase && restart_phase < system_phase) {
+ restart = true;
#ifdef USE_FRACTIONAL_DELTA
local_delta = (system_phase - restart_phase) * lifetime;
#endif
@@ -118,12 +119,12 @@ void main() {
} else {
if (restart_phase >= prev_system_phase) {
- restart=true;
+ restart = true;
#ifdef USE_FRACTIONAL_DELTA
local_delta = (1.0 - restart_phase + system_phase) * lifetime;
#endif
- } else if (restart_phase < system_phase ) {
- restart=true;
+ } else if (restart_phase < system_phase) {
+ restart = true;
#ifdef USE_FRACTIONAL_DELTA
local_delta = (system_phase - restart_phase) * lifetime;
#endif
@@ -133,14 +134,14 @@ void main() {
uint current_cycle = cycle;
if (system_phase < restart_phase) {
- current_cycle-=uint(1);
+ current_cycle -= uint(1);
}
uint particle_number = current_cycle * uint(total_particles) + uint(gl_VertexID);
int index = int(gl_VertexID);
if (restart) {
- shader_active=emitting;
+ shader_active = emitting;
}
mat4 xform;
@@ -150,30 +151,33 @@ void main() {
#else
if (clear || restart) {
#endif
- out_color=vec4(1.0);
- out_velocity_active=vec4(0.0);
- out_custom=vec4(0.0);
+ out_color = vec4(1.0);
+ out_velocity_active = vec4(0.0);
+ out_custom = vec4(0.0);
if (!restart)
- shader_active=false;
+ shader_active = false;
xform = mat4(
- vec4(1.0,0.0,0.0,0.0),
- vec4(0.0,1.0,0.0,0.0),
- vec4(0.0,0.0,1.0,0.0),
- vec4(0.0,0.0,0.0,1.0)
- );
+ vec4(1.0, 0.0, 0.0, 0.0),
+ vec4(0.0, 1.0, 0.0, 0.0),
+ vec4(0.0, 0.0, 1.0, 0.0),
+ vec4(0.0, 0.0, 0.0, 1.0));
} else {
- out_color=color;
- out_velocity_active=velocity_active;
- out_custom=custom;
- xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0)));
+ out_color = color;
+ out_velocity_active = velocity_active;
+ out_custom = custom;
+ xform = transpose(mat4(xform_1, xform_2, xform_3, vec4(vec3(0.0), 1.0)));
}
if (shader_active) {
//execute shader
{
+ /* clang-format off */
+
VERTEX_SHADER_CODE
+
+ /* clang-format on */
}
#if !defined(DISABLE_FORCE)
@@ -181,26 +185,25 @@ VERTEX_SHADER_CODE
if (false) {
vec3 force = vec3(0.0);
- for(int i=0;i<attractor_count;i++) {
+ for (int i = 0; i < attractor_count; i++) {
vec3 rel_vec = xform[3].xyz - attractors[i].pos;
float dist = length(rel_vec);
if (attractors[i].radius < dist)
continue;
- if (attractors[i].eat_radius>0.0 && attractors[i].eat_radius > dist) {
- out_velocity_active.a=0.0;
+ if (attractors[i].eat_radius > 0.0 && attractors[i].eat_radius > dist) {
+ out_velocity_active.a = 0.0;
}
rel_vec = normalize(rel_vec);
- float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation);
+ float attenuation = pow(dist / attractors[i].radius, attractors[i].attenuation);
- if (attractors[i].dir==vec3(0.0)) {
+ if (attractors[i].dir == vec3(0.0)) {
//towards center
- force+=attractors[i].strength * rel_vec * attenuation * mass;
+ force += attractors[i].strength * rel_vec * attenuation * mass;
} else {
- force+=attractors[i].strength * attractors[i].dir * attenuation *mass;
-
+ force += attractors[i].strength * attractors[i].dir * attenuation * mass;
}
}
@@ -216,26 +219,25 @@ VERTEX_SHADER_CODE
}
#endif
} else {
- xform=mat4(0.0);
+ xform = mat4(0.0);
}
xform = transpose(xform);
- out_velocity_active.a = mix(0.0,1.0,shader_active);
+ out_velocity_active.a = mix(0.0, 1.0, shader_active);
out_xform_1 = xform[0];
out_xform_2 = xform[1];
out_xform_3 = xform[2];
#endif //PARTICLES_COPY
-
}
+/* clang-format off */
[fragment]
//any code here is never executed, stuff is filled just so it works
-
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData {
@@ -249,12 +251,16 @@ MATERIAL_UNIFORMS
FRAGMENT_SHADER_GLOBALS
void main() {
-
{
+
LIGHT_SHADER_CODE
+
}
{
+
FRAGMENT_SHADER_CODE
+
}
}
+/* clang-format on */
diff --git a/drivers/gles2/shaders/resolve.glsl b/drivers/gles2/shaders/resolve.glsl
index 0b50a9c57b..5c6f5d6561 100644
--- a/drivers/gles2/shaders/resolve.glsl
+++ b/drivers/gles2/shaders/resolve.glsl
@@ -1,18 +1,19 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
-
void main() {
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
@@ -20,6 +21,7 @@ precision mediump float;
#endif
in vec2 uv_interp;
+/* clang-format on */
uniform sampler2D source_specular; //texunit:0
uniform sampler2D source_ssr; //texunit:1
@@ -31,14 +33,12 @@ layout(location = 0) out vec4 frag_color;
void main() {
- vec4 specular = texture( source_specular, uv_interp );
+ vec4 specular = texture(source_specular, uv_interp);
#ifdef USE_SSR
-
- vec4 ssr = textureLod(source_ssr,uv_interp,0.0);
- specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a);
+ vec4 ssr = textureLod(source_ssr, uv_interp, 0.0);
+ specular.rgb = mix(specular.rgb, ssr.rgb * specular.a, ssr.a);
#endif
- frag_color = vec4(specular.rgb,1.0);
+ frag_color = vec4(specular.rgb, 1.0);
}
-
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index b945e696b1..906c089170 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -10,13 +11,12 @@ precision mediump int;
#include "stdlib.glsl"
-
-
//
// attributes
//
attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
attribute vec3 normal_attrib; // attrib:1
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP)
@@ -66,8 +66,6 @@ attribute highp vec4 instance_custom_data; // attrib:8
#endif
-
-
//
// uniforms
//
@@ -88,7 +86,6 @@ uniform float light_bias;
uniform float light_normal_bias;
#endif
-
//
// varyings
//
@@ -113,9 +110,12 @@ varying vec2 uv_interp;
varying vec2 uv2_interp;
#endif
+/* clang-format off */
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
void main() {
highp vec4 vertex = vertex_attrib;
@@ -124,10 +124,11 @@ void main() {
#ifdef USE_INSTANCING
{
- highp mat4 m = mat4(instance_xform_row_0,
- instance_xform_row_1,
- instance_xform_row_2,
- vec4(0.0, 0.0, 0.0, 1.0));
+ highp mat4 m = mat4(
+ instance_xform_row_0,
+ instance_xform_row_1,
+ instance_xform_row_2,
+ vec4(0.0, 0.0, 0.0, 1.0));
world_matrix = world_matrix * transpose(m);
}
#endif
@@ -161,7 +162,7 @@ void main() {
normal = normalize((world_matrix * vec4(normal, 0.0)).xyz);
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP)
- tangent = normalize((world_matrix * vec4(tangent, 0.0)),xyz);
+ tangent = normalize((world_matrix * vec4(tangent, 0.0)), xyz);
binormal = normalize((world_matrix * vec4(binormal, 0.0)).xyz);
#endif
#endif
@@ -185,11 +186,12 @@ void main() {
for (int i = 0; i < 4; i++) {
ivec2 tex_ofs = ivec2(int(bone_ids[i]) * 3, 0);
- highp mat4 b = mat4(texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(0, 0)),
- texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(1, 0)),
- texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(2, 0)),
- vec4(0.0, 0.0, 0.0, 1.0));
-
+ highp mat4 b = mat4(
+ texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(0, 0)),
+ texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(1, 0)),
+ texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(2, 0)),
+ vec4(0.0, 0.0, 0.0, 1.0));
+
bone_transform += transpose(b) * bone_weights[i];
}
}
@@ -199,7 +201,6 @@ void main() {
world_matrix = bone_transform * world_matrix;
#endif
-
#ifdef USE_INSTANCING
vec4 instance_custom = instance_custom_data;
#else
@@ -207,16 +208,17 @@ void main() {
#endif
-
mat4 modelview = camera_matrix * world_matrix;
#define world_transform world_matrix
-{
+ {
+ /* clang-format off */
VERTEX_SHADER_CODE
-}
+ /* clang-format on */
+ }
vec4 outvec = vertex;
@@ -258,11 +260,16 @@ VERTEX_SHADER_CODE
#endif
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
-
}
+/* clang-format off */
[fragment]
-#extension GL_ARB_shader_texture_lod : require
+#extension GL_ARB_shader_texture_lod : enable
+
+#ifndef GL_ARB_shader_texture_lod
+#define texture2DLod(img, coord, lod) texture2D(img, coord)
+#define textureCubeLod(img, coord, lod) textureCube(img, coord)
+#endif
#ifdef USE_GLES_OVER_GL
#define mediump
@@ -281,6 +288,7 @@ precision mediump int;
//
uniform mat4 camera_matrix;
+/* clang-format on */
uniform mat4 camera_inverse_matrix;
uniform mat4 projection_matrix;
uniform mat4 projection_inverse_matrix;
@@ -289,7 +297,6 @@ uniform mat4 world_transform;
uniform highp float time;
-
#ifdef SCREEN_UV_USED
uniform vec2 screen_pixel_size;
#endif
@@ -343,7 +350,6 @@ uniform float light_spot_attenuation;
uniform float light_spot_range;
uniform float light_spot_angle;
-
// shadows
uniform highp sampler2D light_shadow_atlas; //texunit:-4
uniform float light_has_shadow;
@@ -362,7 +368,6 @@ uniform mat4 light_shadow_matrix3;
uniform mat4 light_shadow_matrix4;
#endif
-
//
// varyings
//
@@ -395,29 +400,33 @@ vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) {
return mix(vec3(dielectric), albedo, metallic); // TODO: reference?
}
+/* clang-format off */
+
FRAGMENT_SHADER_GLOBALS
+/* clang-format on */
#ifdef LIGHT_PASS
-void light_compute(vec3 N,
- vec3 L,
- vec3 V,
- vec3 B,
- vec3 T,
- vec3 light_color,
- vec3 attenuation,
- vec3 diffuse_color,
- vec3 transmission,
- float specular_blob_intensity,
- float roughness,
- float metallic,
- float rim,
- float rim_tint,
- float clearcoat,
- float clearcoat_gloss,
- float anisotropy,
- inout vec3 diffuse_light,
- inout vec3 specular_light) {
+void light_compute(
+ vec3 N,
+ vec3 L,
+ vec3 V,
+ vec3 B,
+ vec3 T,
+ vec3 light_color,
+ vec3 attenuation,
+ vec3 diffuse_color,
+ vec3 transmission,
+ float specular_blob_intensity,
+ float roughness,
+ float metallic,
+ float rim,
+ float rim_tint,
+ float clearcoat,
+ float clearcoat_gloss,
+ float anisotropy,
+ inout vec3 diffuse_light,
+ inout vec3 specular_light) {
float NdotL = dot(N, L);
float cNdotL = max(NdotL, 0.0);
@@ -430,7 +439,7 @@ void light_compute(vec3 N,
// TODO hardcode Oren Nayar for now
float diffuse_brdf_NL;
- diffuse_brdf_NL = max(0.0,(NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
+ diffuse_brdf_NL = max(0.0, (NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
// diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
diffuse_light += light_color * diffuse_color * diffuse_brdf_NL * attenuation;
@@ -439,25 +448,21 @@ void light_compute(vec3 N,
{
// calculate specular reflection
- vec3 R = normalize(-reflect(L,N));
+ vec3 R = normalize(-reflect(L, N));
float cRdotV = max(dot(R, V), 0.0);
float blob_intensity = pow(cRdotV, (1.0 - roughness) * 256.0);
specular_light += light_color * attenuation * blob_intensity * specular_blob_intensity;
-
}
}
-
-
-
// shadows
-float sample_shadow(highp sampler2D shadow,
- vec2 shadow_pixel_size,
- vec2 pos,
- float depth,
- vec4 clamp_rect)
-{
+float sample_shadow(
+ highp sampler2D shadow,
+ vec2 shadow_pixel_size,
+ vec2 pos,
+ float depth,
+ vec4 clamp_rect) {
// vec4 depth_value = texture2D(shadow, pos);
// return depth_value.z;
@@ -465,11 +470,9 @@ float sample_shadow(highp sampler2D shadow,
// return (depth_value.x + depth_value.y + depth_value.z + depth_value.w) / 4.0;
}
-
#endif
-void main()
-{
+void main() {
highp vec3 vertex = vertex_interp;
vec3 albedo = vec3(1.0);
@@ -493,7 +496,6 @@ void main()
float ao_light_affect = 0.0;
#endif
-
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP)
vec3 binormal = normalize(binormal_interp) * side;
vec3 tangent = normalize(tangent_interp) * side;
@@ -508,7 +510,6 @@ void main()
#endif
float normaldepth = 1.0;
-
#ifdef ALPHA_SCISSOR_USED
float alpha_scissor = 0.5;
#endif
@@ -517,12 +518,13 @@ void main()
vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
-{
+ {
+ /* clang-format off */
FRAGMENT_SHADER_CODE
-
-}
+ /* clang-format on */
+ }
#if defined(ENABLE_NORMALMAP)
normalmap.xy = normalmap.xy * 2.0 - 1.0;
@@ -567,7 +569,7 @@ FRAGMENT_SHADER_CODE
vec3 attenuation = vec3(omni_attenuation);
if (light_has_shadow > 0.5) {
- highp vec3 splane = (light_shadow_matrix * vec4(vertex, 1.0)).xyz;
+ highp vec3 splane = (light_shadow_matrix * vec4(vertex, 1.0)).xyz;
float shadow_len = length(splane);
splane = normalize(splane);
@@ -596,25 +598,26 @@ FRAGMENT_SHADER_CODE
}
}
- light_compute(normal,
- normalize(light_vec),
- eye_position,
- binormal,
- tangent,
- light_color.xyz * light_energy,
- attenuation,
- albedo,
- transmission,
- specular * light_specular,
- roughness,
- metallic,
- rim,
- rim_tint,
- clearcoat,
- clearcoat_gloss,
- anisotropy,
- diffuse_light,
- specular_light);
+ light_compute(
+ normal,
+ normalize(light_vec),
+ eye_position,
+ binormal,
+ tangent,
+ light_color.xyz * light_energy,
+ attenuation,
+ albedo,
+ transmission,
+ specular * light_specular,
+ roughness,
+ metallic,
+ rim,
+ rim_tint,
+ clearcoat,
+ clearcoat_gloss,
+ anisotropy,
+ diffuse_light,
+ specular_light);
} else if (light_type == LIGHT_TYPE_DIRECTIONAL) {
@@ -633,133 +636,130 @@ FRAGMENT_SHADER_CODE
if (depth_z < light_split_offsets.x) {
#endif
- vec3 pssm_coord;
- float pssm_fade = 0.0;
+ vec3 pssm_coord;
+ float pssm_fade = 0.0;
#ifdef LIGHT_USE_PSSM_BLEND
- float pssm_blend;
- vec3 pssm_coord2;
- bool use_blend = true;
+ float pssm_blend;
+ vec3 pssm_coord2;
+ bool use_blend = true;
#endif
#ifdef LIGHT_USE_PSSM4
- if (depth_z < light_split_offsets.y) {
- if (depth_z < light_split_offsets.x) {
- highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
+ if (depth_z < light_split_offsets.y) {
+ if (depth_z < light_split_offsets.x) {
+ highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#ifdef LIGHT_USE_PSSM_BLEND
- splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
- pssm_coord2 = splane.xyz / splane.w;
+ splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
- pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z);
+ pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z);
#endif
- } else {
- highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
+ } else {
+ highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#ifdef LIGHT_USE_PSSM_BLEND
- splane = (light_shadow_matrix3 * vec4(vertex, 1.0));
- pssm_coord2 = splane.xyz / splane.w;
+ splane = (light_shadow_matrix3 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
- pssm_blend = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z);
+ pssm_blend = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z);
#endif
- }
- } else {
- if (depth_z < light_split_offsets.z) {
+ }
+ } else {
+ if (depth_z < light_split_offsets.z) {
- highp vec4 splane = (light_shadow_matrix3 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
+ highp vec4 splane = (light_shadow_matrix3 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
- splane = (light_shadow_matrix4 * vec4(vertex, 1.0));
- pssm_coord2 = splane.xyz / splane.w;
- pssm_blend = smoothstep(light_split_offsets.y, light_split_offsets.z, depth_z);
+ splane = (light_shadow_matrix4 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
+ pssm_blend = smoothstep(light_split_offsets.y, light_split_offsets.z, depth_z);
#endif
- } else {
+ } else {
- highp vec4 splane = (light_shadow_matrix4 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
- pssm_fade = smoothstep(light_split_offsets.z, light_split_offsets.w, depth_z);
+ highp vec4 splane = (light_shadow_matrix4 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
+ pssm_fade = smoothstep(light_split_offsets.z, light_split_offsets.w, depth_z);
#if defined(LIGHT_USE_PSSM_BLEND)
- use_blend = false;
+ use_blend = false;
#endif
+ }
}
- }
#endif // LIGHT_USE_PSSM4
#ifdef LIGHT_USE_PSSM2
- if (depth_z < light_split_offsets.x) {
+ if (depth_z < light_split_offsets.x) {
- highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
+ highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#ifdef LIGHT_USE_PSSM_BLEND
- splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
- pssm_coord2 = splane.xyz / splane.w;
- pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z);
+ splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
+ pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z);
#endif
- } else {
- highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
- pssm_fade = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z);
+ } else {
+ highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
+ pssm_fade = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z);
#ifdef LIGHT_USE_PSSM_BLEND
- use_blend = false;
+ use_blend = false;
#endif
- }
+ }
#endif // LIGHT_USE_PSSM2
#if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2)
- {
- highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0));
- pssm_coord = splane.xyz / splane.w;
- }
+ {
+ highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
+ }
#endif
- float shadow = sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord.xy, pssm_coord.z, light_clamp);
+ float shadow = sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord.xy, pssm_coord.z, light_clamp);
#ifdef LIGHT_USE_PSSM_BLEND
- if (use_blend) {
- shadow = mix(shadow, sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend);
- }
+ if (use_blend) {
+ shadow = mix(shadow, sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend);
+ }
#endif
- attenuation *= shadow;
-
-
- }
-
+ attenuation *= shadow;
+ }
}
light_compute(normal,
- normalize(light_vec),
- eye_position,
- binormal,
- tangent,
- light_color.xyz * light_energy,
- attenuation,
- albedo,
- transmission,
- specular * light_specular,
- roughness,
- metallic,
- rim,
- rim_tint,
- clearcoat,
- clearcoat_gloss,
- anisotropy,
- diffuse_light,
- specular_light);
+ normalize(light_vec),
+ eye_position,
+ binormal,
+ tangent,
+ light_color.xyz * light_energy,
+ attenuation,
+ albedo,
+ transmission,
+ specular * light_specular,
+ roughness,
+ metallic,
+ rim,
+ rim_tint,
+ clearcoat,
+ clearcoat_gloss,
+ anisotropy,
+ diffuse_light,
+ specular_light);
} else if (light_type == LIGHT_TYPE_SPOT) {
vec3 light_att = vec3(1.0);
if (light_has_shadow > 0.5) {
- highp vec4 splane = (light_shadow_matrix * vec4(vertex, 1.0));
+ highp vec4 splane = (light_shadow_matrix * vec4(vertex, 1.0));
splane.xyz /= splane.w;
float shadow = sample_shadow(light_shadow_atlas, vec2(0.0), splane.xy, splane.z, light_clamp);
@@ -768,8 +768,6 @@ FRAGMENT_SHADER_CODE
} else {
light_att = vec3(0.0);
}
-
-
}
vec3 light_rel_vec = light_position - vertex;
@@ -788,25 +786,26 @@ FRAGMENT_SHADER_CODE
light_att *= vec3(spot_attenuation);
- light_compute(normal,
- normalize(light_rel_vec),
- eye_position,
- binormal,
- tangent,
- light_color.xyz * light_energy,
- light_att,
- albedo,
- transmission,
- specular * light_specular,
- roughness,
- metallic,
- rim,
- rim_tint,
- clearcoat,
- clearcoat_gloss,
- anisotropy,
- diffuse_light,
- specular_light);
+ light_compute(
+ normal,
+ normalize(light_rel_vec),
+ eye_position,
+ binormal,
+ tangent,
+ light_color.xyz * light_energy,
+ light_att,
+ albedo,
+ transmission,
+ specular * light_specular,
+ roughness,
+ metallic,
+ rim,
+ rim_tint,
+ clearcoat,
+ clearcoat_gloss,
+ anisotropy,
+ diffuse_light,
+ specular_light);
}
gl_FragColor = vec4(ambient_light + diffuse_light + specular_light, alpha);
@@ -818,7 +817,6 @@ FRAGMENT_SHADER_CODE
#ifdef USE_RADIANCE_MAP
-
vec3 ref_vec = reflect(-eye_position, N);
ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz);
@@ -831,7 +829,6 @@ FRAGMENT_SHADER_CODE
vec3 env_ambient = textureCubeLod(radiance_map, ambient_dir, RADIANCE_MAX_LOD).xyz * bg_energy;
ambient_light = mix(ambient_color.rgb, env_ambient, ambient_sky_contribution);
-
}
ambient_light *= ambient_energy;
@@ -855,28 +852,23 @@ FRAGMENT_SHADER_CODE
// TODO shadeless
{
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
- const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04);
+ const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
vec4 r = roughness * c0 + c1;
- float ndotv = clamp(dot(normal,eye_position),0.0,1.0);
- float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y;
- vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
+ float ndotv = clamp(dot(normal, eye_position), 0.0, 1.0);
+ float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
+ vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;
vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo);
specular_light *= AB.x * specular_color + AB.y;
}
-
gl_FragColor = vec4(ambient_light + diffuse_light + specular_light, alpha);
// gl_FragColor = vec4(normal, 1.0);
-
#else
gl_FragColor = vec4(albedo, alpha);
#endif
#endif // RENDER_DEPTH
-
#endif // lighting
-
-
}
diff --git a/drivers/gles2/shaders/screen_space_reflection.glsl b/drivers/gles2/shaders/screen_space_reflection.glsl
index b2e6f7a736..a11da10b61 100644
--- a/drivers/gles2/shaders/screen_space_reflection.glsl
+++ b/drivers/gles2/shaders/screen_space_reflection.glsl
@@ -1,8 +1,9 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
out vec2 pos_interp;
@@ -11,13 +12,14 @@ void main() {
uv_interp = uv_in;
gl_Position = vertex_attrib;
- pos_interp.xy=gl_Position.xy;
+ pos_interp.xy = gl_Position.xy;
}
+/* clang-format off */
[fragment]
-
in vec2 uv_interp;
+/* clang-format on */
in vec2 pos_interp;
uniform sampler2D source_diffuse; //texunit:0
@@ -40,81 +42,70 @@ uniform float depth_tolerance;
uniform float distance_fade;
uniform float curve_fade_in;
-
layout(location = 0) out vec4 frag_color;
-
-vec2 view_to_screen(vec3 view_pos,out float w) {
- vec4 projected = projection * vec4(view_pos, 1.0);
- projected.xyz /= projected.w;
- projected.xy = projected.xy * 0.5 + 0.5;
- w=projected.w;
- return projected.xy;
+vec2 view_to_screen(vec3 view_pos, out float w) {
+ vec4 projected = projection * vec4(view_pos, 1.0);
+ projected.xyz /= projected.w;
+ projected.xy = projected.xy * 0.5 + 0.5;
+ w = projected.w;
+ return projected.xy;
}
-
-
#define M_PI 3.14159265359
void main() {
-
- ////
-
- vec4 diffuse = texture( source_diffuse, uv_interp );
- vec4 normal_roughness = texture( source_normal_roughness, uv_interp);
+ vec4 diffuse = texture(source_diffuse, uv_interp);
+ vec4 normal_roughness = texture(source_normal_roughness, uv_interp);
vec3 normal;
- normal = normal_roughness.xyz*2.0-1.0;
+ normal = normal_roughness.xyz * 2.0 - 1.0;
float roughness = normal_roughness.w;
- float depth_tex = texture(source_depth,uv_interp).r;
+ float depth_tex = texture(source_depth, uv_interp).r;
- vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 );
- vec3 vertex = world_pos.xyz/world_pos.w;
+ vec4 world_pos = inverse_projection * vec4(uv_interp * 2.0 - 1.0, depth_tex * 2.0 - 1.0, 1.0);
+ vec3 vertex = world_pos.xyz / world_pos.w;
vec3 view_dir = normalize(vertex);
vec3 ray_dir = normalize(reflect(view_dir, normal));
- if (dot(ray_dir,normal)<0.001) {
- frag_color=vec4(0.0);
+ if (dot(ray_dir, normal) < 0.001) {
+ frag_color = vec4(0.0);
return;
}
//ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0);
//ray_dir = normalize(vec3(1,1,-1));
-
////////////////
-
//make ray length and clip it against the near plane (don't want to trace beyond visible)
float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far;
- vec3 ray_end = vertex + ray_dir*ray_len;
+ vec3 ray_end = vertex + ray_dir * ray_len;
float w_begin;
- vec2 vp_line_begin = view_to_screen(vertex,w_begin);
+ vec2 vp_line_begin = view_to_screen(vertex, w_begin);
float w_end;
- vec2 vp_line_end = view_to_screen( ray_end, w_end);
- vec2 vp_line_dir = vp_line_end-vp_line_begin;
+ vec2 vp_line_end = view_to_screen(ray_end, w_end);
+ vec2 vp_line_dir = vp_line_end - vp_line_begin;
//we need to interpolate w along the ray, to generate perspective correct reflections
- w_begin = 1.0/w_begin;
- w_end = 1.0/w_end;
+ w_begin = 1.0 / w_begin;
+ w_end = 1.0 / w_end;
+ float z_begin = vertex.z * w_begin;
+ float z_end = ray_end.z * w_end;
- float z_begin = vertex.z*w_begin;
- float z_end = ray_end.z*w_end;
-
- vec2 line_begin = vp_line_begin/pixel_size;
- vec2 line_dir = vp_line_dir/pixel_size;
+ vec2 line_begin = vp_line_begin / pixel_size;
+ vec2 line_dir = vp_line_dir / pixel_size;
float z_dir = z_end - z_begin;
float w_dir = w_end - w_begin;
-
// clip the line to the viewport edges
float scale_max_x = min(1.0, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x));
@@ -124,121 +115,109 @@ void main() {
float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y);
line_dir *= line_clip;
z_dir *= line_clip;
- w_dir *=line_clip;
+ w_dir *= line_clip;
//clip z and w advance to line advance
vec2 line_advance = normalize(line_dir); //down to pixel
- float step_size = length(line_advance)/length(line_dir);
- float z_advance = z_dir*step_size; // adapt z advance to line advance
- float w_advance = w_dir*step_size; // adapt w advance to line advance
+ float step_size = length(line_advance) / length(line_dir);
+ float z_advance = z_dir * step_size; // adapt z advance to line advance
+ float w_advance = w_dir * step_size; // adapt w advance to line advance
//make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice)
- float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y));
- line_advance*=advance_angle_adj; // adapt z advance to line advance
- z_advance*=advance_angle_adj;
- w_advance*=advance_angle_adj;
+ float advance_angle_adj = 1.0 / max(abs(line_advance.x), abs(line_advance.y));
+ line_advance *= advance_angle_adj; // adapt z advance to line advance
+ z_advance *= advance_angle_adj;
+ w_advance *= advance_angle_adj;
vec2 pos = line_begin;
float z = z_begin;
float w = w_begin;
- float z_from=z/w;
- float z_to=z_from;
+ float z_from = z / w;
+ float z_to = z_from;
float depth;
- vec2 prev_pos=pos;
+ vec2 prev_pos = pos;
- bool found=false;
+ bool found = false;
- float steps_taken=0.0;
+ float steps_taken = 0.0;
- for(int i=0;i<num_steps;i++) {
+ for (int i = 0; i < num_steps; i++) {
- pos+=line_advance;
- z+=z_advance;
- w+=w_advance;
+ pos += line_advance;
+ z += z_advance;
+ w += w_advance;
//convert to linear depth
- depth = texture(source_depth, pos*pixel_size).r * 2.0 - 1.0;
+ depth = texture(source_depth, pos * pixel_size).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
#endif
- depth=-depth;
+ depth = -depth;
z_from = z_to;
- z_to = z/w;
+ z_to = z / w;
- if (depth>z_to) {
+ if (depth > z_to) {
//if depth was surpassed
- if (depth<=max(z_to,z_from)+depth_tolerance) {
+ if (depth <= max(z_to, z_from) + depth_tolerance) {
//check the depth tolerance
- found=true;
+ found = true;
}
break;
}
- steps_taken+=1.0;
- prev_pos=pos;
+ steps_taken += 1.0;
+ prev_pos = pos;
}
-
-
-
if (found) {
- float margin_blend=1.0;
-
+ float margin_blend = 1.0;
- vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin
- if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) {
+ vec2 margin = vec2((viewport_size.x + viewport_size.y) * 0.5 * 0.05); //make a uniform margin
+ if (any(bvec4(lessThan(pos, -margin), greaterThan(pos, viewport_size + margin)))) {
//clip outside screen + margin
- frag_color=vec4(0.0);
+ frag_color = vec4(0.0);
return;
}
{
//blend fading out towards external margin
- vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0)));
- margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y));
+ vec2 margin_grad = mix(pos - viewport_size, -pos, lessThan(pos, vec2(0.0)));
+ margin_blend = 1.0 - smoothstep(0.0, margin.x, max(margin_grad.x, margin_grad.y));
//margin_blend=1.0;
-
}
vec2 final_pos;
float grad;
- grad=steps_taken/float(num_steps);
- float initial_fade = curve_fade_in==0.0 ? 1.0 : pow(clamp(grad,0.0,1.0),curve_fade_in);
- float fade = pow(clamp(1.0-grad,0.0,1.0),distance_fade)*initial_fade;
- final_pos=pos;
-
-
-
-
-
-
+ grad = steps_taken / float(num_steps);
+ float initial_fade = curve_fade_in == 0.0 ? 1.0 : pow(clamp(grad, 0.0, 1.0), curve_fade_in);
+ float fade = pow(clamp(1.0 - grad, 0.0, 1.0), distance_fade) * initial_fade;
+ final_pos = pos;
#ifdef REFLECT_ROUGHNESS
-
vec4 final_color;
//if roughness is enabled, do screen space cone tracing
if (roughness > 0.001) {
///////////////////////////////////////////////////////////////////////////////////////
//use a blurred version (in consecutive mipmaps) of the screen to simulate roughness
- float gloss = 1.0-roughness;
+ float gloss = 1.0 - roughness;
float cone_angle = roughness * M_PI * 0.5;
vec2 cone_dir = final_pos - line_begin;
float cone_len = length(cone_dir);
cone_dir = normalize(cone_dir); //will be used normalized from now on
float max_mipmap = filter_mipmap_levels - 1.0;
- float gloss_mult=gloss;
+ float gloss_mult = gloss;
- float rem_alpha=1.0;
+ float rem_alpha = 1.0;
final_color = vec4(0.0);
- for(int i=0;i<7;i++) {
+ for (int i = 0; i < 7; i++) {
float op_len = 2.0 * tan(cone_angle) * cone_len; //opposite side of iso triangle
float radius;
@@ -258,30 +237,30 @@ void main() {
}
//find the place where screen must be sampled
- vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size;
+ vec2 sample_pos = (line_begin + cone_dir * (cone_len - radius)) * pixel_size;
//radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels
- float mipmap = clamp( log2( radius ), 0.0, max_mipmap );
+ float mipmap = clamp(log2(radius), 0.0, max_mipmap);
//mipmap = max(mipmap-1.0,0.0);
//do sampling
vec4 sample_color;
{
- sample_color = textureLod(source_diffuse,sample_pos,mipmap);
+ sample_color = textureLod(source_diffuse, sample_pos, mipmap);
}
//multiply by gloss
- sample_color.rgb*=gloss_mult;
- sample_color.a=gloss_mult;
+ sample_color.rgb *= gloss_mult;
+ sample_color.a = gloss_mult;
rem_alpha -= sample_color.a;
- if(rem_alpha < 0.0) {
+ if (rem_alpha < 0.0) {
sample_color.rgb *= (1.0 - abs(rem_alpha));
}
- final_color+=sample_color;
+ final_color += sample_color;
- if (final_color.a>=0.95) {
+ if (final_color.a >= 0.95) {
// This code of accumulating gloss and aborting on near one
// makes sense when you think of cone tracing.
// Think of it as if roughness was 0, then we could abort on the first
@@ -290,29 +269,21 @@ void main() {
break;
}
- cone_len-=radius*2.0; //go to next (smaller) circle.
-
- gloss_mult*=gloss;
-
+ cone_len -= radius * 2.0; //go to next (smaller) circle.
+ gloss_mult *= gloss;
}
} else {
- final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0);
+ final_color = textureLod(source_diffuse, final_pos * pixel_size, 0.0);
}
- frag_color = vec4(final_color.rgb,fade*margin_blend);
+ frag_color = vec4(final_color.rgb, fade * margin_blend);
#else
- frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,fade*margin_blend);
+ frag_color = vec4(textureLod(source_diffuse, final_pos * pixel_size, 0.0).rgb, fade * margin_blend);
#endif
-
-
} else {
- frag_color = vec4(0.0,0.0,0.0,0.0);
+ frag_color = vec4(0.0, 0.0, 0.0, 0.0);
}
-
-
-
}
-
diff --git a/drivers/gles2/shaders/ssao.glsl b/drivers/gles2/shaders/ssao.glsl
index 219f0957e0..82eea8f274 100644
--- a/drivers/gles2/shaders/ssao.glsl
+++ b/drivers/gles2/shaders/ssao.glsl
@@ -1,14 +1,16 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
- gl_Position.z=1.0;
+ gl_Position.z = 1.0;
}
+/* clang-format off */
[fragment]
#define TWO_PI 6.283185307179586476925286766559
@@ -43,19 +45,21 @@ void main() {
// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent
// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9
-const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2,
-3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
-9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
-11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
-11, 11, 13, 12, 13, 19, 17, 13, 11, 18,
-19, 11, 11, 14, 17, 21, 15, 16, 17, 18,
-13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
-29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
-31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
-19, 27, 21, 25, 39, 29, 17, 21, 27 );
+const int ROTATIONS[] = int[](
+ 1, 1, 2, 3, 2, 5, 2, 3, 2,
+ 3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
+ 9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
+ 11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
+ 11, 11, 13, 12, 13, 19, 17, 13, 11, 18,
+ 19, 11, 11, 14, 17, 21, 15, 16, 17, 18,
+ 13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
+ 29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
+ 31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
+ 19, 27, 21, 25, 39, 29, 17, 21, 27);
+/* clang-format on */
//#define NUM_SPIRAL_TURNS (7)
-const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES-1];
+const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
uniform sampler2D source_depth; //texunit:0
uniform highp usampler2D source_depth_mipmaps; //texunit:1
@@ -90,44 +94,41 @@ vec3 reconstructCSPosition(vec2 S, float z) {
}
vec3 getPosition(ivec2 ssP) {
- vec3 P;
- P.z = texelFetch(source_depth, ssP, 0).r;
+ vec3 P;
+ P.z = texelFetch(source_depth, ssP, 0).r;
- P.z = P.z * 2.0 - 1.0;
+ P.z = P.z * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
- P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
+ P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
#endif
- P.z = -P.z;
+ P.z = -P.z;
- // Offset to pixel center
- P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
- return P;
+ // Offset to pixel center
+ P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
+ return P;
}
/** Reconstructs screen-space unit normal from screen-space position */
vec3 reconstructCSFaceNormal(vec3 C) {
- return normalize(cross(dFdy(C), dFdx(C)));
+ return normalize(cross(dFdy(C), dFdx(C)));
}
-
-
/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */
-vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){
- // Radius relative to ssR
- float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES));
- float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle;
+vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR) {
+ // Radius relative to ssR
+ float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES));
+ float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle;
- ssR = alpha;
- return vec2(cos(angle), sin(angle));
+ ssR = alpha;
+ return vec2(cos(angle), sin(angle));
}
-
/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */
vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
- // Derivation:
- // mipLevel = floor(log(ssR / MAX_OFFSET));
+ // Derivation:
+ // mipLevel = floor(log(ssR / MAX_OFFSET));
int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL);
ivec2 ssP = ivec2(ssR * unitOffset) + ssC;
@@ -138,13 +139,12 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
// Manually clamp to the texture size because texelFetch bypasses the texture unit
ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1));
-
if (mipLevel < 1) {
//read from depth buffer
P.z = texelFetch(source_depth, mipP, 0).r;
P.z = P.z * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
@@ -153,78 +153,74 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
} else {
//read from mipmaps
- uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel-1).r;
- P.z = -(float(d)/65535.0)*camera_z_far;
+ uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel - 1).r;
+ P.z = -(float(d) / 65535.0) * camera_z_far;
}
-
// Offset to pixel center
P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
return P;
}
-
-
/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds
- to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
+ to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
- Note that units of H() in the HPG12 paper are meters, not
- unitless. The whole falloff/sampling function is therefore
- unitless. In this implementation, we factor out (9 / radius).
+ Note that units of H() in the HPG12 paper are meters, not
+ unitless. The whole falloff/sampling function is therefore
+ unitless. In this implementation, we factor out (9 / radius).
- Four versions of the falloff function are implemented below
+ Four versions of the falloff function are implemented below
*/
-float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in float p_radius, in int tapIndex, in float randomPatternRotationAngle) {
- // Offset on the unit disk, spun for this pixel
- float ssR;
- vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR);
- ssR *= ssDiskRadius;
+float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in float p_radius, in int tapIndex, in float randomPatternRotationAngle) {
+ // Offset on the unit disk, spun for this pixel
+ float ssR;
+ vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR);
+ ssR *= ssDiskRadius;
- // The occluding point in camera space
- vec3 Q = getOffsetPosition(ssC, unitOffset, ssR);
+ // The occluding point in camera space
+ vec3 Q = getOffsetPosition(ssC, unitOffset, ssR);
- vec3 v = Q - C;
+ vec3 v = Q - C;
- float vv = dot(v, v);
- float vn = dot(v, n_C);
+ float vv = dot(v, v);
+ float vn = dot(v, n_C);
- const float epsilon = 0.01;
- float radius2 = p_radius*p_radius;
+ const float epsilon = 0.01;
+ float radius2 = p_radius * p_radius;
- // A: From the HPG12 paper
- // Note large epsilon to avoid overdarkening within cracks
- //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;
+ // A: From the HPG12 paper
+ // Note large epsilon to avoid overdarkening within cracks
+ //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;
- // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]
- float f=max(radius2 - vv, 0.0);
- return f * f * f * max((vn - bias) / (epsilon + vv), 0.0);
+ // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]
+ float f = max(radius2 - vv, 0.0);
+ return f * f * f * max((vn - bias) / (epsilon + vv), 0.0);
- // C: Medium contrast (which looks better at high radii), no division. Note that the
- // contribution still falls off with radius^2, but we've adjusted the rate in a way that is
- // more computationally efficient and happens to be aesthetically pleasing.
- // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);
+ // C: Medium contrast (which looks better at high radii), no division. Note that the
+ // contribution still falls off with radius^2, but we've adjusted the rate in a way that is
+ // more computationally efficient and happens to be aesthetically pleasing.
+ // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);
- // D: Low contrast, no division operation
- // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);
+ // D: Low contrast, no division operation
+ // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);
}
-
-
void main() {
-
// Pixel being shaded
ivec2 ssC = ivec2(gl_FragCoord.xy);
// World space point being shaded
vec3 C = getPosition(ssC);
-/* if (C.z <= -camera_z_far*0.999) {
- // We're on the skybox
- visibility=1.0;
- return;
- }*/
+ /*
+ if (C.z <= -camera_z_far*0.999) {
+ // We're on the skybox
+ visibility=1.0;
+ return;
+ }
+ */
//visibility=-C.z/camera_z_far;
//return;
@@ -251,7 +247,7 @@ void main() {
#endif
float sum = 0.0;
for (int i = 0; i < NUM_SAMPLES; ++i) {
- sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius,i, randomPatternRotationAngle);
+ sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius, i, randomPatternRotationAngle);
}
float A = max(0.0, 1.0 - sum * intensity_div_r6 * (5.0 / float(NUM_SAMPLES)));
@@ -271,10 +267,10 @@ void main() {
sum = 0.0;
for (int i = 0; i < NUM_SAMPLES; ++i) {
- sum += sampleAO(ssC, C, n_C, ssDiskRadius,radius2, i, randomPatternRotationAngle);
+ sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius2, i, randomPatternRotationAngle);
}
- A= min(A,max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES))));
+ A = min(A, max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES))));
#endif
// Bilateral box-filter over a quad for free, respecting depth edges
// (the difference that this makes is subtle)
@@ -286,8 +282,4 @@ void main() {
}
visibility = A;
-
}
-
-
-
diff --git a/drivers/gles2/shaders/ssao_blur.glsl b/drivers/gles2/shaders/ssao_blur.glsl
index 472dc21acf..e4133ad534 100644
--- a/drivers/gles2/shaders/ssao_blur.glsl
+++ b/drivers/gles2/shaders/ssao_blur.glsl
@@ -1,26 +1,25 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
- gl_Position.z=1.0;
+ gl_Position.z = 1.0;
}
+/* clang-format off */
[fragment]
-
uniform sampler2D source_ssao; //texunit:0
+/* clang-format on */
uniform sampler2D source_depth; //texunit:1
uniform sampler2D source_normal; //texunit:3
-
layout(location = 0) out float visibility;
-
//////////////////////////////////////////////////////////////////////////////////////////////
// Tunable Parameters:
@@ -28,32 +27,30 @@ layout(location = 0) out float visibility;
uniform float edge_sharpness;
/** Step in 2-pixel intervals since we already blurred against neighbors in the
- first AO pass. This constant can be increased while R decreases to improve
- performance at the expense of some dithering artifacts.
+ first AO pass. This constant can be increased while R decreases to improve
+ performance at the expense of some dithering artifacts.
- Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was
- unobjectionable after shading was applied but eliminated most temporal incoherence
- from using small numbers of sample taps.
- */
+ Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was
+ unobjectionable after shading was applied but eliminated most temporal incoherence
+ from using small numbers of sample taps.
+ */
uniform int filter_scale;
/** Filter radius in pixels. This will be multiplied by SCALE. */
-#define R (4)
-
+#define R (4)
//////////////////////////////////////////////////////////////////////////////////////////////
-
// Gaussian coefficients
const float gaussian[R + 1] =
-// float[](0.356642, 0.239400, 0.072410, 0.009869);
-// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
- float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
-// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
+ //float[](0.356642, 0.239400, 0.072410, 0.009869);
+ //float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
+ float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
+//float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
/** (1, 0) or (0, 1)*/
-uniform ivec2 axis;
+uniform ivec2 axis;
uniform float camera_z_far;
uniform float camera_z_near;
@@ -72,11 +69,11 @@ void main() {
float depth_divide = 1.0 / camera_z_far;
-// depth*=depth_divide;
+ //depth *= depth_divide;
/*
- if (depth > camera_z_far*0.999) {
- discard;//skybox
+ if (depth > camera_z_far * 0.999) {
+ discard; //skybox
}
*/
@@ -96,23 +93,21 @@ void main() {
if (r != 0) {
ivec2 ppos = ssC + axis * (r * filter_scale);
- float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r;
- ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit);
+ float value = texelFetch(source_ssao, clamp(ppos, ivec2(0), clamp_limit), 0).r;
+ ivec2 rpos = clamp(ppos, ivec2(0), clamp_limit);
float temp_depth = texelFetch(source_depth, rpos, 0).r;
//vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0;
temp_depth = temp_depth * 2.0 - 1.0;
temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near));
-// temp_depth *= depth_divide;
+ // temp_depth *= depth_divide;
// spatial domain: offset gaussian tap
float weight = 0.3 + gaussian[abs(r)];
//weight *= max(0.0,dot(temp_normal,normal));
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
- weight *= max(0.0, 1.0
- - edge_sharpness * abs(temp_depth - depth)
- );
+ weight *= max(0.0, 1.0 - edge_sharpness * abs(temp_depth - depth));
sum += value * weight;
totalWeight += weight;
diff --git a/drivers/gles2/shaders/ssao_minify.glsl b/drivers/gles2/shaders/ssao_minify.glsl
index 647c762438..272f3e236e 100644
--- a/drivers/gles2/shaders/ssao_minify.glsl
+++ b/drivers/gles2/shaders/ssao_minify.glsl
@@ -1,21 +1,23 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
-
#ifdef MINIFY_START
#define SDEPTH_TYPE highp sampler2D
uniform float camera_z_far;
uniform float camera_z_near;
+/* clang-format on */
#else
@@ -32,28 +34,23 @@ layout(location = 0) out mediump uint depth;
void main() {
-
ivec2 ssP = ivec2(gl_FragCoord.xy);
- // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
- // On DX9, the bit-and can be implemented with floating-point modulo
+ // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
+ // On DX9, the bit-and can be implemented with floating-point modulo
#ifdef MINIFY_START
float fdepth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
fdepth = fdepth * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- fdepth = ((fdepth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ fdepth = ((fdepth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
fdepth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - fdepth * (camera_z_far - camera_z_near));
#endif
fdepth /= camera_z_far;
- depth = uint(clamp(fdepth*65535.0,0.0,65535.0));
+ depth = uint(clamp(fdepth * 65535.0, 0.0, 65535.0));
#else
depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
#endif
-
-
}
-
-
diff --git a/drivers/gles2/shaders/stdlib.glsl b/drivers/gles2/shaders/stdlib.glsl
index 8b30e097e6..6bc81a22d8 100644
--- a/drivers/gles2/shaders/stdlib.glsl
+++ b/drivers/gles2/shaders/stdlib.glsl
@@ -1,6 +1,5 @@
-vec2 select2(vec2 a, vec2 b, bvec2 c)
-{
+vec2 select2(vec2 a, vec2 b, bvec2 c) {
vec2 ret;
ret.x = c.x ? b.x : a.x;
@@ -9,8 +8,7 @@ vec2 select2(vec2 a, vec2 b, bvec2 c)
return ret;
}
-vec3 select3(vec3 a, vec3 b, bvec3 c)
-{
+vec3 select3(vec3 a, vec3 b, bvec3 c) {
vec3 ret;
ret.x = c.x ? b.x : a.x;
@@ -20,8 +18,7 @@ vec3 select3(vec3 a, vec3 b, bvec3 c)
return ret;
}
-vec4 select4(vec4 a, vec4 b, bvec4 c)
-{
+vec4 select4(vec4 a, vec4 b, bvec4 c) {
vec4 ret;
ret.x = c.x ? b.x : a.x;
@@ -32,9 +29,7 @@ vec4 select4(vec4 a, vec4 b, bvec4 c)
return ret;
}
-
-highp vec4 texel2DFetch(highp sampler2D tex, ivec2 size, ivec2 coord)
-{
+highp vec4 texel2DFetch(highp sampler2D tex, ivec2 size, ivec2 coord) {
float x_coord = float(2 * coord.x + 1) / float(size.x * 2);
float y_coord = float(2 * coord.y + 1) / float(size.y * 2);
diff --git a/drivers/gles2/shaders/subsurf_scattering.glsl b/drivers/gles2/shaders/subsurf_scattering.glsl
index fc66d66198..f40fb3a244 100644
--- a/drivers/gles2/shaders/subsurf_scattering.glsl
+++ b/drivers/gles2/shaders/subsurf_scattering.glsl
@@ -1,105 +1,93 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
-
void main() {
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
//#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
#define QUALIFIER const
#ifdef USE_25_SAMPLES
-
-const int kernel_size=25;
-QUALIFIER vec2 kernel[25] = vec2[] (
- vec2(0.530605, 0.0),
- vec2(0.000973794, -3.0),
- vec2(0.00333804, -2.52083),
- vec2(0.00500364, -2.08333),
- vec2(0.00700976, -1.6875),
- vec2(0.0094389, -1.33333),
- vec2(0.0128496, -1.02083),
- vec2(0.017924, -0.75),
- vec2(0.0263642, -0.520833),
- vec2(0.0410172, -0.333333),
- vec2(0.0493588, -0.1875),
- vec2(0.0402784, -0.0833333),
- vec2(0.0211412, -0.0208333),
- vec2(0.0211412, 0.0208333),
- vec2(0.0402784, 0.0833333),
- vec2(0.0493588, 0.1875),
- vec2(0.0410172, 0.333333),
- vec2(0.0263642, 0.520833),
- vec2(0.017924, 0.75),
- vec2(0.0128496, 1.02083),
- vec2(0.0094389, 1.33333),
- vec2(0.00700976, 1.6875),
- vec2(0.00500364, 2.08333),
- vec2(0.00333804, 2.52083),
- vec2(0.000973794, 3.0)
-);
-
+const int kernel_size = 25;
+/* clang-format on */
+QUALIFIER vec2 kernel[25] = vec2[](
+ vec2(0.530605, 0.0),
+ vec2(0.000973794, -3.0),
+ vec2(0.00333804, -2.52083),
+ vec2(0.00500364, -2.08333),
+ vec2(0.00700976, -1.6875),
+ vec2(0.0094389, -1.33333),
+ vec2(0.0128496, -1.02083),
+ vec2(0.017924, -0.75),
+ vec2(0.0263642, -0.520833),
+ vec2(0.0410172, -0.333333),
+ vec2(0.0493588, -0.1875),
+ vec2(0.0402784, -0.0833333),
+ vec2(0.0211412, -0.0208333),
+ vec2(0.0211412, 0.0208333),
+ vec2(0.0402784, 0.0833333),
+ vec2(0.0493588, 0.1875),
+ vec2(0.0410172, 0.333333),
+ vec2(0.0263642, 0.520833),
+ vec2(0.017924, 0.75),
+ vec2(0.0128496, 1.02083),
+ vec2(0.0094389, 1.33333),
+ vec2(0.00700976, 1.6875),
+ vec2(0.00500364, 2.08333),
+ vec2(0.00333804, 2.52083),
+ vec2(0.000973794, 3.0));
#endif //USE_25_SAMPLES
#ifdef USE_17_SAMPLES
-
-const int kernel_size=17;
-
+const int kernel_size = 17;
QUALIFIER vec2 kernel[17] = vec2[](
- vec2(0.536343, 0.0),
- vec2(0.00317394, -2.0),
- vec2(0.0100386, -1.53125),
- vec2(0.0144609, -1.125),
- vec2(0.0216301, -0.78125),
- vec2(0.0347317, -0.5),
- vec2(0.0571056, -0.28125),
- vec2(0.0582416, -0.125),
- vec2(0.0324462, -0.03125),
- vec2(0.0324462, 0.03125),
- vec2(0.0582416, 0.125),
- vec2(0.0571056, 0.28125),
- vec2(0.0347317, 0.5),
- vec2(0.0216301, 0.78125),
- vec2(0.0144609, 1.125),
- vec2(0.0100386, 1.53125),
- vec2(0.00317394,2.0)
-);
-
+ vec2(0.536343, 0.0),
+ vec2(0.00317394, -2.0),
+ vec2(0.0100386, -1.53125),
+ vec2(0.0144609, -1.125),
+ vec2(0.0216301, -0.78125),
+ vec2(0.0347317, -0.5),
+ vec2(0.0571056, -0.28125),
+ vec2(0.0582416, -0.125),
+ vec2(0.0324462, -0.03125),
+ vec2(0.0324462, 0.03125),
+ vec2(0.0582416, 0.125),
+ vec2(0.0571056, 0.28125),
+ vec2(0.0347317, 0.5),
+ vec2(0.0216301, 0.78125),
+ vec2(0.0144609, 1.125),
+ vec2(0.0100386, 1.53125),
+ vec2(0.00317394, 2.0));
#endif //USE_17_SAMPLES
-
#ifdef USE_11_SAMPLES
-
-const int kernel_size=11;
-
+const int kernel_size = 11;
QUALIFIER vec2 kernel[11] = vec2[](
- vec2(0.560479, 0.0),
- vec2(0.00471691, -2.0),
- vec2(0.0192831, -1.28),
- vec2(0.03639, -0.72),
- vec2(0.0821904, -0.32),
- vec2(0.0771802, -0.08),
- vec2(0.0771802, 0.08),
- vec2(0.0821904, 0.32),
- vec2(0.03639, 0.72),
- vec2(0.0192831, 1.28),
- vec2(0.00471691,2.0)
-);
-
+ vec2(0.560479, 0.0),
+ vec2(0.00471691, -2.0),
+ vec2(0.0192831, -1.28),
+ vec2(0.03639, -0.72),
+ vec2(0.0821904, -0.32),
+ vec2(0.0771802, -0.08),
+ vec2(0.0771802, 0.08),
+ vec2(0.0821904, 0.32),
+ vec2(0.03639, 0.72),
+ vec2(0.0192831, 1.28),
+ vec2(0.00471691, 2.0));
#endif //USE_11_SAMPLES
-
-
uniform float max_radius;
uniform float camera_z_far;
uniform float camera_z_near;
@@ -115,28 +103,24 @@ layout(location = 0) out vec4 frag_color;
void main() {
- float strength = texture(source_sss,uv_interp).r;
- strength*=strength; //stored as sqrt
+ float strength = texture(source_sss, uv_interp).r;
+ strength *= strength; //stored as sqrt
// Fetch color of current pixel:
vec4 base_color = texture(source_diffuse, uv_interp);
-
- if (strength>0.0) {
-
+ if (strength > 0.0) {
// Fetch linear depth of current pixel:
float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
float scale = unit_size; //remember depth is negative by default in OpenGL
#else
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
float scale = unit_size / depth; //remember depth is negative by default in OpenGL
#endif
-
-
// Calculate the final step to fetch the surrounding pixels:
vec2 step = max_radius * scale * dir;
step *= strength; // Modulate it using the alpha channel.
@@ -157,35 +141,33 @@ void main() {
#ifdef ENABLE_FOLLOW_SURFACE
// If the difference in depth is huge, we lerp color back to "colorM":
- float depth_cmp = texture(source_depth, offset).r *2.0 - 1.0;
+ float depth_cmp = texture(source_depth, offset).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near));
#endif
- float s = clamp(300.0f * scale *
- max_radius * abs(depth - depth_cmp),0.0,1.0);
+ float s = clamp(300.0f * scale * max_radius * abs(depth - depth_cmp), 0.0, 1.0);
color = mix(color, base_color.rgb, s);
#endif
// Accumulate:
- color*=kernel[i].x;
+ color *= kernel[i].x;
#ifdef ENABLE_STRENGTH_WEIGHTING
float color_s = texture(source_sss, offset).r;
- color_weight+=color_s * kernel[i].x;
- color*=color_s;
+ color_weight += color_s * kernel[i].x;
+ color *= color_s;
#endif
color_accum += color;
-
}
#ifdef ENABLE_STRENGTH_WEIGHTING
- color_accum/=color_weight;
+ color_accum /= color_weight;
#endif
- frag_color = vec4(color_accum,base_color.a); //keep alpha (used for SSAO)
+ frag_color = vec4(color_accum, base_color.a); //keep alpha (used for SSAO)
} else {
frag_color = base_color;
}
diff --git a/drivers/gles2/shaders/tonemap.glsl b/drivers/gles2/shaders/tonemap.glsl
index 2f671158b2..eae3b5a1ca 100644
--- a/drivers/gles2/shaders/tonemap.glsl
+++ b/drivers/gles2/shaders/tonemap.glsl
@@ -1,8 +1,9 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -11,19 +12,19 @@ void main() {
gl_Position = vertex_attrib;
uv_interp = uv_in;
#ifdef V_FLIP
- uv_interp.y = 1.0-uv_interp.y;
+ uv_interp.y = 1.0 - uv_interp.y;
#endif
-
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
precision mediump float;
#endif
-
in vec2 uv_interp;
+/* clang-format on */
uniform highp sampler2D source; //texunit:0
@@ -56,64 +57,54 @@ uniform sampler2D color_correction; //texunit:3
#endif
-
layout(location = 0) out vec4 frag_color;
#ifdef USE_GLOW_FILTER_BICUBIC
// w0, w1, w2, and w3 are the four cubic B-spline basis functions
-float w0(float a)
-{
- return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0);
+float w0(float a) {
+ return (1.0 / 6.0) * (a * (a * (-a + 3.0) - 3.0) + 1.0);
}
-float w1(float a)
-{
- return (1.0/6.0)*(a*a*(3.0*a - 6.0) + 4.0);
+float w1(float a) {
+ return (1.0 / 6.0) * (a * a * (3.0 * a - 6.0) + 4.0);
}
-float w2(float a)
-{
- return (1.0/6.0)*(a*(a*(-3.0*a + 3.0) + 3.0) + 1.0);
+float w2(float a) {
+ return (1.0 / 6.0) * (a * (a * (-3.0 * a + 3.0) + 3.0) + 1.0);
}
-float w3(float a)
-{
- return (1.0/6.0)*(a*a*a);
+float w3(float a) {
+ return (1.0 / 6.0) * (a * a * a);
}
// g0 and g1 are the two amplitude functions
-float g0(float a)
-{
- return w0(a) + w1(a);
+float g0(float a) {
+ return w0(a) + w1(a);
}
-float g1(float a)
-{
- return w2(a) + w3(a);
+float g1(float a) {
+ return w2(a) + w3(a);
}
// h0 and h1 are the two offset functions
-float h0(float a)
-{
- return -1.0 + w1(a) / (w0(a) + w1(a));
+float h0(float a) {
+ return -1.0 + w1(a) / (w0(a) + w1(a));
}
-float h1(float a)
-{
- return 1.0 + w3(a) / (w2(a) + w3(a));
+float h1(float a) {
+ return 1.0 + w3(a) / (w2(a) + w3(a));
}
uniform ivec2 glow_texture_size;
-vec4 texture2D_bicubic(sampler2D tex, vec2 uv,int p_lod)
-{
- float lod=float(p_lod);
+vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
+ float lod = float(p_lod);
vec2 tex_size = vec2(glow_texture_size >> p_lod);
- vec2 pixel_size =1.0/tex_size;
- uv = uv*tex_size + 0.5;
- vec2 iuv = floor( uv );
- vec2 fuv = fract( uv );
+ vec2 pixel_size = 1.0 / tex_size;
+ uv = uv * tex_size + 0.5;
+ vec2 iuv = floor(uv);
+ vec2 fuv = fract(uv);
float g0x = g0(fuv.x);
float g1x = g1(fuv.x);
@@ -127,24 +118,19 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv,int p_lod)
vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - 0.5) * pixel_size;
vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * pixel_size;
- return g0(fuv.y) * (g0x * textureLod(tex, p0,lod) +
- g1x * textureLod(tex, p1,lod)) +
- g1(fuv.y) * (g0x * textureLod(tex, p2,lod) +
- g1x * textureLod(tex, p3,lod));
+ return (g0(fuv.y) * (g0x * textureLod(tex, p0, lod) + g1x * textureLod(tex, p1, lod))) +
+ (g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod)));
}
-
-
-#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) texture2D_bicubic(m_tex,m_uv,m_lod)
+#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)
#else
-#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) textureLod(m_tex,m_uv,float(m_lod))
+#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod))
#endif
-
-vec3 tonemap_filmic(vec3 color,float white) {
+vec3 tonemap_filmic(vec3 color, float white) {
float A = 0.15;
float B = 0.50;
@@ -154,11 +140,10 @@ vec3 tonemap_filmic(vec3 color,float white) {
float F = 0.30;
float W = 11.2;
- vec3 coltn = ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;
- float whitetn = ((white*(A*white+C*B)+D*E)/(white*(A*white+B)+D*F))-E/F;
-
- return coltn/whitetn;
+ vec3 coltn = ((color * (A * color + C * B) + D * E) / (color * (A * color + B) + D * F)) - E / F;
+ float whitetn = ((white * (A * white + C * B) + D * E) / (white * (A * white + B) + D * F)) - E / F;
+ return coltn / whitetn;
}
vec3 tonemap_aces(vec3 color) {
@@ -167,12 +152,12 @@ vec3 tonemap_aces(vec3 color) {
float c = 2.43f;
float d = 0.59f;
float e = 0.14f;
- return color = clamp((color*(a*color+b))/(color*(c*color+d)+e),vec3(0.0),vec3(1.0));
+ return color = clamp((color * (a * color + b)) / (color * (c * color + d) + e), vec3(0.0), vec3(1.0));
}
-vec3 tonemap_reindhart(vec3 color,float white) {
+vec3 tonemap_reindhart(vec3 color, float white) {
- return ( color * ( 1.0 + ( color / ( white) ) ) ) / ( 1.0 + color );
+ return (color * (1.0 + (color / (white)))) / (1.0 + color);
}
void main() {
@@ -181,10 +166,10 @@ void main() {
#ifdef USE_AUTO_EXPOSURE
- color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey;
+ color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey;
#endif
- color*=exposure;
+ color *= exposure;
#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7)
#define USING_GLOW
@@ -195,56 +180,54 @@ void main() {
#ifdef USE_GLOW_LEVEL1
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,1).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 1).rgb;
#endif
#ifdef USE_GLOW_LEVEL2
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,2).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 2).rgb;
#endif
#ifdef USE_GLOW_LEVEL3
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,3).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 3).rgb;
#endif
#ifdef USE_GLOW_LEVEL4
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,4).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 4).rgb;
#endif
#ifdef USE_GLOW_LEVEL5
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,5).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 5).rgb;
#endif
#ifdef USE_GLOW_LEVEL6
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,6).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 6).rgb;
#endif
#ifdef USE_GLOW_LEVEL7
- glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,7).rgb;
+ glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 7).rgb;
#endif
-
glow *= glow_intensity;
#endif
-
#ifdef USE_REINDHART_TONEMAPPER
- color.rgb = tonemap_reindhart(color.rgb,white);
+ color.rgb = tonemap_reindhart(color.rgb, white);
-# if defined(USING_GLOW)
- glow = tonemap_reindhart(glow,white);
-# endif
+#if defined(USING_GLOW)
+ glow = tonemap_reindhart(glow, white);
+#endif
#endif
#ifdef USE_FILMIC_TONEMAPPER
- color.rgb = tonemap_filmic(color.rgb,white);
+ color.rgb = tonemap_filmic(color.rgb, white);
-# if defined(USING_GLOW)
- glow = tonemap_filmic(glow,white);
-# endif
+#if defined(USING_GLOW)
+ glow = tonemap_filmic(glow, white);
+#endif
#endif
@@ -252,26 +235,26 @@ void main() {
color.rgb = tonemap_aces(color.rgb);
-# if defined(USING_GLOW)
+#if defined(USING_GLOW)
glow = tonemap_aces(glow);
-# endif
+#endif
#endif
//regular Linear -> SRGB conversion
vec3 a = vec3(0.055);
- color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308)));
+ color.rgb = mix((vec3(1.0) + a) * pow(color.rgb, vec3(1.0 / 2.4)) - a, 12.92 * color.rgb, lessThan(color.rgb, vec3(0.0031308)));
#if defined(USING_GLOW)
- glow = mix( (vec3(1.0)+a)*pow(glow,vec3(1.0/2.4))-a , 12.92*glow , lessThan(glow,vec3(0.0031308)));
+ glow = mix((vec3(1.0) + a) * pow(glow, vec3(1.0 / 2.4)) - a, 12.92 * glow, lessThan(glow, vec3(0.0031308)));
#endif
-//glow needs to be added in SRGB space (together with image space effects)
+ //glow needs to be added in SRGB space (together with image space effects)
- color.rgb = clamp(color.rgb,0.0,1.0);
+ color.rgb = clamp(color.rgb, 0.0, 1.0);
#if defined(USING_GLOW)
- glow = clamp(glow,0.0,1.0);
+ glow = clamp(glow, 0.0, 1.0);
#endif
#ifdef USE_GLOW_REPLACE
@@ -291,33 +274,32 @@ void main() {
{
glow = (glow * 0.5) + 0.5;
- color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r)));
- color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g)));
- color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b)));
+ color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r)));
+ color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g)));
+ color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b)));
}
#endif
#if defined(USING_GLOW) && !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE)
//additive
- color.rgb+=glow;
+ color.rgb += glow;
#endif
#ifdef USE_BCS
- color.rgb = mix(vec3(0.0),color.rgb,bcs.x);
- color.rgb = mix(vec3(0.5),color.rgb,bcs.y);
- color.rgb = mix(vec3(dot(vec3(1.0),color.rgb)*0.33333),color.rgb,bcs.z);
+ color.rgb = mix(vec3(0.0), color.rgb, bcs.x);
+ color.rgb = mix(vec3(0.5), color.rgb, bcs.y);
+ color.rgb = mix(vec3(dot(vec3(1.0), color.rgb) * 0.33333), color.rgb, bcs.z);
#endif
#ifdef USE_COLOR_CORRECTION
- color.r = texture(color_correction,vec2(color.r,0.0)).r;
- color.g = texture(color_correction,vec2(color.g,0.0)).g;
- color.b = texture(color_correction,vec2(color.b,0.0)).b;
+ color.r = texture(color_correction, vec2(color.r, 0.0)).r;
+ color.g = texture(color_correction, vec2(color.g, 0.0)).g;
+ color.b = texture(color_correction, vec2(color.b, 0.0)).b;
#endif
-
- frag_color=vec4(color.rgb,1.0);
+ frag_color = vec4(color.rgb, 1.0);
}
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 5e13bed198..643d50797e 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -1173,8 +1173,8 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
{
//skeleton handling
- if (ci->skeleton.is_valid()) {
- skeleton = storage->skeleton_owner.getornull(ci->skeleton);
+ if (ci->skeleton.is_valid() && storage->skeleton_owner.owns(ci->skeleton)) {
+ skeleton = storage->skeleton_owner.get(ci->skeleton);
if (!skeleton->use_2d) {
skeleton = NULL;
} else {
@@ -1557,17 +1557,12 @@ void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light *p_lights_with_s
int ofs = h;
glDisable(GL_BLEND);
- //print_line(" debug lights ");
while (light) {
-
- //print_line("debug light");
if (light->shadow_buffer.is_valid()) {
- //print_line("sb is valid");
RasterizerStorageGLES3::CanvasLightShadow *sb = storage->canvas_light_shadow_owner.get(light->shadow_buffer);
if (sb) {
glBindTexture(GL_TEXTURE_2D, sb->distance);
- //glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex);
draw_generic_textured_rect(Rect2(h, ofs, w - h * 2, h), Rect2(0, 0, 1, 1));
ofs += h * 2;
}
@@ -1677,19 +1672,7 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons
} break;
}
}
- /*
- if (i==0) {
- for(int i=0;i<cc->lines.size();i++) {
- Vector2 p = instance->xform_cache.xform(cc->lines.get(i));
- Plane pp(Vector3(p.x,p.y,0),1);
- pp.normal = light.xform(pp.normal);
- pp = projection.xform4(pp);
- print_line(itos(i)+": "+pp.normal/pp.d);
- //pp=light_mat.xform4(pp);
- //print_line(itos(i)+": "+pp.normal/pp.d);
- }
- }
-*/
+
glBindVertexArray(cc->array_id);
glDrawElements(GL_TRIANGLES, cc->len * 3, GL_UNSIGNED_SHORT, 0);
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index cb17695c5f..e4824695d5 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -33,7 +33,9 @@
#include "gl_context/context_gl.h"
#include "os/os.h"
#include "project_settings.h"
+
#include <string.h>
+
RasterizerStorage *RasterizerGLES3::get_storage() {
return storage;
@@ -134,30 +136,32 @@ typedef void (*DEBUGPROCARB)(GLenum source,
typedef void (*DebugMessageCallbackARB)(DEBUGPROCARB callback, const void *userParam);
-void RasterizerGLES3::initialize() {
-
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("Using GLES3 video driver");
- }
+Error RasterizerGLES3::is_viable() {
#ifdef GLAD_ENABLED
if (!gladLoadGL()) {
ERR_PRINT("Error initializing GLAD");
+ return ERR_UNAVAILABLE;
}
// GLVersion seems to be used for both GL and GL ES, so we need different version checks for them
#ifdef OPENGL_ENABLED // OpenGL 3.3 Core Profile required
- if (GLVersion.major < 3 && GLVersion.minor < 3) {
+ if (GLVersion.major < 3 || (GLVersion.major == 3 && GLVersion.minor < 3)) {
#else // OpenGL ES 3.0
if (GLVersion.major < 3) {
#endif
- ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
- OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n"
- "Godot Engine will self-destruct as soon as you acknowledge this error message.",
- "Fatal error: Insufficient OpenGL / GLES driver support");
+ return ERR_UNAVAILABLE;
}
+#endif // GLAD_ENABLED
+ return OK;
+}
+
+void RasterizerGLES3::initialize() {
+
+ print_verbose("Using GLES3 video driver");
+
+#ifdef GLAD_ENABLED
if (OS::get_singleton()->is_stdout_verbose()) {
if (GLAD_GL_ARB_debug_output) {
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
@@ -167,7 +171,6 @@ void RasterizerGLES3::initialize() {
print_line("OpenGL debugging not supported!");
}
}
-
#endif // GLAD_ENABLED
/* // For debugging
diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h
index f4449ac0f9..0a264caf8f 100644
--- a/drivers/gles3/rasterizer_gles3.h
+++ b/drivers/gles3/rasterizer_gles3.h
@@ -62,9 +62,10 @@ public:
virtual void end_frame(bool p_swap_buffers);
virtual void finalize();
+ static Error is_viable();
static void make_current();
-
static void register_config();
+
RasterizerGLES3();
~RasterizerGLES3();
};
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index eebdbe9493..88f14890ef 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1008,7 +1008,10 @@ RID RasterizerSceneGLES3::light_instance_create(RID p_light) {
light_instance->light = p_light;
light_instance->light_ptr = storage->light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light_instance->light_ptr, RID());
+ if (!light_instance->light_ptr) {
+ memdelete(light_instance);
+ ERR_FAIL_COND_V(!light_instance->light_ptr, RID());
+ }
light_instance->self = light_instance_owner.make_rid(light_instance);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 3697cccef4..0bb0e12b8e 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -6998,7 +6998,10 @@ RID RasterizerStorageGLES3::canvas_light_shadow_buffer_create(int p_width) {
//printf("errnum: %x\n",status);
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
- ERR_FAIL_COND_V(status != GL_FRAMEBUFFER_COMPLETE, RID());
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ memdelete(cls);
+ ERR_FAIL_COND_V(status != GL_FRAMEBUFFER_COMPLETE, RID());
+ }
return canvas_light_shadow_owner.make_rid(cls);
}
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 0c353d42bb..a78a392cbd 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -436,8 +436,6 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
continue;
}
- print_line("u - "+String(E->key())+" offset: "+itos(r_gen_code.uniform_offsets[E->get().order]));
-
}
*/
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index ca0ce5cd3e..007600bb42 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -240,8 +240,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
CharString code_globals;
CharString material_string;
- //print_line("code version? "+itos(conditional_version.code_version));
-
CustomCode *cc = NULL;
if (conditional_version.code_version > 0) {
@@ -743,13 +741,6 @@ void ShaderGLES3::set_custom_shader(uint32_t p_code_id) {
void ShaderGLES3::free_custom_shader(uint32_t p_code_id) {
- /* if (! custom_code_map.has( p_code_id )) {
- print_line("no code id "+itos(p_code_id));
- } else {
- print_line("freed code id "+itos(p_code_id));
-
- }*/
-
ERR_FAIL_COND(!custom_code_map.has(p_code_id));
if (conditional_version.code_version == p_code_id)
conditional_version.code_version = 0; //bye
diff --git a/drivers/gles3/shaders/blend_shape.glsl b/drivers/gles3/shaders/blend_shape.glsl
index 4e0d066823..a1e954e33d 100644
--- a/drivers/gles3/shaders/blend_shape.glsl
+++ b/drivers/gles3/shaders/blend_shape.glsl
@@ -1,6 +1,6 @@
+/* clang-format off */
[vertex]
-
/*
from VisualServer:
@@ -23,56 +23,57 @@ ARRAY_INDEX=8,
/* INPUT ATTRIBS */
-layout(location=0) in highp VFORMAT vertex_attrib;
-layout(location=1) in vec3 normal_attrib;
+layout(location = 0) in highp VFORMAT vertex_attrib;
+/* clang-format on */
+layout(location = 1) in vec3 normal_attrib;
#ifdef ENABLE_TANGENT
-layout(location=2) in vec4 tangent_attrib;
+layout(location = 2) in vec4 tangent_attrib;
#endif
#ifdef ENABLE_COLOR
-layout(location=3) in vec4 color_attrib;
+layout(location = 3) in vec4 color_attrib;
#endif
#ifdef ENABLE_UV
-layout(location=4) in vec2 uv_attrib;
+layout(location = 4) in vec2 uv_attrib;
#endif
#ifdef ENABLE_UV2
-layout(location=5) in vec2 uv2_attrib;
+layout(location = 5) in vec2 uv2_attrib;
#endif
#ifdef ENABLE_SKELETON
-layout(location=6) in ivec4 bone_attrib;
-layout(location=7) in vec4 weight_attrib;
+layout(location = 6) in ivec4 bone_attrib;
+layout(location = 7) in vec4 weight_attrib;
#endif
/* BLEND ATTRIBS */
#ifdef ENABLE_BLEND
-layout(location=8) in highp VFORMAT vertex_attrib_blend;
-layout(location=9) in vec3 normal_attrib_blend;
+layout(location = 8) in highp VFORMAT vertex_attrib_blend;
+layout(location = 9) in vec3 normal_attrib_blend;
#ifdef ENABLE_TANGENT
-layout(location=10) in vec4 tangent_attrib_blend;
+layout(location = 10) in vec4 tangent_attrib_blend;
#endif
#ifdef ENABLE_COLOR
-layout(location=11) in vec4 color_attrib_blend;
+layout(location = 11) in vec4 color_attrib_blend;
#endif
#ifdef ENABLE_UV
-layout(location=12) in vec2 uv_attrib_blend;
+layout(location = 12) in vec2 uv_attrib_blend;
#endif
#ifdef ENABLE_UV2
-layout(location=13) in vec2 uv2_attrib_blend;
+layout(location = 13) in vec2 uv2_attrib_blend;
#endif
#ifdef ENABLE_SKELETON
-layout(location=14) in ivec4 bone_attrib_blend;
-layout(location=15) in vec4 weight_attrib_blend;
+layout(location = 14) in ivec4 bone_attrib_blend;
+layout(location = 15) in vec4 weight_attrib_blend;
#endif
#endif
@@ -110,7 +111,6 @@ uniform float blend_amount;
void main() {
-
#ifdef ENABLE_BLEND
vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount;
@@ -140,7 +140,6 @@ void main() {
uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount;
#endif
-
#ifdef ENABLE_SKELETON
bone_out = bone_attrib_blend;
@@ -149,7 +148,6 @@ void main() {
#else //ENABLE_BLEND
-
vertex_out = vertex_attrib * blend_amount;
#ifdef ENABLE_NORMAL
@@ -177,7 +175,6 @@ void main() {
uv2_out = uv2_attrib * blend_amount;
#endif
-
#ifdef ENABLE_SKELETON
bone_out = bone_attrib;
@@ -188,10 +185,10 @@ void main() {
gl_Position = vec4(0.0);
}
+/* clang-format off */
[fragment]
-
void main() {
}
-
+/* clang-format on */
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index e7828d265c..53f563303a 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -1,12 +1,13 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec2 vertex;
-layout(location=3) in vec4 color_attrib;
+layout(location = 0) in highp vec2 vertex;
+/* clang-format on */
+layout(location = 3) in vec4 color_attrib;
#ifdef USE_SKELETON
-layout(location=6) in uvec4 bone_indices; // attrib:6
-layout(location=7) in vec4 bone_weights; // attrib:7
+layout(location = 6) in uvec4 bone_indices; // attrib:6
+layout(location = 7) in vec4 bone_weights; // attrib:7
#endif
#ifdef USE_TEXTURE_RECT
@@ -18,25 +19,24 @@ uniform vec4 src_rect;
#ifdef USE_INSTANCING
-layout(location=8) in highp vec4 instance_xform0;
-layout(location=9) in highp vec4 instance_xform1;
-layout(location=10) in highp vec4 instance_xform2;
-layout(location=11) in lowp vec4 instance_color;
+layout(location = 8) in highp vec4 instance_xform0;
+layout(location = 9) in highp vec4 instance_xform1;
+layout(location = 10) in highp vec4 instance_xform2;
+layout(location = 11) in lowp vec4 instance_color;
#ifdef USE_INSTANCE_CUSTOM
-layout(location=12) in highp vec4 instance_custom_data;
+layout(location = 12) in highp vec4 instance_custom_data;
#endif
#endif
-layout(location=4) in highp vec2 uv_attrib;
+layout(location = 4) in highp vec2 uv_attrib;
-//skeletn
+// skeleton
#endif
uniform highp vec2 color_texpixel_size;
-
layout(std140) uniform CanvasItemData { //ubo:0
highp mat4 projection_matrix;
@@ -46,7 +46,6 @@ layout(std140) uniform CanvasItemData { //ubo:0
uniform highp mat4 modelview_matrix;
uniform highp mat4 extra_matrix;
-
out highp vec2 uv_interp;
out mediump vec4 color_interp;
@@ -55,7 +54,6 @@ out mediump vec4 color_interp;
out highp vec2 pixel_size_interp;
#endif
-
#ifdef USE_SKELETON
uniform mediump sampler2D skeleton_texture; // texunit:-1
uniform highp mat4 skeleton_transform;
@@ -66,7 +64,7 @@ uniform highp mat4 skeleton_transform_inverse;
layout(std140) uniform LightData { //ubo:1
- //light matrices
+ // light matrices
highp mat4 light_matrix;
highp mat4 light_local_matrix;
highp mat4 shadow_matrix;
@@ -80,11 +78,9 @@ layout(std140) uniform LightData { //ubo:1
highp float shadow_distance_mult;
};
-
out vec4 light_uv_interp;
out vec2 transformed_light_uv;
-
out vec4 local_rot;
#ifdef USE_SHADOWS
@@ -101,27 +97,31 @@ uniform int h_frames;
uniform int v_frames;
#endif
-
#if defined(USE_MATERIAL)
+/* clang-format off */
layout(std140) uniform UniformData { //ubo:2
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
void main() {
vec4 color = color_attrib;
#ifdef USE_INSTANCING
- mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0)));
- color*=instance_color;
+ mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0)));
+ color *= instance_color;
vec4 instance_custom = instance_custom_data;
#else
@@ -136,41 +136,40 @@ void main() {
} else {
uv_interp = src_rect.xy + abs(src_rect.zw) * vertex;
}
- highp vec4 outvec = vec4(dst_rect.xy + abs(dst_rect.zw) * mix(vertex,vec2(1.0,1.0)-vertex,lessThan(src_rect.zw,vec2(0.0,0.0))),0.0,1.0);
+ highp vec4 outvec = vec4(dst_rect.xy + abs(dst_rect.zw) * mix(vertex, vec2(1.0, 1.0) - vertex, lessThan(src_rect.zw, vec2(0.0, 0.0))), 0.0, 1.0);
#else
uv_interp = uv_attrib;
- highp vec4 outvec = vec4(vertex,0.0,1.0);
+ highp vec4 outvec = vec4(vertex, 0.0, 1.0);
#endif
-
#ifdef USE_PARTICLES
//scale by texture size
- outvec.xy/=color_texpixel_size;
+ outvec.xy /= color_texpixel_size;
//compute h and v frames and adjust UV interp for animation
int total_frames = h_frames * v_frames;
- int frame = min(int(float(total_frames) *instance_custom.z),total_frames-1);
- float frame_w = 1.0/float(h_frames);
- float frame_h = 1.0/float(v_frames);
+ int frame = min(int(float(total_frames) * instance_custom.z), total_frames - 1);
+ float frame_w = 1.0 / float(h_frames);
+ float frame_h = 1.0 / float(v_frames);
uv_interp.x = uv_interp.x * frame_w + frame_w * float(frame % h_frames);
uv_interp.y = uv_interp.y * frame_h + frame_h * float(frame / h_frames);
#endif
-
#define extra_matrix extra_matrix2
-{
+ {
+ /* clang-format off */
VERTEX_SHADER_CODE
-}
-
+ /* clang-format on */
+ }
#ifdef USE_NINEPATCH
- pixel_size_interp=abs(dst_rect.zw) * vertex;
+ pixel_size_interp = abs(dst_rect.zw) * vertex;
#endif
#if !defined(SKIP_TRANSFORM_USED)
@@ -184,47 +183,46 @@ VERTEX_SHADER_CODE
#ifdef USE_PIXEL_SNAP
- outvec.xy=floor(outvec+0.5).xy;
+ outvec.xy = floor(outvec + 0.5).xy;
#endif
-
#ifdef USE_SKELETON
- if (bone_weights!=vec4(0.0)){ //must be a valid bone
+ if (bone_weights != vec4(0.0)) { //must be a valid bone
//skeleton transform
ivec4 bone_indicesi = ivec4(bone_indices);
- ivec2 tex_ofs = ivec2( bone_indicesi.x%256, (bone_indicesi.x/256)*2 );
+ ivec2 tex_ofs = ivec2(bone_indicesi.x % 256, (bone_indicesi.x / 256) * 2);
- highp mat2x4 m = mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.x;
+ highp mat2x4 m;
+ m = mat2x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+ bone_weights.x;
- tex_ofs = ivec2( bone_indicesi.y%256, (bone_indicesi.y/256)*2 );
+ tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 2);
- m+= mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.y;
+ m += mat2x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+ bone_weights.y;
- tex_ofs = ivec2( bone_indicesi.z%256, (bone_indicesi.z/256)*2 );
+ tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 2);
- m+= mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.z;
+ m += mat2x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+ bone_weights.z;
+ tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 2);
- tex_ofs = ivec2( bone_indicesi.w%256, (bone_indicesi.w/256)*2 );
+ m += mat2x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+ bone_weights.w;
- m+= mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.w;
-
- mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0],m[1],vec4(0.0,0.0,1.0,0.0),vec4(0.0,0.0,0.0,1.0))) * skeleton_transform_inverse;
+ mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))) * skeleton_transform_inverse;
outvec = bone_matrix * outvec;
}
@@ -236,45 +234,39 @@ VERTEX_SHADER_CODE
#ifdef USE_LIGHTING
light_uv_interp.xy = (light_matrix * outvec).xy;
- light_uv_interp.zw =(light_local_matrix * outvec).xy;
+ light_uv_interp.zw = (light_local_matrix * outvec).xy;
mat3 inverse_light_matrix = mat3(inverse(light_matrix));
inverse_light_matrix[0] = normalize(inverse_light_matrix[0]);
inverse_light_matrix[1] = normalize(inverse_light_matrix[1]);
inverse_light_matrix[2] = normalize(inverse_light_matrix[2]);
- transformed_light_uv = (inverse_light_matrix * vec3(light_uv_interp.zw,0.0)).xy; //for normal mapping
+ transformed_light_uv = (inverse_light_matrix * vec3(light_uv_interp.zw, 0.0)).xy; //for normal mapping
#ifdef USE_SHADOWS
- pos=outvec.xy;
+ pos = outvec.xy;
#endif
-
- local_rot.xy=normalize( (modelview_matrix * ( extra_matrix * vec4(1.0,0.0,0.0,0.0) )).xy );
- local_rot.zw=normalize( (modelview_matrix * ( extra_matrix * vec4(0.0,1.0,0.0,0.0) )).xy );
+ local_rot.xy = normalize((modelview_matrix * (extra_matrix * vec4(1.0, 0.0, 0.0, 0.0))).xy);
+ local_rot.zw = normalize((modelview_matrix * (extra_matrix * vec4(0.0, 1.0, 0.0, 0.0))).xy);
#ifdef USE_TEXTURE_RECT
- local_rot.xy*=sign(src_rect.z);
- local_rot.zw*=sign(src_rect.w);
+ local_rot.xy *= sign(src_rect.z);
+ local_rot.zw *= sign(src_rect.w);
#endif
-
-
#endif
-
}
+/* clang-format off */
[fragment]
-
-
uniform mediump sampler2D color_texture; // texunit:0
+/* clang-format on */
uniform highp vec2 color_texpixel_size;
uniform mediump sampler2D normal_texture; // texunit:1
-
in highp vec2 uv_interp;
in mediump vec4 color_interp;
-
#if defined(SCREEN_TEXTURE_USED)
uniform sampler2D screen_texture; // texunit:-3
@@ -292,7 +284,6 @@ layout(std140) uniform CanvasItemData {
highp float time;
};
-
#ifdef USE_LIGHTING
layout(std140) uniform LightData {
@@ -314,10 +305,8 @@ uniform lowp sampler2D light_texture; // texunit:-1
in vec4 light_uv_interp;
in vec2 transformed_light_uv;
-
in vec4 local_rot;
-
#ifdef USE_SHADOWS
uniform highp sampler2D shadow_texture; // texunit:-2
@@ -332,44 +321,49 @@ const bool at_light_pass = false;
uniform mediump vec4 final_modulate;
-
-
-
-layout(location=0) out mediump vec4 frag_color;
-
+layout(location = 0) out mediump vec4 frag_color;
#if defined(USE_MATERIAL)
+/* clang-format off */
layout(std140) uniform UniformData {
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
+
FRAGMENT_SHADER_GLOBALS
+/* clang-format on */
+
void light_compute(
- inout vec4 light,
- inout vec2 light_vec,
- inout float light_height,
- inout vec4 light_color,
- vec2 light_uv,
- inout vec4 shadow_color,
- vec3 normal,
- vec2 uv,
+ inout vec4 light,
+ inout vec2 light_vec,
+ inout float light_height,
+ inout vec4 light_color,
+ vec2 light_uv,
+ inout vec4 shadow_color,
+ vec3 normal,
+ vec2 uv,
#if defined(SCREEN_UV_USED)
- vec2 screen_uv,
+ vec2 screen_uv,
#endif
- vec4 color) {
+ vec4 color) {
#if defined(USE_LIGHT_SHADER_CODE)
+ /* clang-format off */
+
LIGHT_SHADER_CODE
-#endif
+ /* clang-format on */
+#endif
}
#ifdef USE_TEXTURE_RECT
@@ -385,48 +379,44 @@ in highp vec2 pixel_size_interp;
uniform int np_repeat_v;
uniform int np_repeat_h;
uniform bool np_draw_center;
-//left top right bottom in pixel coordinates
+// left top right bottom in pixel coordinates
uniform vec4 np_margins;
+float map_ninepatch_axis(float pixel, float draw_size, float tex_pixel_size, float margin_begin, float margin_end, int np_repeat, inout int draw_center) {
-
-float map_ninepatch_axis(float pixel, float draw_size,float tex_pixel_size,float margin_begin,float margin_end,int np_repeat,inout int draw_center) {
-
-
- float tex_size = 1.0/tex_pixel_size;
+ float tex_size = 1.0 / tex_pixel_size;
if (pixel < margin_begin) {
return pixel * tex_pixel_size;
- } else if (pixel >= draw_size-margin_end) {
- return (tex_size-(draw_size-pixel)) * tex_pixel_size;
+ } else if (pixel >= draw_size - margin_end) {
+ return (tex_size - (draw_size - pixel)) * tex_pixel_size;
} else {
- if (!np_draw_center){
+ if (!np_draw_center) {
draw_center--;
}
- if (np_repeat==0) { //stretch
+ if (np_repeat == 0) { //stretch
//convert to ratio
float ratio = (pixel - margin_begin) / (draw_size - margin_begin - margin_end);
//scale to source texture
return (margin_begin + ratio * (tex_size - margin_begin - margin_end)) * tex_pixel_size;
- } else if (np_repeat==1) { //tile
+ } else if (np_repeat == 1) { //tile
//convert to ratio
float ofs = mod((pixel - margin_begin), tex_size - margin_begin - margin_end);
//scale to source texture
return (margin_begin + ofs) * tex_pixel_size;
- } else if (np_repeat==2) { //tile fit
+ } else if (np_repeat == 2) { //tile fit
//convert to ratio
float src_area = draw_size - margin_begin - margin_end;
float dst_area = tex_size - margin_begin - margin_end;
- float scale = max(1.0,floor(src_area / max(dst_area,0.0000001) + 0.5));
+ float scale = max(1.0, floor(src_area / max(dst_area, 0.0000001) + 0.5));
//convert to ratio
float ratio = (pixel - margin_begin) / src_area;
- ratio = mod(ratio * scale,1.0);
+ ratio = mod(ratio * scale, 1.0);
return (margin_begin + ratio * dst_area) * tex_pixel_size;
}
}
-
}
#endif
@@ -443,42 +433,39 @@ void main() {
#ifdef USE_NINEPATCH
- int draw_center=2;
+ int draw_center = 2;
uv = vec2(
- map_ninepatch_axis(pixel_size_interp.x,abs(dst_rect.z),color_texpixel_size.x,np_margins.x,np_margins.z,np_repeat_h,draw_center),
- map_ninepatch_axis(pixel_size_interp.y,abs(dst_rect.w),color_texpixel_size.y,np_margins.y,np_margins.w,np_repeat_v,draw_center)
- );
+ map_ninepatch_axis(pixel_size_interp.x, abs(dst_rect.z), color_texpixel_size.x, np_margins.x, np_margins.z, np_repeat_h, draw_center),
+ map_ninepatch_axis(pixel_size_interp.y, abs(dst_rect.w), color_texpixel_size.y, np_margins.y, np_margins.w, np_repeat_v, draw_center));
- if (draw_center==0) {
- color.a=0.0;
+ if (draw_center == 0) {
+ color.a = 0.0;
}
- uv = uv*src_rect.zw+src_rect.xy; //apply region if needed
+ uv = uv * src_rect.zw + src_rect.xy; //apply region if needed
#endif
if (clip_rect_uv) {
- uv = clamp(uv,src_rect.xy,src_rect.xy+abs(src_rect.zw));
+ uv = clamp(uv, src_rect.xy, src_rect.xy + abs(src_rect.zw));
}
#endif
#if !defined(COLOR_USED)
-//default behavior, texture by color
+ //default behavior, texture by color
#ifdef USE_DISTANCE_FIELD
- const float smoothing = 1.0/32.0;
- float distance = textureLod(color_texture, uv,0.0).a;
+ const float smoothing = 1.0 / 32.0;
+ float distance = textureLod(color_texture, uv, 0.0).a;
color.a = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance) * color.a;
#else
- color *= texture( color_texture, uv );
+ color *= texture(color_texture, uv);
#endif
#endif
-
-
vec3 normal;
#if defined(NORMAL_USED)
@@ -489,59 +476,56 @@ void main() {
#endif
if (use_default_normal) {
- normal.xy = textureLod(normal_texture, uv,0.0).xy * 2.0 - 1.0;
- normal.z = sqrt(1.0-dot(normal.xy,normal.xy));
- normal_used=true;
+ normal.xy = textureLod(normal_texture, uv, 0.0).xy * 2.0 - 1.0;
+ normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
+ normal_used = true;
} else {
- normal = vec3(0.0,0.0,1.0);
+ normal = vec3(0.0, 0.0, 1.0);
}
-
-
#if defined(SCREEN_UV_USED)
- vec2 screen_uv = gl_FragCoord.xy*screen_pixel_size;
+ vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
-
-{
- float normal_depth=1.0;
+ {
+ float normal_depth = 1.0;
#if defined(NORMALMAP_USED)
- vec3 normal_map=vec3(0.0,0.0,1.0);
+ vec3 normal_map = vec3(0.0, 0.0, 1.0);
#endif
+ /* clang-format off */
+
FRAGMENT_SHADER_CODE
+ /* clang-format on */
+
#if defined(NORMALMAP_USED)
- normal = mix(vec3(0.0,0.0,1.0), normal_map * vec3(2.0,-2.0,1.0) - vec3( 1.0, -1.0, 0.0 ), normal_depth );
+ normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth);
#endif
-
-}
+ }
#ifdef DEBUG_ENCODED_32
- highp float enc32 = dot( color,highp vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) );
- color = vec4(vec3(enc32),1.0);
+ highp float enc32 = dot(color, highp vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1));
+ color = vec4(vec3(enc32), 1.0);
#endif
-
- color*=final_modulate;
-
-
+ color *= final_modulate;
#ifdef USE_LIGHTING
vec2 light_vec = transformed_light_uv;
if (normal_used) {
- normal.xy = mat2(local_rot.xy,local_rot.zw) * normal.xy;
+ normal.xy = mat2(local_rot.xy, local_rot.zw) * normal.xy;
}
- float att=1.0;
+ float att = 1.0;
vec2 light_uv = light_uv_interp.xy;
- vec4 light = texture(light_texture,light_uv);
+ vec4 light = texture(light_texture, light_uv);
- if (any(lessThan(light_uv_interp.xy,vec2(0.0,0.0))) || any(greaterThanEqual(light_uv_interp.xy,vec2(1.0,1.0)))) {
- color.a*=light_outside_alpha; //invisible
+ if (any(lessThan(light_uv_interp.xy, vec2(0.0, 0.0))) || any(greaterThanEqual(light_uv_interp.xy, vec2(1.0, 1.0)))) {
+ color.a *= light_outside_alpha; //invisible
} else {
float real_light_height = light_height;
@@ -549,178 +533,176 @@ FRAGMENT_SHADER_CODE
vec4 real_light_shadow_color = light_shadow_color;
#if defined(USE_LIGHT_SHADER_CODE)
-//light is written by the light shader
+ //light is written by the light shader
light_compute(
- light,
- light_vec,
- real_light_height,
- real_light_color,
- light_uv,
- real_light_shadow_color,
- normal,
- uv,
+ light,
+ light_vec,
+ real_light_height,
+ real_light_color,
+ light_uv,
+ real_light_shadow_color,
+ normal,
+ uv,
#if defined(SCREEN_UV_USED)
- screen_uv,
+ screen_uv,
#endif
- color);
+ color);
#endif
light *= real_light_color;
if (normal_used) {
- vec3 light_normal = normalize(vec3(light_vec,-real_light_height));
- light*=max(dot(-light_normal,normal),0.0);
+ vec3 light_normal = normalize(vec3(light_vec, -real_light_height));
+ light *= max(dot(-light_normal, normal), 0.0);
}
- color*=light;
+ color *= light;
#ifdef USE_SHADOWS
light_vec = light_uv_interp.zw; //for shadows
- float angle_to_light = -atan(light_vec.x,light_vec.y);
+ float angle_to_light = -atan(light_vec.x, light_vec.y);
float PI = 3.14159265358979323846264;
/*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays
float ang*/
- float su,sz;
+ float su, sz;
float abs_angle = abs(angle_to_light);
vec2 point;
float sh;
- if (abs_angle<45.0*PI/180.0) {
+ if (abs_angle < 45.0 * PI / 180.0) {
point = light_vec;
- sh=0.0+(1.0/8.0);
- } else if (abs_angle>135.0*PI/180.0) {
+ sh = 0.0 + (1.0 / 8.0);
+ } else if (abs_angle > 135.0 * PI / 180.0) {
point = -light_vec;
- sh = 0.5+(1.0/8.0);
- } else if (angle_to_light>0.0) {
+ sh = 0.5 + (1.0 / 8.0);
+ } else if (angle_to_light > 0.0) {
- point = vec2(light_vec.y,-light_vec.x);
- sh = 0.25+(1.0/8.0);
+ point = vec2(light_vec.y, -light_vec.x);
+ sh = 0.25 + (1.0 / 8.0);
} else {
- point = vec2(-light_vec.y,light_vec.x);
- sh = 0.75+(1.0/8.0);
-
+ point = vec2(-light_vec.y, light_vec.x);
+ sh = 0.75 + (1.0 / 8.0);
}
-
- highp vec4 s = shadow_matrix * vec4(point,0.0,1.0);
- s.xyz/=s.w;
- su=s.x*0.5+0.5;
- sz=s.z*0.5+0.5;
+ highp vec4 s = shadow_matrix * vec4(point, 0.0, 1.0);
+ s.xyz /= s.w;
+ su = s.x * 0.5 + 0.5;
+ sz = s.z * 0.5 + 0.5;
//sz=lightlength(light_vec);
- highp float shadow_attenuation=0.0;
+ highp float shadow_attenuation = 0.0;
#ifdef USE_RGBA_SHADOWS
-#define SHADOW_DEPTH(m_tex,m_uv) dot(texture((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) )
+#define SHADOW_DEPTH(m_tex, m_uv) dot(texture((m_tex), (m_uv)), vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1))
#else
-#define SHADOW_DEPTH(m_tex,m_uv) (texture((m_tex),(m_uv)).r)
+#define SHADOW_DEPTH(m_tex, m_uv) (texture((m_tex), (m_uv)).r)
#endif
-
-
#ifdef SHADOW_USE_GRADIENT
-#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=1.0-smoothstep(sd,sd+shadow_gradient,sz); }
+#define SHADOW_TEST(m_ofs) \
+ { \
+ highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
+ shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); \
+ }
#else
-#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=step(sz,sd); }
+#define SHADOW_TEST(m_ofs) \
+ { \
+ highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
+ shadow_attenuation += step(sz, sd); \
+ }
#endif
-
#ifdef SHADOW_FILTER_NEAREST
SHADOW_TEST(su);
#endif
-
#ifdef SHADOW_FILTER_PCF3
- SHADOW_TEST(su+shadowpixel_size);
+ SHADOW_TEST(su + shadowpixel_size);
SHADOW_TEST(su);
- SHADOW_TEST(su-shadowpixel_size);
- shadow_attenuation/=3.0;
+ SHADOW_TEST(su - shadowpixel_size);
+ shadow_attenuation /= 3.0;
#endif
-
#ifdef SHADOW_FILTER_PCF5
- SHADOW_TEST(su+shadowpixel_size*2.0);
- SHADOW_TEST(su+shadowpixel_size);
+ SHADOW_TEST(su + shadowpixel_size * 2.0);
+ SHADOW_TEST(su + shadowpixel_size);
SHADOW_TEST(su);
- SHADOW_TEST(su-shadowpixel_size);
- SHADOW_TEST(su-shadowpixel_size*2.0);
- shadow_attenuation/=5.0;
+ SHADOW_TEST(su - shadowpixel_size);
+ SHADOW_TEST(su - shadowpixel_size * 2.0);
+ shadow_attenuation /= 5.0;
#endif
-
#ifdef SHADOW_FILTER_PCF7
- SHADOW_TEST(su+shadowpixel_size*3.0);
- SHADOW_TEST(su+shadowpixel_size*2.0);
- SHADOW_TEST(su+shadowpixel_size);
+ SHADOW_TEST(su + shadowpixel_size * 3.0);
+ SHADOW_TEST(su + shadowpixel_size * 2.0);
+ SHADOW_TEST(su + shadowpixel_size);
SHADOW_TEST(su);
- SHADOW_TEST(su-shadowpixel_size);
- SHADOW_TEST(su-shadowpixel_size*2.0);
- SHADOW_TEST(su-shadowpixel_size*3.0);
- shadow_attenuation/=7.0;
+ SHADOW_TEST(su - shadowpixel_size);
+ SHADOW_TEST(su - shadowpixel_size * 2.0);
+ SHADOW_TEST(su - shadowpixel_size * 3.0);
+ shadow_attenuation /= 7.0;
#endif
-
#ifdef SHADOW_FILTER_PCF9
- SHADOW_TEST(su+shadowpixel_size*4.0);
- SHADOW_TEST(su+shadowpixel_size*3.0);
- SHADOW_TEST(su+shadowpixel_size*2.0);
- SHADOW_TEST(su+shadowpixel_size);
+ SHADOW_TEST(su + shadowpixel_size * 4.0);
+ SHADOW_TEST(su + shadowpixel_size * 3.0);
+ SHADOW_TEST(su + shadowpixel_size * 2.0);
+ SHADOW_TEST(su + shadowpixel_size);
SHADOW_TEST(su);
- SHADOW_TEST(su-shadowpixel_size);
- SHADOW_TEST(su-shadowpixel_size*2.0);
- SHADOW_TEST(su-shadowpixel_size*3.0);
- SHADOW_TEST(su-shadowpixel_size*4.0);
- shadow_attenuation/=9.0;
+ SHADOW_TEST(su - shadowpixel_size);
+ SHADOW_TEST(su - shadowpixel_size * 2.0);
+ SHADOW_TEST(su - shadowpixel_size * 3.0);
+ SHADOW_TEST(su - shadowpixel_size * 4.0);
+ shadow_attenuation /= 9.0;
#endif
#ifdef SHADOW_FILTER_PCF13
- SHADOW_TEST(su+shadowpixel_size*6.0);
- SHADOW_TEST(su+shadowpixel_size*5.0);
- SHADOW_TEST(su+shadowpixel_size*4.0);
- SHADOW_TEST(su+shadowpixel_size*3.0);
- SHADOW_TEST(su+shadowpixel_size*2.0);
- SHADOW_TEST(su+shadowpixel_size);
+ SHADOW_TEST(su + shadowpixel_size * 6.0);
+ SHADOW_TEST(su + shadowpixel_size * 5.0);
+ SHADOW_TEST(su + shadowpixel_size * 4.0);
+ SHADOW_TEST(su + shadowpixel_size * 3.0);
+ SHADOW_TEST(su + shadowpixel_size * 2.0);
+ SHADOW_TEST(su + shadowpixel_size);
SHADOW_TEST(su);
- SHADOW_TEST(su-shadowpixel_size);
- SHADOW_TEST(su-shadowpixel_size*2.0);
- SHADOW_TEST(su-shadowpixel_size*3.0);
- SHADOW_TEST(su-shadowpixel_size*4.0);
- SHADOW_TEST(su-shadowpixel_size*5.0);
- SHADOW_TEST(su-shadowpixel_size*6.0);
- shadow_attenuation/=13.0;
+ SHADOW_TEST(su - shadowpixel_size);
+ SHADOW_TEST(su - shadowpixel_size * 2.0);
+ SHADOW_TEST(su - shadowpixel_size * 3.0);
+ SHADOW_TEST(su - shadowpixel_size * 4.0);
+ SHADOW_TEST(su - shadowpixel_size * 5.0);
+ SHADOW_TEST(su - shadowpixel_size * 6.0);
+ shadow_attenuation /= 13.0;
#endif
- //color*=shadow_attenuation;
- color=mix(real_light_shadow_color,color,shadow_attenuation);
+ //color *= shadow_attenuation;
+ color = mix(real_light_shadow_color, color, shadow_attenuation);
//use shadows
#endif
}
//use lighting
#endif
- //color.rgb*=color.a;
+ //color.rgb *= color.a;
frag_color = color;
-
}
diff --git a/drivers/gles3/shaders/canvas_shadow.glsl b/drivers/gles3/shaders/canvas_shadow.glsl
index c757990de0..68d0713385 100644
--- a/drivers/gles3/shaders/canvas_shadow.glsl
+++ b/drivers/gles3/shaders/canvas_shadow.glsl
@@ -1,49 +1,45 @@
+/* clang-format off */
[vertex]
-
-
uniform highp mat4 projection_matrix;
+/* clang-format on */
uniform highp mat4 light_matrix;
uniform highp mat4 world_matrix;
uniform highp float distance_norm;
-layout(location=0) in highp vec3 vertex;
+layout(location = 0) in highp vec3 vertex;
out highp vec4 position_interp;
void main() {
- gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0)));
- position_interp=gl_Position;
+ gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0)));
+ position_interp = gl_Position;
}
+/* clang-format off */
[fragment]
in highp vec4 position_interp;
+/* clang-format on */
#ifdef USE_RGBA_SHADOWS
-
-layout(location=0) out lowp vec4 distance_buf;
-
+layout(location = 0) out lowp vec4 distance_buf;
#else
-
-layout(location=0) out highp float distance_buf;
-
+layout(location = 0) out highp float distance_buf;
#endif
void main() {
- highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias;
+ highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
#ifdef USE_RGBA_SHADOWS
highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
- distance_buf=comp;
+ distance_buf = comp;
#else
- distance_buf=depth;
-
+ distance_buf = depth;
#endif
}
-
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl
index 1b7c626d3c..a5637537d2 100644
--- a/drivers/gles3/shaders/copy.glsl
+++ b/drivers/gles3/shaders/copy.glsl
@@ -1,13 +1,14 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
-layout(location=4) in vec3 cube_in;
+layout(location = 4) in vec3 cube_in;
#else
-layout(location=4) in vec2 uv_in;
+layout(location = 4) in vec2 uv_in;
#endif
-layout(location=5) in vec2 uv2_in;
+layout(location = 5) in vec2 uv2_in;
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
out vec3 cube_interp;
@@ -32,7 +33,7 @@ void main() {
#else
uv_interp = uv_in;
#ifdef V_FLIP
- uv_interp.y = 1.0-uv_interp.y;
+ uv_interp.y = 1.0 - uv_interp.y;
#endif
#endif
@@ -44,9 +45,9 @@ void main() {
uv_interp = copy_section.xy + uv_interp * copy_section.zw;
gl_Position.xy = (copy_section.xy + (gl_Position.xy * 0.5 + 0.5) * copy_section.zw) * 2.0 - 1.0;
#endif
-
}
+/* clang-format off */
[fragment]
#define M_PI 3.14159265359
@@ -60,6 +61,7 @@ in vec3 cube_interp;
#else
in vec2 uv_interp;
#endif
+/* clang-format on */
#ifdef USE_ASYM_PANO
uniform highp mat4 pano_transform;
@@ -72,38 +74,33 @@ uniform samplerCube source_cube; //texunit:0
uniform sampler2D source; //texunit:0
#endif
-
#ifdef USE_MULTIPLIER
uniform float multiplier;
#endif
#if defined(USE_PANORAMA) || defined(USE_ASYM_PANO)
-vec4 texturePanorama(vec3 normal,sampler2D pano ) {
+vec4 texturePanorama(vec3 normal, sampler2D pano) {
vec2 st = vec2(
- atan(normal.x, normal.z),
- acos(normal.y)
- );
-
- if(st.x < 0.0)
- st.x += M_PI*2.0;
+ atan(normal.x, normal.z),
+ acos(normal.y));
- st/=vec2(M_PI*2.0,M_PI);
+ if (st.x < 0.0)
+ st.x += M_PI * 2.0;
- return textureLod(pano,st,0.0);
+ st /= vec2(M_PI * 2.0, M_PI);
+ return textureLod(pano, st, 0.0);
}
#endif
-
uniform float stuff;
uniform vec2 pixel_size;
in vec2 uv2_interp;
-
#ifdef USE_BCS
uniform vec3 bcs;
@@ -118,20 +115,17 @@ uniform sampler2D color_correction; //texunit:1
layout(location = 0) out vec4 frag_color;
-
-
-
void main() {
//vec4 color = color_interp;
#ifdef USE_PANORAMA
- vec4 color = texturePanorama( normalize(cube_interp), source );
+ vec4 color = texturePanorama(normalize(cube_interp), source);
#elif defined(USE_ASYM_PANO)
- // When an asymmetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result.
+ // When an asymmetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result.
// Note that we're ignoring the x-offset for IPD, with Z sufficiently in the distance it becomes neglectible, as a result we could probably just set cube_normal.z to -1.
// The Matrix[2][0] (= asym_proj.x) and Matrix[2][1] (= asym_proj.z) values are what provide the right shift in the image.
@@ -142,72 +136,68 @@ void main() {
cube_normal = mat3(pano_transform) * cube_normal;
cube_normal.z = -cube_normal.z;
- vec4 color = texturePanorama( normalize(cube_normal.xyz), source );
+ vec4 color = texturePanorama(normalize(cube_normal.xyz), source);
#elif defined(USE_CUBEMAP)
- vec4 color = texture( source_cube, normalize(cube_interp) );
+ vec4 color = texture(source_cube, normalize(cube_interp));
#else
- vec4 color = textureLod( source, uv_interp,0.0 );
+ vec4 color = textureLod(source, uv_interp, 0.0);
#endif
-
-
#ifdef LINEAR_TO_SRGB
//regular Linear -> SRGB conversion
vec3 a = vec3(0.055);
- color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308)));
+ color.rgb = mix((vec3(1.0) + a) * pow(color.rgb, vec3(1.0 / 2.4)) - a, 12.92 * color.rgb, lessThan(color.rgb, vec3(0.0031308)));
#endif
#ifdef SRGB_TO_LINEAR
- color.rgb = mix(pow((color.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)),vec3(2.4)),color.rgb * (1.0 / 12.92),lessThan(color.rgb,vec3(0.04045)));
+ color.rgb = mix(pow((color.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), color.rgb * (1.0 / 12.92), lessThan(color.rgb, vec3(0.04045)));
#endif
#ifdef DEBUG_GRADIENT
- color.rg=uv_interp;
- color.b=0.0;
+ color.rg = uv_interp;
+ color.b = 0.0;
#endif
#ifdef DISABLE_ALPHA
- color.a=1.0;
+ color.a = 1.0;
#endif
-
#ifdef GAUSSIAN_HORIZONTAL
- color*=0.38774;
- color+=texture( source, uv_interp+vec2( 1.0, 0.0)*pixel_size )*0.24477;
- color+=texture( source, uv_interp+vec2( 2.0, 0.0)*pixel_size )*0.06136;
- color+=texture( source, uv_interp+vec2(-1.0, 0.0)*pixel_size )*0.24477;
- color+=texture( source, uv_interp+vec2(-2.0, 0.0)*pixel_size )*0.06136;
+ color *= 0.38774;
+ color += texture(source, uv_interp + vec2(1.0, 0.0) * pixel_size) * 0.24477;
+ color += texture(source, uv_interp + vec2(2.0, 0.0) * pixel_size) * 0.06136;
+ color += texture(source, uv_interp + vec2(-1.0, 0.0) * pixel_size) * 0.24477;
+ color += texture(source, uv_interp + vec2(-2.0, 0.0) * pixel_size) * 0.06136;
#endif
#ifdef GAUSSIAN_VERTICAL
- color*=0.38774;
- color+=texture( source, uv_interp+vec2( 0.0, 1.0)*pixel_size )*0.24477;
- color+=texture( source, uv_interp+vec2( 0.0, 2.0)*pixel_size )*0.06136;
- color+=texture( source, uv_interp+vec2( 0.0,-1.0)*pixel_size )*0.24477;
- color+=texture( source, uv_interp+vec2( 0.0,-2.0)*pixel_size )*0.06136;
+ color *= 0.38774;
+ color += texture(source, uv_interp + vec2(0.0, 1.0) * pixel_size) * 0.24477;
+ color += texture(source, uv_interp + vec2(0.0, 2.0) * pixel_size) * 0.06136;
+ color += texture(source, uv_interp + vec2(0.0, -1.0) * pixel_size) * 0.24477;
+ color += texture(source, uv_interp + vec2(0.0, -2.0) * pixel_size) * 0.06136;
#endif
#ifdef USE_BCS
- color.rgb = mix(vec3(0.0),color.rgb,bcs.x);
- color.rgb = mix(vec3(0.5),color.rgb,bcs.y);
- color.rgb = mix(vec3(dot(vec3(1.0),color.rgb)*0.33333),color.rgb,bcs.z);
+ color.rgb = mix(vec3(0.0), color.rgb, bcs.x);
+ color.rgb = mix(vec3(0.5), color.rgb, bcs.y);
+ color.rgb = mix(vec3(dot(vec3(1.0), color.rgb) * 0.33333), color.rgb, bcs.z);
#endif
#ifdef USE_COLOR_CORRECTION
- color.r = texture(color_correction,vec2(color.r,0.0)).r;
- color.g = texture(color_correction,vec2(color.g,0.0)).g;
- color.b = texture(color_correction,vec2(color.b,0.0)).b;
+ color.r = texture(color_correction, vec2(color.r, 0.0)).r;
+ color.g = texture(color_correction, vec2(color.g, 0.0)).g;
+ color.b = texture(color_correction, vec2(color.b, 0.0)).b;
#endif
#ifdef USE_MULTIPLIER
- color.rgb*=multiplier;
+ color.rgb *= multiplier;
#endif
frag_color = color;
}
-
diff --git a/drivers/gles3/shaders/cube_to_dp.glsl b/drivers/gles3/shaders/cube_to_dp.glsl
index 5ffc78c0b9..2b74f054f9 100644
--- a/drivers/gles3/shaders/cube_to_dp.glsl
+++ b/drivers/gles3/shaders/cube_to_dp.glsl
@@ -1,8 +1,9 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -12,10 +13,11 @@ void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
-
uniform highp samplerCube source_cube; //texunit:0
+/* clang-format on */
in vec2 uv_interp;
uniform bool z_flip;
@@ -25,55 +27,53 @@ uniform highp float bias;
void main() {
- highp vec3 normal = vec3( uv_interp * 2.0 - 1.0, 0.0 );
-/*
- if(z_flip) {
- normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ highp vec3 normal = vec3(uv_interp * 2.0 - 1.0, 0.0);
+ /*
+ if (z_flip) {
+ normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
} else {
- normal.z = -0.5 + 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ normal.z = -0.5 + 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
}
-*/
+ */
- //normal.z = sqrt(1.0-dot(normal.xy,normal.xy));
- //normal.xy*=1.0+normal.z;
+ //normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
+ //normal.xy *= 1.0 + normal.z;
- normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
+ normal = normalize(normal);
+ /*
+ normal.z = 0.5;
normal = normalize(normal);
+ */
-/*
- normal.z=0.5;
- normal=normalize(normal);
-*/
if (!z_flip) {
- normal.z=-normal.z;
+ normal.z = -normal.z;
}
- //normal = normalize(vec3( uv_interp * 2.0 - 1.0, 1.0 ));
- float depth = texture(source_cube,normal).r;
+ //normal = normalize(vec3(uv_interp * 2.0 - 1.0, 1.0));
+ float depth = texture(source_cube, normal).r;
// absolute values for direction cosines, bigger value equals closer to basis axis
vec3 unorm = abs(normal);
- if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) {
- // x code
- unorm = normal.x > 0.0 ? vec3( 1.0, 0.0, 0.0 ) : vec3( -1.0, 0.0, 0.0 ) ;
- } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) {
- // y code
- unorm = normal.y > 0.0 ? vec3( 0.0, 1.0, 0.0 ) : vec3( 0.0, -1.0, 0.0 ) ;
- } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) {
- // z code
- unorm = normal.z > 0.0 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 0.0, 0.0, -1.0 ) ;
+ if ((unorm.x >= unorm.y) && (unorm.x >= unorm.z)) {
+ // x code
+ unorm = normal.x > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(-1.0, 0.0, 0.0);
+ } else if ((unorm.y > unorm.x) && (unorm.y >= unorm.z)) {
+ // y code
+ unorm = normal.y > 0.0 ? vec3(0.0, 1.0, 0.0) : vec3(0.0, -1.0, 0.0);
+ } else if ((unorm.z > unorm.x) && (unorm.z > unorm.y)) {
+ // z code
+ unorm = normal.z > 0.0 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 0.0, -1.0);
} else {
- // oh-no we messed up code
- // has to be
- unorm = vec3( 1.0, 0.0, 0.0 );
+ // oh-no we messed up code
+ // has to be
+ unorm = vec3(1.0, 0.0, 0.0);
}
- float depth_fix = 1.0 / dot(normal,unorm);
-
+ float depth_fix = 1.0 / dot(normal, unorm);
depth = 2.0 * depth - 1.0;
float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near));
- gl_FragDepth = (linear_depth*depth_fix+bias) / z_far;
+ gl_FragDepth = (linear_depth * depth_fix + bias) / z_far;
}
-
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index 485fbb6ee0..f65f798ff0 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -1,22 +1,24 @@
+/* clang-format off */
[vertex]
+layout(location = 0) in highp vec2 vertex;
+/* clang-format on */
-layout(location=0) in highp vec2 vertex;
-
-layout(location=4) in highp vec2 uv;
+layout(location = 4) in highp vec2 uv;
out highp vec2 uv_interp;
void main() {
- uv_interp=uv;
- gl_Position=vec4(vertex,0,1);
+ uv_interp = uv;
+ gl_Position = vec4(vertex, 0, 1);
}
+/* clang-format off */
[fragment]
-
precision highp float;
+/* clang-format on */
precision highp int;
#ifdef USE_SOURCE_PANORAMA
@@ -36,90 +38,85 @@ uniform int face_id;
uniform float roughness;
in highp vec2 uv_interp;
-
layout(location = 0) out vec4 frag_color;
-
#define M_PI 3.14159265359
-
-vec3 texelCoordToVec(vec2 uv, int faceID)
-{
- mat3 faceUvVectors[6];
-/*
- // -x
- faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z
- faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[1][2] = vec3(-1.0, 0.0, 0.0); // -x face
-
- // +x
- faceUvVectors[0][0] = vec3(0.0, 0.0, -1.0); // u -> -z
- faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[0][2] = vec3(1.0, 0.0, 0.0); // +x face
-
- // -y
- faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[3][1] = vec3(0.0, 0.0, -1.0); // v -> -z
- faceUvVectors[3][2] = vec3(0.0, -1.0, 0.0); // -y face
-
- // +y
- faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[2][1] = vec3(0.0, 0.0, 1.0); // v -> +z
- faceUvVectors[2][2] = vec3(0.0, 1.0, 0.0); // +y face
-
- // -z
- faceUvVectors[5][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
- faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[5][2] = vec3(0.0, 0.0, -1.0); // -z face
-
- // +z
- faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face
-*/
-
- // -x
- faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z
- faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face
-
- // +x
- faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z
- faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face
-
- // -y
- faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z
- faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face
-
- // +y
- faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z
- faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face
-
- // -z
- faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
- faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face
-
- // +z
- faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x
- faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
- faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face
-
- // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2].
- vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2];
- return normalize(result);
+vec3 texelCoordToVec(vec2 uv, int faceID) {
+ mat3 faceUvVectors[6];
+ /*
+ // -x
+ faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z
+ faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[1][2] = vec3(-1.0, 0.0, 0.0); // -x face
+
+ // +x
+ faceUvVectors[0][0] = vec3(0.0, 0.0, -1.0); // u -> -z
+ faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[0][2] = vec3(1.0, 0.0, 0.0); // +x face
+
+ // -y
+ faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[3][1] = vec3(0.0, 0.0, -1.0); // v -> -z
+ faceUvVectors[3][2] = vec3(0.0, -1.0, 0.0); // -y face
+
+ // +y
+ faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[2][1] = vec3(0.0, 0.0, 1.0); // v -> +z
+ faceUvVectors[2][2] = vec3(0.0, 1.0, 0.0); // +y face
+
+ // -z
+ faceUvVectors[5][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
+ faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[5][2] = vec3(0.0, 0.0, -1.0); // -z face
+
+ // +z
+ faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face
+ */
+
+ // -x
+ faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z
+ faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face
+
+ // +x
+ faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z
+ faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face
+
+ // -y
+ faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z
+ faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face
+
+ // +y
+ faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z
+ faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face
+
+ // -z
+ faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
+ faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face
+
+ // +z
+ faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face
+
+ // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2].
+ vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2];
+ return normalize(result);
}
-vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N)
-{
+vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) {
float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph]
// Compute distribution direction
float Phi = 2.0 * M_PI * Xi.x;
- float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));
+ float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y));
float SinTheta = sqrt(1.0 - CosTheta * CosTheta);
// Convert to spherical direction
@@ -137,33 +134,29 @@ vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N)
}
// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
-float GGX(float NdotV, float a)
-{
+float GGX(float NdotV, float a) {
float k = a / 2.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
-float G_Smith(float a, float nDotV, float nDotL)
-{
+float G_Smith(float a, float nDotV, float nDotL) {
return GGX(nDotL, a * a) * GGX(nDotV, a * a);
}
float radicalInverse_VdC(uint bits) {
- bits = (bits << 16u) | (bits >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- return float(bits) * 2.3283064365386963e-10; // / 0x100000000
+ bits = (bits << 16u) | (bits >> 16u);
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+ return float(bits) * 2.3283064365386963e-10; // / 0x100000000
}
vec2 Hammersley(uint i, uint N) {
- return vec2(float(i)/float(N), radicalInverse_VdC(i));
+ return vec2(float(i) / float(N), radicalInverse_VdC(i));
}
-
-
#ifdef LOW_QUALITY
#define SAMPLE_COUNT 64u
@@ -178,37 +171,33 @@ uniform bool z_flip;
#ifdef USE_SOURCE_PANORAMA
-vec4 texturePanorama(vec3 normal,sampler2D pano ) {
+vec4 texturePanorama(vec3 normal, sampler2D pano) {
vec2 st = vec2(
- atan(normal.x, normal.z),
- acos(normal.y)
- );
-
- if(st.x < 0.0)
- st.x += M_PI*2.0;
+ atan(normal.x, normal.z),
+ acos(normal.y));
- st/=vec2(M_PI*2.0,M_PI);
+ if (st.x < 0.0)
+ st.x += M_PI * 2.0;
- return textureLod(pano,st,0.0);
+ st /= vec2(M_PI * 2.0, M_PI);
+ return textureLod(pano, st, 0.0);
}
#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);
- if (norm.z<0.0) {
- norm.y=0.5-norm.y+0.5;
+ 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.0) {
+ norm.y = 0.5 - norm.y + 0.5;
}
- return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index) ), 0.0);
-
+ return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index)), 0.0);
}
#endif
@@ -217,19 +206,18 @@ void main() {
#ifdef USE_DUAL_PARABOLOID
- vec3 N = vec3( uv_interp * 2.0 - 1.0, 0.0 );
- N.z = 0.5 - 0.5*((N.x * N.x) + (N.y * N.y));
+ vec3 N = vec3(uv_interp * 2.0 - 1.0, 0.0);
+ N.z = 0.5 - 0.5 * ((N.x * N.x) + (N.y * N.y));
N = normalize(N);
if (z_flip) {
- N.y=-N.y; //y is flipped to improve blending between both sides
- N.z=-N.z;
+ N.y = -N.y; //y is flipped to improve blending between both sides
+ N.z = -N.z;
}
-
#else
- vec2 uv = (uv_interp * 2.0) - 1.0;
- vec3 N = texelCoordToVec(uv, face_id);
+ vec2 uv = (uv_interp * 2.0) - 1.0;
+ vec3 N = texelCoordToVec(uv, face_id);
#endif
//vec4 color = color_interp;
@@ -237,49 +225,46 @@ void main() {
#ifdef USE_SOURCE_PANORAMA
- frag_color=vec4(texturePanorama(N,source_panorama).rgb,1.0);
+ frag_color = vec4(texturePanorama(N, source_panorama).rgb, 1.0);
#endif
#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
- frag_color=vec4(textureDualParaboloidArray(N).rgb,1.0);
+ frag_color = vec4(textureDualParaboloidArray(N).rgb, 1.0);
#endif
#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
- N.y=-N.y;
- frag_color=vec4(texture(N,source_cube).rgb,1.0);
+ N.y = -N.y;
+ frag_color = vec4(texture(N, source_cube).rgb, 1.0);
#endif
-
-
-
#else
vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);
- for(uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) {
+ for (uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) {
vec2 xi = Hammersley(sampleNum, SAMPLE_COUNT);
- vec3 H = ImportanceSampleGGX( xi, roughness, N );
- vec3 V = N;
- vec3 L = normalize(2.0 * dot( V, H ) * H - V);
+ vec3 H = ImportanceSampleGGX(xi, roughness, N);
+ vec3 V = N;
+ vec3 L = (2.0 * dot(V, H) * H - V);
- float ndotl = clamp(dot(N, L),0.0,1.0);
+ float ndotl = clamp(dot(N, L), 0.0, 1.0);
- if (ndotl>0.0) {
+ if (ndotl > 0.0) {
#ifdef USE_SOURCE_PANORAMA
- sum.rgb += texturePanorama(H,source_panorama).rgb *ndotl;
+ sum.rgb += texturePanorama(L, source_panorama).rgb * ndotl;
#endif
#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
- sum.rgb += textureDualParaboloidArray(H).rgb *ndotl;
+ sum.rgb += textureDualParaboloidArray(L).rgb * ndotl;
#endif
#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
- H.y=-H.y;
- sum.rgb += textureLod(source_cube, H, 0.0).rgb *ndotl;
+ L.y = -L.y;
+ sum.rgb += textureLod(source_cube, L, 0.0).rgb * ndotl;
#endif
sum.a += ndotl;
}
@@ -289,6 +274,4 @@ void main() {
frag_color = vec4(sum.rgb, 1.0);
#endif
-
}
-
diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl
index c8567b4d53..b67d06bc10 100644
--- a/drivers/gles3/shaders/effect_blur.glsl
+++ b/drivers/gles3/shaders/effect_blur.glsl
@@ -1,8 +1,9 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -23,11 +24,13 @@ void main() {
#endif
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
precision mediump float;
#endif
+/* clang-format on */
in vec2 uv_interp;
uniform sampler2D source_color; //texunit:0
@@ -39,7 +42,6 @@ uniform sampler2D source_ssao; //texunit:1
uniform float lod;
uniform vec2 pixel_size;
-
layout(location = 0) out vec4 frag_color;
#ifdef SSAO_MERGE
@@ -48,31 +50,31 @@ uniform vec4 ssao_color;
#endif
-#if defined (GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL)
+#if defined(GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL)
uniform float glow_strength;
#endif
-#if defined(DOF_FAR_BLUR) || defined (DOF_NEAR_BLUR)
+#if defined(DOF_FAR_BLUR) || defined(DOF_NEAR_BLUR)
#ifdef DOF_QUALITY_LOW
-const int dof_kernel_size=5;
-const int dof_kernel_from=2;
-const float dof_kernel[5] = float[] (0.153388,0.221461,0.250301,0.221461,0.153388);
+const int dof_kernel_size = 5;
+const int dof_kernel_from = 2;
+const float dof_kernel[5] = float[](0.153388, 0.221461, 0.250301, 0.221461, 0.153388);
#endif
#ifdef DOF_QUALITY_MEDIUM
-const int dof_kernel_size=11;
-const int dof_kernel_from=5;
-const float dof_kernel[11] = float[] (0.055037,0.072806,0.090506,0.105726,0.116061,0.119726,0.116061,0.105726,0.090506,0.072806,0.055037);
+const int dof_kernel_size = 11;
+const int dof_kernel_from = 5;
+const float dof_kernel[11] = float[](0.055037, 0.072806, 0.090506, 0.105726, 0.116061, 0.119726, 0.116061, 0.105726, 0.090506, 0.072806, 0.055037);
#endif
#ifdef DOF_QUALITY_HIGH
-const int dof_kernel_size=21;
-const int dof_kernel_from=10;
-const float dof_kernel[21] = float[] (0.028174,0.032676,0.037311,0.041944,0.046421,0.050582,0.054261,0.057307,0.059587,0.060998,0.061476,0.060998,0.059587,0.057307,0.054261,0.050582,0.046421,0.041944,0.037311,0.032676,0.028174);
+const int dof_kernel_size = 21;
+const int dof_kernel_from = 10;
+const float dof_kernel[21] = float[](0.028174, 0.032676, 0.037311, 0.041944, 0.046421, 0.050582, 0.054261, 0.057307, 0.059587, 0.060998, 0.061476, 0.060998, 0.059587, 0.057307, 0.054261, 0.050582, 0.046421, 0.041944, 0.037311, 0.032676, 0.028174);
#endif
uniform sampler2D dof_source_depth; //texunit:1
@@ -88,7 +90,6 @@ uniform sampler2D source_dof_original; //texunit:2
#endif
-
#ifdef GLOW_FIRST_PASS
uniform float exposure;
@@ -112,53 +113,51 @@ uniform float camera_z_near;
void main() {
-
-
#ifdef GAUSSIAN_HORIZONTAL
vec2 pix_size = pixel_size;
- pix_size*=0.5; //reading from larger buffer, so use more samples
- vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.214607;
- color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.189879;
- color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.157305;
- color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.071303;
- color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.189879;
- color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.157305;
- color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.071303;
+ pix_size *= 0.5; //reading from larger buffer, so use more samples
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.214607;
+ color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.189879;
+ color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.157305;
+ color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.071303;
+ color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.189879;
+ color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.157305;
+ color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.071303;
frag_color = color;
#endif
#ifdef GAUSSIAN_VERTICAL
- vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774;
- color+=textureLod( source_color, uv_interp+vec2( 0.0, 1.0)*pixel_size,lod )*0.24477;
- color+=textureLod( source_color, uv_interp+vec2( 0.0, 2.0)*pixel_size,lod )*0.06136;
- color+=textureLod( source_color, uv_interp+vec2( 0.0,-1.0)*pixel_size,lod )*0.24477;
- color+=textureLod( source_color, uv_interp+vec2( 0.0,-2.0)*pixel_size,lod )*0.06136;
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.38774;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.24477;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.06136;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.24477;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.06136;
frag_color = color;
#endif
-//glow uses larger sigma for a more rounded blur effect
+ //glow uses larger sigma for a more rounded blur effect
#ifdef GLOW_GAUSSIAN_HORIZONTAL
vec2 pix_size = pixel_size;
- pix_size*=0.5; //reading from larger buffer, so use more samples
- vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.174938;
- color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.165569;
- color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.140367;
- color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.106595;
- color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.165569;
- color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.140367;
- color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.106595;
- color*=glow_strength;
+ pix_size *= 0.5; //reading from larger buffer, so use more samples
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.174938;
+ color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.165569;
+ color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.140367;
+ color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.106595;
+ color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.165569;
+ color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.140367;
+ color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.106595;
+ color *= glow_strength;
frag_color = color;
#endif
#ifdef GLOW_GAUSSIAN_VERTICAL
- vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.288713;
- color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.233062;
- color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.122581;
- color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.233062;
- color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.122581;
- color*=glow_strength;
+ vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.288713;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.233062;
+ color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.122581;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.233062;
+ color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.122581;
+ color *= glow_strength;
frag_color = color;
#endif
@@ -166,47 +165,45 @@ void main() {
vec4 color_accum = vec4(0.0);
- float depth = textureLod( dof_source_depth, uv_interp, 0.0).r;
+ float depth = textureLod(dof_source_depth, uv_interp, 0.0).r;
depth = depth * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
#endif
- float amount = smoothstep(dof_begin,dof_end,depth);
- float k_accum=0.0;
+ float amount = smoothstep(dof_begin, dof_end, depth);
+ float k_accum = 0.0;
- for(int i=0;i<dof_kernel_size;i++) {
+ for (int i = 0; i < dof_kernel_size; i++) {
- int int_ofs = i-dof_kernel_from;
+ int int_ofs = i - dof_kernel_from;
vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * amount * dof_radius;
float tap_k = dof_kernel[i];
- float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r;
+ float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r;
tap_depth = tap_depth * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near));
#endif
- float tap_amount = mix(smoothstep(dof_begin,dof_end,tap_depth),1.0,int_ofs==0);
- tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect
-
- vec4 tap_color = textureLod( source_color, tap_uv, 0.0) * tap_k;
-
- k_accum+=tap_k*tap_amount;
- color_accum+=tap_color*tap_amount;
+ float tap_amount = mix(smoothstep(dof_begin, dof_end, tap_depth), 1.0, int_ofs == 0);
+ tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect
+ vec4 tap_color = textureLod(source_color, tap_uv, 0.0) * tap_k;
+ k_accum += tap_k * tap_amount;
+ color_accum += tap_color * tap_amount;
}
- if (k_accum>0.0) {
- color_accum/=k_accum;
+ if (k_accum > 0.0) {
+ color_accum /= k_accum;
}
- frag_color = color_accum;///k_accum;
+ frag_color = color_accum; ///k_accum;
#endif
@@ -214,47 +211,45 @@ void main() {
vec4 color_accum = vec4(0.0);
- float max_accum=0.0;
+ float max_accum = 0.0;
- for(int i=0;i<dof_kernel_size;i++) {
+ for (int i = 0; i < dof_kernel_size; i++) {
- int int_ofs = i-dof_kernel_from;
+ int int_ofs = i - dof_kernel_from;
vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * dof_radius;
- float ofs_influence = max(0.0,1.0-float(abs(int_ofs))/float(dof_kernel_from));
+ float ofs_influence = max(0.0, 1.0 - float(abs(int_ofs)) / float(dof_kernel_from));
float tap_k = dof_kernel[i];
- vec4 tap_color = textureLod( source_color, tap_uv, 0.0);
+ vec4 tap_color = textureLod(source_color, tap_uv, 0.0);
- float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r;
+ float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r;
tap_depth = tap_depth * 2.0 - 1.0;
-#ifdef USE_ORTHOGONAL_PROJECTION
- tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near));
#endif
- float tap_amount = 1.0-smoothstep(dof_end,dof_begin,tap_depth);
- tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect
+ float tap_amount = 1.0 - smoothstep(dof_end, dof_begin, tap_depth);
+ tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect
#ifdef DOF_NEAR_FIRST_TAP
- tap_color.a= 1.0-smoothstep(dof_end,dof_begin,tap_depth);
+ tap_color.a = 1.0 - smoothstep(dof_end, dof_begin, tap_depth);
#endif
- max_accum=max(max_accum,tap_amount*ofs_influence);
-
- color_accum+=tap_color*tap_k;
+ max_accum = max(max_accum, tap_amount * ofs_influence);
+ color_accum += tap_color * tap_k;
}
- color_accum.a=max(color_accum.a,sqrt(max_accum));
-
+ color_accum.a = max(color_accum.a, sqrt(max_accum));
#ifdef DOF_NEAR_BLUR_MERGE
- vec4 original = textureLod( source_dof_original, uv_interp, 0.0);
- color_accum = mix(original,color_accum,color_accum.a);
+ vec4 original = textureLod(source_dof_original, uv_interp, 0.0);
+ color_accum = mix(original, color_accum, color_accum.a);
#endif
@@ -265,37 +260,32 @@ void main() {
#endif
-
-
#ifdef GLOW_FIRST_PASS
#ifdef GLOW_USE_AUTO_EXPOSURE
- frag_color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey;
+ frag_color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey;
#endif
- frag_color*=exposure;
+ frag_color *= exposure;
- float luminance = max(frag_color.r,max(frag_color.g,frag_color.b));
- float feedback = max( smoothstep(glow_hdr_threshold,glow_hdr_threshold+glow_hdr_scale,luminance), glow_bloom );
+ float luminance = max(frag_color.r, max(frag_color.g, frag_color.b));
+ float feedback = max(smoothstep(glow_hdr_threshold, glow_hdr_threshold + glow_hdr_scale, luminance), glow_bloom);
frag_color *= feedback;
#endif
-
#ifdef SIMPLE_COPY
- vec4 color =textureLod( source_color, uv_interp,0.0);
+ vec4 color = textureLod(source_color, uv_interp, 0.0);
frag_color = color;
#endif
#ifdef SSAO_MERGE
- vec4 color =textureLod( source_color, uv_interp,0.0);
- float ssao =textureLod( source_ssao, uv_interp,0.0).r;
+ vec4 color = textureLod(source_color, uv_interp, 0.0);
+ float ssao = textureLod(source_ssao, uv_interp, 0.0).r;
- frag_color = vec4( mix(color.rgb,color.rgb*mix(ssao_color.rgb,vec3(1.0),ssao),color.a), 1.0 );
+ frag_color = vec4(mix(color.rgb, color.rgb * mix(ssao_color.rgb, vec3(1.0), ssao), color.a), 1.0);
#endif
-
-
}
diff --git a/drivers/gles3/shaders/exposure.glsl b/drivers/gles3/shaders/exposure.glsl
index 001b90a0f1..759adcda06 100644
--- a/drivers/gles3/shaders/exposure.glsl
+++ b/drivers/gles3/shaders/exposure.glsl
@@ -1,19 +1,19 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
-
}
+/* clang-format off */
[fragment]
-
uniform highp sampler2D source_exposure; //texunit:0
+/* clang-format on */
#ifdef EXPOSURE_BEGIN
@@ -33,66 +33,56 @@ uniform highp float max_luminance;
layout(location = 0) out highp float exposure;
-
-
void main() {
-
-
#ifdef EXPOSURE_BEGIN
-
- ivec2 src_pos = ivec2(gl_FragCoord.xy)*source_render_size/target_size;
+ ivec2 src_pos = ivec2(gl_FragCoord.xy) * source_render_size / target_size;
#if 1
//more precise and expensive, but less jittery
- ivec2 next_pos = ivec2(gl_FragCoord.xy+ivec2(1))*source_render_size/target_size;
- next_pos = max(next_pos,src_pos+ivec2(1)); //so it at least reads one pixel
- highp vec3 source_color=vec3(0.0);
- for(int i=src_pos.x;i<next_pos.x;i++) {
- for(int j=src_pos.y;j<next_pos.y;j++) {
- source_color += texelFetch(source_exposure,ivec2(i,j),0).rgb;
+ ivec2 next_pos = ivec2(gl_FragCoord.xy + ivec2(1)) * source_render_size / target_size;
+ next_pos = max(next_pos, src_pos + ivec2(1)); //so it at least reads one pixel
+ highp vec3 source_color = vec3(0.0);
+ for (int i = src_pos.x; i < next_pos.x; i++) {
+ for (int j = src_pos.y; j < next_pos.y; j++) {
+ source_color += texelFetch(source_exposure, ivec2(i, j), 0).rgb;
}
}
- source_color/=float( (next_pos.x-src_pos.x)*(next_pos.y-src_pos.y) );
+ source_color /= float((next_pos.x - src_pos.x) * (next_pos.y - src_pos.y));
#else
- highp vec3 source_color = texelFetch(source_exposure,src_pos,0).rgb;
+ highp vec3 source_color = texelFetch(source_exposure, src_pos, 0).rgb;
#endif
- exposure = max(source_color.r,max(source_color.g,source_color.b));
+ exposure = max(source_color.r, max(source_color.g, source_color.b));
#else
ivec2 coord = ivec2(gl_FragCoord.xy);
- exposure = texelFetch(source_exposure,coord*3+ivec2(0,0),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(1,0),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(2,0),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(0,1),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(1,1),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(2,1),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(0,2),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(1,2),0).r;
- exposure += texelFetch(source_exposure,coord*3+ivec2(2,2),0).r;
- exposure *= (1.0/9.0);
+ exposure = texelFetch(source_exposure, coord * 3 + ivec2(0, 0), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 0), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 0), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 1), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 1), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 1), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 2), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 2), 0).r;
+ exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 2), 0).r;
+ exposure *= (1.0 / 9.0);
#ifdef EXPOSURE_END
#ifdef EXPOSURE_FORCE_SET
//will stay as is
#else
- highp float prev_lum = texelFetch(prev_exposure,ivec2(0,0),0).r; //1 pixel previous exposure
- exposure = clamp( prev_lum + (exposure-prev_lum)*exposure_adjust,min_luminance,max_luminance);
+ highp float prev_lum = texelFetch(prev_exposure, ivec2(0, 0), 0).r; //1 pixel previous exposure
+ exposure = clamp(prev_lum + (exposure - prev_lum) * exposure_adjust, min_luminance, max_luminance);
#endif //EXPOSURE_FORCE_SET
-
#endif //EXPOSURE_END
#endif //EXPOSURE_BEGIN
-
-
}
-
-
diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl
index fbee08c0fe..8523c08597 100644
--- a/drivers/gles3/shaders/particles.glsl
+++ b/drivers/gles3/shaders/particles.glsl
@@ -1,14 +1,13 @@
+/* clang-format off */
[vertex]
-
-
-layout(location=0) in highp vec4 color;
-layout(location=1) in highp vec4 velocity_active;
-layout(location=2) in highp vec4 custom;
-layout(location=3) in highp vec4 xform_1;
-layout(location=4) in highp vec4 xform_2;
-layout(location=5) in highp vec4 xform_3;
-
+layout(location = 0) in highp vec4 color;
+/* clang-format on */
+layout(location = 1) in highp vec4 velocity_active;
+layout(location = 2) in highp vec4 custom;
+layout(location = 3) in highp vec4 xform_1;
+layout(location = 4) in highp vec4 xform_2;
+layout(location = 5) in highp vec4 xform_3;
struct Attractor {
@@ -39,7 +38,6 @@ uniform float lifetime;
uniform mat4 emission_transform;
uniform uint random_seed;
-
out highp vec4 out_color; //tfb:
out highp vec4 out_velocity_active; //tfb:
out highp vec4 out_custom; //tfb:
@@ -47,20 +45,24 @@ out highp vec4 out_xform_1; //tfb:
out highp vec4 out_xform_2; //tfb:
out highp vec4 out_xform_3; //tfb:
-
#if defined(USE_MATERIAL)
+/* clang-format off */
layout(std140) uniform UniformData { //ubo:0
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
uint hash(uint x) {
x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
@@ -69,13 +71,12 @@ uint hash(uint x) {
return x;
}
-
void main() {
#ifdef PARTICLES_COPY
- out_color=color;
- out_velocity_active=velocity_active;
+ out_color = color;
+ out_velocity_active = velocity_active;
out_custom = custom;
out_xform_1 = xform_1;
out_xform_2 = xform_2;
@@ -83,47 +84,47 @@ void main() {
#else
- bool apply_forces=true;
- bool apply_velocity=true;
- float local_delta=delta;
+ bool apply_forces = true;
+ bool apply_velocity = true;
+ float local_delta = delta;
float mass = 1.0;
- float restart_phase = float(gl_VertexID)/float(total_particles);
+ float restart_phase = float(gl_VertexID) / float(total_particles);
- if (randomness>0.0) {
+ if (randomness > 0.0) {
uint seed = cycle;
if (restart_phase >= system_phase) {
- seed-=uint(1);
+ seed -= uint(1);
}
- seed*=uint(total_particles);
- seed+=uint(gl_VertexID);
+ seed *= uint(total_particles);
+ seed += uint(gl_VertexID);
float random = float(hash(seed) % uint(65536)) / 65536.0;
- restart_phase+=randomness * random * 1.0 / float(total_particles);
+ restart_phase += randomness * random * 1.0 / float(total_particles);
}
- restart_phase*= (1.0-explosiveness);
- bool restart=false;
+ restart_phase *= (1.0 - explosiveness);
+ bool restart = false;
bool shader_active = velocity_active.a > 0.5;
if (system_phase > prev_system_phase) {
// restart_phase >= prev_system_phase is used so particles emit in the first frame they are processed
- if (restart_phase >= prev_system_phase && restart_phase < system_phase ) {
- restart=true;
+ if (restart_phase >= prev_system_phase && restart_phase < system_phase) {
+ restart = true;
#ifdef USE_FRACTIONAL_DELTA
local_delta = (system_phase - restart_phase) * lifetime;
#endif
}
- } else if(delta > 0.0) {
+ } else if (delta > 0.0) {
if (restart_phase >= prev_system_phase) {
- restart=true;
+ restart = true;
#ifdef USE_FRACTIONAL_DELTA
local_delta = (1.0 - restart_phase + system_phase) * lifetime;
#endif
- } else if (restart_phase < system_phase ) {
- restart=true;
+ } else if (restart_phase < system_phase) {
+ restart = true;
#ifdef USE_FRACTIONAL_DELTA
local_delta = (system_phase - restart_phase) * lifetime;
#endif
@@ -133,14 +134,14 @@ void main() {
uint current_cycle = cycle;
if (system_phase < restart_phase) {
- current_cycle-=uint(1);
+ current_cycle -= uint(1);
}
uint particle_number = current_cycle * uint(total_particles) + uint(gl_VertexID);
int index = int(gl_VertexID);
if (restart) {
- shader_active=emitting;
+ shader_active = emitting;
}
mat4 xform;
@@ -150,30 +151,33 @@ void main() {
#else
if (clear || restart) {
#endif
- out_color=vec4(1.0);
- out_velocity_active=vec4(0.0);
- out_custom=vec4(0.0);
+ out_color = vec4(1.0);
+ out_velocity_active = vec4(0.0);
+ out_custom = vec4(0.0);
if (!restart)
- shader_active=false;
+ shader_active = false;
xform = mat4(
- vec4(1.0,0.0,0.0,0.0),
- vec4(0.0,1.0,0.0,0.0),
- vec4(0.0,0.0,1.0,0.0),
- vec4(0.0,0.0,0.0,1.0)
- );
+ vec4(1.0, 0.0, 0.0, 0.0),
+ vec4(0.0, 1.0, 0.0, 0.0),
+ vec4(0.0, 0.0, 1.0, 0.0),
+ vec4(0.0, 0.0, 0.0, 1.0));
} else {
- out_color=color;
- out_velocity_active=velocity_active;
- out_custom=custom;
- xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0)));
+ out_color = color;
+ out_velocity_active = velocity_active;
+ out_custom = custom;
+ xform = transpose(mat4(xform_1, xform_2, xform_3, vec4(vec3(0.0), 1.0)));
}
if (shader_active) {
//execute shader
{
+ /* clang-format off */
+
VERTEX_SHADER_CODE
+
+ /* clang-format on */
}
#if !defined(DISABLE_FORCE)
@@ -181,26 +185,25 @@ VERTEX_SHADER_CODE
if (false) {
vec3 force = vec3(0.0);
- for(int i=0;i<attractor_count;i++) {
+ for (int i = 0; i < attractor_count; i++) {
vec3 rel_vec = xform[3].xyz - attractors[i].pos;
float dist = length(rel_vec);
if (attractors[i].radius < dist)
continue;
- if (attractors[i].eat_radius>0.0 && attractors[i].eat_radius > dist) {
- out_velocity_active.a=0.0;
+ if (attractors[i].eat_radius > 0.0 && attractors[i].eat_radius > dist) {
+ out_velocity_active.a = 0.0;
}
rel_vec = normalize(rel_vec);
- float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation);
+ float attenuation = pow(dist / attractors[i].radius, attractors[i].attenuation);
- if (attractors[i].dir==vec3(0.0)) {
+ if (attractors[i].dir == vec3(0.0)) {
//towards center
- force+=attractors[i].strength * rel_vec * attenuation * mass;
+ force += attractors[i].strength * rel_vec * attenuation * mass;
} else {
- force+=attractors[i].strength * attractors[i].dir * attenuation *mass;
-
+ force += attractors[i].strength * attractors[i].dir * attenuation * mass;
}
}
@@ -216,25 +219,24 @@ VERTEX_SHADER_CODE
}
#endif
} else {
- xform=mat4(0.0);
+ xform = mat4(0.0);
}
xform = transpose(xform);
- out_velocity_active.a = mix(0.0,1.0,shader_active);
+ out_velocity_active.a = mix(0.0, 1.0, shader_active);
out_xform_1 = xform[0];
out_xform_2 = xform[1];
out_xform_3 = xform[2];
#endif //PARTICLES_COPY
-
}
+/* clang-format off */
[fragment]
-//any code here is never executed, stuff is filled just so it works
-
+// any code here is never executed, stuff is filled just so it works
#if defined(USE_MATERIAL)
@@ -251,10 +253,15 @@ FRAGMENT_SHADER_GLOBALS
void main() {
{
+
LIGHT_SHADER_CODE
+
}
{
+
FRAGMENT_SHADER_CODE
+
}
}
+/* clang-format on */
diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl
index 0b50a9c57b..d64d8308c1 100644
--- a/drivers/gles3/shaders/resolve.glsl
+++ b/drivers/gles3/shaders/resolve.glsl
@@ -1,27 +1,29 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
-
void main() {
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
precision mediump float;
#endif
+/* clang-format on */
in vec2 uv_interp;
-uniform sampler2D source_specular; //texunit:0
-uniform sampler2D source_ssr; //texunit:1
+uniform sampler2D source_specular; // texunit:0
+uniform sampler2D source_ssr; // texunit:1
uniform vec2 pixel_size;
@@ -31,14 +33,12 @@ layout(location = 0) out vec4 frag_color;
void main() {
- vec4 specular = texture( source_specular, uv_interp );
+ vec4 specular = texture(source_specular, uv_interp);
#ifdef USE_SSR
-
- vec4 ssr = textureLod(source_ssr,uv_interp,0.0);
- specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a);
+ vec4 ssr = textureLod(source_ssr, uv_interp, 0.0);
+ specular.rgb = mix(specular.rgb, ssr.rgb * specular.a, ssr.a);
#endif
- frag_color = vec4(specular.rgb,1.0);
+ frag_color = vec4(specular.rgb, 1.0);
}
-
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 2d6f42679f..12cbe02d0c 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#define M_PI 3.14159265359
@@ -16,50 +17,50 @@ ARRAY_WEIGHTS=7,
ARRAY_INDEX=8,
*/
-//hack to use uv if no uv present so it works with lightmap
-
+// hack to use uv if no uv present so it works with lightmap
/* INPUT ATTRIBS */
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=1) in vec3 normal_attrib;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 1) in vec3 normal_attrib;
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
-layout(location=2) in vec4 tangent_attrib;
+layout(location = 2) in vec4 tangent_attrib;
#endif
#if defined(ENABLE_COLOR_INTERP)
-layout(location=3) in vec4 color_attrib;
+layout(location = 3) in vec4 color_attrib;
#endif
#if defined(ENABLE_UV_INTERP)
-layout(location=4) in vec2 uv_attrib;
+layout(location = 4) in vec2 uv_attrib;
#endif
#if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP)
-layout(location=5) in vec2 uv2_attrib;
+layout(location = 5) in vec2 uv2_attrib;
#endif
uniform float normal_mult;
#ifdef USE_SKELETON
-layout(location=6) in uvec4 bone_indices; // attrib:6
-layout(location=7) in vec4 bone_weights; // attrib:7
+layout(location = 6) in uvec4 bone_indices; // attrib:6
+layout(location = 7) in vec4 bone_weights; // attrib:7
#endif
#ifdef USE_INSTANCING
-layout(location=8) in highp vec4 instance_xform0;
-layout(location=9) in highp vec4 instance_xform1;
-layout(location=10) in highp vec4 instance_xform2;
-layout(location=11) in lowp vec4 instance_color;
+layout(location = 8) in highp vec4 instance_xform0;
+layout(location = 9) in highp vec4 instance_xform1;
+layout(location = 10) in highp vec4 instance_xform2;
+layout(location = 11) in lowp vec4 instance_color;
#if defined(ENABLE_INSTANCE_CUSTOM)
-layout(location=12) in highp vec4 instance_custom_data;
+layout(location = 12) in highp vec4 instance_custom_data;
#endif
#endif
-layout(std140) uniform SceneData { //ubo:0
+layout(std140) uniform SceneData { // ubo:0
highp mat4 projection_matrix;
highp mat4 inv_projection_matrix;
@@ -102,12 +103,10 @@ layout(std140) uniform SceneData { //ubo:0
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
@@ -115,7 +114,7 @@ layout(std140) uniform DirectionalLightData { //ubo:3
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_params; // cone attenuation, angle, specular, shadow enabled,
mediump vec4 light_clamp;
mediump vec4 shadow_color_contact;
highp mat4 shadow_matrix1;
@@ -135,14 +134,12 @@ 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_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];
@@ -155,7 +152,6 @@ layout(std140) uniform SpotLightData { //ubo:5
#ifdef USE_FORWARD_LIGHTING
-
uniform int omni_light_indices[MAX_FORWARD_LIGHTS];
uniform int omni_light_count;
@@ -167,49 +163,45 @@ uniform int spot_light_count;
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) {
+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 );
+ float dotNL = max(dot(N, L), 0.0);
diffuse += dotNL * light_color / M_PI;
if (roughness > 0.0) {
vec3 H = normalize(V + L);
- float dotNH = max(dot(N,H), 0.0 );
- float intensity = (roughness >= 1.0 ? 1.0 : pow( dotNH, (1.0-roughness) * 256.0));
+ float dotNH = max(dot(N, H), 0.0);
+ float intensity = (roughness >= 1.0 ? 1.0 : 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 ));
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) {
- light_compute(normal,normalize(light_rel_vec),eye_vec,omni_lights[idx].light_color_energy.rgb * light_attenuation,roughness,diffuse,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 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_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_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);
+ light_compute(normal, normalize(light_rel_vec), eye_vec, spot_lights[idx].light_color_energy.rgb * light_attenuation, roughness, diffuse, specular);
}
-
#endif
/* Varyings */
@@ -225,29 +217,33 @@ out vec4 color_interp;
out vec2 uv_interp;
#endif
-#if defined(ENABLE_UV2_INTERP) || defined (USE_LIGHTMAP)
+#if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP)
out vec2 uv2_interp;
#endif
-
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
out vec3 tangent_interp;
out vec3 binormal_interp;
#endif
-
#if defined(USE_MATERIAL)
-layout(std140) uniform UniformData { //ubo:1
+/* clang-format off */
+layout(std140) uniform UniformData { // ubo:1
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
+
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
out highp float dp_clip;
@@ -257,7 +253,7 @@ out highp float dp_clip;
#define SKELETON_TEXTURE_WIDTH 256
#ifdef USE_SKELETON
-uniform highp sampler2D skeleton_texture; //texunit:-1
+uniform highp sampler2D skeleton_texture; // texunit:-1
#endif
out highp vec4 position_interp;
@@ -272,21 +268,19 @@ void main() {
mat4 world_matrix = world_transform;
-
#ifdef USE_INSTANCING
{
- highp mat4 m=mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0));
+ highp mat4 m = mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0));
world_matrix = world_matrix * transpose(m);
}
#endif
vec3 normal = normal_attrib * normal_mult;
-
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
vec3 tangent = tangent_attrib.xyz;
- tangent*=normal_mult;
+ tangent *= normal_mult;
float binormalf = tangent_attrib.a;
#endif
@@ -298,10 +292,9 @@ void main() {
#endif
-
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
- vec3 binormal = normalize( cross(normal,tangent) * binormalf );
+ vec3 binormal = normalize(cross(normal, tangent) * binormalf);
#endif
#if defined(ENABLE_UV_INTERP)
@@ -329,13 +322,13 @@ void main() {
mat3 normal_matrix = mat3(transpose(inverse(world_matrix)));
normal = normal_matrix * normal;
#else
- normal = normalize((world_matrix * vec4(normal,0.0)).xyz);
+ normal = normalize((world_matrix * vec4(normal, 0.0)).xyz);
#endif
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
- tangent = normalize((world_matrix * vec4(tangent,0.0)).xyz);
- binormal = normalize((world_matrix * vec4(binormal,0.0)).xyz);
+ tangent = normalize((world_matrix * vec4(tangent, 0.0)).xyz);
+ binormal = normalize((world_matrix * vec4(binormal, 0.0)).xyz);
#endif
#endif
@@ -345,60 +338,59 @@ void main() {
#define projection_matrix local_projection
#define world_transform world_matrix
-
#ifdef USE_SKELETON
{
//skeleton transform
ivec4 bone_indicesi = ivec4(bone_indices); // cast to signed int
- ivec2 tex_ofs = ivec2( bone_indicesi.x%256, (bone_indicesi.x/256)*3 );
- highp mat3x4 m = mat3x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
- ) * bone_weights.x;
-
- tex_ofs = ivec2( bone_indicesi.y%256, (bone_indicesi.y/256)*3 );
+ ivec2 tex_ofs = ivec2(bone_indicesi.x % 256, (bone_indicesi.x / 256) * 3);
+ highp mat3x4 m;
+ m = mat3x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+ bone_weights.x;
- m+= mat3x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
- ) * bone_weights.y;
+ tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 3);
- tex_ofs = ivec2( bone_indicesi.z%256, (bone_indicesi.z/256)*3 );
+ m += mat3x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+ bone_weights.y;
- m+= mat3x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
- ) * bone_weights.z;
+ tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 3);
+ m += mat3x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+ bone_weights.z;
- tex_ofs = ivec2( bone_indicesi.w%256, (bone_indicesi.w/256)*3 );
+ tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 3);
- m+= mat3x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
- ) * bone_weights.w;
+ m += mat3x4(
+ texelFetch(skeleton_texture, tex_ofs, 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+ texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+ bone_weights.w;
- mat4 bone_matrix = transpose(mat4(m[0],m[1],m[2],vec4(0.0,0.0,0.0,1.0)));
+ mat4 bone_matrix = transpose(mat4(m[0], m[1], m[2], vec4(0.0, 0.0, 0.0, 1.0)));
world_matrix = bone_matrix * world_matrix;
}
#endif
mat4 modelview = camera_inverse_matrix * world_matrix;
-{
+ {
+ /* clang-format off */
VERTEX_SHADER_CODE
-}
-
-
+ /* clang-format on */
+ }
-//using local coordinates (default)
+// using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
vertex = modelview * vertex;
@@ -407,13 +399,13 @@ VERTEX_SHADER_CODE
mat3 normal_matrix = mat3(transpose(inverse(modelview)));
normal = normal_matrix * normal;
#else
- normal = normalize((modelview * vec4(normal,0.0)).xyz);
+ normal = normalize((modelview * vec4(normal, 0.0)).xyz);
#endif
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
- tangent = normalize((modelview * vec4(tangent,0.0)).xyz);
- binormal = normalize((modelview * vec4(binormal,0.0)).xyz);
+ tangent = normalize((modelview * vec4(tangent, 0.0)).xyz);
+ binormal = normalize((modelview * vec4(binormal, 0.0)).xyz);
#endif
#endif
@@ -421,74 +413,70 @@ VERTEX_SHADER_CODE
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
vertex = camera_inverse_matrix * vertex;
- normal = normalize((camera_inverse_matrix * vec4(normal,0.0)).xyz);
+ normal = normalize((camera_inverse_matrix * vec4(normal, 0.0)).xyz);
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
- tangent = normalize((camera_inverse_matrix * vec4(tangent,0.0)).xyz);
- binormal = normalize((camera_inverse_matrix * vec4(binormal,0.0)).xyz);
+ tangent = normalize((camera_inverse_matrix * vec4(tangent, 0.0)).xyz);
+ binormal = normalize((camera_inverse_matrix * vec4(binormal, 0.0)).xyz);
#endif
#endif
vertex_interp = vertex.xyz;
normal_interp = normal;
-
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
tangent_interp = tangent;
binormal_interp = binormal;
#endif
-
#ifdef RENDER_DEPTH
-
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
- vertex_interp.z*= shadow_dual_paraboloid_render_side;
- normal_interp.z*= shadow_dual_paraboloid_render_side;
+ vertex_interp.z *= shadow_dual_paraboloid_render_side;
+ normal_interp.z *= shadow_dual_paraboloid_render_side;
- dp_clip=vertex_interp.z; //this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias
+ dp_clip = vertex_interp.z; //this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias
//for dual paraboloid shadow mapping, this is the fastest but least correct way, as it curves straight edges
- highp vec3 vtx = vertex_interp+normalize(vertex_interp)*z_offset;
+ highp vec3 vtx = vertex_interp + normalize(vertex_interp) * z_offset;
highp float distance = length(vtx);
vtx = normalize(vtx);
- vtx.xy/=1.0-vtx.z;
- vtx.z=(distance/shadow_dual_paraboloid_render_zfar);
- vtx.z=vtx.z * 2.0 - 1.0;
+ vtx.xy /= 1.0 - vtx.z;
+ vtx.z = (distance / shadow_dual_paraboloid_render_zfar);
+ vtx.z = vtx.z * 2.0 - 1.0;
vertex_interp = vtx;
-
#else
float z_ofs = z_offset;
- z_ofs += (1.0-abs(normal_interp.z))*z_slope_scale;
- vertex_interp.z-=z_ofs;
+ z_ofs += (1.0 - abs(normal_interp.z)) * z_slope_scale;
+ vertex_interp.z -= z_ofs;
#endif //RENDER_DEPTH_DUAL_PARABOLOID
#endif //RENDER_DEPTH
- gl_Position = projection_matrix * vec4(vertex_interp,1.0);
+ gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
- position_interp=gl_Position;
+ position_interp = gl_Position;
#ifdef USE_VERTEX_LIGHTING
- diffuse_light_interp=vec4(0.0);
- specular_light_interp=vec4(0.0);
+ 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 < 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);
+ 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
@@ -496,36 +484,34 @@ VERTEX_SHADER_CODE
vec3 directional_diffuse = vec3(0.0);
vec3 directional_specular = vec3(0.0);
- light_compute(normal_interp,-light_direction_attenuation.xyz,-normalize( vertex_interp ),light_color_energy.rgb,roughness,directional_diffuse,directional_specular);
+ light_compute(normal_interp, -light_direction_attenuation.xyz, -normalize(vertex_interp), light_color_energy.rgb, 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);
+ 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.a = 1.0;
}
- diffuse_light_interp.rgb+=directional_diffuse;
+ 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);
+ 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.a = 1.0;
}
- specular_light_interp.rgb+=directional_specular;
+ specular_light_interp.rgb += directional_specular;
#endif //USE_LIGHT_DIRECTIONAL
-
#endif // USE_VERTEX_LIGHTING
-
}
-
+/* clang-format off */
[fragment]
/* texture unit usage, N is max_texture_unity-N
@@ -544,6 +530,7 @@ VERTEX_SHADER_CODE
*/
uniform highp mat4 world_transform;
+/* clang-format on */
#define M_PI 3.14159265359
@@ -569,37 +556,33 @@ in vec3 binormal_interp;
in highp vec3 vertex_interp;
in vec3 normal_interp;
-
/* PBR CHANNELS */
#ifdef USE_RADIANCE_MAP
-
-
-layout(std140) uniform Radiance { //ubo:2
+layout(std140) uniform Radiance { // ubo:2
mat4 radiance_inverse_xform;
float radiance_ambient_contribution;
-
};
#define RADIANCE_MAX_LOD 5.0
#ifdef USE_RADIANCE_MAP_ARRAY
-uniform sampler2DArray radiance_map; //texunit:-2
+uniform sampler2DArray radiance_map; // texunit:-2
-vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) {
+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);
+ 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 texture filtering
- vec2 normg=norm.xy;
- if (norm.z>0.0) {
- norm.y=0.5-norm.y+0.5;
+ vec2 normg = norm.xy;
+ if (norm.z > 0.0) {
+ norm.y = 0.5 - norm.y + 0.5;
}
// thanks to OpenGL spec using floor(layer + 0.5) for texture arrays,
@@ -608,22 +591,22 @@ vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) {
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);
+ 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
+uniform sampler2D radiance_map; // texunit:-2
-vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) {
+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.0) {
- norm.y=0.5-norm.y+0.5;
+ 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.0) {
+ norm.y = 0.5 - norm.y + 0.5;
}
return textureLod(p_tex, norm.xy, p_roughness * RADIANCE_MAX_LOD).xyz;
}
@@ -634,20 +617,24 @@ vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) {
/* Material Uniforms */
-
-
#if defined(USE_MATERIAL)
+/* clang-format off */
layout(std140) uniform UniformData {
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
+
FRAGMENT_SHADER_GLOBALS
+/* clang-format on */
+
layout(std140) uniform SceneData {
highp mat4 projection_matrix;
@@ -693,7 +680,7 @@ layout(std140) uniform SceneData {
highp float fog_height_curve;
};
-//directional light data
+ //directional light data
#ifdef USE_LIGHT_DIRECTIONAL
@@ -702,7 +689,7 @@ layout(std140) uniform DirectionalLightData {
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_params; // cone attenuation, angle, specular, shadow enabled,
mediump vec4 light_clamp;
mediump vec4 shadow_color_contact;
highp mat4 shadow_matrix1;
@@ -712,8 +699,7 @@ layout(std140) uniform DirectionalLightData {
mediump vec4 shadow_split_offsets;
};
-
-uniform highp sampler2DShadow directional_shadow; //texunit:-4
+uniform highp sampler2DShadow directional_shadow; // texunit:-4
#endif
@@ -721,52 +707,47 @@ uniform highp sampler2DShadow directional_shadow; //texunit:-4
in vec4 diffuse_light_interp;
in vec4 specular_light_interp;
#endif
-//omni and spot
+// 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_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
+layout(std140) uniform OmniLightData { // ubo:4
LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
};
-layout(std140) uniform SpotLightData { //ubo:5
+layout(std140) uniform SpotLightData { // ubo:5
LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
};
-
-uniform highp sampler2DShadow shadow_atlas; //texunit:-5
-
+uniform highp sampler2DShadow shadow_atlas; // texunit:-5
struct ReflectionData {
mediump vec4 box_extents;
mediump vec4 box_offset;
mediump vec4 params; // intensity, 0, interior , boxproject
- mediump vec4 ambient; //ambient color, energy
+ mediump vec4 ambient; // ambient color, energy
mediump vec4 atlas_clamp;
- highp mat4 local_matrix; //up to here for spot and omni, rest is for directional
- //notes: for ambientblend, use distance to edge to blend between already existing global environment
+ highp mat4 local_matrix; // up to here for spot and omni, rest is for directional
+ // notes: for ambientblend, use distance to edge to blend between already existing global environment
};
layout(std140) uniform ReflectionProbeData { //ubo:6
ReflectionData reflections[MAX_REFLECTION_DATA_STRUCTS];
};
-uniform mediump sampler2D reflection_atlas; //texunit:-3
-
+uniform mediump sampler2D reflection_atlas; // texunit:-3
#ifdef USE_FORWARD_LIGHTING
@@ -781,39 +762,38 @@ uniform int reflection_count;
#endif
-
#if defined(SCREEN_TEXTURE_USED)
-uniform highp sampler2D screen_texture; //texunit:-7
+uniform highp sampler2D screen_texture; // texunit:-7
#endif
#ifdef USE_MULTIPLE_RENDER_TARGETS
-layout(location=0) out vec4 diffuse_buffer;
-layout(location=1) out vec4 specular_buffer;
-layout(location=2) out vec4 normal_mr_buffer;
+layout(location = 0) out vec4 diffuse_buffer;
+layout(location = 1) out vec4 specular_buffer;
+layout(location = 2) out vec4 normal_mr_buffer;
#if defined(ENABLE_SSS)
-layout(location=3) out float sss_buffer;
+layout(location = 3) out float sss_buffer;
#endif
#else
-layout(location=0) out vec4 frag_color;
+layout(location = 0) out vec4 frag_color;
#endif
in highp vec4 position_interp;
-uniform highp sampler2D depth_buffer; //texunit:-8
+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)
+ if (abs(dir.z) > 0.99)
return 1.0;
- vec3 endpoint = pos+dir*max_distance;
+ vec3 endpoint = pos + dir * max_distance;
vec4 source = position_interp;
vec4 dest = projection_matrix * vec4(endpoint, 1.0);
@@ -822,51 +802,48 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
vec2 screen_rel = to_screen - from_screen;
- if (length(screen_rel)<0.00001)
- return 1.0; //too small, don't do anything
+ if (length(screen_rel) < 0.00001)
+ return 1.0; // too small, don't do anything
- /*float pixel_size; //approximate pixel size
+ /*
+ float pixel_size; // approximate pixel size
if (screen_rel.x > screen_rel.y) {
- pixel_size = abs((pos.x-endpoint.x)/(screen_rel.x/screen_pixel_size.x));
+ pixel_size = abs((pos.x - endpoint.x) / (screen_rel.x / screen_pixel_size.x));
} else {
- pixel_size = abs((pos.y-endpoint.y)/(screen_rel.y/screen_pixel_size.y));
-
- }*/
- vec4 bias = projection_matrix * vec4(pos+vec3(0.0,0.0,max_distance*0.5), 1.0); //todo un-harcode the 0.04
-
-
-
- vec2 pixel_incr = normalize(screen_rel)*screen_pixel_size;
+ pixel_size = abs((pos.y - endpoint.y) / (screen_rel.y / screen_pixel_size.y));
+ }
+ */
+ vec4 bias = projection_matrix * vec4(pos + vec3(0.0, 0.0, max_distance * 0.5), 1.0);
+ vec2 pixel_incr = normalize(screen_rel) * screen_pixel_size;
float steps = length(screen_rel) / length(pixel_incr);
- steps = min(2000.0,steps); //put a limit to avoid freezing in some strange situation
- //steps=10.0;
+ steps = min(2000.0, steps); // put a limit to avoid freezing in some strange situation
+ //steps = 10.0;
- vec4 incr = (dest - source)/steps;
- float ratio=0.0;
- float ratio_incr = 1.0/steps;
+ vec4 incr = (dest - source) / steps;
+ float ratio = 0.0;
+ float ratio_incr = 1.0 / steps;
- while(steps>0.0) {
- source += incr*2.0;
- bias+=incr*2.0;
+ while (steps > 0.0) {
+ source += incr * 2.0;
+ bias += incr * 2.0;
vec3 uv_depth = (source.xyz / source.w) * 0.5 + 0.5;
- float depth = texture(depth_buffer,uv_depth.xy).r;
+ float depth = texture(depth_buffer, uv_depth.xy).r;
if (depth < uv_depth.z) {
- if (depth > (bias.z/bias.w) * 0.5 + 0.5) {
- return min(pow(ratio,4.0),1.0);
+ if (depth > (bias.z / bias.w) * 0.5 + 0.5) {
+ return min(pow(ratio, 4.0), 1.0);
} else {
return 1.0;
}
}
-
- ratio+=ratio_incr;
- steps-=1.0;
+ ratio += ratio_incr;
+ steps -= 1.0;
}
return 1.0;
@@ -874,7 +851,6 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
#endif
-
// This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V.
// We're dividing this factor off because the overall term we'll end up looks like
// (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012):
@@ -896,51 +872,48 @@ float G_GGX_2cos(float cos_theta_m, float alpha) {
// C. Schlick, "An Inexpensive BRDF Model for Physically-based Rendering", Computer Graphics Forum. 13 (3): 233 (1994)
// Eq. (19), although see Heitz (2014) the about the problems with his derivation.
// It nevertheless approximates GGX well with k = alpha/2.
- float k = 0.5*alpha;
+ float k = 0.5 * alpha;
return 0.5 / (cos_theta_m * (1.0 - k) + k);
- // float cos2 = cos_theta_m*cos_theta_m;
- // float sin2 = (1.0-cos2);
- // return 1.0 /( cos_theta_m + sqrt(cos2 + alpha*alpha*sin2) );
+ // float cos2 = cos_theta_m * cos_theta_m;
+ // float sin2 = (1.0 - cos2);
+ // return 1.0 / (cos_theta_m + sqrt(cos2 + alpha * alpha * sin2));
}
float D_GGX(float cos_theta_m, float alpha) {
- float alpha2 = alpha*alpha;
- float d = 1.0 + (alpha2-1.0)*cos_theta_m*cos_theta_m;
- return alpha2/(M_PI * d * d);
+ float alpha2 = alpha * alpha;
+ float d = 1.0 + (alpha2 - 1.0) * cos_theta_m * cos_theta_m;
+ return alpha2 / (M_PI * d * d);
}
float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
float cos2 = cos_theta_m * cos_theta_m;
- float sin2 = (1.0-cos2);
+ float sin2 = (1.0 - cos2);
float s_x = alpha_x * cos_phi;
float s_y = alpha_y * sin_phi;
- return 1.0 / max(cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ), 0.001);
+ return 1.0 / max(cos_theta_m + sqrt(cos2 + (s_x * s_x + s_y * s_y) * sin2), 0.001);
}
float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
float cos2 = cos_theta_m * cos_theta_m;
- float sin2 = (1.0-cos2);
- float r_x = cos_phi/alpha_x;
- float r_y = sin_phi/alpha_y;
- float d = cos2 + sin2*(r_x * r_x + r_y * r_y);
+ float sin2 = (1.0 - cos2);
+ float r_x = cos_phi / alpha_x;
+ float r_y = sin_phi / alpha_y;
+ float d = cos2 + sin2 * (r_x * r_x + r_y * r_y);
return 1.0 / max(M_PI * alpha_x * alpha_y * d * d, 0.001);
}
-
-float SchlickFresnel(float u)
-{
- float m = 1.0-u;
- float m2 = m*m;
- return m2*m2*m; // pow(m,5)
+float SchlickFresnel(float u) {
+ float m = 1.0 - u;
+ float m2 = m * m;
+ return m2 * m2 * m; // pow(m,5)
}
-float GTR1(float NdotH, float a)
-{
- if (a >= 1.0) return 1.0/M_PI;
- float a2 = a*a;
- float t = 1.0 + (a2-1.0)*NdotH*NdotH;
- return (a2-1.0) / (M_PI*log(a2)*t);
+float GTR1(float NdotH, float a) {
+ if (a >= 1.0) return 1.0 / M_PI;
+ float a2 = a * a;
+ float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
+ return (a2 - 1.0) / (M_PI * log(a2) * t);
}
vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) {
@@ -952,18 +925,21 @@ vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) {
void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec3 attenuation, vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) {
#if defined(USE_LIGHT_SHADER_CODE)
-//light is written by the light shader
+ // light is written by the light shader
vec3 normal = N;
vec3 albedo = diffuse_color;
vec3 light = L;
vec3 view = V;
+ /* clang-format off */
+
LIGHT_SHADER_CODE
+ /* clang-format on */
#else
- float NdotL = dot(N,L);
+ float NdotL = dot(N, L);
float cNdotL = max(NdotL, 0.0); // clamped NdotL
float NdotV = dot(N, V);
float cNdotV = max(NdotV, 0.0);
@@ -975,10 +951,9 @@ LIGHT_SHADER_CODE
float diffuse_brdf_NL; // BRDF times N.L for calculating diffuse radiance
#endif
-
#if defined(DIFFUSE_LAMBERT_WRAP)
- //energy conserving lambert wrap shader
- diffuse_brdf_NL = max(0.0,(NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
+ // energy conserving lambert wrap shader
+ diffuse_brdf_NL = max(0.0, (NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
#elif defined(DIFFUSE_OREN_NAYAR)
@@ -986,12 +961,11 @@ LIGHT_SHADER_CODE
// see http://mimosa-pudica.net/improved-oren-nayar.html
float LdotV = dot(L, V);
-
float s = LdotV - NdotL * NdotV;
float t = mix(1.0, max(NdotL, NdotV), step(0.0, s));
float sigma2 = roughness * roughness; // TODO: this needs checking
- vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) );
+ vec3 A = 1.0 + sigma2 * (-0.5 / (sigma2 + 0.33) + 0.17 * diffuse_color / (sigma2 + 0.13));
float B = 0.45 * sigma2 / (sigma2 + 0.09);
diffuse_brdf_NL = cNdotL * (A + vec3(B) * s / t) * (1.0 / M_PI);
@@ -999,21 +973,20 @@ LIGHT_SHADER_CODE
#elif defined(DIFFUSE_TOON)
- diffuse_brdf_NL = smoothstep(-roughness,max(roughness,0.01),NdotL);
+ diffuse_brdf_NL = smoothstep(-roughness, max(roughness, 0.01), NdotL);
#elif defined(DIFFUSE_BURLEY)
{
-
vec3 H = normalize(V + L);
- float cLdotH = max(0.0,dot(L, H));
+ float cLdotH = max(0.0, dot(L, H));
float FD90 = 0.5 + 2.0 * cLdotH * cLdotH * roughness;
float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotV);
float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotL);
diffuse_brdf_NL = (1.0 / M_PI) * FdV * FdL * cNdotL;
- /*
+ /*
float energyBias = mix(roughness, 0.0, 0.5);
float energyFactor = mix(roughness, 1.0, 1.0 / 1.51);
float fd90 = energyBias + 2.0 * VoH * VoH * roughness;
@@ -1021,10 +994,11 @@ LIGHT_SHADER_CODE
float lightScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotL, 5.0);
float viewScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotV, 5.0);
- diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;*/
+ diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;
+ */
}
#else
- //lambert
+ // lambert
diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
#endif
@@ -1034,70 +1008,67 @@ LIGHT_SHADER_CODE
diffuse_light += light_color * diffuse_color * (vec3(1.0 / M_PI) - diffuse_brdf_NL) * transmission * attenuation;
#endif
-
#if defined(LIGHT_USE_RIM)
- float rim_light = pow(max(0.0,1.0-cNdotV), max(0.0,(1.0-roughness)*16.0));
- diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
+ float rim_light = pow(max(0.0, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0));
+ diffuse_light += rim_light * rim * mix(vec3(1.0), diffuse_color, rim_tint) * light_color;
#endif
}
-
if (roughness > 0.0) { // FIXME: roughness == 0 should not disable specular light entirely
-
// D
#if defined(SPECULAR_BLINN)
vec3 H = normalize(V + L);
- float cNdotH = max(dot(N,H), 0.0 );
- float intensity = pow( cNdotH, (1.0-roughness) * 256.0);
+ float cNdotH = max(dot(N, H), 0.0);
+ float intensity = pow(cNdotH, (1.0 - roughness) * 256.0);
specular_light += light_color * intensity * specular_blob_intensity * attenuation;
#elif defined(SPECULAR_PHONG)
- vec3 R = normalize(-reflect(L,N));
- float cRdotV = max(0.0,dot(R,V));
- float intensity = pow( cRdotV, (1.0-roughness) * 256.0);
- specular_light += light_color * intensity * specular_blob_intensity * attenuation;
+ vec3 R = normalize(-reflect(L, N));
+ float cRdotV = max(0.0, dot(R, V));
+ float intensity = pow(cRdotV, (1.0 - roughness) * 256.0);
+ specular_light += light_color * intensity * specular_blob_intensity * attenuation;
#elif defined(SPECULAR_TOON)
- vec3 R = normalize(-reflect(L,N));
- float RdotV = dot(R,V);
- float mid = 1.0-roughness;
- mid*=mid;
- float intensity = smoothstep(mid-roughness*0.5, mid+roughness*0.5, RdotV) * mid;
+ vec3 R = normalize(-reflect(L, N));
+ float RdotV = dot(R, V);
+ float mid = 1.0 - roughness;
+ mid *= mid;
+ float intensity = smoothstep(mid - roughness * 0.5, mid + roughness * 0.5, RdotV) * mid;
diffuse_light += light_color * intensity * specular_blob_intensity * attenuation; // write to diffuse_light, as in toon shading you generally want no reflection
#elif defined(SPECULAR_DISABLED)
- //none..
+ // none..
#elif defined(SPECULAR_SCHLICK_GGX)
// shlick+ggx as default
vec3 H = normalize(V + L);
- float cNdotH = max(dot(N,H), 0.0);
- float cLdotH = max(dot(L,H), 0.0);
+ float cNdotH = max(dot(N, H), 0.0);
+ float cLdotH = max(dot(L, H), 0.0);
-# if defined(LIGHT_USE_ANISOTROPY)
+#if defined(LIGHT_USE_ANISOTROPY)
- float aspect = sqrt(1.0-anisotropy*0.9);
- float rx = roughness/aspect;
- float ry = roughness*aspect;
- float ax = rx*rx;
- float ay = ry*ry;
- float XdotH = dot( T, H );
- float YdotH = dot( B, H );
+ float aspect = sqrt(1.0 - anisotropy * 0.9);
+ float rx = roughness / aspect;
+ float ry = roughness * aspect;
+ float ax = rx * rx;
+ float ay = ry * ry;
+ float XdotH = dot(T, H);
+ float YdotH = dot(B, H);
float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);
float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH);
-# else
+#else
float alpha = roughness * roughness;
float D = D_GGX(cNdotH, alpha);
float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha);
-# endif
+#endif
// F
float F0 = 1.0; // FIXME
float cLdotH5 = SchlickFresnel(cLdotH);
@@ -1110,19 +1081,18 @@ LIGHT_SHADER_CODE
#if defined(LIGHT_USE_CLEARCOAT)
if (clearcoat_gloss > 0.0) {
-# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN)
+#if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN)
vec3 H = normalize(V + L);
-# endif
-# if !defined(SPECULAR_SCHLICK_GGX)
- float cNdotH = max(dot(N,H), 0.0);
- float cLdotH = max(dot(L,H), 0.0);
+#endif
+#if !defined(SPECULAR_SCHLICK_GGX)
+ float cNdotH = max(dot(N, H), 0.0);
+ float cLdotH = max(dot(L, H), 0.0);
float cLdotH5 = SchlickFresnel(cLdotH);
#endif
float Dr = GTR1(cNdotH, mix(.1, .001, clearcoat_gloss));
float Fr = mix(.04, 1.0, cLdotH5);
float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25);
-
float specular_brdf_NL = 0.25 * clearcoat * Gr * Fr * Dr * cNdotL;
specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation;
@@ -1130,45 +1100,42 @@ LIGHT_SHADER_CODE
#endif
}
-
#endif //defined(USE_LIGHT_SHADER_CODE)
}
-
float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 pos, float depth, vec4 clamp_rect) {
#ifdef SHADOW_MODE_PCF_13
- float avg=textureProj(shadow,vec4(pos,depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x*2.0,0.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x*2.0,0.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y*2.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y*2.0),depth,1.0));
- return avg*(1.0/13.0);
+ float avg = textureProj(shadow, vec4(pos, depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, 0.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, 0.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(0.0, shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(0.0, -shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, -shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, -shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x * 2.0, 0.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x * 2.0, 0.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(0.0, shadow_pixel_size.y * 2.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(0.0, -shadow_pixel_size.y * 2.0), depth, 1.0));
+ return avg * (1.0 / 13.0);
#elif defined(SHADOW_MODE_PCF_5)
- float avg=textureProj(shadow,vec4(pos,depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0));
- avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0));
- return avg*(1.0/5.0);
+ float avg = textureProj(shadow, vec4(pos, depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, 0.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, 0.0), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(0.0, shadow_pixel_size.y), depth, 1.0));
+ avg += textureProj(shadow, vec4(pos + vec2(0.0, -shadow_pixel_size.y), depth, 1.0));
+ return avg * (1.0 / 5.0);
#else
- return textureProj(shadow,vec4(pos,depth,1.0));
+ return textureProj(shadow, vec4(pos, depth, 1.0));
#endif
-
}
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
@@ -1177,239 +1144,227 @@ in highp float dp_clip;
#endif
-
-
#if 0
-//need to save texture depth for this
-
+// need to save texture depth for this
vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 pos, float distance) {
float scale = 8.25 * (1.0 - translucency) / subsurface_scatter_width;
float d = scale * distance;
- /**
- * Armed with the thickness, we can now calculate the color by means of the
- * precalculated transmittance profile.
- * (It can be precomputed into a texture, for maximum performance):
- */
+ /**
+ * Armed with the thickness, we can now calculate the color by means of the
+ * precalculated transmittance profile.
+ * (It can be precomputed into a texture, for maximum performance):
+ */
float dd = -d * d;
- vec3 profile = vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
- vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
- vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
- vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
- vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) +
- vec3(0.078, 0.0, 0.0) * exp(dd / 7.41);
-
- /**
- * Using the profile, we finally approximate the transmitted lighting from
- * the back of the object:
- */
- return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0);
+ vec3 profile =
+ vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
+ vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
+ vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
+ vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
+ vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) +
+ vec3(0.078, 0.0, 0.0) * exp(dd / 7.41);
+
+ /**
+ * Using the profile, we finally approximate the transmitted lighting from
+ * the back of the object:
+ */
+ return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0);
}
#endif
-void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
- 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;
- float omni_attenuation = pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w );
+ 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;
+ float omni_attenuation = pow(max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w);
vec3 light_attenuation = vec3(omni_attenuation);
#if !defined(SHADOWS_DISABLED)
- if (omni_lights[idx].light_params.w>0.5) {
- //there is a shadowmap
+ if (omni_lights[idx].light_params.w > 0.5) {
+ // there is a shadowmap
- highp vec3 splane=(omni_lights[idx].shadow_matrix * vec4(vertex,1.0)).xyz;
- float shadow_len=length(splane);
- splane=normalize(splane);
- vec4 clamp_rect=omni_lights[idx].light_clamp;
+ highp vec3 splane = (omni_lights[idx].shadow_matrix * vec4(vertex, 1.0)).xyz;
+ float shadow_len = length(splane);
+ splane = normalize(splane);
+ vec4 clamp_rect = omni_lights[idx].light_clamp;
- if (splane.z>=0.0) {
+ if (splane.z >= 0.0) {
- splane.z+=1.0;
+ splane.z += 1.0;
- clamp_rect.y+=clamp_rect.w;
+ clamp_rect.y += clamp_rect.w;
} else {
- splane.z=1.0 - splane.z;
+ splane.z = 1.0 - splane.z;
/*
- if (clamp_rect.z<clamp_rect.w) {
- clamp_rect.x+=clamp_rect.z;
+ if (clamp_rect.z < clamp_rect.w) {
+ clamp_rect.x += clamp_rect.z;
} else {
- clamp_rect.y+=clamp_rect.w;
+ clamp_rect.y += clamp_rect.w;
}
*/
-
}
- splane.xy/=splane.z;
- splane.xy=splane.xy * 0.5 + 0.5;
+ splane.xy /= splane.z;
+ splane.xy = splane.xy * 0.5 + 0.5;
splane.z = shadow_len * omni_lights[idx].light_pos_inv_radius.w;
- 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);
+ 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);
+ 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);
+ light_attenuation *= mix(omni_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow);
}
#endif //SHADOWS_DISABLED
-
- light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim * omni_attenuation,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
-
+ light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, omni_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, omni_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, rim * omni_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
}
-void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent,vec3 albedo, vec3 transmission,float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
+void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
- 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;
- float spot_attenuation = pow( max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w );
+ 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;
+ float spot_attenuation = 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 = max(0.0001,(1.0 - scos) / (1.0 - spot_cutoff));
- spot_attenuation*= 1.0 - pow( spot_rim, spot_lights[idx].light_params.x);
+ float spot_cutoff = spot_lights[idx].light_params.y;
+ float scos = max(dot(-normalize(light_rel_vec), spot_dir), spot_cutoff);
+ float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - spot_cutoff));
+ spot_attenuation *= 1.0 - pow(spot_rim, spot_lights[idx].light_params.x);
vec3 light_attenuation = vec3(spot_attenuation);
#if !defined(SHADOWS_DISABLED)
- if (spot_lights[idx].light_params.w>0.5) {
+ if (spot_lights[idx].light_params.w > 0.5) {
//there is a shadowmap
- highp vec4 splane=(spot_lights[idx].shadow_matrix * vec4(vertex,1.0));
- splane.xyz/=splane.w;
+ highp vec4 splane = (spot_lights[idx].shadow_matrix * vec4(vertex, 1.0));
+ splane.xyz /= splane.w;
- float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp);
+ 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);
+ 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);
+ light_attenuation *= mix(spot_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow);
}
#endif //SHADOWS_DISABLED
- light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim * spot_attenuation,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
-
+ light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, spot_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, spot_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, rim * spot_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
}
-void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 tangent,float roughness,float anisotropy,vec3 ambient,vec3 skybox, inout highp vec4 reflection_accum,inout highp vec4 ambient_accum) {
+void reflection_process(int idx, vec3 vertex, vec3 normal, vec3 binormal, vec3 tangent, float roughness, float anisotropy, vec3 ambient, vec3 skybox, inout highp vec4 reflection_accum, inout highp vec4 ambient_accum) {
- vec3 ref_vec = normalize(reflect(vertex,normal));
- vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex,1.0)).xyz;
+ vec3 ref_vec = normalize(reflect(vertex, normal));
+ vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex, 1.0)).xyz;
vec3 box_extents = reflections[idx].box_extents.xyz;
- if (any(greaterThan(abs(local_pos),box_extents))) { //out of the reflection box
+ if (any(greaterThan(abs(local_pos), box_extents))) { //out of the reflection box
return;
}
vec3 inner_pos = abs(local_pos / box_extents);
- float blend = max(inner_pos.x,max(inner_pos.y,inner_pos.z));
+ float blend = max(inner_pos.x, max(inner_pos.y, inner_pos.z));
//make blend more rounded
- blend=mix(length(inner_pos),blend,blend);
- blend*=blend;
- blend=max(0.0, 1.0-blend);
+ blend = mix(length(inner_pos), blend, blend);
+ blend *= blend;
+ blend = max(0.0, 1.0 - blend);
- if (reflections[idx].params.x>0.0){// compute reflection
+ if (reflections[idx].params.x > 0.0) { // compute reflection
- vec3 local_ref_vec = (reflections[idx].local_matrix * vec4(ref_vec,0.0)).xyz;
+ vec3 local_ref_vec = (reflections[idx].local_matrix * vec4(ref_vec, 0.0)).xyz;
if (reflections[idx].params.w > 0.5) { //box project
vec3 nrdir = normalize(local_ref_vec);
- vec3 rbmax = (box_extents - local_pos)/nrdir;
- vec3 rbmin = (-box_extents - local_pos)/nrdir;
-
+ vec3 rbmax = (box_extents - local_pos) / nrdir;
+ vec3 rbmin = (-box_extents - local_pos) / nrdir;
- vec3 rbminmax = mix(rbmin,rbmax,greaterThan(nrdir,vec3(0.0,0.0,0.0)));
+ vec3 rbminmax = mix(rbmin, rbmax, greaterThan(nrdir, vec3(0.0, 0.0, 0.0)));
float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);
vec3 posonbox = local_pos + nrdir * fa;
local_ref_vec = posonbox - reflections[idx].box_offset.xyz;
}
-
- vec4 clamp_rect=reflections[idx].atlas_clamp;
+ vec4 clamp_rect = reflections[idx].atlas_clamp;
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.0) {
- norm.y=0.5-norm.y+0.5;
+ 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.0) {
+ norm.y = 0.5 - norm.y + 0.5;
}
- vec2 atlas_uv = norm.xy * clamp_rect.zw + clamp_rect.xy;
- atlas_uv = clamp(atlas_uv,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw);
+ vec2 atlas_uv = norm.xy * clamp_rect.zw + clamp_rect.xy;
+ atlas_uv = clamp(atlas_uv, clamp_rect.xy, clamp_rect.xy + clamp_rect.zw);
highp vec4 reflection;
- reflection.rgb = textureLod(reflection_atlas,atlas_uv,roughness*5.0).rgb;
+ reflection.rgb = textureLod(reflection_atlas, atlas_uv, roughness * 5.0).rgb;
if (reflections[idx].params.z < 0.5) {
- reflection.rgb = mix(skybox,reflection.rgb,blend);
+ reflection.rgb = mix(skybox, reflection.rgb, blend);
}
- reflection.rgb*=reflections[idx].params.x;
+ reflection.rgb *= reflections[idx].params.x;
reflection.a = blend;
- reflection.rgb*=reflection.a;
+ reflection.rgb *= reflection.a;
- reflection_accum+=reflection;
+ reflection_accum += reflection;
}
#ifndef USE_LIGHTMAP
- if (reflections[idx].ambient.a>0.0) { //compute ambient using skybox
-
+ if (reflections[idx].ambient.a > 0.0) { //compute ambient using skybox
- vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal,0.0)).xyz;
+ vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal, 0.0)).xyz;
- vec3 splane=normalize(local_amb_vec);
- vec4 clamp_rect=reflections[idx].atlas_clamp;
+ vec3 splane = normalize(local_amb_vec);
+ vec4 clamp_rect = reflections[idx].atlas_clamp;
- splane.z*=-1.0;
- if (splane.z>=0.0) {
- splane.z+=1.0;
- clamp_rect.y+=clamp_rect.w;
+ splane.z *= -1.0;
+ if (splane.z >= 0.0) {
+ splane.z += 1.0;
+ clamp_rect.y += clamp_rect.w;
} else {
- splane.z=1.0 - splane.z;
- splane.y=-splane.y;
+ splane.z = 1.0 - splane.z;
+ splane.y = -splane.y;
}
- splane.xy/=splane.z;
- splane.xy=splane.xy * 0.5 + 0.5;
+ splane.xy /= splane.z;
+ splane.xy = splane.xy * 0.5 + 0.5;
splane.xy = splane.xy * clamp_rect.zw + clamp_rect.xy;
- splane.xy = clamp(splane.xy,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw);
+ splane.xy = clamp(splane.xy, clamp_rect.xy, clamp_rect.xy + clamp_rect.zw);
highp vec4 ambient_out;
- ambient_out.a=blend;
- ambient_out.rgb = textureLod(reflection_atlas,splane.xy,5.0).rgb;
- ambient_out.rgb=mix(reflections[idx].ambient.rgb,ambient_out.rgb,reflections[idx].ambient.a);
+ ambient_out.a = blend;
+ ambient_out.rgb = textureLod(reflection_atlas, splane.xy, 5.0).rgb;
+ ambient_out.rgb = mix(reflections[idx].ambient.rgb, ambient_out.rgb, reflections[idx].ambient.a);
if (reflections[idx].params.z < 0.5) {
- ambient_out.rgb = mix(ambient,ambient_out.rgb,blend);
+ ambient_out.rgb = mix(ambient, ambient_out.rgb, blend);
}
ambient_out.rgb *= ambient_out.a;
- ambient_accum+=ambient_out;
+ ambient_accum += ambient_out;
} else {
highp vec4 ambient_out;
- ambient_out.a=blend;
- ambient_out.rgb=reflections[idx].ambient.rgb;
+ ambient_out.a = blend;
+ ambient_out.rgb = reflections[idx].ambient.rgb;
if (reflections[idx].params.z < 0.5) {
- ambient_out.rgb = mix(ambient,ambient_out.rgb,blend);
+ ambient_out.rgb = mix(ambient, ambient_out.rgb, blend);
}
ambient_out.rgb *= ambient_out.a;
- ambient_accum+=ambient_out;
-
+ ambient_accum += ambient_out;
}
#endif
}
@@ -1448,13 +1403,13 @@ uniform bool gi_probe_blend_ambient2;
vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, bool blend_ambient, vec3 direction, float tan_half_angle, float max_distance, float p_bias) {
- float dist = p_bias;//1.0; //dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0;
- float alpha=0.0;
+ float dist = p_bias; //1.0; //dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0;
+ float alpha = 0.0;
vec3 color = vec3(0.0);
- while(dist < max_distance && alpha < 0.95) {
+ while (dist < max_distance && alpha < 0.95) {
float diameter = max(1.0, 2.0 * tan_half_angle * dist);
- vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) );
+ vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter));
float a = (1.0 - alpha);
color += scolor.rgb * a;
alpha += a * scolor.a;
@@ -1462,35 +1417,33 @@ vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 am
}
if (blend_ambient) {
- color.rgb = mix(ambient,color.rgb,min(1.0,alpha/0.95));
+ color.rgb = mix(ambient, color.rgb, min(1.0, alpha / 0.95));
}
return color;
}
-void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient,float multiplier, mat3 normal_mtx,vec3 ref_vec, float roughness,float p_bias,float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) {
-
-
+void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds, vec3 cell_size, vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient, float multiplier, mat3 normal_mtx, vec3 ref_vec, float roughness, float p_bias, float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) {
- vec3 probe_pos = (probe_xform * vec4(pos,1.0)).xyz;
- vec3 ref_pos = (probe_xform * vec4(pos+ref_vec,1.0)).xyz;
+ vec3 probe_pos = (probe_xform * vec4(pos, 1.0)).xyz;
+ vec3 ref_pos = (probe_xform * vec4(pos + ref_vec, 1.0)).xyz;
ref_vec = normalize(ref_pos - probe_pos);
- probe_pos+=(probe_xform * vec4(normal_mtx[2],0.0)).xyz*p_normal_bias;
+ probe_pos += (probe_xform * vec4(normal_mtx[2], 0.0)).xyz * p_normal_bias;
-/* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0);
+ /* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0);
out_diff.a = 1.0;
return;*/
//out_diff = vec4(textureLod(probe,probe_pos*cell_size,3.0).rgb,1.0);
//return;
//this causes corrupted pixels, i have no idea why..
- if (any(bvec2(any(lessThan(probe_pos,vec3(0.0))),any(greaterThan(probe_pos,bounds))))) {
+ if (any(bvec2(any(lessThan(probe_pos, vec3(0.0))), any(greaterThan(probe_pos, bounds))))) {
return;
}
- vec3 blendv = abs(probe_pos/bounds * 2.0 - 1.0);
- float blend = clamp(1.0-max(blendv.x,max(blendv.y,blendv.z)), 0.0, 1.0);
+ vec3 blendv = abs(probe_pos / bounds * 2.0 - 1.0);
+ float blend = clamp(1.0 - max(blendv.x, max(blendv.y, blendv.z)), 0.0, 1.0);
//float blend=1.0;
float max_distance = length(bounds);
@@ -1499,14 +1452,13 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec
#ifdef VCT_QUALITY_HIGH
#define MAX_CONE_DIRS 6
- vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] (
- vec3(0, 0, 1),
- vec3(0.866025, 0, 0.5),
- vec3(0.267617, 0.823639, 0.5),
- vec3(-0.700629, 0.509037, 0.5),
- vec3(-0.700629, -0.509037, 0.5),
- vec3(0.267617, -0.823639, 0.5)
- );
+ vec3 cone_dirs[MAX_CONE_DIRS] = vec3[](
+ vec3(0, 0, 1),
+ vec3(0.866025, 0, 0.5),
+ vec3(0.267617, 0.823639, 0.5),
+ vec3(-0.700629, 0.509037, 0.5),
+ vec3(-0.700629, -0.509037, 0.5),
+ vec3(0.267617, -0.823639, 0.5));
float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15);
float cone_angle_tan = 0.577;
@@ -1515,54 +1467,50 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec
#define MAX_CONE_DIRS 4
- vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] (
+ vec3 cone_dirs[MAX_CONE_DIRS] = vec3[](
vec3(0.707107, 0, 0.707107),
vec3(0, 0.707107, 0.707107),
vec3(-0.707107, 0, 0.707107),
- vec3(0, -0.707107, 0.707107)
- );
+ vec3(0, -0.707107, 0.707107));
float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25);
float cone_angle_tan = 0.98269;
- max_distance*=0.5;
+ max_distance *= 0.5;
float min_ref_tan = 0.2;
#endif
- vec3 light=vec3(0.0);
- for(int i=0;i<MAX_CONE_DIRS;i++) {
-
- vec3 dir = normalize( (probe_xform * vec4(pos + normal_mtx * cone_dirs[i],1.0)).xyz - probe_pos);
- light+=cone_weights[i] * voxel_cone_trace(probe,cell_size,probe_pos,ambient,blend_ambient,dir,cone_angle_tan,max_distance,p_bias);
+ vec3 light = vec3(0.0);
+ for (int i = 0; i < MAX_CONE_DIRS; i++) {
+ vec3 dir = normalize((probe_xform * vec4(pos + normal_mtx * cone_dirs[i], 1.0)).xyz - probe_pos);
+ light += cone_weights[i] * voxel_cone_trace(probe, cell_size, probe_pos, ambient, blend_ambient, dir, cone_angle_tan, max_distance, p_bias);
}
- light*=multiplier;
+ light *= multiplier;
- out_diff += vec4(light*blend,blend);
+ out_diff += vec4(light * blend, blend);
//irradiance
- vec3 irr_light = voxel_cone_trace(probe,cell_size,probe_pos,environment,blend_ambient,ref_vec,max(min_ref_tan,tan(roughness * 0.5 * M_PI)) ,max_distance,p_bias);
+ vec3 irr_light = voxel_cone_trace(probe, cell_size, probe_pos, environment, blend_ambient, ref_vec, max(min_ref_tan, tan(roughness * 0.5 * M_PI)), max_distance, p_bias);
irr_light *= multiplier;
//irr_light=vec3(0.0);
- out_spec += vec4(irr_light*blend,blend);
-
+ out_spec += vec4(irr_light * blend, blend);
}
-
void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_specular, inout vec3 out_ambient) {
roughness = roughness * roughness;
- vec3 ref_vec = normalize(reflect(normalize(pos),normal));
+ vec3 ref_vec = normalize(reflect(normalize(pos), normal));
//find arbitrary tangent and bitangent, then build a matrix
vec3 v0 = abs(normal.z) < 0.999 ? vec3(0, 0, 1) : vec3(0, 1, 0);
vec3 tangent = normalize(cross(v0, normal));
vec3 bitangent = normalize(cross(tangent, normal));
- mat3 normal_mat = mat3(tangent,bitangent,normal);
+ mat3 normal_mat = mat3(tangent, bitangent, normal);
vec4 diff_accum = vec4(0.0);
vec4 spec_accum = vec4(0.0);
@@ -1574,35 +1522,32 @@ void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_sp
out_specular = vec3(0.0);
- gi_probe_compute(gi_probe1,gi_probe_xform1,gi_probe_bounds1,gi_probe_cell_size1,pos,ambient,environment,gi_probe_blend_ambient1,gi_probe_multiplier1,normal_mat,ref_vec,roughness,gi_probe_bias1,gi_probe_normal_bias1,spec_accum,diff_accum);
+ gi_probe_compute(gi_probe1, gi_probe_xform1, gi_probe_bounds1, gi_probe_cell_size1, pos, ambient, environment, gi_probe_blend_ambient1, gi_probe_multiplier1, normal_mat, ref_vec, roughness, gi_probe_bias1, gi_probe_normal_bias1, spec_accum, diff_accum);
if (gi_probe2_enabled) {
- gi_probe_compute(gi_probe2,gi_probe_xform2,gi_probe_bounds2,gi_probe_cell_size2,pos,ambient,environment,gi_probe_blend_ambient2,gi_probe_multiplier2,normal_mat,ref_vec,roughness,gi_probe_bias2,gi_probe_normal_bias2,spec_accum,diff_accum);
+ gi_probe_compute(gi_probe2, gi_probe_xform2, gi_probe_bounds2, gi_probe_cell_size2, pos, ambient, environment, gi_probe_blend_ambient2, gi_probe_multiplier2, normal_mat, ref_vec, roughness, gi_probe_bias2, gi_probe_normal_bias2, spec_accum, diff_accum);
}
- if (diff_accum.a>0.0) {
- diff_accum.rgb/=diff_accum.a;
+ if (diff_accum.a > 0.0) {
+ diff_accum.rgb /= diff_accum.a;
}
- if (spec_accum.a>0.0) {
- spec_accum.rgb/=spec_accum.a;
+ if (spec_accum.a > 0.0) {
+ spec_accum.rgb /= spec_accum.a;
}
- out_specular+=spec_accum.rgb;
- out_ambient+=diff_accum.rgb;
-
+ out_specular += spec_accum.rgb;
+ out_ambient += diff_accum.rgb;
}
#endif
-
-
void main() {
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
- if (dp_clip>0.0)
+ if (dp_clip > 0.0)
discard;
#endif
@@ -1622,37 +1567,36 @@ void main() {
vec2 anisotropy_flow = vec2(1.0, 0.0);
#if defined(ENABLE_AO)
- float ao=1.0;
- float ao_light_affect=0.0;
+ float ao = 1.0;
+ float ao_light_affect = 0.0;
#endif
float alpha = 1.0;
#if defined(DO_SIDE_CHECK)
- float side=gl_FrontFacing ? 1.0 : -1.0;
+ float side = gl_FrontFacing ? 1.0 : -1.0;
#else
- float side=1.0;
+ float side = 1.0;
#endif
-
#if defined(ALPHA_SCISSOR_USED)
float alpha_scissor = 0.5;
#endif
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
- vec3 binormal = normalize(binormal_interp)*side;
- vec3 tangent = normalize(tangent_interp)*side;
+ vec3 binormal = normalize(binormal_interp) * side;
+ vec3 tangent = normalize(tangent_interp) * side;
#else
vec3 binormal = vec3(0.0);
vec3 tangent = vec3(0.0);
#endif
- vec3 normal = normalize(normal_interp)*side;
+ vec3 normal = normalize(normal_interp) * side;
#if defined(ENABLE_UV_INTERP)
vec2 uv = uv_interp;
#endif
-#if defined(ENABLE_UV2_INTERP) || defined (USE_LIGHTMAP)
+#if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP)
vec2 uv2 = uv2_interp;
#endif
@@ -1665,33 +1609,33 @@ void main() {
vec3 normalmap = vec3(0.5);
#endif
- float normaldepth=1.0;
+ float normaldepth = 1.0;
#if defined(SCREEN_UV_USED)
- vec2 screen_uv = gl_FragCoord.xy*screen_pixel_size;
+ vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
-#if defined (ENABLE_SSS)
- float sss_strength=0.0;
+#if defined(ENABLE_SSS)
+ float sss_strength = 0.0;
#endif
-{
-
+ {
+ /* clang-format off */
FRAGMENT_SHADER_CODE
-}
-
+ /* clang-format on */
+ }
#if defined(ALPHA_SCISSOR_USED)
- if (alpha<alpha_scissor) {
+ if (alpha < alpha_scissor) {
discard;
}
#endif
#ifdef USE_OPAQUE_PREPASS
- if (alpha<opaque_prepass_threshold) {
+ if (alpha < opaque_prepass_threshold) {
discard;
}
@@ -1699,33 +1643,33 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_NORMALMAP)
- normalmap.xy=normalmap.xy*2.0-1.0;
- normalmap.z=sqrt(max(0.0, 1.0-dot(normalmap.xy,normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
+ normalmap.xy = normalmap.xy * 2.0 - 1.0;
+ normalmap.z = sqrt(max(0.0, 1.0 - dot(normalmap.xy, normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
- normal = normalize( mix(normal_interp,tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z,normaldepth) ) * side;
+ normal = normalize(mix(normal_interp, tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z, normaldepth)) * side;
#endif
#if defined(LIGHT_USE_ANISOTROPY)
- if (anisotropy>0.01) {
+ if (anisotropy > 0.01) {
//rotation matrix
- mat3 rot = mat3( tangent, binormal, normal );
+ mat3 rot = mat3(tangent, binormal, normal);
//make local to space
- tangent = normalize(rot * vec3(anisotropy_flow.x,anisotropy_flow.y,0.0));
- binormal = normalize(rot * vec3(-anisotropy_flow.y,anisotropy_flow.x,0.0));
+ tangent = normalize(rot * vec3(anisotropy_flow.x, anisotropy_flow.y, 0.0));
+ binormal = normalize(rot * vec3(-anisotropy_flow.y, anisotropy_flow.x, 0.0));
}
#endif
#ifdef ENABLE_CLIP_ALPHA
- if (albedo.a<0.99) {
+ if (albedo.a < 0.99) {
//used for doublepass and shadowmapping
discard;
}
#endif
-/////////////////////// LIGHTING //////////////////////////////
+ /////////////////////// LIGHTING //////////////////////////////
//apply energy conservation
@@ -1735,44 +1679,40 @@ FRAGMENT_SHADER_CODE
vec3 diffuse_light = diffuse_light_interp.rgb;
#else
- vec3 specular_light = vec3(0.0,0.0,0.0);
- vec3 diffuse_light = vec3(0.0,0.0,0.0);
+ vec3 specular_light = vec3(0.0, 0.0, 0.0);
+ 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 );
-
+ vec3 env_reflection_light = vec3(0.0, 0.0, 0.0);
+ vec3 eye_vec = -normalize(vertex_interp);
#ifdef USE_RADIANCE_MAP
#ifdef AMBIENT_LIGHT_DISABLED
- ambient_light=vec3(0.0,0.0,0.0);
+ ambient_light = vec3(0.0, 0.0, 0.0);
#else
{
{ //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 = textureDualParaboloid(radiance_map,ref_vec,roughness) * bg_energy;
+ 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 = textureDualParaboloid(radiance_map, ref_vec, roughness) * bg_energy;
env_reflection_light = radiance;
-
}
//no longer a cubemap
//vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y);
-
}
#ifndef USE_LIGHTMAP
{
- vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz);
- vec3 env_ambient=textureDualParaboloid(radiance_map,ambient_dir,1.0) * bg_energy;
+ vec3 ambient_dir = normalize((radiance_inverse_xform * vec4(normal, 0.0)).xyz);
+ 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 = mix(ambient_light_color.rgb, env_ambient, radiance_ambient_contribution);
//ambient_light=vec3(0.0,0.0,0.0);
}
#endif
@@ -1781,23 +1721,23 @@ FRAGMENT_SHADER_CODE
#else
#ifdef AMBIENT_LIGHT_DISABLED
- ambient_light=vec3(0.0,0.0,0.0);
+ ambient_light = vec3(0.0, 0.0, 0.0);
#else
- ambient_light=ambient_light_color.rgb;
+ ambient_light = ambient_light_color.rgb;
#endif //AMBIENT_LIGHT_DISABLED
#endif
- ambient_light*=ambient_energy;
+ ambient_light *= ambient_energy;
- float specular_blob_intensity=1.0;
+ float specular_blob_intensity = 1.0;
#if defined(SPECULAR_TOON)
- specular_blob_intensity*=specular * 2.0;
+ specular_blob_intensity *= specular * 2.0;
#endif
#if defined(USE_LIGHT_DIRECTIONAL)
- vec3 light_attenuation=vec3(1.0);
+ vec3 light_attenuation = vec3(1.0);
float depth_z = -vertex.z;
#ifdef LIGHT_DIRECTIONAL_SHADOW
@@ -1811,261 +1751,234 @@ FRAGMENT_SHADER_CODE
if (depth_z < shadow_split_offsets.x) {
#endif //LIGHT_USE_PSSM4
- vec3 pssm_coord;
- float pssm_fade=0.0;
+ vec3 pssm_coord;
+ float pssm_fade = 0.0;
#ifdef LIGHT_USE_PSSM_BLEND
- float pssm_blend;
- vec3 pssm_coord2;
- bool use_blend=true;
+ float pssm_blend;
+ vec3 pssm_coord2;
+ bool use_blend = true;
#endif
-
#ifdef LIGHT_USE_PSSM4
+ if (depth_z < shadow_split_offsets.y) {
- if (depth_z < shadow_split_offsets.y) {
-
- if (depth_z < shadow_split_offsets.x) {
-
- highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
+ if (depth_z < shadow_split_offsets.x) {
+ highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
- splane=(shadow_matrix2 * vec4(vertex,1.0));
- pssm_coord2=splane.xyz/splane.w;
- pssm_blend=smoothstep(0.0,shadow_split_offsets.x,depth_z);
+ splane = (shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
+ pssm_blend = smoothstep(0.0, shadow_split_offsets.x, depth_z);
#endif
- } else {
+ } else {
- highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
+ highp vec4 splane = (shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
- splane=(shadow_matrix3 * vec4(vertex,1.0));
- pssm_coord2=splane.xyz/splane.w;
- pssm_blend=smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,depth_z);
+ splane = (shadow_matrix3 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
+ pssm_blend = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z);
#endif
+ }
+ } else {
- }
- } else {
-
-
- if (depth_z < shadow_split_offsets.z) {
+ if (depth_z < shadow_split_offsets.z) {
- highp vec4 splane=(shadow_matrix3 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
+ highp vec4 splane = (shadow_matrix3 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
- splane=(shadow_matrix4 * vec4(vertex,1.0));
- pssm_coord2=splane.xyz/splane.w;
- pssm_blend=smoothstep(shadow_split_offsets.y,shadow_split_offsets.z,depth_z);
+ splane = (shadow_matrix4 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
+ pssm_blend = smoothstep(shadow_split_offsets.y, shadow_split_offsets.z, depth_z);
#endif
- } else {
+ } else {
- highp vec4 splane=(shadow_matrix4 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
- pssm_fade = smoothstep(shadow_split_offsets.z,shadow_split_offsets.w,depth_z);
+ highp vec4 splane = (shadow_matrix4 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
+ pssm_fade = smoothstep(shadow_split_offsets.z, shadow_split_offsets.w, depth_z);
#if defined(LIGHT_USE_PSSM_BLEND)
- use_blend=false;
+ use_blend = false;
#endif
-
+ }
}
- }
-
-
#endif //LIGHT_USE_PSSM4
#ifdef LIGHT_USE_PSSM2
- if (depth_z < shadow_split_offsets.x) {
-
- highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
+ if (depth_z < shadow_split_offsets.x) {
+ highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
- splane=(shadow_matrix2 * vec4(vertex,1.0));
- pssm_coord2=splane.xyz/splane.w;
- pssm_blend=smoothstep(0.0,shadow_split_offsets.x,depth_z);
+ splane = (shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord2 = splane.xyz / splane.w;
+ pssm_blend = smoothstep(0.0, shadow_split_offsets.x, depth_z);
#endif
- } else {
- highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
- pssm_fade = smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,depth_z);
+ } else {
+ highp vec4 splane = (shadow_matrix2 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
+ pssm_fade = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z);
#if defined(LIGHT_USE_PSSM_BLEND)
- use_blend=false;
+ use_blend = false;
#endif
-
- }
+ }
#endif //LIGHT_USE_PSSM2
#if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2)
- { //regular orthogonal
- highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0));
- pssm_coord=splane.xyz/splane.w;
- }
+ { //regular orthogonal
+ highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
+ pssm_coord = splane.xyz / splane.w;
+ }
#endif
+ //one one sample
- //one one sample
-
- float shadow = sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp);
+ float shadow = sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord.xy, pssm_coord.z, light_clamp);
#if defined(LIGHT_USE_PSSM_BLEND)
- if (use_blend) {
- shadow=mix(shadow, sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp),pssm_blend);
- }
+ if (use_blend) {
+ shadow = mix(shadow, sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend);
+ }
#endif
#ifdef USE_CONTACT_SHADOWS
- if (shadow>0.01 && shadow_color_contact.a>0.0) {
+ 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);
-
- }
+ float contact_shadow = contact_shadow_compute(vertex, -light_direction_attenuation.xyz, shadow_color_contact.a);
+ shadow = min(shadow, contact_shadow);
+ }
#endif
- light_attenuation=mix(mix(shadow_color_contact.rgb,vec3(1.0),shadow),vec3(1.0),pssm_fade);
-
-
+ light_attenuation = mix(mix(shadow_color_contact.rgb, vec3(1.0), shadow), vec3(1.0), pssm_fade);
}
-
#endif // !defined(SHADOWS_DISABLED)
#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);
+ 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,transmission,light_params.z*specular_blob_intensity,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+ light_compute(normal, -light_direction_attenuation.xyz, eye_vec, binormal, tangent, light_color_energy.rgb, light_attenuation, albedo, transmission, light_params.z * specular_blob_intensity, roughness, metallic, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
#endif
-
#endif //#USE_LIGHT_DIRECTIONAL
#ifdef USE_GI_PROBES
- gi_probes_compute(vertex,normal,roughness,env_reflection_light,ambient_light);
+ gi_probes_compute(vertex, normal, roughness, env_reflection_light, ambient_light);
#endif
#ifdef USE_LIGHTMAP
- ambient_light = texture(lightmap,uv2).rgb * lightmap_energy;
+ ambient_light = texture(lightmap, uv2).rgb * lightmap_energy;
#endif
#ifdef USE_LIGHTMAP_CAPTURE
{
- vec3 cone_dirs[12] = vec3[] (
- vec3(0, 0, 1),
- vec3(0.866025, 0, 0.5),
- vec3(0.267617, 0.823639, 0.5),
- vec3(-0.700629, 0.509037, 0.5),
- vec3(-0.700629, -0.509037, 0.5),
- vec3(0.267617, -0.823639, 0.5),
- vec3(0, 0, -1),
- vec3(0.866025, 0, -0.5),
- vec3(0.267617, 0.823639, -0.5),
- vec3(-0.700629, 0.509037, -0.5),
- vec3(-0.700629, -0.509037, -0.5),
- vec3(0.267617, -0.823639, -0.5)
- );
-
-
- vec3 local_normal = normalize(camera_matrix * vec4(normal,0.0)).xyz;
+ vec3 cone_dirs[12] = vec3[](
+ vec3(0, 0, 1),
+ vec3(0.866025, 0, 0.5),
+ vec3(0.267617, 0.823639, 0.5),
+ vec3(-0.700629, 0.509037, 0.5),
+ vec3(-0.700629, -0.509037, 0.5),
+ vec3(0.267617, -0.823639, 0.5),
+ vec3(0, 0, -1),
+ vec3(0.866025, 0, -0.5),
+ vec3(0.267617, 0.823639, -0.5),
+ vec3(-0.700629, 0.509037, -0.5),
+ vec3(-0.700629, -0.509037, -0.5),
+ vec3(0.267617, -0.823639, -0.5));
+
+ vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz;
vec4 captured = vec4(0.0);
float sum = 0.0;
- for(int i=0;i<12;i++) {
- float amount = max(0.0,dot(local_normal,cone_dirs[i])); //not correct, but creates a nice wrap around effect
- captured += lightmap_captures[i]*amount;
- sum+=amount;
+ for (int i = 0; i < 12; i++) {
+ float amount = max(0.0, dot(local_normal, cone_dirs[i])); //not correct, but creates a nice wrap around effect
+ captured += lightmap_captures[i] * amount;
+ sum += amount;
}
- captured/=sum;
+ captured /= sum;
if (lightmap_capture_sky) {
- ambient_light = mix( ambient_light, captured.rgb, captured.a);
+ ambient_light = mix(ambient_light, captured.rgb, captured.a);
} else {
ambient_light = captured.rgb;
}
-
}
#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);
+ 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);
}
- if (reflection_accum.a>0.0) {
- specular_light+=reflection_accum.rgb/reflection_accum.a;
+ if (reflection_accum.a > 0.0) {
+ specular_light += reflection_accum.rgb / reflection_accum.a;
} else {
- specular_light+=env_reflection_light;
+ specular_light += env_reflection_light;
}
#ifndef USE_LIGHTMAP
- if (ambient_accum.a>0.0) {
- ambient_light=ambient_accum.rgb/ambient_accum.a;
+ if (ambient_accum.a > 0.0) {
+ ambient_light = ambient_accum.rgb / ambient_accum.a;
}
#endif
-
#ifdef USE_VERTEX_LIGHTING
- diffuse_light*=albedo;
+ 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,transmission,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light);
+ for (int i = 0; i < omni_light_count; i++) {
+ light_process_omni(omni_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light);
}
- for(int i=0;i<spot_light_count;i++) {
- light_process_spot(spot_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,transmission,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light);
+ for (int i = 0; i < spot_light_count; i++) {
+ light_process_spot(spot_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, 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
- specular_light*=reflection_multiplier;
- ambient_light*=albedo; //ambient must be multiplied by albedo at the end
+ specular_light *= reflection_multiplier;
+ ambient_light *= albedo; //ambient must be multiplied by albedo at the end
#if defined(ENABLE_AO)
- ambient_light*=ao;
- ao_light_affect = mix(1.0,ao,ao_light_affect);
- specular_light*=ao_light_affect;
- diffuse_light*=ao_light_affect;
+ ambient_light *= ao;
+ ao_light_affect = mix(1.0, ao, ao_light_affect);
+ specular_light *= ao_light_affect;
+ diffuse_light *= ao_light_affect;
#endif
-
-
//energy conservation
- diffuse_light *= 1.0-metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
- ambient_light *= 1.0-metallic;
-
+ diffuse_light *= 1.0 - metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
+ ambient_light *= 1.0 - metallic;
{
@@ -2076,27 +1989,24 @@ FRAGMENT_SHADER_CODE
// Environment brdf approximation (Lazarov 2013)
// see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
- const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04);
+ const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
vec4 r = roughness * c0 + c1;
- float ndotv = clamp(dot(normal,eye_vec),0.0,1.0);
- float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y;
- vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
+ float ndotv = clamp(dot(normal, eye_vec), 0.0, 1.0);
+ float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
+ vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;
vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo);
specular_light *= AB.x * specular_color + AB.y;
#endif
-
}
if (fog_color_enabled.a > 0.5) {
- float fog_amount=0.0;
-
-
+ float fog_amount = 0.0;
#ifdef USE_LIGHT_DIRECTIONAL
- vec3 fog_color = mix( fog_color_enabled.rgb, fog_sun_color_amount.rgb,fog_sun_color_amount.a * pow(max( dot(normalize(vertex),-light_direction_attenuation.xyz), 0.0),8.0) );
+ vec3 fog_color = mix(fog_color_enabled.rgb, fog_sun_color_amount.rgb, fog_sun_color_amount.a * pow(max(dot(normalize(vertex), -light_direction_attenuation.xyz), 0.0), 8.0));
#else
vec3 fog_color = fog_color_enabled.rgb;
@@ -2106,78 +2016,67 @@ FRAGMENT_SHADER_CODE
if (fog_depth_enabled) {
- float fog_z = smoothstep(fog_depth_begin,z_far,length(vertex));
+ float fog_z = smoothstep(fog_depth_begin, z_far, length(vertex));
- fog_amount = pow(fog_z,fog_depth_curve);
+ fog_amount = pow(fog_z, fog_depth_curve);
if (fog_transmit_enabled) {
vec3 total_light = emission + ambient_light + specular_light + diffuse_light;
- float transmit = pow(fog_z,fog_transmit_curve);
- fog_color = mix(max(total_light,fog_color),fog_color,transmit);
+ float transmit = pow(fog_z, fog_transmit_curve);
+ fog_color = mix(max(total_light, fog_color), fog_color, transmit);
}
}
if (fog_height_enabled) {
- float y = (camera_matrix * vec4(vertex,1.0)).y;
- fog_amount = max(fog_amount,pow(smoothstep(fog_height_min,fog_height_max,y),fog_height_curve));
+ float y = (camera_matrix * vec4(vertex, 1.0)).y;
+ fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve));
}
float rev_amount = 1.0 - fog_amount;
-
emission = emission * rev_amount + fog_color * fog_amount;
- ambient_light*=rev_amount;
- specular_light*rev_amount;
- diffuse_light*=rev_amount;
-
+ ambient_light *= rev_amount;
+ specular_light *rev_amount;
+ diffuse_light *= rev_amount;
}
#ifdef USE_MULTIPLE_RENDER_TARGETS
-
#ifdef SHADELESS
- diffuse_buffer=vec4(albedo.rgb,0.0);
- specular_buffer=vec4(0.0);
+ diffuse_buffer = vec4(albedo.rgb, 0.0);
+ specular_buffer = vec4(0.0);
#else
-
-
//approximate ambient scale for SSAO, since we will lack full ambient
- float max_emission=max(emission.r,max(emission.g,emission.b));
- float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b));
- float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b));
- float total_ambient = max_ambient+max_diffuse+max_emission;
- float ambient_scale = (total_ambient>0.0) ? (max_ambient+ambient_occlusion_affect_light*max_diffuse)/total_ambient : 0.0;
+ float max_emission = max(emission.r, max(emission.g, emission.b));
+ float max_ambient = max(ambient_light.r, max(ambient_light.g, ambient_light.b));
+ float max_diffuse = max(diffuse_light.r, max(diffuse_light.g, diffuse_light.b));
+ float total_ambient = max_ambient + max_diffuse + max_emission;
+ float ambient_scale = (total_ambient > 0.0) ? (max_ambient + ambient_occlusion_affect_light * max_diffuse) / total_ambient : 0.0;
#if defined(ENABLE_AO)
- ambient_scale=mix(0.0,ambient_scale,ambient_occlusion_affect_ao_channel);
+ ambient_scale = mix(0.0, ambient_scale, ambient_occlusion_affect_ao_channel);
#endif
- diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale);
- specular_buffer=vec4(specular_light,metallic);
+ diffuse_buffer = vec4(emission + diffuse_light + ambient_light, ambient_scale);
+ specular_buffer = vec4(specular_light, metallic);
#endif //SHADELESS
- normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness);
+ normal_mr_buffer = vec4(normalize(normal) * 0.5 + 0.5, roughness);
-#if defined (ENABLE_SSS)
+#if defined(ENABLE_SSS)
sss_buffer = sss_strength;
#endif
-
#else //USE_MULTIPLE_RENDER_TARGETS
-
#ifdef SHADELESS
- frag_color=vec4(albedo,alpha);
+ frag_color = vec4(albedo, alpha);
#else
- frag_color=vec4(emission+ambient_light+diffuse_light+specular_light,alpha);
+ frag_color = vec4(emission + ambient_light + diffuse_light + specular_light, alpha);
#endif //SHADELESS
#endif //USE_MULTIPLE_RENDER_TARGETS
-
-
#endif //RENDER_DEPTH
-
-
}
diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl
index b2e6f7a736..86546319a0 100644
--- a/drivers/gles3/shaders/screen_space_reflection.glsl
+++ b/drivers/gles3/shaders/screen_space_reflection.glsl
@@ -1,8 +1,9 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
out vec2 pos_interp;
@@ -11,13 +12,14 @@ void main() {
uv_interp = uv_in;
gl_Position = vertex_attrib;
- pos_interp.xy=gl_Position.xy;
+ pos_interp.xy = gl_Position.xy;
}
+/* clang-format off */
[fragment]
-
in vec2 uv_interp;
+/* clang-format on */
in vec2 pos_interp;
uniform sampler2D source_diffuse; //texunit:0
@@ -40,81 +42,67 @@ uniform float depth_tolerance;
uniform float distance_fade;
uniform float curve_fade_in;
-
layout(location = 0) out vec4 frag_color;
-
-vec2 view_to_screen(vec3 view_pos,out float w) {
- vec4 projected = projection * vec4(view_pos, 1.0);
- projected.xyz /= projected.w;
- projected.xy = projected.xy * 0.5 + 0.5;
- w=projected.w;
- return projected.xy;
+vec2 view_to_screen(vec3 view_pos, out float w) {
+ vec4 projected = projection * vec4(view_pos, 1.0);
+ projected.xyz /= projected.w;
+ projected.xy = projected.xy * 0.5 + 0.5;
+ w = projected.w;
+ return projected.xy;
}
-
-
#define M_PI 3.14159265359
void main() {
-
- ////
-
- vec4 diffuse = texture( source_diffuse, uv_interp );
- vec4 normal_roughness = texture( source_normal_roughness, uv_interp);
+ vec4 diffuse = texture(source_diffuse, uv_interp);
+ vec4 normal_roughness = texture(source_normal_roughness, uv_interp);
vec3 normal;
-
- normal = normal_roughness.xyz*2.0-1.0;
+ normal = normal_roughness.xyz * 2.0 - 1.0;
float roughness = normal_roughness.w;
- float depth_tex = texture(source_depth,uv_interp).r;
+ float depth_tex = texture(source_depth, uv_interp).r;
- vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 );
- vec3 vertex = world_pos.xyz/world_pos.w;
+ vec4 world_pos = inverse_projection * vec4(uv_interp * 2.0 - 1.0, depth_tex * 2.0 - 1.0, 1.0);
+ vec3 vertex = world_pos.xyz / world_pos.w;
vec3 view_dir = normalize(vertex);
vec3 ray_dir = normalize(reflect(view_dir, normal));
- if (dot(ray_dir,normal)<0.001) {
- frag_color=vec4(0.0);
+ if (dot(ray_dir, normal) < 0.001) {
+ frag_color = vec4(0.0);
return;
}
//ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0);
-
- //ray_dir = normalize(vec3(1,1,-1));
-
+ //ray_dir = normalize(vec3(1, 1, -1));
////////////////
-
- //make ray length and clip it against the near plane (don't want to trace beyond visible)
+ // make ray length and clip it against the near plane (don't want to trace beyond visible)
float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far;
- vec3 ray_end = vertex + ray_dir*ray_len;
+ vec3 ray_end = vertex + ray_dir * ray_len;
float w_begin;
- vec2 vp_line_begin = view_to_screen(vertex,w_begin);
+ vec2 vp_line_begin = view_to_screen(vertex, w_begin);
float w_end;
- vec2 vp_line_end = view_to_screen( ray_end, w_end);
- vec2 vp_line_dir = vp_line_end-vp_line_begin;
-
- //we need to interpolate w along the ray, to generate perspective correct reflections
-
- w_begin = 1.0/w_begin;
- w_end = 1.0/w_end;
+ vec2 vp_line_end = view_to_screen(ray_end, w_end);
+ vec2 vp_line_dir = vp_line_end - vp_line_begin;
+ // we need to interpolate w along the ray, to generate perspective correct reflections
+ w_begin = 1.0 / w_begin;
+ w_end = 1.0 / w_end;
- float z_begin = vertex.z*w_begin;
- float z_end = ray_end.z*w_end;
+ float z_begin = vertex.z * w_begin;
+ float z_end = ray_end.z * w_end;
- vec2 line_begin = vp_line_begin/pixel_size;
- vec2 line_dir = vp_line_dir/pixel_size;
+ vec2 line_begin = vp_line_begin / pixel_size;
+ vec2 line_dir = vp_line_dir / pixel_size;
float z_dir = z_end - z_begin;
float w_dir = w_end - w_begin;
-
// clip the line to the viewport edges
float scale_max_x = min(1.0, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x));
@@ -124,126 +112,114 @@ void main() {
float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y);
line_dir *= line_clip;
z_dir *= line_clip;
- w_dir *=line_clip;
+ w_dir *= line_clip;
- //clip z and w advance to line advance
- vec2 line_advance = normalize(line_dir); //down to pixel
- float step_size = length(line_advance)/length(line_dir);
- float z_advance = z_dir*step_size; // adapt z advance to line advance
- float w_advance = w_dir*step_size; // adapt w advance to line advance
+ // clip z and w advance to line advance
+ vec2 line_advance = normalize(line_dir); // down to pixel
+ float step_size = length(line_advance) / length(line_dir);
+ float z_advance = z_dir * step_size; // adapt z advance to line advance
+ float w_advance = w_dir * step_size; // adapt w advance to line advance
- //make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice)
- float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y));
- line_advance*=advance_angle_adj; // adapt z advance to line advance
- z_advance*=advance_angle_adj;
- w_advance*=advance_angle_adj;
+ // make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice)
+ float advance_angle_adj = 1.0 / max(abs(line_advance.x), abs(line_advance.y));
+ line_advance *= advance_angle_adj; // adapt z advance to line advance
+ z_advance *= advance_angle_adj;
+ w_advance *= advance_angle_adj;
vec2 pos = line_begin;
float z = z_begin;
float w = w_begin;
- float z_from=z/w;
- float z_to=z_from;
+ float z_from = z / w;
+ float z_to = z_from;
float depth;
- vec2 prev_pos=pos;
+ vec2 prev_pos = pos;
- bool found=false;
+ bool found = false;
- float steps_taken=0.0;
+ float steps_taken = 0.0;
- for(int i=0;i<num_steps;i++) {
+ for (int i = 0; i < num_steps; i++) {
- pos+=line_advance;
- z+=z_advance;
- w+=w_advance;
+ pos += line_advance;
+ z += z_advance;
+ w += w_advance;
- //convert to linear depth
+ // convert to linear depth
- depth = texture(source_depth, pos*pixel_size).r * 2.0 - 1.0;
+ depth = texture(source_depth, pos * pixel_size).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
#endif
- depth=-depth;
+ depth = -depth;
z_from = z_to;
- z_to = z/w;
+ z_to = z / w;
- if (depth>z_to) {
- //if depth was surpassed
- if (depth<=max(z_to,z_from)+depth_tolerance) {
- //check the depth tolerance
- found=true;
+ if (depth > z_to) {
+ // if depth was surpassed
+ if (depth <= max(z_to, z_from) + depth_tolerance) {
+ // check the depth tolerance
+ found = true;
}
break;
}
- steps_taken+=1.0;
- prev_pos=pos;
+ steps_taken += 1.0;
+ prev_pos = pos;
}
-
-
-
if (found) {
- float margin_blend=1.0;
+ float margin_blend = 1.0;
-
- vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin
- if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) {
- //clip outside screen + margin
- frag_color=vec4(0.0);
+ vec2 margin = vec2((viewport_size.x + viewport_size.y) * 0.5 * 0.05); // make a uniform margin
+ if (any(bvec4(lessThan(pos, -margin), greaterThan(pos, viewport_size + margin)))) {
+ // clip outside screen + margin
+ frag_color = vec4(0.0);
return;
}
{
//blend fading out towards external margin
- vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0)));
- margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y));
- //margin_blend=1.0;
-
+ vec2 margin_grad = mix(pos - viewport_size, -pos, lessThan(pos, vec2(0.0)));
+ margin_blend = 1.0 - smoothstep(0.0, margin.x, max(margin_grad.x, margin_grad.y));
+ //margin_blend = 1.0;
}
vec2 final_pos;
float grad;
- grad=steps_taken/float(num_steps);
- float initial_fade = curve_fade_in==0.0 ? 1.0 : pow(clamp(grad,0.0,1.0),curve_fade_in);
- float fade = pow(clamp(1.0-grad,0.0,1.0),distance_fade)*initial_fade;
- final_pos=pos;
-
-
-
-
-
-
+ grad = steps_taken / float(num_steps);
+ float initial_fade = curve_fade_in == 0.0 ? 1.0 : pow(clamp(grad, 0.0, 1.0), curve_fade_in);
+ float fade = pow(clamp(1.0 - grad, 0.0, 1.0), distance_fade) * initial_fade;
+ final_pos = pos;
#ifdef REFLECT_ROUGHNESS
-
vec4 final_color;
- //if roughness is enabled, do screen space cone tracing
+ // if roughness is enabled, do screen space cone tracing
if (roughness > 0.001) {
///////////////////////////////////////////////////////////////////////////////////////
- //use a blurred version (in consecutive mipmaps) of the screen to simulate roughness
+ // use a blurred version (in consecutive mipmaps) of the screen to simulate roughness
- float gloss = 1.0-roughness;
+ float gloss = 1.0 - roughness;
float cone_angle = roughness * M_PI * 0.5;
vec2 cone_dir = final_pos - line_begin;
float cone_len = length(cone_dir);
- cone_dir = normalize(cone_dir); //will be used normalized from now on
+ cone_dir = normalize(cone_dir); // will be used normalized from now on
float max_mipmap = filter_mipmap_levels - 1.0;
- float gloss_mult=gloss;
+ float gloss_mult = gloss;
- float rem_alpha=1.0;
+ float rem_alpha = 1.0;
final_color = vec4(0.0);
- for(int i=0;i<7;i++) {
+ for (int i = 0; i < 7; i++) {
- float op_len = 2.0 * tan(cone_angle) * cone_len; //opposite side of iso triangle
+ float op_len = 2.0 * tan(cone_angle) * cone_len; // opposite side of iso triangle
float radius;
{
- //fit to sphere inside cone (sphere ends at end of cone), something like this:
+ // fit to sphere inside cone (sphere ends at end of cone), something like this:
// ___
// \O/
// V
@@ -257,31 +233,31 @@ void main() {
radius = (a * (sqrt(a2 + fh2) - a)) / (4.0f * h);
}
- //find the place where screen must be sampled
- vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size;
- //radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels
- float mipmap = clamp( log2( radius ), 0.0, max_mipmap );
+ // find the place where screen must be sampled
+ vec2 sample_pos = (line_begin + cone_dir * (cone_len - radius)) * pixel_size;
+ // radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels
+ float mipmap = clamp(log2(radius), 0.0, max_mipmap);
+ //mipmap = max(mipmap - 1.0, 0.0);
- //mipmap = max(mipmap-1.0,0.0);
- //do sampling
+ // do sampling
vec4 sample_color;
{
- sample_color = textureLod(source_diffuse,sample_pos,mipmap);
+ sample_color = textureLod(source_diffuse, sample_pos, mipmap);
}
- //multiply by gloss
- sample_color.rgb*=gloss_mult;
- sample_color.a=gloss_mult;
+ // multiply by gloss
+ sample_color.rgb *= gloss_mult;
+ sample_color.a = gloss_mult;
rem_alpha -= sample_color.a;
- if(rem_alpha < 0.0) {
+ if (rem_alpha < 0.0) {
sample_color.rgb *= (1.0 - abs(rem_alpha));
}
- final_color+=sample_color;
+ final_color += sample_color;
- if (final_color.a>=0.95) {
+ if (final_color.a >= 0.95) {
// This code of accumulating gloss and aborting on near one
// makes sense when you think of cone tracing.
// Think of it as if roughness was 0, then we could abort on the first
@@ -290,29 +266,21 @@ void main() {
break;
}
- cone_len-=radius*2.0; //go to next (smaller) circle.
-
- gloss_mult*=gloss;
-
+ cone_len -= radius * 2.0; // go to next (smaller) circle.
+ gloss_mult *= gloss;
}
} else {
- final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0);
+ final_color = textureLod(source_diffuse, final_pos * pixel_size, 0.0);
}
- frag_color = vec4(final_color.rgb,fade*margin_blend);
+ frag_color = vec4(final_color.rgb, fade * margin_blend);
#else
- frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,fade*margin_blend);
+ frag_color = vec4(textureLod(source_diffuse, final_pos * pixel_size, 0.0).rgb, fade * margin_blend);
#endif
-
-
} else {
- frag_color = vec4(0.0,0.0,0.0,0.0);
+ frag_color = vec4(0.0, 0.0, 0.0, 0.0);
}
-
-
-
}
-
diff --git a/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl
index 219f0957e0..be44365169 100644
--- a/drivers/gles3/shaders/ssao.glsl
+++ b/drivers/gles3/shaders/ssao.glsl
@@ -1,34 +1,30 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
- gl_Position.z=1.0;
+ gl_Position.z = 1.0;
}
+/* clang-format off */
[fragment]
#define TWO_PI 6.283185307179586476925286766559
#ifdef SSAO_QUALITY_HIGH
-
#define NUM_SAMPLES (80)
-
#endif
#ifdef SSAO_QUALITY_LOW
-
#define NUM_SAMPLES (15)
-
#endif
#if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH)
-
#define NUM_SAMPLES (40)
-
#endif
// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower
@@ -43,19 +39,21 @@ void main() {
// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent
// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9
-const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2,
-3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
-9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
-11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
-11, 11, 13, 12, 13, 19, 17, 13, 11, 18,
-19, 11, 11, 14, 17, 21, 15, 16, 17, 18,
-13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
-29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
-31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
-19, 27, 21, 25, 39, 29, 17, 21, 27 );
+const int ROTATIONS[] = int[](
+ 1, 1, 2, 3, 2, 5, 2, 3, 2,
+ 3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
+ 9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
+ 11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
+ 11, 11, 13, 12, 13, 19, 17, 13, 11, 18,
+ 19, 11, 11, 14, 17, 21, 15, 16, 17, 18,
+ 13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
+ 29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
+ 31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
+ 19, 27, 21, 25, 39, 29, 17, 21, 27);
+/* clang-format on */
//#define NUM_SPIRAL_TURNS (7)
-const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES-1];
+const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
uniform sampler2D source_depth; //texunit:0
uniform highp usampler2D source_depth_mipmaps; //texunit:1
@@ -90,44 +88,41 @@ vec3 reconstructCSPosition(vec2 S, float z) {
}
vec3 getPosition(ivec2 ssP) {
- vec3 P;
- P.z = texelFetch(source_depth, ssP, 0).r;
+ vec3 P;
+ P.z = texelFetch(source_depth, ssP, 0).r;
- P.z = P.z * 2.0 - 1.0;
+ P.z = P.z * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
- P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
+ P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
#endif
- P.z = -P.z;
+ P.z = -P.z;
- // Offset to pixel center
- P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
- return P;
+ // Offset to pixel center
+ P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
+ return P;
}
/** Reconstructs screen-space unit normal from screen-space position */
vec3 reconstructCSFaceNormal(vec3 C) {
- return normalize(cross(dFdy(C), dFdx(C)));
+ return normalize(cross(dFdy(C), dFdx(C)));
}
-
-
/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */
-vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){
- // Radius relative to ssR
- float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES));
- float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle;
+vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR) {
+ // Radius relative to ssR
+ float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES));
+ float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle;
- ssR = alpha;
- return vec2(cos(angle), sin(angle));
+ ssR = alpha;
+ return vec2(cos(angle), sin(angle));
}
-
/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */
vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
- // Derivation:
- // mipLevel = floor(log(ssR / MAX_OFFSET));
+ // Derivation:
+ // mipLevel = floor(log(ssR / MAX_OFFSET));
int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL);
ivec2 ssP = ivec2(ssR * unitOffset) + ssC;
@@ -138,98 +133,91 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
// Manually clamp to the texture size because texelFetch bypasses the texture unit
ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1));
-
if (mipLevel < 1) {
//read from depth buffer
P.z = texelFetch(source_depth, mipP, 0).r;
P.z = P.z * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
-
#endif
P.z = -P.z;
} else {
//read from mipmaps
- uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel-1).r;
- P.z = -(float(d)/65535.0)*camera_z_far;
+ uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel - 1).r;
+ P.z = -(float(d) / 65535.0) * camera_z_far;
}
-
// Offset to pixel center
P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
return P;
}
-
-
/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds
- to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
+ to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
- Note that units of H() in the HPG12 paper are meters, not
- unitless. The whole falloff/sampling function is therefore
- unitless. In this implementation, we factor out (9 / radius).
+ Note that units of H() in the HPG12 paper are meters, not
+ unitless. The whole falloff/sampling function is therefore
+ unitless. In this implementation, we factor out (9 / radius).
- Four versions of the falloff function are implemented below
+ Four versions of the falloff function are implemented below
*/
-float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in float p_radius, in int tapIndex, in float randomPatternRotationAngle) {
- // Offset on the unit disk, spun for this pixel
- float ssR;
- vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR);
- ssR *= ssDiskRadius;
+float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in float p_radius, in int tapIndex, in float randomPatternRotationAngle) {
+ // Offset on the unit disk, spun for this pixel
+ float ssR;
+ vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR);
+ ssR *= ssDiskRadius;
- // The occluding point in camera space
- vec3 Q = getOffsetPosition(ssC, unitOffset, ssR);
+ // The occluding point in camera space
+ vec3 Q = getOffsetPosition(ssC, unitOffset, ssR);
- vec3 v = Q - C;
+ vec3 v = Q - C;
- float vv = dot(v, v);
- float vn = dot(v, n_C);
+ float vv = dot(v, v);
+ float vn = dot(v, n_C);
- const float epsilon = 0.01;
- float radius2 = p_radius*p_radius;
+ const float epsilon = 0.01;
+ float radius2 = p_radius * p_radius;
- // A: From the HPG12 paper
- // Note large epsilon to avoid overdarkening within cracks
- //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;
+ // A: From the HPG12 paper
+ // Note large epsilon to avoid overdarkening within cracks
+ //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;
- // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]
- float f=max(radius2 - vv, 0.0);
- return f * f * f * max((vn - bias) / (epsilon + vv), 0.0);
+ // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]
+ float f = max(radius2 - vv, 0.0);
+ return f * f * f * max((vn - bias) / (epsilon + vv), 0.0);
- // C: Medium contrast (which looks better at high radii), no division. Note that the
- // contribution still falls off with radius^2, but we've adjusted the rate in a way that is
- // more computationally efficient and happens to be aesthetically pleasing.
- // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);
+ // C: Medium contrast (which looks better at high radii), no division. Note that the
+ // contribution still falls off with radius^2, but we've adjusted the rate in a way that is
+ // more computationally efficient and happens to be aesthetically pleasing.
+ // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);
- // D: Low contrast, no division operation
- // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);
+ // D: Low contrast, no division operation
+ // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);
}
-
-
void main() {
-
-
// Pixel being shaded
ivec2 ssC = ivec2(gl_FragCoord.xy);
// World space point being shaded
vec3 C = getPosition(ssC);
-/* if (C.z <= -camera_z_far*0.999) {
- // We're on the skybox
- visibility=1.0;
- return;
- }*/
+ /*
+ if (C.z <= -camera_z_far * 0.999) {
+ // We're on the skybox
+ visibility=1.0;
+ return;
+ }
+ */
- //visibility=-C.z/camera_z_far;
+ //visibility = -C.z / camera_z_far;
//return;
#if 0
- vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0;
+ vec3 n_C = texelFetch(source_normal, ssC, 0).rgb * 2.0 - 1.0;
#else
vec3 n_C = reconstructCSFaceNormal(C);
n_C = -n_C;
@@ -251,7 +239,7 @@ void main() {
#endif
float sum = 0.0;
for (int i = 0; i < NUM_SAMPLES; ++i) {
- sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius,i, randomPatternRotationAngle);
+ sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius, i, randomPatternRotationAngle);
}
float A = max(0.0, 1.0 - sum * intensity_div_r6 * (5.0 / float(NUM_SAMPLES)));
@@ -271,10 +259,10 @@ void main() {
sum = 0.0;
for (int i = 0; i < NUM_SAMPLES; ++i) {
- sum += sampleAO(ssC, C, n_C, ssDiskRadius,radius2, i, randomPatternRotationAngle);
+ sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius2, i, randomPatternRotationAngle);
}
- A= min(A,max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES))));
+ A = min(A, max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES))));
#endif
// Bilateral box-filter over a quad for free, respecting depth edges
// (the difference that this makes is subtle)
@@ -286,8 +274,4 @@ void main() {
}
visibility = A;
-
}
-
-
-
diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl
index 472dc21acf..c49ea1e957 100644
--- a/drivers/gles3/shaders/ssao_blur.glsl
+++ b/drivers/gles3/shaders/ssao_blur.glsl
@@ -1,26 +1,25 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
- gl_Position.z=1.0;
+ gl_Position.z = 1.0;
}
+/* clang-format off */
[fragment]
-
uniform sampler2D source_ssao; //texunit:0
+/* clang-format on */
uniform sampler2D source_depth; //texunit:1
uniform sampler2D source_normal; //texunit:3
-
layout(location = 0) out float visibility;
-
//////////////////////////////////////////////////////////////////////////////////////////////
// Tunable Parameters:
@@ -28,32 +27,30 @@ layout(location = 0) out float visibility;
uniform float edge_sharpness;
/** Step in 2-pixel intervals since we already blurred against neighbors in the
- first AO pass. This constant can be increased while R decreases to improve
- performance at the expense of some dithering artifacts.
+ first AO pass. This constant can be increased while R decreases to improve
+ performance at the expense of some dithering artifacts.
- Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was
- unobjectionable after shading was applied but eliminated most temporal incoherence
- from using small numbers of sample taps.
- */
+ Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was
+ unobjectionable after shading was applied but eliminated most temporal incoherence
+ from using small numbers of sample taps.
+ */
uniform int filter_scale;
/** Filter radius in pixels. This will be multiplied by SCALE. */
-#define R (4)
-
+#define R (4)
//////////////////////////////////////////////////////////////////////////////////////////////
-
// Gaussian coefficients
const float gaussian[R + 1] =
-// float[](0.356642, 0.239400, 0.072410, 0.009869);
-// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
- float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
-// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
+ //float[](0.356642, 0.239400, 0.072410, 0.009869);
+ //float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
+ float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
+//float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
-/** (1, 0) or (0, 1)*/
-uniform ivec2 axis;
+/** (1, 0) or (0, 1) */
+uniform ivec2 axis;
uniform float camera_z_far;
uniform float camera_z_near;
@@ -65,18 +62,18 @@ void main() {
ivec2 ssC = ivec2(gl_FragCoord.xy);
float depth = texelFetch(source_depth, ssC, 0).r;
- //vec3 normal = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0;
+ //vec3 normal = texelFetch(source_normal, ssC, 0).rgb * 2.0 - 1.0;
depth = depth * 2.0 - 1.0;
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
float depth_divide = 1.0 / camera_z_far;
-// depth*=depth_divide;
+ //depth *= depth_divide;
/*
- if (depth > camera_z_far*0.999) {
- discard;//skybox
+ if (depth > camera_z_far * 0.999) {
+ discard; //skybox
}
*/
@@ -96,23 +93,21 @@ void main() {
if (r != 0) {
ivec2 ppos = ssC + axis * (r * filter_scale);
- float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r;
- ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit);
+ float value = texelFetch(source_ssao, clamp(ppos, ivec2(0), clamp_limit), 0).r;
+ ivec2 rpos = clamp(ppos, ivec2(0), clamp_limit);
float temp_depth = texelFetch(source_depth, rpos, 0).r;
//vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0;
temp_depth = temp_depth * 2.0 - 1.0;
temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near));
-// temp_depth *= depth_divide;
+ //temp_depth *= depth_divide;
// spatial domain: offset gaussian tap
float weight = 0.3 + gaussian[abs(r)];
- //weight *= max(0.0,dot(temp_normal,normal));
+ //weight *= max(0.0, dot(temp_normal, normal));
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
- weight *= max(0.0, 1.0
- - edge_sharpness * abs(temp_depth - depth)
- );
+ weight *= max(0.0, 1.0 - edge_sharpness * abs(temp_depth - depth));
sum += value * weight;
totalWeight += weight;
diff --git a/drivers/gles3/shaders/ssao_minify.glsl b/drivers/gles3/shaders/ssao_minify.glsl
index 647c762438..1696648dae 100644
--- a/drivers/gles3/shaders/ssao_minify.glsl
+++ b/drivers/gles3/shaders/ssao_minify.glsl
@@ -1,20 +1,22 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
-
#ifdef MINIFY_START
#define SDEPTH_TYPE highp sampler2D
uniform float camera_z_far;
+/* clang-format on */
uniform float camera_z_near;
#else
@@ -32,28 +34,23 @@ layout(location = 0) out mediump uint depth;
void main() {
-
ivec2 ssP = ivec2(gl_FragCoord.xy);
- // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
- // On DX9, the bit-and can be implemented with floating-point modulo
+ // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
+ // On DX9, the bit-and can be implemented with floating-point modulo
#ifdef MINIFY_START
float fdepth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
fdepth = fdepth * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- fdepth = ((fdepth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ fdepth = ((fdepth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
fdepth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - fdepth * (camera_z_far - camera_z_near));
#endif
fdepth /= camera_z_far;
- depth = uint(clamp(fdepth*65535.0,0.0,65535.0));
+ depth = uint(clamp(fdepth * 65535.0, 0.0, 65535.0));
#else
depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
#endif
-
-
}
-
-
diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl
index fc66d66198..f40fb3a244 100644
--- a/drivers/gles3/shaders/subsurf_scattering.glsl
+++ b/drivers/gles3/shaders/subsurf_scattering.glsl
@@ -1,105 +1,93 @@
+/* clang-format off */
[vertex]
-
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
-
void main() {
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
//#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
#define QUALIFIER const
#ifdef USE_25_SAMPLES
-
-const int kernel_size=25;
-QUALIFIER vec2 kernel[25] = vec2[] (
- vec2(0.530605, 0.0),
- vec2(0.000973794, -3.0),
- vec2(0.00333804, -2.52083),
- vec2(0.00500364, -2.08333),
- vec2(0.00700976, -1.6875),
- vec2(0.0094389, -1.33333),
- vec2(0.0128496, -1.02083),
- vec2(0.017924, -0.75),
- vec2(0.0263642, -0.520833),
- vec2(0.0410172, -0.333333),
- vec2(0.0493588, -0.1875),
- vec2(0.0402784, -0.0833333),
- vec2(0.0211412, -0.0208333),
- vec2(0.0211412, 0.0208333),
- vec2(0.0402784, 0.0833333),
- vec2(0.0493588, 0.1875),
- vec2(0.0410172, 0.333333),
- vec2(0.0263642, 0.520833),
- vec2(0.017924, 0.75),
- vec2(0.0128496, 1.02083),
- vec2(0.0094389, 1.33333),
- vec2(0.00700976, 1.6875),
- vec2(0.00500364, 2.08333),
- vec2(0.00333804, 2.52083),
- vec2(0.000973794, 3.0)
-);
-
+const int kernel_size = 25;
+/* clang-format on */
+QUALIFIER vec2 kernel[25] = vec2[](
+ vec2(0.530605, 0.0),
+ vec2(0.000973794, -3.0),
+ vec2(0.00333804, -2.52083),
+ vec2(0.00500364, -2.08333),
+ vec2(0.00700976, -1.6875),
+ vec2(0.0094389, -1.33333),
+ vec2(0.0128496, -1.02083),
+ vec2(0.017924, -0.75),
+ vec2(0.0263642, -0.520833),
+ vec2(0.0410172, -0.333333),
+ vec2(0.0493588, -0.1875),
+ vec2(0.0402784, -0.0833333),
+ vec2(0.0211412, -0.0208333),
+ vec2(0.0211412, 0.0208333),
+ vec2(0.0402784, 0.0833333),
+ vec2(0.0493588, 0.1875),
+ vec2(0.0410172, 0.333333),
+ vec2(0.0263642, 0.520833),
+ vec2(0.017924, 0.75),
+ vec2(0.0128496, 1.02083),
+ vec2(0.0094389, 1.33333),
+ vec2(0.00700976, 1.6875),
+ vec2(0.00500364, 2.08333),
+ vec2(0.00333804, 2.52083),
+ vec2(0.000973794, 3.0));
#endif //USE_25_SAMPLES
#ifdef USE_17_SAMPLES
-
-const int kernel_size=17;
-
+const int kernel_size = 17;
QUALIFIER vec2 kernel[17] = vec2[](
- vec2(0.536343, 0.0),
- vec2(0.00317394, -2.0),
- vec2(0.0100386, -1.53125),
- vec2(0.0144609, -1.125),
- vec2(0.0216301, -0.78125),
- vec2(0.0347317, -0.5),
- vec2(0.0571056, -0.28125),
- vec2(0.0582416, -0.125),
- vec2(0.0324462, -0.03125),
- vec2(0.0324462, 0.03125),
- vec2(0.0582416, 0.125),
- vec2(0.0571056, 0.28125),
- vec2(0.0347317, 0.5),
- vec2(0.0216301, 0.78125),
- vec2(0.0144609, 1.125),
- vec2(0.0100386, 1.53125),
- vec2(0.00317394,2.0)
-);
-
+ vec2(0.536343, 0.0),
+ vec2(0.00317394, -2.0),
+ vec2(0.0100386, -1.53125),
+ vec2(0.0144609, -1.125),
+ vec2(0.0216301, -0.78125),
+ vec2(0.0347317, -0.5),
+ vec2(0.0571056, -0.28125),
+ vec2(0.0582416, -0.125),
+ vec2(0.0324462, -0.03125),
+ vec2(0.0324462, 0.03125),
+ vec2(0.0582416, 0.125),
+ vec2(0.0571056, 0.28125),
+ vec2(0.0347317, 0.5),
+ vec2(0.0216301, 0.78125),
+ vec2(0.0144609, 1.125),
+ vec2(0.0100386, 1.53125),
+ vec2(0.00317394, 2.0));
#endif //USE_17_SAMPLES
-
#ifdef USE_11_SAMPLES
-
-const int kernel_size=11;
-
+const int kernel_size = 11;
QUALIFIER vec2 kernel[11] = vec2[](
- vec2(0.560479, 0.0),
- vec2(0.00471691, -2.0),
- vec2(0.0192831, -1.28),
- vec2(0.03639, -0.72),
- vec2(0.0821904, -0.32),
- vec2(0.0771802, -0.08),
- vec2(0.0771802, 0.08),
- vec2(0.0821904, 0.32),
- vec2(0.03639, 0.72),
- vec2(0.0192831, 1.28),
- vec2(0.00471691,2.0)
-);
-
+ vec2(0.560479, 0.0),
+ vec2(0.00471691, -2.0),
+ vec2(0.0192831, -1.28),
+ vec2(0.03639, -0.72),
+ vec2(0.0821904, -0.32),
+ vec2(0.0771802, -0.08),
+ vec2(0.0771802, 0.08),
+ vec2(0.0821904, 0.32),
+ vec2(0.03639, 0.72),
+ vec2(0.0192831, 1.28),
+ vec2(0.00471691, 2.0));
#endif //USE_11_SAMPLES
-
-
uniform float max_radius;
uniform float camera_z_far;
uniform float camera_z_near;
@@ -115,28 +103,24 @@ layout(location = 0) out vec4 frag_color;
void main() {
- float strength = texture(source_sss,uv_interp).r;
- strength*=strength; //stored as sqrt
+ float strength = texture(source_sss, uv_interp).r;
+ strength *= strength; //stored as sqrt
// Fetch color of current pixel:
vec4 base_color = texture(source_diffuse, uv_interp);
-
- if (strength>0.0) {
-
+ if (strength > 0.0) {
// Fetch linear depth of current pixel:
float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
float scale = unit_size; //remember depth is negative by default in OpenGL
#else
depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
float scale = unit_size / depth; //remember depth is negative by default in OpenGL
#endif
-
-
// Calculate the final step to fetch the surrounding pixels:
vec2 step = max_radius * scale * dir;
step *= strength; // Modulate it using the alpha channel.
@@ -157,35 +141,33 @@ void main() {
#ifdef ENABLE_FOLLOW_SURFACE
// If the difference in depth is huge, we lerp color back to "colorM":
- float depth_cmp = texture(source_depth, offset).r *2.0 - 1.0;
+ float depth_cmp = texture(source_depth, offset).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
- depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near));
#endif
- float s = clamp(300.0f * scale *
- max_radius * abs(depth - depth_cmp),0.0,1.0);
+ float s = clamp(300.0f * scale * max_radius * abs(depth - depth_cmp), 0.0, 1.0);
color = mix(color, base_color.rgb, s);
#endif
// Accumulate:
- color*=kernel[i].x;
+ color *= kernel[i].x;
#ifdef ENABLE_STRENGTH_WEIGHTING
float color_s = texture(source_sss, offset).r;
- color_weight+=color_s * kernel[i].x;
- color*=color_s;
+ color_weight += color_s * kernel[i].x;
+ color *= color_s;
#endif
color_accum += color;
-
}
#ifdef ENABLE_STRENGTH_WEIGHTING
- color_accum/=color_weight;
+ color_accum /= color_weight;
#endif
- frag_color = vec4(color_accum,base_color.a); //keep alpha (used for SSAO)
+ frag_color = vec4(color_accum, base_color.a); //keep alpha (used for SSAO)
} else {
frag_color = base_color;
}
diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl
index 63475c9039..e4aa8d5730 100644
--- a/drivers/gles3/shaders/tonemap.glsl
+++ b/drivers/gles3/shaders/tonemap.glsl
@@ -1,26 +1,29 @@
+/* clang-format off */
[vertex]
-layout (location = 0) in highp vec4 vertex_attrib;
-layout (location = 4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
-void main()
-{
+void main() {
gl_Position = vertex_attrib;
uv_interp = uv_in;
- #ifdef V_FLIP
- uv_interp.y = 1.0f - uv_interp.y;
- #endif
+#ifdef V_FLIP
+ uv_interp.y = 1.0f - uv_interp.y;
+#endif
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
- precision mediump float;
+precision mediump float;
#endif
+/* clang-format on */
in vec2 uv_interp;
@@ -30,109 +33,97 @@ uniform float exposure;
uniform float white;
#ifdef USE_AUTO_EXPOSURE
- uniform highp sampler2D source_auto_exposure; //texunit:1
- uniform highp float auto_exposure_grey;
+uniform highp sampler2D source_auto_exposure; //texunit:1
+uniform highp float auto_exposure_grey;
#endif
#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7)
- #define USING_GLOW // only use glow when at least one glow level is selected
+#define USING_GLOW // only use glow when at least one glow level is selected
- uniform highp sampler2D source_glow; //texunit:2
- uniform highp float glow_intensity;
+uniform highp sampler2D source_glow; //texunit:2
+uniform highp float glow_intensity;
#endif
#ifdef USE_BCS
- uniform vec3 bcs;
+uniform vec3 bcs;
#endif
#ifdef USE_COLOR_CORRECTION
- uniform sampler2D color_correction; //texunit:3
+uniform sampler2D color_correction; //texunit:3
#endif
-layout (location = 0) out vec4 frag_color;
+layout(location = 0) out vec4 frag_color;
#ifdef USE_GLOW_FILTER_BICUBIC
- // w0, w1, w2, and w3 are the four cubic B-spline basis functions
- float w0(float a)
- {
- return (1.0f / 6.0f) * (a * (a * (-a + 3.0f) - 3.0f) + 1.0f);
- }
-
- float w1(float a)
- {
- return (1.0f / 6.0f) * (a * a * (3.0f * a - 6.0f) + 4.0f);
- }
-
- float w2(float a)
- {
- return (1.0f / 6.0f) * (a * (a * (-3.0f * a + 3.0f) + 3.0f) + 1.0f);
- }
-
- float w3(float a)
- {
- return (1.0f / 6.0f) * (a * a * a);
- }
-
- // g0 and g1 are the two amplitude functions
- float g0(float a)
- {
- return w0(a) + w1(a);
- }
-
- float g1(float a)
- {
- return w2(a) + w3(a);
- }
-
- // h0 and h1 are the two offset functions
- float h0(float a)
- {
- return -1.0f + w1(a) / (w0(a) + w1(a));
- }
-
- float h1(float a)
- {
- return 1.0f + w3(a) / (w2(a) + w3(a));
- }
-
- uniform ivec2 glow_texture_size;
-
- vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod)
- {
- float lod = float(p_lod);
- vec2 tex_size = vec2(glow_texture_size >> p_lod);
- vec2 pixel_size = vec2(1.0f) / tex_size;
-
- uv = uv * tex_size + vec2(0.5f);
-
- vec2 iuv = floor(uv);
- vec2 fuv = fract(uv);
-
- float g0x = g0(fuv.x);
- float g1x = g1(fuv.x);
- float h0x = h0(fuv.x);
- float h1x = h1(fuv.x);
- float h0y = h0(fuv.y);
- float h1y = h1(fuv.y);
-
- vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5f)) * pixel_size;
- vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5f)) * pixel_size;
- vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
- vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
-
- return g0(fuv.y) * (g0x * textureLod(tex, p0,lod) +
- g1x * textureLod(tex, p1,lod)) +
- g1(fuv.y) * (g0x * textureLod(tex, p2,lod) +
- g1x * textureLod(tex, p3,lod));
- }
-
- #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)
+// w0, w1, w2, and w3 are the four cubic B-spline basis functions
+float w0(float a) {
+ return (1.0f / 6.0f) * (a * (a * (-a + 3.0f) - 3.0f) + 1.0f);
+}
+
+float w1(float a) {
+ return (1.0f / 6.0f) * (a * a * (3.0f * a - 6.0f) + 4.0f);
+}
+
+float w2(float a) {
+ return (1.0f / 6.0f) * (a * (a * (-3.0f * a + 3.0f) + 3.0f) + 1.0f);
+}
+
+float w3(float a) {
+ return (1.0f / 6.0f) * (a * a * a);
+}
+
+// g0 and g1 are the two amplitude functions
+float g0(float a) {
+ return w0(a) + w1(a);
+}
+
+float g1(float a) {
+ return w2(a) + w3(a);
+}
+
+// h0 and h1 are the two offset functions
+float h0(float a) {
+ return -1.0f + w1(a) / (w0(a) + w1(a));
+}
+
+float h1(float a) {
+ return 1.0f + w3(a) / (w2(a) + w3(a));
+}
+
+uniform ivec2 glow_texture_size;
+
+vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
+ float lod = float(p_lod);
+ vec2 tex_size = vec2(glow_texture_size >> p_lod);
+ vec2 pixel_size = vec2(1.0f) / tex_size;
+
+ uv = uv * tex_size + vec2(0.5f);
+
+ vec2 iuv = floor(uv);
+ vec2 fuv = fract(uv);
+
+ float g0x = g0(fuv.x);
+ float g1x = g1(fuv.x);
+ float h0x = h0(fuv.x);
+ float h1x = h1(fuv.x);
+ float h0y = h0(fuv.y);
+ float h1y = h1(fuv.y);
+
+ vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5f)) * pixel_size;
+ vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5f)) * pixel_size;
+ vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
+ vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
+
+ return (g0(fuv.y) * (g0x * textureLod(tex, p0, lod) + g1x * textureLod(tex, p1, lod))) +
+ (g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod)));
+}
+
+#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)
#else
- #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod))
+#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod))
#endif
-vec3 tonemap_filmic(vec3 color, float white)
-{
+vec3 tonemap_filmic(vec3 color, float white) {
const float A = 0.15f;
const float B = 0.50f;
const float C = 0.10f;
@@ -147,8 +138,7 @@ vec3 tonemap_filmic(vec3 color, float white)
return clamp(color_tonemapped / white_tonemapped, vec3(0.0f), vec3(1.0f));
}
-vec3 tonemap_aces(vec3 color, float white)
-{
+vec3 tonemap_aces(vec3 color, float white) {
const float A = 2.51f;
const float B = 0.03f;
const float C = 2.43f;
@@ -161,96 +151,90 @@ vec3 tonemap_aces(vec3 color, float white)
return clamp(color_tonemapped / white_tonemapped, vec3(0.0f), vec3(1.0f));
}
-vec3 tonemap_reindhart(vec3 color, float white)
-{
+vec3 tonemap_reindhart(vec3 color, float white) {
return clamp((color) / (1.0f + color) * (1.0f + (color / (white))), vec3(0.0f), vec3(1.0f)); // whitepoint is probably not in linear space here!
}
-vec3 linear_to_srgb(vec3 color) // convert linear rgb to srgb, assumes clamped input in range [0;1]
-{
+vec3 linear_to_srgb(vec3 color) { // convert linear rgb to srgb, assumes clamped input in range [0;1]
const vec3 a = vec3(0.055f);
return mix((vec3(1.0f) + a) * pow(color.rgb, vec3(1.0f / 2.4f)) - a, 12.92f * color.rgb, lessThan(color.rgb, vec3(0.0031308f)));
}
-vec3 apply_tonemapping(vec3 color, float white) // inputs are LINEAR, always outputs clamped [0;1] color
-{
- #ifdef USE_REINDHART_TONEMAPPER
- return tonemap_reindhart(color, white);
- #endif
+vec3 apply_tonemapping(vec3 color, float white) { // inputs are LINEAR, always outputs clamped [0;1] color
+#ifdef USE_REINDHART_TONEMAPPER
+ return tonemap_reindhart(color, white);
+#endif
- #ifdef USE_FILMIC_TONEMAPPER
- return tonemap_filmic(color, white);
- #endif
+#ifdef USE_FILMIC_TONEMAPPER
+ return tonemap_filmic(color, white);
+#endif
- #ifdef USE_ACES_TONEMAPPER
- return tonemap_aces(color, white);
- #endif
+#ifdef USE_ACES_TONEMAPPER
+ return tonemap_aces(color, white);
+#endif
return clamp(color, vec3(0.0f), vec3(1.0f)); // no other seleced -> linear
}
-vec3 gather_glow(sampler2D tex, vec2 uv) // sample all selected glow levels
-{
+vec3 gather_glow(sampler2D tex, vec2 uv) { // sample all selected glow levels
vec3 glow = vec3(0.0f);
- #ifdef USE_GLOW_LEVEL1
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 1).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL1
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 1).rgb;
+#endif
- #ifdef USE_GLOW_LEVEL2
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 2).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL2
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 2).rgb;
+#endif
- #ifdef USE_GLOW_LEVEL3
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 3).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL3
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 3).rgb;
+#endif
- #ifdef USE_GLOW_LEVEL4
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 4).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL4
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 4).rgb;
+#endif
- #ifdef USE_GLOW_LEVEL5
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 5).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL5
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 5).rgb;
+#endif
- #ifdef USE_GLOW_LEVEL6
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 6).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL6
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 6).rgb;
+#endif
- #ifdef USE_GLOW_LEVEL7
- glow += GLOW_TEXTURE_SAMPLE(tex, uv, 7).rgb;
- #endif
+#ifdef USE_GLOW_LEVEL7
+ glow += GLOW_TEXTURE_SAMPLE(tex, uv, 7).rgb;
+#endif
return glow;
}
-vec3 apply_glow(vec3 color, vec3 glow) // apply glow using the selected blending mode
-{
- #ifdef USE_GLOW_REPLACE
- color = glow;
- #endif
+vec3 apply_glow(vec3 color, vec3 glow) { // apply glow using the selected blending mode
+#ifdef USE_GLOW_REPLACE
+ color = glow;
+#endif
- #ifdef USE_GLOW_SCREEN
- color = max((color + glow) - (color * glow), vec3(0.0));
- #endif
+#ifdef USE_GLOW_SCREEN
+ color = max((color + glow) - (color * glow), vec3(0.0));
+#endif
- #ifdef USE_GLOW_SOFTLIGHT
- glow = glow * vec3(0.5f) + vec3(0.5f);
+#ifdef USE_GLOW_SOFTLIGHT
+ glow = glow * vec3(0.5f) + vec3(0.5f);
- color.r = (glow.r <= 0.5f) ? (color.r - (1.0f - 2.0f * glow.r) * color.r * (1.0f - color.r)) : (((glow.r > 0.5f) && (color.r <= 0.25f)) ? (color.r + (2.0f * glow.r - 1.0f) * (4.0f * color.r * (4.0f * color.r + 1.0f) * (color.r - 1.0f) + 7.0f * color.r)) : (color.r + (2.0f * glow.r - 1.0f) * (sqrt(color.r) - color.r)));
- color.g = (glow.g <= 0.5f) ? (color.g - (1.0f - 2.0f * glow.g) * color.g * (1.0f - color.g)) : (((glow.g > 0.5f) && (color.g <= 0.25f)) ? (color.g + (2.0f * glow.g - 1.0f) * (4.0f * color.g * (4.0f * color.g + 1.0f) * (color.g - 1.0f) + 7.0f * color.g)) : (color.g + (2.0f * glow.g - 1.0f) * (sqrt(color.g) - color.g)));
- color.b = (glow.b <= 0.5f) ? (color.b - (1.0f - 2.0f * glow.b) * color.b * (1.0f - color.b)) : (((glow.b > 0.5f) && (color.b <= 0.25f)) ? (color.b + (2.0f * glow.b - 1.0f) * (4.0f * color.b * (4.0f * color.b + 1.0f) * (color.b - 1.0f) + 7.0f * color.b)) : (color.b + (2.0f * glow.b - 1.0f) * (sqrt(color.b) - color.b)));
- #endif
+ color.r = (glow.r <= 0.5f) ? (color.r - (1.0f - 2.0f * glow.r) * color.r * (1.0f - color.r)) : (((glow.r > 0.5f) && (color.r <= 0.25f)) ? (color.r + (2.0f * glow.r - 1.0f) * (4.0f * color.r * (4.0f * color.r + 1.0f) * (color.r - 1.0f) + 7.0f * color.r)) : (color.r + (2.0f * glow.r - 1.0f) * (sqrt(color.r) - color.r)));
+ color.g = (glow.g <= 0.5f) ? (color.g - (1.0f - 2.0f * glow.g) * color.g * (1.0f - color.g)) : (((glow.g > 0.5f) && (color.g <= 0.25f)) ? (color.g + (2.0f * glow.g - 1.0f) * (4.0f * color.g * (4.0f * color.g + 1.0f) * (color.g - 1.0f) + 7.0f * color.g)) : (color.g + (2.0f * glow.g - 1.0f) * (sqrt(color.g) - color.g)));
+ color.b = (glow.b <= 0.5f) ? (color.b - (1.0f - 2.0f * glow.b) * color.b * (1.0f - color.b)) : (((glow.b > 0.5f) && (color.b <= 0.25f)) ? (color.b + (2.0f * glow.b - 1.0f) * (4.0f * color.b * (4.0f * color.b + 1.0f) * (color.b - 1.0f) + 7.0f * color.b)) : (color.b + (2.0f * glow.b - 1.0f) * (sqrt(color.b) - color.b)));
+#endif
- #if !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) // no other selected -> additive
- color += glow;
- #endif
+#if !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) // no other selected -> additive
+ color += glow;
+#endif
return color;
}
-vec3 apply_bcs(vec3 color, vec3 bcs)
-{
+vec3 apply_bcs(vec3 color, vec3 bcs) {
color = mix(vec3(0.0f), color, bcs.x);
color = mix(vec3(0.5f), color, bcs.y);
color = mix(vec3(dot(vec3(1.0f), color) * 0.33333f), color, bcs.z);
@@ -258,8 +242,7 @@ vec3 apply_bcs(vec3 color, vec3 bcs)
return color;
}
-vec3 apply_color_correction(vec3 color, sampler2D correction_tex)
-{
+vec3 apply_color_correction(vec3 color, sampler2D correction_tex) {
color.r = texture(correction_tex, vec2(color.r, 0.0f)).r;
color.g = texture(correction_tex, vec2(color.g, 0.0f)).g;
color.b = texture(correction_tex, vec2(color.b, 0.0f)).b;
@@ -267,15 +250,14 @@ vec3 apply_color_correction(vec3 color, sampler2D correction_tex)
return color;
}
-void main()
-{
+void main() {
vec3 color = textureLod(source, uv_interp, 0.0f).rgb;
// Exposure
- #ifdef USE_AUTO_EXPOSURE
- color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey;
- #endif
+#ifdef USE_AUTO_EXPOSURE
+ color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey;
+#endif
color *= exposure;
@@ -283,33 +265,33 @@ void main()
color = apply_tonemapping(color, white);
- #ifdef KEEP_3D_LINEAR
- // leave color as is (-> don't convert to SRGB)
- #else
- color = linear_to_srgb(color); // regular linear -> SRGB conversion
- #endif
+#ifdef KEEP_3D_LINEAR
+ // leave color as is (-> don't convert to SRGB)
+#else
+ color = linear_to_srgb(color); // regular linear -> SRGB conversion
+#endif
// Glow
- #ifdef USING_GLOW
- vec3 glow = gather_glow(source_glow, uv_interp) * glow_intensity;
+#ifdef USING_GLOW
+ vec3 glow = gather_glow(source_glow, uv_interp) * glow_intensity;
- // high dynamic range -> SRGB
- glow = apply_tonemapping(glow, white);
- glow = linear_to_srgb(glow);
+ // high dynamic range -> SRGB
+ glow = apply_tonemapping(glow, white);
+ glow = linear_to_srgb(glow);
- color = apply_glow(color, glow);
- #endif
+ color = apply_glow(color, glow);
+#endif
// Additional effects
- #ifdef USE_BCS
- color = apply_bcs(color, bcs);
- #endif
+#ifdef USE_BCS
+ color = apply_bcs(color, bcs);
+#endif
- #ifdef USE_COLOR_CORRECTION
- color = apply_color_correction(color, color_correction);
- #endif
+#ifdef USE_COLOR_CORRECTION
+ color = apply_color_correction(color, color_correction);
+#endif
frag_color = vec4(color, 1.0f);
}
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 3f512af8d5..b08688892e 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -271,7 +271,6 @@ static void _write_png_data(png_structp png_ptr, png_bytep data, png_size_t p_le
v.resize(vs + p_length);
PoolVector<uint8_t>::Write w = v.write();
copymem(&w[vs], data, p_length);
- //print_line("png write: "+itos(p_length));
}
static PoolVector<uint8_t> _lossless_pack_png(const Ref<Image> &p_image) {
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index d1104eec18..744b3a35e6 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -183,10 +183,8 @@ Error AudioDriverPulseAudio::init_device() {
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
pa_buffer_size = buffer_frames * pa_map.channels;
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("PulseAudio: detected " + itos(pa_map.channels) + " channels");
- print_line("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
- }
+ print_verbose("PulseAudio: detected " + itos(pa_map.channels) + " channels");
+ print_verbose("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
pa_sample_spec spec;
spec.format = PA_SAMPLE_S16LE;
@@ -614,9 +612,7 @@ Error AudioDriverPulseAudio::capture_init_device() {
break;
}
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("PulseAudio: detected " + itos(pa_rec_map.channels) + " input channels");
- }
+ print_verbose("PulseAudio: detected " + itos(pa_rec_map.channels) + " input channels");
pa_sample_spec spec;
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index 365788e192..69830b542b 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -112,10 +112,7 @@ Error AudioDriverRtAudio::init() {
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
unsigned int buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
-
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
- }
+ print_verbose("Audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
short int tries = 2;
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index c25d34125d..ca16c6fcae 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -106,7 +106,6 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
if (is_backup_save_enabled() && (p_mode_flags & WRITE) && !(p_mode_flags & READ)) {
save_path = path;
path = path + ".tmp";
- //print_line("saving instead to "+path);
}
f = fopen(path.utf8().get_data(), mode_string);
@@ -134,9 +133,6 @@ void FileAccessUnix::close() {
}
if (save_path != "") {
-
- //unlink(save_path.utf8().get_data());
- //print_line("renaming...");
int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data());
if (rename_error && close_fail_notify) {
@@ -291,8 +287,7 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
if (!err) {
return flags.st_mtime;
} else {
- print_line("ERROR IN: " + p_file);
-
+ ERR_EXPLAIN("Failed to get modified time for: " + p_file);
ERR_FAIL_V(0);
};
}
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 8aab4cb521..05dfd69f58 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -329,7 +329,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
return OK;
}
-Error OS_Unix::kill(const ProcessID &p_pid, const int p_max_wait_msec) {
+Error OS_Unix::kill(const ProcessID &p_pid) {
int ret = ::kill(p_pid, SIGKILL);
if (!ret) {
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index c5240231fa..95b74d23ff 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -91,7 +91,7 @@ public:
virtual uint64_t get_ticks_usec() const;
virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
- virtual Error kill(const ProcessID &p_pid, const int p_max_wait_msec = -1);
+ virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
virtual bool has_environment(const String &p_var) const;
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 2dcb4ff3d8..11abe3256e 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -321,10 +321,8 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) {
input_position = 0;
input_size = 0;
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("WASAPI: detected " + itos(channels) + " channels");
- print_line("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
- }
+ print_verbose("WASAPI: detected " + itos(channels) + " channels");
+ print_verbose("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
return OK;
}
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index ea194e5eae..b4492a2022 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -31,11 +31,13 @@
#ifdef WINDOWS_ENABLED
#include "file_access_windows.h"
-#include "os/os.h"
-#include "shlwapi.h"
+
+#include "core/os/os.h"
+#include "core/print_string.h"
+
+#include <shlwapi.h>
#include <windows.h>
-#include "print_string.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <tchar.h>
@@ -133,11 +135,6 @@ void FileAccessWindows::close() {
if (save_path != "") {
- //unlink(save_path.utf8().get_data());
- //print_line("renaming...");
- //_wunlink(save_path.c_str()); //unlink if exists
- //int rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str());
-
bool rename_error = true;
int attempts = 4;
while (rename_error && attempts) {
@@ -305,11 +302,10 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
return st.st_mtime;
} else {
- print_line("no access to " + file);
+ ERR_EXPLAIN("Failed to get modified time for: " + file);
+ ERR_FAIL_V(0);
}
-
- ERR_FAIL_V(0);
-};
+}
FileAccessWindows::FileAccessWindows() {
diff --git a/drivers/winmidi/win_midi.cpp b/drivers/winmidi/win_midi.cpp
index 6da6e31b2b..63f7f13685 100644
--- a/drivers/winmidi/win_midi.cpp
+++ b/drivers/winmidi/win_midi.cpp
@@ -53,6 +53,12 @@ Error MIDIDriverWinMidi::open() {
char err[256];
midiInGetErrorText(res, err, 256);
ERR_PRINTS("midiInOpen error: " + String(err));
+
+ MIDIINCAPS caps;
+ res = midiInGetDevCaps(i, &caps, sizeof(MIDIINCAPS));
+ if (res == MMSYSERR_NOERROR) {
+ ERR_PRINTS("Can't open MIDI device \"" + String(caps.szPname) + "\", is it being used by another application?");
+ }
}
}
diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h
index 42e1adb2b7..0867c56128 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.h
+++ b/drivers/xaudio2/audio_driver_xaudio2.h
@@ -51,7 +51,7 @@ class AudioDriverXAudio2 : public AudioDriver {
HANDLE buffer_end_event;
XAudio2DriverVoiceCallback() :
buffer_end_event(CreateEvent(NULL, FALSE, FALSE, NULL)) {}
- void STDMETHODCALLTYPE OnBufferEnd(void *pBufferContext) { /*print_line("buffer ended");*/
+ void STDMETHODCALLTYPE OnBufferEnd(void *pBufferContext) {
SetEvent(buffer_end_event);
}
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index 6d444c5422..590621816e 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -974,8 +974,6 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant
ofs += 0.001;
}
- print_line("inserting");
-
*get_block_animation_update_ptr() = true;
get_undo_redo()->create_action("Add Audio Track Clip");
get_undo_redo()->add_do_method(get_animation().ptr(), "audio_track_insert_key", get_track(), ofs, stream);
@@ -1124,7 +1122,6 @@ Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_
}
String anim = get_animation()->animation_track_get_key_animation(get_track(), p_index);
- print_line("anim " + anim + " has " + itos(ap->has_animation(anim)));
if (anim != "[stop]" && ap->has_animation(anim)) {
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 9d4333bc29..2fecf24d7d 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -717,7 +717,6 @@ void CodeTextEditor::_complete_request() {
if (code_complete_func) {
code_complete_func(code_complete_ud, ctext, &entries, forced);
}
- // print_line("COMPLETE: "+p_request);
if (entries.size() == 0)
return;
Vector<String> strs;
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index c4a17d5402..62ae14c988 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -336,12 +336,9 @@ void DependencyEditorOwners::_fill_owners(EditorFileSystemDirectory *efsd) {
for (int i = 0; i < efsd->get_file_count(); i++) {
Vector<String> deps = efsd->get_file_deps(i);
- //print_line(":::"+efsd->get_file_path(i));
bool found = false;
for (int j = 0; j < deps.size(); j++) {
- //print_line("\t"+deps[j]+" vs "+editing);
if (deps[j] == editing) {
- //print_line("found");
found = true;
break;
}
@@ -510,7 +507,7 @@ void DependencyRemoveDialog::ok_pressed() {
res->set_path("");
}
String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
- print_line("Moving to trash: " + path);
+ print_verbose("Moving to trash: " + path);
Error err = OS::get_singleton()->move_to_trash(path);
if (err != OK) {
EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
@@ -525,7 +522,7 @@ void DependencyRemoveDialog::ok_pressed() {
for (int i = 0; i < dirs_to_delete.size(); ++i) {
String path = OS::get_singleton()->get_resource_dir() + dirs_to_delete[i].replace_first("res://", "/");
- print_line("Moving to trash: " + path);
+ print_verbose("Moving to trash: " + path);
Error err = OS::get_singleton()->move_to_trash(path);
if (err != OK) {
EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + dirs_to_delete[i] + "\n");
@@ -673,7 +670,6 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
if (!p_parent) {
Vector<String> deps = efsd->get_file_deps(i);
- //print_line(":::"+efsd->get_file_path(i));
for (int j = 0; j < deps.size(); j++) {
if (!refs.has(deps[j])) {
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 91a29f5717..fe1cf3484e 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -792,7 +792,6 @@ Error DocData::_load(Ref<XMLParser> parser) {
class_list[name] = ClassDoc();
ClassDoc &c = class_list[name];
- //print_line("class: "+name);
c.name = name;
if (parser->has_attribute("inherits"))
c.inherits = parser->get_attribute_value("inherits");
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index f1c8c08d08..d99908a3c3 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -172,7 +172,6 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
parent = root;
} else {
String ppath = path.substr(0, pp);
- print_line("PPATH IS: " + ppath);
ERR_CONTINUE(!dir_map.has(ppath));
parent = dir_map[ppath];
}
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index a084437226..9c775be87e 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -482,10 +482,8 @@ void EditorAudioBus::drop_data(const Point2 &p_point, const Variant &p_data) {
Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
- print_line("drag fw");
TreeItem *item = effects->get_item_at_position(p_point);
if (!item) {
- print_line("no item");
return Variant();
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 721158cebb..e46fe96885 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -1486,8 +1486,6 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con
return;
}
- print_line("exporting " + p_path);
-
bool convert = GLOBAL_GET("editor/convert_text_resources_to_binary_on_export");
if (!convert)
return;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 50b3810e52..5a0a49d577 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1907,8 +1907,6 @@ void EditorHelpBit::_go_to_help(String p_what) {
void EditorHelpBit::_meta_clicked(String p_select) {
- print_line("got meta " + p_select);
-
if (p_select.begins_with("$")) { //enum
String select = p_select.substr(1, p_select.length());
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0ca70c41fa..353dce5b20 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -108,7 +108,6 @@
#include "editor/plugins/script_editor_plugin.h"
#include "editor/plugins/script_text_editor.h"
#include "editor/plugins/shader_editor_plugin.h"
-#include "editor/plugins/shader_graph_editor_plugin.h"
#include "editor/plugins/skeleton_2d_editor_plugin.h"
#include "editor/plugins/skeleton_editor_plugin.h"
#include "editor/plugins/skeleton_ik_editor_plugin.h"
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 6818de8281..1f2e73654c 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -104,14 +104,12 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>
continue;
}
AABB aabb = mesh->get_aabb();
- print_line("aabb: " + aabb);
Vector3 ofs = aabb.position + aabb.size * 0.5;
aabb.position -= ofs;
Transform xform;
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.25);
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.25) * xform.basis;
AABB rot_aabb = xform.xform(aabb);
- print_line("rot_aabb: " + rot_aabb);
float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
if (m == 0) {
textures.push_back(Ref<Texture>());
@@ -119,7 +117,6 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>
}
m = 1.0 / m;
m *= 0.5;
- print_line("scale: " + rtos(m));
xform.basis.scale(Vector3(m, m, m));
xform.origin = -xform.basis.xform(ofs); //-ofs*m;
xform.origin.z -= rot_aabb.size.z * 2;
@@ -133,7 +130,6 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>
Ref<ImageTexture> it(memnew(ImageTexture));
it->create_from_image(img);
- //print_line("loaded image, size: "+rtos(m)+" dist: "+rtos(dist)+" empty?"+itos(img.empty())+" w: "+itos(it->get_width())+" h: "+itos(it->get_height()));
VS::get_singleton()->free(inst);
textures.push_back(it);
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 67700b59de..f57c863bcf 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -100,6 +100,8 @@ void EditorProfiler::clear() {
updating_frame = false;
hover_metric = -1;
seeking = false;
+
+ _update_plot();
}
static String _get_percent_txt(float p_value, float p_total) {
@@ -167,7 +169,7 @@ void EditorProfiler::_update_plot() {
int w = graph->get_size().width;
int h = graph->get_size().height;
- bool reset_texture = false;
+ bool reset_texture = graph_texture.is_null();
int desired_len = w * h * 4;
@@ -342,7 +344,6 @@ void EditorProfiler::_update_plot() {
}
time = OS::get_singleton()->get_ticks_usec() - time;
- //print_line("Taken: "+rtos(USEC_TO_SEC(time)));
}
wr = PoolVector<uint8_t>::Write();
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index a9eaad47b7..bc56a95b47 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -152,8 +152,6 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, c
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));
f->store_line(FileAccess::get_md5(p_item.path));
memdelete(f);
- } else {
- //print_line("was not generated");
}
}
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index bbd18306a2..62870ab35c 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -196,8 +196,8 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
void EditorRun::stop() {
if (status != STATUS_STOP && pid != 0) {
- const int max_wait_msec = GLOBAL_DEF("editor/stop_max_wait_msec", 10000);
- OS::get_singleton()->kill(pid, max_wait_msec);
+
+ OS::get_singleton()->kill(pid);
}
status = STATUS_STOP;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 9278d7676a..5d3c6dd087 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -146,7 +146,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
const VariantContainer *v = props.getptr(p_name);
if (!v) {
- print_line("EditorSettings::_get - Warning, not found: " + String(p_name));
+ WARN_PRINTS("EditorSettings::_get - Property not found: " + String(p_name));
return false;
}
r_ret = v->variant;
@@ -853,10 +853,7 @@ void EditorSettings::create() {
singleton->data_dir = data_dir;
singleton->cache_dir = cache_dir;
- if (OS::get_singleton()->is_stdout_verbose()) {
-
- print_line("EditorSettings: Load OK!");
- }
+ print_verbose("EditorSettings: Load OK!");
singleton->setup_language();
singleton->setup_network();
@@ -968,8 +965,8 @@ void EditorSettings::save() {
if (err != OK) {
ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path);
- } else if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("EditorSettings Save OK!");
+ } else {
+ print_verbose("EditorSettings: Save OK!");
}
}
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 50d71f1c98..7ed7b920d9 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -238,7 +238,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
clock_t end_time = clock();
#else
- print_line("Sorry no icons for you");
+ print_line("SVG support disabled, editor icons won't be rendered.");
#endif
}
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp
index b9e0c7d0fa..28b1095256 100644
--- a/editor/fileserver/editor_file_server.cpp
+++ b/editor/fileserver/editor_file_server.cpp
@@ -34,9 +34,10 @@
#include "io/marshalls.h"
//#define DEBUG_PRINT(m_p) print_line(m_p)
-#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec());
+//#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec());
-//#define DEBUG_TIME(m_what)
+#define DEBUG_PRINT(m_what)
+#define DEBUG_TIME(m_what)
void EditorFileServer::_close_client(ClientData *cd) {
@@ -107,7 +108,6 @@ void EditorFileServer::_subthread_start(void *s) {
//wait for ID
err = cd->connection->get_data(buf4, 4);
- //#define DEBUG_PRINT(m_p) print_line(m_p)
DEBUG_TIME("get_data")
if (err != OK) {
@@ -150,13 +150,13 @@ void EditorFileServer::_subthread_start(void *s) {
s.parse_utf8(fileutf8.ptr());
if (cmd == FileAccessNetwork::COMMAND_FILE_EXISTS) {
- print_line("FILE EXISTS: " + s);
+ DEBUG_PRINT("FILE EXISTS: " + s);
}
if (cmd == FileAccessNetwork::COMMAND_GET_MODTIME) {
- print_line("MOD TIME: " + s);
+ DEBUG_PRINT("MOD TIME: " + s);
}
if (cmd == FileAccessNetwork::COMMAND_OPEN_FILE) {
- print_line("OPEN: " + s);
+ DEBUG_PRINT("OPEN: " + s);
}
if (!s.begins_with("res://")) {
@@ -243,7 +243,7 @@ void EditorFileServer::_subthread_start(void *s) {
int read = cd->files[id]->get_buffer(buf.ptrw(), blocklen);
ERR_CONTINUE(read < 0);
- print_line("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen));
+ DEBUG_PRINT("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen));
//not found, continue
encode_uint32(id, buf4);
@@ -259,7 +259,7 @@ void EditorFileServer::_subthread_start(void *s) {
} break;
case FileAccessNetwork::COMMAND_CLOSE: {
- print_line("CLOSED");
+ DEBUG_PRINT("CLOSED");
ERR_CONTINUE(!cd->files.has(id));
memdelete(cd->files[id]);
cd->files.erase(id);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index ec1153a015..cb38c2f85e 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -809,7 +809,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
}
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- print_line("Moving " + old_path + " -> " + new_path);
+ print_verbose("Moving " + old_path + " -> " + new_path);
Error err = da->rename(old_path, new_path);
if (err == OK) {
//Move/Rename any corresponding import settings too
@@ -837,7 +837,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
//Only treat as a changed dependency if it was successfully moved
for (int i = 0; i < file_changed_paths.size(); ++i) {
p_file_renames[file_changed_paths[i]] = file_changed_paths[i].replace_first(old_path, new_path);
- print_line(" Remap: " + file_changed_paths[i] + " -> " + p_file_renames[file_changed_paths[i]]);
+ print_verbose(" Remap: " + file_changed_paths[i] + " -> " + p_file_renames[file_changed_paths[i]]);
}
for (int i = 0; i < folder_changed_paths.size(); ++i) {
p_folder_renames[folder_changed_paths[i]] = folder_changed_paths[i].replace_first(old_path, new_path);
@@ -865,7 +865,7 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
}
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- print_line("Duplicating " + old_path + " -> " + new_path);
+ print_verbose("Duplicating " + old_path + " -> " + new_path);
Error err = p_item.is_file ? da->copy(old_path, new_path) : da->copy_dir(old_path, new_path);
if (err == OK) {
//Move/Rename any corresponding import settings too
@@ -942,7 +942,7 @@ void FileSystemDock::_update_dependencies_after_move(const Map<String, String> &
for (int i = 0; i < remaps.size(); ++i) {
//Because we haven't called a rescan yet the found remap might still be an old path itself.
String file = p_renames.has(remaps[i]) ? p_renames[remaps[i]] : remaps[i];
- print_line("Remapping dependencies for: " + file);
+ print_verbose("Remapping dependencies for: " + file);
Error err = ResourceLoader::rename_dependencies(file, p_renames);
if (err == OK) {
if (ResourceLoader::get_resource_type(file) == "PackedScene")
@@ -998,7 +998,7 @@ void FileSystemDock::_make_dir_confirm() {
return;
}
- print_line("Making folder " + dir_name + " in " + path);
+ print_verbose("Making folder " + dir_name + " in " + path);
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
Error err = da->change_dir(path);
if (err == OK) {
@@ -1007,7 +1007,7 @@ void FileSystemDock::_make_dir_confirm() {
memdelete(da);
if (err == OK) {
- print_line("call rescan!");
+ print_verbose("FileSystem: calling rescan.");
_rescan();
} else {
EditorNode::get_singleton()->show_warning(TTR("Could not create folder."));
@@ -1054,7 +1054,7 @@ void FileSystemDock::_rename_operation_confirm() {
_update_favorite_dirs_list_after_move(folder_renames);
//Rescan everything
- print_line("call rescan!");
+ print_verbose("FileSystem: calling rescan.");
_rescan();
}
@@ -1089,7 +1089,7 @@ void FileSystemDock::_duplicate_operation_confirm() {
_try_duplicate_item(to_duplicate, new_path);
//Rescan everything
- print_line("call rescan!");
+ print_verbose("FileSystem: calling rescan.");
_rescan();
}
@@ -1146,7 +1146,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
_update_project_settings_after_move(file_renames);
_update_favorite_dirs_list_after_move(folder_renames);
- print_line("call rescan!");
+ print_verbose("FileSystem: calling rescan.");
_rescan();
}
}
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index ef7409fd43..9ede8a05bc 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -123,12 +123,12 @@ void FindInFiles::_notification(int p_notification) {
void FindInFiles::start() {
if (_pattern == "") {
- print_line("Nothing to search, pattern is empty");
+ print_verbose("Nothing to search, pattern is empty");
emit_signal(SIGNAL_FINISHED);
return;
}
if (_extension_filter.size() == 0) {
- print_line("Nothing to search, filter matches no files");
+ print_verbose("Nothing to search, filter matches no files");
emit_signal(SIGNAL_FINISHED);
return;
}
@@ -207,7 +207,7 @@ void FindInFiles::_iterate() {
_scan_file(fpath);
} else {
- print_line("Search complete");
+ print_verbose("Search complete");
set_process(false);
_current_dir = "";
_searching = false;
@@ -226,7 +226,7 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
DirAccess *dir = DirAccess::open(path);
if (dir == NULL) {
- print_line("Cannot open directory! " + path);
+ print_verbose("Cannot open directory! " + path);
return;
}
@@ -258,7 +258,7 @@ void FindInFiles::_scan_file(String fpath) {
FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
if (f == NULL) {
- print_line(String("Cannot open file ") + fpath);
+ print_verbose(String("Cannot open file ") + fpath);
return;
}
@@ -896,7 +896,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
int _;
if (!find_next(line, search_text, repl_begin, _finder->is_match_case(), _finder->is_whole_words(), _, _)) {
// Make sure the replace is still valid in case the file was tampered with.
- print_line(String("Occurrence no longer matches, replace will be ignored in {0}: line {1}, col {2}").format(varray(fpath, repl_line_number, repl_begin)));
+ print_verbose(String("Occurrence no longer matches, replace will be ignored in {0}: line {1}, col {2}").format(varray(fpath, repl_line_number, repl_begin)));
continue;
}
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 22ea5883e8..d4bd4f85e6 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -119,7 +119,6 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n
Collada::NodeJoint *joint = static_cast<Collada::NodeJoint *>(p_node);
- print_line("populating joint " + joint->name);
p_skeleton->add_bone(p_node->name);
if (p_parent >= 0)
p_skeleton->set_bone_parent(r_bone, p_parent);
@@ -137,8 +136,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n
p_skeleton->set_bone_rest(r_bone, collada.fix_transform(collada.state.bone_rest_map[joint->sid]));
//should map this bone to something for animation?
} else {
- print_line("no rest: " + joint->sid);
- WARN_PRINT("Joint has no rest...");
+ WARN_PRINT("Collada: Joint has no rest.");
}
int id = r_bone++;
@@ -585,9 +583,6 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c
binormals.write[index_arrayr[idx * 3 + 1]] += binormal;
tangents.write[index_arrayr[idx * 3 + 2]] += tangent;
binormals.write[index_arrayr[idx * 3 + 2]] += binormal;
-
- //print_line(itos(idx)+" tangent: "+tangent);
- //print_line(itos(idx)+" binormal: "+binormal);
}
r_tangents.resize(vlen * 4);
@@ -1028,7 +1023,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
material = material_cache[target];
} else if (p.material != "") {
- print_line("Warning, unreferenced material in geometry instance: " + p.material);
+ WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + p.material);
}
}
@@ -1352,7 +1347,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mesh_cache[meshid] = mesh;
} else {
- print_line("Warning, will not import geometry: " + meshid);
+ WARN_PRINTS("Collada: Will not import geometry: " + meshid);
}
}
@@ -1379,7 +1374,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mi->set_surface_material(i, material);
} else if (matname != "") {
- print_line("Warning, unreferenced material in geometry instance: " + matname);
+ WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + matname);
}
}
}
@@ -1541,7 +1536,6 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
for (int i = 0; i < collada.state.animation_tracks.size(); i++) {
const Collada::AnimationTrack &at = collada.state.animation_tracks[i];
- //print_line("CHANNEL: "+at.target+" PARAM: "+at.param);
String node;
@@ -1551,7 +1545,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
node = node_name_map[at.target];
} else {
- print_line("Couldn't find node: " + at.target);
+ WARN_PRINTS("Collada: Couldn't find node: " + at.target);
continue;
}
} else {
@@ -1570,7 +1564,6 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
}
create_animation(-1, p_make_tracks_in_all_bones, p_import_value_tracks);
- //print_line("clipcount: "+itos(collada.state.animation_clips.size()));
for (int i = 0; i < collada.state.animation_clips.size(); i++)
create_animation(i, p_make_tracks_in_all_bones, p_import_value_tracks);
}
@@ -1580,11 +1573,8 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Ref<Animation> animation = Ref<Animation>(memnew(Animation));
if (p_clip == -1) {
-
- //print_line("default");
animation->set_name("default");
} else {
- //print_line("clip name: "+collada.state.animation_clips[p_clip].name);
animation->set_name(collada.state.animation_clips[p_clip].name);
}
@@ -1658,7 +1648,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
}
- //print_line("anim len: "+rtos(anim_length));
animation->set_length(anim_length);
bool tracks_found = false;
@@ -1736,7 +1725,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
if (xform_idx == -1) {
- print_line("couldn't find matching node " + at.target + " xform for track " + at.param);
+ WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param);
continue;
}
@@ -1758,14 +1747,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
ERR_CONTINUE(data.size() > 1);
xf.data.write[cn] = data[0];
} else if (data.size() == xf.data.size()) {
-
xf.data = data;
} else {
-
- if (data.size() != xf.data.size()) {
- print_line("component " + at.component + " datasize " + itos(data.size()) + " xfdatasize " + itos(xf.data.size()));
- }
-
+ ERR_EXPLAIN("Component " + at.component + " has datasize " + itos(data.size()) + ", xfdatasize " + itos(xf.data.size()));
ERR_CONTINUE(data.size() != xf.data.size());
}
}
@@ -1781,7 +1765,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform;
} else {
- ERR_PRINT("INVALID SKELETON!!!!");
+ ERR_PRINT("Collada: Invalid skeleton");
}
}
@@ -1812,8 +1796,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
if (E->get())
continue;
- //print_line("BONE LACKS ANIM: "+E->key());
-
NodeMap &nm = node_map[E->key()];
String path = scene->get_path_to(nm.node);
ERR_CONTINUE(nm.bone < 0);
@@ -1823,7 +1805,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Collada::Node *cn = collada.state.scene_map[E->key()];
if (cn->ignore_anim) {
- print_line("warning, ignoring animation on node: " + path);
+ WARN_PRINTS("Collada: Ignoring animation on node: " + path);
continue;
}
@@ -1889,10 +1871,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
} else if (data.size() == 16) {
//matrix
- print_line("value keys for matrices not supported");
+ WARN_PRINT("Collada: Value keys for matrices not supported.");
} else {
-
- print_line("don't know what to do with this amount of value keys: " + itos(data.size()));
+ WARN_PRINTS("Collada: Unexpected amount of value keys: " + itos(data.size()));
}
animation->track_insert_key(track, time, value);
@@ -1994,7 +1975,6 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String &p_path
if (state.animations.size() == 0)
return Ref<Animation>();
Ref<Animation> anim = state.animations[0];
- print_line("Anim Load OK");
String base = p_path.get_basename().to_lower();
if (p_flags & IMPORT_ANIMATION_DETECT_LOOP) {
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 906d902b4a..4d5c292847 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -323,7 +323,7 @@ Error EditorSceneImporterGLTF::_parse_buffers(GLTFState &state, const String &p_
}
}
- print_line("total buffers: " + itos(state.buffers.size()));
+ print_verbose("glTF: Total buffers: " + itos(state.buffers.size()));
return OK;
}
@@ -359,7 +359,7 @@ Error EditorSceneImporterGLTF::_parse_buffer_views(GLTFState &state) {
state.buffer_views.push_back(buffer_view);
}
- print_line("total buffer views: " + itos(state.buffer_views.size()));
+ print_verbose("glTF: Total buffer views: " + itos(state.buffer_views.size()));
return OK;
}
@@ -451,7 +451,7 @@ Error EditorSceneImporterGLTF::_parse_accessors(GLTFState &state) {
state.accessors.push_back(accessor);
}
- print_line("total accessors: " + itos(state.accessors.size()));
+ print_verbose("glTF: Total accessors: " + itos(state.accessors.size()));
return OK;
}
@@ -501,8 +501,8 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe
const uint8_t *bufptr = buffer.ptr();
//use to debug
- //print_line("type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count));
- print_line("accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length));
+ print_verbose("glTF: type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count));
+ print_verbose("glTF: accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length));
int buffer_end = (stride * (count - 1)) + element_size;
ERR_FAIL_COND_V(buffer_end > bv.byte_length, ERR_PARSE_ERROR);
@@ -853,7 +853,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Array meshes = state.json["meshes"];
for (int i = 0; i < meshes.size(); i++) {
- print_line("on mesh: " + itos(i));
+ print_verbose("glTF: Parsing mesh: " + itos(i));
Dictionary d = meshes[i];
GLTFMesh mesh;
@@ -935,7 +935,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
w[j + 3] /= total;
}
- //print_line(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3]));
+ //print_verbose(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3]));
}
}
array[Mesh::ARRAY_WEIGHTS] = weights;
@@ -996,7 +996,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Array morphs;
//blend shapes
if (p.has("targets")) {
- print_line("has targets!");
+ print_verbose("glTF: Mesh has targets");
Array targets = p["targets"];
if (j == 0) {
@@ -1091,7 +1091,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
state.meshes.push_back(mesh);
}
- print_line("total meshes: " + itos(state.meshes.size()));
+ print_verbose("glTF: Total meshes: " + itos(state.meshes.size()));
return OK;
}
@@ -1183,7 +1183,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
- print_line("total images: " + itos(state.images.size()));
+ print_verbose("Total images: " + itos(state.images.size()));
return OK;
}
@@ -1338,7 +1338,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
state.materials.push_back(material);
}
- print_line("total materials: " + itos(state.materials.size()));
+ print_verbose("Total materials: " + itos(state.materials.size()));
return OK;
}
@@ -1381,12 +1381,11 @@ Error EditorSceneImporterGLTF::_parse_skins(GLTFState &state) {
skin.bones.push_back(bone);
}
- print_line("skin has skeleton? " + itos(d.has("skeleton")));
+ print_verbose("glTF: Skin has skeleton? " + itos(d.has("skeleton")));
if (d.has("skeleton")) {
int skeleton = d["skeleton"];
ERR_FAIL_INDEX_V(skeleton, state.nodes.size(), ERR_PARSE_ERROR);
- //state.nodes[skeleton]->skeleton_skin = state.skins.size();
- print_line("setting skeleton skin to" + itos(skeleton));
+ print_verbose("glTF: Setting skeleton skin to" + itos(skeleton));
skin.skeleton = skeleton;
if (!state.skeleton_nodes.has(skeleton)) {
state.skeleton_nodes[skeleton] = Vector<int>();
@@ -1443,7 +1442,7 @@ Error EditorSceneImporterGLTF::_parse_skins(GLTFState &state) {
*/
state.skins.push_back(skin);
}
- print_line("total skins: " + itos(state.skins.size()));
+ print_verbose("glTF: Total skins: " + itos(state.skins.size()));
//now
@@ -1496,7 +1495,7 @@ Error EditorSceneImporterGLTF::_parse_cameras(GLTFState &state) {
state.cameras.push_back(camera);
}
- print_line("total cameras: " + itos(state.cameras.size()));
+ print_verbose("glTF: Total cameras: " + itos(state.cameras.size()));
return OK;
}
@@ -1574,7 +1573,6 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
}
}
- print_line("path: " + path);
PoolVector<float> times = _decode_accessor_as_floats(state, input, false);
if (path == "translation") {
PoolVector<Vector3> translations = _decode_accessor_as_vec3(state, output, false);
@@ -1624,7 +1622,7 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
state.animations.push_back(animation);
}
- print_line("total animations: " + itos(state.animations.size()));
+ print_verbose("glTF: Total animations: " + itos(state.animations.size()));
return OK;
}
@@ -1656,7 +1654,7 @@ void EditorSceneImporterGLTF::_generate_node(GLTFState &state, int p_node, Node
if (n->mesh >= 0) {
ERR_FAIL_INDEX(n->mesh, state.meshes.size());
MeshInstance *mi = memnew(MeshInstance);
- print_line("**creating mesh for: " + n->name);
+ print_verbose("glTF: Creating mesh for: " + n->name);
GLTFMesh &mesh = state.meshes.write[n->mesh];
mi->set_mesh(mesh.mesh);
if (mesh.mesh->get_name() == "") {
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index 211bb7bcc9..db16f20ade 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -52,6 +52,7 @@ String ResourceImporterLayeredTexture::get_preset_name(int p_idx) const {
void ResourceImporterLayeredTexture::get_import_options(List<ImportOption> *r_options, int p_preset) const {
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "Lossless,Video RAM,Uncompressed", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), p_preset == PRESET_3D ? 1 : 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "compress/no_bptc_if_rgb"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/repeat", PROPERTY_HINT_ENUM, "Disabled,Enabled,Mirrored"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_COLOR_CORRECT ? 0 : 1));
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 5babf6419c..3f101cd04d 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -63,7 +63,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
material_map[current_name] = current;
} else if (l.begins_with("Ka ")) {
//uv
- print_line("Warning: Ambient light for material '" + current_name + "' is ignored in PBR");
+ WARN_PRINTS("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR");
} else if (l.begins_with("Kd ")) {
//normal
@@ -119,7 +119,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
} else if (l.begins_with("map_Ka ")) {
//uv
- print_line("Warning: Ambient light texture for material '" + current_name + "' is ignored in PBR");
+ WARN_PRINTS("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR");
} else if (l.begins_with("map_Kd ")) {
//normal
@@ -335,8 +335,8 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
surf_tool->index();
- print_line("current material library " + current_material_library + " has " + itos(material_map.has(current_material_library)));
- print_line("current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
+ print_verbose("OBJ: Current material library " + current_material_library + " has " + itos(material_map.has(current_material_library)));
+ print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) {
surf_tool->set_material(material_map[current_material_library][current_material]);
@@ -350,7 +350,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
mesh->surface_set_name(mesh->get_surface_count() - 1, current_group);
}
- print_line("Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1));
+ print_verbose("OBJ: Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1));
surf_tool->clear();
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
}
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index b5e3466b12..f544811eb0 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -281,12 +281,11 @@ static String _fixstr(const String &p_what, const String &p_str) {
Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map, LightBakeMode p_light_bake_mode) {
- // children first..
+ // children first
for (int i = 0; i < p_node->get_child_count(); i++) {
Node *r = _fix_node(p_node->get_child(i), p_root, collision_map, p_light_bake_mode);
if (!r) {
- print_line("was erased...");
i--; //was erased
}
}
@@ -391,7 +390,6 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
colshape->set_owner(p_node->get_owner());
} else if (p_node->has_meta("empty_draw_type")) {
String empty_draw_type = String(p_node->get_meta("empty_draw_type"));
- print_line(empty_draw_type);
StaticBody *sb = memnew(StaticBody);
sb->set_name(_fixstr(name, "colonly"));
Object::cast_to<Spatial>(sb)->set_transform(Object::cast_to<Spatial>(p_node)->get_transform());
@@ -723,15 +721,11 @@ void ResourceImporterScene::_filter_anim_tracks(Ref<Animation> anim, Set<String>
Ref<Animation> a = anim;
ERR_FAIL_COND(!a.is_valid());
- print_line("From Anim " + anim->get_name() + ":");
-
for (int j = 0; j < a->get_track_count(); j++) {
String path = a->track_get_path(j);
if (!keep.has(path)) {
-
- print_line("Remove: " + path);
a->remove_track(j);
j--;
}
@@ -899,8 +893,6 @@ void ResourceImporterScene::_find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Trans
}
meshes[mesh] = transform;
-
- print_line("mesh transform: " + meshes[mesh]);
}
}
for (int i = 0; i < p_node->get_child_count(); i++) {
@@ -913,8 +905,6 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
List<PropertyInfo> pi;
- print_line("node: " + String(p_node->get_name()));
-
if (p_make_animations) {
if (Object::cast_to<AnimationPlayer>(p_node)) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
@@ -1316,7 +1306,6 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
if (bool(p_options["external_files/store_in_subdir"])) {
String subdir_name = p_source_file.get_file().get_basename();
DirAccess *da = DirAccess::open(base_path);
- print_line("at path " + da->get_current_dir() + " making " + subdir_name);
Error err = da->make_dir(subdir_name);
memdelete(da);
ERR_FAIL_COND_V(err != OK && err != ERR_ALREADY_EXISTS, err);
@@ -1421,7 +1410,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
Ref<PackedScene> packer = memnew(PackedScene);
packer->pack(scene);
- print_line("SAVING TO: " + p_save_path + ".scn");
+ print_verbose("Saving scene to: " + p_save_path + ".scn");
err = ResourceSaver::save(p_save_path + ".scn", packer); //do not take over, let the changed files reload themselves
ERR_FAIL_COND_V(err != OK, err);
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 9e99dcc5c8..d04f29ea5e 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -205,7 +205,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
/*print_line("chunksize: "+itos(chunksize));
print_line("channels: "+itos(format_channels));
print_line("bits: "+itos(format_bits));
-*/
+ */
int len = frames;
if (format_channels == 2)
@@ -293,6 +293,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
bool is16 = format_bits != 8;
int rate = format_freq;
+ /*
print_line("Input Sample: ");
print_line("\tframes: " + itos(frames));
print_line("\tformat_channels: " + itos(format_channels));
@@ -301,18 +302,16 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
print_line("\tloop: " + itos(loop));
print_line("\tloop begin: " + itos(loop_begin));
print_line("\tloop end: " + itos(loop_end));
+ */
//apply frequency limit
bool limit_rate = p_options["force/max_rate"];
int limit_rate_hz = p_options["force/max_rate_hz"];
if (limit_rate && rate > limit_rate_hz && rate > 0 && frames > 0) {
- //resampleeee!!!
+ // resample!
int new_data_frames = (int)(frames * (float)limit_rate_hz / (float)rate);
- print_line("\tresampling ratio: " + rtos((float)limit_rate_hz / (float)rate));
- print_line("\tnew frames: " + itos(new_data_frames));
-
Vector<float> new_data;
new_data.resize(new_data_frames * format_channels);
for (int c = 0; c < format_channels; c++) {
@@ -492,8 +491,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
- //print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size()));
-
} else {
dst_format = is16 ? AudioStreamSample::FORMAT_16_BITS : AudioStreamSample::FORMAT_8_BITS;
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 418936ac9f..93bed035a5 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -112,7 +112,6 @@ void PluginConfigDialog::_notification(int p_what) {
void PluginConfigDialog::config(const String &p_config_path) {
if (p_config_path.length()) {
Ref<ConfigFile> cf = memnew(ConfigFile);
- print_line(p_config_path);
cf->load(p_config_path);
name_edit->set_text(cf->get_value("plugin", "name", ""));
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index e5476aaf08..2d240b5a5c 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -349,7 +349,6 @@ void AnimationNodeBlendSpace2DEditor::_tool_switch(int p_tool) {
points.push_back(blend_space->get_blend_point_position(i));
}
Vector<Delaunay2D::Triangle> tr = Delaunay2D::triangulate(points);
- print_line("triangleS: " + itos(tr.size()));
for (int i = 0; i < tr.size(); i++) {
blend_space->add_triangle(tr[i].points[0], tr[i].points[1], tr[i].points[2]);
}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 9530fae8e4..dbb5fa578b 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -38,7 +38,6 @@ void AnimationNodeBlendTreeEditor::remove_custom_type(const Ref<Script> &p_scrip
void AnimationNodeBlendTreeEditor::_update_options_menu() {
- print_line("update options");
add_node->get_popup()->clear();
for (int i = 0; i < add_options.size(); i++) {
add_node->get_popup()->add_item(add_options[i].name, i);
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 27a16fd3dd..f282d391ff 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -429,7 +429,7 @@ bool SpatialMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) c
Ref<SpatialMaterial> mat = p_resource;
return mat.is_valid();
}
-Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<SpatialMaterial> mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
@@ -475,7 +475,7 @@ bool ParticlesMaterialConversionPlugin::handles(const Ref<Resource> &p_resource)
Ref<ParticlesMaterial> mat = p_resource;
return mat.is_valid();
}
-Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<ParticlesMaterial> mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
@@ -513,7 +513,7 @@ bool CanvasItemMaterialConversionPlugin::handles(const Ref<Resource> &p_resource
Ref<CanvasItemMaterial> mat = p_resource;
return mat.is_valid();
}
-Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<CanvasItemMaterial> mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 80a5c535b8..31a927d83f 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -109,7 +109,7 @@ class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin {
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin {
@@ -117,7 +117,7 @@ class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin {
@@ -125,7 +125,7 @@ class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
#endif // MATERIAL_EDITOR_PLUGIN_H
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index ea8f921034..7b7e23531a 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -97,13 +97,11 @@ void MeshEditor::edit(Ref<Mesh> p_mesh) {
_update_rotation();
AABB aabb = mesh->get_aabb();
- print_line("aabb: " + aabb);
Vector3 ofs = aabb.position + aabb.size * 0.5;
float m = aabb.get_longest_axis_size();
if (m != 0) {
m = 1.0 / m;
m *= 0.5;
- //print_line("scale: "+rtos(m));
Transform xform;
xform.basis.scale(Vector3(m, m, m));
xform.origin = -xform.basis.xform(ofs); //-ofs*m;
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index 99a28be555..c24c96bdc5 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -169,8 +169,6 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
void MeshLibraryEditor::_import_scene_cbk(const String &p_str) {
- print_line("Impot Callback!");
-
Ref<PackedScene> ps = ResourceLoader::load(p_str, "PackedScene");
ERR_FAIL_COND(ps.is_null());
Node *scene = ps->instance();
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index b50e0dfe88..ae5d510502 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -58,8 +58,6 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) {
void Particles2DEditorPlugin::_file_selected(const String &p_file) {
- print_line("file: " + p_file);
-
source_emission_file = p_file;
emission_mask->popup_centered_minsize();
}
@@ -73,7 +71,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
generate_seconds->set_value(1.0);
else
generate_seconds->set_value(trunc(gen_time) + 1.0);
- generate_aabb->popup_centered_minsize();
+ generate_visibility_rect->popup_centered_minsize();
} break;
case MENU_LOAD_EMISSION_MASK: {
@@ -93,7 +91,7 @@ void Particles2DEditorPlugin::_generate_visibility_rect() {
float running = 0.0;
- EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time));
+ EditorProgress ep("gen_vrect", TTR("Generating Visibility Rect"), int(time));
bool was_emitting = particles->is_emitting();
if (!was_emitting) {
@@ -376,19 +374,19 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
epoints->set_value(512);
file->get_vbox()->add_margin_child(TTR("Generated Point Count:"), epoints);
- generate_aabb = memnew(ConfirmationDialog);
- generate_aabb->set_title(TTR("Generate Visibility Rect"));
+ generate_visibility_rect = memnew(ConfirmationDialog);
+ generate_visibility_rect->set_title(TTR("Generate Visibility Rect"));
VBoxContainer *genvb = memnew(VBoxContainer);
- generate_aabb->add_child(genvb);
+ generate_visibility_rect->add_child(genvb);
generate_seconds = memnew(SpinBox);
genvb->add_margin_child(TTR("Generation Time (sec):"), generate_seconds);
generate_seconds->set_min(0.1);
generate_seconds->set_max(25);
generate_seconds->set_value(2);
- toolbar->add_child(generate_aabb);
+ toolbar->add_child(generate_visibility_rect);
- generate_aabb->connect("confirmed", this, "_generate_visibility_rect");
+ generate_visibility_rect->connect("confirmed", this, "_generate_visibility_rect");
emission_mask = memnew(ConfirmationDialog);
emission_mask->set_title(TTR("Generate Visibility Rect"));
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index addf65789c..2b6123141b 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -66,7 +66,7 @@ class Particles2DEditorPlugin : public EditorPlugin {
SpinBox *epoints;
- ConfirmationDialog *generate_aabb;
+ ConfirmationDialog *generate_visibility_rect;
SpinBox *generate_seconds;
ConfirmationDialog *emission_mask;
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 6a99dcb9a5..3c381158a4 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -262,6 +262,7 @@ void ParticlesEditor::_notification(int p_notification) {
if (p_notification == NOTIFICATION_ENTER_TREE) {
options->set_icon(options->get_popup()->get_icon("Particles", "EditorIcons"));
+ get_tree()->connect("node_removed", this, "_node_removed");
}
}
@@ -444,6 +445,7 @@ void ParticlesEditor::_bind_methods() {
ClassDB::bind_method("_menu_option", &ParticlesEditor::_menu_option);
ClassDB::bind_method("_generate_aabb", &ParticlesEditor::_generate_aabb);
+ ClassDB::bind_method("_node_removed", &ParticlesEditor::_node_removed);
}
ParticlesEditor::ParticlesEditor() {
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 4840b1899d..a437cd5362 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -36,6 +36,7 @@
#include "os/input.h"
#include "os/keyboard.h"
#include "scene/2d/skeleton_2d.h"
+
Node2D *Polygon2DEditor::_get_node() const {
return node;
@@ -82,7 +83,6 @@ void Polygon2DEditor::_notification(int p_what) {
void Polygon2DEditor::_sync_bones() {
- print_line("syncinc");
if (!node->has_node(node->get_skeleton())) {
error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node"));
error->popup_centered_minsize();
@@ -101,8 +101,6 @@ void Polygon2DEditor::_sync_bones() {
Array prev_bones = node->call("_get_bones");
node->clear_bones();
- print_line("bones in skeleton: " + itos(skeleton->get_bone_count()));
-
for (int i = 0; i < skeleton->get_bone_count(); i++) {
NodePath path = skeleton->get_path_to(skeleton->get_bone(i));
PoolVector<float> weights;
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index 89c1b3a978..af3c09afc5 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -276,7 +276,6 @@ void EditorInspectorRootMotionPlugin::parse_begin(Object *p_object) {
bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) {
if (p_path == "root_motion_track" && p_object->is_class("AnimationTree") && p_type == Variant::NODE_PATH) {
- print_line("use custom!");
EditorPropertyRootMotion *editor = memnew(EditorPropertyRootMotion);
if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {
editor->setup(p_hint_text);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 1bb7c98114..fa034c97c0 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1692,7 +1692,6 @@ void ScriptEditor::_update_script_names() {
if (restoring_layout)
return;
- waiting_update_names = false;
Set<Ref<Script> > used;
Node *edited = EditorNode::get_singleton()->get_edited_scene();
if (edited) {
@@ -1816,8 +1815,12 @@ void ScriptEditor::_update_script_names() {
}
}
- _update_members_overview();
- _update_help_overview();
+ if (!waiting_update_names) {
+ _update_members_overview();
+ _update_help_overview();
+ } else {
+ waiting_update_names = false;
+ }
_update_members_overview_visibility();
_update_help_overview_visibility();
_update_script_colors();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 522ce52234..4e7047ee38 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -60,7 +60,6 @@ void ScriptTextEditor::apply_code() {
if (script.is_null())
return;
- //print_line("applying code");
script->set_source_code(code_editor->get_text_edit()->get_text());
script->update_exports();
_update_member_keywords();
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index ea1876c27a..5ee40dc90a 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -37,7 +37,6 @@
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/property_editor.h"
-#include "scene/resources/shader_graph.h"
#include "servers/visual/shader_types.h"
/*** SHADER SCRIPT EDITOR ****/
@@ -167,7 +166,6 @@ void ShaderTextEditor::_check_shader_mode() {
String type = ShaderLanguage::get_shader_type(get_text_edit()->get_text());
- print_line("type is: " + type);
Shader::Mode mode;
if (type == "canvas_item") {
diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp
deleted file mode 100644
index 1a9d980feb..0000000000
--- a/editor/plugins/shader_graph_editor_plugin.cpp
+++ /dev/null
@@ -1,2932 +0,0 @@
-/*************************************************************************/
-/* shader_graph_editor_plugin.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-// FIXME: Godot 3.0 broke compatibility with ShaderGraphEditorPlugin,
-// it needs to be ported to the new shader language.
-#if 0
-#include "shader_graph_editor_plugin.h"
-
-#include "canvas_item_editor_plugin.h"
-#include "os/keyboard.h"
-#include "scene/gui/check_box.h"
-#include "scene/gui/menu_button.h"
-#include "scene/gui/panel.h"
-#include "spatial_editor_plugin.h"
-
-void GraphColorRampEdit::_gui_input(const InputEvent& p_event) {
-
- if (p_event.type==InputEvent::KEY && p_event->is_pressed() && p_event->get_scancode()==KEY_DELETE && grabbed!=-1) {
-
- points.remove(grabbed);
- grabbed=-1;
- update();
- emit_signal("ramp_changed");
- accept_event();
- }
-
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) {
-
- update();
- int x = p_event->get_position().x;
- int total_w = get_size().width-get_size().height-3;
- if (x>total_w+3) {
-
- if (grabbed==-1)
- return;
- Size2 ms = Size2(350, picker->get_combined_minimum_size().height+10);
- picker->set_color(points[grabbed].color);
- popup->set_position(get_global_position()-Size2(0,ms.height));
- popup->set_size(ms);
- popup->popup();
- return;
- }
-
-
- float ofs = CLAMP(x/float(total_w),0,1);
-
- grabbed=-1;
- grabbing=true;
- int pos=-1;
- for(int i=0;i<points.size();i++) {
-
- if (ABS(x-points[i].offset*total_w)<4) {
- grabbed=i;
- }
- if (points[i].offset<ofs)
- pos=i;
- }
-
- grabbed_at=ofs;
- //grab or select
- if (grabbed!=-1) {
- return;
- }
- //insert
-
-
- Point p;
- p.offset=ofs;
-
- Point prev;
- Point next;
-
- if (pos==-1) {
-
- prev.color=Color(0,0,0);
- prev.offset=0;
- if (points.size()) {
- next=points[0];
- } else {
- next.color=Color(1,1,1);
- next.offset=1.0;
- }
- } else {
-
- if (pos==points.size()-1) {
- next.color=Color(1,1,1);
- next.offset=1.0;
- } else {
- next=points[pos+1];
- }
- prev=points[pos];
-
- }
-
- p.color=prev.color.linear_interpolate(next.color,(p.offset-prev.offset)/(next.offset-prev.offset));
-
- points.push_back(p);
- points.sort();
- for(int i=0;i<points.size();i++) {
- if (points[i].offset==ofs) {
- grabbed=i;
- break;
- }
- }
-
- emit_signal("ramp_changed");
-
- }
-
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && !p_event->is_pressed()) {
-
- if (grabbing) {
- grabbing=false;
- emit_signal("ramp_changed");
- }
- update();
- }
-
- if (p_event.type==InputEvent::MOUSE_MOTION && grabbing) {
-
- int total_w = get_size().width-get_size().height-3;
-
- int x = p_event.mouse_motion.x;
- float newofs = CLAMP(x/float(total_w),0,1);
-
- bool valid=true;
- for(int i=0;i<points.size();i++) {
-
- if (points[i].offset==newofs && i!=grabbed) {
- valid=false;
- }
- }
-
- if (!valid)
- return;
-
- points[grabbed].offset=newofs;
-
- points.sort();
- for(int i=0;i<points.size();i++) {
- if (points[i].offset==newofs) {
- grabbed=i;
- break;
- }
- }
-
- emit_signal("ramp_changed");
-
- update();
- }
-}
-
-void GraphColorRampEdit::_notification(int p_what){
-
- if (p_what==NOTIFICATION_ENTER_TREE) {
- if (!picker->is_connected("color_changed",this,"_color_changed")) {
- picker->connect("color_changed",this,"_color_changed");
- }
- }
- if (p_what==NOTIFICATION_DRAW) {
-
-
- Point prev;
- prev.offset=0;
- prev.color=Color(0,0,0);
-
- int h = get_size().y;
- int total_w = get_size().width-get_size().height-3;
-
- for(int i=-1;i<points.size();i++) {
-
- Point next;
- if (i+1==points.size()) {
- next.color=Color(1,1,1);
- next.offset=1;
- } else {
- next=points[i+1];
- }
-
- if (prev.offset==next.offset) {
- prev=next;
- continue;
- }
-
- Vector<Vector2> points;
- Vector<Color> colors;
- points.push_back(Vector2(prev.offset*total_w,h));
- points.push_back(Vector2(prev.offset*total_w,0));
- points.push_back(Vector2(next.offset*total_w,0));
- points.push_back(Vector2(next.offset*total_w,h));
- colors.push_back(prev.color);
- colors.push_back(prev.color);
- colors.push_back(next.color);
- colors.push_back(next.color);
- draw_primitive(points,colors,Vector<Point2>());
- prev=next;
- }
-
- for(int i=0;i<points.size();i++) {
-
- Color col=i==grabbed?Color(1,0.0,0.0,0.9):Color(1,1,1,0.8);
-
- draw_line(Vector2(points[i].offset*total_w,0),Vector2(points[i].offset*total_w,h-1),Color(0,0,0,0.7));
- draw_line(Vector2(points[i].offset*total_w-1,h/2),Vector2(points[i].offset*total_w-1,h-1),col);
- draw_line(Vector2(points[i].offset*total_w+1,h/2),Vector2(points[i].offset*total_w+1,h-1),col);
- draw_line(Vector2(points[i].offset*total_w-1,h/2),Vector2(points[i].offset*total_w+1,h/2),col);
- draw_line(Vector2(points[i].offset*total_w-1,h-1),Vector2(points[i].offset*total_w+1,h-1),col);
-
- }
-
- if (grabbed!=-1) {
-
- draw_rect(Rect2(total_w+3,0,h,h),points[grabbed].color);
- }
-
- if (has_focus()) {
-
- draw_line(Vector2(-1,-1),Vector2(total_w+1,-1),Color(1,1,1,0.6));
- draw_line(Vector2(total_w+1,-1),Vector2(total_w+1,h+1),Color(1,1,1,0.6));
- draw_line(Vector2(total_w+1,h+1),Vector2(-1,h+1),Color(1,1,1,0.6));
- draw_line(Vector2(-1,-1),Vector2(-1,h+1),Color(1,1,1,0.6));
- }
-
- }
-}
-
-Size2 GraphColorRampEdit::get_minimum_size() const {
-
- return Vector2(0,16);
-}
-
-
-void GraphColorRampEdit::_color_changed(const Color& p_color) {
-
- if (grabbed==-1)
- return;
- points[grabbed].color=p_color;
- update();
- emit_signal("ramp_changed");
-
-}
-
-void GraphColorRampEdit::set_ramp(const Vector<float>& p_offsets,const Vector<Color>& p_colors) {
-
- ERR_FAIL_COND(p_offsets.size()!=p_colors.size());
- points.clear();
- for(int i=0;i<p_offsets.size();i++) {
- Point p;
- p.offset=p_offsets[i];
- p.color=p_colors[i];
- points.push_back(p);
- }
-
- points.sort();
- update();
-}
-
-Vector<float> GraphColorRampEdit::get_offsets() const{
- Vector<float> ret;
- for(int i=0;i<points.size();i++)
- ret.push_back(points[i].offset);
- return ret;
-}
-Vector<Color> GraphColorRampEdit::get_colors() const{
-
- Vector<Color> ret;
- for(int i=0;i<points.size();i++)
- ret.push_back(points[i].color);
- return ret;
-}
-
-
-void GraphColorRampEdit::_bind_methods(){
-
- ClassDB::bind_method(D_METHOD("_gui_input"),&GraphColorRampEdit::_gui_input);
- ClassDB::bind_method(D_METHOD("_color_changed"),&GraphColorRampEdit::_color_changed);
- ADD_SIGNAL(MethodInfo("ramp_changed"));
-}
-
-GraphColorRampEdit::GraphColorRampEdit(){
-
- grabbed=-1;
- grabbing=false;
- set_focus_mode(FOCUS_ALL);
-
- popup = memnew( PopupPanel );
- picker = memnew( ColorPicker );
- popup->add_child(picker);
- /popup->set_child_rect(picker);
- add_child(popup);
-
-}
-////////////
-
-void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
-
- if (p_event.type==InputEvent::KEY && p_event->is_pressed() && p_event->get_scancode()==KEY_DELETE && grabbed!=-1) {
-
- points.remove(grabbed);
- grabbed=-1;
- update();
- emit_signal("curve_changed");
- accept_event();
- }
-
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) {
-
- update();
- Point2 p = Vector2(p_event->get_position().x,p_event->get_position().y)/get_size();
- p.y=1.0-p.y;
- grabbed=-1;
- grabbing=true;
-
- for(int i=0;i<points.size();i++) {
-
- Vector2 ps = p*get_size();
- Vector2 pt = Vector2(points[i].offset,points[i].height)*get_size();
- if (ps.distance_to(pt)<4) {
- grabbed=i;
- }
-
- }
-
-
- //grab or select
- if (grabbed!=-1) {
- return;
- }
- //insert
-
-
- Point np;
- np.offset=p.x;
- np.height=p.y;
-
- points.push_back(np);
- points.sort();
- for(int i=0;i<points.size();i++) {
- if (points[i].offset==p.x && points[i].height==p.y) {
- grabbed=i;
- break;
- }
- }
-
- emit_signal("curve_changed");
-
- }
-
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && !p_event->is_pressed()) {
-
- if (grabbing) {
- grabbing=false;
- emit_signal("curve_changed");
- }
- update();
- }
-
- if (p_event.type==InputEvent::MOUSE_MOTION && grabbing && grabbed != -1) {
-
- Point2 p = Vector2(p_event->get_position().x,p_event->get_position().y)/get_size();
- p.y=1.0-p.y;
-
- p.x = CLAMP(p.x,0.0,1.0);
- p.y = CLAMP(p.y,0.0,1.0);
-
- bool valid=true;
-
- for(int i=0;i<points.size();i++) {
-
- if (points[i].offset==p.x && points[i].height==p.y && i!=grabbed) {
- valid=false;
- }
- }
-
- if (!valid)
- return;
-
- points[grabbed].offset=p.x;
- points[grabbed].height=p.y;
-
- points.sort();
- for(int i=0;i<points.size();i++) {
- if (points[i].offset==p.x && points[i].height==p.y) {
- grabbed=i;
- break;
- }
- }
-
- emit_signal("curve_changed");
-
- update();
- }
-}
-
-void GraphCurveMapEdit::_plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d) {
-
- float geometry[4][4];
- float tmp1[4][4];
- float tmp2[4][4];
- float deltas[4][4];
- double x, dx, dx2, dx3;
- double y, dy, dy2, dy3;
- double d, d2, d3;
- int lastx, lasty;
- int newx, newy;
- int ntimes;
- int i,j;
-
- int xmax=get_size().x;
- int ymax=get_size().y;
-
- /* construct the geometry matrix from the segment */
- for (i = 0; i < 4; i++) {
- geometry[i][2] = 0;
- geometry[i][3] = 0;
- }
-
- geometry[0][0] = (p_a[0] * xmax);
- geometry[1][0] = (p_b[0] * xmax);
- geometry[2][0] = (p_c[0] * xmax);
- geometry[3][0] = (p_d[0] * xmax);
-
- geometry[0][1] = (p_a[1] * ymax);
- geometry[1][1] = (p_b[1] * ymax);
- geometry[2][1] = (p_c[1] * ymax);
- geometry[3][1] = (p_d[1] * ymax);
-
- /* subdivide the curve ntimes (1000) times */
- ntimes = 4 * xmax;
- /* ntimes can be adjusted to give a finer or coarser curve */
- d = 1.0 / ntimes;
- d2 = d * d;
- d3 = d * d * d;
-
- /* construct a temporary matrix for determining the forward differencing deltas */
- tmp2[0][0] = 0; tmp2[0][1] = 0; tmp2[0][2] = 0; tmp2[0][3] = 1;
- tmp2[1][0] = d3; tmp2[1][1] = d2; tmp2[1][2] = d; tmp2[1][3] = 0;
- tmp2[2][0] = 6*d3; tmp2[2][1] = 2*d2; tmp2[2][2] = 0; tmp2[2][3] = 0;
- tmp2[3][0] = 6*d3; tmp2[3][1] = 0; tmp2[3][2] = 0; tmp2[3][3] = 0;
-
- /* compose the basis and geometry matrices */
-
- static const float CR_basis[4][4] = {
- { -0.5, 1.5, -1.5, 0.5 },
- { 1.0, -2.5, 2.0, -0.5 },
- { -0.5, 0.0, 0.5, 0.0 },
- { 0.0, 1.0, 0.0, 0.0 },
- };
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- tmp1[i][j] = (CR_basis[i][0] * geometry[0][j] +
- CR_basis[i][1] * geometry[1][j] +
- CR_basis[i][2] * geometry[2][j] +
- CR_basis[i][3] * geometry[3][j]);
- }
- }
- /* compose the above results to get the deltas matrix */
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- deltas[i][j] = (tmp2[i][0] * tmp1[0][j] +
- tmp2[i][1] * tmp1[1][j] +
- tmp2[i][2] * tmp1[2][j] +
- tmp2[i][3] * tmp1[3][j]);
- }
- }
-
-
- /* extract the x deltas */
- x = deltas[0][0];
- dx = deltas[1][0];
- dx2 = deltas[2][0];
- dx3 = deltas[3][0];
-
- /* extract the y deltas */
- y = deltas[0][1];
- dy = deltas[1][1];
- dy2 = deltas[2][1];
- dy3 = deltas[3][1];
-
-
- lastx = CLAMP (x, 0, xmax);
- lasty = CLAMP (y, 0, ymax);
-
- /* if (fix255)
- {
- cd->curve[cd->outline][lastx] = lasty;
- }
- else
- {
- cd->curve_ptr[cd->outline][lastx] = lasty;
- if(gb_debug) printf("bender_plot_curve xmax:%d ymax:%d\n", (int)xmax, (int)ymax);
- }
-*/
- /* loop over the curve */
- for (i = 0; i < ntimes; i++)
- {
- /* increment the x values */
- x += dx;
- dx += dx2;
- dx2 += dx3;
-
- /* increment the y values */
- y += dy;
- dy += dy2;
- dy2 += dy3;
-
- newx = CLAMP ((Math::round (x)), 0, xmax);
- newy = CLAMP ((Math::round (y)), 0, ymax);
-
- /* if this point is different than the last one...then draw it */
- if ((lastx != newx) || (lasty != newy)) {
- draw_line(Vector2(lastx,ymax-lasty),Vector2(newx,ymax-newy),Color(0.8,0.8,0.8,0.8),2.0);
- }
-
- lastx = newx;
- lasty = newy;
- }
-}
-
-
-void GraphCurveMapEdit::_notification(int p_what){
-
- if (p_what==NOTIFICATION_DRAW) {
-
- draw_style_box(get_stylebox("bg","Tree"),Rect2(Point2(),get_size()));
-
- int w = get_size().x;
- int h = get_size().y;
-
- Vector2 prev=Vector2(0,0);
- Vector2 prev2=Vector2(0,0);
-
- for(int i=-1;i<points.size();i++) {
-
- Vector2 next;
- Vector2 next2;
- if (i+1>=points.size()) {
- next=Vector2(1,1);
- } else {
- next=Vector2(points[i+1].offset,points[i+1].height);
- }
-
- if (i+2>=points.size()) {
- next2=Vector2(1,1);
- } else {
- next2=Vector2(points[i+2].offset,points[i+2].height);
- }
-
- /*if (i==-1 && prev.offset==next.offset) {
- prev=next;
- continue;
- }*/
-
- _plot_curve(prev2,prev,next,next2);
-
- prev2=prev;
- prev=next;
- }
-
- for(int i=0;i<points.size();i++) {
-
- Color col=i==grabbed?Color(1,0.0,0.0,0.9):Color(1,1,1,0.8);
-
-
- draw_rect(Rect2( Vector2(points[i].offset,1.0-points[i].height)*get_size()-Vector2(2,2),Vector2(5,5)),col);
- }
-
- /* if (grabbed!=-1) {
-
- draw_rect(Rect2(total_w+3,0,h,h),points[grabbed].color);
- }
-*/
- if (has_focus()) {
-
- draw_line(Vector2(-1,-1),Vector2(w+1,-1),Color(1,1,1,0.6));
- draw_line(Vector2(w+1,-1),Vector2(w+1,h+1),Color(1,1,1,0.6));
- draw_line(Vector2(w+1,h+1),Vector2(-1,h+1),Color(1,1,1,0.6));
- draw_line(Vector2(-1,-1),Vector2(-1,h+1),Color(1,1,1,0.6));
- }
-
- }
-}
-
-Size2 GraphCurveMapEdit::get_minimum_size() const {
-
- return Vector2(64,64);
-}
-
-
-
-void GraphCurveMapEdit::set_points(const Vector<Vector2>& p_points) {
-
-
- points.clear();
- for(int i=0;i<p_points.size();i++) {
- Point p;
- p.offset=p_points[i].x;
- p.height=p_points[i].y;
- points.push_back(p);
- }
-
- points.sort();
- update();
-}
-
-Vector<Vector2> GraphCurveMapEdit::get_points() const {
- Vector<Vector2> ret;
- for(int i=0;i<points.size();i++)
- ret.push_back(Vector2(points[i].offset,points[i].height));
- return ret;
-}
-
-void GraphCurveMapEdit::_bind_methods(){
-
- ClassDB::bind_method(D_METHOD("_gui_input"),&GraphCurveMapEdit::_gui_input);
- ADD_SIGNAL(MethodInfo("curve_changed"));
-}
-
-GraphCurveMapEdit::GraphCurveMapEdit(){
-
- grabbed=-1;
- grabbing=false;
- set_focus_mode(FOCUS_ALL);
-
-}
-
-
-////cbacks
-///
-void ShaderGraphView::_scalar_const_changed(double p_value,int p_id) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Scalar Constant"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"scalar_const_node_set_value",type,p_id,p_value);
- ur->add_undo_method(graph.ptr(),"scalar_const_node_set_value",type,p_id,graph->scalar_const_node_get_value(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-
-void ShaderGraphView::_vec_const_changed(double p_value, int p_id,Array p_arr){
-
- Vector3 val;
- for(int i=0;i<p_arr.size();i++) {
- val[i]=p_arr[i].call("get_val");
- }
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Vec Constant"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"vec_const_node_set_value",type,p_id,val);
- ur->add_undo_method(graph.ptr(),"vec_const_node_set_value",type,p_id,graph->vec_const_node_get_value(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_rgb_const_changed(const Color& p_color, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change RGB Constant"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"rgb_const_node_set_value",type,p_id,p_color);
- ur->add_undo_method(graph.ptr(),"rgb_const_node_set_value",type,p_id,graph->rgb_const_node_get_value(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_scalar_op_changed(int p_op, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Scalar Operator"));
- ur->add_do_method(graph.ptr(),"scalar_op_node_set_op",type,p_id,p_op);
- ur->add_undo_method(graph.ptr(),"scalar_op_node_set_op",type,p_id,graph->scalar_op_node_get_op(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_vec_op_changed(int p_op, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Vec Operator"));
- ur->add_do_method(graph.ptr(),"vec_op_node_set_op",type,p_id,p_op);
- ur->add_undo_method(graph.ptr(),"vec_op_node_set_op",type,p_id,graph->vec_op_node_get_op(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-void ShaderGraphView::_vec_scalar_op_changed(int p_op, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Vec Scalar Operator"));
- ur->add_do_method(graph.ptr(),"vec_scalar_op_node_set_op",type,p_id,p_op);
- ur->add_undo_method(graph.ptr(),"vec_scalar_op_node_set_op",type,p_id,graph->vec_scalar_op_node_get_op(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_rgb_op_changed(int p_op, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change RGB Operator"));
- ur->add_do_method(graph.ptr(),"rgb_op_node_set_op",type,p_id,p_op);
- ur->add_undo_method(graph.ptr(),"rgb_op_node_set_op",type,p_id,graph->rgb_op_node_get_op(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-void ShaderGraphView::_xform_inv_rev_changed(bool p_enabled, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Toggle Rot Only"));
- ur->add_do_method(graph.ptr(),"xform_vec_mult_node_set_no_translation",type,p_id,p_enabled);
- ur->add_undo_method(graph.ptr(),"xform_vec_mult_node_set_no_translation",type,p_id,graph->xform_vec_mult_node_get_no_translation(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-void ShaderGraphView::_scalar_func_changed(int p_func, int p_id){
-
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Scalar Function"));
- ur->add_do_method(graph.ptr(),"scalar_func_node_set_function",type,p_id,p_func);
- ur->add_undo_method(graph.ptr(),"scalar_func_node_set_function",type,p_id,graph->scalar_func_node_get_function(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-void ShaderGraphView::_vec_func_changed(int p_func, int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Vec Function"));
- ur->add_do_method(graph.ptr(),"vec_func_node_set_function",type,p_id,p_func);
- ur->add_undo_method(graph.ptr(),"vec_func_node_set_function",type,p_id,graph->vec_func_node_get_function(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_scalar_input_changed(double p_value,int p_id){
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Scalar Uniform"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"scalar_input_node_set_value",type,p_id,p_value);
- ur->add_undo_method(graph.ptr(),"scalar_input_node_set_value",type,p_id,graph->scalar_input_node_get_value(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_vec_input_changed(double p_value, int p_id,Array p_arr){
-
- Vector3 val;
- for(int i=0;i<p_arr.size();i++) {
- val[i]=p_arr[i].call("get_val");
- }
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Vec Uniform"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"vec_input_node_set_value",type,p_id,val);
- ur->add_undo_method(graph.ptr(),"vec_input_node_set_value",type,p_id,graph->vec_input_node_get_value(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-void ShaderGraphView::_xform_input_changed(int p_id, Node *p_button){
-
-
- ToolButton *tb = Object::cast_to<ToolButton>(p_button);
- ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height));
- ped_popup->set_size(tb->get_size());
- edited_id=p_id;
- edited_def=-1;
- ped_popup->edit(NULL,"",Variant::TRANSFORM,graph->xform_input_node_get_value(type,p_id),PROPERTY_HINT_NONE,"");
- ped_popup->popup();
-
-}
-void ShaderGraphView::_xform_const_changed(int p_id, Node *p_button){
-
- ToolButton *tb = Object::cast_to<ToolButton>(p_button);
- ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height));
- ped_popup->set_size(tb->get_size());
- edited_id=p_id;
- edited_def=-1;
- ped_popup->edit(NULL,"",Variant::TRANSFORM,graph->xform_const_node_get_value(type,p_id),PROPERTY_HINT_NONE,"");
- ped_popup->popup();
-
-}
-
-void ShaderGraphView::_rgb_input_changed(const Color& p_color, int p_id){
-
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change RGB Uniform"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"rgb_input_node_set_value",type,p_id,p_color);
- ur->add_undo_method(graph.ptr(),"rgb_input_node_set_value",type,p_id,graph->rgb_input_node_get_value(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-void ShaderGraphView::_tex_input_change(int p_id, Node *p_button){
-
-
-}
-void ShaderGraphView::_cube_input_change(int p_id){
-
-
-}
-
-void ShaderGraphView::_variant_edited() {
-
- if (edited_def != -1) {
-
- Variant v = ped_popup->get_variant();
- Variant v2 = graph->default_get_value(type,edited_id,edited_def);
- if (v2.get_type() == Variant::NIL)
- switch (v.get_type()) {
- case Variant::VECTOR3:
- v2=Vector3();
- break;
- case Variant::REAL:
- v2=0.0;
- break;
- case Variant::TRANSFORM:
- v2=Transform();
- break;
- case Variant::COLOR:
- v2=Color();
- break;
- default: {}
- }
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Default Value"));
- ur->add_do_method(graph.ptr(),"default_set_value",type,edited_id,edited_def, v);
- ur->add_undo_method(graph.ptr(),"default_set_value",type,edited_id,edited_def, v2);
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
- return;
- }
-
- if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_XFORM_CONST) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change XForm Uniform"));
- ur->add_do_method(graph.ptr(),"xform_const_node_set_value",type,edited_id,ped_popup->get_variant());
- ur->add_undo_method(graph.ptr(),"xform_const_node_set_value",type,edited_id,graph->xform_const_node_get_value(type,edited_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
- }
-
-
- if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_XFORM_INPUT) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change XForm Uniform"));
- ur->add_do_method(graph.ptr(),"xform_input_node_set_value",type,edited_id,ped_popup->get_variant());
- ur->add_undo_method(graph.ptr(),"xform_input_node_set_value",type,edited_id,graph->xform_input_node_get_value(type,edited_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
- }
-
- if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_TEXTURE_INPUT) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Texture Uniform"));
- ur->add_do_method(graph.ptr(),"texture_input_node_set_value",type,edited_id,ped_popup->get_variant());
- ur->add_undo_method(graph.ptr(),"texture_input_node_set_value",type,edited_id,graph->texture_input_node_get_value(type,edited_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
- }
-
- if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_CUBEMAP_INPUT) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Cubemap Uniform"));
- ur->add_do_method(graph.ptr(),"cubemap_input_node_set_value",type,edited_id,ped_popup->get_variant());
- ur->add_undo_method(graph.ptr(),"cubemap_input_node_set_value",type,edited_id,graph->cubemap_input_node_get_value(type,edited_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
- }
-
-}
-
-void ShaderGraphView::_comment_edited(int p_id,Node* p_button) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- TextEdit *te=Object::cast_to<TextEdit>(p_button);
- ur->create_action(TTR("Change Comment"),UndoRedo::MERGE_ENDS);
- ur->add_do_method(graph.ptr(),"comment_node_set_text",type,p_id,te->get_text());
- ur->add_undo_method(graph.ptr(),"comment_node_set_text",type,p_id,graph->comment_node_get_text(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-
-}
-
-void ShaderGraphView::_color_ramp_changed(int p_id,Node* p_ramp) {
-
- GraphColorRampEdit *cr=Object::cast_to<GraphColorRampEdit>(p_ramp);
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
-
-
- Vector<float> offsets=cr->get_offsets();
- Vector<Color> colors=cr->get_colors();
-
- PoolVector<float> new_offsets;
- PoolVector<Color> new_colors;
- {
- new_offsets.resize(offsets.size());
- new_colors.resize(colors.size());
- PoolVector<float>::Write ow=new_offsets.write();
- PoolVector<Color>::Write cw=new_colors.write();
- for(int i=0;i<new_offsets.size();i++) {
- ow[i]=offsets[i];
- cw[i]=colors[i];
- }
-
- }
-
-
- PoolVector<float> old_offsets=graph->color_ramp_node_get_offsets(type,p_id);
- PoolVector<Color> old_colors=graph->color_ramp_node_get_colors(type,p_id);
-
- if (old_offsets.size()!=new_offsets.size())
- ur->create_action(TTR("Add/Remove to Color Ramp"));
- else
- ur->create_action(TTR("Modify Color Ramp"),UndoRedo::MERGE_ENDS);
-
- ur->add_do_method(graph.ptr(),"color_ramp_node_set_ramp",type,p_id,new_colors,new_offsets);
- ur->add_undo_method(graph.ptr(),"color_ramp_node_set_ramp",type,p_id,old_colors,old_offsets);
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-
-void ShaderGraphView::_curve_changed(int p_id,Node* p_curve) {
-
- GraphCurveMapEdit *cr=Object::cast_to<GraphCurveMapEdit>(p_curve);
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
-
-
- Vector<Point2> points=cr->get_points();
-
- PoolVector<Vector2> new_points;
- {
- new_points.resize(points.size());
- PoolVector<Vector2>::Write ow=new_points.write();
- for(int i=0;i<new_points.size();i++) {
- ow[i]=points[i];
- }
-
- }
-
-
- PoolVector<Vector2> old_points=graph->curve_map_node_get_points(type,p_id);
-
- if (old_points.size()!=new_points.size())
- ur->create_action(TTR("Add/Remove to Curve Map"));
- else
- ur->create_action(TTR("Modify Curve Map"),UndoRedo::MERGE_ENDS);
-
- ur->add_do_method(graph.ptr(),"curve_map_node_set_points",type,p_id,new_points);
- ur->add_undo_method(graph.ptr(),"curve_map_node_set_points",type,p_id,old_points);
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
-}
-
-
-void ShaderGraphView::_input_name_changed(const String& p_name, int p_id, Node *p_line_edit) {
-
- LineEdit *le=Object::cast_to<LineEdit>(p_line_edit);
- ERR_FAIL_COND(!le);
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Input Name"));
- ur->add_do_method(graph.ptr(),"input_node_set_name",type,p_id,p_name);
- ur->add_undo_method(graph.ptr(),"input_node_set_name",type,p_id,graph->input_node_get_name(type,p_id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- block_update=true;
- ur->commit_action();
- block_update=false;
- le->set_text(graph->input_node_get_name(type,p_id));
-}
-
-void ShaderGraphView::_tex_edited(int p_id,Node* p_button) {
-
- ToolButton *tb = Object::cast_to<ToolButton>(p_button);
- ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height));
- ped_popup->set_size(tb->get_size());
- edited_id=p_id;
- edited_def=-1;
- ped_popup->edit(NULL,"",Variant::OBJECT,graph->texture_input_node_get_value(type,p_id),PROPERTY_HINT_RESOURCE_TYPE,"Texture");
-}
-
-void ShaderGraphView::_cube_edited(int p_id,Node* p_button) {
-
- ToolButton *tb = Object::cast_to<ToolButton>(p_button);
- ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height));
- ped_popup->set_size(tb->get_size());
- edited_id=p_id;
- edited_def=-1;
- ped_popup->edit(NULL,"",Variant::OBJECT,graph->cubemap_input_node_get_value(type,p_id),PROPERTY_HINT_RESOURCE_TYPE,"CubeMap");
-}
-
-
-//////////////view/////////////
-
-
-void ShaderGraphView::_connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
-
- int from_idx=-1;
- int to_idx=-1;
- for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) {
-
- if (p_from==E->get()->get_name())
- from_idx=E->key();
- if (p_to==E->get()->get_name())
- to_idx=E->key();
- }
-
- ERR_FAIL_COND(from_idx==-1);
- ERR_FAIL_COND(to_idx==-1);
-
- ur->create_action(TTR("Connect Graph Nodes"));
-
- List<ShaderGraph::Connection> conns;
-
- graph->get_node_connections(type,&conns);
- //disconnect/reconnect dependencies
- ur->add_undo_method(graph.ptr(),"disconnect_node",type,from_idx,p_from_slot,to_idx,p_to_slot);
- for(List<ShaderGraph::Connection>::Element *E=conns.front();E;E=E->next()) {
-
- if (E->get().dst_id==to_idx && E->get().dst_slot==p_to_slot) {
- ur->add_do_method(graph.ptr(),"disconnect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot);
- ur->add_undo_method(graph.ptr(),"connect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot);
- }
- }
- ur->add_do_method(graph.ptr(),"connect_node",type,from_idx,p_from_slot,to_idx,p_to_slot);
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
-
-
-}
-
-void ShaderGraphView::_disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
-
- int from_idx=-1;
- int to_idx=-1;
- for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) {
-
- if (p_from==E->get()->get_name())
- from_idx=E->key();
- if (p_to==E->get()->get_name())
- to_idx=E->key();
- }
-
- ERR_FAIL_COND(from_idx==-1);
- ERR_FAIL_COND(to_idx==-1);
-
- if (!graph->is_node_connected(type,from_idx,p_from_slot,to_idx,p_to_slot))
- return; //nothing to disconnect
-
- ur->create_action(TTR("Disconnect Graph Nodes"));
-
- List<ShaderGraph::Connection> conns;
-
- graph->get_node_connections(type,&conns);
- //disconnect/reconnect dependencies
- ur->add_do_method(graph.ptr(),"disconnect_node",type,from_idx,p_from_slot,to_idx,p_to_slot);
- ur->add_undo_method(graph.ptr(),"connect_node",type,from_idx,p_from_slot,to_idx,p_to_slot);
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
-
-
-}
-
-void ShaderGraphView::_node_removed(int p_id) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Remove Shader Graph Node"));
-
- ur->add_do_method(graph.ptr(),"node_remove",type,p_id);
- ur->add_undo_method(graph.ptr(),"node_add",type,graph->node_get_type(type,p_id),p_id);
- ur->add_undo_method(graph.ptr(),"node_set_state",type,p_id,graph->node_get_state(type,p_id));
- List<ShaderGraph::Connection> conns;
-
- graph->get_node_connections(type,&conns);
- for(List<ShaderGraph::Connection>::Element *E=conns.front();E;E=E->next()) {
-
- if (E->get().dst_id==p_id || E->get().src_id==p_id) {
- ur->add_undo_method(graph.ptr(),"connect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot);
- }
- }
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
-
-}
-
-void ShaderGraphView::_begin_node_move()
-{
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Move Shader Graph Node"));
-}
-
-void ShaderGraphView::_node_moved(const Vector2& p_from, const Vector2& p_to,int p_id) {
-
-
- ERR_FAIL_COND(!node_map.has(p_id));
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->add_do_method(this,"_move_node",p_id,p_to);
- ur->add_undo_method(this,"_move_node",p_id,p_from);
-}
-
-void ShaderGraphView::_end_node_move()
-{
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->commit_action();
-}
-
-void ShaderGraphView::_move_node(int p_id,const Vector2& p_to) {
-
- ERR_FAIL_COND(!node_map.has(p_id));
- node_map[p_id]->set_offset(p_to);
- graph->node_set_position(type,p_id,p_to);
-}
-
-void ShaderGraphView::_duplicate_nodes_request()
-{
- Array s_id;
-
- for(Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) {
- ShaderGraph::NodeType t=graph->node_get_type(type, E->key());
- if (t==ShaderGraph::NODE_OUTPUT || t==ShaderGraph::NODE_INPUT)
- continue;
- GraphNode *gn = E->get();
- if (gn && gn->is_selected())
- s_id.push_back(E->key());
- }
-
- if (s_id.size()==0)
- return;
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Duplicate Graph Node(s)"));
- ur->add_do_method(this,"_duplicate_nodes",s_id);
- List<int> n_ids = graph->generate_ids(type, s_id.size());
- for (List<int>::Element *E=n_ids.front();E;E=E->next())
- ur->add_undo_method(graph.ptr(),"node_remove",type,E->get());
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
-
-}
-
-void ShaderGraphView::_duplicate_nodes(const Array &p_nodes)
-{
- List<int> n = List<int>();
- for (int i=0; i<p_nodes.size();i++)
- n.push_back(p_nodes.get(i));
- graph->duplicate_nodes(type, n);
- call_deferred("_update_graph");
-}
-
-void ShaderGraphView::_delete_nodes_request()
-{
- List<int> s_id=List<int>();
-
- for(Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) {
- ShaderGraph::NodeType t=graph->node_get_type(type, E->key());
- if (t==ShaderGraph::NODE_OUTPUT)
- continue;
- GraphNode *gn = E->get();
- if (gn && gn->is_selected())
- s_id.push_back(E->key());
- }
-
- if (s_id.size()==0)
- return;
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Delete Shader Graph Node(s)"));
-
- for (List<int>::Element *N=s_id.front();N;N=N->next()) {
- ur->add_do_method(graph.ptr(),"node_remove",type,N->get());
- ur->add_undo_method(graph.ptr(),"node_add",type,graph->node_get_type(type,N->get()),N->get());
- ur->add_undo_method(graph.ptr(),"node_set_state",type,N->get(),graph->node_get_state(type,N->get()));
- List<ShaderGraph::Connection> conns;
-
- graph->get_node_connections(type,&conns);
- for(List<ShaderGraph::Connection>::Element *E=conns.front();E;E=E->next()) {
-
- if (E->get().dst_id==N->get() || E->get().src_id==N->get()) {
- ur->add_undo_method(graph.ptr(),"connect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot);
- }
- }
- }
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
-
-}
-
-void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, int v_type, String p_hint)
-{
- ToolButton *tb = Object::cast_to<ToolButton>(p_button);
- ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height));
- ped_popup->set_size(tb->get_size());
- edited_id=p_id;
- edited_def=p_param;
- Variant::Type vt = (Variant::Type)v_type;
- Variant v = graph->default_get_value(type,p_id,edited_def);
- int h=PROPERTY_HINT_NONE;
- if (v.get_type() == Variant::NIL)
- switch (vt) {
- case Variant::VECTOR3:
- v=Vector3();
- break;
- case Variant::REAL:
- h=PROPERTY_HINT_RANGE;
- v=0.0;
- break;
- case Variant::TRANSFORM:
- v=Transform();
- break;
- case Variant::COLOR:
- h=PROPERTY_HINT_COLOR_NO_ALPHA;
- v=Color();
- break;
- default: {}
- }
-
- ped_popup->edit(NULL,"",vt,v,h,p_hint);
-
- ped_popup->popup();
-}
-
-ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) {
- ToolButton *l = memnew( ToolButton );
- l->set_text(text);
- l->set_text_align(ToolButton::ALIGN_LEFT);
- l->add_style_override("hover", l->get_stylebox("normal", "ToolButton"));
- l->add_style_override("pressed", l->get_stylebox("normal", "ToolButton"));
- l->add_style_override("focus", l->get_stylebox("normal", "ToolButton"));
- switch (v_type) {
- case Variant::REAL:
- l->set_icon(ped_popup->get_icon("Real", "EditorIcons"));
- break;
- case Variant::VECTOR3:
- l->set_icon(ped_popup->get_icon("Vector", "EditorIcons"));
- break;
- case Variant::TRANSFORM:
- l->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
- break;
- case Variant::COLOR:
- l->set_icon(ped_popup->get_icon("Color", "EditorIcons"));
- break;
- default: {}
- }
- return l;
-}
-
-ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int param,Variant::Type v_type, String p_hint) {
- ToolButton *edit = memnew( ToolButton );
- edit->set_text(text);
- edit->set_text_align(ToolButton::ALIGN_LEFT);
- edit->set_flat(false);
- edit->add_style_override("normal", gn->get_stylebox("defaultframe", "GraphNode"));
- edit->add_style_override("hover", gn->get_stylebox("defaultframe", "GraphNode"));
- edit->add_style_override("pressed", gn->get_stylebox("defaultframe", "GraphNode"));
- edit->add_style_override("focus", gn->get_stylebox("defaultfocus", "GraphNode"));
- edit->connect("pressed",this,"_default_changed",varray(p_id,edit,param,v_type,p_hint));
-
- switch (v_type) {
- case Variant::REAL:
- edit->set_icon(ped_popup->get_icon("Real", "EditorIcons"));
- break;
- case Variant::VECTOR3:
- edit->set_icon(ped_popup->get_icon("Vector", "EditorIcons"));
- break;
- case Variant::TRANSFORM:
- edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
- break;
- case Variant::COLOR: {
- Image icon_color = Image(15,15,false,Image::FORMAT_RGB8);
- Color c = graph->default_get_value(type,p_id,param);
- for (int x=1;x<14;x++)
- for (int y=1;y<14;y++)
- icon_color.set_pixel(x,y,c);
- Ref<ImageTexture> t;
- t.instance();
- t->create_from_image(icon_color);
- edit->set_icon(t);
- } break;
- default: {}
- }
- return edit;
-}
-
-void ShaderGraphView::_create_node(int p_id) {
-
-
- GraphNode *gn = memnew( GraphNode );
- gn->set_show_close_button(true);
- Color typecol[4]={
- Color(0.9,0.4,1),
- Color(0.8,1,0.2),
- Color(1,0.2,0.2),
- Color(0,1,1)
- };
-
- const String hint_spin = "-65536,65535,0.001";
- const String hint_slider = "0.0,1.0,0.01,slider";
-
-
- switch(graph->node_get_type(type,p_id)) {
-
- case ShaderGraph::NODE_INPUT: {
-
- gn->set_title("Input");
-
- List<ShaderGraph::SlotInfo> si;
- ShaderGraph::get_input_output_node_slot_info(graph->get_mode(),type,&si);
-
- int idx=0;
- for (List<ShaderGraph::SlotInfo>::Element *E=si.front();E;E=E->next()) {
- ShaderGraph::SlotInfo& s=E->get();
- if (s.dir==ShaderGraph::SLOT_IN) {
-
- Label *l= memnew( Label );
- l->set_text(s.name);
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
- gn->set_slot(idx,false,0,Color(),true,s.type,typecol[s.type]);
- idx++;
- }
- }
-
- } break; // all inputs (case Shader type dependent)
- case ShaderGraph::NODE_SCALAR_CONST: {
- gn->set_title("Scalar");
- SpinBox *sb = memnew( SpinBox );
- sb->set_min(-100000);
- sb->set_max(100000);
- sb->set_step(0.001);
- sb->set_val(graph->scalar_const_node_get_value(type,p_id));
- sb->connect("value_changed",this,"_scalar_const_changed",varray(p_id));
- gn->add_child(sb);
- gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; //scalar constant
- case ShaderGraph::NODE_VEC_CONST: {
-
- gn->set_title("Vector");
- Array v3p(true);
- for(int i=0;i<3;i++) {
- HBoxContainer *hbc = memnew( HBoxContainer );
- Label *l = memnew( Label );
- l->set_text(String::chr('X'+i));
- hbc->add_child(l);
- SpinBox *sb = memnew( SpinBox );
- sb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- sb->set_min(-100000);
- sb->set_max(100000);
- sb->set_step(0.001);
- sb->set_val(graph->vec_const_node_get_value(type,p_id)[i]);
- sb->connect("value_changed",this,"_vec_const_changed",varray(p_id,v3p));
- v3p.push_back(sb);
- hbc->add_child(sb);
- gn->add_child(hbc);
- }
- gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
-
- } break; //vec3 constant
- case ShaderGraph::NODE_RGB_CONST: {
-
- gn->set_title("Color");
- ColorPickerButton *cpb = memnew( ColorPickerButton );
- cpb->set_color(graph->rgb_const_node_get_value(type,p_id));
- cpb->connect("color_changed",this,"_rgb_const_changed",varray(p_id));
- gn->add_child(cpb);
- Label *l = memnew( Label );
- l->set_text("RGB");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
- l = memnew( Label );
- l->set_text("Alpha");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
-
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; //rgb constant (shows a color picker instead)
- case ShaderGraph::NODE_XFORM_CONST: {
- gn->set_title("XForm");
- ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit...");
- edit->connect("pressed",this,"_xform_const_changed",varray(p_id,edit));
- gn->add_child(edit);
- gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]);
-
- } break; // 4x4 matrix constant
- case ShaderGraph::NODE_TIME: {
-
- gn->set_title("Time");
- Label *l = memnew( Label );
- l->set_text("(s)");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
- gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; // time in seconds
- case ShaderGraph::NODE_SCREEN_TEX: {
-
- gn->set_title("ScreenTex");
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (!graph->is_slot_connected(type,p_id,0)) {
- Vector3 v = graph->default_get_value(type, p_id, 0);
- hbc->add_child(make_editor("UV: " + v,gn,p_id,0,Variant::VECTOR3));
- } else {
- hbc->add_child(make_label("UV",Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("RGB")));
- gn->add_child(hbc);
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
-
- } break; // screen texture sampler (takes UV) (only usable in fragment case Shader)
- case ShaderGraph::NODE_SCALAR_OP: {
-
- gn->set_title("ScalarOp");
- static const char* op_name[ShaderGraph::SCALAR_MAX_OP]={
- ("Add"),
- ("Sub"),
- ("Mul"),
- ("Div"),
- ("Mod"),
- ("Pow"),
- ("Max"),
- ("Min"),
- ("Atan2")
- };
-
- OptionButton *ob = memnew( OptionButton );
- for(int i=0;i<ShaderGraph::SCALAR_MAX_OP;i++) {
-
- ob->add_item(op_name[i],i);
- }
-
- ob->select(graph->scalar_op_node_get_op(type,p_id));
- ob->connect("item_selected",this,"_scalar_op_changed",varray(p_id));
- gn->add_child(ob);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a",Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("a: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_spin));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b",Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("b: ")+Variant(v),gn,p_id,1,Variant::REAL,hint_spin));
- }
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
-
-
- } break; // scalar vs scalar op (mul: { } break; add: { } break; div: { } break; etc)
- case ShaderGraph::NODE_VEC_OP: {
-
- gn->set_title("VecOp");
- static const char* op_name[ShaderGraph::VEC_MAX_OP]={
- ("Add"),
- ("Sub"),
- ("Mul"),
- ("Div"),
- ("Mod"),
- ("Pow"),
- ("Max"),
- ("Min"),
- ("Cross")
- };
-
- OptionButton *ob = memnew( OptionButton );
- for(int i=0;i<ShaderGraph::VEC_MAX_OP;i++) {
-
- ob->add_item(op_name[i],i);
- }
-
- ob->select(graph->vec_op_node_get_op(type,p_id));
- ob->connect("item_selected",this,"_vec_op_changed",varray(p_id));
- gn->add_child(ob);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a",Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b",Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("b: ")+v,gn,p_id,1,Variant::VECTOR3));
- }
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
-
-
- } break; // vec3 vs vec3 op (mul: { } break;ad: { } break;div: { } break;crossprod: { } break;etc)
- case ShaderGraph::NODE_VEC_SCALAR_OP: {
-
- gn->set_title("VecScalarOp");
- static const char* op_name[ShaderGraph::VEC_SCALAR_MAX_OP]={
- ("Mul"),
- ("Div"),
- ("Pow"),
- };
-
- OptionButton *ob = memnew( OptionButton );
- for(int i=0;i<ShaderGraph::VEC_SCALAR_MAX_OP;i++) {
-
- ob->add_item(op_name[i],i);
- }
-
- ob->select(graph->vec_scalar_op_node_get_op(type,p_id));
- ob->connect("item_selected",this,"_vec_scalar_op_changed",varray(p_id));
- gn->add_child(ob);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a",Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
-
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b",Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("b: ")+Variant(v),gn,p_id,1,Variant::REAL,hint_spin));
- }
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
-
-
- } break; // vec3 vs scalar op (mul: { } break; add: { } break; div: { } break; etc)
- case ShaderGraph::NODE_RGB_OP: {
-
- gn->set_title("RGB Op");
- static const char* op_name[ShaderGraph::RGB_MAX_OP]={
- ("Screen"),
- ("Difference"),
- ("Darken"),
- ("Lighten"),
- ("Overlay"),
- ("Dodge"),
- ("Burn"),
- ("SoftLight"),
- ("HardLight")
- };
-
- OptionButton *ob = memnew( OptionButton );
- for(int i=0;i<ShaderGraph::RGB_MAX_OP;i++) {
-
- ob->add_item(op_name[i],i);
- }
-
- ob->select(graph->rgb_op_node_get_op(type,p_id));
- ob->connect("item_selected",this,"_rgb_op_changed",varray(p_id));
- gn->add_child(ob);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a",Variant::COLOR));
- } else {
- hbc->add_child(make_editor(String("a: "),gn,p_id,0,Variant::COLOR));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b",Variant::COLOR));
- } else {
- gn->add_child(make_editor(String("b: "),gn,p_id,1,Variant::COLOR));
- }
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
-
- } break; // vec3 vs vec3 rgb op (with scalar amount): { } break; like brighten: { } break; darken: { } break; burn: { } break; dodge: { } break; multiply: { } break; etc.
- case ShaderGraph::NODE_XFORM_MULT: {
-
- gn->set_title("XFMult");
- HBoxContainer *hbc = memnew( HBoxContainer );
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a",Variant::TRANSFORM));
- } else {
- hbc->add_child(make_editor(String("a: edit..."),gn,p_id,0,Variant::TRANSFORM));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b",Variant::TRANSFORM));
- } else {
- gn->add_child(make_editor(String("b: edit..."),gn,p_id,1,Variant::TRANSFORM));
- }
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]);
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],false,0,Color());
-
-
- } break; // mat4 x mat4
- case ShaderGraph::NODE_XFORM_VEC_MULT: {
-
- gn->set_title("XFVecMult");
-
- CheckBox *button = memnew (CheckBox("RotOnly"));
- button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id));
- button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id));
-
- gn->add_child(button);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("xf",Variant::TRANSFORM));
- } else {
- hbc->add_child(make_editor(String("xf: edit..."),gn,p_id,0,Variant::TRANSFORM));
- }
- hbc->add_spacer();
- Label *l = memnew(Label("out"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child( l);
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("a",Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("a: ")+v,gn,p_id,1,Variant::VECTOR3));
- }
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
-
- } break;
- case ShaderGraph::NODE_XFORM_VEC_INV_MULT: {
-
- gn->set_title("XFVecInvMult");
-
-
- CheckBox *button = memnew( CheckBox("RotOnly"));
- button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id));
- button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id));
-
- gn->add_child(button);
-
- if (graph->is_slot_connected(type, p_id, 0)) {
- gn->add_child(make_label("a",Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- gn->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 1)) {
- hbc->add_child(make_label("xf", Variant::TRANSFORM));
- } else {
- hbc->add_child(make_editor(String("xf: edit..."),gn,p_id,1,Variant::TRANSFORM));
- }
- hbc->add_spacer();
- Label *l = memnew(Label("out"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child( l);
- gn->add_child(hbc);
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
-
-
- } break; // mat4 x vec3 inverse mult (with no-translation option)
- case ShaderGraph::NODE_SCALAR_FUNC: {
-
- gn->set_title("ScalarFunc");
- static const char* func_name[ShaderGraph::SCALAR_MAX_FUNC]={
- ("Sin"),
- ("Cos"),
- ("Tan"),
- ("ASin"),
- ("ACos"),
- ("ATan"),
- ("SinH"),
- ("CosH"),
- ("TanH"),
- ("Log"),
- ("Exp"),
- ("Sqrt"),
- ("Abs"),
- ("Sign"),
- ("Floor"),
- ("Round"),
- ("Ceil"),
- ("Frac"),
- ("Satr"),
- ("Neg")
- };
-
- OptionButton *ob = memnew( OptionButton );
- for(int i=0;i<ShaderGraph::SCALAR_MAX_FUNC;i++) {
-
- ob->add_item(func_name[i],i);
- }
-
- ob->select(graph->scalar_func_node_get_function(type,p_id));
- ob->connect("item_selected",this,"_scalar_func_changed",varray(p_id));
- gn->add_child(ob);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("in", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("in: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_spin));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
-
- } break; // scalar function (sin: { } break; cos: { } break; etc)
- case ShaderGraph::NODE_VEC_FUNC: {
-
-
-
- gn->set_title("VecFunc");
- static const char* func_name[ShaderGraph::VEC_MAX_FUNC]={
- ("Normalize"),
- ("Saturate"),
- ("Negate"),
- ("Reciprocal"),
- ("RGB to HSV"),
- ("HSV to RGB"),
- };
-
- OptionButton *ob = memnew( OptionButton );
- for(int i=0;i<ShaderGraph::VEC_MAX_FUNC;i++) {
-
- ob->add_item(func_name[i],i);
- }
-
- ob->select(graph->vec_func_node_get_function(type,p_id));
- ob->connect("item_selected",this,"_vec_func_changed",varray(p_id));
- gn->add_child(ob);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("in", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("in: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("out")));
- gn->add_child(hbc);
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
-
- } break; // vector function (normalize: { } break; negate: { } break; reciprocal: { } break; rgb2hsv: { } break; hsv2rgb: { } break; etc: { } break; etc)
- case ShaderGraph::NODE_VEC_LEN: {
- gn->set_title("VecLength");
- HBoxContainer *hbc = memnew( HBoxContainer );
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("in", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("in: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("len")));
- gn->add_child(hbc);
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; // vec3 length
- case ShaderGraph::NODE_DOT_PROD: {
-
- gn->set_title("DotProduct");
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("dp")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("b: ")+v,gn,p_id,1,Variant::VECTOR3));
- }
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
-
- } break; // vec3 . vec3 (dot product -> scalar output)
- case ShaderGraph::NODE_VEC_TO_SCALAR: {
-
- gn->set_title("Vec2Scalar");
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("vec", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("vec: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("x"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child( l);
- gn->add_child(hbc);
- l=memnew(Label("y"));
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child( l );
- l=memnew(Label("z"));
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child( l);
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
- gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
-
-
-
- } break; // 1 vec3 input: { } break; 3 scalar outputs
- case ShaderGraph::NODE_SCALAR_TO_VEC: {
-
- gn->set_title("Scalar2Vec");
- HBoxContainer *hbc = memnew( HBoxContainer );
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("x", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("x: ")+Variant(v),gn,p_id,0,Variant::REAL));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("vec")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("y", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("y: ")+Variant(v),gn,p_id,1,Variant::REAL));
- }
- if (graph->is_slot_connected(type, p_id, 2)) {
- gn->add_child(make_label("in", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,2);
- gn->add_child(make_editor(String("in: ")+Variant(v),gn,p_id,2,Variant::REAL));
- }
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
-
- } break; // 3 scalar input: { } break; 1 vec3 output
- case ShaderGraph::NODE_VEC_TO_XFORM: {
-
- gn->set_title("Vec2XForm");
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("x", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("x: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("xf")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("y", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("y: ")+v,gn,p_id,1,Variant::VECTOR3));
- }
- if (graph->is_slot_connected(type, p_id, 2)) {
- gn->add_child(make_label("z", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,2);
- gn->add_child(make_editor(String("z: ")+v,gn,p_id,2,Variant::VECTOR3));
- }
- if (graph->is_slot_connected(type, p_id, 3)) {
- gn->add_child(make_label("ofs", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,3);
- gn->add_child(make_editor(String("ofs: ")+v,gn,p_id,3,Variant::VECTOR3));
- }
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]);
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
- gn->set_slot(3,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
-
- } break; // 3 vec input: { } break; 1 xform output
- case ShaderGraph::NODE_XFORM_TO_VEC: {
-
- gn->set_title("XForm2Vec");
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("fx", Variant::TRANSFORM));
- } else {
- hbc->add_child(make_editor(String("fx: edit..."),gn,p_id,0,Variant::TRANSFORM));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("x"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child( l);
- gn->add_child(hbc);
- l=memnew(Label("y"));
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child( l );
- l=memnew(Label("z"));
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child( l);
- l=memnew(Label("ofs"));
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child( l);
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(3,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
-
- } break; // 3 vec input: { } break; 1 xform output
- case ShaderGraph::NODE_SCALAR_INTERP: {
-
- gn->set_title("ScalarInterp");
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("a: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_spin));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("interp")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("b: ")+Variant(v),gn,p_id,1,Variant::REAL,hint_spin));
- }
- if (graph->is_slot_connected(type, p_id, 2)) {
- gn->add_child(make_label("c", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,2);
- gn->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,2,Variant::REAL,hint_slider));
- }
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
-
-
- } break; // scalar interpolation (with optional curve)
- case ShaderGraph::NODE_VEC_INTERP: {
-
- gn->set_title("VecInterp");
- HBoxContainer *hbc = memnew( HBoxContainer );
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("a", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- hbc->add_child( memnew(Label("interp")));
- gn->add_child(hbc);
- if (graph->is_slot_connected(type, p_id, 1)) {
- gn->add_child(make_label("b", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,1);
- gn->add_child(make_editor(String("b: ")+v,gn,p_id,1,Variant::VECTOR3));
- }
- if (graph->is_slot_connected(type, p_id, 2)) {
- gn->add_child(make_label("c", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,2);
- gn->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,2,Variant::REAL,hint_slider));
- }
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
-
- } break; // vec3 interpolation (with optional curve)
- case ShaderGraph::NODE_COLOR_RAMP: {
-
- gn->set_title("ColorRamp");
- GraphColorRampEdit * ramp = memnew( GraphColorRampEdit );
-
- PoolVector<real_t> offsets = graph->color_ramp_node_get_offsets(type,p_id);
- PoolVector<Color> colors = graph->color_ramp_node_get_colors(type,p_id);
-
- int oc = offsets.size();
-
- if (oc) {
- PoolVector<real_t>::Read rofs = offsets.read();
- PoolVector<Color>::Read rcol = colors.read();
-
- Vector<float> ofsv;
- Vector<Color> colorv;
- for(int i=0;i<oc;i++) {
- ofsv.push_back(rofs[i]);
- colorv.push_back(rcol[i]);
- }
-
- ramp->set_ramp(ofsv,colorv);
-
- }
-
- ramp->connect("ramp_changed",this,"_color_ramp_changed",varray(p_id,ramp));
- ramp->set_custom_minimum_size(Size2(128,1));
- gn->add_child(ramp);
-
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("c", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_slider));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("rgb"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child( l);
- gn->add_child(hbc);
- l=memnew(Label("alpha"));
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child( l);
-
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(2,false,ShaderGraph::SLOT_MAX,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
-
- } break; // scalar interpolation (with optional curve)
- case ShaderGraph::NODE_CURVE_MAP: {
-
- gn->set_title("CurveMap");
- GraphCurveMapEdit * map = memnew( GraphCurveMapEdit );
-
- PoolVector<Vector2> points = graph->curve_map_node_get_points(type,p_id);
-
- int oc = points.size();
-
- if (oc) {
- PoolVector<Vector2>::Read rofs = points.read();
-
-
- Vector<Vector2> ofsv;
- for(int i=0;i<oc;i++) {
- ofsv.push_back(rofs[i]);
- }
-
- map->set_points(ofsv);
-
- }
- map->connect("curve_changed",this,"_curve_changed",varray(p_id,map));
-
- //map->connect("map_changed",this,"_curve_map_changed",varray(p_id,map));
- map->set_custom_minimum_size(Size2(128,64));
- gn->add_child(map);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("c", Variant::REAL));
- } else {
- float v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_slider));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("cmap"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child( l);
- gn->add_child(hbc);
-
-
- gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
-
- } break; // scalar interpolation (with optional curve)
-
- case ShaderGraph::NODE_SCALAR_INPUT: {
-
- gn->set_title("ScalarUniform");
- LineEdit *le = memnew( LineEdit );
- gn->add_child(le);
- le->set_text(graph->input_node_get_name(type,p_id));
- le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
- SpinBox *sb = memnew( SpinBox );
- sb->set_min(-100000);
- sb->set_max(100000);
- sb->set_step(0.001);
- sb->set_val(graph->scalar_input_node_get_value(type,p_id));
- sb->connect("value_changed",this,"_scalar_input_changed",varray(p_id));
- gn->add_child(sb);
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; // scalar uniform (assignable in material)
- case ShaderGraph::NODE_VEC_INPUT: {
-
- gn->set_title("VectorUniform");
- LineEdit *le = memnew( LineEdit );
- gn->add_child(le);
- le->set_text(graph->input_node_get_name(type,p_id));
- le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
- Array v3p(true);
- for(int i=0;i<3;i++) {
- HBoxContainer *hbc = memnew( HBoxContainer );
- Label *l = memnew( Label );
- l->set_text(String::chr('X'+i));
- hbc->add_child(l);
- SpinBox *sb = memnew( SpinBox );
- sb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- sb->set_min(-100000);
- sb->set_max(100000);
- sb->set_step(0.001);
- sb->set_val(graph->vec_input_node_get_value(type,p_id)[i]);
- sb->connect("value_changed",this,"_vec_input_changed",varray(p_id,v3p));
- v3p.push_back(sb);
- hbc->add_child(sb);
- gn->add_child(hbc);
- }
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
-
- } break; // vec3 uniform (assignable in material)
- case ShaderGraph::NODE_RGB_INPUT: {
-
- gn->set_title("ColorUniform");
- LineEdit *le = memnew( LineEdit );
- gn->add_child(le);
- le->set_text(graph->input_node_get_name(type,p_id));
- le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
- ColorPickerButton *cpb = memnew( ColorPickerButton );
- cpb->set_color(graph->rgb_input_node_get_value(type,p_id));
- cpb->connect("color_changed",this,"_rgb_input_changed",varray(p_id));
- gn->add_child(cpb);
- Label *l = memnew( Label );
- l->set_text("RGB");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
- l = memnew( Label );
- l->set_text("Alpha");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
-
- gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(3,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
-
- } break; // color uniform (assignable in material)
- case ShaderGraph::NODE_XFORM_INPUT: {
- gn->set_title("XFUniform");
- LineEdit *le = memnew( LineEdit );
- gn->add_child(le);
- le->set_text(graph->input_node_get_name(type,p_id));
- le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
- ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit...");
- edit->connect("pressed",this,"_xform_input_changed",varray(p_id,edit));
- gn->add_child(edit);
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]);
-
- } break; // mat4 uniform (assignable in material)
- case ShaderGraph::NODE_TEXTURE_INPUT: {
-
- gn->set_title("TexUniform");
- LineEdit *le = memnew( LineEdit );
- gn->add_child(le);
- le->set_text(graph->input_node_get_name(type,p_id));
- le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
- TextureRect *tex = memnew( TextureRect );
- tex->set_expand(true);
- tex->set_custom_minimum_size(Size2(80,80));
- tex->set_drag_forwarding(this);
- gn->add_child(tex);
- tex->set_mouse_filter(MOUSE_FILTER_PASS);
- tex->set_texture(graph->texture_input_node_get_value(type,p_id));
- ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit...");
- edit->connect("pressed",this,"_tex_edited",varray(p_id,edit));
- gn->add_child(edit);
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("UV", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("RGB"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child(l);
- gn->add_child(hbc);
- l = memnew( Label );
- l->set_text("Alpha");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
-
- gn->set_slot(3,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(4,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; // texture input (assignable in material)
- case ShaderGraph::NODE_CUBEMAP_INPUT: {
-
- gn->set_title("TexUniform");
- LineEdit *le = memnew( LineEdit );
- gn->add_child(le);
- le->set_text(graph->input_node_get_name(type,p_id));
- le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
-
- ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit...");
- edit->connect("pressed",this,"_cube_edited",varray(p_id,edit));
- gn->add_child(edit);
-
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("UV", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("RGB"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child(l);
- gn->add_child(hbc);
- l = memnew( Label );
- l->set_text("Alpha");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
-
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(3,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
- } break; // cubemap input (assignable in material)
- case ShaderGraph::NODE_DEFAULT_TEXTURE: {
-
- gn->set_title("CanvasItemTex");
- HBoxContainer *hbc = memnew( HBoxContainer );
- hbc->add_constant_override("separation",0);
- if (graph->is_slot_connected(type, p_id, 0)) {
- hbc->add_child(make_label("UV", Variant::VECTOR3));
- } else {
- Vector3 v = graph->default_get_value(type,p_id,0);
- hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3));
- }
- hbc->add_spacer();
- Label *l=memnew(Label("RGB"));
- l->set_align(Label::ALIGN_RIGHT);
- hbc->add_child(l);
- gn->add_child(hbc);
- l = memnew( Label );
- l->set_text("Alpha");
- l->set_align(Label::ALIGN_RIGHT);
- gn->add_child(l);
-
- gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
- gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]);
-
-
- } break; // screen texture sampler (takes UV) (only usable in fragment case Shader)
-
- case ShaderGraph::NODE_OUTPUT: {
- gn->set_title("Output");
- gn->set_show_close_button(false);
-
- List<ShaderGraph::SlotInfo> si;
- ShaderGraph::get_input_output_node_slot_info(graph->get_mode(),type,&si);
-
- Array colors;
- colors.push_back("Color");
- colors.push_back("LightColor");
- colors.push_back("Light");
- colors.push_back("ShadowColor");
- colors.push_back("Diffuse");
- colors.push_back("Specular");
- colors.push_back("Emission");
- Array reals;
- reals.push_back("Alpha");
- reals.push_back("DiffuseAlpha");
- reals.push_back("NormalMapDepth");
- reals.push_back("SpecExp");
- reals.push_back("Glow");
- reals.push_back("ShadeParam");
- reals.push_back("SpecularExp");
- reals.push_back("LightAlpha");
- reals.push_back("ShadowAlpha");
- reals.push_back("PointSize");
- reals.push_back("Discard");
-
- int idx=0;
- for (List<ShaderGraph::SlotInfo>::Element *E=si.front();E;E=E->next()) {
- ShaderGraph::SlotInfo& s=E->get();
- if (s.dir==ShaderGraph::SLOT_OUT) {
- Variant::Type v;
- if (colors.find(s.name)>=0)
- v=Variant::COLOR;
- else if (reals.find(s.name)>=0)
- v=Variant::REAL;
- else
- v=Variant::VECTOR3;
- gn->add_child(make_label(s.name, v));
- gn->set_slot(idx,true,s.type,typecol[s.type],false,0,Color());
- idx++;
- }
- }
-
- } break; // output (case Shader type dependent)
- case ShaderGraph::NODE_COMMENT: {
- gn->set_title("Comment");
- TextEdit *te = memnew(TextEdit);
- te->set_custom_minimum_size(Size2(100,100));
- gn->add_child(te);
- te->set_text(graph->comment_node_get_text(type,p_id));
- te->connect("text_changed",this,"_comment_edited",varray(p_id,te));
-
- } break; // comment
-
-
-
- }
-
- gn->connect("dragged",this,"_node_moved",varray(p_id));
- gn->connect("close_request",this,"_node_removed",varray(p_id),CONNECT_DEFERRED);
- graph_edit->add_child(gn);
- node_map[p_id]=gn;
- gn->set_offset(graph->node_get_position(type,p_id));
-
-
-}
-
-void ShaderGraphView::_update_graph() {
-
-
- if (block_update)
- return;
-
- for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) {
-
- memdelete(E->get());
- }
-
- node_map.clear();
-
- if (!graph.is_valid())
- return;
-
-
- List<int> nl;
- graph->get_node_list(type,&nl);
-
- for(List<int>::Element *E=nl.front();E;E=E->next()) {
-
- _create_node(E->get());
- }
- graph_edit->clear_connections();
-
- List<ShaderGraph::Connection> connections;
- graph->get_node_connections(type,&connections);
- for(List<ShaderGraph::Connection>::Element *E=connections.front();E;E=E->next()) {
-
- ERR_CONTINUE(!node_map.has(E->get().src_id) || !node_map.has(E->get().dst_id));
- graph_edit->connect_node(node_map[E->get().src_id]->get_name(),E->get().src_slot,node_map[E->get().dst_id]->get_name(),E->get().dst_slot);
- }
-
-}
-
-void ShaderGraphView::_sg_updated() {
-
- if (!graph.is_valid())
- return;
- switch(graph->get_graph_error(type)) {
- case ShaderGraph::GRAPH_OK: status->set_text(""); break;
- case ShaderGraph::GRAPH_ERROR_CYCLIC: status->set_text(TTR("Error: Cyclic Connection Link")); break;
- case ShaderGraph::GRAPH_ERROR_MISSING_CONNECTIONS: status->set_text(TTR("Error: Missing Input Connections")); break;
- }
-}
-
-Variant ShaderGraphView::get_drag_data_fw(const Point2 &p_point, Control *p_from)
-{
- TextureRect* frame = Object::cast_to<TextureRect>(p_from);
- if (!frame)
- return Variant();
-
- if (!frame->get_texture().is_valid())
- return Variant();
-
- RES res = frame->get_texture();
- return EditorNode::get_singleton()->drag_resource(res,p_from);
-
- return Variant();
-}
-
-bool ShaderGraphView::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const
-{
- if (p_data.get_type() != Variant::DICTIONARY)
- return false;
-
- Dictionary d = p_data;
-
- if (d.has("type")){
- if (d["type"] == "resource" && d.has("resource")) {
- Variant val = d["resource"];
-
- if (val.get_type()==Variant::OBJECT) {
- RES res = val;
- if (res.is_valid() && Object::cast_to<Texture>(res))
- return true;
- }
- }
- else if (d["type"] == "files" && d.has("files")) {
- Vector<String> files = d["files"];
- if (files.size() != 1)
- return false;
- return (ResourceLoader::get_resource_type(files[0]) == "ImageTexture");
- }
- }
-
- return false;
-}
-
-void ShaderGraphView::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from)
-{
- if (!can_drop_data_fw(p_point, p_data, p_from))
- return;
-
- TextureRect *frame = Object::cast_to<TextureRect>(p_from);
- if (!frame)
- return;
-
- Dictionary d = p_data;
- Ref<Texture> tex;
-
- if (d.has("type")) {
- if (d["type"] == "resource" && d.has("resource")){
- Variant val = d["resource"];
-
- if (val.get_type()==Variant::OBJECT) {
- RES res = val;
- if (res.is_valid())
- tex = Ref<Texture>(Object::cast_to<Texture>(*res));
- }
- }
- else if (d["type"] == "files" && d.has("files")) {
- Vector<String> files = d["files"];
- RES res = ResourceLoader::load(files[0]);
- if (res.is_valid())
- tex = Ref<Texture>(Object::cast_to<Texture>(*res));
- }
- }
-
- if (!tex.is_valid()) return;
-
- GraphNode *gn = Object::cast_to<GraphNode>(frame->get_parent());
- if (!gn) return;
-
- int id = -1;
- for(Map<int,GraphNode*>::Element *E = node_map.front();E;E=E->next())
- if (E->get() == gn) {
- id = E->key();
- break;
- }
- print_line(String::num(double(id)));
- if (id < 0) return;
-
- if (graph->node_get_type(type,id)==ShaderGraph::NODE_TEXTURE_INPUT) {
-
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Texture Uniform"));
- ur->add_do_method(graph.ptr(),"texture_input_node_set_value",type,id,tex);
- ur->add_undo_method(graph.ptr(),"texture_input_node_set_value",type,id,graph->texture_input_node_get_value(type,id));
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
- }
-}
-
-void ShaderGraphView::set_graph(Ref<ShaderGraph> p_graph){
-
-
- if (graph.is_valid()) {
- graph->disconnect("updated",this,"_sg_updated");
- }
- graph=p_graph;
- if (graph.is_valid()) {
- graph->connect("updated",this,"_sg_updated");
- }
- _update_graph();
- _sg_updated();
-
-}
-
-void ShaderGraphView::_notification(int p_what) {
-
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- ped_popup->connect("variant_changed",this,"_variant_edited");
- }
-}
-
-void ShaderGraphView::add_node(int p_type, const Vector2 &location) {
-
- if (p_type==ShaderGraph::NODE_INPUT && graph->node_count(type, p_type)>0)
- return;
-
- List<int> existing;
- graph->get_node_list(type,&existing);
- existing.sort();
- int newid=1;
- for(List<int>::Element *E=existing.front();E;E=E->next()) {
- if (!E->next() || (E->get()+1!=E->next()->get())){
- newid=E->get()+1;
- break;
- }
- }
-
- Vector2 init_ofs = location;
- while(true) {
- bool valid=true;
- for(List<int>::Element *E=existing.front();E;E=E->next()) {
- Vector2 pos = graph->node_get_position(type,E->get());
- if (init_ofs==pos) {
- init_ofs+=Vector2(20,20);
- valid=false;
- break;
-
- }
- }
-
- if (valid)
- break;
- }
- UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Add Shader Graph Node"));
- ur->add_do_method(graph.ptr(),"node_add",type,p_type,newid);
- ur->add_do_method(graph.ptr(),"node_set_position",type,newid,init_ofs);
- ur->add_undo_method(graph.ptr(),"node_remove",type,newid);
- ur->add_do_method(this,"_update_graph");
- ur->add_undo_method(this,"_update_graph");
- ur->commit_action();
-
-}
-
-void ShaderGraphView::_bind_methods() {
-
- ClassDB::bind_method("_update_graph",&ShaderGraphView::_update_graph);
- ClassDB::bind_method("_begin_node_move", &ShaderGraphView::_begin_node_move);
- ClassDB::bind_method("_node_moved",&ShaderGraphView::_node_moved);
- ClassDB::bind_method("_end_node_move", &ShaderGraphView::_end_node_move);
- ClassDB::bind_method("_move_node",&ShaderGraphView::_move_node);
- ClassDB::bind_method("_node_removed",&ShaderGraphView::_node_removed);
- ClassDB::bind_method("_connection_request",&ShaderGraphView::_connection_request);
- ClassDB::bind_method("_disconnection_request",&ShaderGraphView::_disconnection_request);
- ClassDB::bind_method("_duplicate_nodes_request", &ShaderGraphView::_duplicate_nodes_request);
- ClassDB::bind_method("_duplicate_nodes", &ShaderGraphView::_duplicate_nodes);
- ClassDB::bind_method("_delete_nodes_request", &ShaderGraphView::_delete_nodes_request);
-
- ClassDB::bind_method("_default_changed",&ShaderGraphView::_default_changed);
- ClassDB::bind_method("_scalar_const_changed",&ShaderGraphView::_scalar_const_changed);
- ClassDB::bind_method("_vec_const_changed",&ShaderGraphView::_vec_const_changed);
- ClassDB::bind_method("_rgb_const_changed",&ShaderGraphView::_rgb_const_changed);
- ClassDB::bind_method("_xform_const_changed",&ShaderGraphView::_xform_const_changed);
- ClassDB::bind_method("_scalar_op_changed",&ShaderGraphView::_scalar_op_changed);
- ClassDB::bind_method("_vec_op_changed",&ShaderGraphView::_vec_op_changed);
- ClassDB::bind_method("_vec_scalar_op_changed",&ShaderGraphView::_vec_scalar_op_changed);
- ClassDB::bind_method("_rgb_op_changed",&ShaderGraphView::_rgb_op_changed);
- ClassDB::bind_method("_xform_inv_rev_changed",&ShaderGraphView::_xform_inv_rev_changed);
- ClassDB::bind_method("_scalar_func_changed",&ShaderGraphView::_scalar_func_changed);
- ClassDB::bind_method("_vec_func_changed",&ShaderGraphView::_vec_func_changed);
- ClassDB::bind_method("_scalar_input_changed",&ShaderGraphView::_scalar_input_changed);
- ClassDB::bind_method("_vec_input_changed",&ShaderGraphView::_vec_input_changed);
- ClassDB::bind_method("_xform_input_changed",&ShaderGraphView::_xform_input_changed);
- ClassDB::bind_method("_rgb_input_changed",&ShaderGraphView::_rgb_input_changed);
- ClassDB::bind_method("_tex_input_change",&ShaderGraphView::_tex_input_change);
- ClassDB::bind_method("_cube_input_change",&ShaderGraphView::_cube_input_change);
- ClassDB::bind_method("_input_name_changed",&ShaderGraphView::_input_name_changed);
- ClassDB::bind_method("_tex_edited",&ShaderGraphView::_tex_edited);
- ClassDB::bind_method("_variant_edited",&ShaderGraphView::_variant_edited);
- ClassDB::bind_method("_cube_edited",&ShaderGraphView::_cube_edited);
- ClassDB::bind_method("_comment_edited",&ShaderGraphView::_comment_edited);
- ClassDB::bind_method("_color_ramp_changed",&ShaderGraphView::_color_ramp_changed);
- ClassDB::bind_method("_curve_changed",&ShaderGraphView::_curve_changed);
-
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ShaderGraphView::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ShaderGraphView::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &ShaderGraphView::drop_data_fw);
-
- ClassDB::bind_method("_sg_updated",&ShaderGraphView::_sg_updated);
-}
-
-ShaderGraphView::ShaderGraphView(ShaderGraph::ShaderType p_type) {
-
- type=p_type;
- graph_edit = memnew( GraphEdit );
- block_update=false;
- ped_popup = memnew( CustomPropertyEditor );
- graph_edit->add_child(ped_popup);
- status = memnew( Label );
- graph_edit->get_top_layer()->add_child(status);
- graph_edit->connect("_begin_node_move", this, "_begin_node_move");
- graph_edit->connect("_end_node_move", this, "_end_node_move");
- status->set_position(Vector2(5,5));
- status->add_color_override("font_color_shadow",Color(0,0,0));
- status->add_color_override("font_color",Color(1,0.4,0.3));
- status->add_constant_override("shadow_as_outline",1);
- status->add_constant_override("shadow_offset_x",2);
- status->add_constant_override("shadow_offset_y",2);
- status->set_text("");
-}
-
-
-//////////////edit//////////////
-void ShaderGraphEditor::edit(Ref<ShaderGraph> p_shader) {
-
- for(int i=0;i<ShaderGraph::SHADER_TYPE_MAX;i++) {
- graph_edits[i]->set_graph(p_shader);
- }
-}
-
-void ShaderGraphEditor::_add_node(int p_type) {
-
- ShaderGraph::ShaderType shader_type=ShaderGraph::ShaderType(tabs->get_current_tab());
- graph_edits[shader_type]->add_node(p_type, next_location);
-}
-
-void ShaderGraphEditor::_popup_requested(const Vector2 &p_position)
-{
- Vector2 scroll_ofs=graph_edits[tabs->get_current_tab()]->get_graph_edit()->get_scroll_ofs();
- next_location = get_local_mouse_position() + scroll_ofs;
- popup->set_global_position(p_position);
- popup->set_size( Size2( 200, 0) );
- popup->popup();
-}
-
-void ShaderGraphEditor::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- for(int i=0;i<ShaderGraph::NODE_TYPE_MAX;i++) {
-
- if (i==ShaderGraph::NODE_OUTPUT)
- continue;
- if (!_2d && i==ShaderGraph::NODE_DEFAULT_TEXTURE)
- continue;
-
- String nn = node_names[i];
- String ic = nn.get_slice(":",0);
- String v = nn.get_slice(":",1);
- bool addsep=false;
- if (nn.ends_with(":")) {
- addsep=true;
- }
- popup->add_icon_item(get_icon(ic,"EditorIcons"),v,i);
- if (addsep)
- popup->add_separator();
- }
- popup->connect("id_pressed",this,"_add_node");
-
-
- }
-}
-
-void ShaderGraphEditor::_bind_methods() {
-
- ClassDB::bind_method("_add_node",&ShaderGraphEditor::_add_node);
- ClassDB::bind_method("_popup_requested",&ShaderGraphEditor::_popup_requested);
-}
-
-
-const char* ShaderGraphEditor::node_names[ShaderGraph::NODE_TYPE_MAX]={
- ("GraphInput:Input"), // all inputs (shader type dependent)
- ("GraphScalar:Scalar Constant"), //scalar constant
- ("GraphVector:Vector Constant"), //vec3 constant
- ("GraphRgb:RGB Constant"), //rgb constant (shows a color picker instead)
- ("GraphXform:XForm Constant"), // 4x4 matrix constant
- ("GraphTime:Time:"), // time in seconds
- ("GraphTexscreen:Screen Sample"), // screen texture sampler (takes uv) (only usable in fragment shader)
- ("GraphScalarOp:Scalar Operator"), // scalar vs scalar op (mul", add", div", etc)
- ("GraphVecOp:Vector Operator"), // vec3 vs vec3 op (mul",ad",div",crossprod",etc)
- ("GraphVecScalarOp:Scalar+Vector Operator"), // vec3 vs scalar op (mul", add", div", etc)
- ("GraphRgbOp:RGB Operator:"), // vec3 vs vec3 rgb op (with scalar amount)", like brighten", darken", burn", dodge", multiply", etc.
- ("GraphXformMult:XForm Multiply"), // mat4 x mat4
- ("GraphXformVecMult:XForm+Vector Multiply"), // mat4 x vec3 mult (with no-translation option)
- ("GraphXformVecImult:Form+Vector InvMultiply:"), // mat4 x vec3 inverse mult (with no-translation option)
- ("GraphXformScalarFunc:Scalar Function"), // scalar function (sin", cos", etc)
- ("GraphXformVecFunc:Vector Function"), // vector function (normalize", negate", reciprocal", rgb2hsv", hsv2rgb", etc", etc)
- ("GraphVecLength:Vector Length"), // vec3 length
- ("GraphVecDp:Dot Product:"), // vec3 . vec3 (dot product -> scalar output)
- ("GraphVecToScalars:Vector -> Scalars"), // 1 vec3 input", 3 scalar outputs
- ("GraphScalarsToVec:Scalars -> Vector"), // 3 scalar input", 1 vec3 output
- ("GraphXformToVecs:XForm -> Vectors"), // 3 vec input", 1 xform output
- ("GraphVecsToXform:Vectors -> XForm:"), // 3 vec input", 1 xform output
- ("GraphScalarInterp:Scalar Interpolate"), // scalar interpolation (with optional curve)
- ("GraphVecInterp:Vector Interpolate:"), // vec3 interpolation (with optional curve)
- ("GraphColorRamp:Color Ramp"), // vec3 interpolation (with optional curve)
- ("GraphCurveMap:Curve Remap:"), // vec3 interpolation (with optional curve)
- ("GraphScalarUniform:Scalar Uniform"), // scalar uniform (assignable in material)
- ("GraphVectorUniform:Vector Uniform"), // vec3 uniform (assignable in material)
- ("GraphRgbUniform:RGB Uniform"), // color uniform (assignable in material)
- ("GraphXformUniform:XForm Uniform"), // mat4 uniform (assignable in material)
- ("GraphTextureUniform:Texture Uniform"), // texture input (assignable in material)
- ("GraphCubeUniform:CubeMap Uniform:"), // cubemap input (assignable in material)
- ("GraphDefaultTexture:CanvasItem Texture:"), // cubemap input (assignable in material)
- ("Output"), // output (shader type dependent)
- ("GraphComment:Comment"), // comment
-
-
-};
-ShaderGraphEditor::ShaderGraphEditor(bool p_2d) {
- _2d=p_2d;
-
- popup = memnew( PopupMenu );
- add_child(popup);
-
-
- tabs = memnew(TabContainer);
- tabs->set_v_size_flags(SIZE_EXPAND_FILL);
- add_child(tabs);
- const char* sname[ShaderGraph::SHADER_TYPE_MAX]={
- "Vertex",
- "Fragment",
- "Light"
- };
- for(int i=0;i<ShaderGraph::SHADER_TYPE_MAX;i++) {
-
- graph_edits[i]= memnew( ShaderGraphView(ShaderGraph::ShaderType(i)) );
- add_child(graph_edits[i]);
- graph_edits[i]->get_graph_edit()->set_name(sname[i]);
- tabs->add_child(graph_edits[i]->get_graph_edit());
- graph_edits[i]->get_graph_edit()->connect("connection_request",graph_edits[i],"_connection_request");
- graph_edits[i]->get_graph_edit()->connect("disconnection_request",graph_edits[i],"_disconnection_request");
- graph_edits[i]->get_graph_edit()->connect("duplicate_nodes_request", graph_edits[i], "_duplicate_nodes_request");
- graph_edits[i]->get_graph_edit()->connect("popup_request",this,"_popup_requested");
- graph_edits[i]->get_graph_edit()->connect("delete_nodes_request",graph_edits[i],"_delete_nodes_request");
- graph_edits[i]->get_graph_edit()->set_right_disconnects(true);
- }
-
- tabs->set_current_tab(1);
-
- set_custom_minimum_size(Size2(100,300));
-}
-
-
-void ShaderGraphEditorPlugin::edit(Object *p_object) {
-
- shader_editor->edit(Object::cast_to<ShaderGraph>(p_object));
-}
-
-bool ShaderGraphEditorPlugin::handles(Object *p_object) const {
-
- ShaderGraph *shader=Object::cast_to<ShaderGraph>(p_object);
- if (!shader)
- return false;
- if (_2d)
- return shader->get_mode()==Shader::MODE_CANVAS_ITEM;
- else
- return shader->get_mode()==Shader::MODE_MATERIAL;
-}
-
-void ShaderGraphEditorPlugin::make_visible(bool p_visible) {
-
- if (p_visible) {
- shader_editor->show();
- } else {
-
- shader_editor->hide();
- }
-
-}
-
-ShaderGraphEditorPlugin::ShaderGraphEditorPlugin(EditorNode *p_node, bool p_2d) {
-
- _2d=p_2d;
- editor=p_node;
- shader_editor = memnew( ShaderGraphEditor(p_2d) );
- shader_editor->hide();
- if (p_2d)
- CanvasItemEditor::get_singleton()->get_bottom_split()->add_child(shader_editor);
- else
- SpatialEditor::get_singleton()->get_shader_split()->add_child(shader_editor);
-
-
- //editor->get_viewport()->add_child(shader_editor);
- //shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- //shader_editor->hide();
-
-}
-
-
-ShaderGraphEditorPlugin::~ShaderGraphEditorPlugin()
-{
-}
-
-#endif
diff --git a/editor/plugins/shader_graph_editor_plugin.h b/editor/plugins/shader_graph_editor_plugin.h
deleted file mode 100644
index f273507fcf..0000000000
--- a/editor/plugins/shader_graph_editor_plugin.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*************************************************************************/
-/* shader_graph_editor_plugin.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef SHADER_GRAPH_EDITOR_PLUGIN_H
-#define SHADER_GRAPH_EDITOR_PLUGIN_H
-
-// FIXME: Godot 3.0 broke compatibility with ShaderGraphEditorPlugin,
-// it needs to be ported to the new shader language.
-#if 0
-
-#include "editor/editor_node.h"
-#include "editor/editor_plugin.h"
-#include "editor/property_editor.h"
-#include "scene/gui/button.h"
-#include "scene/gui/graph_edit.h"
-#include "scene/gui/popup.h"
-#include "scene/gui/tree.h"
-#include "scene/resources/shader.h"
-#include "scene/resources/shader_graph.h"
-
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
-class GraphColorRampEdit : public Control {
-
- GDCLASS(GraphColorRampEdit,Control);
-
-
- struct Point {
-
- float offset;
- Color color;
- bool operator<(const Point& p_ponit) const {
- return offset<p_ponit.offset;
- }
- };
-
- PopupPanel *popup;
- ColorPicker *picker;
-
-
- bool grabbing;
- int grabbed;
- float grabbed_at;
- Vector<Point> points;
-
- void _color_changed(const Color& p_color);
-
-protected:
- void _gui_input(const InputEvent& p_event);
- void _notification(int p_what);
- static void _bind_methods();
-public:
-
- void set_ramp(const Vector<float>& p_offsets,const Vector<Color>& p_colors);
- Vector<float> get_offsets() const;
- Vector<Color> get_colors() const;
- virtual Size2 get_minimum_size() const;
- GraphColorRampEdit();
-};
-
-
-class GraphCurveMapEdit : public Control {
-
- GDCLASS(GraphCurveMapEdit,Control);
-
-
- struct Point {
-
- float offset;
- float height;
- bool operator<(const Point& p_ponit) const {
- return offset<p_ponit.offset;
- }
- };
-
-
- bool grabbing;
- int grabbed;
- Vector<Point> points;
-
- void _plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d);
-protected:
- void _gui_input(const InputEvent& p_event);
- void _notification(int p_what);
- static void _bind_methods();
-public:
-
- void set_points(const Vector<Vector2>& p_points);
- Vector<Vector2> get_points() const;
- virtual Size2 get_minimum_size() const;
- GraphCurveMapEdit();
-};
-
-class ShaderGraphView : public Control {
-
- GDCLASS(ShaderGraphView,Control);
-
-
-
- CustomPropertyEditor *ped_popup;
- bool block_update;
-
- Label *status;
- GraphEdit *graph_edit;
- Ref<ShaderGraph> graph;
- int edited_id;
- int edited_def;
-
- ShaderGraph::ShaderType type;
-
- void _update_graph();
- void _create_node(int p_id);
-
-
- ToolButton *make_label(String text, Variant::Type v_type = Variant::NIL);
- ToolButton *make_editor(String text, GraphNode* gn, int p_id, int param, Variant::Type type, String p_hint="");
-
- void _connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
- void _disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
-
- void _node_removed(int p_id);
- void _begin_node_move();
- void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id);
- void _end_node_move();
- void _move_node(int p_id,const Vector2& p_to);
- void _duplicate_nodes_request();
- void _duplicate_nodes(const Array &p_nodes);
- void _delete_nodes_request();
-
-
- void _default_changed(int p_id, Node* p_button, int p_param, int v_type, String p_hint);
-
- void _scalar_const_changed(double p_value,int p_id);
- void _vec_const_changed(double p_value, int p_id, Array p_arr);
- void _rgb_const_changed(const Color& p_color, int p_id);
- void _xform_const_changed(int p_id,Node* p_button);
- void _scalar_op_changed(int p_op, int p_id);
- void _vec_op_changed(int p_op, int p_id);
- void _vec_scalar_op_changed(int p_op, int p_id);
- void _rgb_op_changed(int p_op, int p_id);
- void _xform_inv_rev_changed(bool p_enabled, int p_id);
- void _scalar_func_changed(int p_func, int p_id);
- void _vec_func_changed(int p_func, int p_id);
- void _scalar_input_changed(double p_value,int p_id);
- void _vec_input_changed(double p_value, int p_id, Array p_arr);
- void _xform_input_changed(int p_id,Node* p_button);
- void _rgb_input_changed(const Color& p_color, int p_id);
- void _tex_input_change(int p_id,Node* p_button);
- void _cube_input_change(int p_id);
- void _input_name_changed(const String& p_name,int p_id,Node* p_line_edit);
- void _tex_edited(int p_id,Node* p_button);
- void _cube_edited(int p_id,Node* p_button);
- void _variant_edited();
- void _comment_edited(int p_id,Node* p_button);
- void _color_ramp_changed(int p_id,Node* p_ramp);
- void _curve_changed(int p_id,Node* p_curve);
- void _sg_updated();
- Map<int,GraphNode*> node_map;
-
- Variant get_drag_data_fw(const Point2& p_point,Control* p_from);
- bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const;
- void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from);
-protected:
- void _notification(int p_what);
- static void _bind_methods();
-public:
-
- void add_node(int p_type, const Vector2 &location);
- GraphEdit *get_graph_edit() { return graph_edit; }
- void set_graph(Ref<ShaderGraph> p_graph);
-
- ShaderGraphView(ShaderGraph::ShaderType p_type=ShaderGraph::SHADER_TYPE_FRAGMENT);
-};
-
-class ShaderGraphEditor : public VBoxContainer {
-
- GDCLASS(ShaderGraphEditor,VBoxContainer);
-
- PopupMenu *popup;
- TabContainer *tabs;
- ShaderGraphView *graph_edits[ShaderGraph::SHADER_TYPE_MAX];
- static const char* node_names[ShaderGraph::NODE_TYPE_MAX];
- Vector2 next_location;
-
- bool _2d;
- void _add_node(int p_type);
- void _popup_requested(const Vector2 &p_position);
-protected:
- void _notification(int p_what);
- static void _bind_methods();
-public:
-
- void edit(Ref<ShaderGraph> p_shader);
- ShaderGraphEditor(bool p_2d);
-};
-
-class ShaderGraphEditorPlugin : public EditorPlugin {
-
- GDCLASS( ShaderGraphEditorPlugin, EditorPlugin );
-
- bool _2d;
- ShaderGraphEditor *shader_editor;
- EditorNode *editor;
-
-public:
-
- virtual String get_name() const { return "ShaderGraph"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
- virtual void make_visible(bool p_visible);
-
- ShaderGraphEditorPlugin(EditorNode *p_node,bool p_2d);
- ~ShaderGraphEditorPlugin();
-
-};
-
-#endif
-#endif // SHADER_GRAPH_EDITOR_PLUGIN_H
diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp
index fe7d1df50c..314db4198d 100644
--- a/editor/plugins/skeleton_editor_plugin.cpp
+++ b/editor/plugins/skeleton_editor_plugin.cpp
@@ -126,9 +126,16 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i
}
void SkeletonEditor::edit(Skeleton *p_node) {
+
skeleton = p_node;
}
+void SkeletonEditor::_notification(int p_what) {
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+ get_tree()->connect("node_removed", this, "_node_removed");
+ }
+}
+
void SkeletonEditor::_node_removed(Node *p_node) {
if (p_node == skeleton) {
@@ -139,6 +146,7 @@ void SkeletonEditor::_node_removed(Node *p_node) {
void SkeletonEditor::_bind_methods() {
ClassDB::bind_method("_on_click_option", &SkeletonEditor::_on_click_option);
+ ClassDB::bind_method("_node_removed", &SkeletonEditor::_node_removed);
}
SkeletonEditor::SkeletonEditor() {
diff --git a/editor/plugins/skeleton_editor_plugin.h b/editor/plugins/skeleton_editor_plugin.h
index b9bdf91902..0ab94c15b5 100644
--- a/editor/plugins/skeleton_editor_plugin.h
+++ b/editor/plugins/skeleton_editor_plugin.h
@@ -61,6 +61,7 @@ class SkeletonEditor : public Node {
friend class SkeletonEditorPlugin;
protected:
+ void _notification(int p_what);
void _node_removed(Node *p_node);
static void _bind_methods();
diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp
index 9bf1178b58..58a1835e68 100644
--- a/editor/plugins/sprite_editor_plugin.cpp
+++ b/editor/plugins/sprite_editor_plugin.cpp
@@ -160,7 +160,6 @@ void SpriteEditor::_update_mesh_data() {
Vector<Vector<Vector2> > lines = bm->clip_opaque_to_polygons(rect, epsilon);
- print_line("lines: " + itos(lines.size()));
uv_lines.clear();
computed_vertices.clear();
@@ -190,21 +189,6 @@ void SpriteEditor::_update_mesh_data() {
computed_vertices.push_back(vtx);
}
-#if 0
- Vector<Vector<Vector2> > polys = Geometry::decompose_polygon(lines[j]);
- print_line("polygon: " + itos(polys.size()));
-
- for (int i = 0; i < polys.size(); i++) {
- for (int k = 0; k < polys[i].size(); k++) {
-
- int idxn = (k + 1) % polys[i].size();
- uv_lines.push_back(polys[i][k]);
- uv_lines.push_back(polys[i][idxn]);
- }
- }
-#endif
-
-#if 1
Vector<int> poly = Geometry::triangulate_polygon(lines[j]);
@@ -218,14 +202,6 @@ void SpriteEditor::_update_mesh_data() {
computed_indices.push_back(poly[idx] + index_ofs);
}
}
-#endif
-
-#if 0
- for (int i = 0; i < lines[j].size() - 1; i++) {
- uv_lines.push_back(lines[j][i]);
- uv_lines.push_back(lines[j][i + 1]);
- }
-#endif
}
debug_uv->update();
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index a9afc7a670..fcbbee2b9c 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -89,7 +89,6 @@ void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, in
}
if (resources.empty()) {
- //print_line("added frames!");
return;
}
@@ -108,7 +107,6 @@ void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, in
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
- //print_line("added frames!");
}
void SpriteFramesEditor::_load_pressed() {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4a9cbfe535..4390b94ece 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -356,8 +356,6 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
undo_redo->add_do_method(atlas_tex.ptr(), "set_region", atlas_tex->get_region());
undo_redo->add_undo_method(atlas_tex.ptr(), "set_region", rect_prev);
} else if (node_ninepatch) {
- // FIXME: Is this intentional?
- } else if (node_ninepatch) {
undo_redo->add_do_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
undo_redo->add_undo_method(node_ninepatch, "set_region_rect", rect_prev);
} else if (obj_styleBox.is_valid()) {
@@ -521,6 +519,10 @@ void TextureRegionEditor::_set_snap_mode(int p_mode) {
else
hb_grid->hide();
+ if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
+ _update_autoslice();
+ }
+
edit_draw->update();
}
@@ -562,7 +564,8 @@ void TextureRegionEditor::_zoom_in() {
}
void TextureRegionEditor::_zoom_reset() {
- if (draw_zoom == 1) return;
+ if (draw_zoom == 1)
+ return;
draw_zoom = 1;
edit_draw->update();
}
@@ -585,25 +588,91 @@ void TextureRegionEditor::apply_rect(const Rect2 &rect) {
atlas_tex->set_region(rect);
}
-void TextureRegionEditor::_notification(int p_what) {
- switch (p_what) {
- case NOTIFICATION_PROCESS: {
- if (node_sprite) {
- if (node_sprite->is_region()) {
+void TextureRegionEditor::_update_autoslice() {
+ autoslice_is_dirty = false;
+ autoslice_cache.clear();
- set_process(false);
- EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
+ Ref<Texture> texture = NULL;
+ if (node_sprite)
+ texture = node_sprite->get_texture();
+ else if (node_ninepatch)
+ texture = node_ninepatch->get_texture();
+ else if (obj_styleBox.is_valid())
+ texture = obj_styleBox->get_texture();
+ else if (atlas_tex.is_valid())
+ texture = atlas_tex->get_atlas();
+
+ if (texture.is_null()) {
+ return;
+ }
+
+ for (int y = 0; y < texture->get_height(); y++) {
+ for (int x = 0; x < texture->get_width(); x++) {
+ if (texture->is_pixel_opaque(x, y)) {
+ bool found = false;
+ for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
+ Rect2 grown = E->get().grow(1.5);
+ if (grown.has_point(Point2(x, y))) {
+ E->get().expand_to(Point2(x, y));
+ E->get().expand_to(Point2(x + 1, y + 1));
+ x = E->get().position.x + E->get().size.x - 1;
+ bool merged = true;
+ while (merged) {
+ merged = false;
+ bool queue_erase = false;
+ for (List<Rect2>::Element *F = autoslice_cache.front(); F; F = F->next()) {
+ if (queue_erase) {
+ autoslice_cache.erase(F->prev());
+ queue_erase = false;
+ }
+ if (F == E)
+ continue;
+ if (E->get().grow(1).intersects(F->get())) {
+ E->get().expand_to(F->get().position);
+ E->get().expand_to(F->get().position + F->get().size);
+ if (F->prev()) {
+ F = F->prev();
+ autoslice_cache.erase(F->next());
+ } else {
+ queue_erase = true;
+ // Can't delete the first rect in the list.
+ }
+ merged = true;
+ }
+ }
+ }
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ Rect2 new_rect(x, y, 1, 1);
+ autoslice_cache.push_back(new_rect);
}
- } else {
- set_process(false);
}
- } break;
- case NOTIFICATION_THEME_CHANGED:
+ }
+ }
+ cache_map[texture->get_rid()] = autoslice_cache;
+}
+
+void TextureRegionEditor::_notification(int p_what) {
+ switch (p_what) {
case NOTIFICATION_READY: {
zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
} break;
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
+ _update_autoslice();
+ }
+ } break;
+ case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
+ // This happens when the user leaves the Editor and returns,
+ // he/she could have changed the textures, so the cache is cleared
+ cache_map.clear();
+ _edit_region();
+ } break;
}
}
@@ -709,57 +778,15 @@ void TextureRegionEditor::_edit_region() {
return;
}
- autoslice_cache.clear();
- Ref<Image> i;
- i.instance();
- if (i->load(texture->get_path()) == OK) {
- BitMap bm;
- bm.create_from_image_alpha(i);
- for (int y = 0; y < i->get_height(); y++) {
- for (int x = 0; x < i->get_width(); x++) {
- if (bm.get_bit(Point2(x, y))) {
- bool found = false;
- for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
- Rect2 grown = E->get().grow(1.5);
- if (grown.has_point(Point2(x, y))) {
- E->get().expand_to(Point2(x, y));
- E->get().expand_to(Point2(x + 1, y + 1));
- x = E->get().position.x + E->get().size.x - 1;
- bool merged = true;
- while (merged) {
- merged = false;
- bool queue_erase = false;
- for (List<Rect2>::Element *F = autoslice_cache.front(); F; F = F->next()) {
- if (queue_erase) {
- autoslice_cache.erase(F->prev());
- queue_erase = false;
- }
- if (F == E)
- continue;
- if (E->get().grow(1).intersects(F->get())) {
- E->get().expand_to(F->get().position);
- E->get().expand_to(F->get().position + F->get().size);
- if (F->prev()) {
- F = F->prev();
- autoslice_cache.erase(F->next());
- } else {
- queue_erase = true;
- //Can't delete the first rect in the list.
- }
- merged = true;
- }
- }
- }
- found = true;
- break;
- }
- }
- if (!found) {
- Rect2 new_rect(x, y, 1, 1);
- autoslice_cache.push_back(new_rect);
- }
- }
- }
+ if (cache_map.has(texture->get_rid())) {
+ autoslice_cache = cache_map[texture->get_rid()];
+ autoslice_is_dirty = false;
+ return;
+ } else {
+ if (is_visible() && snap_mode == SNAP_AUTOSLICE) {
+ _update_autoslice();
+ } else {
+ autoslice_is_dirty = true;
}
}
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 670cc86bbb..61ef769f89 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -92,7 +92,9 @@ class TextureRegionEditor : public Control {
Rect2 rect_prev;
float prev_margin;
int edited_margin;
+ Map<RID, List<Rect2> > cache_map;
List<Rect2> autoslice_cache;
+ bool autoslice_is_dirty;
bool drag;
bool creating;
@@ -110,6 +112,7 @@ class TextureRegionEditor : public Control {
void _zoom_reset();
void _zoom_out();
void apply_rect(const Rect2 &rect);
+ void _update_autoslice();
protected:
void _notification(int p_what);
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 0a421bdffe..34dd36692c 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -79,9 +79,9 @@ void TileMapEditor::_notification(int p_what) {
PopupMenu *p = options->get_popup();
p->set_item_icon(p->get_item_index(OPTION_PAINTING), get_icon("Edit", "EditorIcons"));
p->set_item_icon(p->get_item_index(OPTION_PICK_TILE), get_icon("ColorPick", "EditorIcons"));
- p->set_item_icon(p->get_item_index(OPTION_SELECT), get_icon("ToolSelect", "EditorIcons"));
- p->set_item_icon(p->get_item_index(OPTION_MOVE), get_icon("ToolMove", "EditorIcons"));
- p->set_item_icon(p->get_item_index(OPTION_DUPLICATE), get_icon("Duplicate", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_SELECT), get_icon("ActionCopy", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_CUT), get_icon("ActionCut", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_COPY), get_icon("Duplicate", "EditorIcons"));
p->set_item_icon(p->get_item_index(OPTION_ERASE_SELECTION), get_icon("Remove", "EditorIcons"));
} break;
@@ -119,12 +119,12 @@ void TileMapEditor::_menu_option(int p_option) {
canvas_item_editor->update();
} break;
- case OPTION_DUPLICATE: {
+ case OPTION_COPY: {
_update_copydata();
if (selection_active) {
- tool = TOOL_DUPLICATING;
+ tool = TOOL_PASTING;
canvas_item_editor->update();
}
@@ -135,12 +135,7 @@ void TileMapEditor::_menu_option(int p_option) {
return;
_start_undo(TTR("Erase Selection"));
- for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
- for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
-
- _set_cell(Point2i(j, i), invalid_cell, false, false, false);
- }
- }
+ _erase_selection();
_finish_undo();
selection_active = false;
@@ -157,11 +152,19 @@ void TileMapEditor::_menu_option(int p_option) {
undo_redo->commit_action();
} break;
- case OPTION_MOVE: {
+ case OPTION_CUT: {
if (selection_active) {
_update_copydata();
- tool = TOOL_MOVING;
+
+ _start_undo(TTR("Cut Selection"));
+ _erase_selection();
+ _finish_undo();
+
+ selection_active = false;
+
+ tool = TOOL_PASTING;
+
canvas_item_editor->update();
}
} break;
@@ -669,6 +672,18 @@ void TileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) {
canvas_item_editor->update();
}
+void TileMapEditor::_erase_selection() {
+ if (!selection_active)
+ return;
+
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
+
+ _set_cell(Point2i(j, i), invalid_cell, false, false, false);
+ }
+ }
+}
+
void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) {
Ref<Texture> t = node->get_tileset()->tile_get_texture(p_cell);
@@ -980,12 +995,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
canvas_item_editor->update();
}
- } else if (tool == TOOL_DUPLICATING) {
+ } else if (tool == TOOL_PASTING) {
Point2 ofs = over_tile - rectangle.position;
Vector<int> ids;
- _start_undo(TTR("Duplicate"));
+ _start_undo(TTR("Paste"));
ids.push_back(0);
for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
@@ -994,34 +1009,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
_finish_undo();
- copydata.clear();
-
- canvas_item_editor->update();
- } else if (tool == TOOL_MOVING) {
-
- Point2 ofs = over_tile - rectangle.position;
- Vector<int> ids;
-
- _start_undo(TTR("Move"));
- ids.push_back(TileMap::INVALID_CELL);
- for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
- for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
-
- _set_cell(Point2i(j, i), ids, false, false, false);
- }
- }
- for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
-
- ids.write[0] = E->get().cell;
- _set_cell(E->get().pos + ofs, ids, E->get().flip_h, E->get().flip_v, E->get().transpose);
- }
- _finish_undo();
-
- copydata.clear();
- selection_active = false;
-
canvas_item_editor->update();
+ return true; // We want to keep the Pasting tool
} else if (tool == TOOL_SELECTING) {
canvas_item_editor->update();
@@ -1068,17 +1058,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
- if (tool == TOOL_DUPLICATING) {
-
- tool = TOOL_NONE;
- copydata.clear();
-
- canvas_item_editor->update();
-
- return true;
- }
-
- if (tool == TOOL_MOVING) {
+ if (tool == TOOL_PASTING) {
tool = TOOL_NONE;
copydata.clear();
@@ -1305,7 +1285,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (k->get_scancode() == KEY_ESCAPE) {
- if (tool == TOOL_DUPLICATING || tool == TOOL_MOVING)
+ if (tool == TOOL_PASTING)
copydata.clear();
else if (tool == TOOL_SELECTING || selection_active)
selection_active = false;
@@ -1349,21 +1329,29 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
- if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) {
+ if (ED_IS_SHORTCUT("tile_map_editor/copy_selection", p_event)) {
_update_copydata();
if (selection_active) {
- tool = TOOL_DUPLICATING;
+ tool = TOOL_PASTING;
canvas_item_editor->update();
return true;
}
}
- if (ED_IS_SHORTCUT("tile_map_editor/move_selection", p_event)) {
+ if (ED_IS_SHORTCUT("tile_map_editor/cut_selection", p_event)) {
if (selection_active) {
_update_copydata();
- tool = TOOL_MOVING;
+
+ _start_undo(TTR("Cut Selection"));
+ _erase_selection();
+ _finish_undo();
+
+ selection_active = false;
+
+ tool = TOOL_PASTING;
+
canvas_item_editor->update();
return true;
}
@@ -1564,7 +1552,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
_draw_cell(ids[0], Point2i(j, i), flip_h, flip_v, transpose, xform);
}
}
- } else if (tool == TOOL_DUPLICATING || tool == TOOL_MOVING) {
+ } else if (tool == TOOL_PASTING) {
if (copydata.empty())
return;
@@ -1844,8 +1832,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD + KEY_B), OPTION_SELECT);
- p->add_shortcut(ED_SHORTCUT("tile_map_editor/move_selection", TTR("Move Selection"), KEY_MASK_CMD + KEY_M), OPTION_MOVE);
- p->add_shortcut(ED_SHORTCUT("tile_map_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD + KEY_D), OPTION_DUPLICATE);
+ p->add_shortcut(ED_SHORTCUT("tile_map_editor/cut_selection", TTR("Cut Selection"), KEY_MASK_CMD + KEY_X), OPTION_CUT);
+ p->add_shortcut(ED_SHORTCUT("tile_map_editor/copy_selection", TTR("Copy Selection"), KEY_MASK_CMD + KEY_C), OPTION_COPY);
p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION);
p->add_separator();
p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID);
@@ -1903,6 +1891,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
TileMapEditor::~TileMapEditor() {
_clear_bucket_cache();
+ copydata.clear();
}
///////////////////////////////////////////////////////////////
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index d72224263a..c824824d56 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -61,8 +61,7 @@ class TileMapEditor : public VBoxContainer {
TOOL_SELECTING,
TOOL_BUCKET,
TOOL_PICKING,
- TOOL_DUPLICATING,
- TOOL_MOVING
+ TOOL_PASTING
};
enum Options {
@@ -70,11 +69,11 @@ class TileMapEditor : public VBoxContainer {
OPTION_BUCKET,
OPTION_PICK_TILE,
OPTION_SELECT,
- OPTION_DUPLICATE,
+ OPTION_COPY,
OPTION_ERASE_SELECTION,
OPTION_PAINTING,
OPTION_FIX_INVALID,
- OPTION_MOVE
+ OPTION_CUT
};
TileMap *node;
@@ -167,6 +166,7 @@ class TileMapEditor : public VBoxContainer {
void _erase_points(const PoolVector<Vector2> p_points);
void _select(const Point2i &p_from, const Point2i &p_to);
+ void _erase_selection();
void _draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform);
void _draw_fill_preview(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 55a04a51b3..6b556cbe12 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -498,7 +498,7 @@ void TileSetEditor::_on_tileset_toolbar_button_pressed(int p_index) {
} break;
case TOOL_TILESET_REMOVE_TEXTURE: {
if (get_current_texture().is_valid()) {
- cd->set_text(TTR("Remove Selected Textue and ALL TILES wich uses it?"));
+ cd->set_text(TTR("Remove selected texture and ALL TILES which use it?"));
cd->popup_centered(Size2(300, 60));
} else {
err_dialog->set_text(TTR("You haven't selected a texture to remove."));
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index aad9258ed9..3a6a73d3cc 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1390,7 +1390,7 @@ void ProjectManager::_open_project_confirm() {
return;
}
- print_line("OPENING: " + path + " (" + selected + ")");
+ print_line("Editing project: " + path + " (" + selected + ")");
List<String> args;
@@ -1447,7 +1447,7 @@ void ProjectManager::_run_project_confirm() {
return;
}
- print_line("OPENING: " + path + " (" + selected + ")");
+ print_line("Running project: " + path + " (" + selected + ")");
List<String> args;
@@ -1513,13 +1513,13 @@ void ProjectManager::_scan_dir(DirAccess *da, float pos, float total, List<Strin
void ProjectManager::_scan_begin(const String &p_base) {
- print_line("SCAN PROJECTS AT: " + p_base);
+ print_line("Scanning projects at: " + p_base);
List<String> projects;
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
da->change_dir(p_base);
_scan_dir(da, 0, 1, &projects);
memdelete(da);
- print_line("found: " + itos(projects.size()) + " projects.");
+ print_line("Found " + itos(projects.size()) + " projects.");
for (List<String>::Element *E = projects.front(); E; E = E->next()) {
String proj = E->get().replace("/", "::");
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 65b2e2301b..a7c336eb16 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -891,7 +891,6 @@ void ProjectSettingsEditor::_item_del() {
return;
}
- print_line("to delete.. " + property);
undo_redo->create_action(TTR("Delete Item"));
Variant value = ProjectSettings::get_singleton()->get(property);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 408e67149a..d9812f7425 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -3992,7 +3992,6 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
String prop = d["name"];
emit_signal("property_keyed", prop, obj->get(prop), false);
} else if (p_button == 5) {
- print_line("PB5");
if (!d.has("name"))
return;
String prop = d["name"];
@@ -4732,7 +4731,7 @@ double PropertyValueEvaluator::eval(const String &p_text) {
script->set_source_code(_build_script(p_new_text));
Error err = script->reload();
if (err) {
- print_line("[PropertyValueEvaluator] Error loading script for expression: " + p_new_text);
+ ERR_PRINTS("PropertyValueEvaluator: Error loading script for expression: " + p_new_text);
return _default_eval(p_new_text);
}
@@ -4748,7 +4747,7 @@ double PropertyValueEvaluator::eval(const String &p_text) {
if (call_err.error == Variant::CallError::CALL_OK) {
return result;
}
- print_line("[PropertyValueEvaluator]: Error eval! Error code: " + itos(call_err.error));
+ ERR_PRINTS("PropertyValueEvaluator: Eval failed, error code: " + itos(call_err.error));
return _default_eval(p_new_text);
}
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index d927e07976..dae1bdeeb0 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -237,7 +237,6 @@ void PropertySelector::_update_search() {
Ref<Texture> icon;
script_methods = false;
- print_line("name: " + E->get().name);
String rep = E->get().name.replace("*", "");
if (E->get().name == "*Script Methods") {
icon = get_icon("Script", "EditorIcons");
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 607d974025..39250ab391 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1512,7 +1512,6 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
}
editor_data->get_undo_redo().commit_action();
- print_line("test: " + String(Variant(selected.front()->get()->get_meta("_editor_icon"))));
editor->push_item(p_script.operator->());
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 47db656017..a916ae23f6 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -968,7 +968,6 @@ void SceneTreeEditor::_warning_changed(Node *p_for_node) {
//should use a timer
update_timer->start();
- //print_line("WARNING CHANGED "+String(p_for_node->get_name()));
}
void SceneTreeEditor::_editor_settings_changed() {
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 746e1cd28f..9db53fe5f5 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1133,7 +1133,6 @@ void ScriptEditorDebugger::_notification(int p_what) {
}
message_type = cmd;
- //print_line("GOT: "+message_type);
ret = ppeer->get_var(cmd);
if (ret != OK) {
@@ -1285,15 +1284,13 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable) {
max_funcs = CLAMP(max_funcs, 16, 512);
msg.push_back(max_funcs);
ppeer->put_var(msg);
-
- print_line("BEGIN PROFILING!");
+ print_verbose("Starting profiling.");
} else {
Array msg;
msg.push_back("stop_profiling");
ppeer->put_var(msg);
-
- print_line("END PROFILING!");
+ print_verbose("Ending profiling.");
}
}
@@ -1430,8 +1427,6 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n
return;
}
-
- //print_line("method");
}
void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p_property, const Variant &p_value) {
@@ -1500,8 +1495,6 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p
return;
}
-
- //print_line("prop");
}
void ScriptEditorDebugger::_method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE) {
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 64638cdb1e..07b3c44807 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -1722,8 +1722,16 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
return;
Skeleton *sk(physical_bone->find_skeleton_parent());
+ if (!sk)
+ return;
+
PhysicalBone *pb(sk->get_physical_bone(physical_bone->get_bone_id()));
+ if (!pb)
+ return;
+
PhysicalBone *pbp(sk->get_physical_bone_parent(physical_bone->get_bone_id()));
+ if (!pbp)
+ return;
Vector<Vector3> points;
diff --git a/editor/translations/af.po b/editor/translations/af.po
index b51e90b9f5..a92264f015 100644
--- a/editor/translations/af.po
+++ b/editor/translations/af.po
@@ -5669,134 +5669,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/ar.po b/editor/translations/ar.po
index a48bee47d8..5631c1884d 100644
--- a/editor/translations/ar.po
+++ b/editor/translations/ar.po
@@ -5794,134 +5794,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "تعديل منحدر اللون"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9402,6 +9274,9 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Modify Color Ramp"
+#~ msgstr "تعديل منحدر اللون"
+
#~ msgid "Disabled"
#~ msgstr "معطّل"
diff --git a/editor/translations/bg.po b/editor/translations/bg.po
index eb38abf260..beeb2be3c6 100644
--- a/editor/translations/bg.po
+++ b/editor/translations/bg.po
@@ -5672,134 +5672,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/bn.po b/editor/translations/bn.po
index f93e41143d..f4021e9731 100644
--- a/editor/translations/bn.po
+++ b/editor/translations/bn.po
@@ -6024,134 +6024,6 @@ msgstr "প্রাসঙ্গিক সাহায্য"
msgid "Shader"
msgstr "শেডার"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "স্কেলার ধ্রুবক পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "ভেক্টর ধ্রুবক পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "RGB ধ্রুবক পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "স্কেলার অপারেটর পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "ভেক্টর অপারেটর পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "ভেক্টর স্কেলার অপারেটর পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "RGB অপারেটর পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "শুধুমাত্র ঘূর্ণন টগল করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "স্কেলার ফাংশন পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "ভেক্টর ফাংশন পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "স্কেলার ইউনিফর্ম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "ভেক্টর ইউনিফর্ম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "RGB ইউনিফর্ম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "প্রাথমিক মান পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "XForm ইউনিফর্ম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "টেক্সার ইউনিফর্ম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Cubemap ইউনিফর্ম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "কমেন্ট পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "রঙ্গের র‍্যাম্পে সংযোজন/বিয়োজন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "রঙ্গের র‍্যাম্প পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Curve Map-এ সংযোজন/বিয়োজন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Curve Map পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "ইনপুট নাম পরিবর্তন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "গ্রাফের নোডসমূহ সংযুক্ত করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "গ্রাফের নোডসমূহ বিচ্ছিন্ন করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Shader Graph Node অপসারণ করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Shader Graph Node সরান"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "গ্রাফ নোড(সমূহ) প্রতিলিপি করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Shader Graph Node(s) অপসারণ করুন"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "সমস্যা: আবর্তনশীল সংযোগ লিঙ্ক"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "সমস্যা: ইনপুট সংযোগ নেই"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Shader Graph Node যোগ করুন"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9907,6 +9779,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "স্কেলার ধ্রুবক পরিবর্তন করুন"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "ভেক্টর ধ্রুবক পরিবর্তন করুন"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "RGB ধ্রুবক পরিবর্তন করুন"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "স্কেলার অপারেটর পরিবর্তন করুন"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "ভেক্টর অপারেটর পরিবর্তন করুন"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "ভেক্টর স্কেলার অপারেটর পরিবর্তন করুন"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "RGB অপারেটর পরিবর্তন করুন"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "শুধুমাত্র ঘূর্ণন টগল করুন"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "স্কেলার ফাংশন পরিবর্তন করুন"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "ভেক্টর ফাংশন পরিবর্তন করুন"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "স্কেলার ইউনিফর্ম পরিবর্তন করুন"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "ভেক্টর ইউনিফর্ম পরিবর্তন করুন"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "RGB ইউনিফর্ম পরিবর্তন করুন"
+
+#~ msgid "Change Default Value"
+#~ msgstr "প্রাথমিক মান পরিবর্তন করুন"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "XForm ইউনিফর্ম পরিবর্তন করুন"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "টেক্সার ইউনিফর্ম পরিবর্তন করুন"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Cubemap ইউনিফর্ম পরিবর্তন করুন"
+
+#~ msgid "Change Comment"
+#~ msgstr "কমেন্ট পরিবর্তন করুন"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "রঙ্গের র‍্যাম্পে সংযোজন/বিয়োজন করুন"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "রঙ্গের র‍্যাম্প পরিবর্তন করুন"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Curve Map-এ সংযোজন/বিয়োজন করুন"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Curve Map পরিবর্তন করুন"
+
+#~ msgid "Change Input Name"
+#~ msgstr "ইনপুট নাম পরিবর্তন করুন"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "গ্রাফের নোডসমূহ সংযুক্ত করুন"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "গ্রাফের নোডসমূহ বিচ্ছিন্ন করুন"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Shader Graph Node অপসারণ করুন"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Shader Graph Node সরান"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "গ্রাফ নোড(সমূহ) প্রতিলিপি করুন"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Shader Graph Node(s) অপসারণ করুন"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "সমস্যা: আবর্তনশীল সংযোগ লিঙ্ক"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "সমস্যা: ইনপুট সংযোগ নেই"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Shader Graph Node যোগ করুন"
+
#~ msgid "Disabled"
#~ msgstr "অসমর্থ"
diff --git a/editor/translations/ca.po b/editor/translations/ca.po
index 3b683b9f9a..075b112224 100644
--- a/editor/translations/ca.po
+++ b/editor/translations/ca.po
@@ -5828,134 +5828,6 @@ msgstr "Ajuda Contextual"
msgid "Shader"
msgstr "Ombreig"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Modificar una constant escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Modificar una constant vectorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Modificar una constant RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Modifica un operador escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Modifica un operador vectorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Modifica un operador vectorial- escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Modifica un operador RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "només Rotacio"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Modifica una Funció Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Modifica una Funció Vectorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Modificar un Uniforme Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Modifica un Uniforme Vectorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Modifica un Uniforme RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Modifica el Valor per Defecte"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Modifica el Uniforme XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Modifica un Uniforme Textura"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Modifica un Uniforme 'CubeMap'"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Modifica el Comentari"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Afegeix/Elimina-ho de la Rampa de Colors"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modifica la Rampa de Color"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Afegeix/Ellimina-ho del Mapa de Corbes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modifica el Mapa de Corbes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Modifica el Nom de l'Entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Connecta els Nodes de Graf"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Desconnecta el Nodes de Graf"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Elimina el Node de Graf d'Ombreig"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Mou el Node de Graf d'Ombreig"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplica el(s) Node(s) de Graf"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Elimina el(s) Node(s) de Graf d'Ombreig"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Error: Enllaç de Connexió Cíclic"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Error: Manquen les Connexions d'Entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Afegeix un Node de Graf d'Ombreig"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9599,6 +9471,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Modificar una constant escalar"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Modificar una constant vectorial"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Modificar una constant RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Modifica un operador escalar"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Modifica un operador vectorial"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Modifica un operador vectorial- escalar"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Modifica un operador RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "només Rotacio"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Modifica una Funció Escalar"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Modifica una Funció Vectorial"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Modificar un Uniforme Escalar"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Modifica un Uniforme Vectorial"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Modifica un Uniforme RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Modifica el Valor per Defecte"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Modifica el Uniforme XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Modifica un Uniforme Textura"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Modifica un Uniforme 'CubeMap'"
+
+#~ msgid "Change Comment"
+#~ msgstr "Modifica el Comentari"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Afegeix/Elimina-ho de la Rampa de Colors"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modifica la Rampa de Color"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Afegeix/Ellimina-ho del Mapa de Corbes"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modifica el Mapa de Corbes"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Modifica el Nom de l'Entrada"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Connecta els Nodes de Graf"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Desconnecta el Nodes de Graf"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Elimina el Node de Graf d'Ombreig"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Mou el Node de Graf d'Ombreig"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplica el(s) Node(s) de Graf"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Elimina el(s) Node(s) de Graf d'Ombreig"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Error: Enllaç de Connexió Cíclic"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Error: Manquen les Connexions d'Entrada"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Afegeix un Node de Graf d'Ombreig"
+
#~ msgid "Disabled"
#~ msgstr "Desactivat"
diff --git a/editor/translations/cs.po b/editor/translations/cs.po
index d0372cf7aa..0da8ebee3c 100644
--- a/editor/translations/cs.po
+++ b/editor/translations/cs.po
@@ -5770,134 +5770,6 @@ msgstr "Kontextová nápověda"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Změnit skalární konstantu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Změna RGB konstanty"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Změnit skalární operátor"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Změnit RGB operátor"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Změnit skalární funkci"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Změnit vektorovou funkci"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Změnit výchozí hodnotu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Změnit komentář"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Upravit mapu křivky"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Změnit název vstupu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Propojit uzly grafu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Odpojit uzly grafu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9471,6 +9343,42 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Změnit skalární konstantu"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Změna RGB konstanty"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Změnit skalární operátor"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Změnit RGB operátor"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Změnit skalární funkci"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Změnit vektorovou funkci"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Změnit výchozí hodnotu"
+
+#~ msgid "Change Comment"
+#~ msgstr "Změnit komentář"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Upravit mapu křivky"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Změnit název vstupu"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Propojit uzly grafu"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Odpojit uzly grafu"
+
#~ msgid "Disabled"
#~ msgstr "Zakázáno"
diff --git a/editor/translations/da.po b/editor/translations/da.po
index 192240ec0a..d3a036452a 100644
--- a/editor/translations/da.po
+++ b/editor/translations/da.po
@@ -5812,134 +5812,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/de.po b/editor/translations/de.po
index 2a97f8ef3d..641d06841b 100644
--- a/editor/translations/de.po
+++ b/editor/translations/de.po
@@ -5883,134 +5883,6 @@ msgstr "Kontexthilfe"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Ändere skalare Konstante"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Ändere Vektorkonstante"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Ändere RGB-Konstante"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Ändere skalaren Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Ändere Vektoroperator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Ändere Vektor-Skalar-Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Ändere RGB-Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "schalte exklusive Rotation um"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Ändere skalare Funktion"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Ändere Vektorfunktion"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Ändere Skalar-Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Ändere Vektor-Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Ändere RGB-Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Ändere Standardwert"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Ändere XForm-Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Ändere Textur-Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Ändere Cubemap-Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Ändere Kommentar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Hinzufügen/Entfernen zum Farbgradienten"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Farbverlauf anpassen"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Hinzfügen/Entfernen zum Curve-Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Verändere Curve-Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Ändere Eingabename"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Verbinde Graph-Nodes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Trenne Graph-Nodes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Entferne Shader-Graph-Node"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Verschiebe Shader-Graph-Node"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Dupliziere Graph-Node(s)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Entferne Shade-Graph-Node(s)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Fehler: Zyklische Verbindung"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Fehler: Fehlende Eingangsverbindung"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Shader-Graph-Node hinzufügen"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9676,6 +9548,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Ändere skalare Konstante"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Ändere Vektorkonstante"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Ändere RGB-Konstante"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Ändere skalaren Operator"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Ändere Vektoroperator"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Ändere Vektor-Skalar-Operator"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Ändere RGB-Operator"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "schalte exklusive Rotation um"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Ändere skalare Funktion"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Ändere Vektorfunktion"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Ändere Skalar-Uniform"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Ändere Vektor-Uniform"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Ändere RGB-Uniform"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Ändere Standardwert"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Ändere XForm-Uniform"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Ändere Textur-Uniform"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Ändere Cubemap-Uniform"
+
+#~ msgid "Change Comment"
+#~ msgstr "Ändere Kommentar"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Hinzufügen/Entfernen zum Farbgradienten"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Farbverlauf anpassen"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Hinzfügen/Entfernen zum Curve-Map"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Verändere Curve-Map"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Ändere Eingabename"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Verbinde Graph-Nodes"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Trenne Graph-Nodes"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Entferne Shader-Graph-Node"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Verschiebe Shader-Graph-Node"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Dupliziere Graph-Node(s)"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Entferne Shade-Graph-Node(s)"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Fehler: Zyklische Verbindung"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Fehler: Fehlende Eingangsverbindung"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Shader-Graph-Node hinzufügen"
+
#~ msgid "Disabled"
#~ msgstr "Deaktiviert"
diff --git a/editor/translations/de_CH.po b/editor/translations/de_CH.po
index a0068f6038..3c10dc874c 100644
--- a/editor/translations/de_CH.po
+++ b/editor/translations/de_CH.po
@@ -5704,134 +5704,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot
index 3dd3be8809..4437b58965 100644
--- a/editor/translations/editor.pot
+++ b/editor/translations/editor.pot
@@ -5542,134 +5542,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/el.po b/editor/translations/el.po
index 64e88cd3be..6dc1f9459d 100644
--- a/editor/translations/el.po
+++ b/editor/translations/el.po
@@ -5847,134 +5847,6 @@ msgstr "Βοήθεια ανάλογα με τα συμφραζόμενα"
msgid "Shader"
msgstr "Πρόγραμμα σκίασης"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Αλλαγή μονόμετρης σταθεράς"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Αλλαγή διανυσματικής σταθεράς"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Αλλαγή χρωματικής σταθεράς"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Αλλαγή μονόμετρου τελεστή"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Αλλαγή διανυσματικού τελεστή"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Αλλαγή διανυσματικού - μονόμετρου τελεστή"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Αλλαγή χρωματικού τελεστή"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Εναλλαγή μόνο περιστροφή"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Αλλαγή μονόμετρης συνάρτησης"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Αλλαγή διανυσματικής συνάρτησης"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Αλλαγή μονόμετρης ομοιόμορφης μεταβλητής"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Αλλαγή διανυσματικής ομοιόμορφης μεταβλητής"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Αλλαγή χρωματικής ομοιόμορφης μεταβλητής"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Αλλαγή προεπιλλεγμένης τιμής"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Αλλαγή ομοιόμορφης μεταβλητής XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Αλλαγή ομοιόμορφης μεταβλητής υφής"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Αλλαγή ομοιόμορφης μεταβλητής χάρτη κύβου"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Αλλαγή σχολίου"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Προσθήκη/Αφαίρεση σε διαβάθμηση χρώματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Επεξεργασία διαβάθμισης χρωμάτων"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Προσθήκη/Αφαίρεση σε χάρτη καμπύλης"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Τροποποίηση χάρτη καμπύλης"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Αλλαγή ονόματος εισόδου"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Σύνδεση κόμβων γραφήματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Αποσύνδεση κόμβων γραφήματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Αφαίρεση κόμβου γραφήματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Μετακίνηση κόμβου γραφήματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Διπλασιασμός κόμβων γραφήματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Διαγραφή κόμβων γραφήματος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Σφάλμα: Κυκλικός σύνδεσμος"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Σφάλμα: Οι συνδέσεις εισόδου λείπουν"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Προσθήκη κόμβου γραφήματος"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9643,6 +9515,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Αλλαγή μονόμετρης σταθεράς"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Αλλαγή διανυσματικής σταθεράς"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Αλλαγή χρωματικής σταθεράς"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Αλλαγή μονόμετρου τελεστή"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Αλλαγή διανυσματικού τελεστή"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Αλλαγή διανυσματικού - μονόμετρου τελεστή"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Αλλαγή χρωματικού τελεστή"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Εναλλαγή μόνο περιστροφή"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Αλλαγή μονόμετρης συνάρτησης"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Αλλαγή διανυσματικής συνάρτησης"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Αλλαγή μονόμετρης ομοιόμορφης μεταβλητής"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Αλλαγή διανυσματικής ομοιόμορφης μεταβλητής"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Αλλαγή χρωματικής ομοιόμορφης μεταβλητής"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Αλλαγή προεπιλλεγμένης τιμής"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Αλλαγή ομοιόμορφης μεταβλητής XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Αλλαγή ομοιόμορφης μεταβλητής υφής"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Αλλαγή ομοιόμορφης μεταβλητής χάρτη κύβου"
+
+#~ msgid "Change Comment"
+#~ msgstr "Αλλαγή σχολίου"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Προσθήκη/Αφαίρεση σε διαβάθμηση χρώματος"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Επεξεργασία διαβάθμισης χρωμάτων"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Προσθήκη/Αφαίρεση σε χάρτη καμπύλης"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Τροποποίηση χάρτη καμπύλης"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Αλλαγή ονόματος εισόδου"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Σύνδεση κόμβων γραφήματος"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Αποσύνδεση κόμβων γραφήματος"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Αφαίρεση κόμβου γραφήματος"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Μετακίνηση κόμβου γραφήματος"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Διπλασιασμός κόμβων γραφήματος"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Διαγραφή κόμβων γραφήματος"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Σφάλμα: Κυκλικός σύνδεσμος"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Σφάλμα: Οι συνδέσεις εισόδου λείπουν"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Προσθήκη κόμβου γραφήματος"
+
#~ msgid "Disabled"
#~ msgstr "Απενεργοποιημένο"
diff --git a/editor/translations/es.po b/editor/translations/es.po
index 14b5840256..efc8ae334d 100644
--- a/editor/translations/es.po
+++ b/editor/translations/es.po
@@ -5885,134 +5885,6 @@ msgstr "Ayuda contextual"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Cambiar constante escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Cambiar Constante Vec."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Cambiar Constante RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Cambiar operador escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Cambiar operador Vec"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Cambiar operador Vec Scalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Cambiar operador RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Act/desact. solo Rot"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Cambiar función Scalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Cambiar función Vec"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Cambiar Scalar uniforme"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Cambiar Vec uniforme"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Cambiar RGB uniforme"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Cambiar valor por defecto"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Cambiar XForm uniforme"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Cambiar textura uniforme"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Cambiar Cubemap uniforme"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Cambiar comentario"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Añadir/quitar de rampa de color"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modificar rampa de color"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Añadir/quitar a/de mapa de curvas"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modificar mapa de curvas"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Cambiar nombre de entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Conectar nodos gráficos"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Desconectar nodos gráficos"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Eliminar el nodo gráfico del shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Mover el nodo gráfico del shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplicar nodo(s) gráfico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Eliminar nodo(s) gráfico(s) del shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Error: Link de conexión cíclico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Error: Conexiones de entrada faltantes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Añadir nodo gráfico del shader"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9669,6 +9541,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Cambiar constante escalar"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Cambiar Constante Vec."
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Cambiar Constante RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Cambiar operador escalar"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Cambiar operador Vec"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Cambiar operador Vec Scalar"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Cambiar operador RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Act/desact. solo Rot"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Cambiar función Scalar"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Cambiar función Vec"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Cambiar Scalar uniforme"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Cambiar Vec uniforme"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Cambiar RGB uniforme"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Cambiar valor por defecto"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Cambiar XForm uniforme"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Cambiar textura uniforme"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Cambiar Cubemap uniforme"
+
+#~ msgid "Change Comment"
+#~ msgstr "Cambiar comentario"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Añadir/quitar de rampa de color"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modificar rampa de color"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Añadir/quitar a/de mapa de curvas"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modificar mapa de curvas"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Cambiar nombre de entrada"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Conectar nodos gráficos"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Desconectar nodos gráficos"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Eliminar el nodo gráfico del shader"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Mover el nodo gráfico del shader"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplicar nodo(s) gráfico"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Eliminar nodo(s) gráfico(s) del shader"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Error: Link de conexión cíclico"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Error: Conexiones de entrada faltantes"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Añadir nodo gráfico del shader"
+
#~ msgid "Disabled"
#~ msgstr "Desactivado"
diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po
index 70e4273c72..457b63c44b 100644
--- a/editor/translations/es_AR.po
+++ b/editor/translations/es_AR.po
@@ -5849,134 +5849,6 @@ msgstr "Ayuda Contextual"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Cambiar Constante Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Cambiar Constante Vec."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Cambiar Constante RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Cambiar Operador Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Cambiar Operador Vec."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Cambiar Operador Vec. Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Cambiar Operador RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Act/Desact. Solo Rot."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Cambiar Función Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Cambiar Función Vec."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Cambiar Uniforme Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Cambiar Uniforme Vec."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Cambiar Uniforme RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Cambiar Valor por Defecto"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Cambiar Uniforme XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Cambiar Uniforme Textura"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Cambiar Uniforme Cubemap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Cambiar Comentarío"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Agregar/Quitar a Rampa de Color"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modificar Rampa de Color"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Agregar/quitar a Mapa de Curvas"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modificar Mapa de Curvas"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Cambiar Nombre de Entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Conectar Nodos de Gráfico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Desconectar Nodo de Gráfico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Quitar Nodo de Gráfico de Shaders"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Mover Nodo de Gráfico de Shaders"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplicar Nodo(s) de Gráfico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Quitar Nodo(s) de Gráfico de Shaders"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Error: Link de Conección Cíclico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Error: Conecciones de Entrada Faltantes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Agregar Nodo de Gráficos de Shader"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9626,6 +9498,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Cambiar Constante Escalar"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Cambiar Constante Vec."
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Cambiar Constante RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Cambiar Operador Escalar"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Cambiar Operador Vec."
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Cambiar Operador Vec. Escalar"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Cambiar Operador RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Act/Desact. Solo Rot."
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Cambiar Función Escalar"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Cambiar Función Vec."
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Cambiar Uniforme Escalar"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Cambiar Uniforme Vec."
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Cambiar Uniforme RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Cambiar Valor por Defecto"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Cambiar Uniforme XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Cambiar Uniforme Textura"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Cambiar Uniforme Cubemap"
+
+#~ msgid "Change Comment"
+#~ msgstr "Cambiar Comentarío"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Agregar/Quitar a Rampa de Color"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modificar Rampa de Color"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Agregar/quitar a Mapa de Curvas"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modificar Mapa de Curvas"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Cambiar Nombre de Entrada"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Conectar Nodos de Gráfico"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Desconectar Nodo de Gráfico"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Quitar Nodo de Gráfico de Shaders"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Mover Nodo de Gráfico de Shaders"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplicar Nodo(s) de Gráfico"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Quitar Nodo(s) de Gráfico de Shaders"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Error: Link de Conección Cíclico"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Error: Conecciones de Entrada Faltantes"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Agregar Nodo de Gráficos de Shader"
+
#~ msgid "Disabled"
#~ msgstr "Desactivado"
diff --git a/editor/translations/fa.po b/editor/translations/fa.po
index 699df3a09a..2a5818db88 100644
--- a/editor/translations/fa.po
+++ b/editor/translations/fa.po
@@ -5732,134 +5732,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/fi.po b/editor/translations/fi.po
index 8f9293dac2..c6efa1f56a 100644
--- a/editor/translations/fi.po
+++ b/editor/translations/fi.po
@@ -5830,134 +5830,6 @@ msgstr "Asiayhteydellinen ohje"
msgid "Shader"
msgstr "Sävytin"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Muuta skalaarivakiota"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Muuta vektorivakiota"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Muuta RGB-värivakiota"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Muuta skalaarioperaattoria"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Muuta vektorioperaattoria"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Muuta vektori- ja skalaarioperaattoria"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Muuta RGB-värioperaattoria"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Vain kierto"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Muuta skalaarifunktiota"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Muuta vektorifunktiota"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Muuta skalaariuniformia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Muuta vektoriuniformia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Muuta RGB-uniformia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Muuta oletusarvoa"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Muuta XForm-uniformia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Muuta tekstuuriuniformia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Muuta Cubemap-uniformia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Vaihda kommenttia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Lisää tai poista väriluiskalta"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Muokkaa väriliukumaa"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Lisää tai poista käyräkartalta"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Muokkaa käyräkarttaa"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Vaihda syötteen nimi"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Yhdistä graafin solmut"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Erota graafin solmut"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Poista sävytingraafin solmu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Siirrä sävytingraafin solmua"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Kahdenna graafin solmut(t)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Poista sävytingraafin solmuja"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Virhe: syklinen kytkentä"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Virhe: syöteliitännät puuttuvat"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Lisää sävytingraafin solmu"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9600,6 +9472,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Muuta skalaarivakiota"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Muuta vektorivakiota"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Muuta RGB-värivakiota"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Muuta skalaarioperaattoria"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Muuta vektorioperaattoria"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Muuta vektori- ja skalaarioperaattoria"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Muuta RGB-värioperaattoria"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Vain kierto"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Muuta skalaarifunktiota"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Muuta vektorifunktiota"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Muuta skalaariuniformia"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Muuta vektoriuniformia"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Muuta RGB-uniformia"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Muuta oletusarvoa"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Muuta XForm-uniformia"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Muuta tekstuuriuniformia"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Muuta Cubemap-uniformia"
+
+#~ msgid "Change Comment"
+#~ msgstr "Vaihda kommenttia"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Lisää tai poista väriluiskalta"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Muokkaa väriliukumaa"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Lisää tai poista käyräkartalta"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Muokkaa käyräkarttaa"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Vaihda syötteen nimi"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Yhdistä graafin solmut"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Erota graafin solmut"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Poista sävytingraafin solmu"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Siirrä sävytingraafin solmua"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Kahdenna graafin solmut(t)"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Poista sävytingraafin solmuja"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Virhe: syklinen kytkentä"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Virhe: syöteliitännät puuttuvat"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Lisää sävytingraafin solmu"
+
#~ msgid "Disabled"
#~ msgstr "Poistettu käytöstä"
diff --git a/editor/translations/fr.po b/editor/translations/fr.po
index e60e8ef18c..2f98c3cf99 100644
--- a/editor/translations/fr.po
+++ b/editor/translations/fr.po
@@ -5901,134 +5901,6 @@ msgstr "Aide contextuelle"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Modifier une constante scalaire"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Modifier une constance vectorielle"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Modifier une constante RVB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Modifier un opérateur scalaire"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Modifier un opérateur vectoriel"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Modifier un opérateur vectoriel scalaire"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Modifier un opérateur RVB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Basculer en mode rotation seule"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Modifier une fonction scalaire"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Modifier une fonction vecteur"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Modifier échelle"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Modifier vecteur"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Modifier RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Changer la valeur par défaut"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Modifier XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Modifier texture"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Modifier Cubemap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Modifier un commentaire"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Ajouter/supprimer de la rampe de couleurs"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modifier une rampe de couleurs"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Ajouter/supprimer de la carte de courbes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modifier la carte de courbes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Changer le nom de l'entrée"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Connecter les nœuds de graphe"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Déconnecter les nœuds de graphe"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Supprimer le nœud de graphe Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Déplacer le nœud de graphe Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Dupliquer le(s) nœud(s) de graphe"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Effacer le(s) nœud(s) de graphe Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Erreur: lien de connexion cyclique"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Erreur : connexions d'entrée manquantes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Ajouter un nœud de graphe Shader"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9687,6 +9559,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Modifier une constante scalaire"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Modifier une constance vectorielle"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Modifier une constante RVB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Modifier un opérateur scalaire"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Modifier un opérateur vectoriel"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Modifier un opérateur vectoriel scalaire"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Modifier un opérateur RVB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Basculer en mode rotation seule"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Modifier une fonction scalaire"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Modifier une fonction vecteur"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Modifier échelle"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Modifier vecteur"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Modifier RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Changer la valeur par défaut"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Modifier XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Modifier texture"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Modifier Cubemap"
+
+#~ msgid "Change Comment"
+#~ msgstr "Modifier un commentaire"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Ajouter/supprimer de la rampe de couleurs"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modifier une rampe de couleurs"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Ajouter/supprimer de la carte de courbes"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modifier la carte de courbes"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Changer le nom de l'entrée"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Connecter les nœuds de graphe"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Déconnecter les nœuds de graphe"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Supprimer le nœud de graphe Shader"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Déplacer le nœud de graphe Shader"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Dupliquer le(s) nœud(s) de graphe"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Effacer le(s) nœud(s) de graphe Shader"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Erreur: lien de connexion cyclique"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Erreur : connexions d'entrée manquantes"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Ajouter un nœud de graphe Shader"
+
#~ msgid "Disabled"
#~ msgstr "Désactivé"
diff --git a/editor/translations/he.po b/editor/translations/he.po
index 2902886cf9..43bfd2a473 100644
--- a/editor/translations/he.po
+++ b/editor/translations/he.po
@@ -5685,134 +5685,6 @@ msgstr "עזרה תלוית הקשר"
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "שינוי ערך בררת המחדל"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "שינוי הערה"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "שינוי שם קלט"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "שגיאה: חסרים חיבורי קלט"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9273,6 +9145,18 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Default Value"
+#~ msgstr "שינוי ערך בררת המחדל"
+
+#~ msgid "Change Comment"
+#~ msgstr "שינוי הערה"
+
+#~ msgid "Change Input Name"
+#~ msgstr "שינוי שם קלט"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "שגיאה: חסרים חיבורי קלט"
+
#~ msgid "Disabled"
#~ msgstr "מושבת"
diff --git a/editor/translations/hi.po b/editor/translations/hi.po
index 3352ef5e68..87c09cdd07 100644
--- a/editor/translations/hi.po
+++ b/editor/translations/hi.po
@@ -5632,134 +5632,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/hu.po b/editor/translations/hu.po
index d4aa6e9a16..1518b02617 100644
--- a/editor/translations/hu.po
+++ b/editor/translations/hu.po
@@ -5825,134 +5825,6 @@ msgstr "Kontextusérzékeny Súgó"
msgid "Shader"
msgstr "Árnyaló"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Skaláris állandó változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Vec állandó változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "RGB állandó változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Skaláris kezelő változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Vec kezelő változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Vektor skalár kezelő változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "RGB kezelő változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Csak vörös kapcsolása"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Skalár-függvény változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Vektor-függvény változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Egységes-skalár változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Egységes-vektor változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Egységes-RGB változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Alapérték változtatás"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Szín Gradiens Módosítása"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9425,6 +9297,51 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Skaláris állandó változtatás"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Vec állandó változtatás"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "RGB állandó változtatás"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Skaláris kezelő változtatás"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Vec kezelő változtatás"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Vektor skalár kezelő változtatás"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "RGB kezelő változtatás"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Csak vörös kapcsolása"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Skalár-függvény változtatás"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Vektor-függvény változtatás"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Egységes-skalár változtatás"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Egységes-vektor változtatás"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Egységes-RGB változtatás"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Alapérték változtatás"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Szín Gradiens Módosítása"
+
#~ msgid "Disabled"
#~ msgstr "Tiltva"
diff --git a/editor/translations/id.po b/editor/translations/id.po
index 1aaa1233cb..d8ffaf2e05 100644
--- a/editor/translations/id.po
+++ b/editor/translations/id.po
@@ -5861,134 +5861,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/is.po b/editor/translations/is.po
index d0dabb0516..5aedc67388 100644
--- a/editor/translations/is.po
+++ b/editor/translations/is.po
@@ -5576,134 +5576,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/it.po b/editor/translations/it.po
index 919b8079aa..4c60b4d34f 100644
--- a/editor/translations/it.po
+++ b/editor/translations/it.po
@@ -5881,134 +5881,6 @@ msgstr "Aiuto Contestuale"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Cambia Costante Scalare"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Cambia Costante Vett."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Cambia Costante RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Cambia Operatore Scalare"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Cambia Operatore Vett."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Cambia Operatore Scalare Vett."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Cambia Operatore RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Abilita Solo Rot"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Cambia Funzione Scalare"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Cambia Funzione Vett."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Cambia Uniforme Scalare"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Cambia Uniforme Vett."
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Cambia Uniforme RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Cambia Valore di Default"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Cambia Uniforme XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Cambia Uniforme Texture"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Cambia Uniforme Cubemap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Cambia Commento"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Aggiungi/Rimuovi alla Rampa Colori"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modifica Rampa Colori"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Aggiung/Rimuovi alla Mappa Curve"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modifica la Mappa Curve"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Cambia Nome Input"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Connetti Nodi Grafico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Disconnetti Nodi Grafico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Rimuovi Nodo Grafico di Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Sposta Nodo Grafico di Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplica Nodo(i) Grafico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Elimina Nodo(i) Grafico di Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Errore: Giunzione ciclica"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Errore: Connessioni Input MAncanti"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Aggiungi Nodo Grafico Shader"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9749,6 +9621,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Cambia Costante Scalare"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Cambia Costante Vett."
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Cambia Costante RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Cambia Operatore Scalare"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Cambia Operatore Vett."
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Cambia Operatore Scalare Vett."
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Cambia Operatore RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Abilita Solo Rot"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Cambia Funzione Scalare"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Cambia Funzione Vett."
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Cambia Uniforme Scalare"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Cambia Uniforme Vett."
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Cambia Uniforme RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Cambia Valore di Default"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Cambia Uniforme XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Cambia Uniforme Texture"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Cambia Uniforme Cubemap"
+
+#~ msgid "Change Comment"
+#~ msgstr "Cambia Commento"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Aggiungi/Rimuovi alla Rampa Colori"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modifica Rampa Colori"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Aggiung/Rimuovi alla Mappa Curve"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modifica la Mappa Curve"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Cambia Nome Input"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Connetti Nodi Grafico"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Disconnetti Nodi Grafico"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Rimuovi Nodo Grafico di Shader"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Sposta Nodo Grafico di Shader"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplica Nodo(i) Grafico"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Elimina Nodo(i) Grafico di Shader"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Errore: Giunzione ciclica"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Errore: Connessioni Input MAncanti"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Aggiungi Nodo Grafico Shader"
+
#~ msgid "Disabled"
#~ msgstr "Disabilitato"
diff --git a/editor/translations/ja.po b/editor/translations/ja.po
index bf038ba7e0..0f87aaeec5 100644
--- a/editor/translations/ja.po
+++ b/editor/translations/ja.po
@@ -6385,150 +6385,6 @@ msgstr "文脈参照ヘルプ"
msgid "Shader"
msgstr "シェーダー"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Scalar Constant"
-msgstr "スカラ定数を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Vec Constant"
-msgstr "ベクトル定数を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change RGB Constant"
-msgstr "RGB定数を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Scalar Operator"
-msgstr "スカラ演算子を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Vec Operator"
-msgstr "ベクトル演算子を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Vec Scalar Operator"
-msgstr "ベクトル・スカラ演算子を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change RGB Operator"
-msgstr "RGB演算子を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "回転のみ変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Scalar Function"
-msgstr "スカラ関数を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Vec Function"
-msgstr "ベクトル関数を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "スカラUniformを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "ベクトルUniformを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "RGB Uniformを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "規定値を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "XForm Uniformを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "テクスチャUniformを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "キューブマップUniformを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "コメントを変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Add/Remove to Color Ramp"
-msgstr "色の傾斜を付加/消去"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "色変化の傾斜を修正"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Add/Remove to Curve Map"
-msgstr "カーブマップを加える/除去"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "カーブマップを修正"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "入力の名前を変更"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Connect Graph Nodes"
-msgstr "グラフノードを接続"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Disconnect Graph Nodes"
-msgstr "グラフノードを切断"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Remove Shader Graph Node"
-msgstr "シェーダーグラフノードを除去"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Move Shader Graph Node"
-msgstr "シェーダーグラフノードを移動"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "グラフノードを複製"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "シェーダーグラフノードを消去"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "エラー:循環結合リンク"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Error: Missing Input Connections"
-msgstr "エラー:入力コネクションが失われています"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "シェーダーグラフノードを追加"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -10415,6 +10271,118 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#, fuzzy
+#~ msgid "Change Scalar Constant"
+#~ msgstr "スカラ定数を変更"
+
+#, fuzzy
+#~ msgid "Change Vec Constant"
+#~ msgstr "ベクトル定数を変更"
+
+#, fuzzy
+#~ msgid "Change RGB Constant"
+#~ msgstr "RGB定数を変更"
+
+#, fuzzy
+#~ msgid "Change Scalar Operator"
+#~ msgstr "スカラ演算子を変更"
+
+#, fuzzy
+#~ msgid "Change Vec Operator"
+#~ msgstr "ベクトル演算子を変更"
+
+#, fuzzy
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "ベクトル・スカラ演算子を変更"
+
+#, fuzzy
+#~ msgid "Change RGB Operator"
+#~ msgstr "RGB演算子を変更"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "回転のみ変更"
+
+#, fuzzy
+#~ msgid "Change Scalar Function"
+#~ msgstr "スカラ関数を変更"
+
+#, fuzzy
+#~ msgid "Change Vec Function"
+#~ msgstr "ベクトル関数を変更"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "スカラUniformを変更"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "ベクトルUniformを変更"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "RGB Uniformを変更"
+
+#~ msgid "Change Default Value"
+#~ msgstr "規定値を変更"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "XForm Uniformを変更"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "テクスチャUniformを変更"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "キューブマップUniformを変更"
+
+#~ msgid "Change Comment"
+#~ msgstr "コメントを変更"
+
+#, fuzzy
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "色の傾斜を付加/消去"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "色変化の傾斜を修正"
+
+#, fuzzy
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "カーブマップを加える/除去"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "カーブマップを修正"
+
+#~ msgid "Change Input Name"
+#~ msgstr "入力の名前を変更"
+
+#, fuzzy
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "グラフノードを接続"
+
+#, fuzzy
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "グラフノードを切断"
+
+#, fuzzy
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "シェーダーグラフノードを除去"
+
+#, fuzzy
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "シェーダーグラフノードを移動"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "グラフノードを複製"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "シェーダーグラフノードを消去"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "エラー:循環結合リンク"
+
+#, fuzzy
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "エラー:入力コネクションが失われています"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "シェーダーグラフノードを追加"
+
#~ msgid "Disabled"
#~ msgstr "無効"
diff --git a/editor/translations/ka.po b/editor/translations/ka.po
index 2c9fe70e36..b8b3e848be 100644
--- a/editor/translations/ka.po
+++ b/editor/translations/ka.po
@@ -5606,134 +5606,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/ko.po b/editor/translations/ko.po
index 7cfa54d1e4..10ee7d659b 100644
--- a/editor/translations/ko.po
+++ b/editor/translations/ko.po
@@ -5818,134 +5818,6 @@ msgstr "도움말 보기"
msgid "Shader"
msgstr "셰이더"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Scalar 상수 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Vec 상수 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "RGB 상수 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Scalar 연산자 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Vec 연산자 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Vec Scalar 연산자 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "RGB 연산자 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "회전만 토글"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Scalar 함수 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Vec 함수 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Scalar uniform 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Vec uniform 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "RGB uniform 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "기본값 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "XForm uniform 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "텍스쳐 uniform 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "큐브맵 uniform 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "주석 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "색상 램프 추가/삭제"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "칼라 램프 수정"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "커브 맵 추가/삭제"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "커브맵 수정"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "입력 이름 변경"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "그래프 노드 연결"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "그래프 노드 연결 해제"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "셰이더 그래프 노드 삭제"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "셰이더 그래프 노드 이동"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "그래프 노드 복제"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "셰이더 그래프 노드 삭제"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "에러: 순환 연결 링크"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "에러: 입력 연결 누락"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "셰이더 그래프 노드 추가"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9561,6 +9433,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Scalar 상수 변경"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Vec 상수 변경"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "RGB 상수 변경"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Scalar 연산자 변경"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Vec 연산자 변경"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Vec Scalar 연산자 변경"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "RGB 연산자 변경"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "회전만 토글"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Scalar 함수 변경"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Vec 함수 변경"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Scalar uniform 변경"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Vec uniform 변경"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "RGB uniform 변경"
+
+#~ msgid "Change Default Value"
+#~ msgstr "기본값 변경"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "XForm uniform 변경"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "텍스쳐 uniform 변경"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "큐브맵 uniform 변경"
+
+#~ msgid "Change Comment"
+#~ msgstr "주석 변경"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "색상 램프 추가/삭제"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "칼라 램프 수정"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "커브 맵 추가/삭제"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "커브맵 수정"
+
+#~ msgid "Change Input Name"
+#~ msgstr "입력 이름 변경"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "그래프 노드 연결"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "그래프 노드 연결 해제"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "셰이더 그래프 노드 삭제"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "셰이더 그래프 노드 이동"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "그래프 노드 복제"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "셰이더 그래프 노드 삭제"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "에러: 순환 연결 링크"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "에러: 입력 연결 누락"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "셰이더 그래프 노드 추가"
+
#~ msgid "Disabled"
#~ msgstr "비활성화됨"
diff --git a/editor/translations/lt.po b/editor/translations/lt.po
index 335001493e..f646555da2 100644
--- a/editor/translations/lt.po
+++ b/editor/translations/lt.po
@@ -5618,134 +5618,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/lv.po b/editor/translations/lv.po
index 33494d0309..7dc72def39 100644
--- a/editor/translations/lv.po
+++ b/editor/translations/lv.po
@@ -5599,134 +5599,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/ms.po b/editor/translations/ms.po
index 569408a4e1..e7e084af56 100644
--- a/editor/translations/ms.po
+++ b/editor/translations/ms.po
@@ -5557,134 +5557,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/nb.po b/editor/translations/nb.po
index 9bb2b196c5..fc4a1bed6e 100644
--- a/editor/translations/nb.po
+++ b/editor/translations/nb.po
@@ -5878,134 +5878,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Endre Kommentar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modifiser Farge-Rampe"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9534,6 +9406,12 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Comment"
+#~ msgstr "Endre Kommentar"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modifiser Farge-Rampe"
+
#~ msgid "Disabled"
#~ msgstr "Deaktivert"
diff --git a/editor/translations/nl.po b/editor/translations/nl.po
index 9807fc11e4..5c0aa6546c 100644
--- a/editor/translations/nl.po
+++ b/editor/translations/nl.po
@@ -5865,135 +5865,6 @@ msgstr "Contextuele Hulp"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Verander Shalar Constante"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Verander Vec Constante"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Verander RGB Constante"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Verander Scalar Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Verander Vec Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Verander Vec Scalar Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Verander RGB Operator"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Aan/Uit Alleen Rot"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Verander Scalar Functie"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Verander Vec Functie"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Verander Scalar Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Verander Vec Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Verander RGB Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Verander Standaardwaarde"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Verander XForm Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Verander Textuur Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Verander Cubemap Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Verander Commentaar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Voeg Toe/Verwijder van Kleur Helling"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Modify Color Ramp"
-msgstr "Wijzig Kleuren Helling"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Voeg Toe/Verwijder van Curve Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Wijzig Curve Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Verander Input Naam"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Verbind Graaf Knooppunten"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Ontkoppel Graaf Knooppunten"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Verwijder Shader Graaf Knooppunten"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Verplaats Shader Graaf Knooppunten"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Dupliceer Graaf Knooppunt(en)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Verwijder Shader Graaf Knooppunt(en)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Fout: Cyclische Connectie Link"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Fout: Ontbrekende Input Connecties"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Voeg Shader Graaf Knooppunt Toe"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9629,6 +9500,103 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Verander Shalar Constante"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Verander Vec Constante"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Verander RGB Constante"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Verander Scalar Operator"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Verander Vec Operator"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Verander Vec Scalar Operator"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Verander RGB Operator"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Aan/Uit Alleen Rot"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Verander Scalar Functie"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Verander Vec Functie"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Verander Scalar Uniform"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Verander Vec Uniform"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Verander RGB Uniform"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Verander Standaardwaarde"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Verander XForm Uniform"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Verander Textuur Uniform"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Verander Cubemap Uniform"
+
+#~ msgid "Change Comment"
+#~ msgstr "Verander Commentaar"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Voeg Toe/Verwijder van Kleur Helling"
+
+#, fuzzy
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Wijzig Kleuren Helling"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Voeg Toe/Verwijder van Curve Map"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Wijzig Curve Map"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Verander Input Naam"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Verbind Graaf Knooppunten"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Ontkoppel Graaf Knooppunten"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Verwijder Shader Graaf Knooppunten"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Verplaats Shader Graaf Knooppunten"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Dupliceer Graaf Knooppunt(en)"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Verwijder Shader Graaf Knooppunt(en)"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Fout: Cyclische Connectie Link"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Fout: Ontbrekende Input Connecties"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Voeg Shader Graaf Knooppunt Toe"
+
#~ msgid "Disabled"
#~ msgstr "Uitgeschakeld"
diff --git a/editor/translations/pl.po b/editor/translations/pl.po
index 96a679a788..3a74f61167 100644
--- a/editor/translations/pl.po
+++ b/editor/translations/pl.po
@@ -5878,136 +5878,6 @@ msgstr "Pomoc kontekstowa"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Zmień wartość stałej skalarnej"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Zmień stałą Vec"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Zmień stałą RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Zmień operator skalara"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Zmień operator Vec"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Zmień operator Vec Scalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Zmień operator RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Przełącz tylko rotacje"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Scalar Function"
-msgstr "Zamień funkcję skalarną"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Zmień funkcję wektorową"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Zmień Wartość Domyślną"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Zmień komentarz"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modyfikuj Color Ramp"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Dodaj/Usuń do mapy krzywej"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Edytuj mape krzywej"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Input Name"
-msgstr "Zmień nazwę wejścia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Połącz węzły grafu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Odłącz węzły grafu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Usuń węzeł Shader Graph"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplikuj węzły grafu"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Usuń węzeł(y) Shader Graph"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Błąd: Brakujące połączenia wejścia"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9674,6 +9544,74 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Zmień wartość stałej skalarnej"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Zmień stałą Vec"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Zmień stałą RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Zmień operator skalara"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Zmień operator Vec"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Zmień operator Vec Scalar"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Zmień operator RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Przełącz tylko rotacje"
+
+#, fuzzy
+#~ msgid "Change Scalar Function"
+#~ msgstr "Zamień funkcję skalarną"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Zmień funkcję wektorową"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Zmień Wartość Domyślną"
+
+#~ msgid "Change Comment"
+#~ msgstr "Zmień komentarz"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modyfikuj Color Ramp"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Dodaj/Usuń do mapy krzywej"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Edytuj mape krzywej"
+
+#, fuzzy
+#~ msgid "Change Input Name"
+#~ msgstr "Zmień nazwę wejścia"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Połącz węzły grafu"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Odłącz węzły grafu"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Usuń węzeł Shader Graph"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplikuj węzły grafu"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Usuń węzeł(y) Shader Graph"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Błąd: Brakujące połączenia wejścia"
+
#~ msgid "Disabled"
#~ msgstr "Wyłączone"
diff --git a/editor/translations/pr.po b/editor/translations/pr.po
index 091d384aae..1ea7dca649 100644
--- a/editor/translations/pr.po
+++ b/editor/translations/pr.po
@@ -5633,134 +5633,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po
index 1da8d0b968..c88dc3ea2c 100644
--- a/editor/translations/pt_BR.po
+++ b/editor/translations/pt_BR.po
@@ -5857,134 +5857,6 @@ msgstr "Ajuda Contextual"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Alterar Constante Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Alterar Constante Vet"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Alterar Constante RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Alterar Operador Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Alterar Operador Vet"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Alterar Operador Vet Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Alterar Operador RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Alternar Rotação Somente"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Alterar Função Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Alterar Função Vet"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Alterar Uniforme Escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Alterar Uniforme Vet"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Alterar Uniforme RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Alterar Valor Padrão"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Alterar Uniforme XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Alterar Uniforme da Textura"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Alterar Uniforme do Cubemap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Alterar Comentário"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Adicionar/Remover para Curva de Cores"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modificar Curva de Cores"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Adicionar/Remover para Curve Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modificar Curve Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Alterar Nome da Entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Conectar Nodes de Grafos"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Desconectar Nodes de Grafos"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Remover Nó de Shader Graph"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Mover Nó de Shader Graph"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplicar Nó(s) de Grafo(s)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Deletar Nó(s) de Shader Graph(s)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Erro: Vínculo de Conexão Cíclico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Erro: Faltando as Conexões da Entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Adicionar Nó de Shader Graph"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9628,6 +9500,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Alterar Constante Escalar"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Alterar Constante Vet"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Alterar Constante RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Alterar Operador Escalar"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Alterar Operador Vet"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Alterar Operador Vet Escalar"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Alterar Operador RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Alternar Rotação Somente"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Alterar Função Escalar"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Alterar Função Vet"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Alterar Uniforme Escalar"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Alterar Uniforme Vet"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Alterar Uniforme RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Alterar Valor Padrão"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Alterar Uniforme XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Alterar Uniforme da Textura"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Alterar Uniforme do Cubemap"
+
+#~ msgid "Change Comment"
+#~ msgstr "Alterar Comentário"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Adicionar/Remover para Curva de Cores"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modificar Curva de Cores"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Adicionar/Remover para Curve Map"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modificar Curve Map"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Alterar Nome da Entrada"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Conectar Nodes de Grafos"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Desconectar Nodes de Grafos"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Remover Nó de Shader Graph"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Mover Nó de Shader Graph"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplicar Nó(s) de Grafo(s)"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Deletar Nó(s) de Shader Graph(s)"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Erro: Vínculo de Conexão Cíclico"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Erro: Faltando as Conexões da Entrada"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Adicionar Nó de Shader Graph"
+
#~ msgid "Disabled"
#~ msgstr "Desabilitado"
diff --git a/editor/translations/pt_PT.po b/editor/translations/pt_PT.po
index 90cba5adfa..9a4a70a1fc 100644
--- a/editor/translations/pt_PT.po
+++ b/editor/translations/pt_PT.po
@@ -5832,134 +5832,6 @@ msgstr "Ajuda contextual"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Mudar constante escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Mudar constante vetorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Mudar constante RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Mudar operador escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Mudar operador vetorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Mudar operador escalar/vetorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Mudar operador RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Alternar só rotação"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Mudar Função escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Mudar Função vetorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Mudar uniforme escalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Mudar uniforme vetorial"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Mudar uniforme RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Mudar valor padrão"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Mudar uniforme XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Mudar uniforme textura"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Mudar uniforme Cubemap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Mudar comentário"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Adicionar/remover da rampa de cores"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modificar rampa de cores"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Adicionar/remover do mapa de curva"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Modificar mapa de curva"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Mudar nome de entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Conectar Nós do gráfico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Desconectar Nós do gráfico"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Remover Nó Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Mover Nó Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Duplicar Nó(s)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Apagar Nó(s) Shader"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Erro: conexão cíclica"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Erro: Faltam conexões de entrada"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Adicionar Nó Shader"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9601,6 +9473,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Mudar constante escalar"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Mudar constante vetorial"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Mudar constante RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Mudar operador escalar"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Mudar operador vetorial"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Mudar operador escalar/vetorial"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Mudar operador RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Alternar só rotação"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Mudar Função escalar"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Mudar Função vetorial"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Mudar uniforme escalar"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Mudar uniforme vetorial"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Mudar uniforme RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Mudar valor padrão"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Mudar uniforme XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Mudar uniforme textura"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Mudar uniforme Cubemap"
+
+#~ msgid "Change Comment"
+#~ msgstr "Mudar comentário"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Adicionar/remover da rampa de cores"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modificar rampa de cores"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Adicionar/remover do mapa de curva"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Modificar mapa de curva"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Mudar nome de entrada"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Conectar Nós do gráfico"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Desconectar Nós do gráfico"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Remover Nó Shader"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Mover Nó Shader"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Duplicar Nó(s)"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Apagar Nó(s) Shader"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Erro: conexão cíclica"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Erro: Faltam conexões de entrada"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Adicionar Nó Shader"
+
#~ msgid "Disabled"
#~ msgstr "Desativado"
diff --git a/editor/translations/ro.po b/editor/translations/ro.po
index 524d449391..f668c20d96 100644
--- a/editor/translations/ro.po
+++ b/editor/translations/ro.po
@@ -5815,134 +5815,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Modifică Rampa de Culori"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9406,6 +9278,9 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Modifică Rampa de Culori"
+
#~ msgid "Disabled"
#~ msgstr "Dezactivat"
diff --git a/editor/translations/ru.po b/editor/translations/ru.po
index 2588e2ec88..117fff72c3 100644
--- a/editor/translations/ru.po
+++ b/editor/translations/ru.po
@@ -5849,134 +5849,6 @@ msgstr "Контекстная справка"
msgid "Shader"
msgstr "Шейдер"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Изменить числовую константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Изменить векторную константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Изменить RGB константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Изменить числовой оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Изменить векторный оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Изменить векторно-числовой оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Изменить RGB оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Переключить - только поворот"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Изменить числовую функцию"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Изменить векторную функцию"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Изменить числовую единицу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Изменить векторную единицу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Изменить RGB единицу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Изменить значение по умолчанию"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Изменить XForm единицу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Изменить текстурную единицу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Изменить единицу кубической карты"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Изменить комментарий"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Добавить/Удалить в Color Ramp"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Редактировать Color Ramp"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Добавить/Удалить в Curve Map"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Редактировать карту кривой"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Изменить имя входа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Соединить узлы графа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Разъединить узлы графа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Удалить узел графа шейдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Передвинуть узел графа шейдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Дублировать узел(ы) графа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Удалить узел(ы) графа шейдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Ошибка: Циклическое подключение"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Ошибка: Отсутствует входное подключение"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Добавить узел графа шейдера"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9617,6 +9489,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Изменить числовую константу"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Изменить векторную константу"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Изменить RGB константу"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Изменить числовой оператор"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Изменить векторный оператор"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Изменить векторно-числовой оператор"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Изменить RGB оператор"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Переключить - только поворот"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Изменить числовую функцию"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Изменить векторную функцию"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Изменить числовую единицу"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Изменить векторную единицу"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Изменить RGB единицу"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Изменить значение по умолчанию"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Изменить XForm единицу"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Изменить текстурную единицу"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Изменить единицу кубической карты"
+
+#~ msgid "Change Comment"
+#~ msgstr "Изменить комментарий"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Добавить/Удалить в Color Ramp"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Редактировать Color Ramp"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Добавить/Удалить в Curve Map"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Редактировать карту кривой"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Изменить имя входа"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Соединить узлы графа"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Разъединить узлы графа"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Удалить узел графа шейдера"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Передвинуть узел графа шейдера"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Дублировать узел(ы) графа"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Удалить узел(ы) графа шейдера"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Ошибка: Циклическое подключение"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Ошибка: Отсутствует входное подключение"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Добавить узел графа шейдера"
+
#~ msgid "Disabled"
#~ msgstr "Отключено"
diff --git a/editor/translations/sk.po b/editor/translations/sk.po
index fb6bbcb1df..fd3f69f1d2 100644
--- a/editor/translations/sk.po
+++ b/editor/translations/sk.po
@@ -5632,134 +5632,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/sl.po b/editor/translations/sl.po
index 4eec1ad26f..707fc575e7 100644
--- a/editor/translations/sl.po
+++ b/editor/translations/sl.po
@@ -5792,134 +5792,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po
index 54151d3ab3..aa41c3e609 100644
--- a/editor/translations/sr_Cyrl.po
+++ b/editor/translations/sr_Cyrl.po
@@ -5835,134 +5835,6 @@ msgstr "Контекстуална помоћ"
msgid "Shader"
msgstr "Шејдер"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Промени скаларну константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Промени векторску константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Промени RGB константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Промени скаларни оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Промени векторски оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Промени векторско-скаларни оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Промени RGB оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Само ротација"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Промени скаларну функцију"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Промени векторску функцију"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Промени скаларну униформу (uniform)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Промени векторску униформу (uniform)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Промени RGB униформу (uniform)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Промени уобичајену вредност"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Промени XForm униформу (uniform)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Промени текстурну униформу (uniform)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Промени Cubemap униформу (uniform)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Промени коментар"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Додај/обириши из рампе боје"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Измени рампу боје"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Додај/обриши из мапе криве"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Модификуј мапу криве"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Промени улазно име"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Повежи чворове графа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Искључи чворове графа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Обриши чвор графа шејдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Помери чвор графа шејдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Дуплирај чвор/ове графа"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Обриши чвор/ове графа шејдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Грешка: пронађена циклична веза"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Грешка: недостаје улазна конекција"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Додај чвор графа шејдера"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9483,6 +9355,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Промени скаларну константу"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Промени векторску константу"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Промени RGB константу"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Промени скаларни оператор"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Промени векторски оператор"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Промени векторско-скаларни оператор"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Промени RGB оператор"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Само ротација"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Промени скаларну функцију"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Промени векторску функцију"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Промени скаларну униформу (uniform)"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Промени векторску униформу (uniform)"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Промени RGB униформу (uniform)"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Промени уобичајену вредност"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Промени XForm униформу (uniform)"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Промени текстурну униформу (uniform)"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Промени Cubemap униформу (uniform)"
+
+#~ msgid "Change Comment"
+#~ msgstr "Промени коментар"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Додај/обириши из рампе боје"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Измени рампу боје"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Додај/обриши из мапе криве"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Модификуј мапу криве"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Промени улазно име"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Повежи чворове графа"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Искључи чворове графа"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Обриши чвор графа шејдера"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Помери чвор графа шејдера"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Дуплирај чвор/ове графа"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Обриши чвор/ове графа шејдера"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Грешка: пронађена циклична веза"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Грешка: недостаје улазна конекција"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Додај чвор графа шејдера"
+
#~ msgid "Disabled"
#~ msgstr "Онемогућено"
diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po
index 0f23981fc1..d0458037ba 100644
--- a/editor/translations/sr_Latn.po
+++ b/editor/translations/sr_Latn.po
@@ -5566,134 +5566,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/sv.po b/editor/translations/sv.po
index 6e41fcbaa9..c9f39bdd5d 100644
--- a/editor/translations/sv.po
+++ b/editor/translations/sv.po
@@ -6121,135 +6121,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-#, fuzzy
-msgid "Change Comment"
-msgstr "Ändra Kommentar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9932,6 +9803,10 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#, fuzzy
+#~ msgid "Change Comment"
+#~ msgstr "Ändra Kommentar"
+
#~ msgid "Disabled"
#~ msgstr "Avaktiverad"
diff --git a/editor/translations/ta.po b/editor/translations/ta.po
index 20f7143578..c3084b15ba 100644
--- a/editor/translations/ta.po
+++ b/editor/translations/ta.po
@@ -5559,134 +5559,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/th.po b/editor/translations/th.po
index de5da160cd..7828977638 100644
--- a/editor/translations/th.po
+++ b/editor/translations/th.po
@@ -5771,134 +5771,6 @@ msgstr "ค้นหาคำที่เลือกในคู่มือ"
msgid "Shader"
msgstr "Shader"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "แก้ไขค่าคงที่สเกลาร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "แก้ไขค่าคงที่เวกเตอร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "แก้ไขค่าคงที่สี"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "แก้ไขเครื่องหมายสเกลาร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "แก้ไขเครื่องหมายเวกเตอร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "แก้ไขเครื่องหมายเวกเตอร์สเกลาร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "แก้ไขเครื่องหมาย RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "สลับเฉพาะการหมุน"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "แก้ไขฟังก์ชันสเกลาร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "แก้ไขฟังก์ชันเวกเตอร์"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "แก้ไขสเกลาร์ Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "แก้ไขเวกเตอร์ Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "แก้ไข RGB Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "แก้ไขค่าปริยาย"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "แก้ไข XForm Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "แก้ไข Texture Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "แก้ไข Cubemap Uniform"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "เปลี่ยนข้อคิดเห็น"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "เพิ่ม/ลบในการไล่สี"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "แก้ไขการไล่สี"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "เพิ่ม/ลบในเส้นโค้ง"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "แก้ไขเส้นโค้ง"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "เปลี่ยนชื่ออินพุต"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "เชื่อมต่อโหนด"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "ตัดการเชื่อมต่อโหนด"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "ลบโหนด"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "ย้ายโหนด"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "ทำซ้ำโหนด"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "ลบโหนด"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "ผิดพลาด: เชื่อมต่อเป็นวง"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "ผิดพลาด: ไม่มีขาเข้า"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "เพิ่มโหนด"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9461,6 +9333,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "แก้ไขค่าคงที่สเกลาร์"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "แก้ไขค่าคงที่เวกเตอร์"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "แก้ไขค่าคงที่สี"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "แก้ไขเครื่องหมายสเกลาร์"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "แก้ไขเครื่องหมายเวกเตอร์"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "แก้ไขเครื่องหมายเวกเตอร์สเกลาร์"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "แก้ไขเครื่องหมาย RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "สลับเฉพาะการหมุน"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "แก้ไขฟังก์ชันสเกลาร์"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "แก้ไขฟังก์ชันเวกเตอร์"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "แก้ไขสเกลาร์ Uniform"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "แก้ไขเวกเตอร์ Uniform"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "แก้ไข RGB Uniform"
+
+#~ msgid "Change Default Value"
+#~ msgstr "แก้ไขค่าปริยาย"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "แก้ไข XForm Uniform"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "แก้ไข Texture Uniform"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "แก้ไข Cubemap Uniform"
+
+#~ msgid "Change Comment"
+#~ msgstr "เปลี่ยนข้อคิดเห็น"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "เพิ่ม/ลบในการไล่สี"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "แก้ไขการไล่สี"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "เพิ่ม/ลบในเส้นโค้ง"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "แก้ไขเส้นโค้ง"
+
+#~ msgid "Change Input Name"
+#~ msgstr "เปลี่ยนชื่ออินพุต"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "เชื่อมต่อโหนด"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "ตัดการเชื่อมต่อโหนด"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "ลบโหนด"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "ย้ายโหนด"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "ทำซ้ำโหนด"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "ลบโหนด"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "ผิดพลาด: เชื่อมต่อเป็นวง"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "ผิดพลาด: ไม่มีขาเข้า"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "เพิ่มโหนด"
+
#~ msgid "Disabled"
#~ msgstr "ปิดใช้งาน"
diff --git a/editor/translations/tr.po b/editor/translations/tr.po
index 904af0db92..6b9de6a394 100644
--- a/editor/translations/tr.po
+++ b/editor/translations/tr.po
@@ -5836,134 +5836,6 @@ msgstr "Bağlamsal Yardım"
msgid "Shader"
msgstr "Gölgelendirici"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Basamaklı Sabiti Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Vec Sabitini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "RGB Sabitini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Skaler Operatörünü Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Vec İşletmenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Vec Basamaklı İşletmeni Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "RGB İşletmenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Yalnız Döndürmeye Geçiş Yap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Basamaklı İşlevi Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Vec İşlevini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Basamaklı Tekdüzenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Vec Tekdüzenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "RGB Tekdüzenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Varsayılan Değeri Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "XForm Tekdüzenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Doku Tekdüzenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Küp Eşleşme Tekdüzenini Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Yorumu Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Renk Yokuşuna Ekle / Kaldır"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Renk Yokuşunu Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Eğri Haritası Ekle / Kaldır"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Eğri Haritasını Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Giriş Adını Değiştir"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "Çizge Düğümlerini Bağla"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Çizge Düğümlerinin Bağlantılarını Kes"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Gölgelendirici Çizge Düğümünü Kaldır"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Gölgelendirici Çizge Düğümünü Taşı"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Grafik Düğüm(lerini) Çoğalt"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Gölgelendirici Çizge Düğümünü Sil"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Hata: Döngüsel Bağlantı Bağlantısı"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Hata: Girdi Bağlantıları Eksik"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Gölgelendirici Çizge Düğümü Ekle"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9598,6 +9470,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Basamaklı Sabiti Değiştir"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Vec Sabitini Değiştir"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "RGB Sabitini Değiştir"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Skaler Operatörünü Değiştir"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Vec İşletmenini Değiştir"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Vec Basamaklı İşletmeni Değiştir"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "RGB İşletmenini Değiştir"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Yalnız Döndürmeye Geçiş Yap"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Basamaklı İşlevi Değiştir"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Vec İşlevini Değiştir"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Basamaklı Tekdüzenini Değiştir"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Vec Tekdüzenini Değiştir"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "RGB Tekdüzenini Değiştir"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Varsayılan Değeri Değiştir"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "XForm Tekdüzenini Değiştir"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Doku Tekdüzenini Değiştir"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Küp Eşleşme Tekdüzenini Değiştir"
+
+#~ msgid "Change Comment"
+#~ msgstr "Yorumu Değiştir"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Renk Yokuşuna Ekle / Kaldır"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Renk Yokuşunu Değiştir"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Eğri Haritası Ekle / Kaldır"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Eğri Haritasını Değiştir"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Giriş Adını Değiştir"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "Çizge Düğümlerini Bağla"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Çizge Düğümlerinin Bağlantılarını Kes"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Gölgelendirici Çizge Düğümünü Kaldır"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Gölgelendirici Çizge Düğümünü Taşı"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Grafik Düğüm(lerini) Çoğalt"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Gölgelendirici Çizge Düğümünü Sil"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Hata: Döngüsel Bağlantı Bağlantısı"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Hata: Girdi Bağlantıları Eksik"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Gölgelendirici Çizge Düğümü Ekle"
+
#~ msgid "Disabled"
#~ msgstr "Devre dışı"
diff --git a/editor/translations/uk.po b/editor/translations/uk.po
index b0b029c9b2..153d01f551 100644
--- a/editor/translations/uk.po
+++ b/editor/translations/uk.po
@@ -5835,134 +5835,6 @@ msgstr "Контекстна довідка"
msgid "Shader"
msgstr "Шейдер"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "Змінити числову сталу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "Змінити векторну константу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "Змінити сталу RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "Змінити числовий оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "Змінити векторний оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "Змінити векторно-числовий оператор"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "Змінити оператор RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "Перемкнути лише поворот"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "Змінити скалярну функцію"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "Змінити векторну функцію"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "Змінити числову одиницю"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "Змінити векторну одиницю"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "Змінити одиницю RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "Змінити значення за промовчанням"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "Змінити одиницю XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "Змінити одиницю текстури"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "Змінити одиницю кубічної мапи"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "Змінити коментар"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "Додати до рампи кольорів або вилучити з неї"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "Змінити градієнт"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "Додати до карти кривих або вилучити з неї"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "Змінити карту кривої"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "Змінити назву входу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "З'єднати вузли графу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "Роз'єднати вузли графу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "Вилучити вузол графу шейдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "Пересунути вузол графу шейдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "Дублювати вузли графу"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "Вилучити взули графу шейдера"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "Помилка: циклічне посилання"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "Помилка: пропущено вхідні з'єднання"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "Додати вузол графу шейдера"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9606,6 +9478,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "Змінити числову сталу"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "Змінити векторну константу"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "Змінити сталу RGB"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "Змінити числовий оператор"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "Змінити векторний оператор"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "Змінити векторно-числовий оператор"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "Змінити оператор RGB"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "Перемкнути лише поворот"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "Змінити скалярну функцію"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "Змінити векторну функцію"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "Змінити числову одиницю"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "Змінити векторну одиницю"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "Змінити одиницю RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "Змінити значення за промовчанням"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "Змінити одиницю XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "Змінити одиницю текстури"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "Змінити одиницю кубічної мапи"
+
+#~ msgid "Change Comment"
+#~ msgstr "Змінити коментар"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "Додати до рампи кольорів або вилучити з неї"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "Змінити градієнт"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "Додати до карти кривих або вилучити з неї"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "Змінити карту кривої"
+
+#~ msgid "Change Input Name"
+#~ msgstr "Змінити назву входу"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "З'єднати вузли графу"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "Роз'єднати вузли графу"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "Вилучити вузол графу шейдера"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "Пересунути вузол графу шейдера"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "Дублювати вузли графу"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "Вилучити взули графу шейдера"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "Помилка: циклічне посилання"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "Помилка: пропущено вхідні з'єднання"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "Додати вузол графу шейдера"
+
#~ msgid "Disabled"
#~ msgstr "Вимкнено"
diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po
index 6f4d4e4032..47be7ef1d1 100644
--- a/editor/translations/ur_PK.po
+++ b/editor/translations/ur_PK.po
@@ -5601,134 +5601,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/vi.po b/editor/translations/vi.po
index 89ea2362f7..18d0de7612 100644
--- a/editor/translations/vi.po
+++ b/editor/translations/vi.po
@@ -5637,134 +5637,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po
index 586efb42f4..d1d840a745 100644
--- a/editor/translations/zh_CN.po
+++ b/editor/translations/zh_CN.po
@@ -5789,134 +5789,6 @@ msgstr "搜索光标位置"
msgid "Shader"
msgstr "着色器"
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr "修改Scalar常量系数"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr "修改Vec常量系数"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr "修改RGB常量系数"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr "更改标量运算符(Scalar Operator)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr "更改 Vec 运算符(Vec Operator)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr "更改Vec标量运算符(Vec Scalar Operator)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr "更改RGB运算符(RGB Operator)"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr "切换旋转模式"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr "修改Function Scalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr "修改Function Vec"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr "修改Uniform Scalar"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr "修改Uniform Vec"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr "修改Uniform RGB"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr "修改默认值"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr "修改Uniform XForm"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr "修改Uniform纹理"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr "修改Uniform Cubemap"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr "修改注释"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr "添加/删除颜色坡度"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr "修改色彩曲线图"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr "添加/删除曲线地图"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr "修改曲线图"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr "更改输入名称"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr "连接Graph Node"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr "断开Graph Node连接"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr "移除Graph Node节点"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr "移动Graph Node节点"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr "复制Graph Node节点"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr "删除Graph Node节点"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr "错误:循环的连接"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr "错误:缺少输入连接"
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr "添加着色器Graph Node"
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
@@ -9482,6 +9354,102 @@ msgstr ""
msgid "Varyings can only be assigned in vertex function."
msgstr ""
+#~ msgid "Change Scalar Constant"
+#~ msgstr "修改Scalar常量系数"
+
+#~ msgid "Change Vec Constant"
+#~ msgstr "修改Vec常量系数"
+
+#~ msgid "Change RGB Constant"
+#~ msgstr "修改RGB常量系数"
+
+#~ msgid "Change Scalar Operator"
+#~ msgstr "更改标量运算符(Scalar Operator)"
+
+#~ msgid "Change Vec Operator"
+#~ msgstr "更改 Vec 运算符(Vec Operator)"
+
+#~ msgid "Change Vec Scalar Operator"
+#~ msgstr "更改Vec标量运算符(Vec Scalar Operator)"
+
+#~ msgid "Change RGB Operator"
+#~ msgstr "更改RGB运算符(RGB Operator)"
+
+#~ msgid "Toggle Rot Only"
+#~ msgstr "切换旋转模式"
+
+#~ msgid "Change Scalar Function"
+#~ msgstr "修改Function Scalar"
+
+#~ msgid "Change Vec Function"
+#~ msgstr "修改Function Vec"
+
+#~ msgid "Change Scalar Uniform"
+#~ msgstr "修改Uniform Scalar"
+
+#~ msgid "Change Vec Uniform"
+#~ msgstr "修改Uniform Vec"
+
+#~ msgid "Change RGB Uniform"
+#~ msgstr "修改Uniform RGB"
+
+#~ msgid "Change Default Value"
+#~ msgstr "修改默认值"
+
+#~ msgid "Change XForm Uniform"
+#~ msgstr "修改Uniform XForm"
+
+#~ msgid "Change Texture Uniform"
+#~ msgstr "修改Uniform纹理"
+
+#~ msgid "Change Cubemap Uniform"
+#~ msgstr "修改Uniform Cubemap"
+
+#~ msgid "Change Comment"
+#~ msgstr "修改注释"
+
+#~ msgid "Add/Remove to Color Ramp"
+#~ msgstr "添加/删除颜色坡度"
+
+#~ msgid "Modify Color Ramp"
+#~ msgstr "修改色彩曲线图"
+
+#~ msgid "Add/Remove to Curve Map"
+#~ msgstr "添加/删除曲线地图"
+
+#~ msgid "Modify Curve Map"
+#~ msgstr "修改曲线图"
+
+#~ msgid "Change Input Name"
+#~ msgstr "更改输入名称"
+
+#~ msgid "Connect Graph Nodes"
+#~ msgstr "连接Graph Node"
+
+#~ msgid "Disconnect Graph Nodes"
+#~ msgstr "断开Graph Node连接"
+
+#~ msgid "Remove Shader Graph Node"
+#~ msgstr "移除Graph Node节点"
+
+#~ msgid "Move Shader Graph Node"
+#~ msgstr "移动Graph Node节点"
+
+#~ msgid "Duplicate Graph Node(s)"
+#~ msgstr "复制Graph Node节点"
+
+#~ msgid "Delete Shader Graph Node(s)"
+#~ msgstr "删除Graph Node节点"
+
+#~ msgid "Error: Cyclic Connection Link"
+#~ msgstr "错误:循环的连接"
+
+#~ msgid "Error: Missing Input Connections"
+#~ msgstr "错误:缺少输入连接"
+
+#~ msgid "Add Shader Graph Node"
+#~ msgstr "添加着色器Graph Node"
+
#~ msgid "Disabled"
#~ msgstr "已禁用"
diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po
index da699b0bc4..9897e6f5a5 100644
--- a/editor/translations/zh_HK.po
+++ b/editor/translations/zh_HK.po
@@ -5877,134 +5877,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po
index abaeb9af32..5ce0ea7f67 100644
--- a/editor/translations/zh_TW.po
+++ b/editor/translations/zh_TW.po
@@ -5748,134 +5748,6 @@ msgstr ""
msgid "Shader"
msgstr ""
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Constant"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Scalar Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Operator"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Toggle Rot Only"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Function"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Scalar Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Vec Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change RGB Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Default Value"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change XForm Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Texture Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Cubemap Uniform"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Comment"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Color Ramp"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add/Remove to Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Modify Curve Map"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Change Input Name"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Connect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Disconnect Graph Nodes"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Remove Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Move Shader Graph Node"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Duplicate Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Delete Shader Graph Node(s)"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Cyclic Connection Link"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Error: Missing Input Connections"
-msgstr ""
-
-#: editor/plugins/shader_graph_editor_plugin.cpp
-msgid "Add Shader Graph Node"
-msgstr ""
-
#: editor/plugins/skeleton_2d_editor_plugin.cpp
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 4363fc1c88..d074e05f43 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -265,9 +265,6 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
Ref<InputEventKey> k = p_event;
if (k.is_valid() && !k->is_echo() && k->get_scancode() != 0) {
-
- //print_line(p_event);
-
if (k->is_pressed())
keys_pressed.insert(k->get_scancode());
else
diff --git a/main/main.cpp b/main/main.cpp
index 2fd9cfa734..a336496d39 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -830,6 +830,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
video_driver = GLOBAL_GET("rendering/quality/driver/driver_name");
}
+ GLOBAL_DEF("rendering/quality/driver/driver_fallback", "Best");
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/driver/driver_fallback", PropertyInfo(Variant::STRING, "rendering/quality/driver/driver_fallback", PROPERTY_HINT_ENUM, "Best,Never"));
+
GLOBAL_DEF("display/window/size/width", 1024);
GLOBAL_DEF("display/window/size/height", 600);
GLOBAL_DEF("display/window/size/resizable", true);
@@ -1040,6 +1043,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (err != OK) {
return err;
}
+
if (init_use_custom_pos) {
OS::get_singleton()->set_window_position(init_custom_pos);
}
@@ -1092,7 +1096,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
boot_logo_path = boot_logo_path.strip_edges();
- if (boot_logo_path != String() /*&& FileAccess::exists(boot_logo_path)*/) {
+ if (boot_logo_path != String()) {
print_line("Boot splash path: " + boot_logo_path);
boot_logo.instance();
Error err = boot_logo->load(boot_logo_path);
@@ -1164,10 +1168,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) {
- //print_line("use custom cursor");
Ref<Texture> cursor = ResourceLoader::load(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image"));
if (cursor.is_valid()) {
- //print_line("loaded ok");
Vector2 hotspot = ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image_hotspot");
Input::get_singleton()->set_custom_mouse_cursor(cursor, Input::CURSOR_ARROW, hotspot);
}
@@ -1214,10 +1216,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
ClassDB::set_current_api(ClassDB::API_NONE); //no more api is registered at this point
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("CORE API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_CORE)));
- print_line("EDITOR API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_EDITOR)));
- }
+ print_verbose("CORE API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_CORE)));
+ print_verbose("EDITOR API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_EDITOR)));
MAIN_PRINT("Main: Done");
return OK;
diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format
index 016a43038b..4f13b2afcb 100755
--- a/misc/hooks/pre-commit-clang-format
+++ b/misc/hooks/pre-commit-clang-format
@@ -31,7 +31,7 @@ PARSE_EXTS=true
# File types to parse. Only effective when PARSE_EXTS is true.
# FILE_EXTS=".c .h .cpp .hpp"
-FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc *.java"
+FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc *.java *.glsl"
# Use pygmentize instead of cat to parse diff with highlighting.
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh
index 5463998720..ee4d0b2a10 100755
--- a/misc/travis/clang-format.sh
+++ b/misc/travis/clang-format.sh
@@ -11,7 +11,7 @@ else
RANGE=HEAD
fi
-FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java)$")
+FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
echo "Checking files:\n$FILES"
# create a random filename to store our generated patch
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index b004641838..3668088590 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -236,7 +236,7 @@ void AreaBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant &
set_spOv_gravityPointAttenuation(p_value);
break;
default:
- print_line("The Bullet areas doesn't suppot this param: " + itos(p_param));
+ WARN_PRINTS("Area doesn't support this parameter in the Bullet backend: " + itos(p_param));
}
}
@@ -259,7 +259,7 @@ Variant AreaBullet::get_param(PhysicsServer::AreaParameter p_param) const {
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
return spOv_gravityPointAttenuation;
default:
- print_line("The Bullet areas doesn't suppot this param: " + itos(p_param));
+ WARN_PRINTS("Area doesn't support this parameter in the Bullet backend: " + itos(p_param));
return Variant();
}
}
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 70f70e7e5f..dbd27a3564 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -1001,11 +1001,13 @@ void BulletPhysicsServer::soft_body_get_collision_exceptions(RID p_body, List<RI
}
void BulletPhysicsServer::soft_body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
- print_line("TODO MUST BE IMPLEMENTED");
+ // FIXME: Must be implemented.
+ WARN_PRINT("soft_body_state is not implemented yet in Bullet backend.");
}
Variant BulletPhysicsServer::soft_body_get_state(RID p_body, BodyState p_state) const {
- print_line("TODO MUST BE IMPLEMENTED");
+ // FIXME: Must be implemented.
+ WARN_PRINT("soft_body_state is not implemented yet in Bullet backend.");
return Variant();
}
@@ -1439,7 +1441,7 @@ RID BulletPhysicsServer::joint_create_generic_6dof(RID p_body_A, const Transform
ERR_FAIL_COND_V(body_A == body_B, RID());
- JointBullet *joint = bulletnew(Generic6DOFJointBullet(body_A, body_B, p_local_frame_A, p_local_frame_B, true));
+ JointBullet *joint = bulletnew(Generic6DOFJointBullet(body_A, body_B, p_local_frame_A, p_local_frame_B));
AddJointToSpace(body_A, joint);
CreateThenReturnRID(joint_owner, joint);
diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp
index 472ad3b52c..ecacce0bee 100644
--- a/modules/bullet/cone_twist_joint_bullet.cpp
+++ b/modules/bullet/cone_twist_joint_bullet.cpp
@@ -64,26 +64,6 @@ ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet
setup(coneConstraint);
}
-void ConeTwistJointBullet::set_angular_only(bool angularOnly) {
- coneConstraint->setAngularOnly(angularOnly);
-}
-
-void ConeTwistJointBullet::set_limit(real_t _swingSpan1, real_t _swingSpan2, real_t _twistSpan, real_t _softness, real_t _biasFactor, real_t _relaxationFactor) {
- coneConstraint->setLimit(_swingSpan1, _swingSpan2, _twistSpan, _softness, _biasFactor, _relaxationFactor);
-}
-
-int ConeTwistJointBullet::get_solve_twist_limit() {
- return coneConstraint->getSolveTwistLimit();
-}
-
-int ConeTwistJointBullet::get_solve_swing_limit() {
- return coneConstraint->getSolveSwingLimit();
-}
-
-real_t ConeTwistJointBullet::get_twist_limit_sign() {
- return coneConstraint->getTwistLimitSign();
-}
-
void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN:
@@ -103,7 +83,9 @@ void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param,
coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), coneConstraint->getLimitSoftness(), coneConstraint->getBiasFactor(), p_value);
break;
default:
- WARN_PRINT("This parameter is not supported by Bullet engine");
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED
+ break;
}
}
@@ -120,7 +102,8 @@ real_t ConeTwistJointBullet::get_param(PhysicsServer::ConeTwistJointParam p_para
case PhysicsServer::CONE_TWIST_JOINT_RELAXATION:
return coneConstraint->getRelaxationFactor();
default:
- WARN_PRINT("This parameter is not supported by Bullet engine");
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED;
return 0;
}
}
diff --git a/modules/bullet/cone_twist_joint_bullet.h b/modules/bullet/cone_twist_joint_bullet.h
index bd6eb49196..d6040fd6ec 100644
--- a/modules/bullet/cone_twist_joint_bullet.h
+++ b/modules/bullet/cone_twist_joint_bullet.h
@@ -47,14 +47,6 @@ public:
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; }
- void set_angular_only(bool angularOnly);
-
- void set_limit(real_t _swingSpan1, real_t _swingSpan2, real_t _twistSpan, real_t _softness = 0.8f, real_t _biasFactor = 0.3f, real_t _relaxationFactor = 1.0f);
- int get_solve_twist_limit();
-
- int get_solve_swing_limit();
- real_t get_twist_limit_sign();
-
void set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value);
real_t get_param(PhysicsServer::ConeTwistJointParam p_param) const;
};
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index adfad7803f..a36f1123bc 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -34,13 +34,13 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-#include <BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h>
+#include <BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h>
/**
@author AndreaCatania
*/
-Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) :
+Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) :
JointBullet() {
Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
@@ -58,9 +58,9 @@ Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBu
btTransform btFrameB;
G_TO_B(scaled_BFrame, btFrameB);
- sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, useLinearReferenceFrameA));
+ sixDOFConstraint = bulletnew(btGeneric6DofSpring2Constraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
} else {
- sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), btFrameA, useLinearReferenceFrameA));
+ sixDOFConstraint = bulletnew(btGeneric6DofSpring2Constraint(*rbA->get_bt_rigid_body(), btFrameA));
}
setup(sixDOFConstraint);
@@ -123,20 +123,11 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
switch (p_param) {
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
limits_lower[0][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
limits_upper[0][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
- break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
- sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
- sixDOFConstraint->getTranslationalLimitMotor()->m_restitution = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
- sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value;
@@ -146,23 +137,11 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
limits_lower[1][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
limits_upper[1][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value;
@@ -171,10 +150,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value;
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value;
+ sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce = p_value;
break;
default:
- WARN_PRINT("This parameter is not supported");
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED
+ break;
}
}
@@ -185,12 +166,6 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
return limits_lower[0][p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
return limits_upper[0][p_axis];
- case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness;
- case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_restitution;
- case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_damping;
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
return sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
@@ -199,23 +174,18 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
return limits_lower[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
return limits_upper[1][p_axis];
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping;
case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce;
case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP;
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity;
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce;
+ return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce;
default:
- WARN_PRINT("This parameter is not supported");
- return 0.;
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED;
+ return 0;
}
}
@@ -246,8 +216,9 @@ void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOF
sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = flags[p_axis][p_flag];
break;
default:
- WARN_PRINT("This flag is not supported by Bullet engine");
- return;
+ ERR_EXPLAIN("This flag " + itos(p_flag) + " is deprecated");
+ WARN_DEPRECATED
+ break;
}
}
diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h
index ad06582eac..176127ed6c 100644
--- a/modules/bullet/generic_6dof_joint_bullet.h
+++ b/modules/bullet/generic_6dof_joint_bullet.h
@@ -40,7 +40,7 @@
class RigidBodyBullet;
class Generic6DOFJointBullet : public JointBullet {
- class btGeneric6DofConstraint *sixDOFConstraint;
+ class btGeneric6DofSpring2Constraint *sixDOFConstraint;
// First is linear second is angular
Vector3 limits_lower[2];
@@ -48,7 +48,7 @@ class Generic6DOFJointBullet : public JointBullet {
bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX];
public:
- Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA);
+ Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB);
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; }
diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp
index 97ea7ca3df..86c6a632cd 100644
--- a/modules/bullet/hinge_joint_bullet.cpp
+++ b/modules/bullet/hinge_joint_bullet.cpp
@@ -95,11 +95,6 @@ real_t HingeJointBullet::get_hinge_angle() {
void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::HINGE_JOINT_BIAS:
- if (0 < p_value) {
- print_line("The Bullet Hinge Joint doesn't support bias, So it's always 0");
- }
- break;
case PhysicsServer::HINGE_JOINT_LIMIT_UPPER:
hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), p_value, hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
break;
@@ -122,7 +117,9 @@ void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t
hingeConstraint->setMaxMotorImpulse(p_value);
break;
default:
- WARN_PRINTS("The Bullet Hinge Joint doesn't support this parameter: " + itos(p_param) + ", value: " + itos(p_value));
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED
+ break;
}
}
@@ -146,7 +143,8 @@ real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const
case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE:
return hingeConstraint->getMaxMotorImpulse();
default:
- WARN_PRINTS("The Bullet Hinge Joint doesn't support this parameter: " + itos(p_param));
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED;
return 0;
}
}
diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp
index c4e5b8cdbe..183a7e75b9 100644
--- a/modules/bullet/pin_joint_bullet.cpp
+++ b/modules/bullet/pin_joint_bullet.cpp
@@ -85,7 +85,8 @@ real_t PinJointBullet::get_param(PhysicsServer::PinJointParam p_param) const {
case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP:
return p2pConstraint->m_setting.m_impulseClamp;
default:
- WARN_PRINTS("This get parameter is not supported");
+ ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
+ WARN_DEPRECATED
return 0;
}
}
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index b5329bc347..4a11bec5af 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -178,7 +178,9 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
space->dynamicsWorld->convexSweepTest(bt_convex_shape, bt_xform_from, bt_xform_to, btResult, 0.002);
if (btResult.hasHit()) {
- p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction;
+ const btScalar l = bt_motion.length();
+ p_closest_unsafe = btResult.m_closestHitFraction;
+ p_closest_safe = MAX(p_closest_unsafe - (1 - ((l - 0.01) / l)), 0);
if (r_info) {
if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) {
B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity);
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 9f2171a82a..258c628d93 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -161,8 +161,6 @@ CSGBrush *CSGShape::_get_brush() {
void CSGShape::_update_shape() {
- //print_line("updating shape for " + String(get_path()));
-
if (parent)
return;
@@ -372,7 +370,6 @@ void CSGShape::_notification(int p_what) {
if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
- //print_line("local xform changed");
if (parent) {
parent->_make_dirty();
}
@@ -641,7 +638,6 @@ CSGBrush *CSGMesh::_build_brush() {
}
}
- //print_line("total vertices? " + itos(vertices.size()));
if (vertices.size() == 0)
return NULL;
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 9424080b6d..3cb24d0407 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -217,8 +217,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
if (!(flags & DDSD_MIPMAPCOUNT))
mipmaps = 1;
- //print_line("found format: "+String(dds_format_info[dds_format].name));
-
PoolVector<uint8_t> src_data;
const DDSFormatInfo &info = dds_format_info[dds_format];
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index ddfa7af771..f5c817c816 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -199,7 +199,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
int wofs = 0;
- print_line("begin encoding, format: " + Image::get_format_name(etc_format));
+ print_verbose("ETC: Begin encoding, format: " + Image::get_format_name(etc_format));
uint64_t t = OS::get_singleton()->get_ticks_msec();
for (int i = 0; i < mmc; i++) {
// convert source image to internal etc2comp format (which is equivalent to Image::FORMAT_RGBAF)
@@ -227,7 +227,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
delete[] src_rgba_f;
}
- print_line("time encoding: " + rtos(OS::get_singleton()->get_ticks_msec() - t));
+ print_verbose("ETC: Time encoding: " + rtos(OS::get_singleton()->get_ticks_msec() - t));
p_img->create(imgw, imgh, p_img->has_mipmaps(), etc_format, dst_data);
}
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 5125b58b41..33d9c011f2 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -126,7 +126,10 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
GDScriptLanguage::singleton->lock->unlock();
#endif
- ERR_FAIL_COND_V(r_error.error != Variant::CallError::CALL_OK, NULL); //error constructing
+ if (r_error.error != Variant::CallError::CALL_OK) {
+ memdelete(instance);
+ ERR_FAIL_COND_V(r_error.error != Variant::CallError::CALL_OK, NULL); //error constructing
+ }
}
//@TODO make thread safe
@@ -294,11 +297,6 @@ bool GDScript::get_property_default_value(const StringName &p_property, Variant
#ifdef TOOLS_ENABLED
- /*
- for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
- print_line("\t"+String(String(I->key())+":"+String(I->get())));
- }
- */
const Map<StringName, Variant>::Element *E = member_default_values_cache.find(p_property);
if (E) {
r_value = E->get();
@@ -335,17 +333,8 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
#ifdef TOOLS_ENABLED
-
- //instance a fake script for editing the values
- //plist.invert();
-
- /*print_line("CREATING PLACEHOLDER");
- for(List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) {
- print_line(E->get().name);
- }*/
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(), Ref<Script>(this), p_this));
placeholders.insert(si);
- //_update_placeholder(si);
_update_exports();
return si;
#else
@@ -409,7 +398,6 @@ bool GDScript::_update_exports() {
bool changed = false;
if (source_changed_cache) {
- //print_line("updating source for "+get_path());
source_changed_cache = false;
changed = true;
@@ -456,11 +444,8 @@ bool GDScript::_update_exports() {
if (bf.is_valid()) {
- //print_line("parent is: "+bf->get_path());
base_cache = bf;
bf->inheriters_cache.insert(get_instance_id());
-
- //bf->_update_exports(p_instances,true,false);
}
} else {
ERR_PRINT(("Path extending itself in " + path).utf8().get_data());
@@ -475,7 +460,6 @@ bool GDScript::_update_exports() {
continue;
members_cache.push_back(c->variables[i]._export);
- //print_line("found "+c->variables[i]._export.name);
member_default_values_cache[c->variables[i].identifier] = c->variables[i].default_value;
}
@@ -490,7 +474,6 @@ bool GDScript::_update_exports() {
}
}
} else {
- //print_line("unchanged is "+get_path());
}
if (base_cache.is_valid()) {
@@ -499,11 +482,9 @@ bool GDScript::_update_exports() {
}
}
- if (/*changed &&*/ placeholders.size()) { //hm :(
+ if (placeholders.size()) { //hm :(
- //print_line("updating placeholders for "+get_path());
-
- //update placeholders if any
+ // update placeholders if any
Map<StringName, Variant> values;
List<PropertyInfo> propnames;
_update_exports_values(values, propnames);
@@ -529,7 +510,6 @@ void GDScript::update_exports() {
Set<ObjectID> copy = inheriters_cache; //might get modified
- //print_line("update exports for "+get_path()+" ic: "+itos(copy.size()));
for (Set<ObjectID>::Element *E = copy.front(); E; E = E->next()) {
Object *id = ObjectDB::get_instance(E->get());
GDScript *s = Object::cast_to<GDScript>(id);
@@ -742,22 +722,36 @@ Error GDScript::load_byte_code(const String &p_path) {
FileAccess *fa = FileAccess::open(p_path, FileAccess::READ);
ERR_FAIL_COND_V(!fa, ERR_CANT_OPEN);
+
FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
ERR_FAIL_COND_V(!fae, ERR_CANT_OPEN);
+
Vector<uint8_t> key;
key.resize(32);
for (int i = 0; i < key.size(); i++) {
key.write[i] = script_encryption_key[i];
}
+
Error err = fae->open_and_parse(fa, key, FileAccessEncrypted::MODE_READ);
- ERR_FAIL_COND_V(err, err);
+
+ if (err) {
+ fa->close();
+ memdelete(fa);
+ memdelete(fae);
+
+ ERR_FAIL_COND_V(err, err);
+ }
+
bytecode.resize(fae->get_len());
fae->get_buffer(bytecode.ptrw(), bytecode.size());
+ fae->close();
memdelete(fae);
+
} else {
bytecode = FileAccess::get_file_as_array(p_path);
}
+
ERR_FAIL_COND_V(bytecode.size() == 0, ERR_PARSE_ERROR);
path = p_path;
@@ -825,7 +819,6 @@ Error GDScript::load_source_code(const String &p_path) {
#ifdef TOOLS_ENABLED
source_changed_cache = true;
#endif
- //print_line("LSC :"+get_path());
path = p_path;
return OK;
}
@@ -1507,7 +1500,6 @@ int GDScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_
p_info_arr[current].self_time = elem->self()->profile.last_frame_self_time;
p_info_arr[current].total_time = elem->self()->profile.last_frame_total_time;
p_info_arr[current].signature = elem->self()->profile.signature;
- //print_line(String(elem->self()->profile.signature)+": "+itos(elem->self()->profile.last_frame_call_count));
current++;
}
elem = elem->next();
@@ -1546,7 +1538,7 @@ struct GDScriptDepSort {
void GDScriptLanguage::reload_all_scripts() {
#ifdef DEBUG_ENABLED
- print_line("RELOAD ALL SCRIPTS");
+ print_verbose("GDScript: Reloading all scripts");
if (lock) {
lock->lock();
}
@@ -1556,7 +1548,7 @@ void GDScriptLanguage::reload_all_scripts() {
SelfList<GDScript> *elem = script_list.first();
while (elem) {
if (elem->self()->get_path().is_resource_file()) {
- print_line("FOUND: " + elem->self()->get_path());
+ print_verbose("GDScript: Found: " + elem->self()->get_path());
scripts.push_back(Ref<GDScript>(elem->self())); //cast to gdscript to avoid being erased by accident
}
elem = elem->next();
@@ -1572,7 +1564,7 @@ void GDScriptLanguage::reload_all_scripts() {
for (List<Ref<GDScript> >::Element *E = scripts.front(); E; E = E->next()) {
- print_line("RELOADING: " + E->get()->get_path());
+ print_verbose("GDScript: Reloading: " + E->get()->get_path());
E->get()->load_source_code(E->get()->get_path());
E->get()->reload(true);
}
@@ -1703,7 +1695,6 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
void GDScriptLanguage::frame() {
- //print_line("calls: "+itos(calls));
calls = 0;
#ifdef DEBUG_ENABLED
@@ -2123,7 +2114,7 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori
Error err = script->load_byte_code(p_path);
if (err != OK) {
-
+ memdelete(script);
ERR_FAIL_COND_V(err != OK, RES());
}
@@ -2131,7 +2122,7 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori
Error err = script->load_source_code(p_path);
if (err != OK) {
-
+ memdelete(script);
ERR_FAIL_COND_V(err != OK, RES());
}
@@ -2146,6 +2137,7 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori
return scriptres;
}
+
void ResourceFormatLoaderGDScript::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("gd");
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 368601127d..3b494dbae7 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -1009,8 +1009,6 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
return prev_pos;
int retval = prev_pos;
- //print_line("retval: "+itos(retval));
-
if (retval & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
slevel++;
codegen.alloc_stack(slevel);
@@ -1324,6 +1322,8 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
int ret = _parse_expression(codegen, op, p_stack_level);
if (ret < 0) {
+ memdelete(id);
+ memdelete(op);
return ERR_PARSE_ERROR;
}
@@ -1343,6 +1343,8 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
// compile the condition
int ret = _parse_expression(codegen, branch.compiled_pattern, p_stack_level);
if (ret < 0) {
+ memdelete(id);
+ memdelete(op);
return ERR_PARSE_ERROR;
}
@@ -1355,6 +1357,8 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
Error err = _parse_block(codegen, branch.body, p_stack_level, p_break_addr, continue_addr);
if (err) {
+ memdelete(id);
+ memdelete(op);
return ERR_PARSE_ERROR;
}
@@ -1366,6 +1370,9 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
codegen.opcodes.write[break_addr + 1] = codegen.opcodes.size();
+ memdelete(id);
+ memdelete(op);
+
} break;
case GDScriptParser::ControlFlowNode::CF_IF: {
@@ -2073,8 +2080,6 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
//validate instances if keeping state
if (p_keep_state) {
-
- print_line("RELOAD KEEP " + p_script->path);
for (Set<Object *>::Element *E = p_script->instances.front(); E;) {
Set<Object *>::Element *N = E->next();
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 934c93059a..d3068fb6d0 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -63,8 +63,8 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
String _template = "extends %BASE%\n"
"\n"
"# Declare member variables here. Examples:\n"
- "# var a %INT_TYPE%= 2\n"
- "# var b %STRING_TYPE%= \"text\"\n"
+ "# var a%INT_TYPE% = 2\n"
+ "# var b%STRING_TYPE% = \"text\"\n"
"\n"
"# Called when the node enters the scene tree for the first time.\n"
"func _ready()%VOID_RETURN%:\n"
@@ -76,9 +76,9 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
#ifdef TOOLS_ENABLED
if (EDITOR_DEF("text_editor/completion/add_type_hints", false)) {
- _template = _template.replace("%INT_TYPE%", ": int ");
- _template = _template.replace("%STRING_TYPE%", ": String ");
- _template = _template.replace("%FLOAT_TYPE%", " : float");
+ _template = _template.replace("%INT_TYPE%", ": int");
+ _template = _template.replace("%STRING_TYPE%", ": String");
+ _template = _template.replace("%FLOAT_TYPE%", ": float");
_template = _template.replace("%VOID_RETURN%", " -> void");
} else {
_template = _template.replace("%INT_TYPE%", "");
@@ -192,7 +192,6 @@ int GDScriptLanguage::find_function(const String &p_function, const String &p_co
if (tokenizer.get_token() == GDScriptTokenizer::TK_NEWLINE) {
indent = tokenizer.get_token_line_indent();
}
- //print_line("TOKEN: "+String(GDScriptTokenizer::get_token_name(tokenizer.get_token())));
if (indent == 0 && tokenizer.get_token() == GDScriptTokenizer::TK_PR_FUNCTION && tokenizer.get_token(1) == GDScriptTokenizer::TK_IDENTIFIER) {
String identifier = tokenizer.get_token_identifier(1);
@@ -201,7 +200,6 @@ int GDScriptLanguage::find_function(const String &p_function, const String &p_co
}
}
tokenizer.advance();
- //print_line("NEXT: "+String(GDScriptTokenizer::get_token_name(tokenizer.get_token())));
}
return -1;
}
@@ -468,7 +466,7 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na
if (th) {
String type = p_args[i].get_slice(":", 1);
if (!type.empty() && type != "var") {
- s += " : " + type;
+ s += ": " + type;
}
}
}
@@ -2598,7 +2596,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
}
method_hint += arg;
if (use_type_hint && mi.arguments[i].type != Variant::NIL) {
- method_hint += " : ";
+ method_hint += ": ";
if (mi.arguments[i].type == Variant::OBJECT && mi.arguments[i].class_name != StringName()) {
method_hint += mi.arguments[i].class_name.operator String();
} else {
@@ -2930,7 +2928,6 @@ void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_t
break;
}
- //print_line(itos(indent_stack.size())+","+itos(tc)+": "+l);
lines.write[i] = l;
}
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index f2e52d48dd..d9c20868bd 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -642,7 +642,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
str += p_args[i]->operator String();
}
- //str+="\n";
print_line(str);
r_ret = Variant();
@@ -657,7 +656,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
str += p_args[i]->operator String();
}
- //str+="\n";
print_line(str);
r_ret = Variant();
@@ -672,7 +670,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
str += p_args[i]->operator String();
}
- //str+="\n";
print_line(str);
r_ret = Variant();
@@ -686,7 +683,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
str += p_args[i]->operator String();
}
- //str+="\n";
print_error(str);
r_ret = Variant();
@@ -698,7 +694,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
str += p_args[i]->operator String();
}
- //str+="\n";
OS::get_singleton()->print("%s", str.utf8().get_data());
r_ret = Variant();
@@ -716,7 +711,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
str += "At: " + script->debug_get_stack_level_source(0) + ":" + itos(script->debug_get_stack_level_line(0)); // + " in function '" + script->debug_get_stack_level_function(0) + "'";
}
- //str+="\n";
print_line(str);
r_ret = Variant();
} break;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 8dfc97b492..930f99fbf7 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -1074,9 +1074,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
} else {
//find list [ or find dictionary {
-
- //print_line("found bug?");
-
_set_error("Error parsing expression, misplaced: " + String(tokenizer->get_token_name(tokenizer->get_token())));
return NULL; //nothing
}
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 537a0c5eaf..6e7842f190 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -937,7 +937,6 @@ void GDScriptTokenizerText::_advance() {
_make_constant(val);
} else if (period_found || exponent_found) {
double val = str.to_double();
- //print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val));
_make_constant(val);
} else {
int64_t val = str.to_int64();
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 8b63987cde..776c18da64 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -486,8 +486,6 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
if (!mesh_library.is_valid() || !mesh_library->has_item(c.item))
continue;
- //print_line("OCTANT, CELLS: "+itos(ii.cells.size()));
-
Vector3 cellpos = Vector3(E->get().x, E->get().y, E->get().z);
Vector3 ofs = _get_offset();
@@ -524,8 +522,6 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
if (g.collision_debug.is_valid()) {
shapes.write[i].shape->add_vertices_to_array(col_debug, xform * shapes[i].local_transform);
}
-
- //print_line("PHIS x: "+xform);
}
// add the item's navmesh at given xform to GridMap's Navigation ancestor
@@ -614,7 +610,6 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
Octant &g = *octant_map[p_key];
PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
PhysicsServer::get_singleton()->body_set_space(g.static_body, get_world()->get_space());
- //print_line("BODYPOS: "+get_global_transform());
if (g.collision_debug_instance.is_valid()) {
VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario());
@@ -1086,7 +1081,6 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe
for (Map<OctantKey, Map<Ref<Material>, Ref<SurfaceTool> > >::Element *E = surface_map.front(); E; E = E->next()) {
- print_line("generating mesh " + itos(ofs++) + "/" + itos(surface_map.size()));
Ref<ArrayMesh> mesh;
mesh.instance();
for (Map<Ref<Material>, Ref<SurfaceTool> >::Element *F = E->get().front(); F; F = F->next()) {
diff --git a/modules/mobile_vr/shaders/lens_distorted.glsl b/modules/mobile_vr/shaders/lens_distorted.glsl
index 5a2975d737..92604c891c 100644
--- a/modules/mobile_vr/shaders/lens_distorted.glsl
+++ b/modules/mobile_vr/shaders/lens_distorted.glsl
@@ -1,7 +1,9 @@
+/* clang-format off */
[vertex]
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
uniform float offset_x;
@@ -9,13 +11,15 @@ out vec2 uv_interp;
void main() {
- uv_interp = uv_in;
- gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0);
+ uv_interp = uv_in;
+ gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0);
}
+/* clang-format off */
[fragment]
uniform sampler2D source; //texunit:0
+/* clang-format on */
uniform vec2 eye_center;
uniform float k1;
@@ -28,32 +32,31 @@ in vec2 uv_interp;
layout(location = 0) out vec4 frag_color;
void main() {
- vec2 coords = uv_interp;
- vec2 offset = coords - eye_center;
-
- // take aspect ratio into account
- offset.y /= aspect_ratio;
-
- // distort
- vec2 offset_sq = offset * offset;
- float radius_sq = offset_sq.x + offset_sq.y;
- float radius_s4 = radius_sq * radius_sq;
- float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4);
- offset *= distortion_scale;
-
- // reapply aspect ratio
- offset.y *= aspect_ratio;
-
- // add our eye center back in
- coords = offset + eye_center;
- coords /= upscale;
-
- // and check our color
- if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) {
- frag_color = vec4(0.0, 0.0, 0.0, 1.0);
- } else {
- coords = (coords + vec2(1.0)) / vec2(2.0);
- frag_color = textureLod(source, coords, 0.0);
- }
+ vec2 coords = uv_interp;
+ vec2 offset = coords - eye_center;
+
+ // take aspect ratio into account
+ offset.y /= aspect_ratio;
+
+ // distort
+ vec2 offset_sq = offset * offset;
+ float radius_sq = offset_sq.x + offset_sq.y;
+ float radius_s4 = radius_sq * radius_sq;
+ float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4);
+ offset *= distortion_scale;
+
+ // reapply aspect ratio
+ offset.y *= aspect_ratio;
+
+ // add our eye center back in
+ coords = offset + eye_center;
+ coords /= upscale;
+
+ // and check our color
+ if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) {
+ frag_color = vec4(0.0, 0.0, 0.0, 1.0);
+ } else {
+ coords = (coords + vec2(1.0)) / vec2(2.0);
+ frag_color = textureLod(source, coords, 0.0);
+ }
}
-
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index cd1a8266ed..d2a861dbe8 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1013,6 +1013,69 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) {
#endif
}
+void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
+
+ Reference *ref_owner = Object::cast_to<Reference>(p_object);
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(!ref_owner);
+#endif
+
+ void *data = p_object->get_script_instance_binding(get_language_index());
+ if (!data)
+ return;
+ Ref<MonoGCHandle> &gchandle = ((Map<Object *, Ref<MonoGCHandle> >::Element *)data)->get();
+
+ if (ref_owner->reference_get_count() > 1 && gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
+ // The reference count was increased after the managed side was the only one referencing our owner.
+ // This means the owner is being referenced again by the unmanaged side,
+ // so the owner must hold the managed side alive again to avoid it from being GCed.
+
+ MonoObject *target = gchandle->get_target();
+ if (!target)
+ return; // Called after the managed side was collected, so nothing to do here
+
+ // Release the current weak handle and replace it with a strong handle.
+ uint32_t strong_gchandle = MonoGCHandle::make_strong_handle(target);
+ gchandle->release();
+ gchandle->set_handle(strong_gchandle, MonoGCHandle::STRONG_HANDLE);
+ }
+}
+
+bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
+
+ Reference *ref_owner = Object::cast_to<Reference>(p_object);
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(!ref_owner);
+#endif
+
+ int refcount = ref_owner->reference_get_count();
+
+ void *data = p_object->get_script_instance_binding(get_language_index());
+ if (!data)
+ return refcount == 0;
+ Ref<MonoGCHandle> &gchandle = ((Map<Object *, Ref<MonoGCHandle> >::Element *)data)->get();
+
+ if (refcount == 1 && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
+ // If owner owner is no longer referenced by the unmanaged side,
+ // the managed instance takes responsibility of deleting the owner when GCed.
+
+ MonoObject *target = gchandle->get_target();
+ if (!target)
+ return refcount == 0; // Called after the managed side was collected, so nothing to do here
+
+ // Release the current strong handle and replace it with a weak handle.
+ uint32_t weak_gchandle = MonoGCHandle::make_weak_handle(target);
+ gchandle->release();
+ gchandle->set_handle(weak_gchandle, MonoGCHandle::WEAK_HANDLE);
+
+ return false;
+ }
+
+ return refcount == 0;
+}
+
CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<MonoGCHandle> &p_gchandle) {
CSharpInstance *instance = memnew(CSharpInstance);
@@ -1303,11 +1366,13 @@ void CSharpInstance::mono_object_disposed() {
void CSharpInstance::refcount_incremented() {
+#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
+#endif
Reference *ref_owner = Object::cast_to<Reference>(owner);
- if (ref_owner->reference_get_count() > 1) { // The managed side also holds a reference, hence 1 instead of 0
+ if (ref_owner->reference_get_count() > 1 && gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
// The reference count was increased after the managed side was the only one referencing our owner.
// This means the owner is being referenced again by the unmanaged side,
// so the owner must hold the managed side alive again to avoid it from being GCed.
@@ -1315,26 +1380,28 @@ void CSharpInstance::refcount_incremented() {
// Release the current weak handle and replace it with a strong handle.
uint32_t strong_gchandle = MonoGCHandle::make_strong_handle(gchandle->get_target());
gchandle->release();
- gchandle->set_handle(strong_gchandle);
+ gchandle->set_handle(strong_gchandle, MonoGCHandle::STRONG_HANDLE);
}
}
bool CSharpInstance::refcount_decremented() {
+#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
+#endif
Reference *ref_owner = Object::cast_to<Reference>(owner);
int refcount = ref_owner->reference_get_count();
- if (refcount == 1) { // The managed side also holds a reference, hence 1 instead of 0
+ if (refcount == 1 && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
// If owner owner is no longer referenced by the unmanaged side,
// the managed instance takes responsibility of deleting the owner when GCed.
// Release the current strong handle and replace it with a weak handle.
uint32_t weak_gchandle = MonoGCHandle::make_weak_handle(gchandle->get_target());
gchandle->release();
- gchandle->set_handle(weak_gchandle);
+ gchandle->set_handle(weak_gchandle, MonoGCHandle::WEAK_HANDLE);
return false;
}
@@ -2118,11 +2185,7 @@ Error CSharpScript::reload(bool p_keep_state) {
if (script_class) {
#ifdef DEBUG_ENABLED
- if (OS::get_singleton()->is_stdout_verbose()) {
- OS::get_singleton()->print(String("Found class " + script_class->get_namespace() + "." +
- script_class->get_name() + " for script " + get_path() + "\n")
- .utf8());
- }
+ print_verbose("Found class " + script_class->get_namespace() + "." + script_class->get_name() + " for script " + get_path());
#endif
tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute));
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 53644eafae..1a5d0c8a69 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -346,6 +346,8 @@ public:
// Don't use these. I'm watching you
virtual void *alloc_instance_binding_data(Object *p_object);
virtual void free_instance_binding_data(void *p_data);
+ virtual void refcount_incremented_instance_binding(Object *p_object);
+ virtual bool refcount_decremented_instance_binding(Object *p_object);
#ifdef DEBUG_ENABLED
Vector<StackInfo> stack_trace_get_info(MonoObject *p_stack_trace);
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index b97bb5e95f..4185f3407d 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -533,7 +533,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
cs_icalls_content.push_back("using System;\n"
"using System.Runtime.CompilerServices;\n"
- "using System.Collections.Generic;\n"
+ "using " BINDINGS_NAMESPACE_COLLECTIONS ";\n"
"\n");
cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
cs_icalls_content.push_back(INDENT1 "internal static class " BINDINGS_CLASS_NATIVECALLS "\n" INDENT1 OPEN_BLOCK);
@@ -638,7 +638,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
cs_icalls_content.push_back("using System;\n"
"using System.Runtime.CompilerServices;\n"
- "using System.Collections.Generic;\n"
+ "using " BINDINGS_NAMESPACE_COLLECTIONS ";\n"
"\n");
cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
cs_icalls_content.push_back(INDENT1 "internal static class " BINDINGS_CLASS_NATIVECALLS_EDITOR "\n" INDENT1 OPEN_BLOCK);
@@ -713,7 +713,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back("using System;\n"); // IntPtr
if (itype.requires_collections)
- output.push_back("using System.Collections.Generic;\n"); // Dictionary
+ output.push_back("using " BINDINGS_NAMESPACE_COLLECTIONS ";\n"); // Dictionary
output.push_back("\nnamespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
@@ -1922,7 +1922,7 @@ void BindingsGenerator::_populate_object_type_interfaces() {
imethod.return_type.cname = Variant::get_type_name(return_info.type);
}
- if (!itype.requires_collections && imethod.return_type.cname == name_cache.type_Dictionary)
+ if (!itype.requires_collections && imethod.return_type.cname == name_cache.type_Dictionary || imethod.return_type.cname == name_cache.type_Array)
itype.requires_collections = true;
for (int i = 0; i < argc; i++) {
@@ -1946,7 +1946,7 @@ void BindingsGenerator::_populate_object_type_interfaces() {
iarg.name = escape_csharp_keyword(snake_to_camel_case(iarg.name));
- if (!itype.requires_collections && iarg.type.cname == name_cache.type_Dictionary)
+ if (!itype.requires_collections && iarg.type.cname == name_cache.type_Dictionary || imethod.return_type.cname == name_cache.type_Array)
itype.requires_collections = true;
if (m && m->has_default_argument(i)) {
@@ -2371,14 +2371,14 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype = TypeInterface();
itype.name = "Array";
itype.cname = itype.name;
- itype.proxy_name = "Array";
+ itype.proxy_name = "Collections.Array";
itype.c_out = "\treturn memnew(Array(%1));\n";
itype.c_type = itype.name;
itype.c_type_in = itype.c_type + "*";
itype.c_type_out = itype.c_type + "*";
itype.cs_type = itype.proxy_name;
itype.cs_in = "%0." CS_SMETHOD_GETINSTANCE "()";
- itype.cs_out = "return new Array(%0);";
+ itype.cs_out = "return new Collections.Array(%0);";
itype.im_type_in = "IntPtr";
itype.im_type_out = "IntPtr";
builtin_types.insert(itype.cname, itype);
@@ -2387,14 +2387,14 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype = TypeInterface();
itype.name = "Dictionary";
itype.cname = itype.name;
- itype.proxy_name = "Dictionary";
+ itype.proxy_name = "Collections.Dictionary";
itype.c_out = "\treturn memnew(Dictionary(%1));\n";
itype.c_type = itype.name;
itype.c_type_in = itype.c_type + "*";
itype.c_type_out = itype.c_type + "*";
itype.cs_type = itype.proxy_name;
itype.cs_in = "%0." CS_SMETHOD_GETINSTANCE "()";
- itype.cs_out = "return new Dictionary(%0);";
+ itype.cs_out = "return new Collections.Dictionary(%0);";
itype.im_type_in = "IntPtr";
itype.im_type_out = "IntPtr";
builtin_types.insert(itype.cname, itype);
@@ -2441,7 +2441,7 @@ void BindingsGenerator::_populate_builtin_type(TypeInterface &r_itype, Variant::
else
iarg.type.cname = Variant::get_type_name(pi.type);
- if (!r_itype.requires_collections && iarg.type.cname == name_cache.type_Dictionary)
+ if (!r_itype.requires_collections && iarg.type.cname == name_cache.type_Dictionary || imethod.return_type.cname == name_cache.type_Array)
r_itype.requires_collections = true;
if ((mi.default_arguments.size() - mi.arguments.size() + i) >= 0)
@@ -2457,7 +2457,7 @@ void BindingsGenerator::_populate_builtin_type(TypeInterface &r_itype, Variant::
imethod.return_type.cname = Variant::get_type_name(mi.return_val.type);
}
- if (!r_itype.requires_collections && imethod.return_type.cname == name_cache.type_Dictionary)
+ if (!r_itype.requires_collections && imethod.return_type.cname == name_cache.type_Dictionary || imethod.return_type.cname == name_cache.type_Array)
r_itype.requires_collections = true;
if (r_itype.class_doc) {
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index 0fb8734410..2faab1718d 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -97,8 +97,7 @@ MonoString *godot_icall_BuildInstance_get_MSBuildPath() {
return GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
}
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'...\n");
+ print_verbose("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'...");
} // FALL THROUGH
case GodotSharpBuilds::MSBUILD_MONO: {
String msbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("msbuild.bat");
@@ -556,8 +555,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
exited = true;
exit_code = klass->get_field("exitCode")->get_int_value(mono_object);
- if (exit_code != 0 && OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print(String("MSBuild finished with exit code " + itos(exit_code) + "\n").utf8());
+ if (exit_code != 0) {
+ print_verbose("MSBuild finished with exit code " + itos(exit_code));
+ }
build_tab->on_build_exit(exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR);
} else {
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index 148bb32398..bb218b49b7 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -209,32 +209,32 @@ bool godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key, MonoOb
}
void godot_register_collections_icalls() {
- mono_add_internal_call("Godot.Array::godot_icall_Array_Ctor", (void *)godot_icall_Array_Ctor);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Dtor", (void *)godot_icall_Array_Dtor);
- mono_add_internal_call("Godot.Array::godot_icall_Array_At", (void *)godot_icall_Array_At);
- mono_add_internal_call("Godot.Array::godot_icall_Array_SetAt", (void *)godot_icall_Array_SetAt);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Count", (void *)godot_icall_Array_Count);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Add", (void *)godot_icall_Array_Add);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Clear", (void *)godot_icall_Array_Clear);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Contains", (void *)godot_icall_Array_Contains);
- mono_add_internal_call("Godot.Array::godot_icall_Array_CopyTo", (void *)godot_icall_Array_CopyTo);
- mono_add_internal_call("Godot.Array::godot_icall_Array_IndexOf", (void *)godot_icall_Array_IndexOf);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Insert", (void *)godot_icall_Array_Insert);
- mono_add_internal_call("Godot.Array::godot_icall_Array_Remove", (void *)godot_icall_Array_Remove);
- mono_add_internal_call("Godot.Array::godot_icall_Array_RemoveAt", (void *)godot_icall_Array_RemoveAt);
-
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Ctor", (void *)godot_icall_Dictionary_Ctor);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Dtor", (void *)godot_icall_Dictionary_Dtor);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_GetValue", (void *)godot_icall_Dictionary_GetValue);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_SetValue", (void *)godot_icall_Dictionary_SetValue);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Keys", (void *)godot_icall_Dictionary_Keys);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Values", (void *)godot_icall_Dictionary_Values);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Count", (void *)godot_icall_Dictionary_Count);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Add", (void *)godot_icall_Dictionary_Add);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Clear", (void *)godot_icall_Dictionary_Clear);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Contains", (void *)godot_icall_Dictionary_Contains);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_ContainsKey", (void *)godot_icall_Dictionary_ContainsKey);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_RemoveKey", (void *)godot_icall_Dictionary_RemoveKey);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_Remove", (void *)godot_icall_Dictionary_Remove);
- mono_add_internal_call("Godot.Dictionary::godot_icall_Dictionary_TryGetValue", (void *)godot_icall_Dictionary_TryGetValue);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Ctor", (void *)godot_icall_Array_Ctor);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Dtor", (void *)godot_icall_Array_Dtor);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_At", (void *)godot_icall_Array_At);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_SetAt", (void *)godot_icall_Array_SetAt);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Count", (void *)godot_icall_Array_Count);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Add", (void *)godot_icall_Array_Add);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Clear", (void *)godot_icall_Array_Clear);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Contains", (void *)godot_icall_Array_Contains);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_CopyTo", (void *)godot_icall_Array_CopyTo);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_IndexOf", (void *)godot_icall_Array_IndexOf);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Insert", (void *)godot_icall_Array_Insert);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Remove", (void *)godot_icall_Array_Remove);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_RemoveAt", (void *)godot_icall_Array_RemoveAt);
+
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Ctor", (void *)godot_icall_Dictionary_Ctor);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Dtor", (void *)godot_icall_Dictionary_Dtor);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_GetValue", (void *)godot_icall_Dictionary_GetValue);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_SetValue", (void *)godot_icall_Dictionary_SetValue);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Keys", (void *)godot_icall_Dictionary_Keys);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Values", (void *)godot_icall_Dictionary_Values);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Count", (void *)godot_icall_Dictionary_Count);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Add", (void *)godot_icall_Dictionary_Add);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Clear", (void *)godot_icall_Dictionary_Clear);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Contains", (void *)godot_icall_Dictionary_Contains);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_ContainsKey", (void *)godot_icall_Dictionary_ContainsKey);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_RemoveKey", (void *)godot_icall_Dictionary_RemoveKey);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Remove", (void *)godot_icall_Dictionary_Remove);
+ mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_TryGetValue", (void *)godot_icall_Dictionary_TryGetValue);
}
diff --git a/modules/mono/glue/cs_files/Array.cs b/modules/mono/glue/cs_files/Array.cs
index 1ec4d7d20a..2f0185b1e3 100644
--- a/modules/mono/glue/cs_files/Array.cs
+++ b/modules/mono/glue/cs_files/Array.cs
@@ -4,7 +4,7 @@ using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-namespace Godot
+namespace Godot.Collections
{
class ArraySafeHandle : SafeHandle
{
diff --git a/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs b/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs
new file mode 100644
index 0000000000..6adf044886
--- /dev/null
+++ b/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
+ public class ExportAttribute : Attribute
+ {
+ private PropertyHint hint;
+ private string hintString;
+
+ public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "")
+ {
+ this.hint = hint;
+ this.hintString = hintString;
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/GodotMethodAttribute.cs b/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs
index 55848769d5..55848769d5 100644
--- a/modules/mono/glue/cs_files/GodotMethodAttribute.cs
+++ b/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs
diff --git a/modules/mono/glue/cs_files/RPCAttributes.cs b/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs
index 6bf9560bfa..6bf9560bfa 100644
--- a/modules/mono/glue/cs_files/RPCAttributes.cs
+++ b/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs
diff --git a/modules/mono/glue/cs_files/SignalAttribute.cs b/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs
index 3957387be9..3957387be9 100644
--- a/modules/mono/glue/cs_files/SignalAttribute.cs
+++ b/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs
diff --git a/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs b/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs
new file mode 100644
index 0000000000..d0437409af
--- /dev/null
+++ b/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public class ToolAttribute : Attribute {}
+}
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs
index c280d32c61..10286f3832 100644
--- a/modules/mono/glue/cs_files/Basis.cs
+++ b/modules/mono/glue/cs_files/Basis.cs
@@ -426,7 +426,7 @@ namespace Godot
public Basis(Quat quat)
{
- real_t s = 2.0f / quat.LengthSquared();
+ real_t s = 2.0f / quat.LengthSquared;
real_t xs = quat.x * s;
real_t ys = quat.y * s;
diff --git a/modules/mono/glue/cs_files/Dictionary.cs b/modules/mono/glue/cs_files/Dictionary.cs
index 30d17c2a59..64cb9f935d 100644
--- a/modules/mono/glue/cs_files/Dictionary.cs
+++ b/modules/mono/glue/cs_files/Dictionary.cs
@@ -4,7 +4,7 @@ using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-namespace Godot
+namespace Godot.Collections
{
class DictionarySafeHandle : SafeHandle
{
diff --git a/modules/mono/glue/cs_files/ExportAttribute.cs b/modules/mono/glue/cs_files/ExportAttribute.cs
deleted file mode 100644
index e6f569e1bb..0000000000
--- a/modules/mono/glue/cs_files/ExportAttribute.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-
-namespace Godot
-{
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
- public class ExportAttribute : Attribute
- {
- private PropertyHint hint;
- private string hintString;
-
- public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "")
- {
- this.hint = hint;
- this.hintString = hintString;
- }
- }
-}
diff --git a/modules/mono/glue/cs_files/NodeExtensions.cs b/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs
index 71534d7782..71534d7782 100644
--- a/modules/mono/glue/cs_files/NodeExtensions.cs
+++ b/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs
diff --git a/modules/mono/glue/cs_files/ObjectExtensions.cs b/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs
index 5c9e6609f4..5c9e6609f4 100644
--- a/modules/mono/glue/cs_files/ObjectExtensions.cs
+++ b/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs
diff --git a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs b/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs
index ceecc589e6..ceecc589e6 100644
--- a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs
+++ b/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs
diff --git a/modules/mono/glue/cs_files/IAwaiter.cs b/modules/mono/glue/cs_files/IAwaiter.cs
deleted file mode 100644
index b5aa1a5389..0000000000
--- a/modules/mono/glue/cs_files/IAwaiter.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Runtime.CompilerServices;
-
-namespace Godot
-{
- public interface IAwaiter : INotifyCompletion
- {
- bool IsCompleted { get; }
-
- void GetResult();
- }
-
- public interface IAwaiter<out TResult> : INotifyCompletion
- {
- bool IsCompleted { get; }
-
- TResult GetResult();
- }
-}
diff --git a/modules/mono/glue/cs_files/IAwaitable.cs b/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs
index 0397957d00..0397957d00 100644
--- a/modules/mono/glue/cs_files/IAwaitable.cs
+++ b/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs
diff --git a/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs b/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs
new file mode 100644
index 0000000000..d3be9d781c
--- /dev/null
+++ b/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs
@@ -0,0 +1,18 @@
+using System.Runtime.CompilerServices;
+
+namespace Godot
+{
+ public interface IAwaiter : INotifyCompletion
+ {
+ bool IsCompleted { get; }
+
+ void GetResult();
+ }
+
+ public interface IAwaiter<out TResult> : INotifyCompletion
+ {
+ bool IsCompleted { get; }
+
+ TResult GetResult();
+ }
+}
diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs
index 6ad4b3dcb2..f7699a15bf 100644
--- a/modules/mono/glue/cs_files/MarshalUtils.cs
+++ b/modules/mono/glue/cs_files/MarshalUtils.cs
@@ -1,4 +1,5 @@
using System;
+using Godot.Collections;
namespace Godot
{
diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs
index c69c55d997..eaa027eb69 100644
--- a/modules/mono/glue/cs_files/Quat.cs
+++ b/modules/mono/glue/cs_files/Quat.cs
@@ -11,18 +11,11 @@ namespace Godot
[StructLayout(LayoutKind.Sequential)]
public struct Quat : IEquatable<Quat>
{
- private static readonly Quat identity = new Quat(0f, 0f, 0f, 1f);
-
public real_t x;
public real_t y;
public real_t z;
public real_t w;
- public static Quat Identity
- {
- get { return identity; }
- }
-
public real_t this[int index]
{
get
@@ -63,6 +56,16 @@ namespace Godot
}
}
+ public real_t Length
+ {
+ get { return Mathf.Sqrt(LengthSquared); }
+ }
+
+ public real_t LengthSquared
+ {
+ get { return Dot(this); }
+ }
+
public Quat CubicSlerp(Quat b, Quat preA, Quat postB, real_t t)
{
real_t t2 = (1.0f - t) * t * 2f;
@@ -76,24 +79,20 @@ namespace Godot
return x * b.x + y * b.y + z * b.z + w * b.w;
}
- public Quat Inverse()
- {
- return new Quat(-x, -y, -z, w);
- }
-
- public real_t Length()
+ public Vector3 GetEuler()
{
- return Mathf.Sqrt(LengthSquared());
+ var basis = new Basis(this);
+ return basis.GetEuler();
}
- public real_t LengthSquared()
+ public Quat Inverse()
{
- return Dot(this);
+ return new Quat(-x, -y, -z, w);
}
public Quat Normalized()
{
- return this / Length();
+ return this / Length;
}
public void Set(real_t x, real_t y, real_t z, real_t w)
@@ -103,12 +102,20 @@ namespace Godot
this.z = z;
this.w = w;
}
+
public void Set(Quat q)
{
- x = q.x;
- y = q.y;
- z = q.z;
- w = q.w;
+ this = q;
+ }
+
+ public void SetAxisAngle(Vector3 axis, real_t angle)
+ {
+ this = new Quat(axis, angle);
+ }
+
+ public void SetEuler(Vector3 eulerYXZ)
+ {
+ this = new Quat(eulerYXZ);
}
public Quat Slerp(Quat b, real_t t)
@@ -192,6 +199,9 @@ namespace Godot
return new Vector3(q.x, q.y, q.z);
}
+ // Static Readonly Properties
+ public static Quat Identity { get; } = new Quat(0f, 0f, 0f, 1f);
+
// Constructors
public Quat(real_t x, real_t y, real_t z, real_t w)
{
@@ -199,15 +209,46 @@ namespace Godot
this.y = y;
this.z = z;
this.w = w;
- }
+ }
+
+ public bool IsNormalized()
+ {
+ return Mathf.Abs(LengthSquared - 1) <= Mathf.Epsilon;
+ }
+
public Quat(Quat q)
- {
- x = q.x;
- y = q.y;
- z = q.z;
- w = q.w;
+ {
+ this = q;
+ }
+
+ public Quat(Basis basis)
+ {
+ this = basis.Quat();
}
-
+
+ public Quat(Vector3 eulerYXZ)
+ {
+ real_t half_a1 = eulerYXZ.y * (real_t)0.5;
+ real_t half_a2 = eulerYXZ.x * (real_t)0.5;
+ real_t half_a3 = eulerYXZ.z * (real_t)0.5;
+
+ // R = Y(a1).X(a2).Z(a3) convention for Euler angles.
+ // Conversion to quaternion as listed in https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf (page A-6)
+ // a3 is the angle of the first rotation, following the notation in this reference.
+
+ real_t cos_a1 = Mathf.Cos(half_a1);
+ real_t sin_a1 = Mathf.Sin(half_a1);
+ real_t cos_a2 = Mathf.Cos(half_a2);
+ real_t sin_a2 = Mathf.Sin(half_a2);
+ real_t cos_a3 = Mathf.Cos(half_a3);
+ real_t sin_a3 = Mathf.Sin(half_a3);
+
+ x = sin_a1 * cos_a2 * sin_a3 + cos_a1 * sin_a2 * cos_a3;
+ y = sin_a1 * cos_a2 * cos_a3 - cos_a1 * sin_a2 * sin_a3;
+ z = -sin_a1 * sin_a2 * cos_a3 + cos_a1 * cos_a2 * sin_a3;
+ w = sin_a1 * sin_a2 * sin_a3 + cos_a1 * cos_a2 * cos_a3;
+ }
+
public Quat(Vector3 axis, real_t angle)
{
real_t d = axis.Length();
diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs
index eaeed7b37b..b58f8bc6a8 100644
--- a/modules/mono/glue/cs_files/StringExtensions.cs
+++ b/modules/mono/glue/cs_files/StringExtensions.cs
@@ -1,5 +1,3 @@
-//using System;
-
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -583,7 +581,7 @@ namespace Godot
// </summary>
public static byte[] Md5Buffer(this string instance)
{
- return NativeCalls.godot_icall_String_md5_buffer(instance);
+ return NativeCalls.godot_icall_String_md5_buffer(instance);
}
// <summary>
@@ -591,7 +589,7 @@ namespace Godot
// </summary>
public static string Md5Text(this string instance)
{
- return NativeCalls.godot_icall_String_md5_text(instance);
+ return NativeCalls.godot_icall_String_md5_text(instance);
}
// <summary>
@@ -750,7 +748,7 @@ namespace Godot
// </summary>
public static int Rfind(this string instance, string what, int from = -1)
{
- return NativeCalls.godot_icall_String_rfind(instance, what, from);
+ return NativeCalls.godot_icall_String_rfind(instance, what, from);
}
// <summary>
@@ -758,7 +756,7 @@ namespace Godot
// </summary>
public static int Rfindn(this string instance, string what, int from = -1)
{
- return NativeCalls.godot_icall_String_rfindn(instance, what, from);
+ return NativeCalls.godot_icall_String_rfindn(instance, what, from);
}
// <summary>
@@ -777,7 +775,7 @@ namespace Godot
public static byte[] Sha256Buffer(this string instance)
{
- return NativeCalls.godot_icall_String_sha256_buffer(instance);
+ return NativeCalls.godot_icall_String_sha256_buffer(instance);
}
// <summary>
@@ -785,7 +783,7 @@ namespace Godot
// </summary>
public static string Sha256Text(this string instance)
{
- return NativeCalls.godot_icall_String_sha256_text(instance);
+ return NativeCalls.godot_icall_String_sha256_text(instance);
}
// <summary>
diff --git a/modules/mono/glue/cs_files/ToolAttribute.cs b/modules/mono/glue/cs_files/ToolAttribute.cs
deleted file mode 100644
index d8601b5b32..0000000000
--- a/modules/mono/glue/cs_files/ToolAttribute.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using System;
-
-namespace Godot
-{
- [AttributeUsage(AttributeTargets.Class)]
- public class ToolAttribute : Attribute {}
-}
diff --git a/modules/mono/godotsharp_defs.h b/modules/mono/godotsharp_defs.h
index f604464e8f..39d608de9f 100644
--- a/modules/mono/godotsharp_defs.h
+++ b/modules/mono/godotsharp_defs.h
@@ -32,6 +32,7 @@
#define GODOTSHARP_DEFS_H
#define BINDINGS_NAMESPACE "Godot"
+#define BINDINGS_NAMESPACE_COLLECTIONS BINDINGS_NAMESPACE ".Collections"
#define BINDINGS_GLOBAL_SCOPE_CLASS "GD"
#define BINDINGS_PTR_FIELD "ptr"
#define BINDINGS_NATIVE_NAME_FIELD "nativeName"
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
index 12109045e0..9f0e933a8c 100644
--- a/modules/mono/mono_gc_handle.cpp
+++ b/modules/mono/mono_gc_handle.cpp
@@ -44,12 +44,12 @@ uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
Ref<MonoGCHandle> MonoGCHandle::create_strong(MonoObject *p_object) {
- return memnew(MonoGCHandle(make_strong_handle(p_object)));
+ return memnew(MonoGCHandle(make_strong_handle(p_object), STRONG_HANDLE));
}
Ref<MonoGCHandle> MonoGCHandle::create_weak(MonoObject *p_object) {
- return memnew(MonoGCHandle(make_weak_handle(p_object)));
+ return memnew(MonoGCHandle(make_weak_handle(p_object), WEAK_HANDLE));
}
void MonoGCHandle::release() {
@@ -64,9 +64,10 @@ void MonoGCHandle::release() {
}
}
-MonoGCHandle::MonoGCHandle(uint32_t p_handle) {
+MonoGCHandle::MonoGCHandle(uint32_t p_handle, HandleType p_handle_type) {
released = false;
+ weak = p_handle_type == WEAK_HANDLE;
handle = p_handle;
}
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 9cb3ef0fbb..7eeaba30e0 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -40,24 +40,33 @@ class MonoGCHandle : public Reference {
GDCLASS(MonoGCHandle, Reference)
bool released;
+ bool weak;
uint32_t handle;
public:
+ enum HandleType {
+ STRONG_HANDLE,
+ WEAK_HANDLE
+ };
+
static uint32_t make_strong_handle(MonoObject *p_object);
static uint32_t make_weak_handle(MonoObject *p_object);
static Ref<MonoGCHandle> create_strong(MonoObject *p_object);
static Ref<MonoGCHandle> create_weak(MonoObject *p_object);
+ _FORCE_INLINE_ bool is_weak() { return weak; }
+
_FORCE_INLINE_ MonoObject *get_target() const { return released ? NULL : mono_gchandle_get_target(handle); }
- _FORCE_INLINE_ void set_handle(uint32_t p_handle) {
- handle = p_handle;
+ _FORCE_INLINE_ void set_handle(uint32_t p_handle, HandleType p_handle_type) {
released = false;
+ weak = p_handle_type == WEAK_HANDLE;
+ handle = p_handle;
}
void release();
- MonoGCHandle(uint32_t p_handle);
+ MonoGCHandle(uint32_t p_handle, HandleType p_handle_type);
~MonoGCHandle();
};
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index f564b93f8f..fadac941e9 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -148,7 +148,7 @@ void GDMono::initialize() {
ERR_FAIL_NULL(Engine::get_singleton());
- OS::get_singleton()->print("Mono: Initializing module...\n");
+ print_verbose("Mono: Initializing module...");
#ifdef DEBUG_METHODS_ENABLED
_initialize_and_check_api_hashes();
@@ -202,7 +202,7 @@ void GDMono::initialize() {
runtime_initialized = true;
- OS::get_singleton()->print("Mono: Runtime initialized\n");
+ print_verbose("Mono: Runtime initialized");
// mscorlib assembly MUST be present at initialization
ERR_EXPLAIN("Mono: Failed to load mscorlib assembly");
@@ -226,7 +226,7 @@ void GDMono::initialize() {
#ifdef DEBUG_ENABLED
bool debugger_attached = _wait_for_debugger_msecs(500);
if (!debugger_attached && OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->printerr("Mono: Debugger wait timeout\n");
+ print_error("Mono: Debugger wait timeout");
#endif
_register_internal_calls();
@@ -256,7 +256,7 @@ void GDMono::initialize() {
metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
}
- OS::get_singleton()->print("Mono: Proceeding to unload scripts domain because of invalid API assemblies\n");
+ print_line("Mono: Proceeding to unload scripts domain because of invalid API assemblies.");
Error err = _unload_scripts_domain();
if (err != OK) {
@@ -269,11 +269,10 @@ void GDMono::initialize() {
}
}
#else
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n");
+ print_verbose("Mono: Glue disabled, ignoring script assemblies.");
#endif
- OS::get_singleton()->print("Mono: INITIALIZED\n");
+ print_verbose("Mono: INITIALIZED");
}
#ifndef MONO_GLUE_DISABLED
@@ -352,8 +351,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo
CRASH_COND(!r_assembly);
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...\n").utf8());
+ print_verbose("Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...");
MonoImageOpenStatus status = MONO_IMAGE_OK;
MonoAssembly *assembly = mono_assembly_load_full(p_aname, NULL, &status, p_refonly);
@@ -372,8 +370,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo
*r_assembly = *stored_assembly;
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print(String("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8());
+ print_verbose("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path());
return true;
}
@@ -500,7 +497,7 @@ bool GDMono::_load_project_assembly() {
mono_assembly_set_main(project_assembly->get_assembly());
} else {
if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->printerr("Mono: Failed to load project assembly\n");
+ print_error("Mono: Failed to load project assembly");
}
return success;
@@ -510,13 +507,13 @@ bool GDMono::_load_api_assemblies() {
if (!_load_core_api_assembly()) {
if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->printerr("Mono: Failed to load Core API assembly\n");
+ print_error("Mono: Failed to load Core API assembly");
return false;
} else {
#ifdef TOOLS_ENABLED
if (!_load_editor_api_assembly()) {
if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->printerr("Mono: Failed to load Editor API assembly\n");
+ print_error("Mono: Failed to load Editor API assembly");
return false;
}
#endif
@@ -593,9 +590,7 @@ Error GDMono::_load_scripts_domain() {
ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG);
- if (OS::get_singleton()->is_stdout_verbose()) {
- OS::get_singleton()->print("Mono: Loading scripts domain...\n");
- }
+ print_verbose("Mono: Loading scripts domain...");
scripts_domain = GDMonoUtils::create_domain("GodotEngine.ScriptsDomain");
@@ -611,9 +606,7 @@ Error GDMono::_unload_scripts_domain() {
ERR_FAIL_NULL_V(scripts_domain, ERR_BUG);
- if (OS::get_singleton()->is_stdout_verbose()) {
- OS::get_singleton()->print("Mono: Unloading scripts domain...\n");
- }
+ print_verbose("Mono: Unloading scripts domain...");
_GodotSharp::get_singleton()->_dispose_callback();
@@ -661,9 +654,7 @@ Error GDMono::_load_tools_domain() {
ERR_FAIL_COND_V(tools_domain != NULL, ERR_BUG);
- if (OS::get_singleton()->is_stdout_verbose()) {
- OS::get_singleton()->print("Mono: Loading tools domain...\n");
- }
+ print_verbose("Mono: Loading tools domain...");
tools_domain = GDMonoUtils::create_domain("GodotEngine.ToolsDomain");
@@ -728,8 +719,7 @@ Error GDMono::reload_scripts_domain() {
if (!_load_project_assembly())
return ERR_CANT_OPEN;
#else
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n");
+ print_verbose("Mono: Glue disabled, ignoring script assemblies.");
#endif
return OK;
@@ -742,9 +732,7 @@ Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {
String domain_name = mono_domain_get_friendly_name(p_domain);
- if (OS::get_singleton()->is_stdout_verbose()) {
- OS::get_singleton()->print(String("Mono: Unloading domain `" + domain_name + "`...\n").utf8());
- }
+ print_verbose("Mono: Unloading domain `" + domain_name + "`...");
if (mono_domain_get() != root_domain)
mono_domain_set(root_domain, true);
@@ -877,7 +865,7 @@ GDMono::~GDMono() {
GDMonoUtils::clear_cache();
- OS::get_singleton()->print("Mono: Runtime cleanup...\n");
+ print_verbose("Mono: Runtime cleanup...");
runtime_initialized = false;
mono_jit_cleanup(root_domain);
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
index eabea8dc3c..5224d309de 100644
--- a/modules/mono/mono_gd/gd_mono_log.cpp
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -152,8 +152,7 @@ void GDMonoLog::initialize() {
log_level_id = log_level_get_id(log_level);
if (log_file) {
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print(String("Mono: Logfile is " + log_file_path + "\n").utf8());
+ print_verbose("Mono: Logfile is " + log_file_path);
mono_trace_set_log_handler(gdmono_MonoLogCallback, this);
} else {
OS::get_singleton()->printerr("Mono: No log file, using default log handler\n");
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 911d629956..c1f56bc3d2 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -156,6 +156,7 @@ void MonoCache::cleanup() {
}
#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
+#define GODOT_API_NS_CLAS(m_ns, m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(m_ns, #m_class))
void update_corlib_cache() {
@@ -206,8 +207,8 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(Control, GODOT_API_CLASS(Control));
CACHE_CLASS_AND_CHECK(Spatial, GODOT_API_CLASS(Spatial));
CACHE_CLASS_AND_CHECK(WeakRef, GODOT_API_CLASS(WeakRef));
- CACHE_CLASS_AND_CHECK(Array, GODOT_API_CLASS(Array));
- CACHE_CLASS_AND_CHECK(Dictionary, GODOT_API_CLASS(Dictionary));
+ CACHE_CLASS_AND_CHECK(Array, GODOT_API_NS_CLAS(BINDINGS_NAMESPACE_COLLECTIONS, Array));
+ CACHE_CLASS_AND_CHECK(Dictionary, GODOT_API_NS_CLAS(BINDINGS_NAMESPACE_COLLECTIONS, Dictionary));
CACHE_CLASS_AND_CHECK(MarshalUtils, GODOT_API_CLASS(MarshalUtils));
#ifdef DEBUG_ENABLED
@@ -234,8 +235,8 @@ void update_godot_api_cache() {
CACHE_FIELD_AND_CHECK(NodePath, ptr, CACHED_CLASS(NodePath)->get_field(BINDINGS_PTR_FIELD));
CACHE_FIELD_AND_CHECK(RID, ptr, CACHED_CLASS(RID)->get_field(BINDINGS_PTR_FIELD));
- CACHE_METHOD_THUNK_AND_CHECK(Array, GetPtr, (Array_GetPtr)GODOT_API_CLASS(Array)->get_method_thunk("GetPtr", 0));
- CACHE_METHOD_THUNK_AND_CHECK(Dictionary, GetPtr, (Dictionary_GetPtr)GODOT_API_CLASS(Dictionary)->get_method_thunk("GetPtr", 0));
+ CACHE_METHOD_THUNK_AND_CHECK(Array, GetPtr, (Array_GetPtr)GODOT_API_NS_CLAS(BINDINGS_NAMESPACE_COLLECTIONS, Array)->get_method_thunk("GetPtr", 0));
+ CACHE_METHOD_THUNK_AND_CHECK(Dictionary, GetPtr, (Dictionary_GetPtr)GODOT_API_NS_CLAS(BINDINGS_NAMESPACE_COLLECTIONS, Dictionary)->get_method_thunk("GetPtr", 0));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, IsArrayGenericType, (IsArrayGenericType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("IsArrayGenericType", 1));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, IsDictionaryGenericType, (IsDictionaryGenericType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("IsDictionaryGenericType", 1));
CACHE_METHOD_THUNK_AND_CHECK(SignalAwaiter, SignalCallback, (SignalAwaiter_SignalCallback)GODOT_API_CLASS(SignalAwaiter)->get_method_thunk("SignalCallback", 1));
@@ -590,14 +591,14 @@ current_invoke_count = 0;
MonoObject *runtime_invoke(MonoMethod *p_method, void *p_obj, void **p_params, MonoException **p_exc) {
GD_MONO_BEGIN_RUNTIME_INVOKE;
- MonoObject *ret = mono_runtime_invoke(p_method, p_obj, p_params, (MonoObject **)&p_exc);
+ MonoObject *ret = mono_runtime_invoke(p_method, p_obj, p_params, (MonoObject **)p_exc);
GD_MONO_END_RUNTIME_INVOKE;
return ret;
}
MonoObject *runtime_invoke_array(MonoMethod *p_method, void *p_obj, MonoArray *p_params, MonoException **p_exc) {
GD_MONO_BEGIN_RUNTIME_INVOKE;
- MonoObject *ret = mono_runtime_invoke_array(p_method, p_obj, p_params, (MonoObject **)&p_exc);
+ MonoObject *ret = mono_runtime_invoke_array(p_method, p_obj, p_params, (MonoObject **)p_exc);
GD_MONO_END_RUNTIME_INVOKE;
return ret;
}
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
index 54720652fa..add1e506ea 100644
--- a/modules/mono/signal_awaiter_utils.cpp
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -42,8 +42,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p
ERR_FAIL_NULL_V(p_source, ERR_INVALID_DATA);
ERR_FAIL_NULL_V(p_target, ERR_INVALID_DATA);
- uint32_t awaiter_handle = MonoGCHandle::make_strong_handle(p_awaiter);
- Ref<SignalAwaiterHandle> sa_con = memnew(SignalAwaiterHandle(awaiter_handle));
+ Ref<SignalAwaiterHandle> sa_con = memnew(SignalAwaiterHandle(p_awaiter));
#ifdef DEBUG_ENABLED
sa_con->set_connection_target(p_target);
#endif
@@ -119,8 +118,8 @@ void SignalAwaiterHandle::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &SignalAwaiterHandle::_signal_callback, MethodInfo("_signal_callback"));
}
-SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle) :
- MonoGCHandle(p_managed_handle) {
+SignalAwaiterHandle::SignalAwaiterHandle(MonoObject *p_managed) :
+ MonoGCHandle(MonoGCHandle::make_strong_handle(p_managed), STRONG_HANDLE) {
#ifdef DEBUG_ENABLED
conn_target_id = 0;
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
index a6a205ff8d..1920432709 100644
--- a/modules/mono/signal_awaiter_utils.h
+++ b/modules/mono/signal_awaiter_utils.h
@@ -64,7 +64,7 @@ public:
}
#endif
- SignalAwaiterHandle(uint32_t p_managed_handle);
+ SignalAwaiterHandle(MonoObject *p_managed);
~SignalAwaiterHandle();
};
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index f5d35714e1..6ec44023c1 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -93,7 +93,7 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
print_line("bmask: "+itos(bmask));
print_line("amask: "+itos(amask));
print_line("surfcount: "+itos(surfcount));
-*/
+ */
PoolVector<uint8_t> data;
data.resize(surfsize);
@@ -159,8 +159,6 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
if (mipmaps)
tex_flags |= Texture::FLAG_MIPMAPS;
- print_line("flip: " + itos(flags & PVR_VFLIP));
-
Ref<Image> image = memnew(Image(width, height, mipmaps, format, data));
ERR_FAIL_COND_V(image->empty(), RES());
@@ -646,12 +644,6 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
static void _pvrtc_decompress(Image *p_img) {
- /*
- static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) {
- decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst);
- }
- */
-
ERR_FAIL_COND(p_img->get_format() != Image::FORMAT_PVRTC2 && p_img->get_format() != Image::FORMAT_PVRTC2A && p_img->get_format() != Image::FORMAT_PVRTC4 && p_img->get_format() != Image::FORMAT_PVRTC4A);
bool _2bit = (p_img->get_format() == Image::FORMAT_PVRTC2 || p_img->get_format() == Image::FORMAT_PVRTC2A);
@@ -665,12 +657,6 @@ static void _pvrtc_decompress(Image *p_img) {
decompress_pvrtc((PVRTCBlock *)r.ptr(), _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w.ptr());
- /*
- for(int i=0;i<newdata.size();i++) {
- print_line(itos(w[i]));
- }
- */
-
w = PoolVector<uint8_t>::Write();
r = PoolVector<uint8_t>::Read();
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp
index 733f32277b..bdd3e31eb8 100644
--- a/modules/regex/regex.cpp
+++ b/modules/regex/regex.cpp
@@ -205,6 +205,8 @@ Error RegEx::compile(const String &p_pattern) {
code = pcre2_compile_16(p, pattern.length(), flags, &err, &offset, cctx);
+ pcre2_compile_context_free_16(cctx);
+
if (!code) {
PCRE2_UCHAR16 buf[256];
pcre2_get_error_message_16(err, buf, 256);
@@ -221,6 +223,8 @@ Error RegEx::compile(const String &p_pattern) {
code = pcre2_compile_32(p, pattern.length(), flags, &err, &offset, cctx);
+ pcre2_compile_context_free_32(cctx);
+
if (!code) {
PCRE2_UCHAR32 buf[256];
pcre2_get_error_message_32(err, buf, 256);
@@ -285,6 +289,8 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
if (res < 0) {
pcre2_match_data_free_32(match);
+ pcre2_match_context_free_32(mctx);
+
return NULL;
}
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 25fc897146..653dd82351 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -59,7 +59,7 @@ void image_decompress_squish(Image *p_image) {
} else if (p_image->get_format() == Image::FORMAT_RGTC_RG) {
squish_flags = squish::kBc5;
} else {
- print_line("Can't decompress unknown format: " + itos(p_image->get_format()));
+ ERR_EXPLAIN("Squish: Can't decompress unknown format: " + itos(p_image->get_format()));
ERR_FAIL_COND(true);
return;
}
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index c95a8ac2dd..0e533d3978 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -208,8 +208,6 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) {
//does this work? (it's less mem..)
//decode_mem_size = ogg_alloc.alloc_buffer_length_in_bytes + info.setup_memory_required + info.temp_memory_required + info.max_frame_size;
- //print_line("succeeded "+itos(ogg_alloc.alloc_buffer_length_in_bytes)+" setup "+itos(info.setup_memory_required)+" setup temp "+itos(info.setup_temp_memory_required)+" temp "+itos(info.temp_memory_required)+" maxframe"+itos(info.max_frame_size));
-
length = stb_vorbis_stream_length_in_seconds(ogg_stream);
stb_vorbis_close(ogg_stream);
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 881808873b..68087ac01f 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -387,7 +387,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
thread_sem->post();
#endif
- //print_line("play "+rtos(p_delta));
time += p_delta;
if (videobuf_time > get_time()) {
@@ -442,16 +441,8 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
int tr = vorbis_synthesis_read(&vd, ret - to_read);
- if (vd.granulepos >= 0) {
- //print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos));
- }
-
- //print_line("mix audio!");
-
audio_frames_wrote += ret - to_read;
- //print_line("AGP: "+itos(vd.granulepos)+" added "+itos(ret-to_read));
-
} else {
/* no pending audio; is there a pending packet to decode? */
@@ -460,7 +451,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
vorbis_synthesis_blockin(&vd, &vb);
}
} else { /* we need more data; break out to suck in another page */
- //printf("need moar data\n");
break;
};
}
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
index 0abefe11ee..b19bcfefcb 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -129,15 +129,45 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
PoolVector<uint8_t> imgdata;
Image::Format format;
+ int output_channels = 0;
if (idxA > 0) {
imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16
format = Image::FORMAT_RGBAH;
+ output_channels = 4;
} else {
imgdata.resize(exr_image.width * exr_image.height * 6); //RGB16
format = Image::FORMAT_RGBH;
+ output_channels = 3;
+ }
+
+ EXRTile single_image_tile;
+ int num_tiles;
+ int tile_width = 0;
+ int tile_height = 0;
+
+ const EXRTile *exr_tiles;
+
+ if (!exr_header.tiled) {
+ single_image_tile.images = exr_image.images;
+ single_image_tile.width = exr_image.width;
+ single_image_tile.height = exr_image.height;
+ single_image_tile.level_x = exr_image.width;
+ single_image_tile.level_y = exr_image.height;
+ single_image_tile.offset_x = 0;
+ single_image_tile.offset_y = 0;
+
+ exr_tiles = &single_image_tile;
+ num_tiles = 1;
+ tile_width = exr_image.width;
+ tile_height = exr_image.height;
+ } else {
+ tile_width = exr_header.tile_size_x;
+ tile_height = exr_header.tile_size_y;
+ num_tiles = exr_image.num_tiles;
+ exr_tiles = exr_image.tiles;
}
{
@@ -145,22 +175,51 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
uint16_t *iw = (uint16_t *)wd.ptr();
// Assume `out_rgba` have enough memory allocated.
- for (int i = 0; i < exr_image.width * exr_image.height; i++) {
+ for (int tile_index = 0; tile_index < num_tiles; tile_index++) {
- Color color(
- reinterpret_cast<float **>(exr_image.images)[idxR][i],
- reinterpret_cast<float **>(exr_image.images)[idxG][i],
- reinterpret_cast<float **>(exr_image.images)[idxB][i]);
+ const EXRTile &tile = exr_tiles[tile_index];
- if (p_force_linear)
- color = color.to_linear();
+ int tw = tile.width;
+ int th = tile.height;
- *iw++ = Math::make_half_float(color.r);
- *iw++ = Math::make_half_float(color.g);
- *iw++ = Math::make_half_float(color.b);
+ const float *r_channel_start = reinterpret_cast<const float *>(tile.images[idxR]);
+ const float *g_channel_start = reinterpret_cast<const float *>(tile.images[idxG]);
+ const float *b_channel_start = reinterpret_cast<const float *>(tile.images[idxB]);
+ const float *a_channel_start = NULL;
if (idxA > 0) {
- *iw++ = Math::make_half_float(reinterpret_cast<float **>(exr_image.images)[idxA][i]);
+ a_channel_start = reinterpret_cast<const float *>(tile.images[idxA]);
+ }
+
+ uint16_t *first_row_w = iw + (tile.offset_y * tile_height * exr_image.width + tile.offset_x * tile_width) * output_channels;
+
+ for (int y = 0; y < th; y++) {
+ const float *r_channel = r_channel_start + y * tile_width;
+ const float *g_channel = g_channel_start + y * tile_width;
+ const float *b_channel = b_channel_start + y * tile_width;
+ const float *a_channel = NULL;
+
+ if (a_channel_start) {
+ a_channel = a_channel_start + y * tile_width;
+ }
+
+ uint16_t *row_w = first_row_w + (y * exr_image.width * output_channels);
+
+ for (int x = 0; x < tw; x++) {
+
+ Color color(*r_channel++, *g_channel++, *b_channel++);
+
+ if (p_force_linear)
+ color = color.to_linear();
+
+ *row_w++ = Math::make_half_float(color.r);
+ *row_w++ = Math::make_half_float(color.g);
+ *row_w++ = Math::make_half_float(color.b);
+
+ if (idxA > 0) {
+ *row_w++ = Math::make_half_float(*a_channel++);
+ }
+ }
}
}
}
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 73b6d702c1..8e98b08b22 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1144,15 +1144,12 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
case VisualScriptBuiltinFunc::TEXT_PRINTERR: {
String str = *p_inputs[0];
-
- //str+="\n";
print_error(str);
} break;
case VisualScriptBuiltinFunc::TEXT_PRINTRAW: {
- String str = *p_inputs[0];
- //str+="\n";
+ String str = *p_inputs[0];
OS::get_singleton()->print("%s", str.utf8().get_data());
} break;
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 45a27d1e79..4471fbd0c4 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -882,7 +882,6 @@ void VisualScriptEditor::_member_selected() {
ERR_FAIL_COND(!ti);
selected = ti->get_metadata(0);
- //print_line("selected: "+String(selected));
if (ti->get_parent() == members->get_root()->get_children()) {
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index ad886bc758..f926d4e2eb 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -394,7 +394,6 @@ void VisualScriptFunctionCall::_update_method_cache() {
}
}
- //print_line("BASE: "+String(type)+" FUNC: "+String(function));
MethodBind *mb = ClassDB::get_method(type, function);
if (mb) {
use_default_args = mb->get_default_argument_count();
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index e4dfc5fe45..f79c81ad88 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -285,7 +285,6 @@ void VisualScriptPropertySelector::_update_search() {
Ref<Texture> icon;
script_methods = false;
- print_line("name: " + E->get().name);
String rep = E->get().name.replace("*", "");
if (E->get().name == "*Script Methods") {
icon = get_icon("Script", "EditorIcons");
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index b9f1f1eab0..46bd691290 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -82,9 +82,7 @@ Error AudioDriverAndroid::init() {
int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("audio buffer size: " + itos(buffer_size));
- }
+ print_verbose("Audio buffer size: " + itos(buffer_size));
audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size);
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 4f72b359e9..5c8d9e078f 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -257,7 +257,6 @@ class EditorExportAndroid : public EditorExportPlatform {
if (dpos == -1)
continue;
d = d.substr(0, dpos).strip_edges();
- //print_line("found device: "+d);
ldevices.push_back(d);
}
@@ -345,8 +344,6 @@ class EditorExportAndroid : public EditorExportPlatform {
}
d.name = vendor + " " + device;
- //print_line("name: "+d.name);
- //print_line("description: "+d.description);
}
ndevices.push_back(d);
@@ -671,19 +668,14 @@ class EditorExportAndroid : public EditorExportPlatform {
ucstring.write[len] = 0;
string_table.write[i] = ucstring.ptr();
}
-
- //print_line("String "+itos(i)+": "+string_table[i]);
}
for (uint32_t i = string_end; i < (ofs + size); i++) {
stable_extra.push_back(p_manifest[i]);
}
- //printf("stable extra: %i\n",int(stable_extra.size()));
string_table_ends = ofs + size;
- //print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends));
-
} break;
case CHUNK_XML_START_TAG: {
@@ -714,35 +706,25 @@ class EditorExportAndroid : public EditorExportPlatform {
//replace project information
if (tname == "manifest" && attrname == "package") {
-
- print_line("FOUND package");
string_table.write[attr_value] = get_package_name(package_name);
}
- if (tname == "manifest" && /*nspace=="android" &&*/ attrname == "versionCode") {
-
- print_line("FOUND versionCode");
+ if (tname == "manifest" && attrname == "versionCode") {
encode_uint32(version_code, &p_manifest.write[iofs + 16]);
}
- if (tname == "manifest" && /*nspace=="android" &&*/ attrname == "versionName") {
-
- print_line("FOUND versionName");
+ if (tname == "manifest" && attrname == "versionName") {
if (attr_value == 0xFFFFFFFF) {
WARN_PRINT("Version name in a resource, should be plaintext")
} else
string_table.write[attr_value] = version_name;
}
- if (tname == "activity" && /*nspace=="android" &&*/ attrname == "screenOrientation") {
+ if (tname == "activity" && attrname == "screenOrientation") {
encode_uint32(orientation == 0 ? 0 : 1, &p_manifest.write[iofs + 16]);
}
- if (tname == "uses-feature" && /*nspace=="android" &&*/ attrname == "glEsVersion") {
- print_line("version number: " + itos(decode_uint32(&p_manifest[iofs + 16])));
- }
-
if (tname == "supports-screens") {
if (attrname == "smallScreens") {
@@ -773,7 +755,6 @@ class EditorExportAndroid : public EditorExportPlatform {
String tname = string_table[name];
if (tname == "manifest") {
- print_line("Found manifest end");
// save manifest ending so we can restore it
Vector<uint8_t> manifest_end;
@@ -913,8 +894,6 @@ class EditorExportAndroid : public EditorExportPlatform {
encode_uint32(string_table.size(), &ret.write[16]); //update new number of strings
encode_uint32(string_data_offset - 8, &ret.write[28]); //update new string data offset
- //print_line("file size: "+itos(ret.size()));
-
p_manifest = ret;
}
@@ -956,7 +935,6 @@ class EditorExportAndroid : public EditorExportPlatform {
void _fix_resources(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest) {
const int UTF8_FLAG = 0x00000100;
- print_line("*******************GORRRGLE***********************");
uint32_t string_block_len = decode_uint32(&p_manifest[16]);
uint32_t string_count = decode_uint32(&p_manifest[20]);
@@ -1234,8 +1212,8 @@ public:
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
}
- print_line("Installing into device (please wait..): " + devices[p_device].name);
- ep.step("Installing to Device (please wait..)..", 2);
+ print_line("Installing to device (please wait...): " + devices[p_device].name);
+ ep.step("Installing to device (please wait...)", 2);
args.clear();
args.push_back("-s");
@@ -1613,8 +1591,11 @@ public:
String apkfname = "main." + itos(version_code) + "." + get_package_name(package_name) + ".obb";
String fullpath = p_path.get_base_dir().plus_file(apkfname);
err = save_pack(p_preset, fullpath);
+
if (err != OK) {
+ unzClose(pkg);
EditorNode::add_io_error("Could not write expansion package file: " + apkfname);
+
return OK;
}
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 0e5f4fb93a..061e05f5ee 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -928,7 +928,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *e
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
if (!mid) {
- print_line("FAILED GETTING METHOD ID " + mname);
+ print_line("RegisterMethod: Failed getting method ID: " + mname);
}
s->add_method(mname, mid, types, get_jni_type(retval));
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 446a5911e5..022ccb7d89 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -554,7 +554,6 @@ bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, St
jstring name2 = (jstring)env->CallObjectMethod(obj, Class_getName);
String str_type = env->GetStringUTFChars(name2, NULL);
- print_line("name: " + str_type);
env->DeleteLocalRef(name2);
uint32_t t = 0;
@@ -1191,9 +1190,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
env->DeleteLocalRef(obj);
env->DeleteLocalRef(param_types);
env->DeleteLocalRef(return_type);
-
- //args[i] = _jobject_to_variant(env, obj);
- //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
};
env->DeleteLocalRef(methods);
@@ -1210,7 +1206,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
jstring name = (jstring)env->CallObjectMethod(obj, Field_getName);
String str_field = env->GetStringUTFChars(name, NULL);
env->DeleteLocalRef(name);
- print_line("FIELD: " + str_field);
int mods = env->CallIntMethod(obj, Field_getModifiers);
if ((mods & 0x8) && (mods & 0x10) && (mods & 0x1)) { //static final public!
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index f9eda9dff1..74c40bde72 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -62,12 +62,19 @@ public:
int OS_Android::get_video_driver_count() const {
- return 1;
+ return 2;
}
const char *OS_Android::get_video_driver_name(int p_driver) const {
- return "GLES2";
+ switch (p_driver) {
+ case VIDEO_DRIVER_GLES3:
+ return "GLES3";
+ case VIDEO_DRIVER_GLES2:
+ return "GLES2";
+ }
+ ERR_EXPLAIN("Invalid video driver index " + itos(p_driver));
+ ERR_FAIL_V(NULL);
}
int OS_Android::get_audio_driver_count() const {
@@ -132,26 +139,55 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
bool use_gl3 = get_gl_version_code_func() >= 0x00030000;
use_gl3 = use_gl3 && (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3");
- use_gl2 = !use_gl3;
-
- if (gfx_init_func)
- gfx_init_func(gfx_init_ud, use_gl2);
+ bool gl_initialization_error = false;
+
+ while (true) {
+ if (use_gl3) {
+ if (RasterizerGLES3::is_viable() == OK) {
+ if (gfx_init_func)
+ gfx_init_func(gfx_init_ud, false);
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ } else {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best") {
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ use_gl3 = false;
+ continue;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ } else {
+ if (RasterizerGLES2::is_viable() == OK) {
+ if (gfx_init_func)
+ gfx_init_func(gfx_init_ud, true);
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
- if (use_gl2) {
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- video_driver_index = VIDEO_DRIVER_GLES2;
- } else {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- video_driver_index = VIDEO_DRIVER_GLES3;
+ if (gl_initialization_error) {
+ OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.\n"
+ "Please try updating your Android version.",
+ "Unable to initialize Video driver");
+ return ERR_UNAVAILABLE;
}
+ video_driver_index = p_video_driver;
+
visual_server = memnew(VisualServerRaster);
/* if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
};*/
+
visual_server->init();
// visual_server->cursor_set_visible(false, 0);
@@ -337,8 +373,6 @@ void OS_Android::process_event(Ref<InputEvent> p_event) {
void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> &p_points) {
- //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size()));
-
switch (p_what) {
case 0: { //gesture begin
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 9754807f38..008e213e5e 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -739,7 +739,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
String library_to_use = "libgodot.iphone." + String(p_debug ? "debug" : "release") + ".fat.a";
- print_line("static library: " + library_to_use);
+ print_line("Static library: " + library_to_use);
String pkg_name;
if (p_preset->get("application/name") != "")
pkg_name = p_preset->get("application/name"); // app_name
@@ -809,7 +809,6 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
file = file.replace_first("iphone/", "");
if (files_to_parse.has(file)) {
- print_line(String("parse ") + file);
_fix_config_file(p_preset, data, config_data, p_debug);
} else if (file.begins_with("libgodot.iphone")) {
if (file != library_to_use) {
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index a4538a6673..addef61ec7 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -99,8 +99,11 @@ int OSIPhone::get_current_video_driver() const {
Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
- video_driver_index = p_video_driver; //this may be misleading
+ video_driver_index = VIDEO_DRIVER_GLES3;
+ if (RasterizerGLES3::is_viable() != OK) {
+ return ERR_UNAVAILABLE;
+ }
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 5a8a05d4df..80699b0d32 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -652,23 +652,57 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
attributes.alpha = false;
attributes.antialias = false;
ERR_FAIL_INDEX_V(p_video_driver, VIDEO_DRIVER_MAX, ERR_INVALID_PARAMETER);
- switch (p_video_driver) {
- case VIDEO_DRIVER_GLES3:
- attributes.majorVersion = 2;
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- break;
- case VIDEO_DRIVER_GLES2:
- attributes.majorVersion = 1;
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- break;
+
+ bool gles3 = true;
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ gles3 = false;
+ }
+
+ bool gl_initialization_error = false;
+
+ while (true) {
+ if (gles3) {
+ if (RasterizerGLES3::is_viable() == OK) {
+ attributes.majorVersion = 2;
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ } else {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best") {
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ gles3 = false;
+ continue;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ } else {
+ if (RasterizerGLES2::is_viable() == OK) {
+ attributes.majorVersion = 1;
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
}
- video_driver_index = p_video_driver;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
- ERR_EXPLAIN("WebGL " + itos(attributes.majorVersion) + ".0 not available");
- ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
+ if (emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS) {
+ gl_initialization_error = true;
+ }
+
+ if (gl_initialization_error) {
+ OS::get_singleton()->alert("Your browser does not support any of the supported WebGL versions.\n"
+ "Please update your browser version.",
+ "Unable to initialize Video driver");
+ return ERR_UNAVAILABLE;
+ }
+
+ video_driver_index = p_video_driver;
video_mode = p_desired;
// Can't fulfil fullscreen request during start-up due to browser security.
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 57ca29bdd5..880705b507 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -380,7 +380,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
String file = fname;
- print_line("READ: " + file);
Vector<uint8_t> data;
data.resize(info.uncompressed_size);
@@ -394,7 +393,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
file = file.replace_first("osx_template.app/", "");
if (file == "Contents/Info.plist") {
- print_line("parse plist");
_fix_plist(p_preset, data, pkg_name);
}
@@ -415,13 +413,12 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
iconpath = p_preset->get("application/icon");
else
iconpath = ProjectSettings::get_singleton()->get("application/config/icon");
- print_line("icon? " + iconpath);
+
if (iconpath != "") {
Ref<Image> icon;
icon.instance();
icon->load(iconpath);
if (!icon->empty()) {
- print_line("loaded?");
_make_icon(icon, data);
}
}
@@ -475,9 +472,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
- print_line("OPEN ERR: " + itos(zerr));
zerr = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size());
- print_line("WRITE ERR: " + itos(zerr));
zipCloseFileInZip(dst_pkg_zip);
}
}
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 7bf274310d..79d7ec410a 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1276,8 +1276,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
}
- video_driver_index = p_video_driver;
-
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
/*
@@ -1333,26 +1331,60 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
/*** END OSX INITIALIZATION ***/
- // only opengl support here...
+ bool gles3 = true;
if (p_video_driver == VIDEO_DRIVER_GLES2) {
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- } else {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
+ gles3 = false;
}
+ bool editor = Engine::get_singleton()->is_editor_hint();
+ bool gl_initialization_error = false;
+
+ while (true) {
+ if (gles3) {
+ if (RasterizerGLES3::is_viable() == OK) {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ } else {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ gles3 = false;
+ continue;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ } else {
+ if (RasterizerGLES2::is_viable() == OK) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ if (gl_initialization_error) {
+ OS::get_singleton()->alert("Your video card driver does not support any of the supported OpenGL versions.\n"
+ "Please update your drivers or if you have a very old or integrated GPU upgrade it.",
+ "Unable to initialize Video driver");
+ return ERR_UNAVAILABLE;
+ }
+
+ video_driver_index = p_video_driver;
+
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
}
- visual_server->init();
+ visual_server->init();
AudioDriverManager::initialize(p_audio_driver);
- midi_driver.open();
-
input = memnew(InputDefault);
joypad_osx = memnew(JoypadOSX);
@@ -1370,6 +1402,8 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
void OS_OSX::finalize() {
+ midi_driver.close();
+
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL);
CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL);
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 8549a44ce5..b6c3dcf9e0 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -187,12 +187,78 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
main_loop = NULL;
outside = true;
+ ContextEGL::Driver opengl_api_type = ContextEGL::GLES_2_0;
+
if (p_video_driver == VIDEO_DRIVER_GLES2) {
- gl_context = memnew(ContextEGL(window, ContextEGL::GLES_2_0));
- } else {
- gl_context = memnew(ContextEGL(window, ContextEGL::GLES_3_0));
+ opengl_api_type = ContextEGL::GLES_2_0;
+ }
+
+ bool gl_initialization_error = false;
+
+ gl_context = NULL;
+ while (!gl_context) {
+ gl_context = memnew(ContextEGL(window, opengl_api_type));
+
+ if (gl_context->initialize() != OK) {
+ memdelete(gl_context);
+ gl_context = NULL;
+
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best") {
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ gl_initialization_error = true;
+ break;
+ }
+
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ opengl_api_type = ContextEGL::GLES_2_0;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ while (true) {
+ if (opengl_api_type == ContextEGL::GLES_3_0) {
+ if (RasterizerGLES3::is_viable() == OK) {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ } else {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ opengl_api_type = ContextEGL::GLES_2_0;
+ continue;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ if (opengl_api_type == ContextEGL::GLES_2_0) {
+ if (RasterizerGLES2::is_viable() == OK) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ if (gl_initialization_error) {
+ OS::get_singleton()->alert("Your video card driver does not support any of the supported OpenGL versions.\n"
+ "Please update your drivers or if you have a very old or integrated GPU upgrade it.",
+ "Unable to initialize Video driver");
+ return ERR_UNAVAILABLE;
}
- gl_context->initialize();
+
+ video_driver_index = p_video_driver;
+ gl_context->make_current();
+ gl_context->set_use_vsync(video_mode.use_vsync);
+
VideoMode vm;
vm.width = gl_context->get_window_width();
vm.height = gl_context->get_window_height();
@@ -230,19 +296,6 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
set_video_mode(vm);
- gl_context->make_current();
-
- if (p_video_driver == VIDEO_DRIVER_GLES2) {
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- } else {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- }
- gl_context->set_use_vsync(vm.use_vsync);
-
- video_driver_index = p_video_driver;
-
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering? Or remove?
/*
@@ -253,7 +306,6 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
*/
visual_server->init();
-
input = memnew(InputDefault);
joypad = ref new JoypadUWP(input);
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index a158237418..794f6df31f 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -68,20 +68,6 @@ void ContextGL_Win::swap_buffers() {
SwapBuffers(hDC);
}
-/*
-static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) {
-
- print_line(String()+"getting proc of: "+p_function);
- GLWrapperFuncPtr func=(GLWrapperFuncPtr)get_gl_proc_address(p_function);
- if (!func) {
- print_line("Couldn't find function: "+String(p_function));
- print_line("error: "+itos(GetLastError()));
- }
- return func;
-
-}
-*/
-
void ContextGL_Win::set_use_vsync(bool p_use) {
if (wglSwapIntervalEXT) {
@@ -122,28 +108,24 @@ Error ContextGL_Win::initialize() {
hDC = GetDC(hWnd);
if (!hDC) {
- MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
pixel_format = ChoosePixelFormat(hDC, &pfd);
if (!pixel_format) // Did Windows Find A Matching Pixel Format?
{
- MessageBox(NULL, "Can't Find A Suitable pixel_format.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
BOOL ret = SetPixelFormat(hDC, pixel_format, &pfd);
if (!ret) // Are We Able To Set The Pixel Format?
{
- MessageBox(NULL, "Can't Set The pixel_format.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
hRC = wglCreateContext(hDC);
if (!hRC) // Are We Able To Get A Rendering Context?
{
- MessageBox(NULL, "Can't Create A Temporary GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
@@ -165,7 +147,6 @@ Error ContextGL_Win::initialize() {
if (wglCreateContextAttribsARB == NULL) //OpenGL 3.0 is not supported
{
- MessageBox(NULL, "Cannot get Proc Address for CreateContextAttribs", "ERROR", MB_OK | MB_ICONEXCLAMATION);
wglDeleteContext(hRC);
return ERR_CANT_CREATE;
}
@@ -173,7 +154,6 @@ Error ContextGL_Win::initialize() {
HGLRC new_hRC = wglCreateContextAttribsARB(hDC, 0, attribs);
if (!new_hRC) {
wglDeleteContext(hRC);
- MessageBox(NULL, "Can't Create An OpenGL 3.3 Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return false
}
wglMakeCurrent(hDC, NULL);
@@ -182,7 +162,6 @@ Error ContextGL_Win::initialize() {
if (!wglMakeCurrent(hDC, hRC)) // Try To Activate The Rendering Context
{
- MessageBox(NULL, "Can't Activate The GL 3.3 Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
}
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index dcd3597e88..150d418502 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -210,6 +210,7 @@ def configure_msvc(env, manual_msvc_config):
'WIN32', 'MSVC',
{'WINVER' : '$target_win_version',
'_WIN32_WINNT': '$target_win_version'}])
+ env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros
if env["bits"] == "64":
env.AppendUnique(CPPDEFINES=['_WIN64'])
diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp
index 796531fe24..b56fb6509e 100644
--- a/platform/windows/joypad.cpp
+++ b/platform/windows/joypad.cpp
@@ -540,9 +540,7 @@ void JoypadWindows::load_xinput() {
}
if (!xinput_dll) {
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("Could not find XInput, using DirectInput only");
- }
+ print_verbose("Could not find XInput, using DirectInput only");
return;
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 56ac467dc6..7009df8e57 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -190,28 +190,6 @@ BOOL WINAPI HandlerRoutine(_In_ DWORD dwCtrlType) {
}
}
-BOOL CALLBACK _CloseWindowsEnum(HWND hWnd, LPARAM lParam) {
- DWORD dwID;
-
- GetWindowThreadProcessId(hWnd, &dwID);
-
- if (dwID == (DWORD)lParam) {
- PostMessage(hWnd, WM_CLOSE, 0, 0);
- }
-
- return TRUE;
-}
-
-bool _close_gracefully(const PROCESS_INFORMATION &pi, const DWORD dwStopWaitMsec) {
- if (!EnumWindows(_CloseWindowsEnum, pi.dwProcessId))
- return false;
-
- if (WaitForSingleObject(pi.hProcess, dwStopWaitMsec) != WAIT_OBJECT_0)
- return false;
-
- return true;
-}
-
void OS_Windows::initialize_debugging() {
SetConsoleCtrlHandler(HandlerRoutine, TRUE);
@@ -449,7 +427,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
input->set_mouse_position(c);
mm->set_speed(Vector2(0, 0));
- if (raw->data.mouse.usFlags ==MOUSE_MOVE_RELATIVE) {
+ if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE) {
mm->set_relative(Vector2(raw->data.mouse.lLastX, raw->data.mouse.lLastY));
} else if (raw->data.mouse.usFlags == MOUSE_MOVE_ABSOLUTE) {
@@ -460,9 +438,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
int nScreenTop = GetSystemMetrics(SM_YVIRTUALSCREEN);
Vector2 abs_pos(
- (double(raw->data.mouse.lLastX) - 65536.0 / (nScreenWidth) ) * nScreenWidth / 65536.0 + nScreenLeft,
- (double(raw->data.mouse.lLastY) - 65536.0 / (nScreenHeight) ) * nScreenHeight / 65536.0 + nScreenTop
- );
+ (double(raw->data.mouse.lLastX) - 65536.0 / (nScreenWidth)) * nScreenWidth / 65536.0 + nScreenLeft,
+ (double(raw->data.mouse.lLastY) - 65536.0 / (nScreenHeight)) * nScreenHeight / 65536.0 + nScreenTop);
POINT coords; //client coords
coords.x = abs_pos.x;
@@ -470,15 +447,13 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ScreenToClient(hWnd, &coords);
-
- mm->set_relative(Vector2(coords.x - old_x, coords.y - old_y ));
+ mm->set_relative(Vector2(coords.x - old_x, coords.y - old_y));
old_x = coords.x;
old_y = coords.y;
/*Input.mi.dx = (int)((((double)(pos.x)-nScreenLeft) * 65536) / nScreenWidth + 65536 / (nScreenWidth));
Input.mi.dy = (int)((((double)(pos.y)-nScreenTop) * 65536) / nScreenHeight + 65536 / (nScreenHeight));
*/
-
}
if (window_has_focus && main_loop)
@@ -856,14 +831,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (ke.uMsg == WM_SYSKEYUP)
ke.uMsg = WM_KEYUP;
- /*if (ke.uMsg==WM_KEYDOWN && alt_mem && uMsg!=WM_SYSKEYDOWN) {
- //altgr hack for intl keyboards, not sure how good it is
- //windows is weeeeird
- ke.mod_state.alt=false;
- ke.mod_state.control=false;
- print_line("")
- }*/
-
ke.wParam = wParam;
ke.lParam = lParam;
key_event_buffer[key_event_pos++] = ke;
@@ -871,7 +838,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} break;
case WM_INPUTLANGCHANGEREQUEST: {
- print_line("input lang change");
+ // FIXME: Do something?
} break;
case WM_TOUCH: {
@@ -1126,7 +1093,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
WNDCLASSEXW wc;
if (is_hidpi_allowed()) {
- print_line("hidpi aware?");
HMODULE Shcore = LoadLibraryW(L"Shcore.dll");
if (Shcore != NULL) {
@@ -1201,8 +1167,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
WindowRect.right = data.size.width;
WindowRect.bottom = data.size.height;
- print_line("wr right " + itos(WindowRect.right) + ", " + itos(WindowRect.bottom));
-
/* DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
@@ -1287,21 +1251,74 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
}
#if defined(OPENGL_ENABLED)
+
+ bool gles3_context = true;
if (p_video_driver == VIDEO_DRIVER_GLES2) {
- gl_context = memnew(ContextGL_Win(hWnd, false));
- gl_context->initialize();
+ gles3_context = false;
+ }
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- } else {
- gl_context = memnew(ContextGL_Win(hWnd, true));
- gl_context->initialize();
+ bool editor = Engine::get_singleton()->is_editor_hint();
+ bool gl_initialization_error = false;
+
+ gl_context = NULL;
+ while (!gl_context) {
+ gl_context = memnew(ContextGL_Win(hWnd, gles3_context));
+
+ if (gl_context->initialize() != OK) {
+ memdelete(gl_context);
+ gl_context = NULL;
+
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ gl_initialization_error = true;
+ break;
+ }
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ gles3_context = false;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
}
- video_driver_index = p_video_driver; // FIXME TODO - FIX IF DRIVER DETECTION HAPPENS AND GLES2 MUST BE USED
+ while (true) {
+ if (gles3_context) {
+ if (RasterizerGLES3::is_viable() == OK) {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ } else {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ gles3_context = false;
+ continue;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ } else {
+ if (RasterizerGLES2::is_viable() == OK) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ if (gl_initialization_error) {
+ OS::get_singleton()->alert("Your video card driver does not support any of the supported OpenGL versions.\n"
+ "Please update your drivers or if you have a very old or integrated GPU upgrade it.",
+ "Unable to initialize Video driver");
+ return ERR_UNAVAILABLE;
+ }
+
+ video_driver_index = p_video_driver;
gl_context->set_use_vsync(video_mode.use_vsync);
#endif
@@ -1335,10 +1352,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
AudioDriverManager::initialize(p_audio_driver);
-#ifdef WINMIDI_ENABLED
- driver_midi.open();
-#endif
-
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
@@ -1490,12 +1503,6 @@ void OS_Windows::finalize() {
if (user_proc) {
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)user_proc);
};
-
- /*
- if (debugger_connection_console) {
- memdelete(debugger_connection_console);
- }
- */
}
void OS_Windows::finalize_core() {
@@ -1759,9 +1766,6 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) {
if (pre_fs_valid) {
GetWindowRect(hWnd, &pre_fs_rect);
- //print_line("A: "+itos(pre_fs_rect.left)+","+itos(pre_fs_rect.top)+","+itos(pre_fs_rect.right-pre_fs_rect.left)+","+itos(pre_fs_rect.bottom-pre_fs_rect.top));
- //MapWindowPoints(hWnd, GetParent(hWnd), (LPPOINT) &pre_fs_rect, 2);
- //print_line("B: "+itos(pre_fs_rect.left)+","+itos(pre_fs_rect.top)+","+itos(pre_fs_rect.right-pre_fs_rect.left)+","+itos(pre_fs_rect.bottom-pre_fs_rect.top));
}
int cs = get_current_screen();
@@ -2438,26 +2442,20 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
return OK;
};
-Error OS_Windows::kill(const ProcessID &p_pid, const int p_max_wait_msec) {
+Error OS_Windows::kill(const ProcessID &p_pid) {
+
ERR_FAIL_COND_V(!process_map->has(p_pid), FAILED);
const PROCESS_INFORMATION pi = (*process_map)[p_pid].pi;
process_map->erase(p_pid);
- Error result;
-
- if (p_max_wait_msec != -1 && _close_gracefully(pi, p_max_wait_msec)) {
- result = OK;
- } else {
- const int ret = TerminateProcess(pi.hProcess, 0);
- result = ret != 0 ? OK : FAILED;
- }
+ const int ret = TerminateProcess(pi.hProcess, 0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
- return result;
-}
+ return ret != 0 ? OK : FAILED;
+};
int OS_Windows::get_process_id() const {
return _getpid();
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 243d4bb328..c9fa46052a 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -259,7 +259,7 @@ public:
virtual uint64_t get_ticks_usec() const;
virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
- virtual Error kill(const ProcessID &p_pid, const int p_stop_max_wait_msec = -1);
+ virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
virtual bool has_environment(const String &p_var) const;
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index cd76667c64..8c1869a1f1 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -65,19 +65,6 @@ void ContextGL_X11::swap_buffers() {
glXSwapBuffers(x11_display, x11_window);
}
-/*
-static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) {
-
- //print_line(String()+"getting proc of: "+p_function);
- GLWrapperFuncPtr func=(GLWrapperFuncPtr)glXGetProcAddress( (const GLubyte*) p_function);
- if (!func) {
- print_line("Couldn't find function: "+String(p_function));
- }
-
- return func;
-
-}*/
-
static bool ctxErrorOccurred = false;
static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
ctxErrorOccurred = true;
@@ -129,9 +116,14 @@ Error ContextGL_X11::initialize() {
};
int fbcount;
- GLXFBConfig fbconfig;
+ GLXFBConfig fbconfig = 0;
XVisualInfo *vi = NULL;
+ XSetWindowAttributes swa;
+ swa.event_mask = StructureNotifyMask;
+ swa.border_pixel = 0;
+ unsigned long valuemask = CWBorderPixel | CWColormap | CWEventMask;
+
if (OS::get_singleton()->is_layered_allowed()) {
GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs_layered, &fbcount);
ERR_FAIL_COND_V(!fbc, ERR_UNCONFIGURED);
@@ -155,16 +147,10 @@ Error ContextGL_X11::initialize() {
}
ERR_FAIL_COND_V(!fbconfig, ERR_UNCONFIGURED);
- XSetWindowAttributes swa;
-
- swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
- swa.border_pixel = 0;
swa.background_pixmap = None;
swa.background_pixel = 0;
swa.border_pixmap = None;
- swa.event_mask = StructureNotifyMask;
-
- x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask | CWBackPixel, &swa);
+ valuemask |= CWBackPixel;
} else {
GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount);
@@ -173,42 +159,21 @@ Error ContextGL_X11::initialize() {
vi = glXGetVisualFromFBConfig(x11_display, fbc[0]);
fbconfig = fbc[0];
-
- XSetWindowAttributes swa;
-
- swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
- swa.border_pixel = 0;
- swa.event_mask = StructureNotifyMask;
-
- x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);
}
- ERR_FAIL_COND_V(!x11_window, ERR_UNCONFIGURED);
- set_class_hint(x11_display, x11_window);
- XMapWindow(x11_display, x11_window);
-
- int (*oldHandler)(Display *, XErrorEvent *) =
- XSetErrorHandler(&ctxErrorHandler);
+ int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&ctxErrorHandler);
switch (context_type) {
- case GLES_2_0_COMPATIBLE:
case OLDSTYLE: {
+
p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE);
+ ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED);
} break;
- /*
- case ContextType::GLES_2_0_COMPATIBLE: {
-
- static int context_attribs[] = {
- GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
- GLX_CONTEXT_MINOR_VERSION_ARB, 0,
- None
- };
+ case GLES_2_0_COMPATIBLE: {
- p->glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs);
- ERR_EXPLAIN("Could not obtain an OpenGL 3.0 context!");
+ p->glx_context = glXCreateNewContext(x11_display, fbconfig, GLX_RGBA_TYPE, 0, true);
ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED);
} break;
- */
case GLES_3_0_COMPATIBLE: {
static int context_attribs[] = {
@@ -220,24 +185,22 @@ Error ContextGL_X11::initialize() {
};
p->glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs);
- ERR_EXPLAIN("Could not obtain an OpenGL 3.3 context!");
ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context, ERR_UNCONFIGURED);
} break;
}
+ swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
+ x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa);
+
+ ERR_FAIL_COND_V(!x11_window, ERR_UNCONFIGURED);
+ set_class_hint(x11_display, x11_window);
+ XMapWindow(x11_display, x11_window);
+
XSync(x11_display, False);
XSetErrorHandler(oldHandler);
glXMakeCurrent(x11_display, x11_window, p->glx_context);
- /*
- glWrapperInit(wrapper_get_proc_address);
- glFlush();
-
- glXSwapBuffers(x11_display,x11_window);
-*/
- //glXMakeCurrent(x11_display, None, NULL);
-
XFree(vi);
return OK;
@@ -310,7 +273,6 @@ ContextGL_X11::ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, c
ContextGL_X11::~ContextGL_X11() {
release_current();
glXDestroyContext(x11_display, p->glx_context);
-
memdelete(p);
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 733d2509f7..a62bd714d2 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -170,13 +170,13 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
#ifdef TOUCH_ENABLED
if (!XQueryExtension(x11_display, "XInputExtension", &touch.opcode, &event_base, &error_base)) {
- fprintf(stderr, "XInput extension not available");
+ print_verbose("XInput extension not available, touch support disabled.");
} else {
// 2.2 is the first release with multitouch
int xi_major = 2;
int xi_minor = 2;
if (XIQueryVersion(x11_display, &xi_major, &xi_minor) != Success) {
- fprintf(stderr, "XInput 2.2 not available (server supports %d.%d)\n", xi_major, xi_minor);
+ print_verbose(vformat("XInput 2.2 not available (server supports %d.%d), touch support disabled.", xi_major, xi_minor));
touch.opcode = 0;
} else {
int dev_count;
@@ -198,14 +198,14 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
}
if (direct_touch) {
touch.devices.push_back(dev->deviceid);
- fprintf(stderr, "Using touch device: %s\n", dev->name);
+ print_verbose("XInput: Using touch device: " + String(dev->name));
}
}
XIFreeDeviceInfo(info);
- if (is_stdout_verbose() && !touch.devices.size()) {
- fprintf(stderr, "No touch devices found\n");
+ if (!touch.devices.size()) {
+ print_verbose("XInput: No touch devices found.");
}
}
}
@@ -266,7 +266,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
*/
// maybe contextgl wants to be in charge of creating the window
-//print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height));
#if defined(OPENGL_ENABLED)
ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
@@ -275,21 +274,70 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
opengl_api_type = ContextGL_X11::GLES_2_0_COMPATIBLE;
}
- context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, opengl_api_type));
- context_gl->initialize();
+ bool editor = Engine::get_singleton()->is_editor_hint();
+ bool gl_initialization_error = false;
- switch (opengl_api_type) {
- case ContextGL_X11::GLES_2_0_COMPATIBLE: {
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- } break;
- case ContextGL_X11::GLES_3_0_COMPATIBLE: {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- } break;
+ context_gl = NULL;
+ while (!context_gl) {
+ context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, opengl_api_type));
+
+ if (context_gl->initialize() != OK) {
+ memdelete(context_gl);
+ context_gl = NULL;
+
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ gl_initialization_error = true;
+ break;
+ }
+
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ opengl_api_type = ContextGL_X11::GLES_2_0_COMPATIBLE;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ while (true) {
+ if (opengl_api_type == ContextGL_X11::GLES_3_0_COMPATIBLE) {
+ if (RasterizerGLES3::is_viable() == OK) {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ } else {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ p_video_driver = VIDEO_DRIVER_GLES2;
+ opengl_api_type = ContextGL_X11::GLES_2_0_COMPATIBLE;
+ continue;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ if (opengl_api_type == ContextGL_X11::GLES_2_0_COMPATIBLE) {
+ if (RasterizerGLES2::is_viable() == OK) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ } else {
+ gl_initialization_error = true;
+ break;
+ }
+ }
+ }
+
+ if (gl_initialization_error) {
+ OS::get_singleton()->alert("Your video card driver does not support any of the supported OpenGL versions.\n"
+ "Please update your drivers or if you have a very old or integrated GPU upgrade it.",
+ "Unable to initialize Video driver");
+ return ERR_UNAVAILABLE;
}
- video_driver_index = p_video_driver; // FIXME TODO - FIX IF DRIVER DETECTION HAPPENS AND GLES2 MUST BE USED
+ video_driver_index = p_video_driver;
context_gl->set_use_vsync(current_videomode.use_vsync);
@@ -340,12 +388,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
set_window_always_on_top(true);
}
- AudioDriverManager::initialize(p_audio_driver);
-
-#ifdef ALSAMIDI_ENABLED
- driver_alsamidi.open();
-#endif
-
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
ERR_FAIL_COND_V(x11_window == 0, ERR_UNAVAILABLE);
@@ -427,9 +469,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
cursor_theme = XcursorGetTheme(x11_display);
if (!cursor_theme) {
- if (is_stdout_verbose()) {
- print_line("XcursorGetTheme could not get cursor theme");
- }
+ print_verbose("XcursorGetTheme could not get cursor theme");
cursor_theme = "default";
}
@@ -442,7 +482,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
current_cursor = CURSOR_ARROW;
if (cursor_theme) {
- //print_line("cursor theme: "+String(cursor_theme));
for (int i = 0; i < CURSOR_MAX; i++) {
static const char *cursor_file[] = {
@@ -468,10 +507,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
if (img[i]) {
cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
- //print_line("found cursor: "+String(cursor_file[i])+" id "+itos(cursors[i]));
} else {
- if (OS::is_stdout_verbose())
- print_line("failed cursor: " + String(cursor_file[i]));
+ print_verbose("Failed loading custom cursor: " + String(cursor_file[i]));
}
}
}
@@ -520,6 +557,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
visual_server->init();
+ AudioDriverManager::initialize(p_audio_driver);
+
input = memnew(InputDefault);
window_has_focus = true; // Set focus to true at init
@@ -1516,7 +1555,6 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
// KeyMappingX11 also translates keysym to unicode.
// It does a binary search on a table to translate
// most properly.
- //print_line("keysym_unicode: "+rtos(keysym_unicode));
unsigned int unicode = keysym_unicode > 0 ? KeyMappingX11::get_unicode_from_keysym(keysym_unicode) : 0;
/* Phase 4, determine if event must be filtered */
@@ -1539,7 +1577,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
// know Mod1 was ALT and Mod4 was META (applekey/winkey)
// just tried Mods until i found them.
- //print_line("mod1: "+itos(xkeyevent->state&Mod1Mask)+" mod 5: "+itos(xkeyevent->state&Mod5Mask));
+ //print_verbose("mod1: "+itos(xkeyevent->state&Mod1Mask)+" mod 5: "+itos(xkeyevent->state&Mod5Mask));
Ref<InputEventKey> k;
k.instance();
@@ -2575,51 +2613,146 @@ void OS_X11::swap_buffers() {
}
void OS_X11::alert(const String &p_alert, const String &p_title) {
+ const char *message_programs[] = { "zenity", "kdialog", "Xdialog", "xmessage" };
+
+ String path = get_environment("PATH");
+ Vector<String> path_elems = path.split(":", false);
+ String program;
+
+ for (int i = 0; i < path_elems.size(); i++) {
+ for (unsigned int k = 0; k < sizeof(message_programs) / sizeof(char *); k++) {
+ String tested_path = path_elems[i] + "/" + message_programs[k];
+
+ if (FileAccess::exists(tested_path)) {
+ program = tested_path;
+ break;
+ }
+ }
+
+ if (program.length())
+ break;
+ }
List<String> args;
- args.push_back("-center");
- args.push_back("-title");
- args.push_back(p_title);
- args.push_back(p_alert);
- execute("xmessage", args, true);
+ if (program.ends_with("zenity")) {
+ args.push_back("--error");
+ args.push_back("--width");
+ args.push_back("500");
+ args.push_back("--title");
+ args.push_back(p_title);
+ args.push_back("--text");
+ args.push_back(p_alert);
+ }
+
+ if (program.ends_with("kdialog")) {
+ args.push_back("--error");
+ args.push_back(p_alert);
+ args.push_back("--title");
+ args.push_back(p_title);
+ }
+
+ if (program.ends_with("Xdialog")) {
+ args.push_back("--title");
+ args.push_back(p_title);
+ args.push_back("--msgbox");
+ args.push_back(p_alert);
+ args.push_back("0");
+ args.push_back("0");
+ }
+
+ if (program.ends_with("xmessage")) {
+ args.push_back("-center");
+ args.push_back("-title");
+ args.push_back(p_title);
+ args.push_back(p_alert);
+ }
+
+ if (program.length()) {
+ execute(program, args, true);
+ } else {
+ print_line(p_alert);
+ }
+
+ return;
+}
+
+bool g_set_icon_error = false;
+int set_icon_errorhandler(Display *dpy, XErrorEvent *ev) {
+ g_set_icon_error = true;
+ return 0;
}
void OS_X11::set_icon(const Ref<Image> &p_icon) {
+ int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&set_icon_errorhandler);
+
Atom net_wm_icon = XInternAtom(x11_display, "_NET_WM_ICON", False);
if (p_icon.is_valid()) {
Ref<Image> img = p_icon->duplicate();
img->convert(Image::FORMAT_RGBA8);
- int w = img->get_width();
- int h = img->get_height();
+ while (true) {
+ int w = img->get_width();
+ int h = img->get_height();
+
+ if (g_set_icon_error) {
+ g_set_icon_error = false;
+
+ WARN_PRINT("Icon too large, attempting to resize icon.");
+
+ int new_width, new_height;
+ if (w > h) {
+ new_width = w / 2;
+ new_height = h * new_width / w;
+ } else {
+ new_height = h / 2;
+ new_width = w * new_height / h;
+ }
+
+ w = new_width;
+ h = new_height;
- // We're using long to have wordsize (32Bit build -> 32 Bits, 64 Bit build -> 64 Bits
- Vector<long> pd;
+ if (!w || !h) {
+ WARN_PRINT("Unable to set icon.");
+ break;
+ }
+
+ img->resize(w, h, Image::INTERPOLATE_CUBIC);
+ }
+
+ // We're using long to have wordsize (32Bit build -> 32 Bits, 64 Bit build -> 64 Bits
+ Vector<long> pd;
- pd.resize(2 + w * h);
+ pd.resize(2 + w * h);
- pd.write[0] = w;
- pd.write[1] = h;
+ pd.write[0] = w;
+ pd.write[1] = h;
- PoolVector<uint8_t>::Read r = img->get_data().read();
+ PoolVector<uint8_t>::Read r = img->get_data().read();
- long *wr = &pd.write[2];
- uint8_t const *pr = r.ptr();
+ long *wr = &pd.write[2];
+ uint8_t const *pr = r.ptr();
- for (int i = 0; i < w * h; i++) {
- long v = 0;
- // A R G B
- v |= pr[3] << 24 | pr[0] << 16 | pr[1] << 8 | pr[2];
- *wr++ = v;
- pr += 4;
+ for (int i = 0; i < w * h; i++) {
+ long v = 0;
+ // A R G B
+ v |= pr[3] << 24 | pr[0] << 16 | pr[1] << 8 | pr[2];
+ *wr++ = v;
+ pr += 4;
+ }
+
+ XChangeProperty(x11_display, x11_window, net_wm_icon, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)pd.ptr(), pd.size());
+
+ if (!g_set_icon_error)
+ break;
}
- XChangeProperty(x11_display, x11_window, net_wm_icon, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)pd.ptr(), pd.size());
} else {
XDeleteProperty(x11_display, x11_window, net_wm_icon);
}
+
XFlush(x11_display);
+ XSetErrorHandler(oldHandler);
}
void OS_X11::force_process_input() {
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index e3b048fd74..9eec8e6cc3 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -121,7 +121,6 @@ void Navigation2D::_navpoly_link(int p_id) {
pending.edge = j;
p.edges.write[j].P = C->get().pending.push_back(pending);
continue;
- //print_line(String()+_get_vertex(ek.a)+" -> "+_get_vertex(ek.b));
}
C->get().B = &p;
@@ -144,8 +143,6 @@ void Navigation2D::_navpoly_unlink(int p_id) {
NavMesh &nm = navpoly_map[p_id];
ERR_FAIL_COND(!nm.linked);
- //print_line("UNLINK");
-
for (List<Polygon>::Element *E = nm.polygons.front(); E; E = E->next()) {
Polygon &p = E->get();
@@ -341,7 +338,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
path.resize(2);
path.write[0] = begin_point;
path.write[1] = end_point;
- //print_line("Direct Path");
return path;
}
@@ -379,7 +375,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
while (!found_route) {
if (open_list.size() == 0) {
- //print_line("NOU OPEN LIST");
break;
}
//check open list
@@ -526,7 +521,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
if (portal_left.distance_squared_to(apex_point) < CMP_EPSILON || CLOCK_TANGENT(apex_point, left, portal_right) > 0) {
left_poly = p;
portal_left = left;
- //print_line("***ADVANCE LEFT");
} else {
apex_point = portal_right;
@@ -537,8 +531,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
if (!path.size() || path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON)
path.push_back(apex_point);
skip = true;
- //print_line("addpoint left");
- //print_line("***CLIP LEFT");
}
}
@@ -547,7 +539,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
if (portal_right.distance_squared_to(apex_point) < CMP_EPSILON || CLOCK_TANGENT(apex_point, right, portal_left) < 0) {
right_poly = p;
portal_right = right;
- //print_line("***ADVANCE RIGHT");
} else {
apex_point = portal_left;
@@ -557,8 +548,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
portal_left = apex_point;
if (!path.size() || path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON)
path.push_back(apex_point);
- //print_line("addpoint right");
- //print_line("***CLIP RIGHT");
}
}
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 2d6679272a..84b12b0bfe 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -257,7 +257,7 @@ void NavigationPolygon::make_polygons_from_outlines() {
TriangulatorPartition tpart;
if (tpart.ConvexPartition_HM(&in_poly, &out_poly) == 0) { //failed!
- print_line("convex partition failed!");
+ ERR_PRINTS("NavigationPolygon: Convex partition failed!");
return;
}
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 1da1d44b17..a4c3057416 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -74,14 +74,14 @@ void Particles2D::set_randomness_ratio(float p_ratio) {
randomness_ratio = p_ratio;
VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
}
-void Particles2D::set_visibility_rect(const Rect2 &p_aabb) {
+void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
- visibility_rect = p_aabb;
+ visibility_rect = p_visibility_rect;
AABB aabb;
- aabb.position.x = p_aabb.position.x;
- aabb.position.y = p_aabb.position.y;
- aabb.size.x = p_aabb.size.x;
- aabb.size.y = p_aabb.size.y;
+ aabb.position.x = p_visibility_rect.position.x;
+ aabb.position.y = p_visibility_rect.position.y;
+ aabb.size.x = p_visibility_rect.size.x;
+ aabb.size.y = p_visibility_rect.size.y;
VS::get_singleton()->particles_set_custom_aabb(particles, aabb);
@@ -326,7 +326,7 @@ void Particles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles2D::set_pre_process_time);
ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles2D::set_explosiveness_ratio);
ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles2D::set_randomness_ratio);
- ClassDB::bind_method(D_METHOD("set_visibility_rect", "aabb"), &Particles2D::set_visibility_rect);
+ ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &Particles2D::set_visibility_rect);
ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates);
ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps);
ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta);
@@ -372,13 +372,13 @@ void Particles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta");
ADD_GROUP("Drawing", "");
- ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_rect"), "set_visibility_rect", "get_visibility_rect");
+ ADD_PROPERTY(PropertyInfo(Variant::RECT2, "visibility_rect"), "set_visibility_rect", "get_visibility_rect");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates");
ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime"), "set_draw_order", "get_draw_order");
ADD_GROUP("Process Material", "process_");
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index f367095581..31a66afb2a 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -84,7 +84,7 @@ public:
void set_pre_process_time(float p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
- void set_visibility_rect(const Rect2 &p_aabb);
+ void set_visibility_rect(const Rect2 &p_visibility_rect);
void set_use_local_coordinates(bool p_enable);
void set_process_material(const Ref<Material> &p_material);
void set_speed_scale(float p_scale);
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 02213e07d0..8e31688d90 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -365,13 +365,6 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap
ERR_FAIL_COND(!contact_monitor);
Map<ObjectID, BodyState>::Element *E = contact_monitor->body_map.find(objid);
- /*if (obj) {
- if (body_in)
- print_line("in: "+String(obj->call("get_name")));
- else
- print_line("out: "+String(obj->call("get_name")));
- }*/
-
ERR_FAIL_COND(!body_in && !E);
if (body_in) {
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 34f4ccc03e..fc0741cc5c 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -253,7 +253,6 @@ void Polygon2D::_notification(int p_what) {
//normalize
for (int j = 0; j < 4; j++) {
weightsw[i * 4 + j] /= tw;
- // print_line("point " + itos(i) + " idx " + itos(j) + " index: " + itos(bonesw[i * 4 + j]) + " weight: " + rtos(weightsw[i * 4 + j]));
}
}
}
@@ -345,8 +344,6 @@ void Polygon2D::_notification(int p_what) {
}
}
- //print_line("loops: " + itos(loops.size()) + " indices: " + itos(indices.size()));
-
VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());
}
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index 26fd5ed658..2cb59c871c 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -374,9 +374,6 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi
capture_subdiv--;
css *= 2.0;
}
-
- print_line("bake subdiv: " + itos(bake_subdiv));
- print_line("capture subdiv: " + itos(capture_subdiv));
}
baker.begin_bake(bake_subdiv, bake_bounds);
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 8b2000d2e9..fa14174089 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -921,8 +921,6 @@ void CPUParticles::_update_particle_data_buffer() {
t = un_transform * t;
}
- // print_line(" particle " + itos(i) + ": " + String(r[idx].active ? "[x]" : "[ ]") + "\n\txform " + r[idx].transform + "\n\t" + r[idx].velocity + "\n\tcolor: " + r[idx].color);
-
if (r[idx].active) {
ptr[0] = t.basis.elements[0][0];
ptr[1] = t.basis.elements[0][1];
@@ -1190,7 +1188,7 @@ void CPUParticles::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps");
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index f5b77d361c..8d84d2408c 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -120,9 +120,7 @@ void Navigation::_navmesh_link(int p_id) {
pending.edge = j;
p.edges.write[j].P = C->get().pending.push_back(pending);
continue;
- //print_line(String()+_get_vertex(ek.a)+" -> "+_get_vertex(ek.b));
}
- //ERR_CONTINUE(C->get().B!=NULL); //wut
C->get().B = &p;
C->get().B_edge = j;
@@ -312,7 +310,6 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
if (!begin_poly || !end_poly) {
- //print_line("No Path Path");
return Vector<Vector3>(); //no path
}
@@ -322,7 +319,6 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
path.resize(2);
path.write[0] = begin_point;
path.write[1] = end_point;
- //print_line("Direct Path");
return path;
}
@@ -347,7 +343,6 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
while (!found_route) {
if (open_list.size() == 0) {
- //print_line("NOU OPEN LIST");
break;
}
//check open list
@@ -581,10 +576,6 @@ Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Ve
}
}
- if (closest_navmesh && closest_navmesh->owner) {
- //print_line("navmesh is: "+Object::cast_to<Node>(closest_navmesh->owner)->get_name());
- }
-
return closest_point;
}
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 4900692155..6ba569ac75 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -329,7 +329,7 @@ void Particles::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps");
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index 7988c43eab..a30fc0ac3e 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -48,18 +48,14 @@ void Joint::_update_joint(bool p_only_free) {
Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL;
Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL;
- if (!node_a || !node_b)
- return;
-
PhysicsBody *body_a = Object::cast_to<PhysicsBody>(node_a);
PhysicsBody *body_b = Object::cast_to<PhysicsBody>(node_b);
- if (!body_a || !body_b)
- return;
-
- if (!body_a) {
+ if (!body_a && body_b)
SWAP(body_a, body_b);
- }
+
+ if (!body_a)
+ return;
joint = _configure_joint(body_a, body_b);
@@ -69,7 +65,8 @@ void Joint::_update_joint(bool p_only_free) {
PhysicsServer::get_singleton()->joint_set_solver_priority(joint, solver_priority);
ba = body_a->get_rid();
- bb = body_b->get_rid();
+ if (body_b)
+ bb = body_b->get_rid();
PhysicsServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 26958930e4..f9d096633c 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -366,22 +366,14 @@ void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
const Vector3 &right = wheel.m_raycastInfo.m_wheelAxleWS;
Vector3 fwd = up.cross(right);
fwd = fwd.normalized();
- //up = right.cross(fwd);
- //up.normalize();
//rotate around steering over de wheelAxleWS
real_t steering = wheel.steers ? m_steeringValue : 0.0;
- //print_line(itos(p_idx)+": "+rtos(steering));
Basis steeringMat(up, steering);
Basis rotatingMat(right, wheel.m_rotation);
- /*
- if (p_idx==1)
- print_line("steeringMat " +steeringMat);
- */
-
Basis basis2(
right[0], up[0], fwd[0],
right[1], up[1], fwd[1],
@@ -420,8 +412,6 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
wheel.m_raycastInfo.m_groundObject = 0;
if (col) {
- //print_line("WHEEL "+itos(p_idx)+" FROM "+source+" TO: "+target);
- //print_line("WHEEL "+itos(p_idx)+" COLLIDE? "+itos(col));
param = source.distance_to(rr.position) / source.distance_to(target);
depth = raylen * param;
wheel.m_raycastInfo.m_contactNormalWS = rr.normal;
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index f3abdc6bbe..e846e1763d 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -491,8 +491,6 @@ Vector<Color> VoxelLightBaker::_get_bake_texture(Ref<Image> p_image, const Color
p_image = p_image->duplicate();
if (p_image->is_compressed()) {
- print_line("DECOMPRESSING!!!!");
-
p_image->decompress();
}
p_image->convert(Image::FORMAT_RGBA8);
@@ -859,7 +857,6 @@ void VoxelLightBaker::plot_light_directional(const Vector3 &p_direction, const C
int idx = first_leaf;
while (idx >= 0) {
- //print_line("plot idx " + itos(idx));
Light *light = &light_data[idx];
Vector3 to(light->x + 0.5, light->y + 0.5, light->z + 0.5);
@@ -949,7 +946,6 @@ void VoxelLightBaker::plot_light_omni(const Vector3 &p_pos, const Color &p_color
int idx = first_leaf;
while (idx >= 0) {
- //print_line("plot idx " + itos(idx));
Light *light = &light_data[idx];
Vector3 to(light->x + 0.5, light->y + 0.5, light->z + 0.5);
@@ -1079,7 +1075,6 @@ void VoxelLightBaker::plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axi
int idx = first_leaf;
while (idx >= 0) {
- //print_line("plot idx " + itos(idx));
Light *light = &light_data[idx];
Vector3 to(light->x + 0.5, light->y + 0.5, light->z + 0.5);
@@ -1498,12 +1493,8 @@ void VoxelLightBaker::_sample_baked_octree_filtered_and_anisotropic(const Vector
for (int i = 0; i < 6; i++) {
//anisotropic read light
float amount = p_direction.dot(aniso_normal[i]);
- //if (c == 0) {
- // print_line("\t" + itos(n) + " aniso " + itos(i) + " " + rtos(light[cell].accum[i][0]) + " VEC: " + aniso_normal[i]);
- //}
if (amount < 0)
amount = 0;
- //amount = 1;
color[c][n].x += light[cell].accum[i][0] * amount;
color[c][n].y += light[cell].accum[i][1] * amount;
color[c][n].z += light[cell].accum[i][2] * amount;
@@ -1513,8 +1504,6 @@ void VoxelLightBaker::_sample_baked_octree_filtered_and_anisotropic(const Vector
color[c][n].y += cells[cell].emission[1];
color[c][n].z += cells[cell].emission[2];
}
-
- //print_line("\tlev " + itos(c) + " - " + itos(n) + " alpha: " + rtos(cells[test_cell].alpha) + " col: " + color[c][n]);
}
}
@@ -1559,8 +1548,6 @@ void VoxelLightBaker::_sample_baked_octree_filtered_and_anisotropic(const Vector
r_color = color_interp[0].linear_interpolate(color_interp[1], level_filter);
r_alpha = Math::lerp(alpha_interp[0], alpha_interp[1], level_filter);
-
- // print_line("pos: " + p_posf + " level " + rtos(p_level) + " down to " + itos(target_level) + "." + rtos(level_filter) + " color " + r_color + " alpha " + rtos(r_alpha));
}
Vector3 VoxelLightBaker::_voxel_cone_trace(const Vector3 &p_pos, const Vector3 &p_normal, float p_aperture) {
@@ -1577,8 +1564,6 @@ Vector3 VoxelLightBaker::_voxel_cone_trace(const Vector3 &p_pos, const Vector3 &
while (dist < max_distance && alpha < 0.95) {
float diameter = MAX(1.0, 2.0 * p_aperture * dist);
- //print_line("VCT: pos " + (p_pos + dist * p_normal) + " dist " + rtos(dist) + " mipmap " + rtos(log2(diameter)) + " alpha " + rtos(alpha));
- //Plane scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) );
_sample_baked_octree_filtered_and_anisotropic(p_pos + dist * p_normal, p_normal, log2(diameter), scolor, salpha);
float a = (1.0 - alpha);
color += scolor * a;
@@ -1601,7 +1586,6 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
Vector3 bitangent = tangent.cross(p_normal).normalized();
Basis normal_xform = Basis(tangent, bitangent, p_normal).transposed();
- // print_line("normal xform: " + normal_xform);
const Vector3 *cone_dirs;
const float *cone_weights;
int cone_dir_count;
@@ -1667,10 +1651,7 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
Vector3 accum;
for (int i = 0; i < cone_dir_count; i++) {
- // if (i > 0)
- // continue;
Vector3 dir = normal_xform.xform(cone_dirs[i]).normalized(); //normal may not completely correct when transformed to cell
- //print_line("direction: " + dir);
accum += _voxel_cone_trace(p_pos, dir, cone_aperture) * cone_weights[i];
}
@@ -1802,7 +1783,6 @@ void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) {
LightMap *pixel = &p_line[p_x];
if (pixel->pos == Vector3())
return;
- //print_line("pos: " + pixel->pos + " normal " + pixel->normal);
switch (bake_mode) {
case BAKE_MODE_CONE_TRACE: {
pixel->light = _compute_pixel_light_at_pos(pixel->pos, pixel->normal) * energy;
@@ -1810,8 +1790,6 @@ void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) {
case BAKE_MODE_RAY_TRACE: {
pixel->light = _compute_ray_trace_at_pos(pixel->pos, pixel->normal) * energy;
} break;
- // pixel->light = Vector3(1, 1, 1);
- //}
}
}
@@ -1895,7 +1873,6 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
if (bake_mode == BAKE_MODE_RAY_TRACE) {
//blur
- print_line("bluring, use pos for separatable copy");
//gauss kernel, 7 step sigma 2
static const float gauss_kernel[4] = { 0.214607, 0.189879, 0.131514, 0.071303 };
//horizontal pass
@@ -1960,8 +1937,6 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
#pragma omp parallel
#endif
for (int i = 0; i < height; i++) {
-
- //print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic, 1)
#endif
@@ -2304,7 +2279,6 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) {
mm->set_transform_format(MultiMesh::TRANSFORM_3D);
mm->set_color_format(MultiMesh::COLOR_8BIT);
- print_line("leaf voxels: " + itos(leaf_voxel_count));
mm->set_instance_count(leaf_voxel_count);
Ref<ArrayMesh> mesh;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index a660665d3f..d8db1973d2 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -960,8 +960,6 @@ Error AnimationPlayer::add_animation(const StringName &p_name, const Ref<Animati
ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER);
- //print_line("Add anim: "+String(p_name)+" name: "+p_animation->get_name());
-
if (animation_set.has(p_name)) {
_unref_anim(animation_set[p_name].animation);
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 76f0ee9359..73bd00e456 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -109,12 +109,12 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
Ref<AnimationNode> node = blend_tree->get_node(node_name);
//inputs.write[p_input].last_pass = state->last_pass;
- float activity=0;
+ float activity = 0;
float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);
Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path);
- if (activity_ptr && p_input<activity_ptr->size()) {
+ if (activity_ptr && p_input < activity_ptr->size()) {
activity_ptr->write[p_input].last_pass = state->last_pass;
activity_ptr->write[p_input].activity = activity;
}
@@ -698,6 +698,28 @@ void AnimationTree::_process_graph(float p_delta) {
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));
+ ObjectID current_animation_player = 0;
+
+ if (player) {
+ current_animation_player = player->get_instance_id();
+ }
+
+ if (last_animation_player != current_animation_player) {
+
+ if (last_animation_player) {
+ Object *old_player = ObjectDB::get_instance(last_animation_player);
+ if (old_player) {
+ old_player->disconnect("caches_cleared", this, "_clear_caches");
+ }
+ }
+
+ if (player) {
+ player->connect("caches_cleared", this, "_clear_caches");
+ }
+
+ last_animation_player = current_animation_player;
+ }
+
if (!player) {
ERR_PRINT("AnimationTree: path points to a node not an AnimationPlayer, disabling playback");
set_active(false);
@@ -1197,6 +1219,13 @@ void AnimationTree::_notification(int p_what) {
if (p_what == NOTIFICATION_EXIT_TREE) {
_clear_caches();
+ if (last_animation_player) {
+
+ Object *old_player = ObjectDB::get_instance(last_animation_player);
+ if (old_player) {
+ old_player->disconnect("caches_cleared", this, "_clear_caches");
+ }
+ }
}
}
@@ -1296,13 +1325,13 @@ void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<A
if (node->get_input_count() && !input_activity_map.has(p_base_path)) {
Vector<Activity> activity;
- for(int i=0;i<node->get_input_count();i++) {
+ for (int i = 0; i < node->get_input_count(); i++) {
Activity a;
- a.last_pass=0;
+ a.last_pass = 0;
activity.push_back(a);
}
input_activity_map[p_base_path] = activity;
- input_activity_map_get[String(p_base_path).substr(0,String(p_base_path).length()-1)]=&input_activity_map[p_base_path];
+ input_activity_map_get[String(p_base_path).substr(0, String(p_base_path).length() - 1)] = &input_activity_map[p_base_path];
}
List<PropertyInfo> plist;
@@ -1402,14 +1431,14 @@ void AnimationTree::rename_parameter(const String &p_base, const String &p_new_b
_update_properties();
}
-float AnimationTree::get_connection_activity(const StringName& p_path,int p_connection) const {
+float AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const {
if (!input_activity_map_get.has(p_path)) {
return 0;
}
const Vector<Activity> *activity = input_activity_map_get[p_path];
- if (!activity || p_connection<0 || p_connection>=activity->size()) {
+ if (!activity || p_connection < 0 || p_connection >= activity->size()) {
return 0;
}
@@ -1420,7 +1449,6 @@ float AnimationTree::get_connection_activity(const StringName& p_path,int p_conn
return (*activity)[p_connection].activity;
}
-
void AnimationTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active);
ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active);
@@ -1447,6 +1475,7 @@ void AnimationTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationTree::advance);
ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationTree::_node_removed);
+ ClassDB::bind_method(D_METHOD("_clear_caches"), &AnimationTree::_clear_caches);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tree_root", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode"), "set_tree_root", "get_tree_root");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "anim_player", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "AnimationPlayer"), "set_animation_player", "get_animation_player");
@@ -1468,6 +1497,7 @@ AnimationTree::AnimationTree() {
setup_pass = 1;
started = true;
properties_dirty = true;
+ last_animation_player = 0;
}
AnimationTree::~AnimationTree() {
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index 70f3932f21..6cb363d50a 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -266,6 +266,8 @@ private:
void _update_properties_for_node(const String &p_base_path, Ref<AnimationNode> node);
+ ObjectID last_animation_player;
+
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp
index 9b1cb1369a..69975e6195 100644
--- a/scene/animation/skeleton_ik.cpp
+++ b/scene/animation/skeleton_ik.cpp
@@ -54,9 +54,9 @@ FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::add_child(
}
/// Build a chain that starts from the root to tip
-void FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain) {
+bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain) {
- ERR_FAIL_COND(-1 == p_task->root_bone);
+ ERR_FAIL_COND_V(-1 == p_task->root_bone, false);
Chain &chain(p_task->chain);
@@ -77,8 +77,8 @@ void FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
for (int x = p_task->end_effectors.size() - 1; 0 <= x; --x) {
const EndEffector *ee(&p_task->end_effectors[x]);
- ERR_FAIL_COND(p_task->root_bone >= ee->tip_bone);
- ERR_FAIL_INDEX(ee->tip_bone, p_task->skeleton->get_bone_count());
+ ERR_FAIL_COND_V(p_task->root_bone >= ee->tip_bone, false);
+ ERR_FAIL_INDEX_V(ee->tip_bone, p_task->skeleton->get_bone_count(), false);
sub_chain_size = 0;
// Picks all IDs that composing a single chain in reverse order (except the root)
@@ -133,6 +133,7 @@ void FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
break;
}
}
+ return true;
}
void FabrikInverseKinematic::update_chain(const Skeleton *p_sk, ChainItem *p_chain_item) {
@@ -247,7 +248,10 @@ FabrikInverseKinematic::Task *FabrikInverseKinematic::create_simple_task(Skeleto
task->end_effectors.push_back(ee);
task->goal_global_transform = goal_transform;
- build_chain(task);
+ if (!build_chain(task)) {
+ free_task(task);
+ return NULL;
+ }
return task;
}
@@ -535,8 +539,10 @@ void SkeletonIK::reload_chain() {
return;
task = FabrikInverseKinematic::create_simple_task(skeleton, skeleton->find_bone(root_bone), skeleton->find_bone(tip_bone), _get_target_transform());
- task->max_iterations = max_iterations;
- task->min_distance = min_distance;
+ if (task) {
+ task->max_iterations = max_iterations;
+ task->min_distance = min_distance;
+ }
}
void SkeletonIK::reload_goal() {
diff --git a/scene/animation/skeleton_ik.h b/scene/animation/skeleton_ik.h
index 08fb00e798..202d6959bb 100644
--- a/scene/animation/skeleton_ik.h
+++ b/scene/animation/skeleton_ik.h
@@ -123,7 +123,7 @@ public:
private:
/// Init a chain that starts from the root to tip
- static void build_chain(Task *p_task, bool p_force_simple_chain = true);
+ static bool build_chain(Task *p_task, bool p_force_simple_chain = true);
static void update_chain(const Skeleton *p_sk, ChainItem *p_chain_item);
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index acdbd9de08..d17ae1d84c 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -31,7 +31,6 @@
#include "base_button.h"
#include "os/keyboard.h"
-#include "print_string.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
@@ -361,7 +360,6 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
return DRAW_DISABLED;
};
- //print_line("press attempt: "+itos(status.press_attempt)+" hover: "+itos(status.hovering)+" pressed: "+itos(status.pressed));
if (status.press_attempt == false && status.hovering && !status.pressed) {
return DRAW_HOVER;
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 03b25a138f..a34f2f1ad5 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "button.h"
-#include "print_string.h"
#include "servers/visual_server.h"
#include "translation.h"
@@ -76,8 +75,6 @@ void Button::_notification(int p_what) {
Color color;
Color color_icon(1, 1, 1, 1);
- //print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode()));
-
Ref<StyleBox> style = get_stylebox("normal");
switch (get_draw_mode()) {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 18f06eca31..e094a063be 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -357,7 +357,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
if (data.shader_override.has(E->get()))
hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
- p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_shaders/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemShader,CanvasItemShaderGraph", hint));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_shaders/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "Shader,VisualShader", hint));
}
}
{
@@ -769,6 +769,7 @@ void Control::force_drag(const Variant &p_data, Control *p_control) {
void Control::set_drag_preview(Control *p_control) {
ERR_FAIL_COND(!is_inside_tree());
+ ERR_FAIL_COND(get_viewport()->gui_is_dragging());
get_viewport()->_gui_set_drag_preview(this, p_control);
}
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 635f812805..9bddaa7d29 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -284,7 +284,13 @@ bool FileDialog::_is_open_should_be_disabled() {
if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE)
return false;
- TreeItem *ti = tree->get_selected();
+ TreeItem *ti = tree->get_next_selected(tree->get_root());
+ while (ti) {
+ TreeItem *prev_ti = ti;
+ ti = tree->get_next_selected(tree->get_root());
+ if (ti == prev_ti)
+ break;
+ }
// We have something that we can't select?
if (!ti)
return mode != MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
@@ -328,6 +334,10 @@ void FileDialog::deselect_items() {
}
}
+void FileDialog::_tree_multi_selected(Object *p_object, int p_cell, bool p_selected) {
+ _tree_selected();
+}
+
void FileDialog::_tree_selected() {
TreeItem *ti = tree->get_selected();
@@ -754,6 +764,7 @@ void FileDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_unhandled_input"), &FileDialog::_unhandled_input);
+ ClassDB::bind_method(D_METHOD("_tree_multi_selected"), &FileDialog::_tree_multi_selected);
ClassDB::bind_method(D_METHOD("_tree_selected"), &FileDialog::_tree_selected);
ClassDB::bind_method(D_METHOD("_tree_item_activated"), &FileDialog::_tree_item_activated);
ClassDB::bind_method(D_METHOD("_dir_entered"), &FileDialog::_dir_entered);
@@ -794,7 +805,7 @@ void FileDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mode_overrides_title"), "set_mode_overrides_title", "is_mode_overriding_title");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open File,Open Files,Open Folder,Open Any,Save"), "set_mode", "get_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access");
ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "filters"), "set_filters", "get_filters");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
@@ -890,6 +901,7 @@ FileDialog::FileDialog() {
_update_drives();
connect("confirmed", this, "_action_pressed");
+ tree->connect("multi_selected", this, "_tree_multi_selected", varray(), CONNECT_DEFERRED);
tree->connect("cell_selected", this, "_tree_selected", varray(), CONNECT_DEFERRED);
tree->connect("item_activated", this, "_tree_item_activated", varray());
tree->connect("nothing_selected", this, "deselect_items");
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index ad483d5dab..3227f1c3a8 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -104,6 +104,7 @@ private:
void update_file_list();
void update_filters();
+ void _tree_multi_selected(Object *p_object, int p_cell, bool p_selected);
void _tree_selected();
void _select_drive(int p_idx);
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index d61bd97c2a..9f5c12e87f 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -502,7 +502,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
bool selected = !items[j].selected;
select(j, false);
if (selected)
- emit_signal("multi_selected", i, true);
+ emit_signal("multi_selected", j, true);
}
if (mb->get_button_index() == BUTTON_RIGHT) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 549daecdae..1f3d5e6e13 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -866,15 +866,14 @@ void LineEdit::_notification(int p_what) {
void LineEdit::copy_text() {
- if (selection.enabled) {
-
+ if (selection.enabled && !pass) {
OS::get_singleton()->set_clipboard(text.substr(selection.begin, selection.end - selection.begin));
}
}
void LineEdit::cut_text() {
- if (selection.enabled) {
+ if (selection.enabled && !pass) {
OS::get_singleton()->set_clipboard(text.substr(selection.begin, selection.end - selection.begin));
selection_delete();
}
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index d862e8669c..8560efdde5 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -68,8 +68,6 @@ void LinkButton::_notification(int p_what) {
Color color;
bool do_underline = false;
- //print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode()));
-
switch (get_draw_mode()) {
case DRAW_NORMAL: {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index a3748bf14c..a5f9bea1b1 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2034,7 +2034,6 @@ void RichTextLabel::selection_copy() {
if (text != "") {
OS::get_singleton()->set_clipboard(text);
- //print_line("COPY: "+text);
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 9a8dc62e4e..ec98b01ced 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -5640,6 +5640,10 @@ void TextEdit::_confirm_completion() {
end_complex_operation();
_cancel_completion();
+
+ if (last_completion_char == '(') {
+ query_code_comple();
+ }
}
void TextEdit::_cancel_code_hint() {
@@ -5692,15 +5696,12 @@ void TextEdit::_update_completion_candidates() {
bool pre_keyword = false;
bool cancel = false;
- //print_line("inquote: "+itos(inquote)+"first quote "+itos(first_quote)+" cofs-1 "+itos(cofs-1));
if (!inquote && first_quote == cofs - 1) {
//no completion here
- //print_line("cancel!");
cancel = true;
} else if (inquote && first_quote != -1) {
s = l.substr(first_quote, cofs - first_quote);
- //print_line("s: 1"+s);
} else if (cofs > 0 && l[cofs - 1] == ' ') {
int kofs = cofs - 1;
String kw;
@@ -5713,7 +5714,6 @@ void TextEdit::_update_completion_candidates() {
}
pre_keyword = keywords.has(kw);
- //print_line("KW "+kw+"? "+itos(pre_keyword));
} else {
@@ -5755,43 +5755,23 @@ void TextEdit::_update_completion_candidates() {
completion_strings.write[i] = completion_strings[i].unquote().quote("'");
}
- if (s == completion_strings[i]) {
- // A perfect match, stop completion
- _cancel_completion();
- return;
+ if (completion_strings[i].begins_with(s)) {
+ completion_options.push_back(completion_strings[i]);
}
+ }
- if (s.is_subsequence_ofi(completion_strings[i])) {
- // don't remove duplicates if no input is provided
- if (s != "" && completion_options.find(completion_strings[i]) != -1) {
- continue;
- }
- // Calculate the similarity to keep completions in good order
- float similarity;
- if (completion_strings[i].begins_with(s)) {
- // Substrings (same case) are the best candidates
- similarity = 1.2;
- } else if (completion_strings[i].to_lower().begins_with(s.to_lower())) {
- // then any substrings
- similarity = 1.1;
- } else {
- // Otherwise compute the similarity
- similarity = s.to_lower().similarity(completion_strings[i].to_lower());
+ if (completion_options.size() == 0) {
+ for (int i = 0; i < completion_strings.size(); i++) {
+ if (s.is_subsequence_of(completion_strings[i])) {
+ completion_options.push_back(completion_strings[i]);
}
+ }
+ }
- int comp_size = completion_options.size();
- if (comp_size == 0) {
+ if (completion_options.size() == 0) {
+ for (int i = 0; i < completion_strings.size(); i++) {
+ if (s.is_subsequence_ofi(completion_strings[i])) {
completion_options.push_back(completion_strings[i]);
- sim_cache.push_back(similarity);
- } else {
- float comp_sim;
- int pos = 0;
- do {
- comp_sim = sim_cache[pos++];
- } while (pos < comp_size && similarity < comp_sim);
- pos = similarity > comp_sim ? pos - 1 : pos; // Pos will be off by one
- completion_options.insert(pos, completion_strings[i]);
- sim_cache.insert(pos, similarity);
}
}
}
@@ -5799,7 +5779,12 @@ void TextEdit::_update_completion_candidates() {
if (completion_options.size() == 0) {
//no options to complete, cancel
_cancel_completion();
+ return;
+ }
+ if (completion_options.size() == 1 && s == completion_options[0]) {
+ // A perfect match, stop completion
+ _cancel_completion();
return;
}
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 6e4fe88dbf..ff90576c1b 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -266,6 +266,8 @@ void TextureProgress::draw_nine_patch_stretched(const Ref<Texture> &p_texture, F
}
}
+ p_texture->get_rect_region(dst_rect, src_rect, dst_rect, src_rect);
+
RID ci = get_canvas_item();
VS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright, VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, true, p_modulate);
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index f6905e7c2e..e30f58e012 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2082,9 +2082,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
} else {
Object *obj = ClassDB::instance(get_class());
- if (!obj) {
- print_line("could not duplicate: " + String(get_class()));
- }
+ ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class()));
ERR_FAIL_COND(!obj);
node = Object::cast_to<Node>(obj);
if (!node)
@@ -2179,9 +2177,7 @@ Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const {
Node *node = NULL;
Object *obj = ClassDB::instance(get_class());
- if (!obj) {
- print_line("could not duplicate: " + String(get_class()));
- }
+ ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class()));
ERR_FAIL_COND_V(!obj, NULL);
node = Object::cast_to<Node>(obj);
if (!node)
@@ -2472,7 +2468,7 @@ static void _Node_debug_sn(Object *p_obj) {
path = n->get_name();
else
path = String(p->get_name()) + "/" + p->get_path_to(n);
- print_line(itos(p_obj->get_instance_id()) + "- Stray Node: " + path + " (Type: " + n->get_class() + ")");
+ print_line(itos(p_obj->get_instance_id()) + " - Stray Node: " + path + " (Type: " + n->get_class() + ")");
}
void Node::_print_stray_nodes() {
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index e99f785848..1d23650a1e 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1195,8 +1195,6 @@ void SceneTree::_update_root_rect() {
VisualServer::get_singleton()->black_bars_set_margins(0, 0, 0, 0);
}
- //print_line("VP SIZE: "+viewport_size+" OFFSET: "+offset+" = "+(offset*2+viewport_size));
- //print_line("SS: "+video_mode);
switch (stretch_mode) {
case STRETCH_MODE_2D: {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index f92b6e7583..d1b3eb9d9a 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -185,6 +185,7 @@ public:
Viewport::GUI::GUI() {
+ dragging = false;
mouse_focus = NULL;
mouse_click_grabber = NULL;
mouse_focus_button = -1;
@@ -1506,12 +1507,6 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_
if (Object::cast_to<Viewport>(p_node))
return NULL;
- Control *c = Object::cast_to<Control>(p_node);
-
- if (c) {
- //print_line("at "+String(c->get_path())+" POS "+c->get_position()+" bt "+p_xform);
- }
-
//subwindows first!!
if (!p_node->is_visible()) {
@@ -1524,6 +1519,8 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_
if (matrix.basis_determinant() == 0.0f)
return NULL;
+ Control *c = Object::cast_to<Control>(p_node);
+
if (!c || !c->clips_input() || c->has_point(matrix.affine_inverse().xform(p_global))) {
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
@@ -1654,7 +1651,6 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
*/
gui.mouse_focus = _gui_find_control(pos);
- //print_line("has mf "+itos(gui.mouse_focus!=NULL));
gui.mouse_focus_button = mb->get_button_index();
if (!gui.mouse_focus) {
@@ -1683,11 +1679,6 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
arr.push_back(gui.mouse_focus->get_class());
ScriptDebugger::get_singleton()->send_message("click_ctrl", arr);
}
-
-/*if (bool(GLOBAL_DEF("debug/print_clicked_control",false))) {
-
- print_line(String(gui.mouse_focus->get_path())+" - "+pos);
- }*/
#endif
if (mb->get_button_index() == BUTTON_LEFT) { //assign focus
@@ -1728,6 +1719,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
}
gui.drag_data = Variant();
+ gui.dragging = false;
if (gui.drag_preview) {
memdelete(gui.drag_preview);
@@ -1757,6 +1749,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
}
gui.drag_data = Variant();
+ gui.dragging = false;
_propagate_viewport_notification(this, NOTIFICATION_DRAG_END);
//change mouse accordingly
}
@@ -1819,10 +1812,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Control *control = Object::cast_to<Control>(ci);
if (control) {
+ gui.dragging = true;
gui.drag_data = control->get_drag_data(control->get_global_transform_with_canvas().affine_inverse().xform(mpos) - gui.drag_accum);
if (gui.drag_data.get_type() != Variant::NIL) {
gui.mouse_focus = NULL;
+ } else {
+ gui.dragging = false;
}
if (control->data.mouse_filter == Control::MOUSE_FILTER_STOP)
@@ -2262,6 +2258,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control *
ERR_EXPLAIN("Drag data must be a value");
ERR_FAIL_COND(p_data.get_type() == Variant::NIL);
+ gui.dragging = true;
gui.drag_data = p_data;
gui.mouse_focus = NULL;
@@ -2701,6 +2698,9 @@ bool Viewport::is_snap_controls_to_pixels_enabled() const {
return snap_controls_to_pixels;
}
+bool Viewport::gui_is_dragging() const {
+ return gui.dragging;
+}
void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_arvr", "use"), &Viewport::set_use_arvr);
@@ -2787,6 +2787,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack);
ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data);
+ ClassDB::bind_method(D_METHOD("gui_is_dragging"), &Viewport::gui_is_dragging);
ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input);
ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index e4ef373c77..450f235b79 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -274,6 +274,7 @@ private:
bool roots_order_dirty;
List<Control *> roots;
int canvas_sort_index; //for sorting items with canvas as root
+ bool dragging;
GUI();
} gui;
@@ -474,6 +475,8 @@ public:
void _subwindow_visibility_changed();
+ bool gui_is_dragging() const;
+
Viewport();
~Viewport();
};
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index da4e2f991d..dccdd244ef 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -150,7 +150,6 @@
#include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/scene_format_text.h"
#include "scene/resources/segment_shape_2d.h"
-#include "scene/resources/shader_graph.h"
#include "scene/resources/shape_line_2d.h"
#include "scene/resources/sky_box.h"
#include "scene/resources/sphere_shape.h"
@@ -564,6 +563,9 @@ void register_scene_types() {
/* REGISTER RESOURCES */
ClassDB::register_virtual_class<Shader>();
+ ClassDB::register_class<ParticlesMaterial>();
+ SceneTree::add_idle_callback(ParticlesMaterial::flush_changes);
+ ParticlesMaterial::init_shaders();
#ifndef _3D_DISABLED
ClassDB::register_virtual_class<Mesh>();
@@ -581,10 +583,6 @@ void register_scene_types() {
SceneTree::add_idle_callback(SpatialMaterial::flush_changes);
SpatialMaterial::init_shaders();
- ClassDB::register_class<ParticlesMaterial>();
- SceneTree::add_idle_callback(ParticlesMaterial::flush_changes);
- ParticlesMaterial::init_shaders();
-
ClassDB::register_class<MultiMesh>();
ClassDB::register_class<MeshLibrary>();
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 7041b62487..58e6db3f5e 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -2906,8 +2906,6 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons
//able to optimize more
erase = false;
} else {
-
- //print_line(itos(i)+"because of interp");
}
}
}
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index 39206ed043..5694099754 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -492,18 +492,14 @@ static void fill_bits(const BitMap *p_src, Ref<BitMap> &p_map, const Point2i &p_
}
} while (reenter || popped);
-#ifdef DEBUG_ENABLED
- print_line("max stack size: " + itos(stack.size()));
-#endif
+ print_verbose("BitMap: Max stack size: " + itos(stack.size()));
}
Vector<Vector<Vector2> > BitMap::clip_opaque_to_polygons(const Rect2 &p_rect, float p_epsilon) const {
Rect2i r = Rect2i(0, 0, width, height).clip(p_rect);
+ print_verbose("BitMap: Rect: " + r);
-#ifdef DEBUG_ENABLED
- print_line("Rect: " + r);
-#endif
Point2i from;
Ref<BitMap> fill;
fill.instance();
@@ -515,13 +511,9 @@ Vector<Vector<Vector2> > BitMap::clip_opaque_to_polygons(const Rect2 &p_rect, fl
if (!fill->get_bit(Point2(j, i)) && get_bit(Point2(j, i))) {
Vector<Vector2> polygon = _march_square(r, Point2i(j, i));
-#ifdef DEBUG_ENABLED
- print_line("pre reduce: " + itos(polygon.size()));
-#endif
+ print_verbose("BitMap: Pre reduce: " + itos(polygon.size()));
polygon = reduce(polygon, r, p_epsilon);
-#ifdef DEBUG_ENABLED
- print_line("post reduce: " + itos(polygon.size()));
-#endif
+ print_verbose("BitMap: Post reduce: " + itos(polygon.size()));
polygons.push_back(polygon);
fill_bits(this, fill, Point2i(j, i), r);
}
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 2f2abd4e08..4df849df6a 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -435,8 +435,6 @@ DynamicFontAtSize::TexturePosition DynamicFontAtSize::_find_texture_pos_for_glyp
break;
}
- //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y));
-
if (ret.index == -1) {
//could not find texture to fit, create one
ret.x = 0;
@@ -1036,6 +1034,8 @@ SelfList<DynamicFont>::List DynamicFont::dynamic_fonts;
DynamicFont::DynamicFont() :
font_list(this) {
+ cache_id.size = 16;
+ outline_cache_id.size = 16;
spacing_top = 0;
spacing_bottom = 0;
spacing_char = 0;
diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp
index 29f1106d16..be394e19c4 100644
--- a/scene/resources/dynamic_font_stb.cpp
+++ b/scene/resources/dynamic_font_stb.cpp
@@ -214,7 +214,6 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
int advance;
stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0);
- //print_line("char has no bitmap: "+itos(p_char)+" but advance is "+itos(advance*scale));
Character ch;
ch.texture_idx = -1;
ch.advance = advance * scale;
@@ -279,8 +278,6 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
break;
}
- //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y));
-
if (tex_index == -1) {
//could not find texture to fit, create one
tex_x = 0;
@@ -364,8 +361,6 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
chr.rect = Rect2(tex_x + rect_margin, tex_y + rect_margin, w, h);
- //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" RECT: "+chr.rect+" X OFS: "+itos(xofs)+" Y OFS: "+itos(yofs));
-
char_map[p_char] = chr;
stbtt_FreeBitmap(cpbitmap, NULL);
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index dcd87a2a61..e6ef956dc5 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -482,6 +482,11 @@ void Mesh::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "lightmap_size_hint"), "set_lightmap_size_hint", "get_lightmap_size_hint");
+ ClassDB::bind_method(D_METHOD("get_surface_count"), &Mesh::get_surface_count);
+ ClassDB::bind_method(D_METHOD("surface_get_arrays", "surf_idx"), &Mesh::surface_get_arrays);
+ ClassDB::bind_method(D_METHOD("surface_get_blend_shape_arrays", "surf_idx"), &Mesh::surface_get_blend_shape_arrays);
+ ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &Mesh::surface_get_material);
+
BIND_ENUM_CONSTANT(PRIMITIVE_POINTS);
BIND_ENUM_CONSTANT(PRIMITIVE_LINES);
BIND_ENUM_CONSTANT(PRIMITIVE_LINE_STRIP);
@@ -1241,7 +1246,7 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
surfaces_tools.push_back(st); //stay there
}
- print_line("gen indices: " + itos(gen_index_count));
+ print_verbose("Mesh: Gen indices: " + itos(gen_index_count));
//go through all indices
for (int i = 0; i < gen_index_count; i += 3) {
@@ -1313,7 +1318,6 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_blend_shape_mode"), &ArrayMesh::get_blend_shape_mode);
ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "compress_flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(ARRAY_COMPRESS_DEFAULT));
- ClassDB::bind_method(D_METHOD("get_surface_count"), &ArrayMesh::get_surface_count);
ClassDB::bind_method(D_METHOD("surface_remove", "surf_idx"), &ArrayMesh::surface_remove);
ClassDB::bind_method(D_METHOD("surface_update_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_region);
ClassDB::bind_method(D_METHOD("surface_get_array_len", "surf_idx"), &ArrayMesh::surface_get_array_len);
@@ -1321,12 +1325,9 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format);
ClassDB::bind_method(D_METHOD("surface_get_primitive_type", "surf_idx"), &ArrayMesh::surface_get_primitive_type);
ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material"), &ArrayMesh::surface_set_material);
- ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &ArrayMesh::surface_get_material);
ClassDB::bind_method(D_METHOD("surface_find_by_name", "name"), &ArrayMesh::surface_find_by_name);
ClassDB::bind_method(D_METHOD("surface_set_name", "surf_idx", "name"), &ArrayMesh::surface_set_name);
ClassDB::bind_method(D_METHOD("surface_get_name", "surf_idx"), &ArrayMesh::surface_get_name);
- ClassDB::bind_method(D_METHOD("surface_get_arrays", "surf_idx"), &ArrayMesh::surface_get_arrays);
- ClassDB::bind_method(D_METHOD("surface_get_blend_shape_arrays", "surf_idx"), &ArrayMesh::surface_get_blend_shape_arrays);
ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape);
ClassDB::bind_method(D_METHOD("create_convex_shape"), &ArrayMesh::create_convex_shape);
ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline);
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 07783d5f4a..f034e07ff9 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -106,7 +106,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
if (i == 0 && base_scene_idx >= 0) {
//scene inheritance on root node
- //print_line("scene inherit");
Ref<PackedScene> sdata = props[base_scene_idx];
ERR_FAIL_COND_V(!sdata.is_valid(), NULL);
node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state
@@ -117,7 +116,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
} else if (n.instance >= 0) {
//instance a scene into this node
- //print_line("instance");
if (n.instance & FLAG_INSTANCE_IS_PLACEHOLDER) {
String path = props[n.instance & FLAG_MASK];
@@ -141,7 +139,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
}
} else if (n.type == TYPE_INSTANCED) {
- //print_line("instanced");
//get the node from somewhere, it likely already exists from another instance
if (parent) {
node = parent->_get_child_by_name(snames[n.name]);
@@ -152,7 +149,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
#endif
}
} else if (ClassDB::is_class_enabled(snames[n.type])) {
- //print_line("created");
//node belongs to this scene and must be created
Object *obj = ClassDB::instance(snames[n.type]);
if (!Object::cast_to<Node>(obj)) {
@@ -491,15 +487,6 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
if (E->get().usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) {
isdefault = true; //is script default value
}
- /*
- if (nd.instance<0 && ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one())) {
- continue;
- }
- */
-
- //print_line("PASSED!");
- //print_line("at: "+String(p_node->get_name())+"::"+name+": - nz: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO)+" no: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONONE));
- //print_line("value: "+String(value)+" is zero: "+itos(value.is_zero())+" is one" +itos(value.is_one()));
if (pack_state_stack.size()) {
// we are on part of an instanced subscene
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp
deleted file mode 100644
index 070cc84863..0000000000
--- a/scene/resources/shader_graph.cpp
+++ /dev/null
@@ -1,2596 +0,0 @@
-/*************************************************************************/
-/* shader_graph.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "shader_graph.h"
-
-#include "scene/scene_string_names.h"
-
-// FIXME: Needs to be ported to the new 3.0 shader API
-#if 0
-Array ShaderGraph::_get_node_list(ShaderType p_type) const {
-
- List<int> nodes;
- get_node_list(p_type,&nodes);
- Array arr(true);
- for (List<int>::Element *E=nodes.front();E;E=E->next())
- arr.push_back(E->get());
- return arr;
-}
-Array ShaderGraph::_get_connections(ShaderType p_type) const {
-
- List<Connection> connections;
- get_node_connections(p_type,&connections);
- Array arr(true);
- for (List<Connection>::Element *E=connections.front();E;E=E->next()) {
-
- Dictionary d(true);
- d["src_id"]=E->get().src_id;
- d["src_slot"]=E->get().src_slot;
- d["dst_id"]=E->get().dst_id;
- d["dst_slot"]=E->get().dst_slot;
- arr.push_back(d);
-
- }
- return arr;
-}
-
-void ShaderGraph::_set_data(const Dictionary &p_data) {
-
- Dictionary d=p_data;
- ERR_FAIL_COND(!d.has("shaders"));
- Array sh=d["shaders"];
- ERR_FAIL_COND(sh.size()!=3);
-
- for(int t=0;t<3;t++) {
- Array data=sh[t];
- ERR_FAIL_COND((data.size()%6)!=0);
- shader[t].node_map.clear();
- for(int i=0;i<data.size();i+=6) {
-
- Node n;
- n.id=data[i+0];
- n.type=NodeType(int(data[i+1]));
- n.pos=data[i+2];
- n.param1=data[i+3];
- n.param2=data[i+4];
-
- Array conns=data[i+5];
- ERR_FAIL_COND((conns.size()%3)!=0);
-
- for(int j=0;j<conns.size();j+=3) {
- SourceSlot ss;
- int ls=conns[j+0];
- if (ls == SLOT_DEFAULT_VALUE) {
- n.defaults[conns[j+1]]=conns[j+2];
- } else {
- ss.id=conns[j+1];
- ss.slot=conns[j+2];
- n.connections[ls]=ss;
- }
- }
- shader[t].node_map[n.id]=n;
-
- }
- }
-
- _pending_update_shader=true;
- _update_shader();
-
-}
-
-Dictionary ShaderGraph::_get_data() const {
-
- Array sh;
- for(int i=0;i<3;i++) {
- Array data;
- int ec = shader[i].node_map.size();
- data.resize(ec*6);
- int idx=0;
- for (Map<int,Node>::Element*E=shader[i].node_map.front();E;E=E->next()) {
-
- data[idx+0]=E->key();
- data[idx+1]=E->get().type;
- data[idx+2]=E->get().pos;
- data[idx+3]=E->get().param1;
- data[idx+4]=E->get().param2;
-
- Array conns;
- conns.resize(E->get().connections.size()*3+E->get().defaults.size()*3);
- int idx2=0;
- for(Map<int,SourceSlot>::Element*F=E->get().connections.front();F;F=F->next()) {
-
- conns[idx2+0]=F->key();
- conns[idx2+1]=F->get().id;
- conns[idx2+2]=F->get().slot;
- idx2+=3;
- }
- for(Map<int,Variant>::Element*F=E->get().defaults.front();F;F=F->next()) {
-
- conns[idx2+0]=SLOT_DEFAULT_VALUE;
- conns[idx2+1]=F->key();
- conns[idx2+2]=F->get();
- idx2+=3;
- }
-
- data[idx+5]=conns;
- idx+=6;
- }
- sh.push_back(data);
- }
-
- Dictionary data;
- data["shaders"]=sh;
- return data;
-}
-
-
-
-ShaderGraph::GraphError ShaderGraph::get_graph_error(ShaderType p_type) const {
-
- ERR_FAIL_INDEX_V(p_type,3,GRAPH_OK);
- return shader[p_type].error;
-}
-
-int ShaderGraph::node_count(ShaderType p_which, int p_type)
-{
- int count=0;
- for (Map<int,Node>::Element *E=shader[p_which].node_map.front();E;E=E->next())
- if (E->get().type==p_type)
- count++;
- return count;
-}
-
-void ShaderGraph::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("_update_shader"),&ShaderGraph::_update_shader);
-
- ClassDB::bind_method(D_METHOD("node_add","shader_type","node_type","id"),&ShaderGraph::node_add);
- ClassDB::bind_method(D_METHOD("node_remove","shader_type","id"),&ShaderGraph::node_remove);
- ClassDB::bind_method(D_METHOD("node_set_position","shader_type","id","position"),&ShaderGraph::node_set_position);
- ClassDB::bind_method(D_METHOD("node_get_position","shader_type","id"),&ShaderGraph::node_get_position);
-
- ClassDB::bind_method(D_METHOD("node_get_type","shader_type","id"),&ShaderGraph::node_get_type);
-
- ClassDB::bind_method(D_METHOD("get_node_list","shader_type"),&ShaderGraph::_get_node_list);
-
- ClassDB::bind_method(D_METHOD("default_set_value","shader_type","id","param_id","value"), &ShaderGraph::default_set_value);
- ClassDB::bind_method(D_METHOD("default_get_value","shader_type","id","param_id"), &ShaderGraph::default_get_value);
-
- ClassDB::bind_method(D_METHOD("scalar_const_node_set_value","shader_type","id","value"),&ShaderGraph::scalar_const_node_set_value);
- ClassDB::bind_method(D_METHOD("scalar_const_node_get_value","shader_type","id"),&ShaderGraph::scalar_const_node_get_value);
-
- ClassDB::bind_method(D_METHOD("vec_const_node_set_value","shader_type","id","value"),&ShaderGraph::vec_const_node_set_value);
- ClassDB::bind_method(D_METHOD("vec_const_node_get_value","shader_type","id"),&ShaderGraph::vec_const_node_get_value);
-
- ClassDB::bind_method(D_METHOD("rgb_const_node_set_value","shader_type","id","value"),&ShaderGraph::rgb_const_node_set_value);
- ClassDB::bind_method(D_METHOD("rgb_const_node_get_value","shader_type","id"),&ShaderGraph::rgb_const_node_get_value);
-
- ClassDB::bind_method(D_METHOD("xform_const_node_set_value","shader_type","id","value"),&ShaderGraph::xform_const_node_set_value);
- ClassDB::bind_method(D_METHOD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_get_value);
-
-
- //void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
-
- ClassDB::bind_method(D_METHOD("texture_node_set_filter_size","shader_type","id","filter_size"),&ShaderGraph::texture_node_set_filter_size);
- ClassDB::bind_method(D_METHOD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_get_filter_size);
-
- ClassDB::bind_method(D_METHOD("texture_node_set_filter_strength","shader_type","id","filter_strength"),&ShaderGraph::texture_node_set_filter_strength);
- ClassDB::bind_method(D_METHOD("texture_node_get_filter_strength","shader_type","id"),&ShaderGraph::texture_node_get_filter_strength);
-
- ClassDB::bind_method(D_METHOD("scalar_op_node_set_op","shader_type","id","op"),&ShaderGraph::scalar_op_node_set_op);
- ClassDB::bind_method(D_METHOD("scalar_op_node_get_op","shader_type","id"),&ShaderGraph::scalar_op_node_get_op);
-
- ClassDB::bind_method(D_METHOD("vec_op_node_set_op","shader_type","id","op"),&ShaderGraph::vec_op_node_set_op);
- ClassDB::bind_method(D_METHOD("vec_op_node_get_op","shader_type","id"),&ShaderGraph::vec_op_node_get_op);
-
- ClassDB::bind_method(D_METHOD("vec_scalar_op_node_set_op","shader_type","id","op"),&ShaderGraph::vec_scalar_op_node_set_op);
- ClassDB::bind_method(D_METHOD("vec_scalar_op_node_get_op","shader_type","id"),&ShaderGraph::vec_scalar_op_node_get_op);
-
- ClassDB::bind_method(D_METHOD("rgb_op_node_set_op","shader_type","id","op"),&ShaderGraph::rgb_op_node_set_op);
- ClassDB::bind_method(D_METHOD("rgb_op_node_get_op","shader_type","id"),&ShaderGraph::rgb_op_node_get_op);
-
-
- ClassDB::bind_method(D_METHOD("xform_vec_mult_node_set_no_translation","shader_type","id","disable"),&ShaderGraph::xform_vec_mult_node_set_no_translation);
- ClassDB::bind_method(D_METHOD("xform_vec_mult_node_get_no_translation","shader_type","id"),&ShaderGraph::xform_vec_mult_node_get_no_translation);
-
- ClassDB::bind_method(D_METHOD("scalar_func_node_set_function","shader_type","id","func"),&ShaderGraph::scalar_func_node_set_function);
- ClassDB::bind_method(D_METHOD("scalar_func_node_get_function","shader_type","id"),&ShaderGraph::scalar_func_node_get_function);
-
- ClassDB::bind_method(D_METHOD("vec_func_node_set_function","shader_type","id","func"),&ShaderGraph::vec_func_node_set_function);
- ClassDB::bind_method(D_METHOD("vec_func_node_get_function","shader_type","id"),&ShaderGraph::vec_func_node_get_function);
-
- ClassDB::bind_method(D_METHOD("input_node_set_name","shader_type","id","name"),&ShaderGraph::input_node_set_name);
- ClassDB::bind_method(D_METHOD("input_node_get_name","shader_type","id"),&ShaderGraph::input_node_get_name);
-
- ClassDB::bind_method(D_METHOD("scalar_input_node_set_value","shader_type","id","value"),&ShaderGraph::scalar_input_node_set_value);
- ClassDB::bind_method(D_METHOD("scalar_input_node_get_value","shader_type","id"),&ShaderGraph::scalar_input_node_get_value);
-
- ClassDB::bind_method(D_METHOD("vec_input_node_set_value","shader_type","id","value"),&ShaderGraph::vec_input_node_set_value);
- ClassDB::bind_method(D_METHOD("vec_input_node_get_value","shader_type","id"),&ShaderGraph::vec_input_node_get_value);
-
- ClassDB::bind_method(D_METHOD("rgb_input_node_set_value","shader_type","id","value"),&ShaderGraph::rgb_input_node_set_value);
- ClassDB::bind_method(D_METHOD("rgb_input_node_get_value","shader_type","id"),&ShaderGraph::rgb_input_node_get_value);
-
- ClassDB::bind_method(D_METHOD("xform_input_node_set_value","shader_type","id","value"),&ShaderGraph::xform_input_node_set_value);
- ClassDB::bind_method(D_METHOD("xform_input_node_get_value","shader_type","id"),&ShaderGraph::xform_input_node_get_value);
-
- ClassDB::bind_method(D_METHOD("texture_input_node_set_value","shader_type","id","value"),&ShaderGraph::texture_input_node_set_value);
- ClassDB::bind_method(D_METHOD("texture_input_node_get_value","shader_type","id"),&ShaderGraph::texture_input_node_get_value);
-
- ClassDB::bind_method(D_METHOD("cubemap_input_node_set_value","shader_type","id","value"),&ShaderGraph::cubemap_input_node_set_value);
- ClassDB::bind_method(D_METHOD("cubemap_input_node_get_value","shader_type","id"),&ShaderGraph::cubemap_input_node_get_value);
-
- ClassDB::bind_method(D_METHOD("comment_node_set_text","shader_type","id","text"),&ShaderGraph::comment_node_set_text);
- ClassDB::bind_method(D_METHOD("comment_node_get_text","shader_type","id"),&ShaderGraph::comment_node_get_text);
-
- ClassDB::bind_method(D_METHOD("color_ramp_node_set_ramp","shader_type","id","colors","offsets"),&ShaderGraph::color_ramp_node_set_ramp);
- ClassDB::bind_method(D_METHOD("color_ramp_node_get_colors","shader_type","id"),&ShaderGraph::color_ramp_node_get_colors);
- ClassDB::bind_method(D_METHOD("color_ramp_node_get_offsets","shader_type","id"),&ShaderGraph::color_ramp_node_get_offsets);
-
- ClassDB::bind_method(D_METHOD("curve_map_node_set_points","shader_type","id","points"),&ShaderGraph::curve_map_node_set_points);
- ClassDB::bind_method(D_METHOD("curve_map_node_get_points","shader_type","id"),&ShaderGraph::curve_map_node_get_points);
-
- ClassDB::bind_method(D_METHOD("connect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::connect_node);
- ClassDB::bind_method(D_METHOD("is_node_connected","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::is_node_connected);
- ClassDB::bind_method(D_METHOD("disconnect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::disconnect_node);
- ClassDB::bind_method(D_METHOD("get_node_connections","shader_type"),&ShaderGraph::_get_connections);
-
- ClassDB::bind_method(D_METHOD("clear","shader_type"),&ShaderGraph::clear);
-
- ClassDB::bind_method(D_METHOD("node_set_state","shader_type","id","state"),&ShaderGraph::node_set_state);
- ClassDB::bind_method(D_METHOD("node_get_state","shader_type","id"),&ShaderGraph::node_get_state);
-
- ClassDB::bind_method(D_METHOD("_set_data"),&ShaderGraph::_set_data);
- ClassDB::bind_method(D_METHOD("_get_data"),&ShaderGraph::_get_data);
-
- ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data","_get_data");
-
- //void get_connections(ShaderType p_which,List<Connection> *p_connections) const;
-
-
- BIND_ENUM_CONSTANT( NODE_INPUT ); // all inputs (shader type dependent)
- BIND_ENUM_CONSTANT( NODE_SCALAR_CONST ); //scalar constant
- BIND_ENUM_CONSTANT( NODE_VEC_CONST ); //vec3 constant
- BIND_ENUM_CONSTANT( NODE_RGB_CONST ); //rgb constant (shows a color picker instead)
- BIND_ENUM_CONSTANT( NODE_XFORM_CONST ); // 4x4 matrix constant
- BIND_ENUM_CONSTANT( NODE_TIME ); // time in seconds
- BIND_ENUM_CONSTANT( NODE_SCREEN_TEX ); // screen texture sampler (takes UV) (only usable in fragment shader)
- BIND_ENUM_CONSTANT( NODE_SCALAR_OP ); // scalar vs scalar op (mul ); add ); div ); etc)
- BIND_ENUM_CONSTANT( NODE_VEC_OP ); // vec3 vs vec3 op (mul );ad );div );crossprod );etc)
- BIND_ENUM_CONSTANT( NODE_VEC_SCALAR_OP ); // vec3 vs scalar op (mul ); add ); div ); etc)
- BIND_ENUM_CONSTANT( NODE_RGB_OP ); // vec3 vs vec3 rgb op (with scalar amount) ); like brighten ); darken ); burn ); dodge ); multiply ); etc.
- BIND_ENUM_CONSTANT( NODE_XFORM_MULT ); // mat4 x mat4
- BIND_ENUM_CONSTANT( NODE_XFORM_VEC_MULT ); // mat4 x vec3 mult (with no-translation option)
- BIND_ENUM_CONSTANT( NODE_XFORM_VEC_INV_MULT ); // mat4 x vec3 inverse mult (with no-translation option)
- BIND_ENUM_CONSTANT( NODE_SCALAR_FUNC ); // scalar function (sin ); cos ); etc)
- BIND_ENUM_CONSTANT( NODE_VEC_FUNC ); // vector function (normalize ); negate ); reciprocal ); rgb2hsv ); hsv2rgb ); etc ); etc)
- BIND_ENUM_CONSTANT( NODE_VEC_LEN ); // vec3 length
- BIND_ENUM_CONSTANT( NODE_DOT_PROD ); // vec3 . vec3 (dot product -> scalar output)
- BIND_ENUM_CONSTANT( NODE_VEC_TO_SCALAR ); // 1 vec3 input ); 3 scalar outputs
- BIND_ENUM_CONSTANT( NODE_SCALAR_TO_VEC ); // 3 scalar input ); 1 vec3 output
- BIND_ENUM_CONSTANT( NODE_VEC_TO_XFORM ); // 3 vec input ); 1 xform output
- BIND_ENUM_CONSTANT( NODE_XFORM_TO_VEC ); // 3 vec input ); 1 xform output
- BIND_ENUM_CONSTANT( NODE_SCALAR_INTERP ); // scalar interpolation (with optional curve)
- BIND_ENUM_CONSTANT( NODE_VEC_INTERP ); // vec3 interpolation (with optional curve)
- BIND_ENUM_CONSTANT( NODE_COLOR_RAMP );
- BIND_ENUM_CONSTANT( NODE_CURVE_MAP );
- BIND_ENUM_CONSTANT( NODE_SCALAR_INPUT ); // scalar uniform (assignable in material)
- BIND_ENUM_CONSTANT( NODE_VEC_INPUT ); // vec3 uniform (assignable in material)
- BIND_ENUM_CONSTANT( NODE_RGB_INPUT ); // color uniform (assignable in material)
- BIND_ENUM_CONSTANT( NODE_XFORM_INPUT ); // mat4 uniform (assignable in material)
- BIND_ENUM_CONSTANT( NODE_TEXTURE_INPUT ); // texture input (assignable in material)
- BIND_ENUM_CONSTANT( NODE_CUBEMAP_INPUT ); // cubemap input (assignable in material)
- BIND_ENUM_CONSTANT( NODE_DEFAULT_TEXTURE );
- BIND_ENUM_CONSTANT( NODE_OUTPUT ); // output (shader type dependent)
- BIND_ENUM_CONSTANT( NODE_COMMENT ); // comment
- BIND_ENUM_CONSTANT( NODE_TYPE_MAX );
-
- BIND_ENUM_CONSTANT( SLOT_TYPE_SCALAR );
- BIND_ENUM_CONSTANT( SLOT_TYPE_VEC );
- BIND_ENUM_CONSTANT( SLOT_TYPE_XFORM );
- BIND_ENUM_CONSTANT( SLOT_TYPE_TEXTURE );
- BIND_ENUM_CONSTANT( SLOT_MAX );
-
- BIND_ENUM_CONSTANT( SHADER_TYPE_VERTEX );
- BIND_ENUM_CONSTANT( SHADER_TYPE_FRAGMENT );
- BIND_ENUM_CONSTANT( SHADER_TYPE_LIGHT );
- BIND_ENUM_CONSTANT( SHADER_TYPE_MAX );
-
-
- BIND_ENUM_CONSTANT( SLOT_IN );
- BIND_ENUM_CONSTANT( SLOT_OUT );
-
- BIND_ENUM_CONSTANT( GRAPH_OK );
- BIND_ENUM_CONSTANT( GRAPH_ERROR_CYCLIC );
- BIND_ENUM_CONSTANT( GRAPH_ERROR_MISSING_CONNECTIONS );
-
- BIND_ENUM_CONSTANT( SCALAR_OP_ADD );
- BIND_ENUM_CONSTANT( SCALAR_OP_SUB );
- BIND_ENUM_CONSTANT( SCALAR_OP_MUL );
- BIND_ENUM_CONSTANT( SCALAR_OP_DIV );
- BIND_ENUM_CONSTANT( SCALAR_OP_MOD );
- BIND_ENUM_CONSTANT( SCALAR_OP_POW );
- BIND_ENUM_CONSTANT( SCALAR_OP_MAX );
- BIND_ENUM_CONSTANT( SCALAR_OP_MIN );
- BIND_ENUM_CONSTANT( SCALAR_OP_ATAN2 );
- BIND_ENUM_CONSTANT( SCALAR_MAX_OP );
-
- BIND_ENUM_CONSTANT( VEC_OP_ADD );
- BIND_ENUM_CONSTANT( VEC_OP_SUB );
- BIND_ENUM_CONSTANT( VEC_OP_MUL );
- BIND_ENUM_CONSTANT( VEC_OP_DIV );
- BIND_ENUM_CONSTANT( VEC_OP_MOD );
- BIND_ENUM_CONSTANT( VEC_OP_POW );
- BIND_ENUM_CONSTANT( VEC_OP_MAX );
- BIND_ENUM_CONSTANT( VEC_OP_MIN );
- BIND_ENUM_CONSTANT( VEC_OP_CROSS );
- BIND_ENUM_CONSTANT( VEC_MAX_OP );
-
- BIND_ENUM_CONSTANT( VEC_SCALAR_OP_MUL );
- BIND_ENUM_CONSTANT( VEC_SCALAR_OP_DIV );
- BIND_ENUM_CONSTANT( VEC_SCALAR_OP_POW );
- BIND_ENUM_CONSTANT( VEC_SCALAR_MAX_OP );
-
- BIND_ENUM_CONSTANT( RGB_OP_SCREEN );
- BIND_ENUM_CONSTANT( RGB_OP_DIFFERENCE );
- BIND_ENUM_CONSTANT( RGB_OP_DARKEN );
- BIND_ENUM_CONSTANT( RGB_OP_LIGHTEN );
- BIND_ENUM_CONSTANT( RGB_OP_OVERLAY );
- BIND_ENUM_CONSTANT( RGB_OP_DODGE );
- BIND_ENUM_CONSTANT( RGB_OP_BURN );
- BIND_ENUM_CONSTANT( RGB_OP_SOFT_LIGHT );
- BIND_ENUM_CONSTANT( RGB_OP_HARD_LIGHT );
- BIND_ENUM_CONSTANT( RGB_MAX_OP );
-
- BIND_ENUM_CONSTANT( SCALAR_FUNC_SIN );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_COS );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_TAN );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_ASIN );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_ACOS );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_ATAN );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_SINH );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_COSH );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_TANH );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_LOG );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_EXP );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_SQRT );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_ABS );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_SIGN );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_FLOOR );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_ROUND );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_CEIL );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_FRAC );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_SATURATE );
- BIND_ENUM_CONSTANT( SCALAR_FUNC_NEGATE );
- BIND_ENUM_CONSTANT( SCALAR_MAX_FUNC );
-
- BIND_ENUM_CONSTANT( VEC_FUNC_NORMALIZE );
- BIND_ENUM_CONSTANT( VEC_FUNC_SATURATE );
- BIND_ENUM_CONSTANT( VEC_FUNC_NEGATE );
- BIND_ENUM_CONSTANT( VEC_FUNC_RECIPROCAL );
- BIND_ENUM_CONSTANT( VEC_FUNC_RGB2HSV );
- BIND_ENUM_CONSTANT( VEC_FUNC_HSV2RGB );
- BIND_ENUM_CONSTANT( VEC_MAX_FUNC );
-
- ADD_SIGNAL(MethodInfo("updated"));
-}
-
-
-String ShaderGraph::_find_unique_name(const String& p_base) {
-
-
-
- int idx=1;
- while(true) {
- String tocmp=p_base;
- if (idx>1) {
- tocmp+="_"+itos(idx);
- }
- bool valid=true;
- for(int i=0;i<3;i++) {
- if (!valid)
- break;
- for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) {
- if (E->get().type!=NODE_SCALAR_INPUT && E->get().type!=NODE_VEC_INPUT && E->get().type==NODE_RGB_INPUT && E->get().type==NODE_XFORM_INPUT && E->get().type==NODE_TEXTURE_INPUT && E->get().type==NODE_CUBEMAP_INPUT)
- continue;
- String name = E->get().param1;
- if (name==tocmp) {
- valid=false;
- break;
- }
-
- }
- }
-
- if (!valid) {
- idx++;
- continue;
- }
- return tocmp;
- }
- return String();
-}
-
-void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(p_id==0);
- ERR_FAIL_COND(p_node_type==NODE_OUTPUT); //can't create output
- ERR_FAIL_COND( shader[p_type].node_map.has(p_id ) );
- ERR_FAIL_INDEX( p_node_type, NODE_TYPE_MAX );
- Node node;
-
- if (p_node_type==NODE_INPUT) {
- //see if it already exists
- for(Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) {
- if (E->get().type==NODE_INPUT) {
- ERR_EXPLAIN("Only one input node can be added to the graph.");
- ERR_FAIL_COND(E->get().type==NODE_INPUT);
- }
- }
- }
- node.type=p_node_type;
- node.id=p_id;
-
- switch(p_node_type) {
- case NODE_INPUT: {} break; // all inputs (shader type dependent)
- case NODE_SCALAR_CONST: { node.param1=0;} break; //scalar constant
- case NODE_VEC_CONST: {node.param1=Vector3();} break; //vec3 constant
- case NODE_RGB_CONST: {node.param1=Color();} break; //rgb constant (shows a color picker instead)
- case NODE_XFORM_CONST: {node.param1=Transform();} break; // 4x4 matrix constant
- case NODE_TIME: {} break; // time in seconds
- case NODE_SCREEN_TEX: {Array arr; arr.push_back(0); arr.push_back(0); node.param2=arr;} break; // screen texture sampler (takes UV) (only usable in fragment shader)
- case NODE_SCALAR_OP: {node.param1=SCALAR_OP_ADD;} break; // scalar vs scalar op (mul: {} break; add: {} break; div: {} break; etc)
- case NODE_VEC_OP: {node.param1=VEC_OP_ADD;} break; // vec3 vs vec3 op (mul: {} break;ad: {} break;div: {} break;crossprod: {} break;etc)
- case NODE_VEC_SCALAR_OP: {node.param1=VEC_SCALAR_OP_MUL;} break; // vec3 vs scalar op (mul: {} break; add: {} break; div: {} break; etc)
- case NODE_RGB_OP: {node.param1=RGB_OP_SCREEN;} break; // vec3 vs vec3 rgb op (with scalar amount): {} break; like brighten: {} break; darken: {} break; burn: {} break; dodge: {} break; multiply: {} break; etc.
- case NODE_XFORM_MULT: {} break; // mat4 x mat4
- case NODE_XFORM_VEC_MULT: {} break; // mat4 x vec3 mult (with no-translation option)
- case NODE_XFORM_VEC_INV_MULT: {} break; // mat4 x vec3 inverse mult (with no-translation option)
- case NODE_SCALAR_FUNC: {node.param1=SCALAR_FUNC_SIN;} break; // scalar function (sin: {} break; cos: {} break; etc)
- case NODE_VEC_FUNC: {node.param1=VEC_FUNC_NORMALIZE;} break; // vector function (normalize: {} break; negate: {} break; reciprocal: {} break; rgb2hsv: {} break; hsv2rgb: {} break; etc: {} break; etc)
- case NODE_VEC_LEN: {} break; // vec3 length
- case NODE_DOT_PROD: {} break; // vec3 . vec3 (dot product -> scalar output)
- case NODE_VEC_TO_SCALAR: {} break; // 1 vec3 input: {} break; 3 scalar outputs
- case NODE_SCALAR_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output
- case NODE_VEC_TO_XFORM: {} break; // 3 scalar input: {} break; 1 vec3 output
- case NODE_XFORM_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output
- case NODE_SCALAR_INTERP: {} break; // scalar interpolation (with optional curve)
- case NODE_VEC_INTERP: {} break; // vec3 interpolation (with optional curve)
- case NODE_COLOR_RAMP: { node.param1=PoolVector<Color>(); node.param2=PoolVector<real_t>();} break; // vec3 interpolation (with optional curve)
- case NODE_CURVE_MAP: { node.param1=PoolVector<Vector2>();} break; // vec3 interpolation (with optional curve)
- case NODE_SCALAR_INPUT: {node.param1=_find_unique_name("Scalar"); node.param2=0;} break; // scalar uniform (assignable in material)
- case NODE_VEC_INPUT: {node.param1=_find_unique_name("Vec3");node.param2=Vector3();} break; // vec3 uniform (assignable in material)
- case NODE_RGB_INPUT: {node.param1=_find_unique_name("Color");node.param2=Color();} break; // color uniform (assignable in material)
- case NODE_XFORM_INPUT: {node.param1=_find_unique_name("XForm"); node.param2=Transform();} break; // mat4 uniform (assignable in material)
- case NODE_TEXTURE_INPUT: {node.param1=_find_unique_name("Tex"); } break; // texture input (assignable in material)
- case NODE_CUBEMAP_INPUT: {node.param1=_find_unique_name("Cube"); } break; // cubemap input (assignable in material)
- case NODE_DEFAULT_TEXTURE: {}; break;
- case NODE_OUTPUT: {} break; // output (shader type dependent)
- case NODE_COMMENT: {} break; // comment
- case NODE_TYPE_MAX: {};
- }
-
- shader[p_type].node_map[p_id]=node;
- _request_update();
-}
-
-void ShaderGraph::node_set_position(ShaderType p_type,int p_id, const Vector2& p_pos) {
- ERR_FAIL_INDEX(p_type,3);
-
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- shader[p_type].node_map[p_id].pos=p_pos;
- _request_update();
-
-}
-Vector2 ShaderGraph::node_get_position(ShaderType p_type,int p_id) const {
- ERR_FAIL_INDEX_V(p_type,3,Vector2());
-
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector2());
- return shader[p_type].node_map[p_id].pos;
-}
-
-
-void ShaderGraph::node_remove(ShaderType p_type,int p_id) {
-
- ERR_FAIL_COND(p_id==0);
- ERR_FAIL_INDEX(p_type,3);
-
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
-
- //erase connections associated with node
- for(Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) {
- if (E->key()==p_id)
- continue; //no self
-
- for (Map<int,SourceSlot>::Element *F=E->get().connections.front();F;) {
- Map<int,SourceSlot>::Element *N=F->next();
-
- if (F->get().id==p_id) {
- E->get().connections.erase(F);
- }
-
- F=N;
- }
- }
-
- shader[p_type].node_map.erase(p_id);
-
- _request_update();
-
-}
-
-
-
-void ShaderGraph::get_node_list(ShaderType p_type,List<int> *p_node_list) const {
-
- ERR_FAIL_INDEX(p_type,3);
-
- Map<int,Node>::Element *E = shader[p_type].node_map.front();
-
- while(E) {
-
- p_node_list->push_back(E->key());
- E=E->next();
- }
-}
-
-
-ShaderGraph::NodeType ShaderGraph::node_get_type(ShaderType p_type,int p_id) const {
-
- ERR_FAIL_INDEX_V(p_type,3,NODE_TYPE_MAX);
-
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),NODE_TYPE_MAX);
- return shader[p_type].node_map[p_id].type;
-}
-
-
-Error ShaderGraph::connect_node(ShaderType p_type,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) {
- ERR_FAIL_INDEX_V(p_type,3,ERR_INVALID_PARAMETER);
-
- ERR_FAIL_COND_V(p_src_id==p_dst_id, ERR_INVALID_PARAMETER);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_src_id), ERR_INVALID_PARAMETER);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_dst_id), ERR_INVALID_PARAMETER);
- NodeType type_src=shader[p_type].node_map[p_src_id].type;
- NodeType type_dst=shader[p_type].node_map[p_dst_id].type;
- ERR_FAIL_INDEX_V( p_src_slot, get_node_output_slot_count(get_mode(),p_type,type_src), ERR_INVALID_PARAMETER );
- ERR_FAIL_INDEX_V( p_dst_slot, get_node_input_slot_count(get_mode(),p_type,type_dst), ERR_INVALID_PARAMETER );
- ERR_FAIL_COND_V(get_node_output_slot_type(get_mode(),p_type,type_src,p_src_slot) != get_node_input_slot_type(get_mode(),p_type,type_dst,p_dst_slot), ERR_INVALID_PARAMETER );
-
-
- SourceSlot ts;
- ts.id=p_src_id;
- ts.slot=p_src_slot;
- shader[p_type].node_map[p_dst_id].connections[p_dst_slot]=ts;
- _request_update();
-
- return OK;
-}
-
-bool ShaderGraph::is_node_connected(ShaderType p_type,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const {
-
- ERR_FAIL_INDEX_V(p_type,3,false);
-
- SourceSlot ts;
- ts.id=p_src_id;
- ts.slot=p_src_slot;
- return shader[p_type].node_map.has(p_dst_id) && shader[p_type].node_map[p_dst_id].connections.has(p_dst_slot) &&
- shader[p_type].node_map[p_dst_id].connections[p_dst_slot]==ts;
-}
-
-void ShaderGraph::disconnect_node(ShaderType p_type,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) {
- ERR_FAIL_INDEX(p_type,3);
-
- SourceSlot ts;
- ts.id=p_src_id;
- ts.slot=p_src_slot;
- if (shader[p_type].node_map.has(p_dst_id) && shader[p_type].node_map[p_dst_id].connections.has(p_dst_slot) &&
- shader[p_type].node_map[p_dst_id].connections[p_dst_slot]==ts) {
- shader[p_type].node_map[p_dst_id].connections.erase(p_dst_slot);
-
- }
- _request_update();
-
-}
-
-void ShaderGraph::get_node_connections(ShaderType p_type,List<Connection> *p_connections) const {
-
- ERR_FAIL_INDEX(p_type,3);
-
- for(const Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) {
- for (const Map<int,SourceSlot>::Element *F=E->get().connections.front();F;F=F->next()) {
-
- Connection c;
- c.dst_id=E->key();
- c.dst_slot=F->key();
- c.src_id=F->get().id;
- c.src_slot=F->get().slot;
- p_connections->push_back(c);
- }
- }
-}
-
-bool ShaderGraph::is_slot_connected(ShaderGraph::ShaderType p_type, int p_dst_id, int slot_id)
-{
- for(const Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) {
- for (const Map<int,SourceSlot>::Element *F=E->get().connections.front();F;F=F->next()) {
-
- if (p_dst_id == E->key() && slot_id==F->key())
- return true;
- }
- }
- return false;
-}
-
-
-void ShaderGraph::clear(ShaderType p_type) {
-
- ERR_FAIL_INDEX(p_type,3);
- shader[p_type].node_map.clear();
- Node out;
- out.pos=Vector2(300,300);
- out.type=NODE_OUTPUT;
- shader[p_type].node_map.insert(0,out);
-
- _request_update();
-
-}
-
-
-void ShaderGraph::scalar_const_node_set_value(ShaderType p_type,int p_id,float p_value) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_SCALAR_CONST);
- n.param1=p_value;
- _request_update();
-
-}
-
-float ShaderGraph::scalar_const_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,0);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_SCALAR_CONST,0);
- return n.param1;
-}
-
-void ShaderGraph::vec_const_node_set_value(ShaderType p_type,int p_id,const Vector3& p_value){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_VEC_CONST);
- n.param1=p_value;
- _request_update();
-
-
-}
-Vector3 ShaderGraph::vec_const_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Vector3());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector3());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_VEC_CONST,Vector3());
- return n.param1;
-
-}
-
-void ShaderGraph::rgb_const_node_set_value(ShaderType p_type,int p_id,const Color& p_value){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_RGB_CONST);
- n.param1=p_value;
- _request_update();
-
-}
-Color ShaderGraph::rgb_const_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Color());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Color());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_RGB_CONST,Color());
- return n.param1;
-
-}
-
-void ShaderGraph::xform_const_node_set_value(ShaderType p_type,int p_id,const Transform& p_value){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_XFORM_CONST);
- n.param1=p_value;
- _request_update();
-
-}
-Transform ShaderGraph::xform_const_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Transform());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Transform());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_XFORM_CONST,Transform());
- return n.param1;
-
-}
-
-void ShaderGraph::texture_node_set_filter_size(ShaderType p_type,int p_id,int p_size){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX);
- Array arr = n.param2;
- arr[0]=p_size;
- n.param2=arr;
- _request_update();
-
-}
-int ShaderGraph::texture_node_get_filter_size(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,0);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX,0);
- Array arr = n.param2;
- return arr[0];
-
-}
-
-void ShaderGraph::texture_node_set_filter_strength(ShaderType p_type,float p_id,float p_strength){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX);
- Array arr = n.param2;
- arr[1]=p_strength;
- n.param2=arr;
- _request_update();
-
-}
-float ShaderGraph::texture_node_get_filter_strength(ShaderType p_type,float p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,0);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX,0);
- Array arr = n.param2;
- return arr[1];
-}
-
-void ShaderGraph::duplicate_nodes(ShaderType p_which, List<int> &p_nodes)
-{
- //Create new node IDs
- Map<int,int> duplicates = Map<int,int>();
- int i=1;
- for(List<int>::Element *E=p_nodes.front();E; E=E->next()) {
- while (shader[p_which].node_map.has(i))
- i++;
- duplicates.insert(E->get(), i);
- i++;
- }
-
- for(List<int>::Element *E = p_nodes.front();E; E=E->next()) {
-
- const Node &n=shader[p_which].node_map[E->get()];
- Node nn=n;
- nn.id=duplicates.find(n.id)->get();
- nn.pos += Vector2(0,100);
- for (Map<int,SourceSlot>::Element *C=nn.connections.front();C;C=C->next()) {
- SourceSlot &c=C->get();
- if (p_nodes.find(c.id))
- c.id=duplicates.find(c.id)->get();
- }
- shader[p_which].node_map[nn.id]=nn;
- }
- _request_update();
-}
-
-List<int> ShaderGraph::generate_ids(ShaderType p_type, int count)
-{
- List<int> ids = List<int>();
- int i=1;
- while (ids.size() < count) {
- while (shader[p_type].node_map.has(i))
- i++;
- ids.push_back(i);
- i++;
- }
- return ids;
-}
-
-
-void ShaderGraph::scalar_op_node_set_op(ShaderType p_type,float p_id,ScalarOp p_op){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_SCALAR_OP);
- n.param1=p_op;
- _request_update();
-
-}
-ShaderGraph::ScalarOp ShaderGraph::scalar_op_node_get_op(ShaderType p_type,float p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,SCALAR_MAX_OP);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),SCALAR_MAX_OP);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_SCALAR_OP,SCALAR_MAX_OP);
- int op = n.param1;
- return ScalarOp(op);
-
-}
-
-
-void ShaderGraph::vec_op_node_set_op(ShaderType p_type,float p_id,VecOp p_op){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_VEC_OP);
- n.param1=p_op;
- _request_update();
-
-}
-ShaderGraph::VecOp ShaderGraph::vec_op_node_get_op(ShaderType p_type,float p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,VEC_MAX_OP);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),VEC_MAX_OP);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_VEC_OP,VEC_MAX_OP);
- int op = n.param1;
- return VecOp(op);
-
-}
-
-
-void ShaderGraph::vec_scalar_op_node_set_op(ShaderType p_type,float p_id,VecScalarOp p_op){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_VEC_SCALAR_OP);
- n.param1=p_op;
- _request_update();
-
-}
-ShaderGraph::VecScalarOp ShaderGraph::vec_scalar_op_node_get_op(ShaderType p_type,float p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,VEC_SCALAR_MAX_OP);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),VEC_SCALAR_MAX_OP);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_VEC_SCALAR_OP,VEC_SCALAR_MAX_OP);
- int op = n.param1;
- return VecScalarOp(op);
-
-}
-
-void ShaderGraph::rgb_op_node_set_op(ShaderType p_type,float p_id,RGBOp p_op){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_RGB_OP);
- n.param1=p_op;
-
- _request_update();
-
-}
-ShaderGraph::RGBOp ShaderGraph::rgb_op_node_get_op(ShaderType p_type,float p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,RGB_MAX_OP);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),RGB_MAX_OP);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_RGB_OP,RGB_MAX_OP);
- int op = n.param1;
- return RGBOp(op);
-
-}
-
-
-void ShaderGraph::xform_vec_mult_node_set_no_translation(ShaderType p_type,int p_id,bool p_no_translation){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_XFORM_VEC_MULT && n.type!=NODE_XFORM_VEC_INV_MULT);
- n.param1=p_no_translation;
- _request_update();
-
-}
-bool ShaderGraph::xform_vec_mult_node_get_no_translation(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,false);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),false);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_XFORM_VEC_MULT && n.type!=NODE_XFORM_VEC_INV_MULT,false);
- return n.param1;
-
-}
-
-void ShaderGraph::scalar_func_node_set_function(ShaderType p_type,int p_id,ScalarFunc p_func){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_SCALAR_FUNC);
- int func = p_func;
- ERR_FAIL_INDEX(func,SCALAR_MAX_FUNC);
- n.param1=func;
- _request_update();
-
-}
-ShaderGraph::ScalarFunc ShaderGraph::scalar_func_node_get_function(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,SCALAR_MAX_FUNC);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),SCALAR_MAX_FUNC);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_SCALAR_FUNC,SCALAR_MAX_FUNC);
- int func = n.param1;
- return ScalarFunc(func);
-}
-
-void ShaderGraph::default_set_value(ShaderGraph::ShaderType p_which, int p_id, int p_param, const Variant &p_value)
-{
- ERR_FAIL_INDEX(p_which,3);
- ERR_FAIL_COND(!shader[p_which].node_map.has(p_id));
- Node& n = shader[p_which].node_map[p_id];
- if(p_value.get_type()==Variant::NIL)
- n.defaults.erase(n.defaults.find(p_param));
- else
- n.defaults[p_param]=p_value;
-
- _request_update();
-
-}
-
-Variant ShaderGraph::default_get_value(ShaderGraph::ShaderType p_which, int p_id, int p_param)
-{
- ERR_FAIL_INDEX_V(p_which,3,Variant());
- ERR_FAIL_COND_V(!shader[p_which].node_map.has(p_id),Variant());
- const Node& n = shader[p_which].node_map[p_id];
-
- if (!n.defaults.has(p_param))
- return Variant();
- return n.defaults[p_param];
-}
-
-
-
-void ShaderGraph::vec_func_node_set_function(ShaderType p_type,int p_id,VecFunc p_func){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_VEC_FUNC);
- int func = p_func;
- ERR_FAIL_INDEX(func,VEC_MAX_FUNC);
- n.param1=func;
-
- _request_update();
-
-}
-ShaderGraph::VecFunc ShaderGraph::vec_func_node_get_function(ShaderType p_type, int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,VEC_MAX_FUNC);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),VEC_MAX_FUNC);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_VEC_FUNC,VEC_MAX_FUNC);
- int func = n.param1;
- return VecFunc(func);
-}
-
-void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- ERR_FAIL_COND(p_colors.size()!=p_offsets.size());
- Node& n = shader[p_type].node_map[p_id];
- n.param1=p_colors;
- n.param2=p_offsets;
- _request_update();
-
-}
-
-PoolVector<Color> ShaderGraph::color_ramp_node_get_colors(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,PoolVector<Color>());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Color>());
- const Node& n = shader[p_type].node_map[p_id];
- return n.param1;
-
-
-}
-
-PoolVector<real_t> ShaderGraph::color_ramp_node_get_offsets(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,PoolVector<real_t>());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<real_t>());
- const Node& n = shader[p_type].node_map[p_id];
- return n.param2;
-
-}
-
-
-void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const PoolVector<Vector2>& p_points) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- n.param1=p_points;
- _request_update();
-
-}
-
-PoolVector<Vector2> ShaderGraph::curve_map_node_get_points(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,PoolVector<Vector2>());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Vector2>());
- const Node& n = shader[p_type].node_map[p_id];
- return n.param1;
-
-}
-
-
-
-void ShaderGraph::input_node_set_name(ShaderType p_type,int p_id,const String& p_name){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- ERR_FAIL_COND(!p_name.is_valid_identifier());
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_SCALAR_INPUT && n.type!=NODE_VEC_INPUT && n.type==NODE_RGB_INPUT && n.type==NODE_XFORM_INPUT && n.type==NODE_TEXTURE_INPUT && n.type==NODE_CUBEMAP_INPUT);
-
- n.param1="";
- n.param1=_find_unique_name(p_name);
- _request_update();
-
-}
-String ShaderGraph::input_node_get_name(ShaderType p_type,int p_id){
-
- ERR_FAIL_INDEX_V(p_type,3,String());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),String());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_SCALAR_INPUT && n.type!=NODE_VEC_INPUT && n.type==NODE_RGB_INPUT && n.type==NODE_XFORM_INPUT && n.type==NODE_TEXTURE_INPUT && n.type==NODE_CUBEMAP_INPUT,String());
- return n.param1;
-}
-
-
-void ShaderGraph::scalar_input_node_set_value(ShaderType p_type,int p_id,float p_value) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_SCALAR_INPUT);
- n.param2=p_value;
- _request_update();
-
-}
-
-float ShaderGraph::scalar_input_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,0);
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0);
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_SCALAR_INPUT,0);
-
- return n.param2;
-}
-
-void ShaderGraph::vec_input_node_set_value(ShaderType p_type,int p_id,const Vector3& p_value){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_VEC_INPUT);
-
- n.param2=p_value;
- _request_update();
-
-}
-Vector3 ShaderGraph::vec_input_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Vector3());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector3());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_VEC_INPUT,Vector3());
- return n.param2;
-}
-
-void ShaderGraph::rgb_input_node_set_value(ShaderType p_type,int p_id,const Color& p_value){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_RGB_INPUT);
- n.param2=p_value;
- _request_update();
-
-}
-Color ShaderGraph::rgb_input_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Color());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Color());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_RGB_INPUT,Color());
- return n.param2;
-}
-
-void ShaderGraph::xform_input_node_set_value(ShaderType p_type,int p_id,const Transform& p_value){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_XFORM_INPUT);
- n.param2=p_value;
- _request_update();
-
-}
-Transform ShaderGraph::xform_input_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Transform());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Transform());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_XFORM_INPUT,Transform());
- return n.param2;
-}
-
-
-void ShaderGraph::texture_input_node_set_value(ShaderType p_type,int p_id,const Ref<Texture>& p_texture) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_TEXTURE_INPUT);
- n.param2=p_texture;
- _request_update();
-
-}
-
-Ref<Texture> ShaderGraph::texture_input_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Ref<Texture>());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Ref<Texture>());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_TEXTURE_INPUT,Ref<Texture>());
- return n.param2;
-}
-
-void ShaderGraph::cubemap_input_node_set_value(ShaderType p_type,int p_id,const Ref<CubeMap>& p_cubemap){
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_CUBEMAP_INPUT);
- n.param2=p_cubemap;
- _request_update();
-
-}
-
-Ref<CubeMap> ShaderGraph::cubemap_input_node_get_value(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,Ref<CubeMap>());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Ref<CubeMap>());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_CUBEMAP_INPUT,Ref<CubeMap>());
- return n.param2;
-
-}
-
-
-void ShaderGraph::comment_node_set_text(ShaderType p_type,int p_id,const String& p_comment) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND(n.type!=NODE_COMMENT);
- n.param1=p_comment;
-
-}
-
-String ShaderGraph::comment_node_get_text(ShaderType p_type,int p_id) const{
-
- ERR_FAIL_INDEX_V(p_type,3,String());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),String());
- const Node& n = shader[p_type].node_map[p_id];
- ERR_FAIL_COND_V(n.type!=NODE_COMMENT,String());
- return n.param1;
-
-}
-
-void ShaderGraph::_request_update() {
-
- if (_pending_update_shader)
- return;
-
- _pending_update_shader=true;
- call_deferred("_update_shader");
-
-}
-
-Variant ShaderGraph::node_get_state(ShaderType p_type,int p_id) const {
-
- ERR_FAIL_INDEX_V(p_type,3,Variant());
- ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Variant());
- const Node& n = shader[p_type].node_map[p_id];
- Dictionary s;
- s["position"]=n.pos;
- s["param1"]=n.param1;
- s["param2"]=n.param2;
- Array keys;
- for (Map<int,Variant>::Element *E=n.defaults.front();E;E=E->next()) {
- keys.append(E->key());
- s[E->key()]=E->get();
- }
- s["default_keys"]=keys;
- return s;
-
-}
-void ShaderGraph::node_set_state(ShaderType p_type,int p_id,const Variant& p_state) {
-
- ERR_FAIL_INDEX(p_type,3);
- ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
- Node& n = shader[p_type].node_map[p_id];
- Dictionary d = p_state;
- ERR_FAIL_COND(!d.has("position"));
- ERR_FAIL_COND(!d.has("param1"));
- ERR_FAIL_COND(!d.has("param2"));
- ERR_FAIL_COND(!d.has("default_keys"));
-
- n.pos=d["position"];
- n.param1=d["param1"];
- n.param2=d["param2"];
- Array keys = d["default_keys"];
- for(int i=0;i<keys.size();i++) {
- n.defaults[keys[i]]=d[keys[i]];
- }
-}
-
-ShaderGraph::ShaderGraph(Mode p_mode) : Shader(p_mode) {
-
- //shader = VisualServer::get_singleton()->shader_create();
- _pending_update_shader=false;
-
- Node input;
- input.id=1;
- input.pos=Vector2(50,40);
- input.type=NODE_INPUT;
-
- Node output;
- output.id=0;
- output.pos=Vector2(350,40);
- output.type=NODE_OUTPUT;
-
- for(int i=0;i<3;i++) {
-
- shader[i].node_map.insert(0,output);
- shader[i].node_map.insert(1,input);
- }
-}
-
-ShaderGraph::~ShaderGraph() {
-
- //VisualServer::get_singleton()->free(shader);
-}
-
-
-const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={
- //material vertex in
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Vertex","SRC_VERTEX","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Normal","SRC_NORMAL","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Tangent","SRC_TANGENT","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"BinormalF","SRC_BINORMALF","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Color","SRC_COLOR","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Alpha","SRC_ALPHA","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV","SRC_UV","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV2","SRC_UV2","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"WorldMatrix","WORLD_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"InvCameraMatrix","INV_CAMERA_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"ProjectionMatrix","PROJECTION_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"ModelviewMatrix","MODELVIEW_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"InstanceID","INSTANCE_ID","",SLOT_TYPE_SCALAR,SLOT_IN},
-
- //material vertex out
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Vertex","VERTEX","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Tangent","TANGENT","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Binormal","BINORMAL","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV","UV",".xy",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV2","UV2",".xy",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"SpecExp","SPEC_EXP","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_VERTEX,"PointSize","POINT_SIZE","",SLOT_TYPE_SCALAR,SLOT_OUT},
- //pixel vertex in
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Vertex","VERTEX","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Position","POSITION.xyz","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Normal","IN_NORMAL","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Tangent","TANGENT","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Binormal","BINORMAL","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"UV","vec3(UV,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"UV2","vec3(UV2,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"UVScreen","vec3(SCREEN_UV,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"InvCameraMatrix","INV_CAMERA_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- //pixel vertex out
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Diffuse","DIFFUSE_OUT","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"DiffuseAlpha","ALPHA_OUT","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Specular","SPECULAR","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"SpecularExp","SPEC_EXP","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Emission","EMISSION","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Glow","GLOW","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"NormalMap","NORMALMAP","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"NormalMapDepth","NORMALMAP_DEPTH","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Discard","DISCARD",">0.5",SLOT_TYPE_SCALAR,SLOT_OUT},
- //light in
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"LightDir","LIGHT_DIR","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"LightDiffuse","LIGHT_DIFFUSE","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"LightSpecular","LIGHT_SPECULAR","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"EyeVec","EYE_VEC","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Diffuse","DIFFUSE","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Specular","SPECULAR","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"SpecExp","SPECULAR_EXP","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_IN},
- //light out
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Light","LIGHT","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Shadow", "SHADOW", "",SLOT_TYPE_VEC, SLOT_OUT },
- //canvas item vertex in
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Vertex","vec3(SRC_VERTEX,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"UV","SRC_UV","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Color","SRC_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Alpha","SRC_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"WorldMatrix","WORLD_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"ExtraMatrix","EXTRA_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"ProjectionMatrix","PROJECTION_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN},
- //canvas item vertex out
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Vertex","VERTEX",".xy",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"UV","UV",".xy",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"PointSize","POINT_SIZE","",SLOT_TYPE_SCALAR,SLOT_OUT},
- //canvas item fragment in
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Color","SRC_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Alpha","SRC_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"UV","vec3(UV,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"UVScreen","vec3(SCREEN_UV,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"TexPixelSize","vec3(TEXTURE_PIXEL_SIZE,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN},
- //canvas item fragment out
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"NormalMap","NORMALMAP","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"NormalMapDepth","NORMALMAP_DEPTH","",SLOT_TYPE_SCALAR,SLOT_OUT},
- //canvas item light in
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"UV","vec3(UV,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightHeight","LIGHT_HEIGHT","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","LIGHT_SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","LIGHT_SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"TexPixelSize","vec3(TEXTURE_PIXEL_SIZE,0)","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN},
- //canvas item light out
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT.a","",SLOT_TYPE_SCALAR,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_OUT},
- {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_OUT},
- //end
- {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,NULL,NULL,NULL,SLOT_TYPE_SCALAR,SLOT_OUT},
-
-
-
-};
-
-void ShaderGraph::get_input_output_node_slot_info(Mode p_mode, ShaderType p_type, List<SlotInfo> *r_slots) {
-
- const InOutParamInfo* iop = &inout_param_info[0];
- while(iop->name) {
- if (p_mode==iop->shader_mode && p_type==iop->shader_type) {
-
- SlotInfo si;
- si.dir=iop->dir;
- si.name=iop->name;
- si.type=iop->slot_type;
- r_slots->push_back(si);
- }
- iop++;
- }
-}
-
-
-const ShaderGraph::NodeSlotInfo ShaderGraph::node_slot_info[]= {
-
- {NODE_SCALAR_CONST,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, //scalar constant
- {NODE_VEC_CONST,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, //vec3 constant
- {NODE_RGB_CONST,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, //rgb constant (shows a color picker instead)
- {NODE_XFORM_CONST,{SLOT_MAX},{SLOT_TYPE_XFORM,SLOT_MAX}}, // 4x4 matrix constant
- {NODE_TIME,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // time in seconds
- {NODE_SCREEN_TEX,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // screen texture sampler (takes UV) (only usable in fragment shader)
- {NODE_SCALAR_OP,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc)
- {NODE_VEC_OP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // scalar vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc)
- {NODE_VEC_SCALAR_OP,{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc)
- {NODE_RGB_OP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc)
- {NODE_XFORM_MULT,{SLOT_TYPE_XFORM,SLOT_TYPE_XFORM,SLOT_MAX},{SLOT_TYPE_XFORM,SLOT_MAX}}, // mat4 x mat4
- {NODE_XFORM_VEC_MULT,{SLOT_TYPE_XFORM,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // mat4 x vec3 mult (with no-translation option)
- {NODE_XFORM_VEC_INV_MULT,{SLOT_TYPE_VEC,SLOT_TYPE_XFORM,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // mat4 x vec3 inverse mult (with no-translation option)
- {NODE_SCALAR_FUNC,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar function (sin,{SLOT_MAX},{SLOT_MAX}}, cos,{SLOT_MAX},{SLOT_MAX}}, etc)
- {NODE_VEC_FUNC,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vector function (normalize,{SLOT_MAX},{SLOT_MAX}}, negate,{SLOT_MAX},{SLOT_MAX}}, reciprocal,{SLOT_MAX},{SLOT_MAX}}, rgb2hsv,{SLOT_MAX},{SLOT_MAX}}, hsv2rgb,{SLOT_MAX},{SLOT_MAX}}, etc,{SLOT_MAX},{SLOT_MAX}}, etc)
- {NODE_VEC_LEN,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 length
- {NODE_DOT_PROD,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 . vec3 (dot product -> scalar output)
- {NODE_VEC_TO_SCALAR,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR}}, // 1 vec3 input,{SLOT_MAX},{SLOT_MAX}}, 3 scalar outputs
- {NODE_SCALAR_TO_VEC,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR},{SLOT_TYPE_VEC,SLOT_MAX}}, // 3 scalar input,{SLOT_MAX},{SLOT_MAX}}, 1 vec3 output
- {NODE_SCALAR_INTERP,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar interpolation (with optional curve)
- {NODE_VEC_INTERP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_TYPE_SCALAR},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 interpolation (with optional curve)
- {NODE_COLOR_RAMP,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 interpolation (with optional curve)
- {NODE_CURVE_MAP,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 interpolation (with optional curve)
- {NODE_SCALAR_INPUT,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar uniform (assignable in material)
- {NODE_VEC_INPUT,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 uniform (assignable in material)
- {NODE_RGB_INPUT,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // color uniform (assignable in material)
- {NODE_XFORM_INPUT,{SLOT_MAX},{SLOT_TYPE_XFORM,SLOT_MAX}}, // mat4 uniform (assignable in material)
- {NODE_TEXTURE_INPUT,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // texture input (assignable in material)
- {NODE_CUBEMAP_INPUT,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // cubemap input (assignable in material)
- {NODE_DEFAULT_TEXTURE,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // cubemap input (assignable in material)
- {NODE_COMMENT,{SLOT_MAX},{SLOT_MAX}}, // comment
- {NODE_TYPE_MAX,{SLOT_MAX},{SLOT_MAX}}
-};
-
-int ShaderGraph::get_node_input_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type) {
-
- if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) {
-
- const InOutParamInfo* iop = &inout_param_info[0];
- int pc=0;
- while(iop->name) {
- if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) {
-
- if (iop->dir==SLOT_OUT)
- pc++;
- }
- iop++;
- }
- return pc;
- } else if (p_type==NODE_VEC_TO_XFORM){
- return 4;
- } else if (p_type==NODE_XFORM_TO_VEC){
- return 1;
- } else {
-
- const NodeSlotInfo*nsi=&node_slot_info[0];
- while(nsi->type!=NODE_TYPE_MAX) {
-
- if (nsi->type==p_type) {
- int pc=0;
- for(int i=0;i<NodeSlotInfo::MAX_INS;i++) {
- if (nsi->ins[i]==SLOT_MAX)
- break;
- pc++;
- }
- return pc;
- }
-
- nsi++;
- }
-
- return 0;
-
- }
-}
-
-int ShaderGraph::get_node_output_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type){
-
- if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) {
-
- const InOutParamInfo* iop = &inout_param_info[0];
- int pc=0;
- while(iop->name) {
- if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) {
-
- if (iop->dir==SLOT_IN)
- pc++;
- }
- iop++;
- }
- return pc;
- } else if (p_type==NODE_VEC_TO_XFORM){
- return 1;
- } else if (p_type==NODE_XFORM_TO_VEC){
- return 4;
- } else {
-
- const NodeSlotInfo*nsi=&node_slot_info[0];
- while(nsi->type!=NODE_TYPE_MAX) {
-
- if (nsi->type==p_type) {
- int pc=0;
- for(int i=0;i<NodeSlotInfo::MAX_OUTS;i++) {
- if (nsi->outs[i]==SLOT_MAX)
- break;
- pc++;
- }
- return pc;
- }
-
- nsi++;
- }
-
- return 0;
-
- }
-}
-ShaderGraph::SlotType ShaderGraph::get_node_input_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx){
-
- if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) {
-
- const InOutParamInfo* iop = &inout_param_info[0];
- int pc=0;
- while(iop->name) {
- if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) {
-
- if (iop->dir==SLOT_OUT) {
- if (pc==p_idx)
- return iop->slot_type;
- pc++;
- }
- }
- iop++;
- }
- ERR_FAIL_V(SLOT_MAX);
- } else if (p_type==NODE_VEC_TO_XFORM){
- return SLOT_TYPE_VEC;
- } else if (p_type==NODE_XFORM_TO_VEC){
- return SLOT_TYPE_XFORM;
- } else {
-
- const NodeSlotInfo*nsi=&node_slot_info[0];
- while(nsi->type!=NODE_TYPE_MAX) {
-
- if (nsi->type==p_type) {
- for(int i=0;i<NodeSlotInfo::MAX_INS;i++) {
-
- if (nsi->ins[i]==SLOT_MAX)
- break;
- if (i==p_idx)
- return nsi->ins[i];
- }
- }
-
- nsi++;
- }
-
- ERR_FAIL_V(SLOT_MAX);
-
- }
-}
-ShaderGraph::SlotType ShaderGraph::get_node_output_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx){
-
- if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) {
-
- const InOutParamInfo* iop = &inout_param_info[0];
- int pc=0;
- while(iop->name) {
- if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) {
-
- if (iop->dir==SLOT_IN) {
- if (pc==p_idx)
- return iop->slot_type;
- pc++;
- }
- }
- iop++;
- }
- ERR_FAIL_V(SLOT_MAX);
- } else if (p_type==NODE_VEC_TO_XFORM){
- return SLOT_TYPE_XFORM;
- } else if (p_type==NODE_XFORM_TO_VEC){
- return SLOT_TYPE_VEC;
- } else {
-
- const NodeSlotInfo*nsi=&node_slot_info[0];
- while(nsi->type!=NODE_TYPE_MAX) {
-
- if (nsi->type==p_type) {
- for(int i=0;i<NodeSlotInfo::MAX_OUTS;i++) {
- if (nsi->outs[i]==SLOT_MAX)
- break;
- if (i==p_idx)
- return nsi->outs[i];
- }
- }
-
- nsi++;
- }
-
- ERR_FAIL_V(SLOT_MAX);
- }
-}
-
-
-
-
-
-void ShaderGraph::_update_shader() {
-
-
- String code[3];
-
- List<StringName> names;
- get_default_texture_param_list(&names);
-
- for (List<StringName>::Element *E=names.front();E;E=E->next()) {
-
- set_default_texture_param(E->get(),Ref<Texture>());
- }
-
-
- for(int i=0;i<3;i++) {
-
- int idx=0;
- for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) {
-
- E->get().sort_order=idx++;
- }
- //simple method for graph solving using bubblesort derived algorithm
- int iters=0;
- int iter_max=shader[i].node_map.size()*shader[i].node_map.size();
-
- while(true) {
- if (iters>iter_max)
- break;
-
- int swaps=0;
- for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) {
-
- for(Map<int,SourceSlot>::Element *F=E->get().connections.front();F;F=F->next()) {
-
- //this is kinda slow, could be sped up
- Map<int,Node>::Element *G = shader[i].node_map.find(F->get().id);
- ERR_FAIL_COND(!G);
- if (G->get().sort_order > E->get().sort_order) {
-
- SWAP(G->get().sort_order,E->get().sort_order);
- swaps++;
- }
- }
- }
-
- iters++;
- if (swaps==0) {
- iters=0;
- break;
- }
- }
-
- if (iters>0) {
-
- shader[i].error=GRAPH_ERROR_CYCLIC;
- continue;
- }
-
- Vector<Node*> order;
- order.resize(shader[i].node_map.size());
-
- for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) {
-
- order[E->get().sort_order]=&E->get();
- }
-
- //generate code for the ordered graph
- bool failed=false;
-
- if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL) {
- code[i]+="vec3 DIFFUSE_OUT=vec3(0,0,0);\n";
- code[i]+="float ALPHA_OUT=0;\n";
- }
-
-
- Map<String,String> inputs_xlate;
- Map<String,String> input_names_xlate;
- Set<String> inputs_used;
-
- for(int j=0;j<order.size();j++) {
-
- Node *n=order[j];
- if (n->type==NODE_INPUT) {
-
- const InOutParamInfo* iop = &inout_param_info[0];
- int idx=0;
- while(iop->name) {
- if (get_mode()==iop->shader_mode && i==iop->shader_type && SLOT_IN==iop->dir) {
-
- const char *typestr[4]={"float","vec3","mat4","texture"};
-
- String vname=("nd"+itos(n->id)+"sl"+itos(idx));
- inputs_xlate[vname]=String(typestr[iop->slot_type])+" "+vname+"="+iop->variable+";\n";
- input_names_xlate[vname]=iop->variable;
- idx++;
- }
- iop++;
- }
-
- } else if (n->type==NODE_OUTPUT) {
-
-
- bool use_alpha=false;
- const InOutParamInfo* iop = &inout_param_info[0];
- int idx=0;
- while(iop->name) {
- if (get_mode()==iop->shader_mode && i==iop->shader_type && SLOT_OUT==iop->dir) {
-
- if (n->connections.has(idx)) {
- String iname=("nd"+itos(n->connections[idx].id)+"sl"+itos(n->connections[idx].slot));
- if (node_get_type(ShaderType(i),n->connections[idx].id)==NODE_INPUT)
- inputs_used.insert(iname);
- code[i]+=String(iop->variable)+"="+iname+String(iop->postfix)+";\n";
- if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL && String(iop->name)=="DiffuseAlpha")
- use_alpha=true;
- }
- idx++;
- }
- iop++;
- }
-
- if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL) {
-
- if (use_alpha) {
- code[i]+="DIFFUSE_ALPHA=vec4(DIFFUSE_OUT,ALPHA_OUT);\n";
- } else {
- code[i]+="DIFFUSE=DIFFUSE_OUT;\n";
- }
- }
-
- } else {
- Vector<String> inputs;
- int max = get_node_input_slot_count(get_mode(),ShaderType(i),n->type);
- for(int k=0;k<max;k++) {
- String iname;
- if (!n->connections.has(k)) {
- iname="nd"+itos(n->id)+"sl"+itos(k)+"def";
- } else {
- iname="nd"+itos(n->connections[k].id)+"sl"+itos(n->connections[k].slot);
- if (node_get_type(ShaderType(i),n->connections[k].id)==NODE_INPUT) {
- inputs_used.insert(iname);
- }
-
- }
- inputs.push_back(iname);
- }
-
- if (failed)
- break;
-
- if (n->type==NODE_TEXTURE_INPUT || n->type==NODE_CUBEMAP_INPUT) {
-
- set_default_texture_param(n->param1,n->param2);
-
- }
- _add_node_code(ShaderType(i),n,inputs,code[i]);
- }
-
- }
-
- if (failed)
- continue;
-
-
- for(Set<String>::Element *E=inputs_used.front();E;E=E->next()) {
-
- ERR_CONTINUE( !inputs_xlate.has(E->get()));
- code[i]=inputs_xlate[E->get()]+code[i];
- String name=input_names_xlate[E->get()];
-
- if (i==SHADER_TYPE_VERTEX && get_mode()==MODE_MATERIAL) {
- if (name==("SRC_COLOR"))
- code[i]="vec3 SRC_COLOR=COLOR.rgb;\n"+code[i];
- if (name==("SRC_ALPHA"))
- code[i]="float SRC_ALPHA=COLOR.a;\n"+code[i];
- if (name==("SRC_UV"))
- code[i]="vec3 SRC_UV=vec3(UV,0);\n"+code[i];
- if (name==("SRC_UV2"))
- code[i]="float SRC_UV2=vec3(UV2,0);\n"+code[i];
- } else if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL) {
- if (name==("IN_NORMAL"))
- code[i]="vec3 IN_NORMAL=NORMAL;\n"+code[i];
- } else if (i==SHADER_TYPE_VERTEX && get_mode()==MODE_CANVAS_ITEM) {
- if (name==("SRC_COLOR"))
- code[i]="vec3 SRC_COLOR=COLOR.rgb;\n"+code[i];
- if (name==("SRC_UV"))
- code[i]="vec3 SRC_UV=vec3(UV,0);\n"+code[i];
- }
-
- }
-
-
-
- shader[i].error=GRAPH_OK;
-
- }
-
- bool all_ok=true;
- for(int i=0;i<3;i++) {
- if (shader[i].error!=GRAPH_OK)
- all_ok=false;
- }
-
- /*print_line("VERTEX: \n"+code[0]);
- print_line("FRAGMENT: \n"+code[1]);
- print_line("LIGHT: \n"+code[2]);*/
-
- if (all_ok) {
- set_code(code[0],code[1],code[2]);
- }
- //do shader here
-
- _pending_update_shader=false;
- emit_signal(SceneStringNames::get_singleton()->updated);
-}
-
-void ShaderGraph::_plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d,uint8_t* p_heights,bool *p_useds) {
-
- float geometry[4][4];
- float tmp1[4][4];
- float tmp2[4][4];
- float deltas[4][4];
- double x, dx, dx2, dx3;
- double y, dy, dy2, dy3;
- double d, d2, d3;
- int lastx, lasty;
- int newx, newy;
- int ntimes;
- int i,j;
-
- int xmax=255;
- int ymax=255;
-
- /* construct the geometry matrix from the segment */
- for (i = 0; i < 4; i++) {
- geometry[i][2] = 0;
- geometry[i][3] = 0;
- }
-
- geometry[0][0] = (p_a[0] * xmax);
- geometry[1][0] = (p_b[0] * xmax);
- geometry[2][0] = (p_c[0] * xmax);
- geometry[3][0] = (p_d[0] * xmax);
-
- geometry[0][1] = (p_a[1] * ymax);
- geometry[1][1] = (p_b[1] * ymax);
- geometry[2][1] = (p_c[1] * ymax);
- geometry[3][1] = (p_d[1] * ymax);
-
- /* subdivide the curve ntimes (1000) times */
- ntimes = 4 * xmax;
- /* ntimes can be adjusted to give a finer or coarser curve */
- d = 1.0 / ntimes;
- d2 = d * d;
- d3 = d * d * d;
-
- /* construct a temporary matrix for determining the forward differencing deltas */
- tmp2[0][0] = 0; tmp2[0][1] = 0; tmp2[0][2] = 0; tmp2[0][3] = 1;
- tmp2[1][0] = d3; tmp2[1][1] = d2; tmp2[1][2] = d; tmp2[1][3] = 0;
- tmp2[2][0] = 6*d3; tmp2[2][1] = 2*d2; tmp2[2][2] = 0; tmp2[2][3] = 0;
- tmp2[3][0] = 6*d3; tmp2[3][1] = 0; tmp2[3][2] = 0; tmp2[3][3] = 0;
-
- /* compose the basis and geometry matrices */
-
- static const float CR_basis[4][4] = {
- { -0.5, 1.5, -1.5, 0.5 },
- { 1.0, -2.5, 2.0, -0.5 },
- { -0.5, 0.0, 0.5, 0.0 },
- { 0.0, 1.0, 0.0, 0.0 },
- };
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- tmp1[i][j] = (CR_basis[i][0] * geometry[0][j] +
- CR_basis[i][1] * geometry[1][j] +
- CR_basis[i][2] * geometry[2][j] +
- CR_basis[i][3] * geometry[3][j]);
- }
- }
- /* compose the above results to get the deltas matrix */
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- deltas[i][j] = (tmp2[i][0] * tmp1[0][j] +
- tmp2[i][1] * tmp1[1][j] +
- tmp2[i][2] * tmp1[2][j] +
- tmp2[i][3] * tmp1[3][j]);
- }
- }
-
-
- /* extract the x deltas */
- x = deltas[0][0];
- dx = deltas[1][0];
- dx2 = deltas[2][0];
- dx3 = deltas[3][0];
-
- /* extract the y deltas */
- y = deltas[0][1];
- dy = deltas[1][1];
- dy2 = deltas[2][1];
- dy3 = deltas[3][1];
-
-
- lastx = CLAMP (x, 0, xmax);
- lasty = CLAMP (y, 0, ymax);
-
- p_heights[lastx] = lasty;
- p_useds[lastx] = true;
-
- /* loop over the curve */
- for (i = 0; i < ntimes; i++)
- {
- /* increment the x values */
- x += dx;
- dx += dx2;
- dx2 += dx3;
-
- /* increment the y values */
- y += dy;
- dy += dy2;
- dy2 += dy3;
-
- newx = CLAMP ((Math::round (x)), 0, xmax);
- newy = CLAMP ((Math::round (y)), 0, ymax);
-
- /* if this point is different than the last one...then draw it */
- if ((lastx != newx) || (lasty != newy))
- {
- p_useds[newx]=true;
- p_heights[newx]=newy;
- }
-
- lastx = newx;
- lasty = newy;
- }
-}
-
-
-void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code) {
-
-
- const char *typestr[4]={"float","vec3","mat4","texture"};
-#define OUTNAME(id, slot) (String(typestr[get_node_output_slot_type(get_mode(), p_type, p_node->type, slot)]) + " " + ("nd" + itos(id) + "sl" + itos(slot)))
-#define OUTVAR(id, slot) ("nd" + itos(id) + "sl" + itos(slot))
-#define DEF_VEC(slot) \
- if (p_inputs[slot].ends_with("def")) { \
- Vector3 v = p_node->defaults[slot]; \
- code += String(typestr[1]) + " " + p_inputs[slot] + "=vec3(" + v + ");\n"; \
- }
-#define DEF_SCALAR(slot) \
- if (p_inputs[slot].ends_with("def")) { \
- double v = p_node->defaults[slot]; \
- code += String(typestr[0]) + " " + p_inputs[slot] + "=" + rtos(v) + ";\n"; \
- }
-#define DEF_COLOR(slot) \
- if (p_inputs[slot].ends_with("def")) { \
- Color col = p_node->defaults[slot]; \
- code += String(typestr[1]) + " " + p_inputs[slot] + "=vec3(" + rtos(col.r) + "," + rtos(col.g) + "," + rtos(col.b) + ");\n"; \
- }
-#define DEF_MATRIX(slot) \
- if (p_inputs[slot].ends_with("def")) { \
- Transform xf = p_node->defaults[slot]; \
- code += String(typestr[2]) + " " + p_inputs[slot] + "=mat4(\n"; \
- code += "\tvec4(vec3(" + rtos(xf.basis.get_axis(0).x) + "," + rtos(xf.basis.get_axis(0).y) + "," + rtos(xf.basis.get_axis(0).z) + "),0),\n"; \
- code += "\tvec4(vec3(" + rtos(xf.basis.get_axis(1).x) + "," + rtos(xf.basis.get_axis(1).y) + "," + rtos(xf.basis.get_axis(1).z) + "),0),\n"; \
- code += "\tvec4(vec3(" + rtos(xf.basis.get_axis(2).x) + "," + rtos(xf.basis.get_axis(2).y) + "," + rtos(xf.basis.get_axis(2).z) + "),0),\n"; \
- code += "\tvec4(vec3(" + rtos(xf.origin.x) + "," + rtos(xf.origin.y) + "," + rtos(xf.origin.z) + "),1)\n"; \
- code += ");\n"; \
- }
-
- switch(p_node->type) {
-
- case NODE_INPUT: {
-
-
- }break;
- case NODE_SCALAR_CONST: {
-
- double scalar = p_node->param1;
- code+=OUTNAME(p_node->id,0)+"="+rtos(scalar)+";\n";
- }break;
- case NODE_VEC_CONST: {
- Vector3 vec = p_node->param1;
- code+=OUTNAME(p_node->id,0)+"=vec3("+rtos(vec.x)+","+rtos(vec.y)+","+rtos(vec.z)+");\n";
- }break;
- case NODE_RGB_CONST: {
- Color col = p_node->param1;
- code+=OUTNAME(p_node->id,0)+"=vec3("+rtos(col.r)+","+rtos(col.g)+","+rtos(col.b)+");\n";
- code+=OUTNAME(p_node->id,1)+"="+rtos(col.a)+";\n";
- }break;
- case NODE_XFORM_CONST: {
-
- Transform xf = p_node->param1;
- code+=OUTNAME(p_node->id,0)+"=mat4(\n";
- code+="\tvec4(vec3("+rtos(xf.basis.get_axis(0).x)+","+rtos(xf.basis.get_axis(0).y)+","+rtos(xf.basis.get_axis(0).z)+"),0),\n";
- code+="\tvec4(vec3("+rtos(xf.basis.get_axis(1).x)+","+rtos(xf.basis.get_axis(1).y)+","+rtos(xf.basis.get_axis(1).z)+"),0),\n";
- code+="\tvec4(vec3("+rtos(xf.basis.get_axis(2).x)+","+rtos(xf.basis.get_axis(2).y)+","+rtos(xf.basis.get_axis(2).z)+"),0),\n";
- code+="\tvec4(vec3("+rtos(xf.origin.x)+","+rtos(xf.origin.y)+","+rtos(xf.origin.z)+"),1)\n";
- code+=");";
-
- }break;
- case NODE_TIME: {
- code+=OUTNAME(p_node->id,0)+"=TIME;\n";
- }break;
- case NODE_SCREEN_TEX: {
- DEF_VEC(0);
- code+=OUTNAME(p_node->id,0)+"=texscreen("+p_inputs[0]+".xy);\n";
- }break;
- case NODE_SCALAR_OP: {
- DEF_SCALAR(0);
- DEF_SCALAR(1);
- int op = p_node->param1;
- String optxt;
- switch(op) {
-
- case SCALAR_OP_ADD: optxt = p_inputs[0]+"+"+p_inputs[1]+";"; break;
- case SCALAR_OP_SUB: optxt = p_inputs[0]+"-"+p_inputs[1]+";"; break;
- case SCALAR_OP_MUL: optxt = p_inputs[0]+"*"+p_inputs[1]+";"; break;
- case SCALAR_OP_DIV: optxt = p_inputs[0]+"/"+p_inputs[1]+";"; break;
- case SCALAR_OP_MOD: optxt = "mod("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case SCALAR_OP_POW: optxt = "pow("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case SCALAR_OP_MAX: optxt = "max("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case SCALAR_OP_MIN: optxt = "min("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case SCALAR_OP_ATAN2: optxt = "atan2("+p_inputs[0]+","+p_inputs[1]+");"; break;
-
- }
- code+=OUTNAME(p_node->id,0)+"="+optxt+"\n";
-
- }break;
- case NODE_VEC_OP: {
- DEF_VEC(0);
- DEF_VEC(1);
- int op = p_node->param1;
- String optxt;
- switch(op) {
- case VEC_OP_ADD: optxt = p_inputs[0]+"+"+p_inputs[1]+";"; break;
- case VEC_OP_SUB: optxt = p_inputs[0]+"-"+p_inputs[1]+";"; break;
- case VEC_OP_MUL: optxt = p_inputs[0]+"*"+p_inputs[1]+";"; break;
- case VEC_OP_DIV: optxt = p_inputs[0]+"/"+p_inputs[1]+";"; break;
- case VEC_OP_MOD: optxt = "mod("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case VEC_OP_POW: optxt = "pow("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case VEC_OP_MAX: optxt = "max("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case VEC_OP_MIN: optxt = "min("+p_inputs[0]+","+p_inputs[1]+");"; break;
- case VEC_OP_CROSS: optxt = "cross("+p_inputs[0]+","+p_inputs[1]+");"; break;
- }
- code+=OUTNAME(p_node->id,0)+"="+optxt+"\n";
-
- }break;
- case NODE_VEC_SCALAR_OP: {
- DEF_VEC(0);
- DEF_SCALAR(1);
- int op = p_node->param1;
- String optxt;
- switch(op) {
- case VEC_SCALAR_OP_MUL: optxt = p_inputs[0]+"*"+p_inputs[1]+";"; break;
- case VEC_SCALAR_OP_DIV: optxt = p_inputs[0]+"/"+p_inputs[1]+";"; break;
- case VEC_SCALAR_OP_POW: optxt = "pow("+p_inputs[0]+","+p_inputs[1]+");"; break;
- }
- code+=OUTNAME(p_node->id,0)+"="+optxt+"\n";
-
- }break;
- case NODE_RGB_OP: {
- DEF_COLOR(0);
- DEF_COLOR(1);
-
- int op = p_node->param1;
- static const char*axisn[3]={"x","y","z"};
- switch(op) {
- case RGB_OP_SCREEN: {
-
- code += OUTNAME(p_node->id,0)+"=vec3(1.0)-(vec3(1.0)-"+p_inputs[0]+")*(vec3(1.0)-"+p_inputs[1]+");\n";
- } break;
- case RGB_OP_DIFFERENCE: {
-
- code += OUTNAME(p_node->id,0)+"=abs("+p_inputs[0]+"-"+p_inputs[1]+");\n";
- } break;
- case RGB_OP_DARKEN: {
-
- code += OUTNAME(p_node->id,0)+"=min("+p_inputs[0]+","+p_inputs[1]+");\n";
- } break;
- case RGB_OP_LIGHTEN: {
-
- code += OUTNAME(p_node->id,0)+"=max("+p_inputs[0]+","+p_inputs[1]+");\n";
-
- } break;
- case RGB_OP_OVERLAY: {
-
- code += OUTNAME(p_node->id,0)+";\n";
- for(int i=0;i<3;i++) {
- code += "{\n";
- code += "\tfloat base="+p_inputs[0]+"."+axisn[i]+";\n";
- code += "\tfloat blend="+p_inputs[1]+"."+axisn[i]+";\n";
- code += "\tif (base < 0.5) {\n";
- code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = 2.0 * base * blend;\n";
- code += "\t} else {\n";
- code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = 1.0 - 2.0 * (1.0 - blend) * (1.0 - base);\n";
- code += "\t}\n";
- code += "}\n";
- }
-
- } break;
- case RGB_OP_DODGE: {
-
- code += OUTNAME(p_node->id,0)+"=("+p_inputs[0]+")/(vec3(1.0)-"+p_inputs[1]+");\n";
-
- } break;
- case RGB_OP_BURN: {
-
- code += OUTNAME(p_node->id,0)+"=vec3(1.0)-(vec3(1.0)-"+p_inputs[0]+")/("+p_inputs[1]+");\n";
- } break;
- case RGB_OP_SOFT_LIGHT: {
-
- code += OUTNAME(p_node->id,0)+";\n";
- for(int i=0;i<3;i++) {
- code += "{\n";
- code += "\tfloat base="+p_inputs[0]+"."+axisn[i]+";\n";
- code += "\tfloat blend="+p_inputs[1]+"."+axisn[i]+";\n";
- code += "\tif (base < 0.5) {\n";
- code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (base * (blend+0.5));\n";
- code += "\t} else {\n";
- code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (1 - (1-base) * (1-(blend-0.5)));\n";
- code += "\t}\n";
- code += "}\n";
- }
-
- } break;
- case RGB_OP_HARD_LIGHT: {
-
- code += OUTNAME(p_node->id,0)+";\n";
- for(int i=0;i<3;i++) {
- code += "{\n";
- code += "\tfloat base="+p_inputs[0]+"."+axisn[i]+";\n";
- code += "\tfloat blend="+p_inputs[1]+"."+axisn[i]+";\n";
- code += "\tif (base < 0.5) {\n";
- code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (base * (2*blend));\n";
- code += "\t} else {\n";
- code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (1 - (1-base) * (1-2*(blend-0.5)));\n";
- code += "\t}\n";
- code += "}\n";
- }
-
- } break;
- }
- }break;
- case NODE_XFORM_MULT: {
- DEF_MATRIX(0);
- DEF_MATRIX(1);
-
- code += OUTNAME(p_node->id,0)+"="+p_inputs[0]+"*"+p_inputs[1]+";\n";
-
- }break;
- case NODE_XFORM_VEC_MULT: {
- DEF_MATRIX(0);
- DEF_VEC(1);
-
- bool no_translation = p_node->param1;
- if (no_translation) {
- code += OUTNAME(p_node->id,0)+"=("+p_inputs[0]+"*vec4("+p_inputs[1]+",0)).xyz;\n";
- } else {
- code += OUTNAME(p_node->id,0)+"=("+p_inputs[0]+"*vec4("+p_inputs[1]+",1)).xyz;\n";
- }
-
- }break;
- case NODE_XFORM_VEC_INV_MULT: {
- DEF_VEC(0);
- DEF_MATRIX(1);
- bool no_translation = p_node->param1;
- if (no_translation) {
- code += OUTNAME(p_node->id,0)+"=("+p_inputs[1]+"*vec4("+p_inputs[0]+",0)).xyz;\n";
- } else {
- code += OUTNAME(p_node->id,0)+"=("+p_inputs[1]+"*vec4("+p_inputs[0]+",1)).xyz;\n";
- }
- }break;
- case NODE_SCALAR_FUNC: {
- DEF_SCALAR(0);
- static const char*scalar_func_id[SCALAR_MAX_FUNC]={
- "sin($)",
- "cos($)",
- "tan($)",
- "asin($)",
- "acos($)",
- "atan($)",
- "sinh($)",
- "cosh($)",
- "tanh($)",
- "log($)",
- "exp($)",
- "sqrt($)",
- "abs($)",
- "sign($)",
- "floor($)",
- "round($)",
- "ceil($)",
- "fract($)",
- "min(max($,0),1)",
- "-($)",
- };
-
- int func = p_node->param1;
- ERR_FAIL_INDEX(func,SCALAR_MAX_FUNC);
- code += OUTNAME(p_node->id,0)+"="+String(scalar_func_id[func]).replace("$",p_inputs[0])+";\n";
-
- } break;
- case NODE_VEC_FUNC: {
- DEF_VEC(0);
- static const char*vec_func_id[VEC_MAX_FUNC]={
- "normalize($)",
- "max(min($,vec3(1,1,1)),vec3(0,0,0))",
- "-($)",
- "1.0/($)",
- "",
- "",
- };
-
-
- int func = p_node->param1;
- ERR_FAIL_INDEX(func,VEC_MAX_FUNC);
- if (func==VEC_FUNC_RGB2HSV) {
- code += OUTNAME(p_node->id,0)+";\n";
- code+="{\n";
- code+="\tvec3 c = "+p_inputs[0]+";\n";
- code+="\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n";
- code+="\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n";
- code+="\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n";
- code+="\tfloat d = q.x - min(q.w, q.y);\n";
- code+="\tfloat e = 1.0e-10;\n";
- code+="\t"+OUTVAR(p_node->id,0)+"=vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n";
- code+="}\n";
- } else if (func==VEC_FUNC_HSV2RGB) {
- code += OUTNAME(p_node->id,0)+";\n";
- code+="{\n";
- code+="\tvec3 c = "+p_inputs[0]+";\n";
- code+="\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n";
- code+="\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n";
- code+="\t"+OUTVAR(p_node->id,0)+"=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n";
- code+="}\n";
-
- } else {
- code += OUTNAME(p_node->id,0)+"="+String(vec_func_id[func]).replace("$",p_inputs[0])+";\n";
- }
- }break;
- case NODE_VEC_LEN: {
- DEF_VEC(0);
-
- code += OUTNAME(p_node->id,0)+"=length("+p_inputs[0]+");\n";
-
- }break;
- case NODE_DOT_PROD: {
- DEF_VEC(0);
- DEF_VEC(1);
- code += OUTNAME(p_node->id,0)+"=dot("+p_inputs[1]+","+p_inputs[0]+");\n";
-
- }break;
- case NODE_VEC_TO_SCALAR: {
- DEF_VEC(0);
- code += OUTNAME(p_node->id,0)+"="+p_inputs[0]+".x;\n";
- code += OUTNAME(p_node->id,1)+"="+p_inputs[0]+".y;\n";
- code += OUTNAME(p_node->id,2)+"="+p_inputs[0]+".z;\n";
-
- }break;
- case NODE_SCALAR_TO_VEC: {
- DEF_SCALAR(0);
- DEF_SCALAR(1);
- DEF_SCALAR(2);
- code += OUTNAME(p_node->id,0)+"=vec3("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+""+");\n";
-
- }break;
- case NODE_VEC_TO_XFORM: {
- DEF_VEC(0);
- DEF_VEC(1);
- DEF_VEC(2);
- DEF_VEC(3);
- code += OUTNAME(p_node->id, 0) + "=mat4(" +
- "vec4(" + p_inputs[0] + ".x," + p_inputs[0] + ".y," + p_inputs[0] + ".z, 0.0),"
- "vec4(" + p_inputs[1] + ".x," + p_inputs[1] + ".y," + p_inputs[1] + ".z, 0.0),"
- "vec4(" + p_inputs[2] + ".x," + p_inputs[2] + ".y," + p_inputs[2] + ".z, 0.0),"
- "vec4(" + p_inputs[3] + ".x," + p_inputs[3] + ".y," + p_inputs[3] + ".z, 1.0));\n";
-
- }break;
- case NODE_XFORM_TO_VEC: {
- DEF_MATRIX(0);
- code += OUTNAME(p_node->id, 0) + ";\n";
- code += OUTNAME(p_node->id, 1) + ";\n";
- code += OUTNAME(p_node->id, 2) + ";\n";
- code += OUTNAME(p_node->id, 3) + ";\n";
- code += "{\n";
- code += "\tvec4 xform_row_01=" + p_inputs[0] + ".x;\n";
- code += "\tvec4 xform_row_02=" + p_inputs[0] + ".y;\n";
- code += "\tvec4 xform_row_03=" + p_inputs[0] + ".z;\n";
- code += "\tvec4 xform_row_04=" + p_inputs[0] + ".w;\n";
- code += "\t" + OUTVAR(p_node->id, 0) + "=vec3(xform_row_01.x, xform_row_01.y, xform_row_01.z);\n";
- code += "\t" + OUTVAR(p_node->id, 1) + "=vec3(xform_row_02.x, xform_row_02.y, xform_row_02.z);\n";
- code += "\t" + OUTVAR(p_node->id, 2) + "=vec3(xform_row_03.x, xform_row_03.y, xform_row_03.z);\n";
- code += "\t" + OUTVAR(p_node->id, 3) + "=vec3(xform_row_04.x, xform_row_04.y, xform_row_04.z);\n";
- code += "}\n";
- }break;
- case NODE_SCALAR_INTERP: {
- DEF_SCALAR(0);
- DEF_SCALAR(1);
- DEF_SCALAR(2);
-
- code += OUTNAME(p_node->id,0)+"=mix("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+");\n";
-
- }break;
- case NODE_VEC_INTERP: {
- DEF_VEC(0);
- DEF_VEC(1);
- DEF_SCALAR(2);
- code += OUTNAME(p_node->id,0)+"=mix("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+");\n";
-
- }break;
- case NODE_COLOR_RAMP: {
- DEF_SCALAR(0);
-
- static const int color_ramp_len=512;
- PoolVector<uint8_t> cramp;
- cramp.resize(color_ramp_len*4);
- {
-
- PoolVector<Color> colors=p_node->param1;
- PoolVector<real_t> offsets=p_node->param2;
- int cc =colors.size();
- PoolVector<uint8_t>::Write crw = cramp.write();
- PoolVector<Color>::Read cr = colors.read();
- PoolVector<real_t>::Read ofr = offsets.read();
-
- int at=0;
- Color color_at(0,0,0,1);
- for(int i=0;i<=cc;i++) {
-
- int pos;
- Color to;
- if (i==cc) {
- if (at==color_ramp_len)
- break;
- pos=color_ramp_len;
- to=Color(1,1,1,1);
- } else {
- to=cr[i];
- pos= MIN(ofr[i]*color_ramp_len,color_ramp_len);
- }
- for(int j=at;j<pos;j++) {
- float t = (j-at)/float(pos-at);
- Color c = color_at.linear_interpolate(to,t);
- crw[j*4+0]=Math::fast_ftoi( CLAMP(c.r*255.0,0,255) );
- crw[j*4+1]=Math::fast_ftoi( CLAMP(c.g*255.0,0,255) );
- crw[j*4+2]=Math::fast_ftoi( CLAMP(c.b*255.0,0,255) );
- crw[j*4+3]=Math::fast_ftoi( CLAMP(c.a*255.0,0,255) );
- }
-
- at=pos;
- color_at=to;
- }
- }
-
- Image gradient(color_ramp_len,1,0,Image::FORMAT_RGBA8,cramp);
- Ref<ImageTexture> it = memnew( ImageTexture );
- it->create_from_image(gradient,Texture::FLAG_FILTER|Texture::FLAG_MIPMAPS);
-
- String crampname= "cramp_"+itos(p_node->id);
- set_default_texture_param(crampname,it);
-
- code +="uniform texture "+crampname+";\n";
- code +="vec4 "+crampname+"_r=tex("+crampname+",vec2("+p_inputs[0]+",0));\n";
- code += OUTNAME(p_node->id,0)+"="+crampname+"_r.rgb;\n";
- code += OUTNAME(p_node->id,1)+"="+crampname+"_r.a;\n";
-
- }break;
- case NODE_CURVE_MAP: {
- DEF_SCALAR(0);
- static const int curve_map_len=256;
- bool mapped[256];
- zeromem(mapped,sizeof(mapped));
- PoolVector<uint8_t> cmap;
- cmap.resize(curve_map_len);
- {
-
- PoolVector<Point2> points=p_node->param1;
- int pc =points.size();
- PoolVector<uint8_t>::Write cmw = cmap.write();
- PoolVector<Point2>::Read pr = points.read();
-
- Vector2 prev=Vector2(0,0);
- Vector2 prev2=Vector2(0,0);
-
- for(int i=-1;i<pc;i++) {
-
- Vector2 next;
- Vector2 next2;
- if (i+1>=pc) {
- next=Vector2(1,1);
- } else {
- next=Vector2(pr[i+1].x,pr[i+1].y);
- }
-
- if (i+2>=pc) {
- next2=Vector2(1,1);
- } else {
- next2=Vector2(pr[i+2].x,pr[i+2].y);
- }
-
- /*if (i==-1 && prev.offset==next.offset) {
- prev=next;
- continue;
- }*/
-
- _plot_curve(prev2,prev,next,next2,cmw.ptr(),mapped);
-
- prev2=prev;
- prev=next;
- }
-
- uint8_t pp=0;
- for(int i=0;i<curve_map_len;i++) {
-
- if (!mapped[i]) {
- cmw[i]=pp;
- } else {
- pp=cmw[i];
- }
- }
- }
-
-
-
- Image gradient(curve_map_len,1,0,Image::FORMAT_L8,cmap);
- Ref<ImageTexture> it = memnew( ImageTexture );
- it->create_from_image(gradient,Texture::FLAG_FILTER|Texture::FLAG_MIPMAPS);
-
- String cmapname= "cmap_"+itos(p_node->id);
- set_default_texture_param(cmapname,it);
-
- code +="uniform texture "+cmapname+";\n";
- code += OUTNAME(p_node->id,0)+"=tex("+cmapname+",vec2("+p_inputs[0]+",0)).r;\n";
-
- }break;
- case NODE_SCALAR_INPUT: {
- String name = p_node->param1;
- float dv=p_node->param2;
- code +="uniform float "+name+"="+rtos(dv)+";\n";
- code += OUTNAME(p_node->id,0)+"="+name+";\n";
- }break;
- case NODE_VEC_INPUT: {
-
- String name = p_node->param1;
- Vector3 dv=p_node->param2;
- code +="uniform vec3 "+name+"=vec3("+rtos(dv.x)+","+rtos(dv.y)+","+rtos(dv.z)+");\n";
- code += OUTNAME(p_node->id,0)+"="+name+";\n";
- }break;
- case NODE_RGB_INPUT: {
-
- String name = p_node->param1;
- Color dv= p_node->param2;
-
- code +="uniform color "+name+"=vec4("+rtos(dv.r)+","+rtos(dv.g)+","+rtos(dv.b)+","+rtos(dv.a)+");\n";
- code += OUTNAME(p_node->id,0)+"="+name+".rgb;\n";
- code += OUTNAME(p_node->id,1)+"="+name+".a;\n";
-
- }break;
- case NODE_XFORM_INPUT: {
-
- String name = p_node->param1;
- Transform dv= p_node->param2;
-
- code +="uniform mat4 "+name+"=mat4(\n";
- code+="\tvec4(vec3("+rtos(dv.basis.get_axis(0).x)+","+rtos(dv.basis.get_axis(0).y)+","+rtos(dv.basis.get_axis(0).z)+"),0),\n";
- code+="\tvec4(vec3("+rtos(dv.basis.get_axis(1).x)+","+rtos(dv.basis.get_axis(1).y)+","+rtos(dv.basis.get_axis(1).z)+"),0),\n";
- code+="\tvec4(vec3("+rtos(dv.basis.get_axis(2).x)+","+rtos(dv.basis.get_axis(2).y)+","+rtos(dv.basis.get_axis(2).z)+"),0),\n";
- code+="\tvec4(vec3("+rtos(dv.origin.x)+","+rtos(dv.origin.y)+","+rtos(dv.origin.z)+"),1)\n";
- code+=");";
-
- code += OUTNAME(p_node->id,0)+"="+name+";\n";
-
- }break;
- case NODE_TEXTURE_INPUT: {
- DEF_VEC(0);
- String name = p_node->param1;
- String rname="rt_read_tex"+itos(p_node->id);
- code +="uniform texture "+name+";";
- code +="vec4 "+rname+"=tex("+name+","+p_inputs[0]+".xy);\n";
- code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n";
- code += OUTNAME(p_node->id,1)+"="+rname+".a;\n";
-
- }break;
- case NODE_CUBEMAP_INPUT: {
- DEF_VEC(0);
- String name = p_node->param1;
- code +="uniform cubemap "+name+";";
- String rname="rt_read_tex"+itos(p_node->id);
- code +="vec4 "+rname+"=texcube("+name+","+p_inputs[0]+".xy);\n";
- code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n";
- code += OUTNAME(p_node->id,1)+"="+rname+".a;\n";
- }break;
- case NODE_DEFAULT_TEXTURE: {
- DEF_VEC(0);
-
- if (get_mode()==MODE_CANVAS_ITEM && p_type==SHADER_TYPE_FRAGMENT) {
-
- String rname="rt_default_tex"+itos(p_node->id);
- code +="vec4 "+rname+"=tex(TEXTURE,"+p_inputs[0]+".xy);\n";
- code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n";
- code += OUTNAME(p_node->id,1)+"="+rname+".a;\n";
-
- } else {
- //not supported
- code += OUTNAME(p_node->id,0)+"=vec3(0,0,0);\n";
- code += OUTNAME(p_node->id,1)+"=1.0;\n";
-
- }
- } break;
- case NODE_OUTPUT: {
-
-
- }break;
- case NODE_COMMENT: {
-
- }break;
- case NODE_TYPE_MAX: {
-
- }
- }
-#undef DEF_SCALAR
-#undef DEF_COLOR
-#undef DEF_MATRIX
-#undef DEF_VEC
-}
-
-#endif
diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h
deleted file mode 100644
index e3a68f8572..0000000000
--- a/scene/resources/shader_graph.h
+++ /dev/null
@@ -1,446 +0,0 @@
-/*************************************************************************/
-/* shader_graph.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef SHADER_GRAPH_H
-#define SHADER_GRAPH_H
-
-// FIXME: Needs to be ported to the new 3.0 shader API
-#if 0
-#include "map.h"
-#include "scene/resources/shader.h"
-
-class ShaderGraph : public Shader {
-
- GDCLASS( ShaderGraph, Shader );
- RES_BASE_EXTENSION("vshader");
-
-public:
-
- enum NodeType {
- NODE_INPUT, // all inputs (shader type dependent)
- NODE_SCALAR_CONST, //scalar constant
- NODE_VEC_CONST, //vec3 constant
- NODE_RGB_CONST, //rgb constant (shows a color picker instead)
- NODE_XFORM_CONST, // 4x4 matrix constant
- NODE_TIME, // time in seconds
- NODE_SCREEN_TEX, // screen texture sampler (takes UV) (only usable in fragment shader)
- NODE_SCALAR_OP, // scalar vs scalar op (mul, add, div, etc)
- NODE_VEC_OP, // vec3 vs vec3 op (mul,ad,div,crossprod,etc)
- NODE_VEC_SCALAR_OP, // vec3 vs scalar op (mul, add, div, etc)
- NODE_RGB_OP, // vec3 vs vec3 rgb op (with scalar amount), like brighten, darken, burn, dodge, multiply, etc.
- NODE_XFORM_MULT, // mat4 x mat4
- NODE_XFORM_VEC_MULT, // mat4 x vec3 mult (with no-translation option)
- NODE_XFORM_VEC_INV_MULT, // mat4 x vec3 inverse mult (with no-translation option)
- NODE_SCALAR_FUNC, // scalar function (sin, cos, etc)
- NODE_VEC_FUNC, // vector function (normalize, negate, reciprocal, rgb2hsv, hsv2rgb, etc, etc)
- NODE_VEC_LEN, // vec3 length
- NODE_DOT_PROD, // vec3 . vec3 (dot product -> scalar output)
- NODE_VEC_TO_SCALAR, // 1 vec3 input, 3 scalar outputs
- NODE_SCALAR_TO_VEC, // 3 scalar input, 1 vec3 output
- NODE_XFORM_TO_VEC, // 3 vec input, 1 xform output
- NODE_VEC_TO_XFORM, // 3 vec input, 1 xform output
- NODE_SCALAR_INTERP, // scalar interpolation (with optional curve)
- NODE_VEC_INTERP, // vec3 interpolation (with optional curve)
- NODE_COLOR_RAMP, //take scalar, output vec3
- NODE_CURVE_MAP, //take scalar, otput scalar
- NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
- NODE_VEC_INPUT, // vec3 uniform (assignable in material)
- NODE_RGB_INPUT, // color uniform (assignable in material)
- NODE_XFORM_INPUT, // mat4 uniform (assignable in material)
- NODE_TEXTURE_INPUT, // texture input (assignable in material)
- NODE_CUBEMAP_INPUT, // cubemap input (assignable in material)
- NODE_DEFAULT_TEXTURE,
- NODE_OUTPUT, // output (shader type dependent)
- NODE_COMMENT, // comment
- NODE_TYPE_MAX
- };
-
-
- struct Connection {
-
- int src_id;
- int src_slot;
- int dst_id;
- int dst_slot;
- };
-
- enum SlotType {
-
- SLOT_TYPE_SCALAR,
- SLOT_TYPE_VEC,
- SLOT_TYPE_XFORM,
- SLOT_TYPE_TEXTURE,
- SLOT_MAX
- };
-
- enum ShaderType {
- SHADER_TYPE_VERTEX,
- SHADER_TYPE_FRAGMENT,
- SHADER_TYPE_LIGHT,
- SHADER_TYPE_MAX
- };
-
- enum SlotDir {
- SLOT_IN,
- SLOT_OUT
- };
-
- enum GraphError {
- GRAPH_OK,
- GRAPH_ERROR_CYCLIC,
- GRAPH_ERROR_MISSING_CONNECTIONS
- };
-
-private:
-
- String _find_unique_name(const String& p_base);
-
- enum {SLOT_DEFAULT_VALUE = 0x7FFFFFFF};
- struct SourceSlot {
-
- int id;
- int slot;
- bool operator==(const SourceSlot& p_slot) const {
- return id==p_slot.id && slot==p_slot.slot;
- }
- };
-
- struct Node {
-
- Vector2 pos;
- NodeType type;
- Variant param1;
- Variant param2;
- Map<int, Variant> defaults;
- int id;
- mutable int order; // used for sorting
- int sort_order;
- Map<int,SourceSlot> connections;
-
- };
-
- struct ShaderData {
- Map<int,Node> node_map;
- GraphError error;
- } shader[3];
-
-
-
- struct InOutParamInfo {
- Mode shader_mode;
- ShaderType shader_type;
- const char *name;
- const char *variable;
- const char *postfix;
- SlotType slot_type;
- SlotDir dir;
- };
-
- static const InOutParamInfo inout_param_info[];
-
- struct NodeSlotInfo {
-
- enum { MAX_INS=3, MAX_OUTS=3 };
- NodeType type;
- const SlotType ins[MAX_INS];
- const SlotType outs[MAX_OUTS];
- };
-
- static const NodeSlotInfo node_slot_info[];
-
- bool _pending_update_shader;
- void _update_shader();
- void _request_update();
-
- void _plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d,uint8_t* p_heights,bool *p_useds);
- void _add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code);
-
- Array _get_node_list(ShaderType p_type) const;
- Array _get_connections(ShaderType p_type) const;
-
- void _set_data(const Dictionary& p_data);
- Dictionary _get_data() const;
-protected:
-
- static void _bind_methods();
-
-public:
-
-
- void node_add(ShaderType p_type, NodeType p_node_type, int p_id);
- void node_remove(ShaderType p_which,int p_id);
- void node_set_position(ShaderType p_which,int p_id,const Point2& p_pos);
- Point2 node_get_position(ShaderType p_which,int p_id) const;
-
- void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
- NodeType node_get_type(ShaderType p_which,int p_id) const;
-
- void scalar_const_node_set_value(ShaderType p_which,int p_id,float p_value);
- float scalar_const_node_get_value(ShaderType p_which,int p_id) const;
-
- void vec_const_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value);
- Vector3 vec_const_node_get_value(ShaderType p_which,int p_id) const;
-
- void rgb_const_node_set_value(ShaderType p_which,int p_id,const Color& p_value);
- Color rgb_const_node_get_value(ShaderType p_which,int p_id) const;
-
- void xform_const_node_set_value(ShaderType p_which,int p_id,const Transform& p_value);
- Transform xform_const_node_get_value(ShaderType p_which,int p_id) const;
-
- void texture_node_set_filter_size(ShaderType p_which,int p_id,int p_size);
- int texture_node_get_filter_size(ShaderType p_which,int p_id) const;
-
- void texture_node_set_filter_strength(ShaderType p_which,float p_id,float p_strength);
- float texture_node_get_filter_strength(ShaderType p_which,float p_id) const;
-
- void duplicate_nodes(ShaderType p_which, List<int> &p_nodes);
-
- List<int> generate_ids(ShaderType p_type, int count);
-
- enum ScalarOp {
- SCALAR_OP_ADD,
- SCALAR_OP_SUB,
- SCALAR_OP_MUL,
- SCALAR_OP_DIV,
- SCALAR_OP_MOD,
- SCALAR_OP_POW,
- SCALAR_OP_MAX,
- SCALAR_OP_MIN,
- SCALAR_OP_ATAN2,
- SCALAR_MAX_OP
- };
-
- void scalar_op_node_set_op(ShaderType p_which,float p_id,ScalarOp p_op);
- ScalarOp scalar_op_node_get_op(ShaderType p_which,float p_id) const;
-
- enum VecOp {
- VEC_OP_ADD,
- VEC_OP_SUB,
- VEC_OP_MUL,
- VEC_OP_DIV,
- VEC_OP_MOD,
- VEC_OP_POW,
- VEC_OP_MAX,
- VEC_OP_MIN,
- VEC_OP_CROSS,
- VEC_MAX_OP
- };
-
- void vec_op_node_set_op(ShaderType p_which,float p_id,VecOp p_op);
- VecOp vec_op_node_get_op(ShaderType p_which,float p_id) const;
-
- enum VecScalarOp {
- VEC_SCALAR_OP_MUL,
- VEC_SCALAR_OP_DIV,
- VEC_SCALAR_OP_POW,
- VEC_SCALAR_MAX_OP
- };
-
- void vec_scalar_op_node_set_op(ShaderType p_which,float p_id,VecScalarOp p_op);
- VecScalarOp vec_scalar_op_node_get_op(ShaderType p_which,float p_id) const;
-
- enum RGBOp {
- RGB_OP_SCREEN,
- RGB_OP_DIFFERENCE,
- RGB_OP_DARKEN,
- RGB_OP_LIGHTEN,
- RGB_OP_OVERLAY,
- RGB_OP_DODGE,
- RGB_OP_BURN,
- RGB_OP_SOFT_LIGHT,
- RGB_OP_HARD_LIGHT,
- RGB_MAX_OP
- };
-
- void rgb_op_node_set_op(ShaderType p_which,float p_id,RGBOp p_op);
- RGBOp rgb_op_node_get_op(ShaderType p_which,float p_id) const;
-
- void xform_vec_mult_node_set_no_translation(ShaderType p_which,int p_id,bool p_no_translation);
- bool xform_vec_mult_node_get_no_translation(ShaderType p_which,int p_id) const;
-
- enum ScalarFunc {
- SCALAR_FUNC_SIN,
- SCALAR_FUNC_COS,
- SCALAR_FUNC_TAN,
- SCALAR_FUNC_ASIN,
- SCALAR_FUNC_ACOS,
- SCALAR_FUNC_ATAN,
- SCALAR_FUNC_SINH,
- SCALAR_FUNC_COSH,
- SCALAR_FUNC_TANH,
- SCALAR_FUNC_LOG,
- SCALAR_FUNC_EXP,
- SCALAR_FUNC_SQRT,
- SCALAR_FUNC_ABS,
- SCALAR_FUNC_SIGN,
- SCALAR_FUNC_FLOOR,
- SCALAR_FUNC_ROUND,
- SCALAR_FUNC_CEIL,
- SCALAR_FUNC_FRAC,
- SCALAR_FUNC_SATURATE,
- SCALAR_FUNC_NEGATE,
- SCALAR_MAX_FUNC
- };
-
- void scalar_func_node_set_function(ShaderType p_which,int p_id,ScalarFunc p_func);
- ScalarFunc scalar_func_node_get_function(ShaderType p_which,int p_id) const;
-
- enum VecFunc {
- VEC_FUNC_NORMALIZE,
- VEC_FUNC_SATURATE,
- VEC_FUNC_NEGATE,
- VEC_FUNC_RECIPROCAL,
- VEC_FUNC_RGB2HSV,
- VEC_FUNC_HSV2RGB,
- VEC_MAX_FUNC
- };
-
- void default_set_value(ShaderType p_which,int p_id,int p_param, const Variant& p_value);
- Variant default_get_value(ShaderType p_which,int p_id,int p_param);
-
- void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func);
- VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const;
-
- void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets);
- PoolVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const;
- PoolVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const;
-
- void curve_map_node_set_points(ShaderType p_which, int p_id, const PoolVector<Vector2>& p_points);
- PoolVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const;
-
- void input_node_set_name(ShaderType p_which,int p_id,const String& p_name);
- String input_node_get_name(ShaderType p_which,int p_id);
-
- void scalar_input_node_set_value(ShaderType p_which,int p_id,float p_value);
- float scalar_input_node_get_value(ShaderType p_which,int p_id) const;
-
- void vec_input_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value);
- Vector3 vec_input_node_get_value(ShaderType p_which,int p_id) const;
-
- void rgb_input_node_set_value(ShaderType p_which,int p_id,const Color& p_value);
- Color rgb_input_node_get_value(ShaderType p_which,int p_id) const;
-
- void xform_input_node_set_value(ShaderType p_which,int p_id,const Transform& p_value);
- Transform xform_input_node_get_value(ShaderType p_which,int p_id) const;
-
- void texture_input_node_set_value(ShaderType p_which,int p_id,const Ref<Texture>& p_texture);
- Ref<Texture> texture_input_node_get_value(ShaderType p_which,int p_id) const;
-
- void cubemap_input_node_set_value(ShaderType p_which,int p_id,const Ref<CubeMap>& p_cubemap);
- Ref<CubeMap> cubemap_input_node_get_value(ShaderType p_which,int p_id) const;
-
- void comment_node_set_text(ShaderType p_which,int p_id,const String& p_comment);
- String comment_node_get_text(ShaderType p_which,int p_id) const;
-
- Error connect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
- bool is_node_connected(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const;
- void disconnect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
-
- void get_node_connections(ShaderType p_which,List<Connection> *p_connections) const;
-
- bool is_slot_connected(ShaderType p_which,int p_dst_id,int slot_id);
-
- void clear(ShaderType p_which);
-
- Variant node_get_state(ShaderType p_type, int p_node) const;
- void node_set_state(ShaderType p_type, int p_id, const Variant& p_state);
-
- GraphError get_graph_error(ShaderType p_type) const;
-
- int node_count(ShaderType p_which, int p_type);
-
- static int get_type_input_count(NodeType p_type);
- static int get_type_output_count(NodeType p_type);
- static SlotType get_type_input_type(NodeType p_type,int p_idx);
- static SlotType get_type_output_type(NodeType p_type,int p_idx);
- static bool is_type_valid(Mode p_mode,ShaderType p_type);
-
-
- struct SlotInfo {
- String name;
- SlotType type;
- SlotDir dir;
- };
-
- static void get_input_output_node_slot_info(Mode p_mode, ShaderType p_type, List<SlotInfo> *r_slots);
-
- static int get_node_input_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type);
- static int get_node_output_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type);
- static SlotType get_node_input_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx);
- static SlotType get_node_output_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx);
-
-
- ShaderGraph(Mode p_mode);
- ~ShaderGraph();
-};
-
-//helper functions
-
-
-
-
-VARIANT_ENUM_CAST( ShaderGraph::NodeType );
-VARIANT_ENUM_CAST( ShaderGraph::ShaderType );
-VARIANT_ENUM_CAST( ShaderGraph::SlotType );
-VARIANT_ENUM_CAST( ShaderGraph::ScalarOp );
-VARIANT_ENUM_CAST( ShaderGraph::VecOp );
-VARIANT_ENUM_CAST( ShaderGraph::VecScalarOp );
-VARIANT_ENUM_CAST( ShaderGraph::RGBOp );
-VARIANT_ENUM_CAST( ShaderGraph::ScalarFunc );
-VARIANT_ENUM_CAST( ShaderGraph::VecFunc );
-VARIANT_ENUM_CAST( ShaderGraph::GraphError );
-
-
-class MaterialShaderGraph : public ShaderGraph {
-
- GDCLASS( MaterialShaderGraph, ShaderGraph );
-
-public:
-
-
- MaterialShaderGraph() : ShaderGraph(MODE_MATERIAL) {
-
- }
-};
-
-class CanvasItemShaderGraph : public ShaderGraph {
-
- GDCLASS( CanvasItemShaderGraph, ShaderGraph );
-
-public:
-
-
- CanvasItemShaderGraph() : ShaderGraph(MODE_CANVAS_ITEM) {
-
- }
-};
-
-#endif
-#endif // SHADER_GRAPH_H
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index ec489e5c5b..81fabf40fe 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -755,15 +755,11 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const
for (List<int>::Element *E = nindices.front(); E; E = E->next()) {
int dst_index = E->get() + vfrom;
- /*
- if (dst_index <0 || dst_index>=vertex_array.size()) {
- print_line("invalid index!");
- }
- */
index_array.push_back(dst_index);
}
- if (index_array.size() % 3)
- print_line("IA not div of 3?");
+ if (index_array.size() % 3) {
+ WARN_PRINT("SurfaceTool: Index array not a multiple of 3.");
+ }
}
//mikktspace callbacks
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index c763c9bc79..811e5c3d2c 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -480,7 +480,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
flags = f->get_32(); //texture flags!
uint32_t df = f->get_32(); //data format
-/*
+ /*
print_line("width: " + itos(tw));
print_line("height: " + itos(th));
print_line("flags: " + itos(flags));
@@ -1022,30 +1022,12 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile
void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture> &p_normal_map, bool p_clip_uv) const {
//this might not necessarily work well if using a rect, needs to be fixed properly
- Rect2 rc = region;
-
if (!atlas.is_valid())
return;
- Rect2 src = p_src_rect;
- src.position += (rc.position - margin.position);
- Rect2 src_c = rc.clip(src);
- if (src_c.size == Size2())
- return;
- Vector2 ofs = (src_c.position - src.position);
-
- Vector2 scale = p_rect.size / p_src_rect.size;
- if (scale.x < 0) {
- float mx = (margin.size.width - margin.position.x);
- mx -= margin.position.x;
- ofs.x = -(ofs.x + mx);
- }
- if (scale.y < 0) {
- float my = margin.size.height - margin.position.y;
- my -= margin.position.y;
- ofs.y = -(ofs.y + my);
- }
- Rect2 dr(p_rect.position + ofs * scale, src_c.size * scale);
+ Rect2 dr;
+ Rect2 src_c;
+ get_rect_region(p_rect, p_src_rect, dr, src_c);
RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose, normal_rid, filter_clip);
@@ -1059,13 +1041,17 @@ bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect,
return false;
Rect2 src = p_src_rect;
+ if (src.size == Size2()) {
+ src.size = rc.size;
+ }
+ Vector2 scale = p_rect.size / src.size;
+
src.position += (rc.position - margin.position);
Rect2 src_c = rc.clip(src);
if (src_c.size == Size2())
return false;
Vector2 ofs = (src_c.position - src.position);
- Vector2 scale = p_rect.size / p_src_rect.size;
if (scale.x < 0) {
float mx = (margin.size.width - margin.position.x);
mx -= margin.position.x;
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 3d2b6c36de..8112d6be00 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -59,7 +59,13 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
tile_set_region(id, p_value);
else if (what == "tile_mode")
tile_set_tile_mode(id, (TileMode)((int)p_value));
- else if (what.left(9) == "autotile/") {
+ else if (what == "is_autotile") {
+ // backward compatibility for Godot 3.0.x
+ // autotile used to be a bool, it's now an enum
+ bool is_autotile = p_value;
+ if (is_autotile)
+ tile_set_tile_mode(id, AUTO_TILE);
+ } else if (what.left(9) == "autotile/") {
what = what.right(9);
if (what == "bitmask_mode")
autotile_set_bitmask_mode(id, (BitmaskMode)((int)p_value));
@@ -950,6 +956,8 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region);
ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape);
ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape);
+ ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &TileSet::tile_set_shape_offset);
+ ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &TileSet::tile_get_shape_offset);
ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform);
ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform);
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way);
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index d8fc3677fb..dac12205b6 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -431,7 +431,6 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
global_code += "\n\n";
String final_code = global_code;
final_code += code;
- //print_line(final_code);
return final_code;
}
@@ -914,7 +913,6 @@ void VisualShader::_update_shader() const {
String final_code = global_code;
final_code += code;
const_cast<VisualShader *>(this)->set_code(final_code);
- //print_line(final_code);
for (int i = 0; i < default_tex_params.size(); i++) {
const_cast<VisualShader *>(this)->set_default_texture_param(default_tex_params[i].name, default_tex_params[i].param);
}
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index 0d1aad0dff..2040377dd4 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -178,7 +178,7 @@ void ARVRServer::remove_interface(const Ref<ARVRInterface> &p_interface) {
ERR_FAIL_COND(idx == -1);
- print_line("Removed interface" + p_interface->get_name());
+ print_verbose("ARVR: Removed interface" + p_interface->get_name());
emit_signal("interface_removed", p_interface->get_name());
interfaces.remove(idx);
@@ -320,12 +320,12 @@ Ref<ARVRInterface> ARVRServer::get_primary_interface() const {
void ARVRServer::set_primary_interface(const Ref<ARVRInterface> &p_primary_interface) {
primary_interface = p_primary_interface;
- print_line("Primary interface set to: " + primary_interface->get_name());
+ print_verbose("ARVR: Primary interface set to: " + primary_interface->get_name());
};
void ARVRServer::clear_primary_interface_if(const Ref<ARVRInterface> &p_primary_interface) {
if (primary_interface == p_primary_interface) {
- print_line("Clearing primary interface");
+ print_verbose("ARVR: Clearing primary interface");
primary_interface.unref();
};
};
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp
index b059c20c95..294b1df241 100644
--- a/servers/physics/collision_solver_sat.cpp
+++ b/servers/physics/collision_solver_sat.cpp
@@ -44,12 +44,6 @@ struct _CollectorCallback {
_FORCE_INLINE_ void call(const Vector3 &p_point_A, const Vector3 &p_point_B) {
- /*
- if (normal.dot(p_point_A) >= normal.dot(p_point_B))
- return;
- print_line("** A: "+p_point_A+" B: "+p_point_B+" D: "+rtos(p_point_A.distance_to(p_point_B)));
- */
-
if (swap)
callback(p_point_B, p_point_A, userdata);
else
@@ -410,26 +404,13 @@ public:
supports_B[i] += best_axis * margin_B;
}
}
- /*
- print_line("best depth: "+rtos(best_depth));
- print_line("best axis: "+(best_axis));
- for(int i=0;i<support_count_A;i++) {
- print_line("A-"+itos(i)+": "+supports_A[i]);
- }
- for(int i=0;i<support_count_B;i++) {
-
- print_line("B-"+itos(i)+": "+supports_B[i]);
- }
-*/
callback->normal = best_axis;
if (callback->prev_axis)
*callback->prev_axis = best_axis;
_generate_contacts_from_supports(supports_A, support_count_A, supports_B, support_count_B, callback);
callback->collided = true;
- //CollisionSolverSW::CallbackResult cbk=NULL;
- //cbk(Vector3(),Vector3(),NULL);
}
_FORCE_INLINE_ SeparatorAxisTest(const ShapeA *p_shape_A, const Transform &p_transform_A, const ShapeB *p_shape_B, const Transform &p_transform_B, _CollectorCallback *p_callback, real_t p_margin_A = 0, real_t p_margin_B = 0) {
@@ -445,9 +426,6 @@ public:
};
/****** SAT TESTS *******/
-/****** SAT TESTS *******/
-/****** SAT TESTS *******/
-/****** SAT TESTS *******/
typedef void (*CollisionFunc)(const ShapeSW *, const Transform &, const ShapeSW *, const Transform &, _CollectorCallback *p_callback, real_t, real_t);
diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp
index 0037b9a862..2f2f6d2908 100644
--- a/servers/physics/collision_solver_sw.cpp
+++ b/servers/physics/collision_solver_sw.cpp
@@ -176,7 +176,6 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform
}
concave_B->cull(local_aabb, concave_callback, &cinfo);
- //print_line("COL AABB TESTS: "+itos(cinfo.aabb_tests));
return cinfo.collided;
}
@@ -364,13 +363,10 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform
concave_B->cull(local_aabb, concave_distance_callback, &cinfo);
if (!cinfo.collided) {
- //print_line(itos(cinfo.tested));
r_point_A = cinfo.close_A;
r_point_B = cinfo.close_B;
}
- //print_line("DIST AABB TESTS: "+itos(cinfo.aabb_tests));
-
return !cinfo.collided;
} else {
diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp
index d660eba879..368a349632 100644
--- a/servers/physics/joints/hinge_joint_sw.cpp
+++ b/servers/physics/joints/hinge_joint_sw.cpp
@@ -224,18 +224,12 @@ bool HingeJointSW::setup(real_t p_step) {
// Compute limit information
real_t hingeAngle = get_hinge_angle();
- //print_line("angle: "+rtos(hingeAngle));
//set bias, sign, clear accumulator
m_correction = real_t(0.);
m_limitSign = real_t(0.);
m_solveLimit = false;
m_accLimitImpulse = real_t(0.);
- /*if (m_useLimit) {
- print_line("low: "+rtos(m_lowerLimit));
- print_line("hi: "+rtos(m_upperLimit));
- }*/
-
//if (m_lowerLimit < m_upperLimit)
if (m_useLimit && m_lowerLimit <= m_upperLimit) {
//if (hingeAngle <= m_lowerLimit*m_limitSoftness)
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index cae2e6fb00..b2ab7bec16 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -231,11 +231,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
aabb = aabb.merge(AABB(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
- /*
- if (p_motion!=Vector3())
- print_line(p_motion);
- */
-
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
real_t best_safe = 1;
@@ -267,7 +262,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
Transform col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
if (CollisionSolverSW::solve_distance(&mshape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) {
- //print_line("failed motion cast (no collision)");
continue;
}
@@ -275,7 +269,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
sep_axis = p_motion.normalized();
if (!CollisionSolverSW::solve_distance(shape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) {
- //print_line("failed motion cast (no collision)");
return false;
}
@@ -298,7 +291,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
if (collided) {
- //print_line(itos(i)+": "+rtos(ofs));
hi = ofs;
} else {
@@ -376,9 +368,6 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
continue;
}
- //print_line("AGAINST: "+itos(col_obj->get_self().get_id())+":"+itos(shape_idx));
- //print_line("THE ABBB: "+(col_obj->get_transform() * col_obj->get_shape_transform(shape_idx)).xform(col_obj->get_shape(shape_idx)->get_aabb()));
-
if (CollisionSolverSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
collided = true;
}
@@ -832,13 +821,11 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
Transform col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
if (CollisionSolverSW::solve_distance(&mshape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) {
- //print_line("failed motion cast (no collision)");
continue;
}
sep_axis = p_motion.normalized();
if (!CollisionSolverSW::solve_distance(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) {
- //print_line("failed motion cast (no collision)");
stuck = true;
break;
}
@@ -862,7 +849,6 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
if (collided) {
- //print_line(itos(i)+": "+rtos(ofs));
hi = ofs;
} else {
diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp
index ad08cb6353..4128e1ec1a 100644
--- a/servers/physics/step_sw.cpp
+++ b/servers/physics/step_sw.cpp
@@ -228,7 +228,6 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
profile_begtime = profile_endtime;
}
- //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count));
/* SETUP CONSTRAINT ISLANDS */
{
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp
index 0d1ffca50d..98fe4adb80 100644
--- a/servers/physics_2d/collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/collision_solver_2d_sat.cpp
@@ -300,7 +300,6 @@ public:
}
}
-//print_line("test axis: "+p_axis+" depth: "+rtos(best_depth));
#ifdef DEBUG_ENABLED
best_axis_count++;
#endif
diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp
index 6ce019f36e..b03a193d97 100644
--- a/servers/physics_2d/collision_solver_2d_sw.cpp
+++ b/servers/physics_2d/collision_solver_2d_sw.cpp
@@ -114,35 +114,6 @@ bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A, const Vector
return true;
}
-/*
-bool CollisionSolver2DSW::solve_ray(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_inverse_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) {
-
-
- const RayShape2DSW *ray = static_cast<const RayShape2DSW*>(p_shape_A);
-
- Vector2 from = p_transform_A.origin;
- Vector2 to = from+p_transform_A.basis.get_axis(2)*ray->get_length();
- Vector2 support_A=to;
-
- from = p_inverse_B.xform(from);
- to = p_inverse_B.xform(to);
-
- Vector2 p,n;
- if (!p_shape_B->intersect_segment(from,to,&p,&n))
- return false;
-
- Vector2 support_B=p_transform_B.xform(p);
-
- if (p_result_callback) {
- if (p_swap_result)
- p_result_callback(support_B,support_A,p_userdata);
- else
- p_result_callback(support_A,support_B,p_userdata);
- }
- return true;
-}
-*/
-
struct _ConcaveCollisionInfo2D {
const Transform2D *transform_A;
@@ -219,7 +190,6 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A, const Transf
concave_B->cull(local_aabb, concave_callback, &cinfo);
- //print_line("Rect2 TESTS: "+itos(cinfo.aabb_tests));
return cinfo.collided;
}
@@ -245,10 +215,6 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
if (type_B == Physics2DServer::SHAPE_LINE || type_B == Physics2DServer::SHAPE_RAY) {
return false;
}
- /*
- if (type_B==Physics2DServer::SHAPE_RAY) {
- return false;
- */
if (swap) {
return solve_static_line(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true);
@@ -256,17 +222,6 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
return solve_static_line(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
}
- /*} else if (type_A==Physics2DServer::SHAPE_RAY) {
-
- if (type_B==Physics2DServer::SHAPE_RAY)
- return false;
-
- if (swap) {
- return solve_ray(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_inverse_A,p_result_callback,p_userdata,true);
- } else {
- return solve_ray(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_inverse_B,p_result_callback,p_userdata,false);
- }
-*/
} else if (type_A == Physics2DServer::SHAPE_RAY) {
if (type_B == Physics2DServer::SHAPE_RAY) {
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 15e80bcd5e..721f21fc40 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -171,13 +171,14 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &
}
if (cbk->valid_dir.dot((p_point_A - p_point_B).normalized()) < 0.7071) {
cbk->invalid_by_dir++;
- ;
- /* print_line("A: "+p_point_A);
+
+ /*
+ print_line("A: "+p_point_A);
print_line("B: "+p_point_B);
print_line("discard too angled "+rtos(cbk->valid_dir.dot((p_point_A-p_point_B))));
print_line("resnorm: "+(p_point_A-p_point_B).normalized());
print_line("distance: "+rtos(p_point_A.distance_to(p_point_B)));
-*/
+ */
return;
}
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index ecebd09436..746aa2d49b 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -234,11 +234,6 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
aabb = aabb.merge(Rect2(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
- /*
- if (p_motion!=Vector2())
- print_line(p_motion);
- */
-
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
real_t best_safe = 1;
@@ -255,15 +250,6 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
const CollisionObject2DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
- /*if (col_obj->get_type()==CollisionObject2DSW::TYPE_BODY) {
-
- const Body2DSW *body=static_cast<const Body2DSW*>(col_obj);
- if (body->get_one_way_collision_direction()!=Vector2() && p_motion.dot(body->get_one_way_collision_direction())<=CMP_EPSILON) {
- print_line("failed in motion dir");
- continue;
- }
- }*/
-
Transform2D col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) {
diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp
index 6108b885f0..d1078f1506 100644
--- a/servers/physics_2d/step_2d_sw.cpp
+++ b/servers/physics_2d/step_2d_sw.cpp
@@ -209,8 +209,6 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
p_space->area_remove_from_moved_list((SelfList<Area2DSW> *)aml.first()); //faster to remove here
}
- //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count));
-
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
p_space->set_elapsed_time(Space2DSW::ELAPSED_TIME_GENERATE_ISLANDS, profile_endtime - profile_begtime);
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 8705033326..ffb130048f 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2533,7 +2533,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
expr = constant;
} else if (tk.type == TK_TRUE) {
- //print_line("found true");
//handle true constant
ConstantNode *constant = alloc_node<ConstantNode>();
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 213b3ad8f6..1e255591f0 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -1180,7 +1180,7 @@ _FORCE_INLINE_ static void _light_capture_sample_octree(const RasterizerStorage:
r_color = color_interp[0].linear_interpolate(color_interp[1], level_filter);
r_alpha = Math::lerp(alpha_interp[0], alpha_interp[1], level_filter);
- // print_line("pos: " + p_posf + " level " + rtos(p_level) + " down to " + itos(target_level) + "." + rtos(level_filter) + " color " + r_color + " alpha " + rtos(r_alpha));
+ //print_line("pos: " + p_posf + " level " + rtos(p_level) + " down to " + itos(target_level) + "." + rtos(level_filter) + " color " + r_color + " alpha " + rtos(r_alpha));
}
_FORCE_INLINE_ static Color _light_capture_voxel_cone_trace(const RasterizerStorage::LightmapCaptureOctree *p_octree, const Vector3 &p_pos, const Vector3 &p_dir, float p_aperture, int p_cell_subdiv) {
@@ -1799,11 +1799,12 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
//light_samplers_culled=0;
- /* print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0));
+ /*
+ print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0));
print_line("OTO: "+itos(p_scenario->octree.get_octant_count()));
- //print_line("OTE: "+itos(p_scenario->octree.get_elem_count()));
+ print_line("OTE: "+itos(p_scenario->octree.get_elem_count()));
print_line("OTP: "+itos(p_scenario->octree.get_pair_count()));
-*/
+ */
/* STEP 3 - PROCESS PORTALS, VALIDATE ROOMS */
//removed, will replace with culling
@@ -2302,7 +2303,6 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) {
int size_divisor = 1;
if (probe->dynamic.compression == RasterizerStorage::GI_PROBE_S3TC) {
- print_line("S3TC");
size_limit = 4;
size_divisor = 4;
}
@@ -2391,7 +2391,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) {
probe->dynamic.mipmaps_s3tc.resize(mipmap_count);
for (int i = 0; i < mipmap_count; i++) {
- print_line("S3TC level: " + itos(i) + " blocks: " + itos(comp_blocks[i].size()));
+ //print_line("S3TC level: " + itos(i) + " blocks: " + itos(comp_blocks[i].size()));
probe->dynamic.mipmaps_s3tc.write[i].resize(comp_blocks[i].size());
PoolVector<InstanceGIProbeData::CompBlockS3TC>::Write w = probe->dynamic.mipmaps_s3tc.write[i].write();
int block_idx = 0;
@@ -2759,7 +2759,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
light->energy[2] += int32_t(light_b * att * ((cell->albedo) & 0xFF) / 255.0);
}
}
- // print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
+ //print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
} break;
}
}
@@ -3180,7 +3180,7 @@ void VisualServerScene::render_probes() {
} break;
case GI_UPDATE_STAGE_UPLOADING: {
- // uint64_t us = OS::get_singleton()->get_ticks_usec();
+ //uint64_t us = OS::get_singleton()->get_ticks_usec();
for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) {
@@ -3190,7 +3190,7 @@ void VisualServerScene::render_probes() {
probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK;
- // print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
+ //print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
} break;
}
}
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index a700fcf11b..90acba306a 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -137,7 +137,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
}
}
- //print_line("lights: "+itos(light_count));
canvas_map[Viewport::CanvasKey(E->key(), E->get().layer)] = &E->get();
}
@@ -194,8 +193,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get()->canvas);
- //print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size()));
- //print_line("GT "+p_viewport->global_transform+". CT: "+E->get()->transform);
Transform2D xform = p_viewport->global_transform * E->get()->transform;
RasterizerCanvas::Light *canvas_lights = NULL;
diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp
index 93f3792bdc..1cafc47685 100644
--- a/servers/visual/visual_server_wrap_mt.cpp
+++ b/servers/visual/visual_server_wrap_mt.cpp
@@ -107,16 +107,16 @@ void VisualServerWrapMT::init() {
if (create_thread) {
- print_line("CREATING RENDER THREAD");
+ print_verbose("VisualServerWrapMT: Creating render thread");
OS::get_singleton()->release_rendering_thread();
if (create_thread) {
thread = Thread::create(_thread_callback, this);
- print_line("STARTING RENDER THREAD");
+ print_verbose("VisualServerWrapMT: Starting render thread");
}
while (!draw_thread_up) {
OS::get_singleton()->delay_usec(1000);
}
- print_line("DONE RENDER THREAD");
+ print_verbose("VisualServerWrapMT: Finished render thread");
} else {
visual_server->init();
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 9da3d857a6..9c8884fe84 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -494,7 +494,7 @@ changes are marked with `// -- GODOT --` comments.
## tinyexr
- Upstream: https://github.com/syoyo/tinyexr
-- Version: git (e385dad, 2018)
+- Version: git (2d5375f, 2018)
- License: BSD-3-Clause
Files extracted from upstream source:
diff --git a/thirdparty/cvtt/ConvectionKernels.cpp b/thirdparty/cvtt/ConvectionKernels.cpp
index 6661d8120d..8d379344e1 100644
--- a/thirdparty/cvtt/ConvectionKernels.cpp
+++ b/thirdparty/cvtt/ConvectionKernels.cpp
@@ -233,7 +233,7 @@ namespace cvtt
{
__m128 m_values[2];
- inline Float operator+(const Float& other) const
+ inline Float operator+(const Float &other) const
{
Float result;
result.m_values[0] = _mm_add_ps(m_values[0], other.m_values[0]);
@@ -281,7 +281,7 @@ namespace cvtt
return result;
}
- inline Float operator/(const Float& other) const
+ inline Float operator/(const Float &other) const
{
Float result;
result.m_values[0] = _mm_div_ps(m_values[0], other.m_values[0]);
@@ -302,14 +302,14 @@ namespace cvtt
{
__m128i m_value;
- inline Int16CompFlag operator&(const Int16CompFlag& other) const
+ inline Int16CompFlag operator&(const Int16CompFlag &other) const
{
Int16CompFlag result;
result.m_value = _mm_and_si128(m_value, other.m_value);
return result;
}
- inline Int16CompFlag operator|(const Int16CompFlag& other) const
+ inline Int16CompFlag operator|(const Int16CompFlag &other) const
{
Int16CompFlag result;
result.m_value = _mm_or_si128(m_value, other.m_value);
@@ -338,7 +338,7 @@ namespace cvtt
return result;
}
- static Float Select(FloatCompFlag flag, Float a, Float b)
+ static Float Select(const FloatCompFlag &flag, const Float &a, const Float &b)
{
Float result;
for (int i = 0; i < 2; i++)
@@ -347,7 +347,7 @@ namespace cvtt
}
template<int TSubtype>
- static VInt16<TSubtype> Select(Int16CompFlag flag, const VInt16<TSubtype> &a, const VInt16<TSubtype> &b)
+ static VInt16<TSubtype> Select(const Int16CompFlag &flag, const VInt16<TSubtype> &a, const VInt16<TSubtype> &b)
{
VInt16<TSubtype> result;
result.m_value = _mm_or_si128(_mm_and_si128(flag.m_value, a.m_value), _mm_andnot_si128(flag.m_value, b.m_value));
@@ -355,7 +355,7 @@ namespace cvtt
}
template<int TSubtype>
- static VInt16<TSubtype> SelectOrZero(Int16CompFlag flag, const VInt16<TSubtype> &a)
+ static VInt16<TSubtype> SelectOrZero(const Int16CompFlag &flag, const VInt16<TSubtype> &a)
{
VInt16<TSubtype> result;
result.m_value = _mm_and_si128(flag.m_value, a.m_value);
@@ -363,12 +363,12 @@ namespace cvtt
}
template<int TSubtype>
- static void ConditionalSet(VInt16<TSubtype>& dest, Int16CompFlag flag, const VInt16<TSubtype> src)
+ static void ConditionalSet(VInt16<TSubtype> &dest, const Int16CompFlag &flag, const VInt16<TSubtype> &src)
{
dest.m_value = _mm_or_si128(_mm_andnot_si128(flag.m_value, dest.m_value), _mm_and_si128(flag.m_value, src.m_value));
}
- static SInt16 ConditionalNegate(const Int16CompFlag &flag, const SInt16& v)
+ static SInt16 ConditionalNegate(const Int16CompFlag &flag, const SInt16 &v)
{
SInt16 result;
result.m_value = _mm_add_epi16(_mm_xor_si128(flag.m_value, v.m_value), _mm_srli_epi16(flag.m_value, 15));
@@ -376,18 +376,18 @@ namespace cvtt
}
template<int TSubtype>
- static void NotConditionalSet(VInt16<TSubtype>& dest, Int16CompFlag flag, const VInt16<TSubtype> src)
+ static void NotConditionalSet(VInt16<TSubtype> &dest, const Int16CompFlag &flag, const VInt16<TSubtype> &src)
{
dest.m_value = _mm_or_si128(_mm_and_si128(flag.m_value, dest.m_value), _mm_andnot_si128(flag.m_value, src.m_value));
}
- static void ConditionalSet(Float& dest, FloatCompFlag flag, const Float src)
+ static void ConditionalSet(Float &dest, const FloatCompFlag &flag, const Float &src)
{
for (int i = 0; i < 2; i++)
dest.m_values[i] = _mm_or_ps(_mm_andnot_ps(flag.m_values[i], dest.m_values[i]), _mm_and_ps(flag.m_values[i], src.m_values[i]));
}
- static void NotConditionalSet(Float& dest, FloatCompFlag flag, const Float src)
+ static void NotConditionalSet(Float &dest, const FloatCompFlag &flag, const Float &src)
{
for (int i = 0; i < 2; i++)
dest.m_values[i] = _mm_or_ps(_mm_and_ps(flag.m_values[i], dest.m_values[i]), _mm_andnot_ps(flag.m_values[i], src.m_values[i]));
@@ -443,7 +443,7 @@ namespace cvtt
return result;
}
- static Float Min(Float a, Float b)
+ static Float Min(const Float &a, const Float &b)
{
Float result;
for (int i = 0; i < 2; i++)
@@ -474,7 +474,7 @@ namespace cvtt
return result;
}
- static Float Max(Float a, Float b)
+ static Float Max(const Float &a, const Float &b)
{
Float result;
for (int i = 0; i < 2; i++)
@@ -482,7 +482,7 @@ namespace cvtt
return result;
}
- static Float Clamp(Float v, float min, float max)
+ static Float Clamp(const Float &v, float min, float max)
{
Float result;
for (int i = 0; i < 2; i++)
@@ -490,7 +490,7 @@ namespace cvtt
return result;
}
- static Float Reciprocal(Float v)
+ static Float Reciprocal(const Float &v)
{
Float result;
for (int i = 0; i < 2; i++)
@@ -498,7 +498,7 @@ namespace cvtt
return result;
}
- static void ConvertLDRInputs(const PixelBlockU8* inputBlocks, int pxOffset, int channel, UInt15& chOut)
+ static void ConvertLDRInputs(const PixelBlockU8* inputBlocks, int pxOffset, int channel, UInt15 &chOut)
{
int16_t values[8];
for (int i = 0; i < 8; i++)
@@ -507,7 +507,7 @@ namespace cvtt
chOut.m_value = _mm_set_epi16(values[7], values[6], values[5], values[4], values[3], values[2], values[1], values[0]);
}
- static void ConvertHDRInputs(const PixelBlockF16* inputBlocks, int pxOffset, int channel, SInt16& chOut)
+ static void ConvertHDRInputs(const PixelBlockF16* inputBlocks, int pxOffset, int channel, SInt16 &chOut)
{
int16_t values[8];
for (int i = 0; i < 8; i++)
@@ -648,7 +648,7 @@ namespace cvtt
return result;
}
- static FloatCompFlag LessOrEqual(Float a, Float b)
+ static FloatCompFlag LessOrEqual(const Float &a, const Float &b)
{
FloatCompFlag result;
for (int i = 0; i < 2; i++)
@@ -664,7 +664,7 @@ namespace cvtt
return result;
}
- static FloatCompFlag Equal(Float a, Float b)
+ static FloatCompFlag Equal(const Float &a, const Float &b)
{
FloatCompFlag result;
for (int i = 0; i < 2; i++)
@@ -776,7 +776,7 @@ namespace cvtt
return result;
}
- static UInt16 RoundAndConvertToU16(Float v, const void* /*roundingMode*/)
+ static UInt16 RoundAndConvertToU16(const Float &v, const void* /*roundingMode*/)
{
__m128i lo = _mm_cvtps_epi32(_mm_add_ps(v.m_values[0], _mm_set1_ps(-32768)));
__m128i hi = _mm_cvtps_epi32(_mm_add_ps(v.m_values[1], _mm_set1_ps(-32768)));
@@ -788,7 +788,7 @@ namespace cvtt
return result;
}
- static UInt15 RoundAndConvertToU15(Float v, const void* /*roundingMode*/)
+ static UInt15 RoundAndConvertToU15(const Float &v, const void* /*roundingMode*/)
{
__m128i lo = _mm_cvtps_epi32(v.m_values[0]);
__m128i hi = _mm_cvtps_epi32(v.m_values[1]);
@@ -800,7 +800,7 @@ namespace cvtt
return result;
}
- static SInt16 RoundAndConvertToS16(Float v, const void* /*roundingMode*/)
+ static SInt16 RoundAndConvertToS16(const Float &v, const void* /*roundingMode*/)
{
__m128i lo = _mm_cvtps_epi32(v.m_values[0]);
__m128i hi = _mm_cvtps_epi32(v.m_values[1]);
@@ -812,7 +812,7 @@ namespace cvtt
return result;
}
- static Float Sqrt(Float f)
+ static Float Sqrt(const Float &f)
{
Float result;
for (int i = 0; i < 2; i++)
@@ -1071,22 +1071,22 @@ namespace cvtt
return XMultiply(b, a);
}
- static bool AnySet(Int16CompFlag v)
+ static bool AnySet(const Int16CompFlag &v)
{
return _mm_movemask_epi8(v.m_value) != 0;
}
- static bool AllSet(Int16CompFlag v)
+ static bool AllSet(const Int16CompFlag &v)
{
return _mm_movemask_epi8(v.m_value) == 0xffff;
}
- static bool AnySet(FloatCompFlag v)
+ static bool AnySet(const FloatCompFlag &v)
{
return _mm_movemask_ps(v.m_values[0]) != 0 || _mm_movemask_ps(v.m_values[1]) != 0;
}
- static bool AllSet(FloatCompFlag v)
+ static bool AllSet(const FloatCompFlag &v)
{
return _mm_movemask_ps(v.m_values[0]) == 0xf && _mm_movemask_ps(v.m_values[1]) == 0xf;
}
@@ -1420,6 +1420,16 @@ namespace cvtt
return v;
}
+ static bool MakeBoolInt16(bool b)
+ {
+ return b;
+ }
+
+ static bool MakeBoolFloat(bool b)
+ {
+ return b;
+ }
+
static bool AndNot(bool a, bool b)
{
return a && !b;
@@ -2562,7 +2572,7 @@ namespace cvtt
}
};
- void ComputeTweakFactors2(int tweak, int range, float* outFactors)
+ void ComputeTweakFactors(int tweak, int range, float *outFactors)
{
int totalUnits = range - 1;
int minOutsideUnits = ((tweak >> 1) & 1);
@@ -2573,7 +2583,7 @@ namespace cvtt
outFactors[1] = static_cast<float>(maxOutsideUnits) / static_cast<float>(insideUnits) + 1.0f;
}
- ParallelMath::Float ScaleHDRValue(ParallelMath::Float v, bool isSigned)
+ ParallelMath::Float ScaleHDRValue(const ParallelMath::Float &v, bool isSigned)
{
if (isSigned)
{
@@ -2591,7 +2601,7 @@ namespace cvtt
assert(ParallelMath::Extract(v, i) != -32768)
#endif
- ParallelMath::Int16CompFlag negative = ParallelMath::Less(v, ParallelMath::MakeSInt16(0));
+ ParallelMath::Int16CompFlag negative = ParallelMath::Less(v, ParallelMath::MakeSInt16(0));
ParallelMath::UInt15 absComp = ParallelMath::LosslessCast<ParallelMath::UInt15>::Cast(ParallelMath::Select(negative, ParallelMath::SInt16(ParallelMath::MakeSInt16(0) - v), v));
ParallelMath::UInt31 multiplied = ParallelMath::XMultiply(absComp, ParallelMath::MakeUInt15(31));
@@ -2635,7 +2645,7 @@ namespace cvtt
{
}
- UnfinishedEndpoints(const MFloat base[TVectorSize], const MFloat offset[TVectorSize])
+ UnfinishedEndpoints(const MFloat *base, const MFloat *offset)
{
for (int ch = 0; ch < TVectorSize; ch++)
m_base[ch] = base[ch];
@@ -2651,10 +2661,10 @@ namespace cvtt
m_offset[ch] = other.m_offset[ch];
}
- void FinishHDRUnsigned(int tweak, int range, MSInt16* outEP0, MSInt16* outEP1, ParallelMath::RoundTowardNearestForScope* roundingMode)
+ void FinishHDRUnsigned(int tweak, int range, MSInt16 *outEP0, MSInt16 *outEP1, ParallelMath::RoundTowardNearestForScope *roundingMode)
{
float tweakFactors[2];
- ComputeTweakFactors2(tweak, range, tweakFactors);
+ ComputeTweakFactors(tweak, range, tweakFactors);
for (int ch = 0; ch < TVectorSize; ch++)
{
@@ -2673,7 +2683,7 @@ namespace cvtt
void FinishHDRSigned(int tweak, int range, MSInt16* outEP0, MSInt16* outEP1, ParallelMath::RoundTowardNearestForScope* roundingMode)
{
float tweakFactors[2];
- ComputeTweakFactors2(tweak, range, tweakFactors);
+ ComputeTweakFactors(tweak, range, tweakFactors);
for (int ch = 0; ch < TVectorSize; ch++)
{
@@ -2694,7 +2704,7 @@ namespace cvtt
ParallelMath::RoundTowardNearestForScope roundingMode;
float tweakFactors[2];
- ComputeTweakFactors2(tweak, range, tweakFactors);
+ ComputeTweakFactors(tweak, range, tweakFactors);
for (int ch = 0; ch < TVectorSize; ch++)
{
@@ -2752,7 +2762,7 @@ namespace cvtt
m_values[i] = ParallelMath::MakeFloatZero();
}
- void Add(const ParallelMath::Float vec[TMatrixSize], ParallelMath::Float weight)
+ void Add(const ParallelMath::Float *vec, const ParallelMath::Float &weight)
{
int index = 0;
for (int row = 0; row < TMatrixSize; row++)
@@ -2765,7 +2775,7 @@ namespace cvtt
}
}
- void Product(MFloat outVec[TMatrixSize], const MFloat inVec[TMatrixSize])
+ void Product(MFloat *outVec, const MFloat *inVec)
{
for (int row = 0; row < TMatrixSize; row++)
{
@@ -2809,7 +2819,7 @@ namespace cvtt
m_maxDist = ParallelMath::MakeFloat(-FLT_MAX);
}
- void ContributePass(const MFloat value[TVectorSize], int pass, MFloat weight)
+ void ContributePass(const MFloat *value, int pass, const MFloat &weight)
{
if (pass == 0)
ContributeCentroid(value, weight);
@@ -2849,7 +2859,7 @@ namespace cvtt
}
private:
- void ContributeCentroid(const MFloat value[TVectorSize], MFloat weight)
+ void ContributeCentroid(const MFloat *value, const MFloat &weight)
{
for (int ch = 0; ch < TVectorSize; ch++)
m_centroid[ch] = m_centroid[ch] + value[ch] * weight;
@@ -2865,7 +2875,7 @@ namespace cvtt
m_centroid[ch] = m_centroid[ch] / denom;
}
- void ContributeDirection(const MFloat value[TVectorSize], MFloat weight)
+ void ContributeDirection(const MFloat *value, const MFloat &weight)
{
MFloat diff[TVectorSize];
for (int ch = 0; ch < TVectorSize; ch++)
@@ -2908,7 +2918,7 @@ namespace cvtt
m_direction[ch] = approx[ch] / approxLen;
}
- void ContributeMinMax(const MFloat value[TVectorSize])
+ void ContributeMinMax(const MFloat *value)
{
MFloat dist = ParallelMath::MakeFloatZero();
for (int ch = 0; ch < TVectorSize; ch++)
@@ -2961,7 +2971,7 @@ namespace cvtt
typedef ParallelMath::UInt31 MUInt31;
template<class TInterpolationEPType, class TColorEPType>
- void Init(const float channelWeights[TVectorSize], const TInterpolationEPType interpolationEndPoints[2][TVectorSize], const TColorEPType colorSpaceEndpoints[2][TVectorSize], int range)
+ void Init(const float *channelWeights, const TInterpolationEPType interpolationEndPoints[2][TVectorSize], const TColorEPType colorSpaceEndpoints[2][TVectorSize], int range)
{
// In BC6H, the interpolation endpoints are higher-precision than the endpoints in color space.
// We need to select indexes using the color-space endpoints.
@@ -3184,7 +3194,7 @@ namespace cvtt
ReconstructHDRUnsignedUninverted(InvertSingle(index), pixel);
}
- void ConditionalInvert(ParallelMath::Int16CompFlag invert)
+ void ConditionalInvert(const ParallelMath::Int16CompFlag &invert)
{
m_isInverted = invert;
}
@@ -3268,7 +3278,7 @@ namespace cvtt
m_wu = 0;
}
- void ContributePW(const MFloat *pwFloatPixel, const MUInt15 &index, MFloat weight)
+ void ContributePW(const MFloat *pwFloatPixel, const MUInt15 &index, const MFloat &weight)
{
MFloat t = ParallelMath::ToFloat(index) * m_rcpMaxIndex;
@@ -3555,7 +3565,7 @@ namespace cvtt
ParallelMath::RoundTowardNearestForScope roundingMode;
float tf[2];
- ComputeTweakFactors2(tweak, range, tf);
+ ComputeTweakFactors(tweak, range, tf);
MFloat base = ParallelMath::ToFloat(original[0]);
MFloat offs = ParallelMath::ToFloat(original[1]) - base;
@@ -5390,7 +5400,7 @@ namespace cvtt
else if (numRefineRounds > MaxRefineRounds)
numRefineRounds = MaxRefineRounds;
- bool fastIndexing = (flags & cvtt::Flags::BC6H_FastIndexing);
+ bool fastIndexing = ((flags & cvtt::Flags::BC6H_FastIndexing) != 0);
float channelWeightsSq[3];
ParallelMath::RoundTowardNearestForScope rtn;
@@ -6550,7 +6560,7 @@ namespace cvtt
}
}
- static void TestCounts(uint32_t flags, const int *counts, int nCounts, MUInt15 numElements, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], const MFloat preWeightedPixels[16][4], bool alphaTest,
+ static void TestCounts(uint32_t flags, const int *counts, int nCounts, const MUInt15 &numElements, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], const MFloat preWeightedPixels[16][4], bool alphaTest,
const MFloat floatSortedInputs[16][4], const MFloat preWeightedFloatSortedInputs[16][4], const float *channelWeights, MFloat &bestError, MUInt15 bestEndpoints[2][3], MUInt15 bestIndexes[16], MUInt15 &bestRange,
const ParallelMath::RoundTowardNearestForScope* rtn)
{
diff --git a/thirdparty/tinyexr/tinyexr.h b/thirdparty/tinyexr/tinyexr.h
index 107c22ffb3..990c8ee142 100644
--- a/thirdparty/tinyexr/tinyexr.h
+++ b/thirdparty/tinyexr/tinyexr.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2014 - 2017, Syoyo Fujita
+Copyright (c) 2014 - 2018, Syoyo Fujita and many contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -115,6 +115,7 @@ extern "C" {
#define TINYEXR_ERROR_CANT_OPEN_FILE (-6)
#define TINYEXR_ERROR_UNSUPPORTED_FORMAT (-7)
#define TINYEXR_ERROR_INVALID_HEADER (-8)
+#define TINYEXR_ERROR_UNSUPPORTED_FEATURE (-9)
// @note { OpenEXR file format: http://www.openexr.com/openexrfilelayout.pdf }
@@ -123,7 +124,8 @@ extern "C" {
#define TINYEXR_PIXELTYPE_HALF (1)
#define TINYEXR_PIXELTYPE_FLOAT (2)
-#define TINYEXR_MAX_ATTRIBUTES (128)
+#define TINYEXR_MAX_HEADER_ATTRIBUTES (1024)
+#define TINYEXR_MAX_CUSTOM_ATTRIBUTES (128)
#define TINYEXR_COMPRESSIONTYPE_NONE (0)
#define TINYEXR_COMPRESSIONTYPE_RLE (1)
@@ -205,7 +207,8 @@ typedef struct _EXRHeader {
// Custom attributes(exludes required attributes(e.g. `channels`,
// `compression`, etc)
int num_custom_attributes;
- EXRAttribute custom_attributes[TINYEXR_MAX_ATTRIBUTES];
+ EXRAttribute *custom_attributes; // array of EXRAttribute. size =
+ // `num_custom_attributes`.
EXRChannelInfo *channels; // [num_channels]
@@ -292,6 +295,9 @@ extern int FreeEXRHeader(EXRHeader *exr_header);
// Free's internal data of EXRImage struct
extern int FreeEXRImage(EXRImage *exr_image);
+// Free's error message
+extern void FreeEXRErrorMessage(const char *msg);
+
// Parse EXR version header of a file.
extern int ParseEXRVersionFromFile(EXRVersion *version, const char *filename);
@@ -300,10 +306,14 @@ extern int ParseEXRVersionFromMemory(EXRVersion *version,
const unsigned char *memory, size_t size);
// Parse single-part OpenEXR header from a file and initialize `EXRHeader`.
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int ParseEXRHeaderFromFile(EXRHeader *header, const EXRVersion *version,
const char *filename, const char **err);
// Parse single-part OpenEXR header from a memory and initialize `EXRHeader`.
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int ParseEXRHeaderFromMemory(EXRHeader *header,
const EXRVersion *version,
const unsigned char *memory, size_t size,
@@ -311,6 +321,8 @@ extern int ParseEXRHeaderFromMemory(EXRHeader *header,
// Parse multi-part OpenEXR headers from a file and initialize `EXRHeader*`
// array.
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int ParseEXRMultipartHeaderFromFile(EXRHeader ***headers,
int *num_headers,
const EXRVersion *version,
@@ -319,6 +331,8 @@ extern int ParseEXRMultipartHeaderFromFile(EXRHeader ***headers,
// Parse multi-part OpenEXR headers from a memory and initialize `EXRHeader*`
// array
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int ParseEXRMultipartHeaderFromMemory(EXRHeader ***headers,
int *num_headers,
const EXRVersion *version,
@@ -330,6 +344,8 @@ extern int ParseEXRMultipartHeaderFromMemory(EXRHeader ***headers,
// Application can free EXRImage using `FreeEXRImage`
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int LoadEXRImageFromFile(EXRImage *image, const EXRHeader *header,
const char *filename, const char **err);
@@ -339,6 +355,8 @@ extern int LoadEXRImageFromFile(EXRImage *image, const EXRHeader *header,
// Application can free EXRImage using `FreeEXRImage`
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int LoadEXRImageFromMemory(EXRImage *image, const EXRHeader *header,
const unsigned char *memory,
const size_t size, const char **err);
@@ -349,6 +367,8 @@ extern int LoadEXRImageFromMemory(EXRImage *image, const EXRHeader *header,
// Application can free EXRImage using `FreeEXRImage`
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int LoadEXRMultipartImageFromFile(EXRImage *images,
const EXRHeader **headers,
unsigned int num_parts,
@@ -361,6 +381,8 @@ extern int LoadEXRMultipartImageFromFile(EXRImage *images,
// Application can free EXRImage using `FreeEXRImage`
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int LoadEXRMultipartImageFromMemory(EXRImage *images,
const EXRHeader **headers,
unsigned int num_parts,
@@ -370,6 +392,8 @@ extern int LoadEXRMultipartImageFromMemory(EXRImage *images,
// Saves multi-channel, single-frame OpenEXR image to a file.
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int SaveEXRImageToFile(const EXRImage *image,
const EXRHeader *exr_header, const char *filename,
const char **err);
@@ -379,6 +403,8 @@ extern int SaveEXRImageToFile(const EXRImage *image,
// Return the number of bytes if succes.
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern size_t SaveEXRImageToMemory(const EXRImage *image,
const EXRHeader *exr_header,
unsigned char **memory, const char **err);
@@ -387,6 +413,8 @@ extern size_t SaveEXRImageToMemory(const EXRImage *image,
// Application must free memory of variables in DeepImage(image, offset_table)
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int LoadDeepEXR(DeepImage *out_image, const char *filename,
const char **err);
@@ -409,6 +437,8 @@ extern int LoadDeepEXR(DeepImage *out_image, const char *filename,
// RGB(A) channels.
// Returns negative value and may set error string in `err` when there's an
// error
+// When there was an error message, Application must free `err` with
+// FreeEXRErrorMessage()
extern int LoadEXRFromMemory(float **out_rgba, int *width, int *height,
const unsigned char *memory, size_t size,
const char **err);
@@ -428,8 +458,10 @@ extern int LoadEXRFromMemory(float **out_rgba, int *width, int *height,
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <iostream>
#include <sstream>
+#include <limits>
#include <string>
#include <vector>
@@ -486,6 +518,9 @@ namespace miniz {
#pragma clang diagnostic ignored "-Wc++11-extensions"
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wunused-function"
+#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+#pragma clang diagnostic ignored "-Wundef"
+
#if __has_warning("-Wcomma")
#pragma clang diagnostic ignored "-Wcomma"
#endif
@@ -495,6 +530,9 @@ namespace miniz {
#if __has_warning("-Wcast-qual")
#pragma clang diagnostic ignored "-Wcast-qual"
#endif
+#if __has_warning("-Wzero-as-null-pointer-constant")
+#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
+#endif
#endif
/* miniz.c v1.15 - public domain deflate/inflate, zlib-subset, ZIP
@@ -2480,10 +2518,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r,
tinfl_status status = TINFL_STATUS_FAILED;
mz_uint32 num_bits, dist, counter, num_extra;
tinfl_bit_buf_t bit_buf;
- const mz_uint8 *pIn_buf_cur = pIn_buf_next,
- *const pIn_buf_end = pIn_buf_next + *pIn_buf_size;
- mz_uint8 *pOut_buf_cur = pOut_buf_next,
- *const pOut_buf_end = pOut_buf_next + *pOut_buf_size;
+ const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end =
+ pIn_buf_next + *pIn_buf_size;
+ mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end =
+ pOut_buf_next + *pOut_buf_size;
size_t out_buf_size_mask =
(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)
? (size_t)-1
@@ -2955,9 +2993,8 @@ int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size,
tinfl_status status =
tinfl_decompress(&decomp, (const mz_uint8 *)pIn_buf + in_buf_ofs,
&in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size,
- (flags &
- ~(TINFL_FLAG_HAS_MORE_INPUT |
- TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)));
+ (flags & ~(TINFL_FLAG_HAS_MORE_INPUT |
+ TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)));
in_buf_ofs += in_buf_size;
if ((dst_buf_size) &&
(!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user)))
@@ -3082,7 +3119,9 @@ static const mz_uint8 s_tdefl_large_dist_extra[128] = {
// Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted
// values.
-typedef struct { mz_uint16 m_key, m_sym_index; } tdefl_sym_freq;
+typedef struct {
+ mz_uint16 m_key, m_sym_index;
+} tdefl_sym_freq;
static tdefl_sym_freq *tdefl_radix_sort_syms(mz_uint num_syms,
tdefl_sym_freq *pSyms0,
tdefl_sym_freq *pSyms1) {
@@ -3549,10 +3588,9 @@ static int tdefl_flush_block(tdefl_compressor *d, int flush) {
mz_uint saved_bit_buf, saved_bits_in;
mz_uint8 *pSaved_output_buf;
mz_bool comp_block_succeeded = MZ_FALSE;
- int n,
- use_raw_block =
- ((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) &&
- (d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size;
+ int n, use_raw_block =
+ ((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) &&
+ (d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size;
mz_uint8 *pOutput_buf_start =
((d->m_pPut_buf_func == NULL) &&
((*d->m_pOut_buf_size - d->m_out_buf_ofs) >= TDEFL_OUT_BUF_SIZE))
@@ -3582,9 +3620,8 @@ static int tdefl_flush_block(tdefl_compressor *d, int flush) {
if (!use_raw_block)
comp_block_succeeded =
- tdefl_compress_block(d,
- (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) ||
- (d->m_total_lz_bytes < 48));
+ tdefl_compress_block(d, (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) ||
+ (d->m_total_lz_bytes < 48));
// If the block gets expanded, forget the current contents of the output
// buffer and send a raw block instead.
@@ -4388,9 +4425,8 @@ mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits,
// C and C99, so no big deal)
#pragma warning(disable : 4244) // 'initializing': conversion from '__int64' to
// 'int', possible loss of data
-#pragma warning( \
- disable : 4267) // 'argument': conversion from '__int64' to 'int',
- // possible loss of data
+#pragma warning(disable : 4267) // 'argument': conversion from '__int64' to
+ // 'int', possible loss of data
#pragma warning(disable : 4996) // 'strdup': The POSIX name for this item is
// deprecated. Instead, use the ISO C and C++
// conformant name: _strdup.
@@ -6894,7 +6930,7 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename,
#ifdef _MSC_VER
#pragma warning(pop)
#endif
-}
+} // namespace miniz
#else
// Reuse MINIZ_LITTE_ENDIAN macro
@@ -6919,8 +6955,26 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename,
// return bint.c[0] == 1;
//}
+static void SetErrorMessage(const std::string &msg, const char **err) {
+ if (err) {
+#ifdef _WIN32
+ (*err) = _strdup(msg.c_str());
+#else
+ (*err) = strdup(msg.c_str());
+#endif
+ }
+}
+
static const int kEXRVersionSize = 8;
+static void cpy2(unsigned short *dst_val, const unsigned short *src_val) {
+ unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val);
+ const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val);
+
+ dst[0] = src[0];
+ dst[1] = src[1];
+}
+
static void swap2(unsigned short *val) {
#ifdef MINIZ_LITTLE_ENDIAN
(void)val;
@@ -6934,6 +6988,36 @@ static void swap2(unsigned short *val) {
#endif
}
+static void cpy4(int *dst_val, const int *src_val) {
+ unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val);
+ const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val);
+
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ dst[3] = src[3];
+}
+
+static void cpy4(unsigned int *dst_val, const unsigned int *src_val) {
+ unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val);
+ const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val);
+
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ dst[3] = src[3];
+}
+
+static void cpy4(float *dst_val, const float *src_val) {
+ unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val);
+ const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val);
+
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ dst[3] = src[3];
+}
+
static void swap4(unsigned int *val) {
#ifdef MINIZ_LITTLE_ENDIAN
(void)val;
@@ -6949,6 +7033,22 @@ static void swap4(unsigned int *val) {
#endif
}
+#if 0
+static void cpy8(tinyexr::tinyexr_uint64 *dst_val, const tinyexr::tinyexr_uint64 *src_val) {
+ unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val);
+ const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val);
+
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ dst[3] = src[3];
+ dst[4] = src[4];
+ dst[5] = src[5];
+ dst[6] = src[6];
+ dst[7] = src[7];
+}
+#endif
+
static void swap8(tinyexr::tinyexr_uint64 *val) {
#ifdef MINIZ_LITTLE_ENDIAN
(void)val;
@@ -7084,6 +7184,15 @@ static FP16 float_to_half_full(FP32 f) {
// #define IMF_B44_COMPRESSION 6
// #define IMF_B44A_COMPRESSION 7
+#ifdef __clang__
+#pragma clang diagnostic push
+
+#if __has_warning("-Wzero-as-null-pointer-constant")
+#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
+#endif
+
+#endif
+
static const char *ReadString(std::string *s, const char *ptr, size_t len) {
// Read untile NULL(\0).
const char *p = ptr;
@@ -7133,7 +7242,21 @@ static bool ReadAttribute(std::string *name, std::string *type,
tinyexr::swap4(reinterpret_cast<unsigned int *>(&data_len));
if (data_len == 0) {
- return false;
+ if ((*type).compare("string") == 0) {
+ // Accept empty string attribute.
+
+ marker += sizeof(uint32_t);
+ size -= sizeof(uint32_t);
+
+ *marker_size = name_len + 1 + type_len + 1 + sizeof(uint32_t);
+
+ data->resize(1);
+ (*data)[0] = '\0';
+
+ return true;
+ } else {
+ return false;
+ }
}
marker += sizeof(uint32_t);
@@ -7236,18 +7359,24 @@ static bool ReadChannelInfo(std::vector<ChannelInfo> &channels,
}
ChannelInfo info;
- tinyexr_int64 data_len = static_cast<tinyexr_int64>(data.size()) - (p - reinterpret_cast<const char *>(data.data()));
+ tinyexr_int64 data_len = static_cast<tinyexr_int64>(data.size()) -
+ (p - reinterpret_cast<const char *>(data.data()));
if (data_len < 0) {
return false;
}
- p = ReadString(
- &info.name, p, size_t(data_len));
+ p = ReadString(&info.name, p, size_t(data_len));
if ((p == NULL) && (info.name.empty())) {
// Buffer overrun. Issue #51.
return false;
}
+ const unsigned char *data_end =
+ reinterpret_cast<const unsigned char *>(p) + 16;
+ if (data_end >= (data.data() + data.size())) {
+ return false;
+ }
+
memcpy(&info.pixel_type, p, sizeof(int));
p += 4;
info.p_linear = static_cast<unsigned char>(p[0]); // uchar
@@ -7468,9 +7597,8 @@ static bool DecompressZip(unsigned char *dst,
// C and C99, so no big deal)
#pragma warning(disable : 4244) // 'initializing': conversion from '__int64' to
// 'int', possible loss of data
-#pragma warning( \
- disable : 4267) // 'argument': conversion from '__int64' to 'int',
- // possible loss of data
+#pragma warning(disable : 4267) // 'argument': conversion from '__int64' to
+ // 'int', possible loss of data
#pragma warning(disable : 4996) // 'strdup': The POSIX name for this item is
// deprecated. Instead, use the ISO C and C++
// conformant name: _strdup.
@@ -7705,6 +7833,7 @@ static void DecompressRle(unsigned char *dst,
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wc++11-extensions"
#pragma clang diagnostic ignored "-Wconversion"
+#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
#if __has_warning("-Wcast-qual")
#pragma clang diagnostic ignored "-Wcast-qual"
@@ -8187,8 +8316,8 @@ static void hufBuildEncTable(
// for all array entries.
//
- int hlink[HUF_ENCSIZE];
- long long *fHeap[HUF_ENCSIZE];
+ std::vector<int> hlink(HUF_ENCSIZE);
+ std::vector<long long *> fHeap(HUF_ENCSIZE);
*im = 0;
@@ -8247,8 +8376,8 @@ static void hufBuildEncTable(
std::make_heap(&fHeap[0], &fHeap[nf], FHeapCompare());
- long long scode[HUF_ENCSIZE];
- memset(scode, 0, sizeof(long long) * HUF_ENCSIZE);
+ std::vector<long long> scode(HUF_ENCSIZE);
+ memset(scode.data(), 0, sizeof(long long) * HUF_ENCSIZE);
while (nf > 1) {
//
@@ -8320,8 +8449,8 @@ static void hufBuildEncTable(
// code table from scode into frq.
//
- hufCanonicalCodeTable(scode);
- memcpy(frq, scode, sizeof(long long) * HUF_ENCSIZE);
+ hufCanonicalCodeTable(scode.data());
+ memcpy(frq, scode.data(), sizeof(long long) * HUF_ENCSIZE);
}
//
@@ -8657,26 +8786,62 @@ static int hufEncode // return: output size (in bits)
lc += 8; \
}
-#define getCode(po, rlc, c, lc, in, out, oe) \
- { \
- if (po == rlc) { \
- if (lc < 8) getChar(c, lc, in); \
- \
- lc -= 8; \
- \
- unsigned char cs = (c >> lc); \
- \
- if (out + cs > oe) return false; \
- \
- unsigned short s = out[-1]; \
- \
- while (cs-- > 0) *out++ = s; \
- } else if (out < oe) { \
- *out++ = po; \
- } else { \
- return false; \
- } \
+#if 0
+#define getCode(po, rlc, c, lc, in, out, ob, oe) \
+ { \
+ if (po == rlc) { \
+ if (lc < 8) getChar(c, lc, in); \
+ \
+ lc -= 8; \
+ \
+ unsigned char cs = (c >> lc); \
+ \
+ if (out + cs > oe) return false; \
+ \
+ /* TinyEXR issue 78 */ \
+ unsigned short s = out[-1]; \
+ \
+ while (cs-- > 0) *out++ = s; \
+ } else if (out < oe) { \
+ *out++ = po; \
+ } else { \
+ return false; \
+ } \
+ }
+#else
+static bool getCode(int po, int rlc, long long &c, int &lc, const char *&in,
+ const char *in_end, unsigned short *&out,
+ const unsigned short *ob, const unsigned short *oe) {
+ (void)ob;
+ if (po == rlc) {
+ if (lc < 8) {
+ /* TinyEXR issue 78 */
+ if ((in + 1) >= in_end) {
+ return false;
+ }
+
+ getChar(c, lc, in);
+ }
+
+ lc -= 8;
+
+ unsigned char cs = (c >> lc);
+
+ if (out + cs > oe) return false;
+
+ // Bounds check for safety
+ if ((out - 1) <= ob) return false;
+ unsigned short s = out[-1];
+
+ while (cs-- > 0) *out++ = s;
+ } else if (out < oe) {
+ *out++ = po;
+ } else {
+ return false;
}
+ return true;
+}
+#endif
//
// Decode (uncompress) ni bits based on encoding & decoding tables:
@@ -8692,8 +8857,8 @@ static bool hufDecode(const long long *hcode, // i : encoding table
{
long long c = 0;
int lc = 0;
- unsigned short *outb = out;
- unsigned short *oe = out + no;
+ unsigned short *outb = out; // begin
+ unsigned short *oe = out + no; // end
const char *ie = in + (ni + 7) / 8; // input byte size
//
@@ -8716,7 +8881,16 @@ static bool hufDecode(const long long *hcode, // i : encoding table
//
lc -= pl.len;
- getCode(pl.lit, rlc, c, lc, in, out, oe);
+ // std::cout << "lit = " << pl.lit << std::endl;
+ // std::cout << "rlc = " << rlc << std::endl;
+ // std::cout << "c = " << c << std::endl;
+ // std::cout << "lc = " << lc << std::endl;
+ // std::cout << "in = " << in << std::endl;
+ // std::cout << "out = " << out << std::endl;
+ // std::cout << "oe = " << oe << std::endl;
+ if (!getCode(pl.lit, rlc, c, lc, in, ie, out, outb, oe)) {
+ return false;
+ }
} else {
if (!pl.p) {
return false;
@@ -8743,7 +8917,9 @@ static bool hufDecode(const long long *hcode, // i : encoding table
//
lc -= l;
- getCode(pl.p[j], rlc, c, lc, in, out, oe);
+ if (!getCode(pl.p[j], rlc, c, lc, in, ie, out, outb, oe)) {
+ return false;
+ }
break;
}
}
@@ -8770,7 +8946,9 @@ static bool hufDecode(const long long *hcode, // i : encoding table
if (pl.len) {
lc -= pl.len;
- getCode(pl.lit, rlc, c, lc, in, out, oe);
+ if (!getCode(pl.lit, rlc, c, lc, in, ie, out, outb, oe)) {
+ return false;
+ }
} else {
return false;
// invalidCode(); // wrong (long) code
@@ -8785,7 +8963,7 @@ static bool hufDecode(const long long *hcode, // i : encoding table
return true;
}
-static void countFrequencies(long long freq[HUF_ENCSIZE],
+static void countFrequencies(std::vector<long long> &freq,
const unsigned short data[/*n*/], int n) {
for (int i = 0; i < HUF_ENCSIZE; ++i) freq[i] = 0;
@@ -8816,21 +8994,21 @@ static int hufCompress(const unsigned short raw[], int nRaw,
char compressed[]) {
if (nRaw == 0) return 0;
- long long freq[HUF_ENCSIZE];
+ std::vector<long long> freq(HUF_ENCSIZE);
countFrequencies(freq, raw, nRaw);
int im = 0;
int iM = 0;
- hufBuildEncTable(freq, &im, &iM);
+ hufBuildEncTable(freq.data(), &im, &iM);
char *tableStart = compressed + 20;
char *tableEnd = tableStart;
- hufPackEncTable(freq, im, iM, &tableEnd);
+ hufPackEncTable(freq.data(), im, iM, &tableEnd);
int tableLength = tableEnd - tableStart;
char *dataStart = tableEnd;
- int nBits = hufEncode(freq, raw, nRaw, iM, dataStart);
+ int nBits = hufEncode(freq.data(), raw, nRaw, iM, dataStart);
int data_length = (nBits + 7) / 8;
writeUInt(compressed, im);
@@ -8843,9 +9021,9 @@ static int hufCompress(const unsigned short raw[], int nRaw,
}
static bool hufUncompress(const char compressed[], int nCompressed,
- unsigned short raw[], int nRaw) {
+ std::vector<unsigned short> *raw) {
if (nCompressed == 0) {
- if (nRaw != 0) return false;
+ if (raw->size() != 0) return false;
return false;
}
@@ -8886,7 +9064,8 @@ static bool hufUncompress(const char compressed[], int nCompressed,
}
hufBuildDecTable(&freq.at(0), im, iM, &hdec.at(0));
- hufDecode(&freq.at(0), &hdec.at(0), ptr, nBits, iM, nRaw, raw);
+ hufDecode(&freq.at(0), &hdec.at(0), ptr, nBits, iM, raw->size(),
+ raw->data());
}
// catch (...)
//{
@@ -8975,7 +9154,7 @@ static bool CompressPiz(unsigned char *outPtr, unsigned int *outSize,
const unsigned char *inPtr, size_t inSize,
const std::vector<ChannelInfo> &channelInfo,
int data_width, int num_lines) {
- unsigned char bitmap[BITMAP_SIZE];
+ std::vector<unsigned char> bitmap(BITMAP_SIZE);
unsigned short minNonZero;
unsigned short maxNonZero;
@@ -9026,12 +9205,12 @@ static bool CompressPiz(unsigned char *outPtr, unsigned int *outSize,
}
}
- bitmapFromData(&tmpBuffer.at(0), static_cast<int>(tmpBuffer.size()), bitmap,
- minNonZero, maxNonZero);
+ bitmapFromData(&tmpBuffer.at(0), static_cast<int>(tmpBuffer.size()),
+ bitmap.data(), minNonZero, maxNonZero);
- unsigned short lut[USHORT_RANGE];
- unsigned short maxValue = forwardLutFromBitmap(bitmap, lut);
- applyLut(lut, &tmpBuffer.at(0), static_cast<int>(tmpBuffer.size()));
+ std::vector<unsigned short> lut(USHORT_RANGE);
+ unsigned short maxValue = forwardLutFromBitmap(bitmap.data(), lut.data());
+ applyLut(lut.data(), &tmpBuffer.at(0), static_cast<int>(tmpBuffer.size()));
//
// Store range compression info in _outBuffer
@@ -9101,7 +9280,7 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr,
return true;
}
- unsigned char bitmap[BITMAP_SIZE];
+ std::vector<unsigned char> bitmap(BITMAP_SIZE);
unsigned short minNonZero;
unsigned short maxNonZero;
@@ -9111,11 +9290,13 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr,
return false;
#endif
- memset(bitmap, 0, BITMAP_SIZE);
+ memset(bitmap.data(), 0, BITMAP_SIZE);
const unsigned char *ptr = inPtr;
- minNonZero = *(reinterpret_cast<const unsigned short *>(ptr));
- maxNonZero = *(reinterpret_cast<const unsigned short *>(ptr + 2));
+ // minNonZero = *(reinterpret_cast<const unsigned short *>(ptr));
+ tinyexr::cpy2(&minNonZero, reinterpret_cast<const unsigned short *>(ptr));
+ // maxNonZero = *(reinterpret_cast<const unsigned short *>(ptr + 2));
+ tinyexr::cpy2(&maxNonZero, reinterpret_cast<const unsigned short *>(ptr + 2));
ptr += 4;
if (maxNonZero >= BITMAP_SIZE) {
@@ -9128,9 +9309,9 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr,
ptr += maxNonZero - minNonZero + 1;
}
- unsigned short lut[USHORT_RANGE];
- memset(lut, 0, sizeof(unsigned short) * USHORT_RANGE);
- unsigned short maxValue = reverseLutFromBitmap(bitmap, lut);
+ std::vector<unsigned short> lut(USHORT_RANGE);
+ memset(lut.data(), 0, sizeof(unsigned short) * USHORT_RANGE);
+ unsigned short maxValue = reverseLutFromBitmap(bitmap.data(), lut.data());
//
// Huffman decoding
@@ -9138,12 +9319,12 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr,
int length;
- length = *(reinterpret_cast<const int *>(ptr));
+ // length = *(reinterpret_cast<const int *>(ptr));
+ tinyexr::cpy4(&length, reinterpret_cast<const int *>(ptr));
ptr += sizeof(int);
std::vector<unsigned short> tmpBuffer(tmpBufSize);
- hufUncompress(reinterpret_cast<const char *>(ptr), length, &tmpBuffer.at(0),
- static_cast<int>(tmpBufSize));
+ hufUncompress(reinterpret_cast<const char *>(ptr), length, &tmpBuffer);
//
// Wavelet decoding
@@ -9184,7 +9365,7 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr,
// Expand the pixel data to their original range
//
- applyLut(lut, &tmpBuffer.at(0), static_cast<int>(tmpBufSize));
+ applyLut(lut.data(), &tmpBuffer.at(0), static_cast<int>(tmpBufSize));
for (int y = 0; y < num_lines; y++) {
for (size_t i = 0; i < channelData.size(); ++i) {
@@ -9409,6 +9590,7 @@ bool CompressZfp(std::vector<unsigned char> *outBuf, unsigned int *outSize,
// -----------------------------------------------------------------
//
+// TODO(syoyo): Refactor function arguments.
static bool DecodePixelData(/* out */ unsigned char **out_images,
const int *requested_pixel_types,
const unsigned char *data_ptr, size_t data_len,
@@ -9421,6 +9603,11 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
const std::vector<size_t> &channel_offset_list) {
if (compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { // PIZ
#if TINYEXR_USE_PIZ
+ if ((width == 0) || (num_lines == 0) || (pixel_data_size == 0)) {
+ // Invalid input #90
+ return false;
+ }
+
// Allocate original data size.
std::vector<unsigned char> outBuf(static_cast<size_t>(
static_cast<size_t>(width * num_lines) * pixel_data_size));
@@ -9452,7 +9639,10 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
FP16 hf;
- hf.u = line_ptr[u];
+ // hf.u = line_ptr[u];
+ // use `cpy` to avoid unaligned memory access when compiler's
+ // optimization is on.
+ tinyexr::cpy2(&(hf.u), line_ptr + u);
tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
@@ -9495,7 +9685,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +
channel_offset_list[c] * static_cast<size_t>(width)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- unsigned int val = line_ptr[u];
+ unsigned int val;
+ // val = line_ptr[u];
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(&val);
@@ -9521,7 +9713,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
v * pixel_data_size * static_cast<size_t>(x_stride) +
channel_offset_list[c] * static_cast<size_t>(x_stride)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- float val = line_ptr[u];
+ float val;
+ // val = line_ptr[u];
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
@@ -9557,9 +9751,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
unsigned long dstLen = static_cast<unsigned long>(outBuf.size());
assert(dstLen > 0);
- if (!tinyexr::DecompressZip(reinterpret_cast<unsigned char *>(&outBuf.at(0)),
- &dstLen, data_ptr,
- static_cast<unsigned long>(data_len))) {
+ if (!tinyexr::DecompressZip(
+ reinterpret_cast<unsigned char *>(&outBuf.at(0)), &dstLen, data_ptr,
+ static_cast<unsigned long>(data_len))) {
return false;
}
@@ -9583,7 +9777,8 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
tinyexr::FP16 hf;
- hf.u = line_ptr[u];
+ // hf.u = line_ptr[u];
+ tinyexr::cpy2(&(hf.u), line_ptr + u);
tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
@@ -9626,7 +9821,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +
channel_offset_list[c] * static_cast<size_t>(width)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- unsigned int val = line_ptr[u];
+ unsigned int val;
+ // val = line_ptr[u];
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(&val);
@@ -9652,7 +9849,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +
channel_offset_list[c] * static_cast<size_t>(width)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- float val = line_ptr[u];
+ float val;
+ // val = line_ptr[u];
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
@@ -9707,7 +9906,8 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
tinyexr::FP16 hf;
- hf.u = line_ptr[u];
+ // hf.u = line_ptr[u];
+ tinyexr::cpy2(&(hf.u), line_ptr + u);
tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
@@ -9750,7 +9950,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +
channel_offset_list[c] * static_cast<size_t>(width)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- unsigned int val = line_ptr[u];
+ unsigned int val;
+ // val = line_ptr[u];
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(&val);
@@ -9776,7 +9978,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +
channel_offset_list[c] * static_cast<size_t>(width)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- float val = line_ptr[u];
+ float val;
+ // val = line_ptr[u];
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
@@ -9839,7 +10043,8 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +
channel_offset_list[c] * static_cast<size_t>(width)));
for (size_t u = 0; u < static_cast<size_t>(width); u++) {
- float val = line_ptr[u];
+ float val;
+ tinyexr::cpy4(&val, line_ptr + u);
tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
@@ -9871,88 +10076,116 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
#endif
} else if (compression_type == TINYEXR_COMPRESSIONTYPE_NONE) {
for (size_t c = 0; c < num_channels; c++) {
- if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) {
- const unsigned short *line_ptr =
- reinterpret_cast<const unsigned short *>(
- data_ptr +
- c * static_cast<size_t>(width) * sizeof(unsigned short));
-
- if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) {
- unsigned short *outLine =
- reinterpret_cast<unsigned short *>(out_images[c]);
- if (line_order == 0) {
- outLine += y * x_stride;
- } else {
- outLine += (height - 1 - y) * x_stride;
- }
+ for (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {
+ if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) {
+ const unsigned short *line_ptr =
+ reinterpret_cast<const unsigned short *>(
+ data_ptr + v * pixel_data_size * size_t(width) +
+ channel_offset_list[c] * static_cast<size_t>(width));
+
+ if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) {
+ unsigned short *outLine =
+ reinterpret_cast<unsigned short *>(out_images[c]);
+ if (line_order == 0) {
+ outLine += (y + v) * x_stride;
+ } else {
+ outLine += (height - 1 - (y + v)) * x_stride;
+ }
- for (int u = 0; u < width; u++) {
- tinyexr::FP16 hf;
+ for (int u = 0; u < width; u++) {
+ tinyexr::FP16 hf;
- hf.u = line_ptr[u];
+ // hf.u = line_ptr[u];
+ tinyexr::cpy2(&(hf.u), line_ptr + u);
- tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
+ tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
+
+ outLine[u] = hf.u;
+ }
+ } else if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) {
+ float *outLine = reinterpret_cast<float *>(out_images[c]);
+ if (line_order == 0) {
+ outLine += (y + v) * x_stride;
+ } else {
+ outLine += (height - 1 - (y + v)) * x_stride;
+ }
- outLine[u] = hf.u;
+ if (reinterpret_cast<const unsigned char *>(line_ptr + width) >
+ (data_ptr + data_len)) {
+ // Insufficient data size
+ return false;
+ }
+
+ for (int u = 0; u < width; u++) {
+ tinyexr::FP16 hf;
+
+ // address may not be aliged. use byte-wise copy for safety.#76
+ // hf.u = line_ptr[u];
+ tinyexr::cpy2(&(hf.u), line_ptr + u);
+
+ tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
+
+ tinyexr::FP32 f32 = half_to_float(hf);
+
+ outLine[u] = f32.f;
+ }
+ } else {
+ assert(0);
+ return false;
}
- } else if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) {
+ } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {
+ const float *line_ptr = reinterpret_cast<const float *>(
+ data_ptr + v * pixel_data_size * size_t(width) +
+ channel_offset_list[c] * static_cast<size_t>(width));
+
float *outLine = reinterpret_cast<float *>(out_images[c]);
if (line_order == 0) {
- outLine += y * x_stride;
+ outLine += (y + v) * x_stride;
} else {
- outLine += (height - 1 - y) * x_stride;
+ outLine += (height - 1 - (y + v)) * x_stride;
}
- for (int u = 0; u < width; u++) {
- tinyexr::FP16 hf;
-
- hf.u = line_ptr[u];
-
- tinyexr::swap2(reinterpret_cast<unsigned short *>(&hf.u));
-
- tinyexr::FP32 f32 = half_to_float(hf);
-
- outLine[u] = f32.f;
+ if (reinterpret_cast<const unsigned char *>(line_ptr + width) >
+ (data_ptr + data_len)) {
+ // Insufficient data size
+ return false;
}
- } else {
- assert(0);
- return false;
- }
- } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {
- const float *line_ptr = reinterpret_cast<const float *>(
- data_ptr + c * static_cast<size_t>(width) * sizeof(float));
- float *outLine = reinterpret_cast<float *>(out_images[c]);
- if (line_order == 0) {
- outLine += y * x_stride;
- } else {
- outLine += (height - 1 - y) * x_stride;
- }
+ for (int u = 0; u < width; u++) {
+ float val;
+ tinyexr::cpy4(&val, line_ptr + u);
- for (int u = 0; u < width; u++) {
- float val = line_ptr[u];
+ tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
- tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
+ outLine[u] = val;
+ }
+ } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {
+ const unsigned int *line_ptr = reinterpret_cast<const unsigned int *>(
+ data_ptr + v * pixel_data_size * size_t(width) +
+ channel_offset_list[c] * static_cast<size_t>(width));
- outLine[u] = val;
- }
- } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {
- const unsigned int *line_ptr = reinterpret_cast<const unsigned int *>(
- data_ptr + c * static_cast<size_t>(width) * sizeof(unsigned int));
+ unsigned int *outLine =
+ reinterpret_cast<unsigned int *>(out_images[c]);
+ if (line_order == 0) {
+ outLine += (y + v) * x_stride;
+ } else {
+ outLine += (height - 1 - (y + v)) * x_stride;
+ }
- unsigned int *outLine = reinterpret_cast<unsigned int *>(out_images[c]);
- if (line_order == 0) {
- outLine += y * x_stride;
- } else {
- outLine += (height - 1 - y) * x_stride;
- }
+ for (int u = 0; u < width; u++) {
+ if (reinterpret_cast<const unsigned char *>(line_ptr + u) >=
+ (data_ptr + data_len)) {
+ // Corrupsed data?
+ return false;
+ }
- for (int u = 0; u < width; u++) {
- unsigned int val = line_ptr[u];
+ unsigned int val;
+ tinyexr::cpy4(&val, line_ptr + u);
- tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
+ tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
- outLine[u] = val;
+ outLine[u] = val;
+ }
}
}
}
@@ -9994,7 +10227,7 @@ static void DecodeTiledPixelData(
num_channels, channels, channel_offset_list);
}
-static void ComputeChannelLayout(std::vector<size_t> *channel_offset_list,
+static bool ComputeChannelLayout(std::vector<size_t> *channel_offset_list,
int *pixel_data_size, size_t *channel_offset,
int num_channels,
const EXRChannelInfo *channels) {
@@ -10015,9 +10248,11 @@ static void ComputeChannelLayout(std::vector<size_t> *channel_offset_list,
(*pixel_data_size) += sizeof(unsigned int);
(*channel_offset) += sizeof(unsigned int);
} else {
- assert(0);
+ // ???
+ return false;
}
}
+ return true;
}
static unsigned char **AllocateImage(int num_channels,
@@ -10125,8 +10360,11 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,
// Read attributes
size_t orig_size = size;
- for (;;) {
+ for (size_t nattr = 0; nattr < TINYEXR_MAX_HEADER_ATTRIBUTES; nattr++) {
if (0 == size) {
+ if (err) {
+ (*err) += "Insufficient data size for attributes.\n";
+ }
return TINYEXR_ERROR_INVALID_DATA;
} else if (marker[0] == '\0') {
size--;
@@ -10139,6 +10377,9 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,
size_t marker_size;
if (!tinyexr::ReadAttribute(&attr_name, &attr_type, &data, &marker_size,
marker, size)) {
+ if (err) {
+ (*err) += "Failed to read attribute.\n";
+ }
return TINYEXR_ERROR_INVALID_DATA;
}
marker += marker_size;
@@ -10209,14 +10450,14 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,
if (!ReadChannelInfo(info->channels, data)) {
if (err) {
- (*err) = "Failed to parse channel info.";
+ (*err) += "Failed to parse channel info.\n";
}
return TINYEXR_ERROR_INVALID_DATA;
}
if (info->channels.size() < 1) {
if (err) {
- (*err) = "# of channels is zero.";
+ (*err) += "# of channels is zero.\n";
}
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -10224,9 +10465,7 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,
has_channels = true;
} else if (attr_name.compare("dataWindow") == 0) {
- if (data.size() < 16) {
- // Corrupsed file(Issue #50).
- } else {
+ if (data.size() >= 16) {
memcpy(&info->data_window[0], &data.at(0), sizeof(int));
memcpy(&info->data_window[1], &data.at(4), sizeof(int));
memcpy(&info->data_window[2], &data.at(8), sizeof(int));
@@ -10238,48 +10477,60 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,
has_data_window = true;
}
} else if (attr_name.compare("displayWindow") == 0) {
- memcpy(&info->display_window[0], &data.at(0), sizeof(int));
- memcpy(&info->display_window[1], &data.at(4), sizeof(int));
- memcpy(&info->display_window[2], &data.at(8), sizeof(int));
- memcpy(&info->display_window[3], &data.at(12), sizeof(int));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->display_window[0]));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->display_window[1]));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->display_window[2]));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->display_window[3]));
-
- has_display_window = true;
+ if (data.size() >= 16) {
+ memcpy(&info->display_window[0], &data.at(0), sizeof(int));
+ memcpy(&info->display_window[1], &data.at(4), sizeof(int));
+ memcpy(&info->display_window[2], &data.at(8), sizeof(int));
+ memcpy(&info->display_window[3], &data.at(12), sizeof(int));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->display_window[0]));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->display_window[1]));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->display_window[2]));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->display_window[3]));
+
+ has_display_window = true;
+ }
} else if (attr_name.compare("lineOrder") == 0) {
- info->line_order = static_cast<int>(data[0]);
- has_line_order = true;
+ if (data.size() >= 1) {
+ info->line_order = static_cast<int>(data[0]);
+ has_line_order = true;
+ }
} else if (attr_name.compare("pixelAspectRatio") == 0) {
- memcpy(&info->pixel_aspect_ratio, &data.at(0), sizeof(float));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->pixel_aspect_ratio));
- has_pixel_aspect_ratio = true;
+ if (data.size() >= sizeof(float)) {
+ memcpy(&info->pixel_aspect_ratio, &data.at(0), sizeof(float));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->pixel_aspect_ratio));
+ has_pixel_aspect_ratio = true;
+ }
} else if (attr_name.compare("screenWindowCenter") == 0) {
- memcpy(&info->screen_window_center[0], &data.at(0), sizeof(float));
- memcpy(&info->screen_window_center[1], &data.at(4), sizeof(float));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->screen_window_center[0]));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->screen_window_center[1]));
- has_screen_window_center = true;
+ if (data.size() >= 8) {
+ memcpy(&info->screen_window_center[0], &data.at(0), sizeof(float));
+ memcpy(&info->screen_window_center[1], &data.at(4), sizeof(float));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->screen_window_center[0]));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->screen_window_center[1]));
+ has_screen_window_center = true;
+ }
} else if (attr_name.compare("screenWindowWidth") == 0) {
- memcpy(&info->screen_window_width, &data.at(0), sizeof(float));
- tinyexr::swap4(
- reinterpret_cast<unsigned int *>(&info->screen_window_width));
+ if (data.size() >= sizeof(float)) {
+ memcpy(&info->screen_window_width, &data.at(0), sizeof(float));
+ tinyexr::swap4(
+ reinterpret_cast<unsigned int *>(&info->screen_window_width));
- has_screen_window_width = true;
+ has_screen_window_width = true;
+ }
} else if (attr_name.compare("chunkCount") == 0) {
- memcpy(&info->chunk_count, &data.at(0), sizeof(int));
- tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->chunk_count));
+ if (data.size() >= sizeof(int)) {
+ memcpy(&info->chunk_count, &data.at(0), sizeof(int));
+ tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->chunk_count));
+ }
} else {
- // Custom attribute(up to TINYEXR_MAX_ATTRIBUTES)
- if (info->attributes.size() < TINYEXR_MAX_ATTRIBUTES) {
+ // Custom attribute(up to TINYEXR_MAX_CUSTOM_ATTRIBUTES)
+ if (info->attributes.size() < TINYEXR_MAX_CUSTOM_ATTRIBUTES) {
EXRAttribute attrib;
#ifdef _MSC_VER
strncpy_s(attrib.name, attr_name.c_str(), 255);
@@ -10409,15 +10660,30 @@ static void ConvertHeader(EXRHeader *exr_header, const HeaderInfo &info) {
exr_header->requested_pixel_types[c] = info.channels[c].pixel_type;
}
- assert(info.attributes.size() < TINYEXR_MAX_ATTRIBUTES);
exr_header->num_custom_attributes = static_cast<int>(info.attributes.size());
- for (size_t i = 0; i < info.attributes.size(); i++) {
- memcpy(exr_header->custom_attributes[i].name, info.attributes[i].name, 256);
- memcpy(exr_header->custom_attributes[i].type, info.attributes[i].type, 256);
- exr_header->custom_attributes[i].size = info.attributes[i].size;
- // Just copy poiner
- exr_header->custom_attributes[i].value = info.attributes[i].value;
+ if (exr_header->num_custom_attributes > 0) {
+ // TODO(syoyo): Report warning when # of attributes exceeds
+ // `TINYEXR_MAX_CUSTOM_ATTRIBUTES`
+ if (exr_header->num_custom_attributes > TINYEXR_MAX_CUSTOM_ATTRIBUTES) {
+ exr_header->num_custom_attributes = TINYEXR_MAX_CUSTOM_ATTRIBUTES;
+ }
+
+ exr_header->custom_attributes = static_cast<EXRAttribute *>(malloc(
+ sizeof(EXRAttribute) * size_t(exr_header->num_custom_attributes)));
+
+ for (size_t i = 0; i < info.attributes.size(); i++) {
+ memcpy(exr_header->custom_attributes[i].name, info.attributes[i].name,
+ 256);
+ memcpy(exr_header->custom_attributes[i].type, info.attributes[i].type,
+ 256);
+ exr_header->custom_attributes[i].size = info.attributes[i].size;
+ // Just copy poiner
+ exr_header->custom_attributes[i].value = info.attributes[i].value;
+ }
+
+ } else {
+ exr_header->custom_attributes = NULL;
}
exr_header->header_len = info.header_len;
@@ -10425,7 +10691,8 @@ static void ConvertHeader(EXRHeader *exr_header, const HeaderInfo &info) {
static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,
const std::vector<tinyexr::tinyexr_uint64> &offsets,
- const unsigned char *head, const size_t size) {
+ const unsigned char *head, const size_t size,
+ std::string *err) {
int num_channels = exr_header->num_channels;
int num_scanline_blocks = 1;
@@ -10445,32 +10712,40 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,
std::vector<size_t> channel_offset_list;
int pixel_data_size = 0;
size_t channel_offset = 0;
- tinyexr::ComputeChannelLayout(&channel_offset_list, &pixel_data_size,
- &channel_offset, num_channels,
- exr_header->channels);
+ if (!tinyexr::ComputeChannelLayout(&channel_offset_list, &pixel_data_size,
+ &channel_offset, num_channels,
+ exr_header->channels)) {
+ if (err) {
+ (*err) += "Failed to compute channel layout.\n";
+ }
+ return TINYEXR_ERROR_INVALID_DATA;
+ }
- bool invalid_data = false;
+ bool invalid_data = false; // TODO(LTE): Use atomic lock for MT safety.
if (exr_header->tiled) {
size_t num_tiles = offsets.size(); // = # of blocks
exr_image->tiles = static_cast<EXRTile *>(
- malloc(sizeof(EXRTile) * static_cast<size_t>(num_tiles)));
+ calloc(sizeof(EXRTile), static_cast<size_t>(num_tiles)));
for (size_t tile_idx = 0; tile_idx < num_tiles; tile_idx++) {
// Allocate memory for each tile.
exr_image->tiles[tile_idx].images = tinyexr::AllocateImage(
num_channels, exr_header->channels, exr_header->requested_pixel_types,
- data_width, data_height);
+ exr_header->tile_size_x, exr_header->tile_size_y);
// 16 byte: tile coordinates
// 4 byte : data size
// ~ : data(uncompressed or compressed)
if (offsets[tile_idx] + sizeof(int) * 5 > size) {
+ if (err) {
+ (*err) += "Insufficient data size.\n";
+ }
return TINYEXR_ERROR_INVALID_DATA;
}
- size_t data_size = size - (offsets[tile_idx] + sizeof(int) * 5);
+ size_t data_size = size_t(size - (offsets[tile_idx] + sizeof(int) * 5));
const unsigned char *data_ptr =
reinterpret_cast<const unsigned char *>(head + offsets[tile_idx]);
@@ -10482,8 +10757,12 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,
tinyexr::swap4(reinterpret_cast<unsigned int *>(&tile_coordinates[3]));
// @todo{ LoD }
- assert(tile_coordinates[2] == 0);
- assert(tile_coordinates[3] == 0);
+ if (tile_coordinates[2] != 0) {
+ return TINYEXR_ERROR_UNSUPPORTED_FEATURE;
+ }
+ if (tile_coordinates[3] != 0) {
+ return TINYEXR_ERROR_UNSUPPORTED_FEATURE;
+ }
int data_len;
memcpy(&data_len, data_ptr + 16,
@@ -10491,6 +10770,9 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,
tinyexr::swap4(reinterpret_cast<unsigned int *>(&data_len));
if (data_len < 4 || size_t(data_len) > data_size) {
+ if (err) {
+ (*err) += "Insufficient data length.\n";
+ }
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -10531,56 +10813,56 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,
size_t y_idx = static_cast<size_t>(y);
if (offsets[y_idx] + sizeof(int) * 2 > size) {
- return TINYEXR_ERROR_INVALID_DATA;
- }
-
- // 4 byte: scan line
- // 4 byte: data size
- // ~ : pixel data(uncompressed or compressed)
- size_t data_size = size - (offsets[y_idx] + sizeof(int) * 2);
- const unsigned char *data_ptr =
- reinterpret_cast<const unsigned char *>(head + offsets[y_idx]);
-
- int line_no;
- memcpy(&line_no, data_ptr, sizeof(int));
- int data_len;
- memcpy(&data_len, data_ptr + 4, sizeof(int));
- tinyexr::swap4(reinterpret_cast<unsigned int *>(&line_no));
- tinyexr::swap4(reinterpret_cast<unsigned int *>(&data_len));
-
- if (size_t(data_len) > data_size) {
- return TINYEXR_ERROR_INVALID_DATA;
- }
-
- int end_line_no = (std::min)(line_no + num_scanline_blocks,
- (exr_header->data_window[3] + 1));
-
- int num_lines = end_line_no - line_no;
- //assert(num_lines > 0);
-
- if (num_lines <= 0) {
invalid_data = true;
} else {
-
- // Move to data addr: 8 = 4 + 4;
- data_ptr += 8;
-
- // Adjust line_no with data_window.bmin.y
- line_no -= exr_header->data_window[1];
-
- if (line_no < 0) {
+ // 4 byte: scan line
+ // 4 byte: data size
+ // ~ : pixel data(uncompressed or compressed)
+ size_t data_size = size_t(size - (offsets[y_idx] + sizeof(int) * 2));
+ const unsigned char *data_ptr =
+ reinterpret_cast<const unsigned char *>(head + offsets[y_idx]);
+
+ int line_no;
+ memcpy(&line_no, data_ptr, sizeof(int));
+ int data_len;
+ memcpy(&data_len, data_ptr + 4, sizeof(int));
+ tinyexr::swap4(reinterpret_cast<unsigned int *>(&line_no));
+ tinyexr::swap4(reinterpret_cast<unsigned int *>(&data_len));
+
+ if (size_t(data_len) > data_size) {
invalid_data = true;
} else {
- if (!tinyexr::DecodePixelData(
- exr_image->images, exr_header->requested_pixel_types, data_ptr,
- static_cast<size_t>(data_len), exr_header->compression_type,
- exr_header->line_order, data_width, data_height, data_width, y,
- line_no, num_lines, static_cast<size_t>(pixel_data_size),
- static_cast<size_t>(exr_header->num_custom_attributes),
- exr_header->custom_attributes,
- static_cast<size_t>(exr_header->num_channels), exr_header->channels,
- channel_offset_list)) {
+ int end_line_no = (std::min)(line_no + num_scanline_blocks,
+ (exr_header->data_window[3] + 1));
+
+ int num_lines = end_line_no - line_no;
+ // assert(num_lines > 0);
+
+ if (num_lines <= 0) {
invalid_data = true;
+ } else {
+ // Move to data addr: 8 = 4 + 4;
+ data_ptr += 8;
+
+ // Adjust line_no with data_window.bmin.y
+ line_no -= exr_header->data_window[1];
+
+ if (line_no < 0) {
+ invalid_data = true;
+ } else {
+ if (!tinyexr::DecodePixelData(
+ exr_image->images, exr_header->requested_pixel_types,
+ data_ptr, static_cast<size_t>(data_len),
+ exr_header->compression_type, exr_header->line_order,
+ data_width, data_height, data_width, y, line_no,
+ num_lines, static_cast<size_t>(pixel_data_size),
+ static_cast<size_t>(exr_header->num_custom_attributes),
+ exr_header->custom_attributes,
+ static_cast<size_t>(exr_header->num_channels),
+ exr_header->channels, channel_offset_list)) {
+ invalid_data = true;
+ }
+ }
}
}
}
@@ -10648,9 +10930,7 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header,
const char **err) {
if (exr_image == NULL || exr_header == NULL || head == NULL ||
marker == NULL || (size <= tinyexr::kEXRVersionSize)) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for DecodeEXRImage().", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -10663,13 +10943,23 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header,
num_scanline_blocks = 16;
}
- int data_width = exr_header->data_window[2] - exr_header->data_window[0] + 1;
- int data_height = exr_header->data_window[3] - exr_header->data_window[1] + 1;
+ int data_width = exr_header->data_window[2] - exr_header->data_window[0];
+ if (data_width >= std::numeric_limits<int>::max()) {
+ // Issue 63
+ tinyexr::SetErrorMessage("Invalid data window value", err);
+ return TINYEXR_ERROR_INVALID_DATA;
+ }
+ data_width++;
+
+ int data_height = exr_header->data_window[3] - exr_header->data_window[1];
+ if (data_height >= std::numeric_limits<int>::max()) {
+ tinyexr::SetErrorMessage("Invalid data height value", err);
+ return TINYEXR_ERROR_INVALID_DATA;
+ }
+ data_height++;
if ((data_width < 0) || (data_height < 0)) {
- if (err) {
- (*err) = "Invalid data window value.";
- }
+ tinyexr::SetErrorMessage("data window or data height is negative.", err);
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -10708,12 +10998,16 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header,
for (size_t y = 0; y < num_blocks; y++) {
tinyexr::tinyexr_uint64 offset;
+ // Issue #81
+ if ((marker + sizeof(tinyexr_uint64)) >= (head + size)) {
+ tinyexr::SetErrorMessage("Insufficient data size in offset table.", err);
+ return TINYEXR_ERROR_INVALID_DATA;
+ }
+
memcpy(&offset, marker, sizeof(tinyexr::tinyexr_uint64));
tinyexr::swap8(&offset);
if (offset >= size) {
- if (err) {
- (*err) = "Invalid offset value.";
- }
+ tinyexr::SetErrorMessage("Invalid offset value in DecodeEXRImage.", err);
return TINYEXR_ERROR_INVALID_DATA;
}
marker += sizeof(tinyexr::tinyexr_uint64); // = 8
@@ -10736,15 +11030,37 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header,
// OK
break;
} else {
- if (err) {
- (*err) = "Cannot reconstruct lineOffset table.";
- }
+ tinyexr::SetErrorMessage(
+ "Cannot reconstruct lineOffset table in DecodeEXRImage.", err);
return TINYEXR_ERROR_INVALID_DATA;
}
}
}
- return DecodeChunk(exr_image, exr_header, offsets, head, size);
+ {
+ std::string e;
+ int ret = DecodeChunk(exr_image, exr_header, offsets, head, size, &e);
+
+ if (ret != TINYEXR_SUCCESS) {
+ if (!e.empty()) {
+ tinyexr::SetErrorMessage(e, err);
+ }
+
+ // release memory(if exists)
+ if ((exr_header->num_channels > 0) && exr_image && exr_image->images) {
+ for (size_t c = 0; c < size_t(exr_header->num_channels); c++) {
+ if (exr_image->images[c]) {
+ free(exr_image->images[c]);
+ exr_image->images[c] = NULL;
+ }
+ }
+ free(exr_image->images);
+ exr_image->images = NULL;
+ }
+ }
+
+ return ret;
+ }
}
} // namespace tinyexr
@@ -10752,9 +11068,7 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header,
int LoadEXR(float **out_rgba, int *width, int *height, const char *filename,
const char **err) {
if (out_rgba == NULL) {
- if (err) {
- (*err) = "Invalid argument.\n";
- }
+ tinyexr::SetErrorMessage("Invalid argument for LoadEXR()", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -10767,13 +11081,14 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename,
{
int ret = ParseEXRVersionFromFile(&exr_version, filename);
if (ret != TINYEXR_SUCCESS) {
+ tinyexr::SetErrorMessage("Invalid EXR header.", err);
return ret;
}
if (exr_version.multipart || exr_version.non_image) {
- if (err) {
- (*err) = "Loading multipart or DeepImage is not supported yet.\n";
- }
+ tinyexr::SetErrorMessage(
+ "Loading multipart or DeepImage is not supported in LoadEXR() API",
+ err);
return TINYEXR_ERROR_INVALID_DATA; // @fixme.
}
}
@@ -10781,6 +11096,7 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename,
{
int ret = ParseEXRHeaderFromFile(&exr_header, &exr_version, filename, err);
if (ret != TINYEXR_SUCCESS) {
+ FreeEXRHeader(&exr_header);
return ret;
}
}
@@ -10795,6 +11111,7 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename,
{
int ret = LoadEXRImageFromFile(&exr_image, &exr_header, filename, err);
if (ret != TINYEXR_SUCCESS) {
+ FreeEXRHeader(&exr_header);
return ret;
}
}
@@ -10819,6 +11136,9 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename,
if ((idxA == 0) && (idxR == -1) && (idxG == -1) && (idxB == -1)) {
// Alpha channel only.
+ if (exr_header.tiled) {
+ // todo.implement this
+ }
(*out_rgba) = reinterpret_cast<float *>(
malloc(4 * sizeof(float) * static_cast<size_t>(exr_image.width) *
static_cast<size_t>(exr_image.height)));
@@ -10833,45 +11153,77 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename,
// Assume RGB(A)
if (idxR == -1) {
- if (err) {
- (*err) = "R channel not found\n";
- }
+ tinyexr::SetErrorMessage("R channel not found", err);
// @todo { free exr_image }
+ FreeEXRHeader(&exr_header);
return TINYEXR_ERROR_INVALID_DATA;
}
if (idxG == -1) {
- if (err) {
- (*err) = "G channel not found\n";
- }
+ tinyexr::SetErrorMessage("G channel not found", err);
// @todo { free exr_image }
+ FreeEXRHeader(&exr_header);
return TINYEXR_ERROR_INVALID_DATA;
}
if (idxB == -1) {
- if (err) {
- (*err) = "B channel not found\n";
- }
+ tinyexr::SetErrorMessage("B channel not found", err);
// @todo { free exr_image }
+ FreeEXRHeader(&exr_header);
return TINYEXR_ERROR_INVALID_DATA;
}
(*out_rgba) = reinterpret_cast<float *>(
malloc(4 * sizeof(float) * static_cast<size_t>(exr_image.width) *
static_cast<size_t>(exr_image.height)));
- for (int i = 0; i < exr_image.width * exr_image.height; i++) {
- (*out_rgba)[4 * i + 0] =
- reinterpret_cast<float **>(exr_image.images)[idxR][i];
- (*out_rgba)[4 * i + 1] =
- reinterpret_cast<float **>(exr_image.images)[idxG][i];
- (*out_rgba)[4 * i + 2] =
- reinterpret_cast<float **>(exr_image.images)[idxB][i];
- if (idxA != -1) {
- (*out_rgba)[4 * i + 3] =
- reinterpret_cast<float **>(exr_image.images)[idxA][i];
- } else {
- (*out_rgba)[4 * i + 3] = 1.0;
+ if (exr_header.tiled) {
+ for (int it = 0; it < exr_image.num_tiles; it++) {
+ for (int j = 0; j < exr_header.tile_size_y; j++)
+ for (int i = 0; i < exr_header.tile_size_x; i++) {
+ const int ii =
+ exr_image.tiles[it].offset_x * exr_header.tile_size_x + i;
+ const int jj =
+ exr_image.tiles[it].offset_y * exr_header.tile_size_y + j;
+ const int idx = ii + jj * exr_image.width;
+
+ // out of region check.
+ if (ii >= exr_image.width) {
+ continue;
+ }
+ if (jj >= exr_image.height) {
+ continue;
+ }
+ const int srcIdx = i + j * exr_header.tile_size_x;
+ unsigned char **src = exr_image.tiles[it].images;
+ (*out_rgba)[4 * idx + 0] =
+ reinterpret_cast<float **>(src)[idxR][srcIdx];
+ (*out_rgba)[4 * idx + 1] =
+ reinterpret_cast<float **>(src)[idxG][srcIdx];
+ (*out_rgba)[4 * idx + 2] =
+ reinterpret_cast<float **>(src)[idxB][srcIdx];
+ if (idxA != -1) {
+ (*out_rgba)[4 * idx + 3] =
+ reinterpret_cast<float **>(src)[idxA][srcIdx];
+ } else {
+ (*out_rgba)[4 * idx + 3] = 1.0;
+ }
+ }
+ }
+ } else {
+ for (int i = 0; i < exr_image.width * exr_image.height; i++) {
+ (*out_rgba)[4 * i + 0] =
+ reinterpret_cast<float **>(exr_image.images)[idxR][i];
+ (*out_rgba)[4 * i + 1] =
+ reinterpret_cast<float **>(exr_image.images)[idxG][i];
+ (*out_rgba)[4 * i + 2] =
+ reinterpret_cast<float **>(exr_image.images)[idxB][i];
+ if (idxA != -1) {
+ (*out_rgba)[4 * i + 3] =
+ reinterpret_cast<float **>(exr_image.images)[idxA][i];
+ } else {
+ (*out_rgba)[4 * i + 3] = 1.0;
+ }
}
}
}
@@ -10889,15 +11241,17 @@ int ParseEXRHeaderFromMemory(EXRHeader *exr_header, const EXRVersion *version,
const unsigned char *memory, size_t size,
const char **err) {
if (memory == NULL || exr_header == NULL) {
- if (err) {
- (*err) = "Invalid argument.\n";
- }
+ tinyexr::SetErrorMessage(
+ "Invalid argument. `memory` or `exr_header` argument is null in "
+ "ParseEXRHeaderFromMemory()",
+ err);
// Invalid argument
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
if (size < tinyexr::kEXRVersionSize) {
+ tinyexr::SetErrorMessage("Insufficient header/data size.\n", err);
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -10912,11 +11266,7 @@ int ParseEXRHeaderFromMemory(EXRHeader *exr_header, const EXRVersion *version,
if (ret != TINYEXR_SUCCESS) {
if (err && !err_str.empty()) {
-#ifdef _WIN32
- (*err) = _strdup(err_str.c_str()); // May leak
-#else
- (*err) = strdup(err_str.c_str()); // May leak
-#endif
+ tinyexr::SetErrorMessage(err_str, err);
}
}
@@ -10932,9 +11282,7 @@ int LoadEXRFromMemory(float **out_rgba, int *width, int *height,
const unsigned char *memory, size_t size,
const char **err) {
if (out_rgba == NULL || memory == NULL) {
- if (err) {
- (*err) = "Invalid argument.\n";
- }
+ tinyexr::SetErrorMessage("Invalid argument for LoadEXRFromMemory", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -10946,6 +11294,7 @@ int LoadEXRFromMemory(float **out_rgba, int *width, int *height,
int ret = ParseEXRVersionFromMemory(&exr_version, memory, size);
if (ret != TINYEXR_SUCCESS) {
+ tinyexr::SetErrorMessage("Failed to parse EXR version", err);
return ret;
}
@@ -10985,26 +11334,20 @@ int LoadEXRFromMemory(float **out_rgba, int *width, int *height,
}
if (idxR == -1) {
- if (err) {
- (*err) = "R channel not found\n";
- }
+ tinyexr::SetErrorMessage("R channel not found", err);
// @todo { free exr_image }
return TINYEXR_ERROR_INVALID_DATA;
}
if (idxG == -1) {
- if (err) {
- (*err) = "G channel not found\n";
- }
+ tinyexr::SetErrorMessage("G channel not found", err);
// @todo { free exr_image }
return TINYEXR_ERROR_INVALID_DATA;
}
if (idxB == -1) {
- if (err) {
- (*err) = "B channel not found\n";
- }
+ tinyexr::SetErrorMessage("B channel not found", err);
// @todo { free exr_image }
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -11040,9 +11383,7 @@ int LoadEXRFromMemory(float **out_rgba, int *width, int *height,
int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,
const char *filename, const char **err) {
if (exr_image == NULL) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for LoadEXRImageFromFile", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -11053,9 +11394,7 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,
FILE *fp = fopen(filename, "rb");
#endif
if (!fp) {
- if (err) {
- (*err) = "Cannot read file.";
- }
+ tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
@@ -11065,6 +11404,12 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,
filesize = static_cast<size_t>(ftell(fp));
fseek(fp, 0, SEEK_SET);
+ if (filesize < 16) {
+ tinyexr::SetErrorMessage("File size too short " + std::string(filename),
+ err);
+ return TINYEXR_ERROR_INVALID_FILE;
+ }
+
std::vector<unsigned char> buf(filesize); // @todo { use mmap }
{
size_t ret;
@@ -11083,16 +11428,13 @@ int LoadEXRImageFromMemory(EXRImage *exr_image, const EXRHeader *exr_header,
const char **err) {
if (exr_image == NULL || memory == NULL ||
(size < tinyexr::kEXRVersionSize)) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for LoadEXRImageFromMemory",
+ err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
if (exr_header->header_len == 0) {
- if (err) {
- (*err) = "EXRHeader is not initialized.";
- }
+ tinyexr::SetErrorMessage("EXRHeader variable is not initialized.", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -11109,26 +11451,22 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
unsigned char **memory_out, const char **err) {
if (exr_image == NULL || memory_out == NULL ||
exr_header->compression_type < 0) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for SaveEXRImageToMemory", err);
return 0; // @fixme
}
#if !TINYEXR_USE_PIZ
if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) {
- if (err) {
- (*err) = "PIZ compression is not supported in this build.";
- }
+ tinyexr::SetErrorMessage("PIZ compression is not supported in this build",
+ err);
return 0;
}
#endif
#if !TINYEXR_USE_ZFP
if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) {
- if (err) {
- (*err) = "ZFP compression is not supported in this build.";
- }
+ tinyexr::SetErrorMessage("ZFP compression is not supported in this build",
+ err);
return 0;
}
#endif
@@ -11136,9 +11474,8 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
#if TINYEXR_USE_ZFP
for (size_t i = 0; i < static_cast<size_t>(exr_header->num_channels); i++) {
if (exr_header->requested_pixel_types[i] != TINYEXR_PIXELTYPE_FLOAT) {
- if (err) {
- (*err) = "Pixel type must be FLOAT for ZFP compression.";
- }
+ tinyexr::SetErrorMessage("Pixel type must be FLOAT for ZFP compression",
+ err);
return 0;
}
}
@@ -11348,6 +11685,11 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_HALF) {
if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) {
for (int y = 0; y < h; y++) {
+ // Assume increasing Y
+ float *line_ptr = reinterpret_cast<float *>(&buf.at(
+ static_cast<size_t>(pixel_data_size * y * exr_image->width) +
+ channel_offset_list[c] *
+ static_cast<size_t>(exr_image->width)));
for (int x = 0; x < exr_image->width; x++) {
tinyexr::FP16 h16;
h16.u = reinterpret_cast<unsigned short **>(
@@ -11357,30 +11699,27 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
tinyexr::swap4(reinterpret_cast<unsigned int *>(&f32.f));
- // Assume increasing Y
- float *line_ptr = reinterpret_cast<float *>(&buf.at(
- static_cast<size_t>(pixel_data_size * y * exr_image->width) +
- channel_offset_list[c] *
- static_cast<size_t>(exr_image->width)));
- line_ptr[x] = f32.f;
+ // line_ptr[x] = f32.f;
+ tinyexr::cpy4(line_ptr + x, &(f32.f));
}
}
} else if (exr_header->requested_pixel_types[c] ==
TINYEXR_PIXELTYPE_HALF) {
for (int y = 0; y < h; y++) {
+ // Assume increasing Y
+ unsigned short *line_ptr = reinterpret_cast<unsigned short *>(
+ &buf.at(static_cast<size_t>(pixel_data_size * y *
+ exr_image->width) +
+ channel_offset_list[c] *
+ static_cast<size_t>(exr_image->width)));
for (int x = 0; x < exr_image->width; x++) {
unsigned short val = reinterpret_cast<unsigned short **>(
exr_image->images)[c][(y + start_y) * exr_image->width + x];
tinyexr::swap2(&val);
- // Assume increasing Y
- unsigned short *line_ptr = reinterpret_cast<unsigned short *>(
- &buf.at(static_cast<size_t>(pixel_data_size * y *
- exr_image->width) +
- channel_offset_list[c] *
- static_cast<size_t>(exr_image->width)));
- line_ptr[x] = val;
+ // line_ptr[x] = val;
+ tinyexr::cpy2(line_ptr + x, &val);
}
}
} else {
@@ -11390,6 +11729,12 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
} else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) {
if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) {
for (int y = 0; y < h; y++) {
+ // Assume increasing Y
+ unsigned short *line_ptr = reinterpret_cast<unsigned short *>(
+ &buf.at(static_cast<size_t>(pixel_data_size * y *
+ exr_image->width) +
+ channel_offset_list[c] *
+ static_cast<size_t>(exr_image->width)));
for (int x = 0; x < exr_image->width; x++) {
tinyexr::FP32 f32;
f32.f = reinterpret_cast<float **>(
@@ -11400,30 +11745,26 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
tinyexr::swap2(reinterpret_cast<unsigned short *>(&h16.u));
- // Assume increasing Y
- unsigned short *line_ptr = reinterpret_cast<unsigned short *>(
- &buf.at(static_cast<size_t>(pixel_data_size * y *
- exr_image->width) +
- channel_offset_list[c] *
- static_cast<size_t>(exr_image->width)));
- line_ptr[x] = h16.u;
+ // line_ptr[x] = h16.u;
+ tinyexr::cpy2(line_ptr + x, &(h16.u));
}
}
} else if (exr_header->requested_pixel_types[c] ==
TINYEXR_PIXELTYPE_FLOAT) {
for (int y = 0; y < h; y++) {
+ // Assume increasing Y
+ float *line_ptr = reinterpret_cast<float *>(&buf.at(
+ static_cast<size_t>(pixel_data_size * y * exr_image->width) +
+ channel_offset_list[c] *
+ static_cast<size_t>(exr_image->width)));
for (int x = 0; x < exr_image->width; x++) {
float val = reinterpret_cast<float **>(
exr_image->images)[c][(y + start_y) * exr_image->width + x];
tinyexr::swap4(reinterpret_cast<unsigned int *>(&val));
- // Assume increasing Y
- float *line_ptr = reinterpret_cast<float *>(&buf.at(
- static_cast<size_t>(pixel_data_size * y * exr_image->width) +
- channel_offset_list[c] *
- static_cast<size_t>(exr_image->width)));
- line_ptr[x] = val;
+ // line_ptr[x] = val;
+ tinyexr::cpy4(line_ptr + x, &val);
}
}
} else {
@@ -11431,18 +11772,18 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,
}
} else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_UINT) {
for (int y = 0; y < h; y++) {
+ // Assume increasing Y
+ unsigned int *line_ptr = reinterpret_cast<unsigned int *>(&buf.at(
+ static_cast<size_t>(pixel_data_size * y * exr_image->width) +
+ channel_offset_list[c] * static_cast<size_t>(exr_image->width)));
for (int x = 0; x < exr_image->width; x++) {
unsigned int val = reinterpret_cast<unsigned int **>(
exr_image->images)[c][(y + start_y) * exr_image->width + x];
tinyexr::swap4(&val);
- // Assume increasing Y
- unsigned int *line_ptr = reinterpret_cast<unsigned int *>(&buf.at(
- static_cast<size_t>(pixel_data_size * y * exr_image->width) +
- channel_offset_list[c] *
- static_cast<size_t>(exr_image->width)));
- line_ptr[x] = val;
+ // line_ptr[x] = val;
+ tinyexr::cpy4(line_ptr + x, &val);
}
}
}
@@ -11611,26 +11952,22 @@ int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header,
const char *filename, const char **err) {
if (exr_image == NULL || filename == NULL ||
exr_header->compression_type < 0) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for SaveEXRImageToFile", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#if !TINYEXR_USE_PIZ
if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) {
- if (err) {
- (*err) = "PIZ compression is not supported in this build.";
- }
+ tinyexr::SetErrorMessage("PIZ compression is not supported in this build",
+ err);
return 0;
}
#endif
#if !TINYEXR_USE_ZFP
if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) {
- if (err) {
- (*err) = "ZFP compression is not supported in this build.";
- }
+ tinyexr::SetErrorMessage("ZFP compression is not supported in this build",
+ err);
return 0;
}
#endif
@@ -11642,9 +11979,7 @@ int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header,
FILE *fp = fopen(filename, "wb");
#endif
if (!fp) {
- if (err) {
- (*err) = "Cannot write a file.";
- }
+ tinyexr::SetErrorMessage("Cannot write a file", err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
@@ -11663,27 +11998,23 @@ int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header,
int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
if (deep_image == NULL) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for LoadDeepEXR", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#ifdef _MSC_VER
FILE *fp = NULL;
errno_t errcode = fopen_s(&fp, filename, "rb");
- if ((!errcode) || (!fp)) {
- if (err) {
- (*err) = "Cannot read file.";
- }
+ if ((0 != errcode) || (!fp)) {
+ tinyexr::SetErrorMessage("Cannot read a file " + std::string(filename),
+ err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
#else
FILE *fp = fopen(filename, "rb");
if (!fp) {
- if (err) {
- (*err) = "Cannot read file.";
- }
+ tinyexr::SetErrorMessage("Cannot read a file " + std::string(filename),
+ err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
#endif
@@ -11696,9 +12027,8 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
if (filesize == 0) {
fclose(fp);
- if (err) {
- (*err) = "File size is zero.";
- }
+ tinyexr::SetErrorMessage("File size is zero : " + std::string(filename),
+ err);
return TINYEXR_ERROR_INVALID_FILE;
}
@@ -11719,9 +12049,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
const char header[] = {0x76, 0x2f, 0x31, 0x01};
if (memcmp(marker, header, 4) != 0) {
- if (err) {
- (*err) = "Invalid magic number.";
- }
+ tinyexr::SetErrorMessage("Invalid magic number", err);
return TINYEXR_ERROR_INVALID_MAGIC_NUMBER;
}
marker += 4;
@@ -11732,9 +12060,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
// ver 2.0, scanline, deep bit on(0x800)
// must be [2, 0, 0, 0]
if (marker[0] != 2 || marker[1] != 8 || marker[2] != 0 || marker[3] != 0) {
- if (err) {
- (*err) = "Unsupported version or scanline.";
- }
+ tinyexr::SetErrorMessage("Unsupported version or scanline", err);
return TINYEXR_ERROR_UNSUPPORTED_FORMAT;
}
@@ -11775,9 +12101,9 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
if (attr_name.compare("compression") == 0) {
compression_type = data[0];
if (compression_type > TINYEXR_COMPRESSIONTYPE_PIZ) {
- if (err) {
- (*err) = "Unsupported compression type.";
- }
+ std::stringstream ss;
+ ss << "Unsupported compression type : " << compression_type;
+ tinyexr::SetErrorMessage(ss.str(), err);
return TINYEXR_ERROR_UNSUPPORTED_FORMAT;
}
@@ -11794,18 +12120,14 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
// ySampling: int
if (!tinyexr::ReadChannelInfo(channels, data)) {
- if (err) {
- (*err) = "Failed to parse channel info.";
- }
+ tinyexr::SetErrorMessage("Failed to parse channel info", err);
return TINYEXR_ERROR_INVALID_DATA;
}
num_channels = static_cast<int>(channels.size());
if (num_channels < 1) {
- if (err) {
- (*err) = "Invalid channels format.";
- }
+ tinyexr::SetErrorMessage("Invalid channels format", err);
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -11877,9 +12199,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
#endif
// OK
} else {
- if (err) {
- (*err) = "Unsupported format.";
- }
+ tinyexr::SetErrorMessage("Unsupported compression format", err);
return TINYEXR_ERROR_UNSUPPORTED_FORMAT;
}
@@ -11936,8 +12256,9 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
unsigned long dstLen =
static_cast<unsigned long>(pixelOffsetTable.size() * sizeof(int));
if (!tinyexr::DecompressZip(
- reinterpret_cast<unsigned char *>(&pixelOffsetTable.at(0)), &dstLen,
- data_ptr + 28, static_cast<unsigned long>(packedOffsetTableSize))) {
+ reinterpret_cast<unsigned char *>(&pixelOffsetTable.at(0)),
+ &dstLen, data_ptr + 28,
+ static_cast<unsigned long>(packedOffsetTableSize))) {
return false;
}
@@ -11955,9 +12276,9 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
unsigned long dstLen = static_cast<unsigned long>(unpackedSampleDataSize);
if (dstLen) {
if (!tinyexr::DecompressZip(
- reinterpret_cast<unsigned char *>(&sample_data.at(0)), &dstLen,
- data_ptr + 28 + packedOffsetTableSize,
- static_cast<unsigned long>(packedSampleDataSize))) {
+ reinterpret_cast<unsigned char *>(&sample_data.at(0)), &dstLen,
+ data_ptr + 28 + packedOffsetTableSize,
+ static_cast<unsigned long>(packedSampleDataSize))) {
return false;
}
assert(dstLen == static_cast<unsigned long>(unpackedSampleDataSize));
@@ -12006,8 +12327,10 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
if (channels[c].pixel_type == 0) { // UINT
for (size_t x = 0; x < static_cast<size_t>(samples_per_line); x++) {
- unsigned int ui = *reinterpret_cast<unsigned int *>(
+ unsigned int ui;
+ unsigned int *src_ptr = reinterpret_cast<unsigned int *>(
&sample_data.at(size_t(data_offset) + x * sizeof(int)));
+ tinyexr::cpy4(&ui, src_ptr);
deep_image->image[c][y][x] = static_cast<float>(ui); // @fixme
}
data_offset +=
@@ -12015,16 +12338,19 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {
} else if (channels[c].pixel_type == 1) { // half
for (size_t x = 0; x < static_cast<size_t>(samples_per_line); x++) {
tinyexr::FP16 f16;
- f16.u = *reinterpret_cast<unsigned short *>(
+ const unsigned short *src_ptr = reinterpret_cast<unsigned short *>(
&sample_data.at(size_t(data_offset) + x * sizeof(short)));
+ tinyexr::cpy2(&(f16.u), src_ptr);
tinyexr::FP32 f32 = half_to_float(f16);
deep_image->image[c][y][x] = f32.f;
}
data_offset += sizeof(short) * static_cast<size_t>(samples_per_line);
} else { // float
for (size_t x = 0; x < static_cast<size_t>(samples_per_line); x++) {
- float f = *reinterpret_cast<float *>(
+ float f;
+ const float *src_ptr = reinterpret_cast<float *>(
&sample_data.at(size_t(data_offset) + x * sizeof(float)));
+ tinyexr::cpy4(&f, src_ptr);
deep_image->image[c][y][x] = f;
}
data_offset += sizeof(float) * static_cast<size_t>(samples_per_line);
@@ -12065,6 +12391,13 @@ void InitEXRImage(EXRImage *exr_image) {
exr_image->num_tiles = 0;
}
+void FreeEXRErrorMessage(const char *msg) {
+ if (msg) {
+ free(reinterpret_cast<void *>(const_cast<char *>(msg)));
+ }
+ return;
+}
+
void InitEXRHeader(EXRHeader *exr_header) {
if (exr_header == NULL) {
return;
@@ -12096,6 +12429,10 @@ int FreeEXRHeader(EXRHeader *exr_header) {
}
}
+ if (exr_header->custom_attributes) {
+ free(exr_header->custom_attributes);
+ }
+
return TINYEXR_SUCCESS;
}
@@ -12125,6 +12462,7 @@ int FreeEXRImage(EXRImage *exr_image) {
free(exr_image->tiles[tid].images);
}
}
+ free(exr_image->tiles);
}
return TINYEXR_SUCCESS;
@@ -12133,9 +12471,8 @@ int FreeEXRImage(EXRImage *exr_image) {
int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version,
const char *filename, const char **err) {
if (exr_header == NULL || exr_version == NULL || filename == NULL) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage("Invalid argument for ParseEXRHeaderFromFile",
+ err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -12146,9 +12483,7 @@ int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version,
FILE *fp = fopen(filename, "rb");
#endif
if (!fp) {
- if (err) {
- (*err) = "Cannot read file.";
- }
+ tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
@@ -12166,9 +12501,8 @@ int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version,
fclose(fp);
if (ret != filesize) {
- if (err) {
- (*err) = "fread error.";
- }
+ tinyexr::SetErrorMessage("fread() error on " + std::string(filename),
+ err);
return TINYEXR_ERROR_INVALID_FILE;
}
}
@@ -12185,10 +12519,13 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers,
if (memory == NULL || exr_headers == NULL || num_headers == NULL ||
exr_version == NULL) {
// Invalid argument
+ tinyexr::SetErrorMessage(
+ "Invalid argument for ParseEXRMultipartHeaderFromMemory", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
if (size < tinyexr::kEXRVersionSize) {
+ tinyexr::SetErrorMessage("Data size too short", err);
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -12207,13 +12544,7 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers,
marker, marker_size);
if (ret != TINYEXR_SUCCESS) {
- if (err) {
-#ifdef _WIN32
- (*err) = _strdup(err_str.c_str()); // may leak
-#else
- (*err) = strdup(err_str.c_str()); // may leak
-#endif
- }
+ tinyexr::SetErrorMessage(err_str, err);
return ret;
}
@@ -12224,9 +12555,8 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers,
// `chunkCount` must exist in the header.
if (info.chunk_count == 0) {
- if (err) {
- (*err) = "`chunkCount' attribute is not found in the header.";
- }
+ tinyexr::SetErrorMessage(
+ "`chunkCount' attribute is not found in the header.", err);
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -12261,9 +12591,8 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers,
const char *filename, const char **err) {
if (exr_headers == NULL || num_headers == NULL || exr_version == NULL ||
filename == NULL) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage(
+ "Invalid argument for ParseEXRMultipartHeaderFromFile()", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -12274,9 +12603,7 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers,
FILE *fp = fopen(filename, "rb");
#endif
if (!fp) {
- if (err) {
- (*err) = "Cannot read file.";
- }
+ tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
@@ -12294,9 +12621,7 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers,
fclose(fp);
if (ret != filesize) {
- if (err) {
- (*err) = "fread error.";
- }
+ tinyexr::SetErrorMessage("`fread' error. file may be corrupted.", err);
return TINYEXR_ERROR_INVALID_FILE;
}
}
@@ -12405,9 +12730,8 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images,
const size_t size, const char **err) {
if (exr_images == NULL || exr_headers == NULL || num_parts == 0 ||
memory == NULL || (size <= tinyexr::kEXRVersionSize)) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage(
+ "Invalid argument for LoadEXRMultipartImageFromMemory()", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -12415,9 +12739,7 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images,
size_t total_header_size = 0;
for (unsigned int i = 0; i < num_parts; i++) {
if (exr_headers[i]->header_len == 0) {
- if (err) {
- (*err) = "EXRHeader is not initialized.";
- }
+ tinyexr::SetErrorMessage("EXRHeader variable is not initialized.", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -12452,9 +12774,8 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images,
tinyexr::swap8(&offset);
if (offset >= size) {
- if (err) {
- (*err) = "Invalid offset size.";
- }
+ tinyexr::SetErrorMessage("Invalid offset size in EXR header chunks.",
+ err);
return TINYEXR_ERROR_INVALID_DATA;
}
@@ -12479,14 +12800,19 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images,
tinyexr::swap4(&part_no);
if (part_no != i) {
- assert(0);
+ tinyexr::SetErrorMessage("Invalid `part number' in EXR header chunks.",
+ err);
return TINYEXR_ERROR_INVALID_DATA;
}
}
+ std::string e;
int ret = tinyexr::DecodeChunk(&exr_images[i], exr_headers[i], offset_table,
- memory, size);
+ memory, size, &e);
if (ret != TINYEXR_SUCCESS) {
+ if (!e.empty()) {
+ tinyexr::SetErrorMessage(e, err);
+ }
return ret;
}
}
@@ -12499,9 +12825,8 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images,
unsigned int num_parts, const char *filename,
const char **err) {
if (exr_images == NULL || exr_headers == NULL || num_parts == 0) {
- if (err) {
- (*err) = "Invalid argument.";
- }
+ tinyexr::SetErrorMessage(
+ "Invalid argument for LoadEXRMultipartImageFromFile", err);
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
@@ -12512,9 +12837,7 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images,
FILE *fp = fopen(filename, "rb");
#endif
if (!fp) {
- if (err) {
- (*err) = "Cannot read file.";
- }
+ tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err);
return TINYEXR_ERROR_CANT_OPEN_FILE;
}
@@ -12670,5 +12993,10 @@ int SaveEXR(const float *data, int width, int height, int components,
return ret;
}
+#ifdef __clang__
+// zero-as-null-ppinter-constant
+#pragma clang diagnostic pop
+#endif
+
#endif // TINYEXR_IMPLEMENTATION_DEIFNED
#endif // TINYEXR_IMPLEMENTATION