VisualShader

Inherits: Shader < Resource < Reference < Object

Category: Core

Brief Description

A custom shader program with a visual editor.

Properties

String code O: “shader_type spatial;void vertex() {// Output:0}void fragment() {// Output:0}void light() {// Output:0}”
Vector2 graph_offset Vector2( 0, 0 )

Methods

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 )

Enumerations

enum Type:

  • TYPE_VERTEX = 0
  • TYPE_FRAGMENT = 1
  • TYPE_LIGHT = 2
  • TYPE_MAX = 3 — Represents the size of the Type enum.

Constants

  • NODE_ID_INVALID = -1
  • NODE_ID_OUTPUT = 0

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.

Property Descriptions

Default Vector2( 0, 0 )
Setter set_graph_offset(value)
Getter get_graph_offset()

Method Descriptions


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


  • 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 )


  • 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

  • void remove_node ( Type type, int id )

  • void set_mode ( Mode mode )