| @@ -180,7 +180,7 @@ void Scene::Render() // XXX: rename to Blit() | |||||
| #endif | #endif | ||||
| #if 0 | #if 0 | ||||
| " float mul = 2.0;\n" | " float mul = 2.0;\n" | ||||
| #if 0 | |||||
| #if 1 | |||||
| " vec2 d1 = mod(vec2(gl_FragCoord), vec2(2.0, 2.0));\n" | " vec2 d1 = mod(vec2(gl_FragCoord), vec2(2.0, 2.0));\n" | ||||
| " float t1 = mod(3.0 * d1.x + 2.0 * d1.y, 4.0);\n" | " float t1 = mod(3.0 * d1.x + 2.0 * d1.y, 4.0);\n" | ||||
| " float dx2 = mod(floor(gl_FragCoord.x * 0.5), 2.0);\n" | " float dx2 = mod(floor(gl_FragCoord.x * 0.5), 2.0);\n" | ||||
| @@ -189,9 +189,9 @@ void Scene::Render() // XXX: rename to Blit() | |||||
| " float dx3 = mod(floor(gl_FragCoord.x * 0.25), 2.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 dy3 = mod(floor(gl_FragCoord.y * 0.25), 2.0);\n" | ||||
| " float t3 = mod(3.0 * dx3 + 2.0 * dy3, 4.0);\n" | " float t3 = mod(3.0 * dx3 + 2.0 * dy3, 4.0);\n" | ||||
| " float t1 = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n" | |||||
| " float t2 = t1;\n" | |||||
| " float t3 = t1;\n" | |||||
| " t1 = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n" | |||||
| " t2 = t1;\n" | |||||
| " t3 = t1;\n" | |||||
| #else | #else | ||||
| " float rand = sin(gl_FragCoord.x * 1.23456) * 123.456\n" | " float rand = sin(gl_FragCoord.x * 1.23456) * 123.456\n" | ||||
| " + cos(gl_FragCoord.y * 2.34567) * 789.012;\n" | " + cos(gl_FragCoord.y * 2.34567) * 789.012;\n" | ||||
| @@ -226,10 +226,45 @@ void Scene::Render() // XXX: rename to Blit() | |||||
| "}", | "}", | ||||
| "void main(float2 in_TexCoord : TEXCOORD0," | "void main(float2 in_TexCoord : TEXCOORD0," | ||||
| " float4 in_FragCoord : WPOS," | |||||
| " uniform sampler2D tex," | " uniform sampler2D tex," | ||||
| " out float4 out_FragColor : COLOR)" | " out float4 out_FragColor : COLOR)" | ||||
| "{" | "{" | ||||
| " out_FragColor = tex2D(tex, in_TexCoord);" | |||||
| " float4 col = tex2D(tex, in_TexCoord);" | |||||
| #if 0 | |||||
| " float mul = 2.0;\n" | |||||
| " float t1, t2, t3;\n" | |||||
| #if 1 | |||||
| " float dx1 = frac(in_FragCoord.x * 0.5) * 2.0;\n" | |||||
| " float dy1 = frac(in_FragCoord.y * 0.5) * 2.0;\n" | |||||
| " t1 = frac((3.0 * dx1 + 2.0 * dy1) / 4.0) * 4.0;\n" | |||||
| " float dx2 = frac(floor(in_FragCoord.x * 0.5) * 0.5) * 2.0;\n" | |||||
| " float dy2 = frac(floor(in_FragCoord.y * 0.5) * 0.5) * 2.0;\n" | |||||
| " t2 = frac((3.0 * dx2 + 2.0 * dy2) / 4.0) * 4.0;\n" | |||||
| " float dx3 = frac(floor(in_FragCoord.x * 0.25) * 0.5) * 2.0;\n" | |||||
| " float dy3 = frac(floor(in_FragCoord.y * 0.25) * 0.5) * 2.0;\n" | |||||
| " t3 = frac((3.0 * dx3 + 2.0 * dy3) / 4.0) * 4.0;\n" | |||||
| " t1 = (1.0 + 4.0 * t1 + t2) / 17.0;\n" | |||||
| " t2 = t1;\n" | |||||
| " t3 = t1;\n" | |||||
| #else | |||||
| " float rand = sin(in_FragCoord.x * 1.23456) * 123.456\n" | |||||
| " + cos(in_FragCoord.y * 2.34567) * 789.012;\n" | |||||
| " t1 = frac(sin(rand) * 17.13043);\n" | |||||
| " t2 = frac(sin(rand) * 27.13043);\n" | |||||
| " t3 = frac(sin(rand) * 37.13043);\n" | |||||
| #endif | |||||
| " float fracx = frac(col.x * mul);\n" | |||||
| " float fracy = frac(col.y * mul);\n" | |||||
| " float fracz = frac(col.z * mul);\n" | |||||
| " fracx = fracx > t1 ? 1.0 : 0.0;\n" | |||||
| " fracy = fracy > t2 ? 1.0 : 0.0;\n" | |||||
| " fracz = fracz > t3 ? 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 | |||||
| " out_FragColor = col;" | |||||
| "}"); | "}"); | ||||
| #endif | #endif | ||||
| } | } | ||||