VisualShader

package
v0.0.0-...-ff35923 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

This class provides a graph-like visual editor for creating a graphics.gd/classdb/Shader. Although [graphics.gd/classdb/VisualShader]s do not require coding, they share the same logic with script shaders. They use [graphics.gd/classdb/VisualShaderNode]s that can be connected to each other to control the flow of the shader. The visual shader graph is converted to a script shader behind the scenes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsVisualShader() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

func (*Extension[T]) AsShader

func (self *Extension[T]) AsShader() Shader.Instance

func (*Extension[T]) AsVisualShader

func (self *Extension[T]) AsVisualShader() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.VisualShader

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddNode

func (self Instance) AddNode(atype Type, node VisualShaderNode.Instance, position Vector2.XY, id int)

Adds the specified 'node' to the shader.

func (Instance) AddVarying

func (self Instance) AddVarying(name string, mode VaryingMode, atype VaryingType)

Adds a new varying value node to the shader.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsShader

func (self Instance) AsShader() Shader.Instance

func (Instance) AsVisualShader

func (self Instance) AsVisualShader() Instance

func (Instance) AttachNodeToFrame

func (self Instance) AttachNodeToFrame(atype Type, id int, frame_ int)

Attaches the given node to the given frame.

func (Instance) CanConnectNodes

func (self Instance) CanConnectNodes(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int) bool

Returns true if the specified nodes and ports can be connected together.

func (Instance) ConnectNodes

func (self Instance) ConnectNodes(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int) error

Connects the specified nodes and ports.

func (Instance) ConnectNodesForced

func (self Instance) ConnectNodesForced(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int)

Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.

func (Instance) DetachNodeFromFrame

func (self Instance) DetachNodeFromFrame(atype Type, id int)

Detaches the given node from the frame it is attached to.

func (Instance) DisconnectNodes

func (self Instance) DisconnectNodes(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int)

Connects the specified nodes and ports.

func (Instance) GetNode

func (self Instance) GetNode(atype Type, id int) VisualShaderNode.Instance

Returns the shader node instance with specified 'type' and 'id'.

func (Instance) GetNodeConnections

func (self Instance) GetNodeConnections(atype Type) []map[string]interface{}

Returns the list of connected nodes with the specified type.

func (Instance) GetNodeList

func (self Instance) GetNodeList(atype Type) []int32

Returns the list of all nodes in the shader with the specified type.

func (Instance) GetNodePosition

func (self Instance) GetNodePosition(atype Type, id int) Vector2.XY

Returns the position of the specified node within the shader graph.

func (Instance) GetValidNodeId

func (self Instance) GetValidNodeId(atype Type) NodeID

Returns next valid node ID that can be added to the shader graph.

func (Instance) GraphOffset

func (self Instance) GraphOffset() Vector2.XY

func (Instance) HasVarying

func (self Instance) HasVarying(name string) bool

Returns true if the shader has a varying with the given 'name'.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsNodeConnection

func (self Instance) IsNodeConnection(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int) bool

Returns true if the specified node and port connection exist.

func (Instance) RemoveNode

func (self Instance) RemoveNode(atype Type, id int)

Removes the specified node from the shader.

func (Instance) RemoveVarying

func (self Instance) RemoveVarying(name string)

Removes a varying value node with the given 'name'. Prints an error if a node with this name is not found.

func (Instance) ReplaceNode

func (self Instance) ReplaceNode(atype Type, id int, new_class string)

Replaces the specified node with a node of new class type.

func (Instance) SetGraphOffset

func (self Instance) SetGraphOffset(value Vector2.XY)

func (Instance) SetMode

func (self Instance) SetMode(mode Shader.Mode)

Sets the mode of this shader.

func (Instance) SetNodePosition

func (self Instance) SetNodePosition(atype Type, id int, position Vector2.XY)

Sets the position of the specified node.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type NodeID

type NodeID int
const NodeIdInvalid NodeID = -1 //gd:VisualShader.NODE_ID_INVALID
const NodeIdOutput NodeID = 0 //gd:VisualShader.NODE_ID_OUTPUT

type Type

type Type int //gd:VisualShader.Type
const (
	// A vertex shader, operating on vertices.
	TypeVertex Type = 0
	// A fragment shader, operating on fragments (pixels).
	TypeFragment Type = 1
	// A shader for light calculations.
	TypeLight Type = 2
	// A function for the "start" stage of particle shader.
	TypeStart Type = 3
	// A function for the "process" stage of particle shader.
	TypeProcess Type = 4
	// A function for the "collide" stage (particle collision handler) of particle shader.
	TypeCollide Type = 5
	// A function for the "start" stage of particle shader, with customized output.
	TypeStartCustom Type = 6
	// A function for the "process" stage of particle shader, with customized output.
	TypeProcessCustom Type = 7
	// A shader for 3D environment's sky.
	TypeSky Type = 8
	// A compute shader that runs for each froxel of the volumetric fog map.
	TypeFog Type = 9
	// Represents the size of the [Type] enum.
	TypeMax Type = 10
)

type VaryingMode

type VaryingMode int //gd:VisualShader.VaryingMode
const (
	// Varying is passed from Vertex function to Fragment and Light functions.
	VaryingModeVertexToFragLight VaryingMode = 0
	// Varying is passed from Fragment function to Light function.
	VaryingModeFragToLight VaryingMode = 1
	// Represents the size of the [VaryingMode] enum.
	VaryingModeMax VaryingMode = 2
)

type VaryingType

type VaryingType int //gd:VisualShader.VaryingType
const (
	// Varying is of type [Float.X].
	VaryingTypeFloat VaryingType = 0
	// Varying is of type int.
	VaryingTypeInt VaryingType = 1
	// Varying is of type unsigned int.
	VaryingTypeUint VaryingType = 2
	// Varying is of type [Vector2.XY].
	VaryingTypeVector2d VaryingType = 3
	// Varying is of type [Vector3.XYZ].
	VaryingTypeVector3d VaryingType = 4
	// Varying is of type [Vector4.XYZW].
	VaryingTypeVector4d VaryingType = 5
	// Varying is of type bool.
	VaryingTypeBoolean VaryingType = 6
	// Varying is of type [Transform3D.BasisOrigin].
	VaryingTypeTransform VaryingType = 7
	// Represents the size of the [VaryingType] enum.
	VaryingTypeMax VaryingType = 8
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL