跳到主要内容

VisualShader

继承

Shader

简要描述

具有可视编辑器的自定义着色器程序。

描述

此类允许您定义自定义着色器程序,该程序可用于各种材质来渲染场景中的对象。

可视着色器编辑器可以用来创建着色器。

成员

类型属性名默认值
Stringcode"shader_type spatial;void vertex() {//Output:0}void fragment() {//Output:0}void light() {//Output:0}"
Vector2graph_offsetVector2( 0, 0 )

方法

返回值类型方法名称
voidadd_node(type: int, node: VisualShaderNode, position: Vector2, id: int)
boolcan_connect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int) const
intconnect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int)
voidconnect_nodes_forced(type: int, from_node: int, from_port: int, to_node: int, to_port: int)
voiddisconnect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int)
VisualShaderNodeget_node(type: int, id: int) const
Arrayget_node_connections(type: int) const
PoolIntArrayget_node_list(type: int) const
Vector2get_node_position(type: int, id: int) const
intget_valid_node_id(type: int) const
boolis_node_connection(type: int, from_node: int, from_port: int, to_node: int, to_port: int) const
voidremove_node(type: int, id: int)
voidset_mode(mode: int)
voidset_node_position(type: int, id: int, position: Vector2)

枚举

enum Type:

  • **TYPE_VERTEX = 0**
  • **TYPE_FRAGMENT = 1**
  • **TYPE_LIGHT = 2**
  • **TYPE_MAX = 3**

表示Type枚举的大小。


常量

  • **NODE_ID_INVALID = -1**
  • **NODE_ID_OUTPUT = 0**

成员说明

  • String code
Default"shader_type spatial;void vertex() {//Output:0}void fragment() {//Output:0}void light() {//Output:0}"
setterset_code(value)
getterget_code
  • Vector2 graph_offset
DefaultVector2( 0, 0 )
setterset_graph_offset(value)
getterget_graph_offset

方法说明

  • add_node add_node(type: int, node: VisualShaderNode, position: Vector2, id: int)

  • can_connect_nodes can_connect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int) const

  • connect_nodes connect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int)

  • connect_nodes_forced connect_nodes_forced(type: int, from_node: int, from_port: int, to_node: int, to_port: int)

  • disconnect_nodes disconnect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int)

  • get_node get_node(type: int, id: int) const

  • get_node_connections get_node_connections(type: int) const

  • get_node_list get_node_list(type: int) const

  • get_node_position get_node_position(type: int, id: int) const

  • get_valid_node_id get_valid_node_id(type: int) const

  • is_node_connection is_node_connection(type: int, from_node: int, from_port: int, to_node: int, to_port: int) const

  • remove_node remove_node(type: int, id: int)

  • set_mode set_mode(mode: int)

  • set_node_position set_node_position(type: int, id: int, position: Vector2)