2024-08-24 17:32:25 +00:00
|
|
|
#ifndef LIGHTMAP_GLSL
|
|
|
|
#define LIGHTMAP_GLSL
|
|
|
|
|
2024-08-24 17:25:29 +00:00
|
|
|
bool do_lightmap() {
|
2024-08-24 13:29:05 +00:00
|
|
|
#ifdef LIGHTMAP_BAKING
|
|
|
|
vec3 n = normalize(v_normal_ws);
|
|
|
|
vec4 diffuse;
|
|
|
|
|
|
|
|
if(u_textured) {
|
|
|
|
diffuse = texture(u_texture2d, v_texcoord);
|
|
|
|
} else {
|
|
|
|
diffuse = u_diffuse; // * v_color;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (u_texlit) {
|
|
|
|
vec4 litsample = texture(u_lightmap, v_texcoord);
|
|
|
|
diffuse *= litsample;
|
|
|
|
}
|
|
|
|
|
|
|
|
fragcolor = vec4(diffuse.rgb*u_litboost, 1.0);
|
2024-08-24 17:25:29 +00:00
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2024-08-24 17:32:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|