Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2021-09-16 10:23:31 -04:00
12 changed files with 43 additions and 22 deletions

View File

@@ -15,11 +15,16 @@ const float shinefalloff = 4.0;
const float shinelen = 0.2;
void main(){
vec3 norc = u_ambientColor * (diffuse + vec3(clamp((dot(a_normal, u_lightdir) + 1.0) / 2.0, 0.0, 1.0)));
float shinedot = max((-dot(u_camdir, a_normal) - (1.0 - shinelen)) / shinelen, 0.0);
float albedo = (1.0 - a_color.a) * pow(shinedot, shinefalloff);
vec4 baseCol = vec4(a_color.rgb, 1.0);
vec3 specular = vec3(0, 0, 0);
v_col = mix(baseCol * vec4(norc, 1.0), vec4(1.0), albedo * norc.r);
vec3 lightReflect = normalize(reflect(a_normal, u_lightdir));
float specularFactor = dot(u_camdir, lightReflect);
if(specularFactor > 0){
specular = vec3(1.0f * pow(specularFactor, 32f)) * (1f-a_color.a); //specular power = 32
}
vec3 norc = (u_ambientColor + specular) * (diffuse + vec3(clamp((dot(a_normal, u_lightdir) + 1.0) / 2.0, 0.0, 1.0)));
v_col = vec4(a_color.rgb, 1.0) * vec4(norc, 1.0);
gl_Position = u_proj * u_trans * a_position;
}