mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-04-03 11:09:40 -04:00
- Added ExampleApplication build so it can be tested without needing to compile first. - Resources and dlls included in added build directory. - Updated readme instructions.
38 lines
1.5 KiB
GLSL
38 lines
1.5 KiB
GLSL
#version 120
|
|
|
|
// Input vertex attributes (from vertex shader)
|
|
varying vec2 fragTexCoord;
|
|
varying vec4 fragColor;
|
|
|
|
// Input uniform values
|
|
uniform sampler2D texture0;
|
|
uniform vec4 colDiffuse;
|
|
|
|
// NOTE: Add here your custom variables
|
|
vec2 resolution = vec2(800.0, 450.0);
|
|
|
|
void main()
|
|
{
|
|
float x = 1.0/resolution.x;
|
|
float y = 1.0/resolution.y;
|
|
|
|
vec4 horizEdge = vec4(0.0);
|
|
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
|
|
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0;
|
|
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
|
|
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
|
|
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0;
|
|
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
|
|
|
|
vec4 vertEdge = vec4(0.0);
|
|
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
|
|
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0;
|
|
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
|
|
vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
|
|
vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0;
|
|
vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
|
|
|
|
vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb));
|
|
|
|
gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a);
|
|
} |