1
0
mirror of https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git synced 2025-09-20 12:25:59 +08:00

Maths nodes refactored, Smoothmin and Smoothmax nodes added

This commit is contained in:
Digvijaysinh Gohil
2024-07-03 00:01:09 +05:30
parent 45ddc1f6a2
commit 3cf0e2d38a
14 changed files with 191 additions and 40 deletions

View File

@ -62,6 +62,10 @@ func _get_property_name(index: int) -> String:
func _get_property_options(index: int) -> PackedStringArray:
return ["Vector2", "Vector3"]
func _get_global_code(mode: Shader.Mode) -> String:
var code: String = preload("Project.gdshaderinc").code
return code
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
var vector_a: String = input_vars[0]
var vector_b: String = input_vars[1]
@ -69,6 +73,6 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
match vector_index:
0:
return output_vars[0] + " = vec2(%s.xy) * (dot(%s.xy, %s.xy) / dot(%s.xy, %s.xy));" % [vector_b, vector_a, vector_b, vector_b, vector_b]
return output_vars[0] + " = project_2d(%s, %s);" % [vector_a, vector_b]
_:
return output_vars[0] + " = %s * (dot(%s, %s) / dot(%s, %s));" % [vector_b, vector_a, vector_b, vector_b, vector_b]
return output_vars[0] + " = project_3d(%s, %s);" % [vector_a, vector_b]