Sky

package
v0.0.0-...-a66c66c Latest Latest
Warning

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

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

Documentation

Overview

Package Sky provides a sky shader pipeline used for shading 3D objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Light

type Light struct {
	Enabled   bool.X   // true if LIGHTX is visible and in the scene. If false, other light properties may be garbage.
	Energy    float.X  // Energy multiplier for LIGHTX.
	Direction vec3.XYZ // Direction that LIGHTX is facing.
	Color     vec3.RGB // Color of LIGHTX.
	Size      float.X  // Angular diameter of LIGHTX in the sky. Expressed in radians. For reference, the sun from earth is about .0087 radians (0.5 degrees).
}

type Lighting

type Lighting struct {
	Color vec3.RGB  `gd:"COLOR"` // Color of the light.
	Alpha float.X   `gd:"ALPHA"` // Alpha of the light.
	Fog   vec4.RGBA `gd:"FOG"`   // Fog color of the light.
}

type RenderMode

type RenderMode string
const (
	UseHalfResPass    RenderMode = "use_half_res_pass"    // Allows the shader to write to and access the half resolution pass.
	UseQuarterResPass RenderMode = "use_quarter_res_pass" // Allows the shader to write to and access the quarter resolution pass.
	DisableFog        RenderMode = "disable_fog"          // If used, fog will not affect the sky.
)

type Shader

type Shader[T gdclass.Interface] struct {
	ShaderMaterial.Extension[T]
}

func (*Shader[T]) Fragment

func (*Shader[T]) Fragment(state struct{}) struct{}

func (*Shader[T]) Lighting

func (*Shader[T]) Lighting(Snapshot) Lighting

func (*Shader[T]) Material

func (*Shader[T]) Material(state struct{}) Snapshot

func (*Shader[T]) OnCreate

func (s *Shader[T]) OnCreate(value reflect.Value)

func (*Shader[T]) Pipeline

func (*Shader[T]) Pipeline() [3]string

func (*Shader[T]) RenderMode

func (*Shader[T]) RenderMode() []RenderMode

func (*Shader[T]) ShaderType

func (*Shader[T]) ShaderType() string

type Snapshot

type Snapshot struct {
	CameraPosition   vec3.XYZ                       `gd:"POSITION"`            // Camera position in world space.
	Radiance         texture.CubeSampler[vec4.RGBA] `gd:"RADIANCE"`            // Radiance cubemap. Can only be read from during background pass. Check !AT_CUBEMAP_PASS before using.
	AtHalfResPass    bool.X                         `gd:"AT_HALF_RES_PASS"`    // True if the shader is being processed at half resolution pass.
	AtQuarterResPass bool.X                         `gd:"AT_QUARTER_RES_PASS"` // True if the shader is being processed at quarter resolution pass.
	AtCubemapPass    bool.X                         `gd:"AT_CUBEMAP_PASS"`     // True if the shader is being processed at cubemap pass.
	EyeDirection     vec3.XYZ                       `gd:"EYE_DIRECTION"`       // Normalized direction of current pixel. Use this as your basic direction for procedural effects.
	ScreenUV         vec2.XY                        `gd:"SCREEN_UV"`           // Screen UV coordinate for current pixel. Used to map a texture to the full screen.
	SkyCoords        vec2.XY                        `gd:"SKY_COORDS"`          // Sphere UV. Used to map a panorama texture to the sky.
	HalfResColor     vec4.RGBA                      `gd:"HALF_RES_COLOR"`      // Color value of corresponding pixel from half resolution pass. Uses linear filter.
	QuarterResColor  vec4.RGBA                      `gd:"QUARTER_RES_COLOR"`   // Color value of corresponding pixel from quarter resolution pass. Uses linear filter.
}

func (Snapshot) Lights

func (Snapshot) Lights() [4]Light

Jump to

Keyboard shortcuts

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