File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -289,6 +289,15 @@ float REFRACTION_sin(float x)
289289 x = mod(x+PI, 2.0*PI)-PI;
290290 return x*(0.999999599920672 + x*x*(-0.166665526354071 + x*x*(0.00833240298869917 + x*x*(-0.0001980863334175 + x*x*(2.69971463693744e-6 - 2.03622449118901e-8*x*x)))));
291291}
292+ // Workaround for Intel's and AMD's unusable implementation of asin, which leads to time-dependent shifts of the Moon from its refracted positions.
293+ float REFRACTION_asin(float x)
294+ {
295+ float sign = x < 0 ? -1 : 1;
296+ if(x < 0) x = -x;
297+ x = 2 * sqrt(1 - x) - 1;
298+ return 0.848061881596496 + x*(-0.755929497461161 + x*(-0.0539853235799928 + x*(-0.025701166121295 + x*(-0.00723634508887381 +
299+ x*(-0.00314276748524976 + x*(-0.00101365621070969 + x*(-0.000411380592372285 + x*(-0.000428167561924693 - 0.000213293541786718*x))))))));
300+ }
292301vec3 innerRefractionForward(vec3 altAzPos)
293302{
294303 const float PI = 3.14159265;
@@ -307,7 +316,7 @@ vec3 innerRefractionForward(vec3 altAzPos)
307316 }
308317
309318 float sinGeo = altAzPos[2]/len;
310- float geom_alt_rad = asin (sinGeo);
319+ float geom_alt_rad = REFRACTION_asin (sinGeo);
311320 float geom_alt_deg = M_180_PI*geom_alt_rad;
312321 if (geom_alt_deg > MIN_GEO_ALTITUDE_DEG)
313322 {
You can’t perform that action at this time.
0 commit comments