跳转至

VisualShader

继承

Shader

简要描述

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

描述

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

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

成员

类型 属性名 默认值
String code "shader_type spatial;void vertex()
Vector2 graph_offset Vector2( 0, 0 )

方法

返回值类型 方法名称
void add_node(type: int, node: VisualShaderNode, position: Vector2, id: int)
bool can_connect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int) const
int connect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int)
void connect_nodes_forced(type: int, from_node: int, from_port: int, to_node: int, to_port: int)
void disconnect_nodes(type: int, from_node: int, from_port: int, to_node: int, to_port: int)
VisualShaderNode get_node(type: int, id: int) const
Array get_node_connections(type: int) const
PoolIntArray get_node_list(type: int) const
Vector2 get_node_position(type: int, id: int) const
int get_valid_node_id(type: int) const
bool is_node_connection(type: int, from_node: int, from_port: int, to_node: int, to_port: int) const
void remove_node(type: int, id: int)
void set_mode(mode: int)
void set_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}"
setter set_code(value)
getter get_code
  • Vector2 graph_offset
Default Vector2( 0, 0 )
setter set_graph_offset(value)
getter get_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)