shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;

uniform vec4 albedo : source_color = vec4(1.0);
uniform sampler2D texture_albedo : source_color, filter_nearest_mipmap, repeat_enable;

uniform vec3 glow_color : source_color = vec3(0.2, 0.5, 1.0);
uniform float glow_strength : hint_range(0.0, 20.0) = 4.0;
uniform float pulse_speed : hint_range(0.0, 10.0) = 1.5;
uniform float pulse_amount : hint_range(0.0, 1.0) = 0.25;

uniform float roughness : hint_range(0.0, 1.0) = 1.0;
uniform float metallic : hint_range(0.0, 1.0) = 0.0;
uniform float specular : hint_range(0.0, 1.0) = 0.5;

uniform vec3 uv1_scale = vec3(1.0);
uniform vec3 uv1_offset = vec3(0.0);

void vertex() {
	UV = UV * uv1_scale.xy + uv1_offset.xy;
}

void fragment() {
	vec4 albedo_tex = texture(texture_albedo, UV);
	ALBEDO = albedo.rgb * albedo_tex.rgb;

	METALLIC = metallic;
	ROUGHNESS = roughness;
	SPECULAR = specular;

	float pulse = 1.0 - pulse_amount + pulse_amount * sin(TIME * pulse_speed);
	EMISSION = ALBEDO * glow_color * glow_strength * pulse;
}
