// WoW 3.3.5 character eye glow effect
// Replicates WoW M2 blendingMode=4 (Add: ONE + ONE — pure additive).
//
// render_mode breakdown:
//   blend_add        — additive blending: eye adds light, makes area brighter
//   unshaded         — no lighting response, fully self-illuminated
//   depth_draw_never — don't write depth, renders on top without occlusion
//   cull_disabled    — visible from both sides (eye meshes are thin)
//
// How it works:
//   result = shader_output + background.  The eye glow mesh sits over the
//   eye base and adds bright colored light in the shape of the glow texture.
//   Darker texture areas contribute nothing; bright areas max out the glow.

shader_type spatial;
render_mode blend_add, unshaded, depth_draw_never, cull_disabled;

// Base texture from the M2 eye-glow BLP (e.g. BloodElfFemaleEyeGlowGreen.blp)
uniform sampler2D albedo_texture : source_color, hint_default_white;

// Tint + brightness multiplier. Defaults match Blood Elf green glow.
uniform vec3  glow_color     : source_color = vec3(0.1, 1.0, 0.2);
uniform float glow_intensity : hint_range(0.0, 4.0, 0.05) = 1.3;

void fragment() {
	vec4 tex = texture(albedo_texture, UV);

	// Use texture luminance as the glow mask; multiply by tint and intensity.
	// High-luminance areas of the texture produce bright colored glow.
	float lum = dot(tex.rgb, vec3(0.299, 0.587, 0.114));
	ALBEDO = glow_color * glow_intensity * lum;

	// Alpha drives blend contribution (SRC_ALPHA + ONE in additive mode).
	ALPHA = tex.a * lum;
}
