30 lines
1.1 KiB
Text
30 lines
1.1 KiB
Text
shader_type spatial;
|
|
// Shared enemy material (one MultiMesh batch), from the prototype's bird shader: wings (local
|
|
// |x|) flap with a per-enemy phase from INSTANCE_CUSTOM.r, and a hit flashes the enemy white
|
|
// through INSTANCE_CUSTOM.g (1 on the hit, fading). Lit like the rest of the farm
|
|
// (toon_light.gdshaderinc), whose rim light keeps the near-black crow readable against the grass
|
|
// and crops, and night_glow (set by DayNight) adds a faint purple glow at night.
|
|
render_mode cull_disabled;
|
|
|
|
#include "res://game/resources/toon_light.gdshaderinc"
|
|
|
|
uniform vec3 base_color : source_color = vec3(0.07, 0.07, 0.09);
|
|
uniform float flap_speed = 11.0;
|
|
uniform float flap_amount = 0.55;
|
|
uniform float night_glow : hint_range(0.0, 1.0) = 0.0;
|
|
|
|
varying float flash;
|
|
|
|
void vertex() {
|
|
float span = abs(VERTEX.x);
|
|
float phase = INSTANCE_CUSTOM.r * 6.2831853;
|
|
VERTEX.y += sin(TIME * flap_speed + phase) * span * flap_amount;
|
|
flash = INSTANCE_CUSTOM.g;
|
|
}
|
|
|
|
void fragment() {
|
|
ALBEDO = mix(base_color, vec3(1.0), clamp(flash, 0.0, 1.0));
|
|
EMISSION = vec3(1.0, 0.9, 0.8) * flash * 0.6 + vec3(0.5, 0.28, 0.75) * night_glow * 0.35;
|
|
ROUGHNESS = 0.55;
|
|
SPECULAR = 0.4;
|
|
}
|