-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTest.gd
102 lines (89 loc) · 2.27 KB
/
Test.gd
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
extends Control
onready var result = $Panel/Result
onready var generator = $ShaderToImage
onready var multiplier = $Panel/Multiplier
onready var type = $Panel/NoiseType
onready var time = $Panel/Time
onready var mod1 = $Panel/Mod1
onready var mod2 = $Panel/Mod2
var enable_time = false
var getted_image
var example_type = [
{
"name" : "Type1",
"material" : preload("ExampleShaders/ShaderToImage_Type1.material"),
"args" : ["time"]
},
{
"name" : "Type2",
"material" : preload("ExampleShaders/ShaderToImage_Type2.material"),
"args" : ["time", "mod1"]
},
{
"name" : "Type3",
"material" : preload("ExampleShaders/ShaderToImage_Type3.material"),
"args" : ["time"]
},
{
"name" : "Type4",
"material" : preload("ExampleShaders/ShaderToImage_Type5.material"),
"args" : ["time", "mod1"]
},
{
"name" : "Type5",
"material" : preload("ExampleShaders/ShaderToImage_Type5.material"),
"args" : ["time", "mod1"]
},
{
"name" : "Type6",
"material" : preload("ExampleShaders/ShaderToImage_Type6.material"),
"args" : ["time"]
},
{
"name" : "Type7",
"material" : preload("ExampleShaders/ShaderToImage_Type7.material"),
"args" : ["mod1", "mod2"]
},
{
"name" : "Type8",
"material" : preload("ExampleShaders/ShaderToImage_Type8.material"),
"args" : ["time"]
},
{
"name" : "Type9",
"material" : preload("ExampleShaders/ShaderToImage_Type9.material"),
"args" : ["time", "mod1"]
},
]
func build_noise_type():
for _type in generator.get_type_list():
var name = _type.name
name += " ("
for arg in _type.args:
name+=arg+", "
name += ")"
type.add_item(name)
pass
func _ready():
for ex in example_type:
generator.add_custom_type(ex.name, ex.material, ex.args)
build_noise_type();
func _process(_delta):
if enable_time:
time.text = str(OS.get_ticks_msec()/1000.0)
pass
func _on_Button_pressed():
generator.multiplier = multiplier.value
generator.type = type.get_selected_id()
generator.time = int(time.text)
generator.mod1 = mod1.value
generator.mod2 = mod2.value
generator.generate_image()
yield(generator, "generated")
getted_image = generator.get_image()
var text = ImageTexture.new()
text.create_from_image(getted_image)
result.texture = text
func _on_EnableTime_pressed():
enable_time=!enable_time
pass # Replace with function body.