You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
503 B
GLSL
22 lines
503 B
GLSL
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
varying vec2 v_Position;
|
|
varying vec4 v_Colour;
|
|
|
|
uniform vec2 mousePos;
|
|
uniform float flashlightSize;
|
|
|
|
const float smoothness = 0.1;
|
|
|
|
void main(void)
|
|
{
|
|
vec2 diff = mousePos - v_Position;
|
|
|
|
float dist = sqrt(diff.x * diff.x + diff.y * diff.y);
|
|
|
|
float smoothnessRange = flashlightSize * smoothness;
|
|
|
|
gl_FragColor = v_Colour * vec4(1.0, 1.0, 1.0, smoothstep(flashlightSize, flashlightSize + smoothnessRange, dist));
|
|
} |