1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-03-12 22:35:18 +00:00

Use AutoInvertColors shader for the cursor tool icons

This commit is contained in:
Manolis Papadeas 2021-06-05 02:01:04 +03:00
parent a67855a7f2
commit a4c9e0e8dd
3 changed files with 19 additions and 11 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=20 format=2]
[ext_resource path="res://assets/themes/dark/theme.tres" type="Theme" id=1]
[ext_resource path="res://src/Main.gd" type="Script" id=2]
@ -9,6 +9,7 @@
[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffects.tscn" type="PackedScene" id=7]
[ext_resource path="res://src/UI/Dialogs/SaveSpriteHTML5.tscn" type="PackedScene" id=8]
[ext_resource path="res://src/UI/Timeline/FrameProperties.tscn" type="PackedScene" id=9]
[ext_resource path="res://src/Shaders/AutoInvertColors.shader" type="Shader" id=10]
[ext_resource path="res://src/UI/Dialogs/SaveSprite.tscn" type="PackedScene" id=11]
[ext_resource path="res://src/UI/Dialogs/OpenSprite.tscn" type="PackedScene" id=12]
[ext_resource path="res://src/UI/Dialogs/SplashDialog.tscn" type="PackedScene" id=27]
@ -17,6 +18,12 @@
[ext_resource path="res://src/UI/Dialogs/AboutDialog.tscn" type="PackedScene" id=34]
[ext_resource path="res://src/UI/Dialogs/ExportDialog.tscn" type="PackedScene" id=39]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 10 )
[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 10 )
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
@ -111,15 +118,13 @@ Do you want to reload it?"
[node name="FrameProperties" parent="Dialogs" instance=ExtResource( 9 )]
[node name="LeftCursor" type="Sprite" parent="." groups=[
"UIButtons",
]]
[node name="LeftCursor" type="Sprite" parent="."]
visible = false
material = SubResource( 1 )
[node name="RightCursor" type="Sprite" parent="." groups=[
"UIButtons",
]]
[node name="RightCursor" type="Sprite" parent="."]
visible = false
material = SubResource( 2 )
[node name="ModulateTween" type="Tween" parent="."]

View file

@ -3,7 +3,6 @@
[ext_resource path="res://assets/graphics/misc/icon_reload.png" type="Texture" id=1]
[ext_resource path="res://src/Preferences/RestoreDefaultButton.gd" type="Script" id=2]
[sub_resource type="ImageTexture" id=1]
[node name="RestoreDefaultButton" type="TextureButton" groups=[
@ -19,4 +18,5 @@ script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="_on_RestoreDefaultButton_pressed"]

View file

@ -2,8 +2,11 @@ shader_type canvas_item;
void fragment() {
vec3 inverted = vec3(1.0) - COLOR.rgb;
vec4 color = texture(TEXTURE, UV);
COLOR = color;
vec3 inverted = vec3(1.0) - color.rgb;
vec3 screen_color = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0).rgb;
float avg = (screen_color.r + screen_color.g + screen_color.b) / 3.0;
COLOR.rgb = inverted * step(avg, 0.5);
float screen_avg = (screen_color.r + screen_color.g + screen_color.b) / 3.0;
COLOR.rgb = inverted * step(0.5, screen_avg) + color.rgb * step(screen_avg, 0.5);
}