Initial
This commit is contained in:
26
shaders/fragment.glsl
Normal file
26
shaders/fragment.glsl
Normal file
@@ -0,0 +1,26 @@
|
||||
#version 130
|
||||
out mediump vec4 color;
|
||||
in mediump vec2 texcoord;
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 cursorPos;
|
||||
uniform vec2 windowSize;
|
||||
uniform vec2 screenshotSize;
|
||||
uniform float flShadow;
|
||||
uniform float flRadius;
|
||||
uniform float cameraScale;
|
||||
uniform bool gridEnabled;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 cursor = vec4(cursorPos.x, windowSize.y - cursorPos.y, 0.0, 1.0);
|
||||
color = mix(
|
||||
texture(tex, texcoord), vec4(0.0, 0.0, 0.0, 0.0),
|
||||
length(cursor - gl_FragCoord) < (flRadius * cameraScale) ? 0.0 : flShadow);
|
||||
|
||||
if(gridEnabled){
|
||||
vec2 uv = texcoord * screenshotSize;
|
||||
if(fract(uv.x) < 0.04f || fract(uv.y) < 0.04f)
|
||||
color = vec4(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
25
shaders/vertex.glsl
Normal file
25
shaders/vertex.glsl
Normal file
@@ -0,0 +1,25 @@
|
||||
#version 130
|
||||
in vec3 aPos;
|
||||
in vec2 aTexCoord;
|
||||
out vec2 texcoord;
|
||||
|
||||
uniform vec2 cameraPos;
|
||||
uniform float cameraScale;
|
||||
uniform vec2 windowSize;
|
||||
uniform vec2 screenshotSize;
|
||||
uniform vec2 cursorPos;
|
||||
|
||||
vec3 to_world(vec3 v) {
|
||||
vec2 ratio = vec2(
|
||||
windowSize.x / screenshotSize.x / cameraScale,
|
||||
windowSize.y / screenshotSize.y / cameraScale);
|
||||
return vec3((v.x / screenshotSize.x * 2.0 - 1.0) / ratio.x,
|
||||
(v.y / screenshotSize.y * 2.0 - 1.0) / ratio.y,
|
||||
v.z);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(to_world((aPos - vec3(cameraPos * vec2(1.0, -1.0), 0.0))), 1.0);
|
||||
texcoord = aTexCoord;
|
||||
}
|
||||
Reference in New Issue
Block a user