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 ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AddNode(atype Type, node VisualShaderNode.Instance, position Vector2.XY, id int)
- func (self Instance) AddVarying(name string, mode VaryingMode, atype VaryingType)
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsShader() Shader.Instance
- func (self Instance) AsVisualShader() Instance
- func (self Instance) AttachNodeToFrame(atype Type, id int, frame_ int)
- func (self Instance) CanConnectNodes(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int) bool
- func (self Instance) ConnectNodes(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int) error
- func (self Instance) ConnectNodesForced(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int)
- func (self Instance) DetachNodeFromFrame(atype Type, id int)
- func (self Instance) DisconnectNodes(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int)
- func (self Instance) GetNode(atype Type, id int) VisualShaderNode.Instance
- func (self Instance) GetNodeConnections(atype Type) []map[string]interface{}
- func (self Instance) GetNodeList(atype Type) []int32
- func (self Instance) GetNodePosition(atype Type, id int) Vector2.XY
- func (self Instance) GetValidNodeId(atype Type) NodeID
- func (self Instance) GraphOffset() Vector2.XY
- func (self Instance) HasVarying(name string) bool
- func (self Instance) ID() ID
- func (self Instance) IsNodeConnection(atype Type, from_node NodeID, from_port int, to_node NodeID, to_port int) bool
- func (self Instance) RemoveNode(atype Type, id int)
- func (self Instance) RemoveVarying(name string)
- func (self Instance) ReplaceNode(atype Type, id int, new_class string)
- func (self Instance) SetGraphOffset(value Vector2.XY)
- func (self Instance) SetMode(mode Shader.Mode)
- func (self Instance) SetNodePosition(atype Type, id int, position Vector2.XY)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type NodeID
- type Type
- type VaryingMode
- type VaryingType
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 Extension ¶
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]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
func (*Extension[T]) AsVisualShader ¶
type 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.
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 (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) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsVisualShader ¶
func (Instance) AttachNodeToFrame ¶
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 ¶
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 ¶
Returns the list of connected nodes with the specified type.
func (Instance) GetNodeList ¶
Returns the list of all nodes in the shader with the specified type.
func (Instance) GetNodePosition ¶
Returns the position of the specified node within the shader graph.
func (Instance) GetValidNodeId ¶
Returns next valid node ID that can be added to the shader graph.
func (Instance) GraphOffset ¶
func (Instance) HasVarying ¶
Returns true if the shader has a varying with the given 'name'.
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 ¶
Removes the specified node from the shader.
func (Instance) RemoveVarying ¶
Removes a varying value node with the given 'name'. Prints an error if a node with this name is not found.
func (Instance) ReplaceNode ¶
Replaces the specified node with a node of new class type.
func (Instance) SetGraphOffset ¶
func (Instance) SetNodePosition ¶
Sets the position of the specified node.
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 )