chore(debug): Scene3D 每帧持续打印 time 与两个 sinf 采样值位模式 - 抓曲线变平时刻

This commit is contained in:
TermiNexus committed 2026-10-15 20:02:19 +08:00
1 parent d31f887290
commit d9b39e99a5
1 file changed
+29
+29
View File
@@ -25,6 +25,26 @@ _time_val: float = float(0.0)
# (x 变大后相邻采样点的相位差被量化 ⇒ 曲线塌成一条平线、热力图颜色失去层次)。
define TIME_WRAP = float(12.566370614359172)
# [临时探针] 每帧打印 time 与两个 sinf 采样值的位模式:
# 正常时 a/b 随 time 变化且互不相同;"曲线变平"时应能看到 a==b(相位被量化)或三者一起冻结。定位后删除。
_tk_hex: t.CArray[char, 17] = "0123456789ABCDEF"
def _dbg_puts(s: const str):
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64(s))
def _dbg_hex32(slot: char, val: uint32):
buf: t.CArray[char, 12]
buf[0] = slot
buf[1] = '='
i: int = 7
while i >= 0:
buf[2 + i] = _tk_hex[int(val & uint32(0xF))]
val = val >> 4
i -= 1
buf[10] = ' '
buf[11] = 0
_dbg_puts(&buf[0])
def _render_thread(arg: t.CPtr):
global _time_val
root: vpui.Tk* = _root_ptr
@@ -36,6 +56,15 @@ def _render_thread(arg: t.CPtr):
if _time_val >= TIME_WRAP: _time_val = _time_val - TIME_WRAP
root.update()
process.yield_cpu()
# [临时探针] 每帧打印:time / sinf(0.5-ws) / sinf(3.0-ws) 的位模式(定位后删除)
ws: float = _time_val * float(2.0)
sa: float = math.sinf(float(0.5) - ws)
sb: float = math.sinf(float(3.0) - ws)
_dbg_puts("[s3d] ")
_dbg_hex32('t', *(uint32*(&_time_val)))
_dbg_hex32('a', *(uint32*(&sa)))
_dbg_hex32('b', *(uint32*(&sb)))
_dbg_puts("\n")
@c.Attribute(t.attr.section(".text.startup"), t.attr.aligned(16))
def _start() -> int | t.CExport: