module CrShader::Language::Builtins::CanvasItem

Overview

Built-in variables available in 2D CanvasItem shaders (shader_type :canvas_item).

Defined in:

crshader/language/builtins.cr

Constant Summary

COLOR = Types::Vec4.new

Output color for fragment stage, or vertex color in vertex stage.

FRAGCOORD = Types::Vec4.new

Window-relative fragment coordinates: (x, y, z=depth, w=1/w).

POINT_COORD = Types::Vec2.new

Normalized point coordinate within a point sprite [0.0, 1.0].

POINT_SIZE = 1.0_f32

Point size in pixels when rendering point primitives (vertex stage).

SCREEN_PIXEL_SIZE = Types::Vec2.new

Size of a single pixel on the screen: vec2(1.0 / viewport_width, 1.0 / viewport_height).

SCREEN_UV = Types::Vec2.new

Screen-space UV coordinate in range [0.0, 1.0] for sampling screen_texture.

SPECULAR_SHININESS = Types::Vec4.new

Screen depth texture reading coordinate.

TEXTURE_PIXEL_SIZE = Types::Vec2.new

Size of a single pixel in the base texture: vec2(1.0 / width, 1.0 / height).

TIME = 0.0_f32

Global game elapsed time in seconds.

UV = Types::Vec2.new

Normalized texture coordinate (UV) in range [0.0, 1.0].

VERTEX = Types::Vec2.new

Input vertex position in 2D space (vertex processor, read-write) or fragment position (fragment processor, read-only).