Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

box_shadow.wgsl

Constants

PI

#
const PI: f32 = 3.14159265358979323846

SAMPLES

#
const SAMPLES: i32 = #SHADOW_SAMPLES

Bindings

view

#
@group(0)
@binding(0)
var<uniform> view: View

Structures

BoxShadowVertexOutput

#
struct BoxShadowVertexOutput {
@builtin(position)
position: vec4<f32> ,
@location(0)
point: vec2<f32> ,
@location(1)
color: vec4<f32> ,
@location(2)
@interpolate(flat)
size: vec2<f32> ,
@location(3)
@interpolate(flat)
radius: vec4<f32> ,
@location(4)
@interpolate(flat)
blur: f32 ,
}

Functions

gaussian

#
fn gaussian (
sigma: f32
) -> f32

erf

#

Approximates the Gauss error function: https://en.wikipedia.org/wiki/Error_function

fn erf ( ) -> vec2<f32>

selectCorner

#

returns the closest corner radius based on the signs of the components of p

fn selectCorner ( ) -> f32

horizontalRoundedBoxShadow

#
fn horizontalRoundedBoxShadow (
blur: f32
corner: f32
half_size: vec2<f32>
) -> f32

roundedBoxShadow

#
fn roundedBoxShadow (
blur: f32
corners: vec4<f32>
) -> f32

vertex

#
@vertex
Processes each 3D point in a model before it's drawn
fn vertex (
@location(0)
vertex_position: vec3<f32>
@location(1)
uv: vec2<f32>
@location(2)
vertex_color: vec4<f32>
@location(3)
size: vec2<f32>
@location(4)
radius: vec4<f32>
@location(5)
blur: f32
@location(6)
bounds: vec2<f32>
) -> BoxShadowVertexOutput

fragment

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