A shader that uses the WESL shading language.
use ;
/// This example uses shader source files from the assets subdirectory
const FRAGMENT_SHADER_ASSET_PATH: &str = "shaders/custom_material.wesl";
/// A plugin that loads the custom material shader
;
/// An example utility shader that is used by the custom material
;
/// set up a simple 3D scene
// This is the struct that will be passed to your shader
import super::util::make_polka_dots;
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(2) uv: vec2<f32>,
}
struct CustomMaterial {
// Needed for 16-bit alignment on WebGL2
time: vec4<f32>,
}
@group(3) @binding(0) var<uniform> material: CustomMaterial;
@fragment
return ;
}
let scaled_pos = pos * 6.0;
let cell = ;
var dist_from_center = ;
let is_even = ( + ) % 2.0;
var dot_color = ;
var is_dot = 0.0;
@if(!PARTY_MODE) {
let color1 = ; // pink
let color2 = ; // purple
dot_color = ;
is_dot = ;
} @else {
let grid_x = ;
let grid_y = ;
let wave_speed = 3.0;
let wave_phase = time * wave_speed;
let diagonal_pos = (grid_x + grid_y) * 0.5;
let wave_value = ;
let wave_normalized = (wave_value + 1.0) * 0.5;
let color1 = ;
let color2 = ;
let intense_color1 = ;
let intense_color2 = ;
let animated_color1 = ;
let animated_color2 = ;
dot_color = ;
let size_mod = 0.15 * wave_value;
dist_from_center = dist_from_center * (1.0 - size_mod);
// Animate whether something is a dot by position but also time
is_dot = ;
}
return ;
}