浏览代码

Merge pull request #105837 from clayjohn/sky-acos-bugfix

Fix float/int comparison in acos_approx in sky template shader
Thaddeus Crews 6 月之前
父节点
当前提交
dedc072840
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      drivers/gles3/shaders/sky.glsl
  2. 1 1
      servers/rendering/renderer_rd/shaders/environment/sky.glsl

+ 1 - 1
drivers/gles3/shaders/sky.glsl

@@ -157,7 +157,7 @@ float acos_approx(float p_x) {
 	float x = abs(p_x);
 	float res = -0.156583f * x + (M_PI / 2.0);
 	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

+ 1 - 1
servers/rendering/renderer_rd/shaders/environment/sky.glsl

@@ -193,7 +193,7 @@ float acos_approx(float p_x) {
 	float x = abs(p_x);
 	float res = -0.156583f * x + (M_PI / 2.0);
 	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