Skip to content

Commit 42a9204

Browse files
committed
Initial commit
0 parents  commit 42a9204

34 files changed

+753
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Godot-specific ignores
2+
.import/
3+
export.cfg
4+
export_presets.cfg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
shader_type canvas_item;
2+
3+
uniform vec4 base: hint_color;
4+
5+
void fragment() {
6+
COLOR = texture(SCREEN_TEXTURE, SCREEN_UV);
7+
8+
float i = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
9+
10+
//COLOR.rgb = vec3(i);
11+
12+
//COLOR = mix(vec4(0,0,0,1), base, i);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
shader_type canvas_item;
2+
3+
void fragment() {
4+
vec2 coord = SCREEN_UV;
5+
6+
//coord.x += 0.01 * cos(TIME * 5.0 + coord.y * 20.0);
7+
8+
//coord = coord - mod(coord, SCREEN_PIXEL_SIZE * 10.0);
9+
10+
COLOR = texture(SCREEN_TEXTURE, coord);
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
shader_type canvas_item;
2+
3+
uniform sampler2D anotherTexture;
4+
5+
void fragment() {
6+
vec4 sample = texture(anotherTexture, UV);
7+
8+
vec2 coord = SCREEN_UV;
9+
10+
//coord.x += 0.02 * sin(TIME * 5.0 + coord.y * 30.0) * pow(sample.r, 2);
11+
12+
COLOR = texture(SCREEN_TEXTURE, coord);
13+
14+
//COLOR.rgb *= sample.rgb;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[gd_scene load_steps=9 format=2]
2+
3+
[ext_resource path="res://assets/platformer.jpg" type="Texture" id=1]
4+
[ext_resource path="res://01-simple-screenspace/01-01-color-transform.gdshader" type="Shader" id=2]
5+
[ext_resource path="res://01-simple-screenspace/01-02-coordinate-transform.gdshader" type="Shader" id=3]
6+
[ext_resource path="res://01-simple-screenspace/01-03-more-textures.gdshader" type="Shader" id=4]
7+
[ext_resource path="res://assets/vignette.png" type="Texture" id=5]
8+
9+
[sub_resource type="ShaderMaterial" id=2]
10+
shader = ExtResource( 2 )
11+
shader_param/base = Color( 0.854902, 0.592157, 0.592157, 1 )
12+
13+
[sub_resource type="ShaderMaterial" id=3]
14+
shader = ExtResource( 3 )
15+
16+
[sub_resource type="ShaderMaterial" id=4]
17+
shader = ExtResource( 4 )
18+
shader_param/anotherTexture = ExtResource( 5 )
19+
20+
[node name="Node2D" type="Control"]
21+
anchor_right = 1.0
22+
anchor_bottom = 1.0
23+
24+
[node name="scene" type="Node2D" parent="."]
25+
26+
[node name="TextureRect" type="TextureRect" parent="scene"]
27+
anchor_right = 1.0
28+
anchor_bottom = 1.0
29+
texture = ExtResource( 1 )
30+
__meta__ = {
31+
"_edit_use_anchors_": true
32+
}
33+
34+
[node name="effect" type="Node2D" parent="."]
35+
36+
[node name="01-01-color-transform" type="ColorRect" parent="effect"]
37+
visible = false
38+
material = SubResource( 2 )
39+
margin_right = 800.0
40+
margin_bottom = 600.0
41+
42+
[node name="01-02-coordinate-transform" type="ColorRect" parent="effect"]
43+
visible = false
44+
material = SubResource( 3 )
45+
margin_right = 800.0
46+
margin_bottom = 600.0
47+
48+
[node name="01-03-more-textures" type="ColorRect" parent="effect"]
49+
material = SubResource( 4 )
50+
margin_right = 800.0
51+
margin_bottom = 600.0

02-metaball/02-metaball.tscn

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
[gd_scene load_steps=7 format=2]
2+
3+
[ext_resource path="res://02-metaball/ball.material" type="Material" id=1]
4+
[ext_resource path="res://02-metaball/effect.gdshader" type="Shader" id=2]
5+
6+
[sub_resource type="Curve" id=1]
7+
_data = [ Vector2( 0, 0.663076 ), 0.0, 0.0, 0, 0, Vector2( 0.386139, 0.717621 ), 0.0, 0.0, 0, 0, Vector2( 0.732673, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
8+
9+
[sub_resource type="Animation" id=4]
10+
resource_name = "1"
11+
length = 2.0
12+
loop = true
13+
tracks/0/type = "bezier"
14+
tracks/0/path = NodePath("ball3:rect_position:x")
15+
tracks/0/interp = 1
16+
tracks/0/loop_wrap = true
17+
tracks/0/imported = false
18+
tracks/0/enabled = true
19+
tracks/0/keys = {
20+
"points": PoolRealArray( 138, -0.25, 0, 0.25, 0, 180, -0.25, 0, 0.25, 0, 138, -0.25, 0, 0.25, 0 ),
21+
"times": PoolRealArray( 0, 1, 2 )
22+
}
23+
tracks/1/type = "bezier"
24+
tracks/1/path = NodePath("ball3:rect_position:y")
25+
tracks/1/interp = 1
26+
tracks/1/loop_wrap = true
27+
tracks/1/imported = false
28+
tracks/1/enabled = true
29+
tracks/1/keys = {
30+
"points": PoolRealArray( 76, -0.25, 0, 0.25, 0, 74, -0.25, 0, 0.25, 0, 76, -0.25, 0, 0.25, 0 ),
31+
"times": PoolRealArray( 0, 1, 2 )
32+
}
33+
34+
[sub_resource type="Animation" id=5]
35+
length = 0.001
36+
tracks/0/type = "bezier"
37+
tracks/0/path = NodePath("ball3:rect_position:x")
38+
tracks/0/interp = 1
39+
tracks/0/loop_wrap = true
40+
tracks/0/imported = false
41+
tracks/0/enabled = true
42+
tracks/0/keys = {
43+
"points": PoolRealArray( 180, -0.25, 0, 0.25, 0 ),
44+
"times": PoolRealArray( 0 )
45+
}
46+
tracks/1/type = "bezier"
47+
tracks/1/path = NodePath("ball3:rect_position:y")
48+
tracks/1/interp = 1
49+
tracks/1/loop_wrap = true
50+
tracks/1/imported = false
51+
tracks/1/enabled = true
52+
tracks/1/keys = {
53+
"points": PoolRealArray( 81, -0.25, 0, 0.25, 0 ),
54+
"times": PoolRealArray( 0 )
55+
}
56+
57+
[sub_resource type="ShaderMaterial" id=3]
58+
shader = ExtResource( 2 )
59+
60+
[node name="Node2D" type="Node2D"]
61+
62+
[node name="scene" type="Node2D" parent="."]
63+
64+
[node name="ColorRect" type="ColorRect" parent="scene"]
65+
anchor_right = 1.0
66+
anchor_bottom = 1.0
67+
margin_right = 800.0
68+
margin_bottom = 600.0
69+
color = Color( 0, 0, 0, 1 )
70+
71+
[node name="ball1" type="ColorRect" parent="scene"]
72+
material = ExtResource( 1 )
73+
margin_left = 99.0
74+
margin_top = 75.0
75+
margin_right = 179.0
76+
margin_bottom = 155.0
77+
78+
[node name="ball3" type="ColorRect" parent="scene"]
79+
material = ExtResource( 1 )
80+
margin_left = 180.0
81+
margin_top = 81.0
82+
margin_right = 260.002
83+
margin_bottom = 161.001
84+
85+
[node name="ball2" type="ColorRect" parent="scene"]
86+
visible = false
87+
material = ExtResource( 1 )
88+
margin_left = 460.0
89+
margin_top = 214.0
90+
margin_right = 540.0
91+
margin_bottom = 294.0
92+
93+
[node name="CPUParticles2D" type="CPUParticles2D" parent="scene/ball2"]
94+
material = ExtResource( 1 )
95+
position = Vector2( 40, 40 )
96+
amount = 100
97+
lifetime = 3.0
98+
explosiveness = 0.66
99+
lifetime_randomness = 0.59
100+
spread = 180.0
101+
gravity = Vector2( 0, 0 )
102+
initial_velocity = 45.87
103+
scale_amount = 30.0
104+
scale_amount_random = 0.62
105+
scale_amount_curve = SubResource( 1 )
106+
107+
[node name="AnimationPlayer" type="AnimationPlayer" parent="scene"]
108+
autoplay = "1"
109+
anims/1 = SubResource( 4 )
110+
anims/RESET = SubResource( 5 )
111+
112+
[node name="effect" type="Node2D" parent="."]
113+
visible = false
114+
115+
[node name="ColorRect" type="ColorRect" parent="effect"]
116+
material = SubResource( 3 )
117+
margin_right = 800.0
118+
margin_bottom = 600.0

02-metaball/ball.gdshader

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
shader_type canvas_item;
2+
render_mode blend_add;
3+
4+
5+
void fragment() {
6+
vec2 p = UV * 2.0 - vec2(1.0);
7+
8+
float i = min(dot(p,p), 1.0);
9+
10+
COLOR = mix(vec4(1.0), vec4(0.0), i);
11+
}

02-metaball/ball.material

193 Bytes
Binary file not shown.

02-metaball/effect.gdshader

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
shader_type canvas_item;
2+
3+
void fragment() {
4+
float x = texture(SCREEN_TEXTURE, SCREEN_UV).r;
5+
6+
x = clamp((x - 0.5) * 100.0, 0.0, 1.0);
7+
8+
COLOR.rgb = mix(vec3(0.0), vec3(1.0), x);
9+
}

03-sketchy/03-sketchy.gdshader

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
shader_type canvas_item;
2+
3+
uniform sampler2D backgroundTexture;
4+
uniform sampler3D hatchTexture;
5+
6+
void fragment() {
7+
vec4 sample = texture(SCREEN_TEXTURE, SCREEN_UV);
8+
9+
COLOR = vec4(1.0);
10+
11+
vec2 random = vec2(sin(TIME*123456.78), cos(TIME*123456.78));
12+
13+
// Фон
14+
vec2 background_uv = UV * vec2(800.0, 600.0) / vec2(3000.0, 2139.0);
15+
background_uv += random.yx;
16+
COLOR = texture(backgroundTexture, background_uv);
17+
18+
// Штриховка
19+
float hatch_intensity = sample.b;
20+
vec2 hatch_uv = UV * 2.0;
21+
float hatch_w = mix(0.05, 0.9, hatch_intensity);
22+
23+
vec2 random_r = vec2(cos(random.x * 3.14), sin(random.x * 3.14));
24+
hatch_uv = vec2(dot(hatch_uv, random_r), dot(hatch_uv, random_r.yx * vec2(1.0, -1.0)));
25+
hatch_uv += random * 4234.324;
26+
27+
vec4 hatch_sample = texture(hatchTexture, vec3(hatch_uv, hatch_w));
28+
COLOR = mix(vec4(0.0), COLOR, hatch_sample.r);
29+
30+
// Контуры
31+
float contour_intensity = sample.g;
32+
COLOR = mix(COLOR, vec4(0.0), contour_intensity);
33+
34+
// Акцентный цвет
35+
float accent_intensity = sample.r;
36+
COLOR = mix(COLOR, vec4(1.0, 0.0, 0.0, 1.0), accent_intensity);
37+
38+
COLOR.a = 1.0;
39+
}

03-sketchy/03-sketchy.material

280 Bytes
Binary file not shown.

03-sketchy/03-sketchy.tscn

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[gd_scene load_steps=8 format=2]
2+
3+
[ext_resource path="res://assets/cat/animated_texture.tres" type="Texture" id=1]
4+
[ext_resource path="res://03-sketchy/03-sketchy.material" type="Material" id=2]
5+
6+
[sub_resource type="Gradient" id=1]
7+
offsets = PoolRealArray( 0, 0.636872, 0.664804, 1 )
8+
colors = PoolColorArray( 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 )
9+
10+
[sub_resource type="GradientTexture2D" id=2]
11+
gradient = SubResource( 1 )
12+
fill = 1
13+
fill_from = Vector2( 0.504167, 0.495833 )
14+
15+
[sub_resource type="Gradient" id=3]
16+
offsets = PoolRealArray( 0.00558659, 0.0167598, 0.027933, 1 )
17+
colors = PoolColorArray( 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1 )
18+
19+
[sub_resource type="GradientTexture2D" id=4]
20+
gradient = SubResource( 3 )
21+
width = 300
22+
height = 300
23+
fill_to = Vector2( 0, 1 )
24+
25+
[sub_resource type="Animation" id=5]
26+
resource_name = "1"
27+
length = 10.0
28+
loop = true
29+
tracks/0/type = "value"
30+
tracks/0/path = NodePath("sun:rect_rotation")
31+
tracks/0/interp = 1
32+
tracks/0/loop_wrap = true
33+
tracks/0/imported = false
34+
tracks/0/enabled = true
35+
tracks/0/keys = {
36+
"times": PoolRealArray( 0, 10 ),
37+
"transitions": PoolRealArray( 1, 1 ),
38+
"update": 0,
39+
"values": [ 0.0, 360.0 ]
40+
}
41+
42+
[node name="Node2D" type="Node2D"]
43+
44+
[node name="scene" type="Node2D" parent="."]
45+
46+
[node name="back" type="ColorRect" parent="scene"]
47+
margin_right = 800.0
48+
margin_bottom = 600.0
49+
color = Color( 0, 0, 0, 1 )
50+
51+
[node name="sun" type="TextureRect" parent="scene"]
52+
margin_left = 323.0
53+
margin_top = 53.0
54+
margin_right = 387.0
55+
margin_bottom = 117.0
56+
rect_rotation = 118.66
57+
rect_pivot_offset = Vector2( 32, 300 )
58+
texture = SubResource( 2 )
59+
60+
[node name="floor" type="TextureRect" parent="scene"]
61+
margin_left = -2.0
62+
margin_top = 300.0
63+
margin_right = 298.0
64+
margin_bottom = 600.0
65+
rect_scale = Vector2( 2.68, 1 )
66+
texture = SubResource( 4 )
67+
68+
[node name="cat" type="TextureRect" parent="scene"]
69+
margin_left = 227.0
70+
margin_top = 146.0
71+
margin_right = 483.0
72+
margin_bottom = 402.0
73+
texture = ExtResource( 1 )
74+
75+
[node name="AnimationPlayer" type="AnimationPlayer" parent="scene"]
76+
autoplay = "1"
77+
anims/1 = SubResource( 5 )
78+
79+
[node name="effect" type="Node2D" parent="."]
80+
81+
[node name="ColorRect" type="ColorRect" parent="effect"]
82+
material = ExtResource( 2 )
83+
margin_right = 800.0
84+
margin_bottom = 600.0

assets/cat/animated_texture.tres

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[gd_resource type="AnimatedTexture" load_steps=7 format=2]
2+
3+
[ext_resource path="res://assets/cat/await6.png" type="Texture" id=1]
4+
[ext_resource path="res://assets/cat/await4.png" type="Texture" id=2]
5+
[ext_resource path="res://assets/cat/await5.png" type="Texture" id=3]
6+
[ext_resource path="res://assets/cat/await2.png" type="Texture" id=4]
7+
[ext_resource path="res://assets/cat/await3.png" type="Texture" id=5]
8+
[ext_resource path="res://assets/cat/await1.png" type="Texture" id=6]
9+
10+
[resource]
11+
flags = 4
12+
frames = 10
13+
fps = 6.0
14+
frame_0/texture = ExtResource( 6 )
15+
frame_0/delay_sec = 0.84
16+
frame_1/texture = ExtResource( 4 )
17+
frame_1/delay_sec = 0.0
18+
frame_2/texture = ExtResource( 5 )
19+
frame_2/delay_sec = 0.0
20+
frame_3/texture = ExtResource( 2 )
21+
frame_3/delay_sec = 0.0
22+
frame_4/texture = ExtResource( 3 )
23+
frame_4/delay_sec = 0.0
24+
frame_5/texture = ExtResource( 1 )
25+
frame_5/delay_sec = 1.07
26+
frame_6/texture = ExtResource( 3 )
27+
frame_6/delay_sec = 0.0
28+
frame_7/texture = ExtResource( 2 )
29+
frame_7/delay_sec = 0.0
30+
frame_8/texture = ExtResource( 5 )
31+
frame_8/delay_sec = 0.0
32+
frame_9/texture = ExtResource( 4 )
33+
frame_9/delay_sec = 0.0

assets/cat/await1.png

25.4 KB
Loading

0 commit comments

Comments
 (0)