Files
西风逍遥游 31880f0021 feat(examples): gate examples in CI and make repository scripts UTF-8 on every host
`examples/<name>/` was a tested surface in name only. The source-quality job had
no examples check at all, and scripts/smoke_examples.sh accepted any process that
had not printed one of its error markers: a project that died during startup,
exited after a single frame, or crashed without a marker was reported as PASS.
Nothing stopped a malformed or unregistered example from reaching dev, which is
how 14 examples arrived without READMEs and 20 were never registered in the
overview table.

Source side
- scripts/check_examples.py classifies every directory under examples/ as either
  runnable (main.nut plus a config.nut that assigns the engine `config` table) or
  as a reviewed non-runnable sample listed in NON_RUNNABLE_EXAMPLES with a
  reason. Both kinds must own a README.md and appear in examples/README.md.
  Stale exemptions and overview links to missing directories fail as well.
- `make check/examples` and a new source-quality CI step run the gate.
- scripts/tests/test_check_examples.py covers it and pins each failure mode
  against fixtures.

Runtime side
- scripts/smoke_examples.sh now enforces liveness, not just marker absence: every
  runnable example must still be running after MIN_RUN_SECONDS (default 2s; CI
  passes 2s), and a process that dies inside that window fails whatever its exit
  code. A clean self-exit after the window passes with an explicit note instead
  of being silently accepted as a pass.
- The Linux CI step sets MIN_RUN_SECONDS=2 and keeps RUN_SECONDS=6, so the job's
  wall clock is unchanged (13.7 min of its 20 min budget on dev).

Windows / GBK
- scripts/utf8_stdio.py re-encodes stdout/stderr as UTF-8 and every scripts/*.py
  program calls it as the first statement of its __main__ block. On a Chinese
  Windows a redirected stream falls back to the ANSI code page (cp936), and
  printing a character that code page cannot encode (arrows, superscripts, bullet
  separators, emoji - all common in this repository) raised UnicodeEncodeError
  and turned a checker into a traceback.
- The mirror image is input: read_text() without encoding= decoded UTF-8
  repository text as cp936 and raised UnicodeDecodeError.
- scripts/tests/test_utf8_stdio.py enforces both conventions for every script and
  test module; text file I/O and child-process decoding now pass encoding="utf-8"
  explicitly.
- Unit-test invocations run with `python3 -X utf8` so the runner's own output
  never follows the host code page.

Violations the new gates found on top of dev, fixed here: 14 examples shipped
without a README (fluid3d, mesh-impact-lab, mesh-modifier-lab, spline-tube-lab on
the earlier dev tip, plus pcg-depth-of-field, pcg-detail-overwrite,
pcg-layer-culling, pcg-location-system, pcg-runtime-orchestration,
pcg-scene-player-culling, pcg-snow-wind, pcg-thunder-strike, pcg-ui-scaler and
pcg-underwater added by #397), 20 were missing from the overview table (those 14
plus archspace-editor, geometry-stroke-lab, interior-mapping, layered-animation,
triplanar-decal, terrain-stamping), and scripts/export_meshret_onnx.py had no
UTF-8 stdio guard.

Verified locally: `python -m ruff check scripts` (All checks passed);
scripts/check_test_manifest.py; scripts/check_quality_metadata.py;
scripts/check_architecture_contracts.py --base HEAD; scripts/check_nodiscard.py;
`make -n check/examples`; scripts/check_examples.py (125 examples: 118 runnable,
7 reviewed non-runnable); and `python -X utf8 -m unittest discover -s scripts/tests
-p "test_*.py"` (155 tests, OK). The runtime half of the contract needs a Linux
headless build, so it is verified by the CI examples smoke step rather than
locally.
2026-09-15 20:20:23 +08:00
..

Rendering Chain Lab — TAA / SSR / RTGI 与自动反射链运行时对比场景

本示例提供一个固定视角的对比场景,用同一条渲染链交替开关 TAA、SSR、RTGI 与自动反射链 (reflectionChain),让屏幕空间反射、间接光颜色溢出和时间性闪烁/拖影的差异在同一画面上 直接对照。场景里的反光地面、饱和遮挡盒、五种粗糙度的球体和一根来回移动的细杆,都是为暴露 这些通道的典型缺陷而摆放的。

运行

make run/<platform>-debug GAME=examples/rendering-chain-lab

也可以进入示例目录后直接启动引擎:

cd examples/rendering-chain-lab && ../../build/linux-debug/src/engine/eve run --debug --mcp-port=7529

Windows 下引擎可执行文件为 build/win32-debug/src/engine/eve.exe。脚本头部记录的等价形式是 eve run --debug --mcp-port=7529 examples/rendering-chain-lab。

演示内容

  • 场景搭建:buildScene() 用 eve.Renderable3D 配 gfx.newMeshCube(1.0) / gfx.newMeshSphere(40, 24) 生成反光地面与后墙(setMetallic(0.72)、setRoughness(0.12))、 红蓝两块高饱和遮挡盒,以及 5 个球体(setMetallic(0.48),粗糙度依次为 0.06 / 0.16 / 0.30 / 0.52 / 0.82)和各自的底座。
  • 时间性伪影诱因:细杆 labMover 在 eve_update 中按 sin(labTime * 0.82) * 2.8 横向移动, 用来观察 TAA 的闪烁与拖影。
  • 相机与光照:eve.Camera3D 设 setFov(48.0)、setAmbient(...)、setExposure(0.85)、 setBloom(0.18, 1.15) 并 setActive(true);gfx.setDirectionalLight 提供主光,两个 eve.Light3D 暖 / 冷点光源补光,gfx.setBackgroundColor 定下暗色基调。
  • 渲染链开关:configureEffects() 取 gfx.getRenderControl(),先执行 rc.setPostProcessQuality("high"),再对 gi、rtgi、aa、taa、ssr、reflectionChain 逐个 enable / disable,最后 rc.compile()。
  • 反射链是一键式的:开启 reflectionChain 会同时打开 aa、taa、rtgi 并关闭 msaa, 三者共用同一套后处理质量档位。
  • 回调结构:eve_init 建场景与 HUD,eve_update(dt) 推进动画并处理按键,eve_render 依次 调用 gfx.clear()、gfx.render3D()、ui.beginFrameAndRender()。

操作

输入 作用
Space 在 FULL(TAA + SSR + RTGI + 反射链)与 BASELINE(上述特性全部关闭)之间切换
R / r 复位相机到 setEye(0.0, 4.4, 12.8) / setTarget(0.0, 1.0, -0.8)

HUD(ui.beginWindow("RenderingChainLab"),经 ui.mountBuildAs("render-lab-hud") 挂载为 宿主叠加层)只显示标题、当前模式和这两条按键提示,没有可点击控件;脚本也没有注册任何鼠标 操作,相机是固定视角。

相关文件

  • main.nut:示例全部逻辑——场景搭建、渲染链开关、HUD 以及三个引擎回调。
  • config.nut:窗口配置,1280×720,标题 EVEngine Rendering Chain Lab,debug = true。
  • README.md:本文件。