-
Notifications
You must be signed in to change notification settings - Fork 20
/
Main.tscn
267 lines (232 loc) · 7.49 KB
/
Main.tscn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
[gd_scene load_steps=14 format=2]
[ext_resource path="res://scripts/BookOfShaders.gd" type="Script" id=1]
[ext_resource path="res://scripts/TextEdit.gd" type="Script" id=2]
[ext_resource path="res://Inconsolata.otf" type="DynamicFontData" id=3]
[ext_resource path="res://shaders/chapter_12/2d-voronoise.shader" type="Shader" id=4]
[ext_resource path="res://DarkTheme.tres" type="Theme" id=5]
[ext_resource path="res://shaders/3D/3DTest.gdshader" type="Shader" id=6]
[ext_resource path="res://scripts/Camera.gd" type="Script" id=7]
[sub_resource type="CubeMesh" id=3]
[sub_resource type="ShaderMaterial" id=8]
shader = ExtResource( 6 )
[sub_resource type="ProceduralSky" id=6]
[sub_resource type="Environment" id=7]
background_mode = 2
background_sky = SubResource( 6 )
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 4 )
shader_param/mouse_position = null
[sub_resource type="DynamicFont" id=2]
size = 14
outline_color = Color( 0, 0, 0, 1 )
use_mipmaps = true
use_filter = true
extra_spacing_top = -2
extra_spacing_bottom = -2
extra_spacing_space = -1
font_data = ExtResource( 3 )
[node name="Main" type="Node"]
[node name="3D" type="Spatial" parent="."]
[node name="MeshInstance" type="MeshInstance" parent="3D"]
mesh = SubResource( 3 )
material/0 = SubResource( 8 )
[node name="GimbleY" type="Spatial" parent="3D"]
transform = Transform( 0.607431, 0, 0.794372, 0, 1, 0, -0.794372, 0, 0.607431, 0, 0, 0 )
script = ExtResource( 7 )
[node name="GimbleX" type="Spatial" parent="3D/GimbleY"]
transform = Transform( 1, 0, 0, 0, 0.918412, 0.395626, 0, -0.395626, 0.918412, 0, 0, 0 )
[node name="Camera" type="Camera" parent="3D/GimbleY/GimbleX"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4 )
current = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="3D"]
environment = SubResource( 7 )
[node name="UI" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="UI"]
material = SubResource( 1 )
anchor_right = 1.0
anchor_bottom = 1.0
focus_mode = 1
color = Color( 0.305882, 0.286275, 0.286275, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextEdit" type="TextEdit" parent="UI"]
anchor_right = 0.5
anchor_bottom = 1.0
focus_mode = 1
theme = ExtResource( 5 )
custom_colors/member_variable_color = Color( 0.909804, 0.172549, 0.152941, 1 )
custom_colors/function_color = Color( 0.580392, 0.737255, 0.321569, 1 )
custom_colors/symbol_color = Color( 0.92549, 0.541176, 0.0470588, 1 )
custom_colors/caret_background_color = Color( 0.929412, 0.0235294, 0.0235294, 1 )
custom_colors/caret_color = Color( 0, 1, 0.533333, 1 )
custom_colors/line_number_color = Color( 1, 1, 1, 0.521569 )
custom_colors/number_color = Color( 0.988235, 0.623529, 0.843137, 1 )
custom_colors/brace_mismatch_color = Color( 1, 0, 0, 1 )
custom_colors/current_line_color = Color( 0.921569, 0.921569, 0.921569, 0.0980392 )
custom_fonts/font = SubResource( 2 )
text = "shader_type canvas_item;
// Created by inigo quilez - iq/2013
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://iquilezles.org/www/articles/voronoise/voronoise.htm
uniform vec2 mouse_position;
vec3 hash3( vec2 p ) {
vec3 q = vec3( dot(p,vec2(127.1,311.7)),
dot(p,vec2(269.5,183.3)),
dot(p,vec2(419.2,371.9)) );
return fract(sin(q)*43758.5453);
}
float iqnoise( in vec2 x, float u, float v ) {
vec2 p = floor(x);
vec2 f = fract(x);
float k = 1.0+63.0*pow(1.0-v,4.0);
float va = 0.0;
float wt = 0.0;
for (int j=-2; j<=2; j++) {
for (int i=-2; i<=2; i++) {
vec2 g = vec2(float(i),float(j));
vec3 o = hash3(p + g)*vec3(u,u,1.0);
vec2 r = g - f + o.xy;
float d = dot(r,r);
float ww = pow( 1.0-smoothstep(0.0,1.414,sqrt(d)), k );
va += o.z*ww;
wt += ww;
}
}
return va/wt;
}
void fragment() {
vec2 res = 1.0/SCREEN_PIXEL_SIZE;
vec2 st = FRAGCOORD.xy/res.xy;
st.x *= res.x/res.y;
vec3 color = vec3(0.0);
st *= 10.;
float n = iqnoise(st, mouse_position.x/res.x, mouse_position.y/res.y);
COLOR = vec4(vec3(n),1.0);
}
"
highlight_current_line = true
syntax_highlighting = true
show_line_numbers = true
smooth_scrolling = true
minimap_draw = true
caret_block_mode = true
caret_blink = true
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="SwitchShader" type="Button" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -105.097
margin_top = 4.16963
margin_right = -5.09619
margin_bottom = 26.1696
theme = ExtResource( 5 )
text = "Switch Shader"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CodeToggle" type="Button" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -188.917
margin_top = 4.19305
margin_right = -109.917
margin_bottom = 26.1931
theme = ExtResource( 5 )
toggle_mode = true
shortcut_in_tooltip = false
pressed = true
text = "Edit Code"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Reset" type="Button" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -241.921
margin_top = 4.3079
margin_right = -193.921
margin_bottom = 26.3079
theme = ExtResource( 5 )
text = "Reset"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="NewShader" type="Button" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -333.808
margin_top = 3.99564
margin_right = -246.808
margin_bottom = 25.9956
theme = ExtResource( 5 )
text = "New Shader"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="2D3D" type="Button" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -374.0
margin_top = 4.0
margin_right = -340.0
margin_bottom = 26.0
theme = ExtResource( 5 )
shortcut_in_tooltip = false
text = "2D"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="FileDialog" type="FileDialog" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -297.263
margin_right = 2.73682
margin_bottom = 437.0
rect_pivot_offset = Vector2( 299.856, -0.0221341 )
theme = ExtResource( 5 )
window_title = "Pick A Shader"
mode_overrides_title = false
mode = 0
access = 1
filters = PoolStringArray( "*.gdshader", "*.shader" )
show_hidden_files = true
current_dir = "user://media/jr/Mnemonic Courier/godot/_src/BookOfShaders-Godot"
current_path = "user://media/jr/Mnemonic Courier/godot/_src/BookOfShaders-Godot/"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="NewShaderDialog" type="FileDialog" parent="UI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -349.802
margin_top = 55.7754
margin_right = -6.80188
margin_bottom = 466.775
theme = ExtResource( 5 )
window_title = "Create Shader"
mode_overrides_title = false
access = 1
filters = PoolStringArray( "*.gdshader", "*.shader" )
show_hidden_files = true
current_dir = "user://shaders"
current_path = "user://shaders/"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="UI/SwitchShader" to="UI" method="_on_SwitchShader_pressed"]
[connection signal="toggled" from="UI/CodeToggle" to="UI" method="_on_CodeToggle_toggled"]
[connection signal="pressed" from="UI/Reset" to="UI" method="_on_Reset_pressed"]
[connection signal="pressed" from="UI/NewShader" to="UI" method="_on_NewShader_pressed"]
[connection signal="button_up" from="UI/2D3D" to="UI" method="_on_2D3D_button_up"]
[connection signal="file_selected" from="UI/FileDialog" to="UI" method="_on_FileDialog_file_selected"]
[connection signal="file_selected" from="UI/NewShaderDialog" to="UI" method="_on_NewShaderDialog_file_selected"]