1
0
mirror of https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git synced 2025-01-07 01:43:35 +08:00

Issue #2 resolved

This commit is contained in:
Digvijaysinh Gohil 2024-01-12 16:53:06 +05:30
parent a0aaf91ef3
commit 4205904cb5
20 changed files with 179 additions and 70 deletions

View File

@ -1,9 +1,6 @@
@tool
class_name VisualShaderNodeVectorTransform extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(0, Vector3(0.0, 0.0, 0.0))
func _get_name() -> String:
return "VectorTransform"
@ -25,6 +22,13 @@ func _get_input_port_name(port: int) -> String:
func _get_input_port_type(port: int) -> PortType:
return PORT_TYPE_VECTOR_3D
func _get_input_port_default_value(port: int) -> Variant:
match port:
0:
return Vector3(0.0, 0.0, 0.0)
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -1,9 +1,6 @@
@tool
class_name VisualShaderNodeMathsNoiseSineWave extends VisualShaderNodeCustom
func _init() -> void:
set_input_port_default_value(1, Vector2(0.0, 1.0))
func _get_name() -> String:
return "NoiseSineWave"
@ -34,6 +31,13 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_VECTOR_2D
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(0.0, 1.0)
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeProceduralCheckerBoard extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0))
_set_input_port_default_value(2, Vector3(0.4, 0.4, 0.4))
_set_input_port_default_value(3, Vector2(1.0, 1.0))
output_port_for_preview = 0
func _get_name() -> String:
@ -43,6 +39,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_VECTOR_3D
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector3(1.0, 1.0, 1.0)
2:
return Vector3(0.4, 0.4, 0.4)
3:
return Vector2(1.0, 1.0)
_:
return null
func _get_output_port_count() -> int:
return 1
@ -66,4 +73,4 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
var color_b: String = input_vars[2]
var frequency: String = input_vars[3]
return output_vars[0] + " = checker_board(%s, %s, %s, %s);" % [uv, color_a, color_b, frequency]
return output_vars[0] + " = checker_board(%s, %s.xyz, %s.xyz, %s);" % [uv, color_a, color_b, frequency]

View File

@ -2,8 +2,6 @@
class_name VisualShaderNodeProceduralGradientNoise extends VisualShaderNodeCustom
func _init() -> void:
set_input_port_default_value(1, 10.0)
output_port_for_preview = 0
func _get_name() -> String:
@ -37,6 +35,13 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return 10.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,7 +2,6 @@
class_name VisualShaderNodePseudoRandomNoise extends VisualShaderNodeCustom
func _init() -> void:
set_input_port_default_value(0, 0.0)
output_port_for_preview = 0
func _get_name() -> String:
@ -26,6 +25,13 @@ func _get_input_port_name(port: int) -> String:
func _get_input_port_type(port: int) -> PortType:
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
0:
return 0.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,8 +2,6 @@
class_name VisualShaderNodeProceduralSimpleNoise extends VisualShaderNodeCustom
func _init() -> void:
set_input_port_default_value(1, 10.0)
output_port_for_preview = 0
func _get_name() -> String:
@ -37,6 +35,13 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return 10.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,9 +2,6 @@
class_name VisualShaderNodeProceduralVoronoi extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 5.0)
_set_input_port_default_value(2, 2.0)
output_port_for_preview = 0
func _get_name() -> String:
@ -40,6 +37,15 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return 5.0
2:
return 2.0
_:
return null
func _get_output_port_count() -> int:
return 2

View File

@ -2,9 +2,6 @@
class_name VisualShaderNodeProceduralEllipse extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 0.5)
_set_input_port_default_value(2, 0.5)
output_port_for_preview = 0
func _get_name() -> String:
@ -40,6 +37,13 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1, 2:
return 0.5
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeProceduralPolygon extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 3)
_set_input_port_default_value(2, 0.5)
_set_input_port_default_value(3, 0.5)
output_port_for_preview = 0
func _get_name() -> String:
@ -45,6 +41,15 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return 3
2, 3:
return 0.5
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,9 +2,6 @@
class_name VisualShaderNodeProceduralRectangle extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 0.5)
_set_input_port_default_value(2, 0.5)
output_port_for_preview = 0
func _get_name() -> String:
@ -40,6 +37,13 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1, 2:
return 0.5
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,11 +2,6 @@
class_name VisualShaderNodeProceduralRoundedPolygon extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 0.5)
_set_input_port_default_value(2, 0.5)
_set_input_port_default_value(3, 3)
_set_input_port_default_value(4, 1.0)
output_port_for_preview = 0
func _get_name() -> String:
@ -45,6 +40,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
_:
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1, 2:
return 0.5
3:
return 3
4:
return 1.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeProceduralRoundedRectangle extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 0.5)
_set_input_port_default_value(2, 0.5)
_set_input_port_default_value(3, 1.0)
output_port_for_preview = 0
func _get_name() -> String:
@ -43,6 +39,15 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1, 2:
return 0.5
3:
return 1.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,12 +2,6 @@
class_name VisualShaderNodeUVFlipbook extends VisualShaderNodeCustom
func _init() -> void:
set_input_port_default_value(1, 1)
set_input_port_default_value(2, 1)
set_input_port_default_value(3, 0)
set_input_port_default_value(4, 0)
set_input_port_default_value(5, 0.1)
set_output_port_for_preview(0)
func _get_name() -> String:
@ -51,6 +45,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1, 2:
return 1
3, 4:
return 0
5:
return 0.1
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -1,9 +1,6 @@
@tool
class_name VisualShaderNodeUVParallaxMapping extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, 1.0)
func _get_name() -> String:
return "ParallaxMapping"
@ -34,6 +31,13 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
_:
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return 1.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeUVRadialShear extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector2(0.5, 0.5))
_set_input_port_default_value(2, 10.0)
_set_input_port_default_value(3, Vector2(0.0, 0.0))
set_output_port_for_preview(0)
func _get_name() -> String:
@ -43,6 +39,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(0.5, 0.5)
2:
return 10.0
3:
return Vector2(0.0, 0.0)
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeUVRotate extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector2(0.5, 0.5))
_set_input_port_default_value(2, 0.0)
_set_input_port_default_value(3, false)
set_output_port_for_preview(0)
func _get_name() -> String:
@ -41,6 +37,15 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(0.5, 0.5)
2:
return 0.0
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeUVSpherize extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector2(0.5, 0.5));
_set_input_port_default_value(2, 10.0);
_set_input_port_default_value(3, Vector2(0.0, 0.0));
set_output_port_for_preview(0)
func _get_name() -> String:
@ -43,6 +39,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(0.5, 0.5)
2:
return 10.0
3:
return Vector2(0.0, 0.0)
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeUVSwirl extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector2(0.5, 0.5))
_set_input_port_default_value(2, 10.0)
_set_input_port_default_value(3, Vector2(0.0, 0.0))
output_port_for_preview = 0
func _get_name() -> String:
@ -43,6 +39,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(0.5, 0.5)
2:
return 10.0
3:
return Vector2(0.0, 0.0)
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,9 +2,6 @@
class_name VisualShaderNodeUVTilingAndOffset extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector2(1.0, 1.0))
_set_input_port_default_value(2, Vector2(0.0, 0.0))
output_port_for_preview = 0
func _get_name() -> String:
@ -38,6 +35,15 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_VECTOR_2D
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(1.0, 1.0)
2:
return Vector2(0.0, 0.0)
_:
return null
func _get_output_port_count() -> int:
return 1

View File

@ -2,10 +2,6 @@
class_name VisualShaderNodeUVTwirl extends VisualShaderNodeCustom
func _init() -> void:
_set_input_port_default_value(1, Vector2(0.5, 0.5))
_set_input_port_default_value(2, 10.0)
_set_input_port_default_value(3, Vector2(0.0, 0.0))
output_port_for_preview = 0
func _get_name() -> String:
@ -43,6 +39,17 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
return PORT_TYPE_SCALAR
return PORT_TYPE_SCALAR
func _get_input_port_default_value(port: int) -> Variant:
match port:
1:
return Vector2(0.5, 0.5)
2:
return 10.0
3:
return Vector2(0.0, 0.0)
_:
return null
func _get_output_port_count() -> int:
return 1