Shader
A shader implemented in the Godot shading language.
Shader.swift:20class Shader
A custom shader program implemented in the Godot shading language, saved with the .gdshader
extension.
This class is used by a ShaderMaterial
and allows you to write your own custom behavior for rendering visual items or updating particle information. For a detailed explanation and usage, please see the tutorials linked below.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var code: String
Returns the shader’s code as the user has written it, not the full generated code used internally.
func getDefaultTextureParameter(name: StringName, index: Int32
) -> Texture2D? Returns the texture that is set as default for the specified parameter.
func getMode(
) -> Shader.Mode Returns the shader mode for the shader.
func getShaderUniformList(getGroups: Bool
) -> GArray Get the list of shader uniforms that can be assigned to a
ShaderMaterial
, for use withsetShaderParameter(param:value:)
andgetShaderParameter(param:)
. The parameters returned are contained in dictionaries in a similar format to the ones returned bygetPropertyList
.func setDefaultTextureParameter(name: StringName, texture: Texture2D?, index: Int32
) Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the
ShaderMaterial
.
Subclasses
class VisualShader
A custom shader program with a visual editor.