swwmgz_m/shaders/glsl/SheenLED.fp

35 lines
806 B
GLSL

// this is a temporary gross hack
void SetupMaterial( inout Material mat )
{
mat.Base = getTexel(vTexCoord.st);
// extract data from bytes of camtex
vec4 ccol = texture(camtex,vec2(.5));
int xy = int(ccol.r*255.); // low and mid digits (*F = HOT, F* = OK)
int zw = int(ccol.g*255.); // high digit and speed (*F = blink)
int u = int(ccol.b*255.); // width of heat bar
int digit0 = zw&0x0F;
int digit1 = (xy&0xF0)>>4;
int digit2 = xy&0x0F;
if ( digit0 != 0x0F )
{
vec2 tc;
if ( digit1 == 0x0F )
{
// OK
}
else if ( digit2 == 0x0F )
{
// HOT
}
else
{
// digits
tc = vec2(.125*(digit0%8),.5*(digit0/8));
}
}
vec2 uv = vTexCoord.st*vec2(textureSize(tex,0));
mat.Base *= 1.5*texture(pixtex,uv);
mat.Normal = ApplyNormalMap(vTexCoord.st);
mat.Bright = vec4(1.);
}