You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Fix float/int comparison in acos_approx in sky template shader
Strict GLSL implementations will not automatically convert `0` to a float
This commit is contained in:
@@ -157,7 +157,7 @@ float acos_approx(float p_x) {
|
|||||||
float x = abs(p_x);
|
float x = abs(p_x);
|
||||||
float res = -0.156583f * x + (M_PI / 2.0);
|
float res = -0.156583f * x + (M_PI / 2.0);
|
||||||
res *= sqrt(1.0f - x);
|
res *= sqrt(1.0f - x);
|
||||||
return (p_x >= 0) ? res : M_PI - res;
|
return (p_x >= 0.0) ? res : M_PI - res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on https://math.stackexchange.com/questions/1098487/atan2-faster-approximation
|
// Based on https://math.stackexchange.com/questions/1098487/atan2-faster-approximation
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ float acos_approx(float p_x) {
|
|||||||
float x = abs(p_x);
|
float x = abs(p_x);
|
||||||
float res = -0.156583f * x + (M_PI / 2.0);
|
float res = -0.156583f * x + (M_PI / 2.0);
|
||||||
res *= sqrt(1.0f - x);
|
res *= sqrt(1.0f - x);
|
||||||
return (p_x >= 0) ? res : M_PI - res;
|
return (p_x >= 0.0) ? res : M_PI - res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on https://math.stackexchange.com/questions/1098487/atan2-faster-approximation
|
// Based on https://math.stackexchange.com/questions/1098487/atan2-faster-approximation
|
||||||
|
|||||||
Reference in New Issue
Block a user