From a8405301c62d358b585ab071f4a7b6b85e9a9255 Mon Sep 17 00:00:00 2001 From: Jules Fouchy Date: Thu, 19 Dec 2024 20:14:01 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ProjectManager/internal_utils.cpp | 2 +- src/ProjectManager/utils.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProjectManager/internal_utils.cpp b/src/ProjectManager/internal_utils.cpp index 6116e435..61586dc3 100644 --- a/src/ProjectManager/internal_utils.cpp +++ b/src/ProjectManager/internal_utils.cpp @@ -63,7 +63,7 @@ auto save_project_to(CommandExecutionContext_Ref const& ctx, std::filesystem::pa { if (!ctx.project_path().has_value() && path != Path::untitled_project()) { // We just saved the untitled project as an actual project, we can delete the untitled project file so that it won't be loaded the next time we open Coollab. - Cool::File::remove(Path::untitled_project()); + Cool::File::remove_file(Path::untitled_project()); } } else diff --git a/src/ProjectManager/utils.cpp b/src/ProjectManager/utils.cpp index 96cdb2b2..0c56dc09 100644 --- a/src/ProjectManager/utils.cpp +++ b/src/ProjectManager/utils.cpp @@ -116,7 +116,7 @@ void before_project_destruction(CommandExecutionContext_Ref const& ctx) break; } } - Cool::File::remove(Path::untitled_project()); // Users either saved their untitled project, or accepted to lose their changes. + Cool::File::remove_file(Path::untitled_project()); // Users either saved their untitled project, or accepted to lose their changes. if (!has_saved) internal_project::save_project_to(ctx, Path::backup_project()); } From 026f58616320100ff14fba1f7a6afb4070a60458 Mon Sep 17 00:00:00 2001 From: Jules Fouchy Date: Mon, 30 Dec 2024 12:52:10 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=9F=A6=20[Nodes]=20Add=20a=20Post-Pro?= =?UTF-8?q?cess=20Glow.=20closes=20#110?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Glow.clbnode | 34 ++++++++ .../Glow.clbnode.presets.json | 86 +++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 Nodes/11 Image Modifier (Post Process)/Glow.clbnode create mode 100644 Nodes/11 Image Modifier (Post Process)/Glow.clbnode.presets.json diff --git a/Nodes/11 Image Modifier (Post Process)/Glow.clbnode b/Nodes/11 Image Modifier (Post Process)/Glow.clbnode new file mode 100644 index 00000000..7e3722f5 --- /dev/null +++ b/Nodes/11 Image Modifier (Post Process)/Glow.clbnode @@ -0,0 +1,34 @@ +// Credit: [illtellyoulater](https://github.com/CoolLibs/Lab/issues/110) + +INPUT UV->Oklab_PremultipliedA 'Image'; +INPUT float 'Brightness'; +INPUT float 'Size'; +INPUT int 'Quality'; /// The higher the number the smoother the result, but it will start to get laggy if set too high. +INPUT float 'Mask'; + +vec4 blur(vec2 uv) +{ + vec4 color = vec4(0.); + for (int x = -'Quality'; x <= 'Quality'; x++) + { + for (int y = -'Quality'; y <= 'Quality'; y++) + { + vec2 offset = vec2(x, y) / 'Quality' * 'Size'; + color += 'Image'(uv + offset); + } + } + + float weights_sum = (2. * 'Quality' + 1.) * (2. * 'Quality' + 1.); + return color / weights_sum; +} + +Oklab_PremultipliedA main(UV uv) +{ + vec4 blurred = blur(uv); + vec4 glow = blurred * 'Brightness'; + vec4 base = 'Image'(uv); + + // Combine original image and glow + // return mix(base, glow, 'Blend Strength'); + return base + glow * 'Mask'; +} \ No newline at end of file diff --git a/Nodes/11 Image Modifier (Post Process)/Glow.clbnode.presets.json b/Nodes/11 Image Modifier (Post Process)/Glow.clbnode.presets.json new file mode 100644 index 00000000..f287480f --- /dev/null +++ b/Nodes/11 Image Modifier (Post Process)/Glow.clbnode.presets.json @@ -0,0 +1,86 @@ +{ + "Presets": { + "Underlying container": [ + { + "first": "d07c9f21-6de8-4dfd-bc8f-04a5573983de", + "second": { + "Name": "Default", + "Values": [ + { + "index": 2, + "data": { + "Name": "Brightness", + "Value": 1.5, + "Metadata": { + "Bounds": { + "Has min bound": true, + "Min": 0.0, + "Has max bound": false, + "Max": 1.0, + "Drag speed": 0.009999999776482582, + "Use slider": false, + "Is logarithmic": false + } + } + } + }, + { + "index": 2, + "data": { + "Name": "Size", + "Value": 0.15000000596046449, + "Metadata": { + "Bounds": { + "Has min bound": true, + "Min": 0.0, + "Has max bound": false, + "Max": 1.0, + "Drag speed": 0.0010000000474974514, + "Use slider": false, + "Is logarithmic": false + } + } + } + }, + { + "index": 1, + "data": { + "Name": "Quality", + "Value": 3, + "Metadata": { + "Bounds": { + "Has min bound": true, + "Min": 1, + "Has max bound": true, + "Max": 6, + "Drag speed": 0.009999999776482582, + "Use slider": false, + "Is logarithmic": false + } + } + } + }, + { + "index": 2, + "data": { + "Name": "Mask", + "Value": 1.0, + "Metadata": { + "Bounds": { + "Has min bound": true, + "Min": 0.0, + "Has max bound": true, + "Max": 1.0, + "Drag speed": 0.009999999776482582, + "Use slider": true, + "Is logarithmic": false + } + } + } + } + ] + } + } + ] + } +} \ No newline at end of file From e60aceabaf835c012040140a7c64614ff9e4a90a Mon Sep 17 00:00:00 2001 From: Jules Fouchy Date: Tue, 31 Dec 2024 13:33:36 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20Fix=20crash=20when=20changin?= =?UTF-8?q?g=20project=20from=20the=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #111 Fixes #112 --- Cool | 2 +- src/ModulesGraph/ModulesGraph.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cool b/Cool index 984886eb..ee0d6e78 160000 --- a/Cool +++ b/Cool @@ -1 +1 @@ -Subproject commit 984886eb8eb8029ca01b89518bf9d3135dad2a72 +Subproject commit ee0d6e7810d01045de47c9b054191f5051b79b60 diff --git a/src/ModulesGraph/ModulesGraph.cpp b/src/ModulesGraph/ModulesGraph.cpp index ca67ef0e..1e66019c 100644 --- a/src/ModulesGraph/ModulesGraph.cpp +++ b/src/ModulesGraph/ModulesGraph.cpp @@ -8,6 +8,7 @@ #include "Cool/Log/ToUser.h" #include "Cool/Nodes/NodesLibrary.h" #include "Cool/StrongTypes/Camera2D.h" +#include "Cool/TextureSource/default_textures.h" #include "Module_Compositing/Module_Compositing.h" #include "Module_Compositing/generate_compositing_shader_code.h" #include "Module_Default/Module_Default.hpp" @@ -365,7 +366,8 @@ void ModulesGraph::submit_gizmos(Cool::GizmoManager& gizmos, CommandExecutor con auto ModulesGraph::final_texture() const -> Cool::TextureRef { - assert(_root_module && "You must call render() before trying to access the final texture"); + if (!_root_module) + return Cool::transparent_texture().ref(); return _root_module->texture(); } From de0ac6a878a1e3bde41cb57ec2f613dc3701722f Mon Sep 17 00:00:00 2001 From: Jules Fouchy Date: Tue, 31 Dec 2024 14:02:22 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20[Cool]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cool b/Cool index ee0d6e78..542d5a16 160000 --- a/Cool +++ b/Cool @@ -1 +1 @@ -Subproject commit ee0d6e7810d01045de47c9b054191f5051b79b60 +Subproject commit 542d5a16cab45a08307242583afc41754846c4a2