Location shaders: check no rotation, fixes #321
This commit is contained in:
@@ -22,7 +22,7 @@ uniform float u_phase;
|
||||
uniform vec2 u_dir;
|
||||
void main() {
|
||||
float len = 1.0 - length(v_tex);
|
||||
if (u_dir.x == 0.0 && u_dir.y == 0.0){
|
||||
if (u_dir.x == 0.0 && u_dir.y == 0.0) {
|
||||
gl_FragColor = vec4(0.2, 0.2, 0.8, 1.0) * len;
|
||||
} else {
|
||||
// outer ring
|
||||
|
||||
@@ -22,7 +22,7 @@ uniform float u_phase;
|
||||
uniform vec2 u_dir;
|
||||
void main() {
|
||||
float len = 1.0 - length(v_tex);
|
||||
if (u_dir.x == 0.0 && u_dir.y == 0.0){
|
||||
if (u_dir.x == 0.0 && u_dir.y == 0.0) {
|
||||
gl_FragColor = vec4(0.2, 0.2, 0.8, 1.0) * len;
|
||||
} else {
|
||||
// outer ring
|
||||
|
||||
@@ -22,19 +22,23 @@ uniform float u_phase;
|
||||
uniform vec2 u_dir;
|
||||
void main() {
|
||||
float len = 1.0 - length(v_tex);
|
||||
// outer ring
|
||||
float a = smoothstep(0.0, 2.0 / u_scale, len);
|
||||
// inner ring
|
||||
float b = 0.8 * smoothstep(3.0 / u_scale, 4.0 / u_scale, len);
|
||||
// center point
|
||||
float c = 0.5 * (1.0 - smoothstep(14.0 / u_scale, 16.0 / u_scale, 1.0 - len));
|
||||
vec2 dir = normalize(v_tex);
|
||||
float d = dot(dir, u_dir);
|
||||
// 0.5 width of viewshed
|
||||
d = clamp(smoothstep(0.7, 0.7 + 2.0/u_scale, d) * len, 0.0, 1.0);
|
||||
// - subtract inner from outer to create the outline
|
||||
// - multiply by viewshed
|
||||
// - add center point
|
||||
a = max(d, (a - (b + c)) + c);
|
||||
gl_FragColor = vec4(0.2, 0.2, 0.8, 1.0) * a;
|
||||
if (u_dir.x == 0.0 && u_dir.y == 0.0) {
|
||||
gl_FragColor = vec4(0.2, 0.2, 0.8, 1.0) * len;
|
||||
} else {
|
||||
// outer ring
|
||||
float a = smoothstep(0.0, 2.0 / u_scale, len);
|
||||
// inner ring
|
||||
float b = 0.8 * smoothstep(3.0 / u_scale, 4.0 / u_scale, len);
|
||||
// center point
|
||||
float c = 0.5 * (1.0 - smoothstep(14.0 / u_scale, 16.0 / u_scale, 1.0 - len));
|
||||
vec2 dir = normalize(v_tex);
|
||||
float d = dot(dir, u_dir);
|
||||
// 0.5 width of viewshed
|
||||
d = clamp(smoothstep(0.7, 0.7 + 2.0/u_scale, d) * len, 0.0, 1.0);
|
||||
// - subtract inner from outer to create the outline
|
||||
// - multiply by viewshed
|
||||
// - add center point
|
||||
a = max(d, (a - (b + c)) + c);
|
||||
gl_FragColor = vec4(0.2, 0.2, 0.8, 1.0) * a;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user