fix: 移动端玻璃模型折射 loop 钳制 — 对齐原版移动端分支
原版 apply effect: t=O?Math.min(B.loop,2):B.loop(O=isMobileWidth), uRgbRefraction=+(t<=3)。移动端 loop=2 少一轮折射采样,色散/亮度观感 与桌面不同。移植版此前移动端仍用 3,导致移动端(含 Dark 主题下的 Hello/cursor)观感与原版有差异。
This commit is contained in:
@@ -523,6 +523,13 @@ function GlassModel({
|
|||||||
// flips. Per-model tingColor overrides: m[0]/m[1] light A/B,
|
// flips. Per-model tingColor overrides: m[0]/m[1] light A/B,
|
||||||
// m[2]/m[3] dark A/B, missing entries fall back to the theme defaults.
|
// m[2]/m[3] dark A/B, missing entries fall back to the theme defaults.
|
||||||
const isDark = useResolvedTheme() === "dark";
|
const isDark = useResolvedTheme() === "dark";
|
||||||
|
// 原版移动端钳制 loop(apply effect: t=O?Math.min(B.loop,2):B.loop)——
|
||||||
|
// 折射采样少一轮,色散/亮度观感随设备宽度变化;桌面 3、移动 2。
|
||||||
|
const loop = isMobile ? Math.min(LIGHT_PARAMS.loop, 2) : LIGHT_PARAMS.loop;
|
||||||
|
useEffect(() => {
|
||||||
|
uniforms.uLoop.value = loop;
|
||||||
|
uniforms.uRgbRefraction.value = +(loop <= 3);
|
||||||
|
}, [loop, uniforms]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const P = isDark ? DARK_PARAMS : LIGHT_PARAMS;
|
const P = isDark ? DARK_PARAMS : LIGHT_PARAMS;
|
||||||
uniforms.uShininess.value = P.shininess;
|
uniforms.uShininess.value = P.shininess;
|
||||||
|
|||||||
Reference in New Issue
Block a user