shaders

package
v0.0.0-...-ae8aae0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RenderingOptions2D = xyz.AccessorFor(RenderingOption2D.Values)

Functions

func Compile

func Compile[V, F, M any](prog Program[V, F, M])

Types

type CanvasItemVertexAttributes

type CanvasItemVertexAttributes struct {
	Global

	// Local space to world space transform. World space is the coordinates you normally use in the editor.
	ModelMatrix mat4.ColumnMajor `gd:"MODEL_MATRIX"`

	// World space to canvas space transform. In canvas space the origin is the upper-left corner of the
	// screen and coordinates ranging from (0, 0) to viewport size.
	CanvasMatrix mat4.ColumnMajor `gd:"CANVAS_MATRIX"`

	// Canvas space to clip space. In clip space coordinates ranging from (-1, -1) to (1, 1).
	ScreenMatrix mat4.ColumnMajor `gd:"SCREEN_MATRIX"`

	InstanceID     int.X     `gd:"INSTANCE_ID"`     // InstanceID for instancing.
	InstanceCustom vec4.XYZW `gd:"INSTANCE_CUSTOM"` // InstanceCustom data.
	AtLightPass    bool.X    `gd:"AT_LIGHT_PASS"`   // Always false.

	// Normalized pixel size of default 2D texture. For a Sprite2D with a texture of size 64x32px,
	// TEXTURE_PIXEL_SIZE = vec2(1/64, 1/32)
	TexturePixelSize vec2.XY `gd:"TEXTURE_PIXEL_SIZE"`

	Position vec2.XY `gd:"VERTEX"`    // Vertex, in local space.
	ID       float.X `gd:"VERTEX_ID"` // The index of the current vertex in the vertex buffer.

	UV        vec2.XY   `gd:"UV"`         // Normalized texture coordinates. Range from 0 to 1.
	Color     vec4.RGBA `gd:"COLOR"`      // Color from vertex primitive.
	PointSize float.X   `gd:"POINT_SIZE"` // Point size for point drawing.
	Custom0   vec4.XYZW `gd:"CUSTOM0"`    // Custom value from vertex primitive.
	Custom1   vec4.XYZW `gd:"CUSTOM1"`    // Custom value from vertex primitive.
}

type Global

type Global struct {
	// Global time since the engine has started, in seconds. It repeats after every 3,600 seconds (which can be changed with
	// the rollover setting). It's not affected by time_scale or pausing. If you need a TIME variable that can be scaled or
	// paused, add your own global shader uniform and update it each frame.
	Time vec1.X `gd:"TIME"`
}

type Program

type Program[V, F, M any] interface {
	Super() ShaderMaterial.Instance

	Fragment(V) F
	Material(F) M
	Lighting(M) vec4.RGBA
	// contains filtered or unexported methods
}

type RenderingOption2D

type RenderingOption2D xyz.Switch[string, struct {
	BlendingModeMix            RenderingOption2D `json:"blend_mix"`             // Mix blend mode (alpha is transparency), default.
	BlendingModeAdd            RenderingOption2D `json:"blend_add"`             // Additive blend mode.
	BlendingModeSub            RenderingOption2D `json:"blend_sub"`             // Subtractive blend mode.
	BlendingModeMul            RenderingOption2D `json:"blend_mul"`             // Multiplicative blend mode.
	BlendingPremultipliedAlpha RenderingOption2D `json:"blend_premul_alpha"`    // Pre-multiplied alpha blend mode.
	BlendingDisabled           RenderingOption2D `json:"blend_disabled"`        // Disable blending, values (including alpha) are written as-is.
	Unshaded                   RenderingOption2D `json:"unshaded"`              // Result is just albedo. No lighting/shading happens in material.
	LightOnly                  RenderingOption2D `json:"light_only"`            // Only draw on light pass.
	SkipVertexTransform        RenderingOption2D `json:"skip_vertex_transform"` // VERTEX needs to be transformed manually in vertex function.
	WorldVertexCoordinates     RenderingOption2D `json:"world_vertex_coords"`   // VERTEX is modified in world coordinates instead of local.
}]

type Type2D

type Type2D struct {
	classdb.Extension[goShader, ShaderMaterial.Instance]
}

type Type3D

type Type3D struct {
	classdb.Extension[goShader, ShaderMaterial.Instance]
}

Directories

Path Synopsis
Package bool provides GPU operations on boolean values.
Package bool provides GPU operations on boolean values.
Pacakge bvec2 provides GPU operations on two-component boolean vectors.
Pacakge bvec2 provides GPU operations on two-component boolean vectors.
Pacakge bvec3 provides GPU operations on three-component boolean vectors.
Pacakge bvec3 provides GPU operations on three-component boolean vectors.
Pacakge bvec4 provides GPU operations on four-component boolean vectors.
Pacakge bvec4 provides GPU operations on four-component boolean vectors.
Package float provides GPU operations on floating-point values.
Package float provides GPU operations on floating-point values.
Package int provides GPU operations on signed integer values.
Package int provides GPU operations on signed integer values.
internal
builtins
builtins checks gdmaths and gdvalue packages for builtin class methods and reports any builtin methods that are missing from gd or any duplicates.
builtins checks gdmaths and gdvalue packages for builtin class methods and reports any builtin methods that are missing from gd or any duplicates.
gpu
Package ivec2 provides GPU operations on two-component signed integer vectors.
Package ivec2 provides GPU operations on two-component signed integer vectors.
Package ivec3 provides GPU operations on three-component signed integer vectors.
Package ivec3 provides GPU operations on three-component signed integer vectors.
Package ivec4 provides GPU operations on four-component signed integer vectors.
Package ivec4 provides GPU operations on four-component signed integer vectors.
Package mat2 provides GPU operations on 2x2 matrices.
Package mat2 provides GPU operations on 2x2 matrices.
Package mat3 provides GPU operations on 3x3 matrices.
Package mat3 provides GPU operations on 3x3 matrices.
Package mat4 provides GPU operations on 4x4 matrices.
Package mat4 provides GPU operations on 4x4 matrices.
Package rgba provides a constructor for vec4.RGBA values.
Package rgba provides a constructor for vec4.RGBA values.
Package uint provides GPU operations on unsigned integer values.
Package uint provides GPU operations on unsigned integer values.
Package uvec2 provides GPU operations on two-component unsigned integer vectors.
Package uvec2 provides GPU operations on two-component unsigned integer vectors.
Package uvec3 provides GPU operations on three-component unsigned integer vectors.
Package uvec3 provides GPU operations on three-component unsigned integer vectors.
Package uvec4 provides GPU operations on four-component unsigned integer vectors.
Package uvec4 provides GPU operations on four-component unsigned integer vectors.
Package vec2 provides GPU operations on two-component floating-point vectors.
Package vec2 provides GPU operations on two-component floating-point vectors.
Package vec3 provides GPU operations on three-component floating-point vectors.
Package vec3 provides GPU operations on three-component floating-point vectors.
Package vec4 provides GPU operations on four-component floating-point vectors.
Package vec4 provides GPU operations on four-component floating-point vectors.

Jump to

Keyboard shortcuts

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