mirror of
https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git
synced 2025-01-05 00:53:36 +08:00
RotateUV node updated
- RotateUV node now has a much intuitive dropdown for Degrees and Radians.
This commit is contained in:
parent
7a212d261a
commit
64dead8a82
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Digvijaysinh Gohil
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -21,7 +21,7 @@ func _get_return_icon_type() -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
func _get_input_port_count() -> int:
|
func _get_input_port_count() -> int:
|
||||||
return 4
|
return 3
|
||||||
|
|
||||||
func _get_input_port_name(port: int) -> String:
|
func _get_input_port_name(port: int) -> String:
|
||||||
match port:
|
match port:
|
||||||
@ -31,8 +31,6 @@ func _get_input_port_name(port: int) -> String:
|
|||||||
return "center"
|
return "center"
|
||||||
2:
|
2:
|
||||||
return "rotation"
|
return "rotation"
|
||||||
3:
|
|
||||||
return "use degrees"
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
|
func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
|
||||||
@ -41,8 +39,6 @@ func _get_input_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
2:
|
2:
|
||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
3:
|
|
||||||
return PORT_TYPE_BOOLEAN
|
|
||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_output_port_count() -> int:
|
func _get_output_port_count() -> int:
|
||||||
@ -54,6 +50,18 @@ func _get_output_port_name(port: int) -> String:
|
|||||||
func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
|
func _get_property_count() -> int:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
func _get_property_default_index(index: int) -> int:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
func _get_property_name(index: int) -> String:
|
||||||
|
return "Units"
|
||||||
|
|
||||||
|
func _get_property_options(index: int) -> PackedStringArray:
|
||||||
|
return ["Degrees", "Radians"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
var code: String = preload("RotateUV.gdshaderinc").code
|
var code: String = preload("RotateUV.gdshaderinc").code
|
||||||
return code
|
return code
|
||||||
@ -72,6 +80,6 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
|
|||||||
|
|
||||||
var center: String = input_vars[1]
|
var center: String = input_vars[1]
|
||||||
var rotation: String = input_vars[2]
|
var rotation: String = input_vars[2]
|
||||||
var use_degrees: String = input_vars[3]
|
var use_degrees: String = "true" if get_option_index(0) == 0 else "false"
|
||||||
|
|
||||||
return output_vars[0] + " = rotate_uv(%s, %s, %s, %s);" % [uv, center, rotation, use_degrees]
|
return output_vars[0] + " = rotate_uv(%s, %s, %s, %s);" % [uv, center, rotation, use_degrees]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user