Skip to content

Commit 63d4d1e

Browse files
authored
Update fragment-shader.js
1 parent 6d7dde3 commit 63d4d1e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backend/web-gl/fragment-shader.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ float asinh(float x) {
2424
}
2525
2626
float atan2(float v1, float v2) {
27-
if (v1 == 0.0 || v2 == 0.0) return 0.0;
28-
return atan(v1 / v2);
27+
if (v2 == 0.0) {
28+
if (v1 == 0.0) return 0.0;
29+
if (v1 > 0.0) return 1.5707963267948966;
30+
if (v1 < 0.0) return -1.5707963267948966;
31+
}
32+
return atan(v1, v2);
2933
}
3034
3135
float atanh(float x) {
@@ -493,4 +497,4 @@ void main(void) {
493497

494498
module.exports = {
495499
fragmentShader
496-
};
500+
};

0 commit comments

Comments
 (0)