VisualShader¶
Inherits: Shader < Resource < RefCounted < Object
A custom shader program with a visual editor.
Description¶
This class allows you to define a custom shader program that can be used for various materials to render objects.
The visual shader editor creates the shader.
Properties¶
|
||
|
Methods¶
void |
add_node ( Type type, VisualShaderNode node, Vector2 position, int id ) |
void |
add_varying ( String name, VaryingMode mode, VaryingType type ) |
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 |
|
has_varying ( String name ) 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 |
remove_varying ( String name ) |
void |
replace_node ( Type type, int id, StringName new_class ) |
void |
|
void |
set_node_position ( Type type, int id, Vector2 position ) |
Enumerations¶
enum Type:
TYPE_VERTEX = 0 --- A vertex shader, operating on vertices.
TYPE_FRAGMENT = 1 --- A fragment shader, operating on fragments (pixels).
TYPE_LIGHT = 2 --- A shader for light calculations.
TYPE_START = 3
TYPE_PROCESS = 4
TYPE_COLLIDE = 5
TYPE_START_CUSTOM = 6
TYPE_PROCESS_CUSTOM = 7
TYPE_SKY = 8
TYPE_FOG = 9 --- A compute shader that runs for each froxel of the volumetric fog map.
TYPE_MAX = 10 --- Represents the size of the Type enum.
enum VaryingMode:
VARYING_MODE_VERTEX_TO_FRAG_LIGHT = 0
VARYING_MODE_FRAG_TO_LIGHT = 1
VARYING_MODE_MAX = 2
enum VaryingType:
VARYING_TYPE_FLOAT = 0
VARYING_TYPE_VECTOR_2D = 1
VARYING_TYPE_VECTOR_3D = 2
VARYING_TYPE_COLOR = 3
VARYING_TYPE_TRANSFORM = 4
VARYING_TYPE_MAX = 5
Constants¶
NODE_ID_INVALID = -1
NODE_ID_OUTPUT = 0
Property Descriptions¶
Dictionary engine_version
Default |
|
Setter |
set_engine_version(value) |
Getter |
get_engine_version() |
The Godot version this VisualShader
was designed for, in the form of a Dictionary with major
and minor
keys with integer values. Example: {"major": 4, "minor": 0}
This is used by the editor to convert visual shaders from older Godot versions.
Vector2 graph_offset
Default |
|
Setter |
set_graph_offset(value) |
Getter |
get_graph_offset() |
The offset vector of the whole graph.
Method Descriptions¶
void add_node ( Type type, VisualShaderNode node, Vector2 position, int id )
Adds the specified node to the shader.
void add_varying ( String name, VaryingMode mode, VaryingType type )
Returns true
if the specified nodes and ports can be connected together.
Connects the specified nodes and ports.
Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
Connects the specified nodes and ports.
VisualShaderNode get_node ( Type type, int id ) const
Returns the shader node instance with specified type
and id
.
Returns the list of connected nodes with the specified type.
PackedInt32Array get_node_list ( Type type ) const
Returns the list of all nodes in the shader with the specified type.
Returns the position of the specified node within the shader graph.
Returns true
if the specified node and port connection exist.
Removes the specified node from the shader.
void remove_varying ( String name )
void replace_node ( Type type, int id, StringName new_class )
Replaces the specified node with a node of new class type.
void set_mode ( Mode mode )
Sets the mode of this shader.
Sets the position of the specified node.