Updated all nodes and added warp

- updated all nodes (load/save support and shader generation)
- added warp node
This commit is contained in:
RodZill4 2018-07-23 22:18:43 +02:00
parent 4c9e5762b1
commit 0cd0609541
23 changed files with 286 additions and 104 deletions

View File

@ -7,7 +7,7 @@ var generated_variants = []
var property_widgets = []
func _ready():
print("ready: "+name)
pass
func initialize_properties(object_list):
property_widgets = object_list
@ -41,6 +41,16 @@ func get_source(index = 0):
return c
return null
func get_source_f(source):
var rv
if source.has("rgb"):
rv = source.rgb+".r"
elif source.has("f"):
rv = source.f
else:
rv = "***error***"
return rv
func get_source_rgb(source):
var rv
if source.has("rgb"):
@ -71,14 +81,16 @@ func serialize():
type = type.right(type.find_last("/")+1)
type = type.left(type.find_last("."))
var data = { name=name, type=type, node_position={x=offset.x, y=offset.y} }
for v in _get_state_variables():
for w in property_widgets:
var v = w.name
data[v] = serialize_element(get(v))
return data
func deserialize(data):
print("deserialize: "+name)
offset = Vector2(data.node_position.x, data.node_position.y)
for v in _get_state_variables():
for w in property_widgets:
var v = w.name
set(v, deserialize_element(data[v]))
print(" "+v+" = "+str(deserialize_element(data[v])))
update_property_widgets()

View File

@ -13,7 +13,7 @@ func color_to_string(c):
return "vec3("+str(c.r)+","+str(c.g)+","+str(c.b)+")"
func get_shader_code(uv):
var rv = { defs="", code="", uv=null, rgb=null, f=null }
var rv = { defs="", code="" }
var src0 = get_source(0)
var src1 = get_source(1)
var src2 = get_source(2)
@ -26,12 +26,15 @@ func get_shader_code(uv):
if src2 != null:
src2_code = src2.get_shader_code(uv)
amount_str = str(src2_code.f)
if !generated:
if generated_variants.empty():
rv.defs = src0_code.defs+src1_code.defs+src2_code.defs
var variant_index = generated_variants.find(uv)
if variant_index == -1:
variant_index = generated_variants.size()
generated_variants.append(uv)
rv.code = src0_code.code+src1_code.code+src2_code.code
rv.code += "vec3 "+name+"_rgb = mix("+get_source_rgb(src0_code)+", "+get_source_rgb(src1_code)+", "+amount_str+");\n"
generated = true
rv.rgb = name+"_rgb"
rv.code += "vec3 "+name+"_"+str(variant_index)+"_rgb = mix("+get_source_rgb(src0_code)+", "+get_source_rgb(src1_code)+", "+amount_str+");\n"
rv.rgb = name+"_"+str(variant_index)+"_rgb"
return rv
func _get_state_variables():

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/blend.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/blend.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]
@ -11,10 +11,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 618.0
margin_top = 148.0
margin_right = 751.0
margin_bottom = 310.0
margin_left = 3.0
margin_top = 4.0
margin_right = 93.0
margin_bottom = 87.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -35,18 +35,18 @@ slot/0/left_color = Color( 0.5, 0.5, 1, 1 )
slot/0/right_enabled = true
slot/0/right_type = 0
slot/0/right_color = Color( 0.5, 0.5, 1, 1 )
slot/1/left_enabled = false
slot/1/left_enabled = true
slot/1/left_type = 0
slot/1/left_color = Color( 1, 1, 1, 1 )
slot/1/left_color = Color( 0.5, 0.5, 1, 1 )
slot/1/right_enabled = false
slot/1/right_type = 0
slot/1/right_color = Color( 1, 1, 1, 1 )
slot/2/left_enabled = false
slot/1/right_color = Color( 0.5, 0.5, 1, 1 )
slot/2/left_enabled = true
slot/2/left_type = 0
slot/2/left_color = Color( 1, 1, 1, 1 )
slot/2/left_color = Color( 0.5, 0.5, 1, 1 )
slot/2/right_enabled = false
slot/2/right_type = 0
slot/2/right_color = Color( 1, 1, 1, 1 )
slot/2/right_color = Color( 0.5, 0.5, 1, 1 )
script = ExtResource( 1 )
_sections_unfolded = [ "Theme" ]
@ -58,7 +58,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 24.0
margin_right = 117.0
margin_right = 74.0
margin_bottom = 38.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -79,7 +79,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 38.0
margin_right = 117.0
margin_right = 74.0
margin_bottom = 52.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -100,7 +100,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 53.0
margin_right = 117.0
margin_right = 74.0
margin_bottom = 77.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/bricks.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/bricks.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]

View File

@ -12,17 +12,20 @@ func color_to_string(c):
return "vec3("+str(c.r)+","+str(c.g)+","+str(c.b)+")"
func get_shader_code(uv):
var rv = { defs="", code="", uv=null, rgb=null, f=null }
var rv = { defs="", code="" }
var src = get_source()
if src == null:
return rv
var src_code = src.get_shader_code(uv)
if !generated:
if generated_variants.empty():
rv.defs = src_code.defs;
rv.code = src_code.code+"vec3 "+name+"_rgb = mix("+color_to_string(color0)+", "+color_to_string(color1)+", "+src_code.f+");\n"
generated = true
var variant_index = generated_variants.find(uv)
if variant_index == -1:
variant_index = generated_variants.size()
generated_variants.append(uv)
rv.code = src_code.code+"vec3 "+name+"_"+str(variant_index)+"_rgb = mix("+color_to_string(color0)+", "+color_to_string(color1)+", "+src_code.f+");\n"
rv.f = src_code.f
rv.rgb = name+"_rgb"
rv.rgb = name+"_"+str(variant_index)+"_rgb"
return rv
func _get_state_variables():

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/colorize.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/colorize.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]
@ -11,10 +12,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 618.0
margin_top = 148.0
margin_right = 751.0
margin_bottom = 310.0
margin_left = 1.0
margin_top = 4.0
margin_right = 98.0
margin_bottom = 74.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -52,7 +53,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 24.0
margin_right = 117.0
margin_right = 81.0
margin_bottom = 44.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -80,7 +81,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 44.0
margin_right = 117.0
margin_right = 81.0
margin_bottom = 64.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false

View File

@ -11,8 +11,12 @@ func _ready():
func get_shader_code(uv):
var rv = { defs="", code="" }
if !generated:
if generated_variants.empty():
rv.defs = "float "+name+"_f(vec2 uv) { return iqnoise(uv, "+str(subdivide)+", "+str(u)+", "+str(v)+"); }\n"
generated = true
rv.f = name+"_f("+uv+")"
var variant_index = generated_variants.find(uv)
if variant_index == -1:
variant_index = generated_variants.size()
generated_variants.append(uv)
rv.code = "float "+name+"_"+str(variant_index)+"_f = "+name+"_f("+uv+");\n"
rv.f = name+"_"+str(variant_index)+"_f"
return rv

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/iqnoise.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/iqnoise.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]

View File

@ -5,7 +5,7 @@ func _ready():
set_slot(0, true, 0, Color(0.5, 0.5, 1), false, 0, Color(0.5, 0.5, 1))
func get_shader_code(uv):
var rv = { defs="", code="", rgb=null, f=null }
var rv = { defs="", code="" }
var src = get_source()
if src == null:
rv.code += "void fragment() {\n"

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/material.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/material.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]
@ -11,10 +12,8 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 550.0
margin_top = 226.0
margin_right = 683.0
margin_bottom = 419.0
margin_right = 84.0
margin_bottom = 43.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -46,7 +45,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 24.0
margin_right = 117.0
margin_right = 68.0
margin_bottom = 38.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false

View File

@ -10,8 +10,12 @@ func _ready():
func get_shader_code(uv):
var rv = { defs="", code="" }
if !generated:
if generated_variants.empty():
rv.defs = "float "+name+"_f(vec2 uv) { return perlin(uv, "+str(iterations)+", "+str(turbulence)+"); }\n"
generated = true
rv.f = name+"_f("+uv+")"
var variant_index = generated_variants.find(uv)
if variant_index == -1:
variant_index = generated_variants.size()
generated_variants.append(uv)
rv.code = "float "+name+"_"+str(variant_index)+"_f = "+name+"_f("+uv+");\n"
rv.f = name+"_"+str(variant_index)+"_f"
return rv

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/perlin.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/perlin.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]

View File

@ -0,0 +1,21 @@
tool
extends "res://addons/procedural_material/node_base.gd"
var waves = 1.0
var sharpness = 1.0
func _ready():
set_slot(0, false, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
initialize_properties([ $waves, $sharpness ])
func get_shader_code(uv):
var rv = { defs="", code="" }
if generated_variants.empty():
rv.defs = "float "+name+"_f(vec2 uv) { return sine(uv, "+str(waves)+", "+str(sharpness)+"); }\n"
var variant_index = generated_variants.find(uv)
if variant_index == -1:
variant_index = generated_variants.size()
generated_variants.append(uv)
rv.code = "float "+name+"_"+str(variant_index)+"_f = "+name+"_f("+uv+");\n"
rv.f = name+"_"+str(variant_index)+"_f"
return rv

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/sine.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/sine.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]
@ -97,8 +97,4 @@ _sections_unfolded = [ "Caret", "Placeholder" ]
[connection signal="close_request" from="." to="." method="queue_free"]
[connection signal="text_changed" from="waves" to="." method="_on_Count_text_changed"]
[connection signal="text_changed" from="sharpness" to="." method="_on_Sharpness_text_changed"]

View File

@ -8,7 +8,7 @@ func _ready():
initialize_properties([ $rotate ])
func get_shader_code(uv):
var rv = { defs="", code="", uv=null }
var rv = { defs="", code="" }
var src = get_source()
if src == null:
return rv
@ -16,8 +16,8 @@ func get_shader_code(uv):
var src_code = src.get_shader_code(rv.uv)
if !generated:
rv.defs = src_code.defs+"vec2 "+name+"_uv(vec2 uv) { return rotate(uv, "+str(angle)+"); }\n"
rv.code = src_code.code;
generated = true
rv.code = src_code.code;
if src_code.has("f"):
rv.f = src_code.f
if src_code.has("rgb"):

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/transform.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/nodes/transform.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]
@ -11,10 +11,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 329.0
margin_top = 117.0
margin_right = 462.0
margin_bottom = 279.0
margin_left = 1.0
margin_top = 1.0
margin_right = 134.0
margin_bottom = 163.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1

View File

@ -0,0 +1,35 @@
tool
extends "res://addons/procedural_material/node_base.gd"
var amount = 0.0
func _ready():
set_slot(0, true, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
set_slot(1, true, 0, Color(0.5, 0.5, 1), false, 0, Color(0.5, 0.5, 1))
initialize_properties([ $amount ])
func get_shader_code(uv):
var rv = { defs="", code="" }
var src0 = get_source(0)
var src1 = get_source(1)
if src0 == null || src1 == null:
return rv
var variant_index = generated_variants.find(uv)
if variant_index == -1:
variant_index = generated_variants.size()
generated_variants.append(uv)
var src1_code0 = src1.get_shader_code(uv+"+vec2(0.01, 0.0)")
var src1_code1 = src1.get_shader_code(uv+"-vec2(0.01, 0.0)")
var src1_code2 = src1.get_shader_code(uv+"+vec2(0.0, 0.01)")
var src1_code3 = src1.get_shader_code(uv+"-vec2(0.0, 0.01)")
rv.defs = src1_code0.defs
rv.code = src1_code0.code+src1_code1.code+src1_code2.code+src1_code3.code
rv.code += "vec2 "+name+"_"+str(variant_index)+"_uv = "+uv+"+"+str(amount)+"*vec2("+get_source_f(src1_code0)+"-"+get_source_f(src1_code1)+", "+get_source_f(src1_code2)+"-"+get_source_f(src1_code3)+");\n"
var src0_code = src0.get_shader_code(name+"_"+str(variant_index)+"_uv")
rv.defs += src0_code.defs
rv.code += src0_code.code
rv.code += "vec3 "+name+"_"+str(variant_index)+"_rgb = "+get_source_rgb(src0_code)+";\n"
rv.code += "float "+name+"_"+str(variant_index)+"_f = "+get_source_f(src0_code)+";\n"
rv.rgb = name+"_"+str(variant_index)+"_rgb"
rv.f = name+"_"+str(variant_index)+"_f"
return rv

View File

@ -0,0 +1,125 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/procedural_material/nodes/warp.gd" type="Script" id=1]
[sub_resource type="Theme" id=1]
[node name="Warp" type="GraphNode" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 1.0
margin_top = 1.0
margin_right = 91.0
margin_bottom = 84.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
theme = SubResource( 1 )
title = "Warp"
offset = Vector2( 0, 0 )
show_close = true
resizable = false
selected = false
comment = false
overlay = 0
slot/0/left_enabled = true
slot/0/left_type = 0
slot/0/left_color = Color( 0.5, 0.5, 1, 1 )
slot/0/right_enabled = true
slot/0/right_type = 0
slot/0/right_color = Color( 0.5, 0.5, 1, 1 )
slot/1/left_enabled = true
slot/1/left_type = 0
slot/1/left_color = Color( 0.5, 0.5, 1, 1 )
slot/1/right_enabled = false
slot/1/right_type = 0
slot/1/right_color = Color( 0.5, 0.5, 1, 1 )
slot/2/left_enabled = false
slot/2/left_type = 0
slot/2/left_color = Color( 1, 1, 1, 1 )
slot/2/right_enabled = false
slot/2/right_type = 0
slot/2/right_color = Color( 1, 1, 1, 1 )
script = ExtResource( 1 )
_sections_unfolded = [ "Theme" ]
[node name="Label1" type="Label" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 24.0
margin_right = 74.0
margin_bottom = 38.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Source"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="Label2" type="Label" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 38.0
margin_right = 74.0
margin_bottom = 52.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Displace"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="amount" type="LineEdit" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 16.0
margin_top = 53.0
margin_right = 74.0
margin_bottom = 77.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 1
size_flags_horizontal = 1
size_flags_vertical = 1
text = "0.5"
focus_mode = 2
context_menu_enabled = true
placeholder_alpha = 0.6
caret_blink = false
caret_blink_speed = 0.65
caret_position = 0
_sections_unfolded = [ "Caret", "Placeholder" ]
[connection signal="close_request" from="." to="." method="queue_free"]
[connection signal="text_changed" from="amount" to="." method="_on_Rotate_text_changed"]

View File

@ -11,6 +11,7 @@ const MENU = [
{ name="iqnoise", description="IQ Noise" },
{ name="perlin", description="Perlin noise" },
{ name="transform", description="Transform" },
{ name="warp", description="Warp" },
{ name="colorize", description="Colorize" },
{ name="blend", description="Blend" }
]
@ -30,7 +31,7 @@ func _on_PopupMenu_id_pressed(id):
if MENU[id].has("command"):
call(MENU[id].command)
elif MENU[id].has("name"):
node_type = load("res://addons/procedural_material/"+MENU[id].name+".tscn")
node_type = load("res://addons/procedural_material/nodes/"+MENU[id].name+".tscn")
if node_type != null:
var node = node_type.instance()
$GraphEdit.add_child(node)
@ -56,7 +57,7 @@ func load_file(filename):
var file = File.new()
if file.open(filename, File.READ) != OK:
return
var data = file.get_var()
var data = parse_json(file.get_as_text())
file.close()
$GraphEdit.clear_connections()
for c in $GraphEdit.get_children():
@ -64,7 +65,9 @@ func load_file(filename):
$GraphEdit.remove_child(c)
c.free()
for n in data.nodes:
var node_type = load("res://addons/procedural_material/"+n.type+".tscn")
if !n.has("type"):
continue
var node_type = load("res://addons/procedural_material/nodes/"+n.type+".tscn")
if node_type != null:
var node = node_type.instance()
node.name = n.name
@ -91,7 +94,7 @@ func save_file(filename):
data.connections = $GraphEdit.get_connection_list()
var file = File.new()
if file.open(filename, File.WRITE) == OK:
file.store_var(data)
file.store_string(to_json(data))
file.close()
func generate_shader():

View File

@ -2,7 +2,7 @@
[ext_resource path="res://addons/procedural_material/pm_editor.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/graph_edit.gd" type="Script" id=2]
[ext_resource path="res://addons/procedural_material/material.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/procedural_material/nodes/material.tscn" type="PackedScene" id=3]
[sub_resource type="Shader" id=1]
@ -100,11 +100,17 @@ float perlin(vec2 uv, int iterations, float turbulence) {
return f/m;
}
float Bricks_f(vec2 uv) { return bricks(uv, vec2(Null, Null), Null, Null, 0.2); }
float Perlin_f(vec2 uv) { return perlin(uv, 9, 0.5); }
float Bricks_f(vec2 uv) { return bricks(uv, vec2(3, 6), 0.5, 0.1, 0.1); }
void fragment() {
float Bricks_0_f = Bricks_f(UV);
vec3 Colorize_rgb = mix(vec3(0.859375,0.198059,0.198059), vec3(0.890625,0.330505,0.111328), Bricks_0_f);
vec3 Material_rgb = Colorize_rgb;
float Perlin_0_f = Perlin_f(UV+vec2(0.01, 0.0));
float Perlin_1_f = Perlin_f(UV-vec2(0.01, 0.0));
float Perlin_2_f = Perlin_f(UV+vec2(0.0, 0.01));
float Perlin_3_f = Perlin_f(UV-vec2(0.0, 0.01));
vec2 Warp_0_uv = UV+0.5*vec2(Perlin_0_f-Perlin_1_f, Perlin_2_f-Perlin_3_f);
float Bricks_0_f = Bricks_f(Warp_0_uv);
vec3 Warp_0_rgb = vec3(Bricks_0_f);
vec3 Material_rgb = Warp_0_rgb;
COLOR = vec4(Material_rgb, 1.0);
}
"
@ -156,10 +162,6 @@ _sections_unfolded = [ "Mouse" ]
[node name="Material" parent="GraphEdit" index="0" instance=ExtResource( 3 )]
margin_left = 0.0
margin_top = 0.0
margin_right = 84.0
margin_bottom = 43.0
_sections_unfolded = [ "Anchor", "Margin", "Mouse", "Theme", "slot" ]
[node name="PopupMenu" type="PopupMenu" parent="GraphEdit" index="1"]
@ -181,7 +183,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
popup_exclusive = false
items = [ "Load texture", null, 0, false, false, 0, 0, null, "", false, "Save texture", null, 0, false, false, 1, 0, null, "", false, "Sine", null, 0, false, false, 2, 0, null, "", false, "Bricks", null, 0, false, false, 3, 0, null, "", false, "IQ Noise", null, 0, false, false, 4, 0, null, "", false, "Perlin noise", null, 0, false, false, 5, 0, null, "", false, "Transform", null, 0, false, false, 6, 0, null, "", false, "Colorize", null, 0, false, false, 7, 0, null, "", false, "Blend", null, 0, false, false, 8, 0, null, "", false ]
items = [ "Load texture", null, 0, false, false, 0, 0, null, "", false, "Save texture", null, 0, false, false, 1, 0, null, "", false, "Sine", null, 0, false, false, 2, 0, null, "", false, "Bricks", null, 0, false, false, 3, 0, null, "", false, "IQ Noise", null, 0, false, false, 4, 0, null, "", false, "Perlin noise", null, 0, false, false, 5, 0, null, "", false, "Transform", null, 0, false, false, 6, 0, null, "", false, "Warp", null, 0, false, false, 7, 0, null, "", false, "Colorize", null, 0, false, false, 8, 0, null, "", false, "Blend", null, 0, false, false, 9, 0, null, "", false ]
hide_on_state_item_selection = false
_sections_unfolded = [ "Rect" ]

View File

@ -1,28 +0,0 @@
tool
extends "res://addons/procedural_material/node_base.gd"
var waves = 1.0
var sharpness = 1.0
func _ready():
set_slot(0, false, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
initialize_properties([ $waves, $sharpness ])
func get_shader_code(uv):
var rv = { defs="", code="", rgb=null, f=null }
if !generated:
rv.defs = "float "+name+"_f(vec2 uv) { return sine(uv, "+str(waves)+", "+str(sharpness)+"); }\n"
generated = true
rv.f = name+"_f("+uv+")"
return rv
func _on_Count_text_changed(new_text):
waves = float(new_text)
get_parent().get_parent().generate_shader()
func _on_Sharpness_text_changed(new_text):
sharpness = float(new_text)
get_parent().get_parent().generate_shader()
func _get_state_variables():
return [ "waves", "sharpness" ]

Binary file not shown.