Skip to content

Commit

Permalink
🔀 Merge remote-tracking branch 'origin/main' into launcher
Browse files Browse the repository at this point in the history
# Conflicts:
#	Cool
#	src/ProjectManager/internal_utils.cpp
#	src/ProjectManager/utils.cpp
  • Loading branch information
JulesFouchy committed Feb 6, 2025
2 parents cc957ef + de0ac6a commit 4a2a376
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cool
34 changes: 34 additions & 0 deletions Nodes/11 Image Modifier (Post Process)/Glow.clbnode
Original file line number Diff line number Diff line change
@@ -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';
}
86 changes: 86 additions & 0 deletions Nodes/11 Image Modifier (Post Process)/Glow.clbnode.presets.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
]
}
}
]
}
}
4 changes: 3 additions & 1 deletion src/ModulesGraph/ModulesGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 4a2a376

Please sign in to comment.