Parcourir la source

video: 8×8 Bresenham dithering (still deactivated).

legacy
Sam Hocevar sam il y a 13 ans
Parent
révision
1f3d06c581
1 fichiers modifiés avec 14 ajouts et 4 suppressions
  1. +14
    -4
      src/video.cpp

+ 14
- 4
src/video.cpp Voir le fichier

@@ -87,16 +87,26 @@ static char const *fragmentshader =
#else
" vec4 col = texture2D(in_Texture, vec2(gl_TexCoord[0]));\n"
#if 0
" float mul = 2.0;\n"
" float dx1 = mod(gl_FragCoord.x, 2.0);\n"
" float dy1 = mod(gl_FragCoord.y, 2.0);\n"
" float t1 = mod(3.0 * dx1 + 2.0 * dy1, 4.0);\n"
" float dx2 = mod(floor(gl_FragCoord.x * 0.5), 2.0);\n"
" float dy2 = mod(floor(gl_FragCoord.y * 0.5), 2.0);\n"
" float t2 = mod(3.0 * dx2 + 2.0 * dy2, 4.0);\n"
" float t = (1.0 + 4.0 * t1 + t2) / 17.0;\n"
" col.x = col.x > t ? 1.0 : 0.0;\n"
" col.y = col.y > t ? 1.0 : 0.0;\n"
" col.z = col.z > t ? 1.0 : 0.0;\n"
" float dx3 = mod(floor(gl_FragCoord.x * 0.25), 2.0);\n"
" float dy3 = mod(floor(gl_FragCoord.y * 0.25), 2.0);\n"
" float t3 = mod(3.0 * dx3 + 2.0 * dy3, 4.0);\n"
" float t = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n"
" float fracx = fract(col.x * mul);\n"
" float fracy = fract(col.y * mul);\n"
" float fracz = fract(col.z * mul);\n"
" fracx = fracx > t ? 1.0 : 0.0;\n"
" fracy = fracy > t ? 1.0 : 0.0;\n"
" fracz = fracz > t ? 1.0 : 0.0;\n"
" col.x = (floor(col.x * mul) + fracx) / mul;\n"
" col.y = (floor(col.y * mul) + fracy) / mul;\n"
" col.z = (floor(col.z * mul) + fracz) / mul;\n"
#endif
" gl_FragColor = col;\n"
#endif


Chargement…
Annuler
Enregistrer