mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-04-12 17:22:00 +02:00
Value node.
This commit is contained in:
parent
0cd3f2d8db
commit
98ade190f9
@ -1,6 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=42 format=2]
|
[gd_resource type="Resource" load_steps=48 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_material.gd" type="Script" id=1]
|
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_material.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://addons/mat_maker_gd/nodes/noise/noise.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://addons/mat_maker_gd/nodes/noise/value.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://addons/mat_maker_gd/nodes/simple/shape.gd" type="Script" id=4]
|
[ext_resource path="res://addons/mat_maker_gd/nodes/simple/shape.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_node_universal_property.gd" type="Script" id=5]
|
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_node_universal_property.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://addons/mat_maker_gd/nodes/other/output_image.gd" type="Script" id=6]
|
[ext_resource path="res://addons/mat_maker_gd/nodes/other/output_image.gd" type="Script" id=6]
|
||||||
@ -47,7 +49,7 @@ sides = 11
|
|||||||
radius = SubResource( 4 )
|
radius = SubResource( 4 )
|
||||||
edge = SubResource( 3 )
|
edge = SubResource( 3 )
|
||||||
|
|
||||||
[sub_resource type="Resource" id=40]
|
[sub_resource type="Resource" id=43]
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
default_type = 5
|
default_type = 5
|
||||||
default_int = 0
|
default_int = 0
|
||||||
@ -59,7 +61,7 @@ default_color = Color( 0, 0, 0, 1 )
|
|||||||
[sub_resource type="Resource" id=6]
|
[sub_resource type="Resource" id=6]
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
graph_position = Vector2( 300, -400 )
|
graph_position = Vector2( 300, -400 )
|
||||||
image = SubResource( 40 )
|
image = SubResource( 43 )
|
||||||
postfix = "-test"
|
postfix = "-test"
|
||||||
|
|
||||||
[sub_resource type="Resource" id=9]
|
[sub_resource type="Resource" id=9]
|
||||||
@ -288,7 +290,40 @@ bevel = SubResource( 29 )
|
|||||||
roundness = SubResource( 38 )
|
roundness = SubResource( 38 )
|
||||||
corner = 0.3
|
corner = 0.3
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id=41]
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
default_type = 5
|
||||||
|
default_int = 0
|
||||||
|
default_float = 0.0
|
||||||
|
default_vector2 = Vector2( 0, 0 )
|
||||||
|
default_vector3 = Vector3( 0, 0, 0 )
|
||||||
|
default_color = Color( 0, 0, 0, 1 )
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id=42]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
graph_position = Vector2( 380, -220 )
|
||||||
|
image = SubResource( 41 )
|
||||||
|
grid_size = 64
|
||||||
|
density = 0.3
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id=44]
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
default_type = 5
|
||||||
|
default_int = 0
|
||||||
|
default_float = 0.0
|
||||||
|
default_vector2 = Vector2( 0, 0 )
|
||||||
|
default_vector3 = Vector3( 0, 0, 0 )
|
||||||
|
default_color = Color( 0, 0, 0, 1 )
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id=45]
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
graph_position = Vector2( 580, -220 )
|
||||||
|
image = SubResource( 44 )
|
||||||
|
scale = Vector2( 4.4, 4.2 )
|
||||||
|
iterations = 3
|
||||||
|
persistence = 0.5
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
image_size = Vector2( 128, 128 )
|
image_size = Vector2( 128, 128 )
|
||||||
nodes = [ SubResource( 5 ), SubResource( 6 ), SubResource( 12 ), SubResource( 15 ), SubResource( 18 ), SubResource( 21 ), SubResource( 24 ), SubResource( 27 ), SubResource( 39 ) ]
|
nodes = [ SubResource( 5 ), SubResource( 6 ), SubResource( 12 ), SubResource( 15 ), SubResource( 18 ), SubResource( 21 ), SubResource( 24 ), SubResource( 27 ), SubResource( 39 ), SubResource( 42 ), SubResource( 45 ) ]
|
||||||
|
@ -3,36 +3,39 @@ extends MMNode
|
|||||||
|
|
||||||
var NoisePerlin = preload("res://addons/mat_maker_gd/nodes/common/noise_perlin.gd")
|
var NoisePerlin = preload("res://addons/mat_maker_gd/nodes/common/noise_perlin.gd")
|
||||||
|
|
||||||
var image : Image
|
export(Resource) var image : Resource
|
||||||
var tex : ImageTexture
|
|
||||||
|
|
||||||
export(Vector2) var scale : Vector2 = Vector2(4, 4)
|
export(Vector2) var scale : Vector2 = Vector2(4, 4)
|
||||||
export(int) var iterations : int = 3
|
export(int) var iterations : int = 3
|
||||||
export(float) var persistence : float = 0.5
|
export(float) var persistence : float = 0.5
|
||||||
|
|
||||||
func get_value_for(uv : Vector2, pseed : int) -> Color:
|
func _init_properties():
|
||||||
return NoisePerlin.perlinc(uv, scale, iterations, persistence, pseed)
|
if !image:
|
||||||
|
image = MMNodeUniversalProperty.new()
|
||||||
|
image.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_IMAGE
|
||||||
|
|
||||||
|
image.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_IMAGE
|
||||||
|
|
||||||
|
register_output_property(image)
|
||||||
|
|
||||||
func _register_methods(mm_graph_node) -> void:
|
func _register_methods(mm_graph_node) -> void:
|
||||||
mm_graph_node.add_slot_int("get_iterations", "set_iterations", "iterations")#, Vector2(1, 10))
|
mm_graph_node.add_slot_texture_universal(image)
|
||||||
mm_graph_node.add_slot_float("get_persistence", "set_persistence", "persistence", 0.05)#, Vector2(0, 1))
|
mm_graph_node.add_slot_vector2("get_scale", "set_scale", "Scale")#, Vector2(1, 10))
|
||||||
mm_graph_node.add_slot_vector2("get_scale", "set_scale", "scale", 1)#, Vector2(1, 32))
|
mm_graph_node.add_slot_int("get_iterations", "set_iterations", "Iterations")#, Vector2(0, 1))
|
||||||
|
mm_graph_node.add_slot_float("get_persistence", "set_persistence", "Persistence", 0.01)#, Vector2(0, 1))
|
||||||
|
|
||||||
func get_iterations() -> int:
|
func get_value_for(uv : Vector2, pseed : int) -> Color:
|
||||||
return iterations
|
var ps : float = 1.0 / float(pseed)
|
||||||
|
|
||||||
func set_iterations(val : int) -> void:
|
#perlin($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))
|
||||||
iterations = val
|
var f : float = NoisePerlin.perlin(uv, scale, iterations, persistence, pseed)
|
||||||
|
|
||||||
emit_changed()
|
return Color(f, f, f, 1)
|
||||||
|
|
||||||
func get_persistence() -> float:
|
func _render(material) -> void:
|
||||||
return persistence
|
var img : Image = render_image(material)
|
||||||
|
|
||||||
func set_persistence(val : float) -> void:
|
image.set_value(img)
|
||||||
persistence = val
|
|
||||||
|
|
||||||
emit_changed()
|
|
||||||
|
|
||||||
func get_scale() -> Vector2:
|
func get_scale() -> Vector2:
|
||||||
return scale
|
return scale
|
||||||
@ -40,4 +43,20 @@ func get_scale() -> Vector2:
|
|||||||
func set_scale(val : Vector2) -> void:
|
func set_scale(val : Vector2) -> void:
|
||||||
scale = val
|
scale = val
|
||||||
|
|
||||||
emit_changed()
|
set_dirty(true)
|
||||||
|
|
||||||
|
func get_iterations() -> int:
|
||||||
|
return iterations
|
||||||
|
|
||||||
|
func set_iterations(val : int) -> void:
|
||||||
|
iterations = val
|
||||||
|
|
||||||
|
set_dirty(true)
|
||||||
|
|
||||||
|
func get_persistence() -> float:
|
||||||
|
return persistence
|
||||||
|
|
||||||
|
func set_persistence(val : float) -> void:
|
||||||
|
persistence = val
|
||||||
|
|
||||||
|
set_dirty(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user