// Proxy shader for canvas textures void SetupMaterial( inout Material mat ) { // canvas textures are upside-down when used by models // this is the default use-case here, so for other situations, // there's a macro for itâ„¢ #ifdef STRAIGHT_UVS mat.Base = texture(scrtex,vTexCoord.st); #else mat.Base = texture(scrtex,vec2(vTexCoord.s,1.-vTexCoord.t)); #endif // drawing with render styles applied can alter the alpha of the // canvas itself, which may not be intended, so cap it to 100% here // unless explicitly disabled #ifndef DONT_FIX_ALPHA mat.Base.a = 1.; #endif // treat a color (usually pure black) as fully transparent // used by some special textures #ifdef ALPHA_KEY if ( mat.Base.rgb == ALPHA_KEY ) mat.Base.a = 0.; #endif mat.Normal = ApplyNormalMap(vTexCoord.st); // by default, canvas textures are treated as fullbright #ifndef NO_FULLBRIGHT mat.Bright = vec4(1.); #endif }