fix(scene3d): PI 改为运行期 float 变量 - 消除 float 字面量被折叠成 double 致波形算术提升为 double(SIN 波形塌平)
This commit is contained in:
1 parent
2803aff04c
commit
aec563e33a
1 file changed
+7
-1
+7
-1
@@ -4,7 +4,13 @@ import string
|
||||
import t, c
|
||||
|
||||
|
||||
define PI = float(3.14159265358979323846)
|
||||
# [修复] 原为 `define PI = float(3.14159265358979323846)`:常量折叠后 IR 里是 **double** 常量
|
||||
# (`-PI` 生成 0xC00921FB54442D18),于是 `x0 = -PI + i*step` 整段被提升成 double 运算
|
||||
# (fpext → fadd(double) → fptrunc),与 _DrawSphere 的纯 float 路径不一致 ——
|
||||
# 现场表现为 SIN 波形高度塌平(球体只用 i*step,不含 -PI,因此不受影响)。
|
||||
# 改成运行期全局变量:PI 参与的所有运算都在运行时按 float 进行,绕开该折叠路径。
|
||||
# 根因是编译器的 float 字面量折叠(已单独记录),编译器修好后可改回 define。
|
||||
PI: float = float(3.14159265358979323846)
|
||||
|
||||
define SPHERE_SLICES = (24 * 1)
|
||||
define SPHERE_STACKS = (16 * 1)
|
||||
|
||||
Reference in new issue
Block a user