mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-03-12 22:35:18 +00:00
Remove unneeded shader parameters
Also changed the parameter names in HSV to reduce some lines of code
This commit is contained in:
parent
483e7df52e
commit
91b1186d6f
7 changed files with 18 additions and 38 deletions
|
@ -1,9 +1,9 @@
|
|||
shader_type canvas_item;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform float hue_shift_amount : hint_range(-1, 1);
|
||||
uniform float sat_shift_amount : hint_range(-1, 1);
|
||||
uniform float val_shift_amount : hint_range(-1, 1);
|
||||
uniform float hue_shift : hint_range(-1, 1);
|
||||
uniform float sat_shift : hint_range(-1, 1);
|
||||
uniform float val_shift : hint_range(-1, 1);
|
||||
uniform sampler2D selection;
|
||||
|
||||
vec3 rgb2hsb(vec3 c){
|
||||
|
@ -40,22 +40,21 @@ void fragment() {
|
|||
// If not greyscale
|
||||
if(col[0] != col[1] || col[1] != col[2]) {
|
||||
// Shift the color by shift_amount, but rolling over the value goes over 1
|
||||
hsb.x = mod(hsb.x + hue_shift_amount, 1.0);
|
||||
hsb.x = mod(hsb.x + hue_shift, 1.0);
|
||||
}
|
||||
if(sat_shift_amount > 0.0) {
|
||||
hsb.y = mix(hsb.y, 1 , sat_shift_amount);
|
||||
if(sat_shift > 0.0) {
|
||||
hsb.y = mix(hsb.y, 1 , sat_shift);
|
||||
}
|
||||
else if (sat_shift_amount < 0.0) {
|
||||
hsb.y = mix(0, hsb.y , 1.0 - abs(sat_shift_amount));
|
||||
else if (sat_shift < 0.0) {
|
||||
hsb.y = mix(0, hsb.y , 1.0 - abs(sat_shift));
|
||||
}
|
||||
|
||||
if(val_shift_amount > 0.0) {
|
||||
hsb.z = mix(hsb.z, 1 , val_shift_amount);
|
||||
if(val_shift > 0.0) {
|
||||
hsb.z = mix(hsb.z, 1 , val_shift);
|
||||
}
|
||||
else if (val_shift_amount < 0.0) {
|
||||
hsb.z = mix(0, hsb.z , 1.0 - abs(val_shift_amount));
|
||||
else if (val_shift < 0.0) {
|
||||
hsb.z = mix(0, hsb.z , 1.0 - abs(val_shift));
|
||||
}
|
||||
|
||||
|
||||
col = hsb2rgb(hsb);
|
||||
vec3 output = mix(original_color.rgb, col, selection_color.a);
|
||||
|
|
|
@ -26,13 +26,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
|
||||
var params := {
|
||||
"red": red,
|
||||
"blue": blue,
|
||||
"green": green,
|
||||
"alpha": alpha,
|
||||
"selection": selection_tex,
|
||||
"affect_selection": selection_checkbox.pressed,
|
||||
"has_selection": project.has_selection
|
||||
"red": red, "blue": blue, "green": green, "alpha": alpha, "selection": selection_tex
|
||||
}
|
||||
if !confirmed:
|
||||
for param in params:
|
||||
|
|
|
@ -69,6 +69,7 @@ margin_bottom = 252.0
|
|||
|
||||
[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"]
|
||||
margin_right = 278.0
|
||||
items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
||||
|
||||
[node name="AnimationOptions" parent="VBoxContainer" index="3"]
|
||||
visible = false
|
||||
|
|
|
@ -51,14 +51,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
|
||||
var params := {
|
||||
"hue_shift_amount": hue,
|
||||
"sat_shift_amount": sat,
|
||||
"val_shift_amount": val,
|
||||
"selection": selection_tex,
|
||||
"affect_selection": selection_checkbox.pressed,
|
||||
"has_selection": project.has_selection
|
||||
}
|
||||
var params := {"hue_shift": hue, "sat_shift": sat, "val_shift": val, "selection": selection_tex}
|
||||
if !confirmed:
|
||||
for param in params:
|
||||
preview.material.set_shader_param(param, params[param])
|
||||
|
|
|
@ -26,13 +26,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
|
||||
var params := {
|
||||
"red": red,
|
||||
"blue": blue,
|
||||
"green": green,
|
||||
"alpha": alpha,
|
||||
"selection": selection_tex,
|
||||
"affect_selection": selection_checkbox.pressed,
|
||||
"has_selection": project.has_selection
|
||||
"red": red, "blue": blue, "green": green, "alpha": alpha, "selection": selection_tex
|
||||
}
|
||||
|
||||
if !confirmed:
|
||||
|
|
|
@ -69,6 +69,7 @@ margin_bottom = 252.0
|
|||
|
||||
[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"]
|
||||
margin_right = 278.0
|
||||
items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
||||
|
||||
[node name="AnimationOptions" parent="VBoxContainer" index="3"]
|
||||
visible = false
|
||||
|
|
|
@ -60,9 +60,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
"width": anim_thickness,
|
||||
"pattern": pattern,
|
||||
"inside": inside_image,
|
||||
"selection": selection_tex,
|
||||
"affect_selection": selection_checkbox.pressed,
|
||||
"has_selection": project.has_selection
|
||||
"selection": selection_tex
|
||||
}
|
||||
if !confirmed:
|
||||
for param in params:
|
||||
|
|
Loading…
Add table
Reference in a new issue