alpha test: fix typo, add back rounding offset

This commit is contained in:
Henrik Rydgard 2013-07-18 01:01:53 +02:00
parent c543665513
commit d76c45411d

View File

@ -202,10 +202,10 @@ void GenerateFragmentShader(char *buffer) {
}
if (enableAlphaTest) {
WRITE(p, "float roundTo255th(in float x) { return x - fract(x * 255.0) * (1.0 / 255.0); }\n");
WRITE(p, "float roundTo255th(in float x) { float y = x + (0.5/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
}
if (enableColorTest) {
WRITE(p, "float roundTo255thv(in vec3 x) { return x - fract(x * 255.0) * (1.0 / 255.0); }\n");
WRITE(p, "vec3 roundTo255thv(in vec3 x) { vec3 y = x + (0.5/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
}
WRITE(p, "void main() {\n");