From 8525f8d1f9f8ad3ea234ff485652f4f90acc3f56 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 25 Feb 2025 19:50:36 -0500 Subject: Update --- crates/throwshade/src/assets/shaders/throwshade/frag.glsl | 8 +++++++- crates/throwshade/src/lib.rs | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'crates/throwshade') diff --git a/crates/throwshade/src/assets/shaders/throwshade/frag.glsl b/crates/throwshade/src/assets/shaders/throwshade/frag.glsl index 2acc78d..745b6e6 100644 --- a/crates/throwshade/src/assets/shaders/throwshade/frag.glsl +++ b/crates/throwshade/src/assets/shaders/throwshade/frag.glsl @@ -4,6 +4,8 @@ precision highp float; in vec2 vertex_texcoord; out vec4 frag_color; +uniform float opacity; + uniform vec2 resolution; uniform float time; @@ -15,12 +17,16 @@ uniform vec2 cursor; uniform float chat_time; uniform float chat_biblicality; +uniform float tracking_mouth; +uniform vec2 tracking_eyes; +uniform mat4 tracking_neck; + vec4 shade(vec2); void main() { vec2 inverted = vec2(vertex_texcoord.x, 1.0 - vertex_texcoord.y); frag_color = shade(inverted); - frag_color.a = clamp(frag_color.a * 0.5, 0.0, 0.5); + frag_color.a = clamp(frag_color.a * opacity, 0.0, opacity); } // "The Cutoff" diff --git a/crates/throwshade/src/lib.rs b/crates/throwshade/src/lib.rs index f832703..b408993 100644 --- a/crates/throwshade/src/lib.rs +++ b/crates/throwshade/src/lib.rs @@ -6,6 +6,7 @@ const FRAG: &'static str = include_str!("assets/shaders/throwshade/frag.glsl"); pub struct ThrowShade { pub tickset: u64, pub timeset: f64, + pub author: String, pub shader: Option, } impl ThrowShade { @@ -13,6 +14,7 @@ impl ThrowShade { Self { tickset: 0, timeset: 0.0, + author: String::new(), shader: None, } } @@ -34,6 +36,7 @@ impl ThrowShade { } cfg_if::cfg_if! { + if #[cfg(target_arch = "wasm32")] { struct Game { throwshade: ThrowShade, @@ -51,6 +54,7 @@ cfg_if::cfg_if! { ctx.clear_color(glam::Vec4::new(0.0, 0.0, 0.0, 0.0)); ctx.clear(); s.bind(ctx); + s.set_f32(ctx, "opacity", 0.5); s.set_vec2(ctx, "resolution", &glam::Vec2::new(ctx.render_width, ctx.render_height)); let elapsed = (st.tick - self.throwshade.tickset) as f32 / 60.0; s.set_f32(ctx, "time", elapsed); -- cgit v1.2.3