Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Constants

SPRITE_MATERIAL_FLAGS_ALPHA_MODE_RESERVED_BITS

#
const SPRITE_MATERIAL_FLAGS_ALPHA_MODE_RESERVED_BITS: u32 = 3221225472u

SPRITE_MATERIAL_FLAGS_ALPHA_MODE_OPAQUE

#
const SPRITE_MATERIAL_FLAGS_ALPHA_MODE_OPAQUE: u32 = 0u

SPRITE_MATERIAL_FLAGS_ALPHA_MODE_MASK

#
const SPRITE_MATERIAL_FLAGS_ALPHA_MODE_MASK: u32 = 1073741824u

SPRITE_MATERIAL_FLAGS_ALPHA_MODE_BLEND

#
const SPRITE_MATERIAL_FLAGS_ALPHA_MODE_BLEND: u32 = 2147483648u

SPRITE_MATERIAL_FLAGS_FLIP_X

#
const SPRITE_MATERIAL_FLAGS_FLIP_X: u32 = 1u

SPRITE_MATERIAL_FLAGS_FLIP_Y

#
const SPRITE_MATERIAL_FLAGS_FLIP_Y: u32 = 2u

SPRITE_MATERIAL_FLAGS_TILE_X

#
const SPRITE_MATERIAL_FLAGS_TILE_X: u32 = 4u

SPRITE_MATERIAL_FLAGS_TILE_Y

#
const SPRITE_MATERIAL_FLAGS_TILE_Y: u32 = 8u

Bindings

material

#
@group(#{MATERIAL_BIND_GROUP})
@binding(0)
var<uniform> material: SpriteMaterial

texture

#
@group(#{MATERIAL_BIND_GROUP})
@binding(1)
var texture: texture_2d<f32>

texture_sampler

#
@group(#{MATERIAL_BIND_GROUP})
@binding(2)
var texture_sampler: sampler

Structures

Vertex

#
struct Vertex {
@builtin(instance_index)
instance_index: u32,
@location(0)
position: vec3<f32>, VERTEX_POSITIONS
@location(1)
normal: vec3<f32>, VERTEX_NORMALS
@location(2)
uv: vec2<f32>, VERTEX_UVS
@location(3)
tangent: vec4<f32>, VERTEX_TANGENTS
@location(4)
color: vec4<f32>, VERTEX_COLORS
}

SpriteMaterial

#
struct SpriteMaterial {
color: vec4<f32>,
flags: u32,
alpha_cutoff: f32,
vertex_scale: vec2<f32>,
vertex_offset: vec2<f32>,
uv_transform: mat3x3<f32>,
tile_stretch_value: vec2<f32>,
scale: vec2<f32>,
min_inset: vec2<f32>,
max_inset: vec2<f32>,
side_stretch_value: vec2<f32>,
center_stretch_value: vec2<f32>,
}

Functions

vertex

#
@vertex
Processes each 3D point in a model before it's drawn
fn vertex (
vertex: Vertex
) -> VertexOutput

fragment

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment ( ) ->
@location(0)
vec4<f32>

apply_slicing

#
fn apply_slicing (
uv: vec2<f32>
) -> vec2<f32>

tile_or_stretch

#

Maps a point p from [a, b] to [c, d], tiling it if stretch_value is not 0.

fn tile_or_stretch (
p: f32,
a: f32,
b: f32,
c: f32,
d: f32,
stretch_value: f32
) -> f32

tile_interval

#

Takes a point p from an interval [a, b] and maps it to a portion of the tile [c, d]

fn tile_interval (
p: f32,
a: f32,
b: f32,
c: f32,
d: f32,
stretch_value: f32
) -> f32

stretch_interval

#

Takes a point p from an interval [a, b] and translates it to the interval [c, d]

fn stretch_interval (
p: f32,
a: f32,
b: f32,
c: f32,
d: f32
) -> f32

alpha_discard

#
fn alpha_discard (
output_color: vec4<f32>
) -> vec4<f32>
Contents