diff options
Diffstat (limited to 'tests/RenderScriptTests/ShadersTest/res')
-rw-r--r-- | tests/RenderScriptTests/ShadersTest/res/drawable-nodpi/robot.png | bin | 0 -> 292580 bytes | |||
-rw-r--r-- | tests/RenderScriptTests/ShadersTest/res/raw/depth_fs.glsl | 13 | ||||
-rw-r--r-- | tests/RenderScriptTests/ShadersTest/res/raw/robot.a3d | bin | 0 -> 144528 bytes | |||
-rw-r--r-- | tests/RenderScriptTests/ShadersTest/res/raw/vignette_fs.glsl | 31 |
4 files changed, 44 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/ShadersTest/res/drawable-nodpi/robot.png b/tests/RenderScriptTests/ShadersTest/res/drawable-nodpi/robot.png Binary files differnew file mode 100644 index 0000000..f7353fd --- /dev/null +++ b/tests/RenderScriptTests/ShadersTest/res/drawable-nodpi/robot.png diff --git a/tests/RenderScriptTests/ShadersTest/res/raw/depth_fs.glsl b/tests/RenderScriptTests/ShadersTest/res/raw/depth_fs.glsl new file mode 100644 index 0000000..096843b --- /dev/null +++ b/tests/RenderScriptTests/ShadersTest/res/raw/depth_fs.glsl @@ -0,0 +1,13 @@ +void main() { + // Non-linear depth value + float z = gl_FragCoord.z; + // Near and far planes from the projection + // In practice, these values can be used to tweak + // the focus range + float n = UNI_near; + float f = UNI_far; + // Linear depth value + z = (2.0 * n) / (f + n - z * (f - n)); + + gl_FragColor = vec4(z, z, z, 1.0); +} diff --git a/tests/RenderScriptTests/ShadersTest/res/raw/robot.a3d b/tests/RenderScriptTests/ShadersTest/res/raw/robot.a3d Binary files differnew file mode 100644 index 0000000..f48895c --- /dev/null +++ b/tests/RenderScriptTests/ShadersTest/res/raw/robot.a3d diff --git a/tests/RenderScriptTests/ShadersTest/res/raw/vignette_fs.glsl b/tests/RenderScriptTests/ShadersTest/res/raw/vignette_fs.glsl new file mode 100644 index 0000000..2dc1ea3 --- /dev/null +++ b/tests/RenderScriptTests/ShadersTest/res/raw/vignette_fs.glsl @@ -0,0 +1,31 @@ +#define CRT_MASK + +varying vec2 varTex0; + +void main() { + lowp vec4 color = texture2D(UNI_Tex0, varTex0); + + vec2 powers = pow(abs((gl_FragCoord.xy / vec2(UNI_width, UNI_height)) - 0.5), vec2(2.0)); + float gradient = smoothstep(UNI_size - UNI_feather, UNI_size + UNI_feather, + powers.x + powers.y); + + color = vec4(mix(color.rgb, vec3(0.0), gradient), 1.0); + +#ifdef CRT_MASK + float vShift = gl_FragCoord.y; + if (mod(gl_FragCoord.x, 6.0) >= 3.0) { + vShift += 2.0; + } + + lowp vec3 r = vec3(0.95, 0.0, 0.2); + lowp vec3 g = vec3(0.2, 0.95, 0.0); + lowp vec3 b = vec3(0.0, 0.2, 0.95); + int channel = int(floor(mod(gl_FragCoord.x, 3.0))); + lowp vec4 crt = vec4(r[channel], g[channel], b[channel], 1.0); + crt *= clamp(floor(mod(vShift, 4.0)), 0.0, 1.0); + + color = (crt * color * 1.25) + 0.05; +#endif + + gl_FragColor = color; +} |