mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
sdf3d_op_revolution and extrusion nodes.
This commit is contained in:
parent
182034fd82
commit
1c988c54ed
@ -1,12 +1,16 @@
|
||||
[gd_resource type="Resource" load_steps=23 format=2]
|
||||
[gd_resource type="Resource" load_steps=38 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/sdf3d/sdf3d_shape_sphere.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_render.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_morph.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/sdf3d/sdf3d_op_extrusion.gd" type="Script" id=6]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_tf_rotate.gd" type="Script" id=7]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_revolution.gd" type="Script" id=8]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/simple/image.gd" type="Script" id=10]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_box.gd" type="Script" id=11]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf2d/sd_shape_circle.gd" type="Script" id=14]
|
||||
|
||||
[sub_resource type="Resource" id=23]
|
||||
script = ExtResource( 5 )
|
||||
@ -23,7 +27,7 @@ graph_position = Vector2( 1020, 100 )
|
||||
image = SubResource( 23 )
|
||||
image_path = "/home/relintai/Projects/broken_seals/game/icon.png"
|
||||
|
||||
[sub_resource type="Resource" id=51]
|
||||
[sub_resource type="Resource" id=57]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
default_int = 0
|
||||
@ -40,7 +44,7 @@ default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
input_property = SubResource( 51 )
|
||||
input_property = SubResource( 57 )
|
||||
|
||||
[sub_resource type="Resource" id=27]
|
||||
script = ExtResource( 5 )
|
||||
@ -71,7 +75,7 @@ default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=30]
|
||||
script = ExtResource( 3 )
|
||||
graph_position = Vector2( 340, 140 )
|
||||
graph_position = Vector2( 460, 140 )
|
||||
input = SubResource( 26 )
|
||||
out_height_map = SubResource( 28 )
|
||||
out_normal_map = SubResource( 29 )
|
||||
@ -128,6 +132,15 @@ default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
input_property = SubResource( 52 )
|
||||
|
||||
[sub_resource type="Resource" id=51]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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=56]
|
||||
script = ExtResource( 4 )
|
||||
graph_position = Vector2( 40, 300 )
|
||||
@ -136,7 +149,91 @@ input2 = SubResource( 55 )
|
||||
output = SubResource( 51 )
|
||||
amount = 0.6
|
||||
|
||||
[sub_resource type="Resource" id=58]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
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=59]
|
||||
script = ExtResource( 14 )
|
||||
graph_position = Vector2( -240, -60 )
|
||||
output = SubResource( 58 )
|
||||
center = Vector2( 0, 0 )
|
||||
radius = 0.1
|
||||
|
||||
[sub_resource type="Resource" id=60]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
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=61]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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=62]
|
||||
script = ExtResource( 8 )
|
||||
graph_position = Vector2( 20, -40 )
|
||||
input = SubResource( 60 )
|
||||
output = SubResource( 61 )
|
||||
offset = 0.4
|
||||
|
||||
[sub_resource type="Resource" id=63]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
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 )
|
||||
input_property = SubResource( 58 )
|
||||
|
||||
[sub_resource type="Resource" id=64]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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=65]
|
||||
script = ExtResource( 6 )
|
||||
graph_position = Vector2( 20, 120 )
|
||||
input = SubResource( 63 )
|
||||
output = SubResource( 64 )
|
||||
length = 0.3
|
||||
|
||||
[sub_resource type="Resource" id=66]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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 )
|
||||
input_property = SubResource( 64 )
|
||||
|
||||
[sub_resource type="Resource" id=67]
|
||||
script = ExtResource( 7 )
|
||||
graph_position = Vector2( 260, -40 )
|
||||
input = SubResource( 66 )
|
||||
output = SubResource( 57 )
|
||||
rotation = Vector3( 30, 30, 30 )
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
image_size = Vector2( 128, 128 )
|
||||
nodes = [ SubResource( 24 ), SubResource( 30 ), SubResource( 50 ), SubResource( 53 ), SubResource( 56 ) ]
|
||||
nodes = [ SubResource( 24 ), SubResource( 30 ), SubResource( 50 ), SubResource( 53 ), SubResource( 56 ), SubResource( 59 ), SubResource( 62 ), SubResource( 65 ), SubResource( 67 ) ]
|
||||
|
63
game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_extrusion.gd
Normal file
63
game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_extrusion.gd
Normal file
@ -0,0 +1,63 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
var SDF3D = preload("res://addons/mat_maker_gd/nodes/common/sdf3d.gd")
|
||||
|
||||
export(Resource) var input : Resource
|
||||
export(Resource) var output : Resource
|
||||
export(float) var length : float = 0.25
|
||||
|
||||
func _init_properties():
|
||||
if !input:
|
||||
input = MMNodeUniversalProperty.new()
|
||||
input.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
|
||||
input.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
|
||||
# input.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
input.slot_name = ">>> Input "
|
||||
|
||||
if !input.is_connected("changed", self, "on_input_changed"):
|
||||
input.connect("changed", self, "on_input_changed")
|
||||
|
||||
if !output:
|
||||
output = MMNodeUniversalProperty.new()
|
||||
output.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR2
|
||||
|
||||
output.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
output.slot_name = ">>> Output >>>"
|
||||
output.get_value_from_owner = true
|
||||
|
||||
register_input_property(input)
|
||||
register_output_property(output)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_label_universal(input)
|
||||
mm_graph_node.add_slot_label_universal(output)
|
||||
|
||||
mm_graph_node.add_slot_float("get_length", "set_length", "Length", 0.01)
|
||||
|
||||
func get_property_value_sdf3d(uv3 : Vector3) -> Vector2:
|
||||
#vec2 $(name_uv)_w = vec2($in($uv.xz+vec2(0.5)),abs($uv.y)-$d);
|
||||
#ret min(max($(name_uv)_w.x,$(name_uv)_w.y),0.0)+length(max($(name_uv)_w,0.0))
|
||||
|
||||
var f : float = input.get_value(Vector2(uv3.x, uv3.z) + Vector2(0.5, 0.5))
|
||||
var w : Vector2 = Vector2(f, abs(uv3.y) - length)
|
||||
|
||||
var ff : float = min(max(w.x,w.y),0.0) + Commons.maxv2(w, Vector2()).length()
|
||||
|
||||
return Vector2(ff, 0)
|
||||
|
||||
#length
|
||||
func get_length() -> float:
|
||||
return length
|
||||
|
||||
func set_length(val : float) -> void:
|
||||
length = val
|
||||
|
||||
emit_changed()
|
||||
output.emit_changed()
|
||||
|
||||
func on_input_changed() -> void:
|
||||
emit_changed()
|
||||
output.emit_changed()
|
60
game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_revolution.gd
Normal file
60
game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_revolution.gd
Normal file
@ -0,0 +1,60 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
var SDF3D = preload("res://addons/mat_maker_gd/nodes/common/sdf3d.gd")
|
||||
|
||||
export(Resource) var input : Resource
|
||||
export(Resource) var output : Resource
|
||||
export(float) var offset : float = 0.25
|
||||
|
||||
func _init_properties():
|
||||
if !input:
|
||||
input = MMNodeUniversalProperty.new()
|
||||
input.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
|
||||
input.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
|
||||
# input.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
input.slot_name = ">>> Input "
|
||||
|
||||
if !input.is_connected("changed", self, "on_input_changed"):
|
||||
input.connect("changed", self, "on_input_changed")
|
||||
|
||||
if !output:
|
||||
output = MMNodeUniversalProperty.new()
|
||||
output.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR2
|
||||
|
||||
output.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
output.slot_name = ">>> Output >>>"
|
||||
output.get_value_from_owner = true
|
||||
|
||||
register_input_property(input)
|
||||
register_output_property(output)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_label_universal(input)
|
||||
mm_graph_node.add_slot_label_universal(output)
|
||||
|
||||
mm_graph_node.add_slot_float("get_offset", "set_offset", "Offset", 0.01)
|
||||
|
||||
func get_property_value_sdf3d(uv3 : Vector3) -> Vector2:
|
||||
#vec2 $(name_uv)_q = vec2(length($uv.xy) - $d + 0.5, $uv.z + 0.5);
|
||||
|
||||
var uv : Vector2 = Vector2(Vector2(uv3.x, uv3.y).length() - offset + 0.5, uv3.z + 0.5)
|
||||
var f : float = input.get_value(uv)
|
||||
|
||||
return Vector2(f, 0)
|
||||
|
||||
#offset
|
||||
func get_offset() -> float:
|
||||
return offset
|
||||
|
||||
func set_offset(val : float) -> void:
|
||||
offset = val
|
||||
|
||||
emit_changed()
|
||||
output.emit_changed()
|
||||
|
||||
func on_input_changed() -> void:
|
||||
emit_changed()
|
||||
output.emit_changed()
|
Loading…
Reference in New Issue
Block a user