VisualShader
Inherits: Shader < Resource < Reference < Object
带有可视化编辑器的自定义着色器程序。
描述
此类允许你自定义着色器程序,可以用于各种材质来渲染对象。
可视化着色器编辑器会创建着色器。
属性
|
方法
void | add_node ( Type type, VisualShaderNode node, Vector2 position, int id ) |
can_connect_nodes ( Type type, int from_node, int from_port, int to_node, int to_port ) const | |
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 ) |
get_node_connections ( Type type ) const | |
get_node_list ( Type type ) const | |
get_node_position ( Type type, int id ) const | |
get_valid_node_id ( Type type ) const | |
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 | |
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
属性说明
- Vector2 graph_offset
Default |
|
Setter | set_graph_offset(value) |
Getter | get_graph_offset() |
整个图的偏移向量。
方法说明
- void add_node ( Type type, VisualShaderNode node, Vector2 position, int id )
将指定节点添加到着色器中。
如果指定节点和端口可以连接在一起,则返回true
。
连接指定的节点和端口。
连接指定的节点和端口,即使它们无法连接。这样的连接是无效的,将不能正常工作。
连接指定的节点和端口。
- VisualShaderNode get_node ( Type type, int id ) const
返回具有指定type
和id
的着色器节点实例。
返回具有指定类型的连接节点的列表。
- PoolIntArray get_node_list ( Type type ) const
返回着色器中具有指定类型的所有节点的列表。
返回指定节点在着色器图中的位置。
如果指定的节点和端口连接存在,返回true
。
从着色器中删除指定的节点。
- void set_mode ( Mode mode )
设置该着色器的模式。
设置指定节点的位置。