Shader

package
v0.0.0-...-80877a9 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package Shader provides methods for working with Shader object instances.

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
	AsShader() Instance
}

type Instance

type Instance [1]gdclass.Shader

A custom shader program implemented in the Godot shading language, saved with the [code].gdshader[/code] 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.

var Nil Instance

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

func New

func New() Instance

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() Instance

func (Instance) Code

func (self Instance) Code() string

func (Instance) GetDefaultTextureParameter

func (self Instance) GetDefaultTextureParameter(name string) [1]gdclass.Texture2D

Returns the texture that is set as default for the specified parameter. [b]Note:[/b] [param name] must match the name of the uniform in the code exactly. [b]Note:[/b] If the sampler array is used use [param index] to access the specified texture.

func (Instance) GetMode

func (self Instance) GetMode() gdclass.ShaderMode

Returns the shader mode for the shader.

func (Instance) GetShaderUniformList

func (self Instance) GetShaderUniformList() []any

Get the list of shader uniforms that can be assigned to a [ShaderMaterial], for use with [method ShaderMaterial.set_shader_parameter] and [method ShaderMaterial.get_shader_parameter]. The parameters returned are contained in dictionaries in a similar format to the ones returned by [method Object.get_property_list]. If argument [param get_groups] is true, parameter grouping hints will be provided.

func (Instance) SetCode

func (self Instance) SetCode(value string)

func (Instance) SetDefaultTextureParameter

func (self Instance) SetDefaultTextureParameter(name string, texture [1]gdclass.Texture2D)

Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the [ShaderMaterial]. [b]Note:[/b] [param name] must match the name of the uniform in the code exactly. [b]Note:[/b] If the sampler array is used use [param index] to access the specified texture.

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

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

type Mode

type Mode = gdclass.ShaderMode //gd:Shader.Mode
const (
	/*Mode used to draw all 3D objects.*/
	ModeSpatial Mode = 0
	/*Mode used to draw all 2D objects.*/
	ModeCanvasItem Mode = 1
	/*Mode used to calculate particle information on a per-particle basis. Not used for drawing.*/
	ModeParticles Mode = 2
	/*Mode used for drawing skies. Only works with shaders attached to [Sky] objects.*/
	ModeSky Mode = 3
	/*Mode used for setting the color and density of volumetric fog effect.*/
	ModeFog Mode = 4
)

Jump to

Keyboard shortcuts

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