add shader

This commit is contained in:
2024-12-13 06:45:07 +03:00
parent 604e8dc875
commit 7bc5aa8e3d
12 changed files with 150 additions and 268 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bw3yv3smvaxqn"
path="res://.godot/imported/nine-patch.png-798f7950fb3126b4e1ed0c39d9e4beba.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://table/nine-patch.png"
dest_files=["res://.godot/imported/nine-patch.png-798f7950fb3126b4e1ed0c39d9e4beba.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -31,21 +31,3 @@ alignment = 1
editable = false
caret_blink = true
caret_blink_interval = 0.5
[node name="Label" type="Label" parent="."]
visible = false
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
[node name="Label" type="Label" parent="Label"]
visible = false
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
[node name="CheckButton" type="CheckButton" parent="Label"]
visible = false
layout_mode = 0
offset_right = 44.0
offset_bottom = 24.0

View File

@@ -1,15 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://pd3fcx55duj2"]
[ext_resource type="Texture2D" uid="uid://bw3yv3smvaxqn" path="res://table/nine-patch.png" id="1_jtmfn"]
[node name="NinePatchRect" type="NinePatchRect"]
offset_right = 17.0
offset_bottom = 16.0
texture = ExtResource("1_jtmfn")
draw_center = false
patch_margin_left = 8
patch_margin_top = 8
patch_margin_right = 8
patch_margin_bottom = 8
axis_stretch_horizontal = 1
axis_stretch_vertical = 1

7
table/switch.gdshader Normal file
View File

@@ -0,0 +1,7 @@
shader_type canvas_item;
void fragment()
{
COLOR.rgb = vec3(1.0, 1.0, 1.0) - log(COLOR.rgb);
}

27
table/switch.tscn Normal file
View File

@@ -0,0 +1,27 @@
[gd_scene load_steps=6 format=3 uid="uid://dhg1syshfaem2"]
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://Shaders/shader_edu.tres" id="1_nb5jm"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kwqxa"]
bg_color = Color(0, 0, 0, 1)
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7vs72"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_houwj"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o2hja"]
bg_color = Color(0.6, 0.6, 0.6, 0)
[node name="PanelContainer" type="PanelContainer"]
offset_right = 186.0
offset_bottom = 40.0
theme_override_styles/panel = SubResource("StyleBoxFlat_kwqxa")
[node name="CheckButton" type="CheckButton" parent="."]
material = ExtResource("1_nb5jm")
layout_mode = 2
size_flags_horizontal = 4
mouse_default_cursor_shape = 2
theme_override_styles/disabled_mirrored = SubResource("StyleBoxTexture_7vs72")
theme_override_styles/hover = SubResource("StyleBoxTexture_houwj")
theme_override_styles/normal = SubResource("StyleBoxFlat_o2hja")

View File

@@ -7,7 +7,7 @@ class_name GDTable extends GridContainer
@export var selector_key_down: Key = KEY_DOWN ## Клавиша увеличения индекса выбранного ряда
@export var selector_key_up: Key = KEY_UP ## Клавиша уменьшения индекса выбранного ряда
@export_file var node_type_file: = 'res://table/node.tscn': get = get_node_scene, set = load_node_scene ## Сцена ячейки устанавливаемая по умолчанию
@export_file var selector_type_file: = 'res://table/selector.tscn': set = load_selector_scene ## Сцена селектора для выбранного ряда
@export_file var switch_type_file: = 'res://table/switch.tscn': set = load_switch_scene ## Сцена селектора для выбранного ряда
const HEAD_PREFIX = 'HEAD_' ## Префикс ключа заголовка таблицы
const INDEX_FORMAT = '%02d_%02d' ## Формат индекса ключа
@@ -28,6 +28,7 @@ var nodes: = {} ## Все ячейки таблицы и до
var columns_min_size = [] ## Ширина каждой колонки
var ScnNode: PackedScene ## Прототип ячейки таблицы
var ScnSelector: PackedScene ## Прототип индикатора выбранного ряда
var ScnSwitch: PackedScene
var selector_color_proc: Callable ## Ссылка на процедуру генератора цвета индикатора выбранного ряда
var selector_size_proc: Callable ## Ссылка на процедуру генератора размера индикатора выбранного ряда
@@ -121,11 +122,9 @@ func set_columns_alignments(alignments: Array):
set_node_alligment(i_col, i_row, alignments[i_col])
##
func load_selector_scene(file_name: String):
selector_type_file = file_name
ScnSelector = load(file_name)
func load_switch_scene(file_name: String):
switch_type_file = file_name
ScnSwitch = load(file_name)
##
func load_node_scene(file_name: String):
@@ -135,10 +134,10 @@ func load_node_scene(file_name: String):
##
func _ready():
ScnSelector = load(selector_type_file)
ScnSwitch = load(switch_type_file)
ScnNode = load(node_type_file)
assert(ScnSelector is PackedScene)
assert(ScnNode is PackedScene)
assert(ScnSwitch is PackedScene)
## Выравнивает по нижнему левому углу. Используется для выравнивания по заголовку.