VisualShader

Inherits: Shader < Resource < Reference < Object

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

描述

此类允许你自定义着色器程序,可以用于各种材质来渲染对象。

可视化着色器编辑器会创建着色器。

属性

Vector2

graph_offset

Vector2( 0, 0 )

方法

void

add_node ( Type type, VisualShaderNode node, Vector2 position, int id )

bool

can_connect_nodes ( Type type, int from_node, int from_port, int to_node, int to_port ) const

Error

connect_nodes ( Type type, int from_node, int from_port, int to_node, int to_port )

void

connect_nodes_forced ( Type type, int from_node, int from_port, int to_node, int to_port )

void

disconnect_nodes ( Type type, int from_node, int from_port, int to_node, int to_port )

VisualShaderNode

get_node ( Type type, int id ) const

Array

get_node_connections ( Type type ) const

PoolIntArray

get_node_list ( Type type ) const

Vector2

get_node_position ( Type type, int id ) const

int

get_valid_node_id ( Type type ) const

bool

is_node_connection ( Type type, int from_node, int from_port, int to_node, int to_port ) const

void

remove_node ( Type type, int id )

void

set_mode ( Mode mode )

void

set_node_position ( Type type, int id, Vector2 position )

枚举

enum Type:

  • TYPE_VERTEX = 0 —- 顶点着色器,对顶点进行操作。

  • TYPE_FRAGMENT = 1 —- 片段着色器,对片段(像素)进行操作。

  • TYPE_LIGHT = 2 —- 用于光线计算的着色器。

  • TYPE_MAX = 3 —- 表示 Type 枚举的大小。

常量

  • NODE_ID_INVALID = -1

  • NODE_ID_OUTPUT = 0

属性说明

Default

Vector2( 0, 0 )

Setter

set_graph_offset(value)

Getter

get_graph_offset()

整个图的偏移向量。

方法说明

将指定节点添加到着色器中。


如果指定节点和端口可以连接在一起,则返回true


连接指定的节点和端口。


  • void connect_nodes_forced ( Type type, int from_node, int from_port, int to_node, int to_port )

连接指定的节点和端口,即使它们无法连接。这样的连接是无效的,将不能正常工作。


  • void disconnect_nodes ( Type type, int from_node, int from_port, int to_node, int to_port )

连接指定的节点和端口。


返回具有指定typeid的着色器节点实例。


  • Array get_node_connections ( Type type ) const

返回具有指定类型的连接节点的列表。


返回着色器中具有指定类型的所有节点的列表。


返回指定节点在着色器图中的位置。


  • int get_valid_node_id ( Type type ) const

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

如果指定的节点和端口连接存在,返回true


  • void remove_node ( Type type, int id )

从着色器中删除指定的节点。


  • void set_mode ( Mode mode )

设置该着色器的模式。


设置指定节点的位置。