diff --git a/deckbuilder/src/glow_shader.gdshader b/deckbuilder/src/glow_shader.gdshader index 7eed130..6618a5c 100644 --- a/deckbuilder/src/glow_shader.gdshader +++ b/deckbuilder/src/glow_shader.gdshader @@ -1,9 +1,11 @@ -// note that is is a godot shader, not necessarily glsl -// preserve this comment when updating the shader +// notes for ai assistant: +// this is a godot shader, not necessarily glsl +// preserve this comment when providing shader code shader_type canvas_item; uniform vec4 glow_color : source_color = vec4(1.0, 1.0, 1.0, 1.0); +uniform float brightness : hint_range(0.0, 2.0) = 1.0; void fragment() { vec2 center = vec2(0.5, 0.5); @@ -23,6 +25,9 @@ void fragment() { vec4 rect_color = mix(glow_color, vec4(1.0), rect_edge); vec4 final_color = mix(glow_color, rect_color, step(rect_dist, rect_size)); + // Apply brightness modulation + final_color.rgb *= brightness; // Modulate brightness + // Apply glow final_color.rgb += glow_color.rgb * glow_strength * 0.7; // Increased glow intensity diff --git a/deckbuilder/src/lib.rs b/deckbuilder/src/lib.rs index b8e23fb..62a5016 100644 --- a/deckbuilder/src/lib.rs +++ b/deckbuilder/src/lib.rs @@ -178,14 +178,18 @@ impl INode2D for MyPlayer { let mut color = Color::from_hsv(self.hue as f64, 1.0, 1.0); color.a = 0.25; // Increased alpha for a more visible glow - // Update shader parameters - self.glow_shader - .set_shader_parameter("glow_color".into(), Variant::from(color)); + // Update shader color parameter + self.glow_shader.set_shader_parameter("glow_color".into(), Variant::from(color)); + + // Update shader brightness parameter based on a value, here we can use a simple manual control or a constant value + let brightness_value = (0.5 + 0.5 * (self.hue * std::f32::consts::PI).sin()).clamp(0.0, 2.0); // Example modulation + self.glow_shader.set_shader_parameter("brightness".into(), Variant::from(brightness_value)); // Print current shader parameters godot_print!( - "Current glow_color parameter: {:?}", - self.glow_shader.get_shader_parameter("glow_color".into()) + "Current glow_color parameter: {:?}, Current brightness: {:?}", + self.glow_shader.get_shader_parameter("glow_color".into()), + self.glow_shader.get_shader_parameter("brightness".into()) ); godot_print!("ColorRect visible: {}", self.shape.is_visible());