From 214d9d80a94b9ddaa313c11d0245184482c32bde Mon Sep 17 00:00:00 2001 From: iv_vuytsik Date: Thu, 25 Sep 2025 08:31:31 +0300 Subject: [PATCH] AEB-57: fix Babylon loader update --- frontend/.gitignore | Bin 605 -> 704 bytes frontend/components/model/ModelViewer.tsx | 28 +++++++++++----------- frontend/tailwind.config.js | 17 +++++++++++++ 3 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 frontend/tailwind.config.js diff --git a/frontend/.gitignore b/frontend/.gitignore index c424a30996ba3b1ae97bc0ed0befe0c172b793f0..965ef77b98936d69959b1374741052aab61d66a3 100644 GIT binary patch literal 704 zcma)3!H(P@4CNdt|G;W5?MQ)p&%N|KAFv|e$+#tez*%+wejj8<+p3oe3G8P-``J9} zE0Mm7l=jWqJH=u)miw_9pLgr3u#eO%Zz)$!+j8UX>RYaQ&y}=W^C9{X)+21@X`Y^S zph787@=R@>Y|4RN_8blrfNM%B^VDy1!TaWFvM`=bt2puZp7-$Mv2ptJD@AhckAzpM zjdRcFt%aIEE!y~uh}-DI6a5zRbF}ZKMFQmG>7-I2&I_slUJs7p#CL8U3cp`pu7Z*0 z>0%1)XDrZqpiL_KGE5WmhAH|q{{mENt{)kF@V_}-0;Sh;h5CzkN#`O9r?G7O#?I1* z(tOj2C{XwcRbZfB=VDGz5zxaJi+C&4eB~ltwzM%8r(1?*EMNiM1mI_hAIZlfkPc3q zb}8VC1H}dbF<`&=4ckLwU-pdk6}r|)nq7HYK0)PF!yzTOty&eUO)Y9ySp}eRpcgf( UNj)L{KiLKq81;UEPpS;=J7pEjR{#J2 literal 605 zcmZWmL2d&f47~dlRJo)pE!=x<4?X7r5ev@76$=PVl>EMCH%S%s0(geO<6)-`i0aIo z>xVIC3|Y^_=Qe4V7Gn#O3s?=!F%^pQc%ojaQz~jn1(lsrWA&ibN^5|f@|ZDtjE=B^ ziOJ(}Nxq31jLtDbU-SU_W=k{!ylsbU*`4LiqYQ1P_$&(swDpg^V5yXZmxhd$#UU7% z1hzAFFyfW;Q_rDrTNoC{vd@lld2;*goNbQ}CDrFuiu3<{r3vnMn(MfEhNB<651VeWq6FCf^ z@4Fy;%UE5Z%;J;lIs?U1f^QgRKt8Dc0aUMgJw!uq&@Mbz=WY291 i = ({ const engine = new Engine(canvas, true) engineRef.current = engine + engine.runRenderLoop(() => { + if (!isDisposedRef.current && sceneRef.current) { + sceneRef.current.render() + } + }) + const scene = new Scene(engine) sceneRef.current = scene @@ -88,12 +95,6 @@ const ModelViewer: React.FC = ({ fillLight.intensity = 0.3 fillLight.diffuse = new Color3(0.8, 0.8, 1) - engine.runRenderLoop(() => { - if (!isDisposedRef.current) { - scene.render() - } - }) - const handleResize = () => { if (!isDisposedRef.current) { engine.resize() @@ -124,6 +125,9 @@ const ModelViewer: React.FC = ({ if (!sceneRef.current || isDisposedRef.current) { return } + + const oldMeshes = sceneRef.current.meshes.slice(); + oldMeshes.forEach(m => m.dispose()); setIsLoading(true) setLoadingProgress(0) @@ -142,12 +146,7 @@ const ModelViewer: React.FC = ({ }, 100) try { - const result = await SceneLoader.ImportMeshAsync( - '', - modelPath, - '', - sceneRef.current - ) + const result = await ImportMeshAsync(modelPath, sceneRef.current) clearInterval(progressInterval) setLoadingProgress(100) @@ -196,7 +195,8 @@ const ModelViewer: React.FC = ({ } } - loadModel() + // Загрузка модлеи начинается после появления спиннера + requestIdleCallback(() => loadModel(), { timeout: 50 }) }, [modelPath, onError, onModelLoaded]) return ( diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js new file mode 100644 index 0000000..d753aeb --- /dev/null +++ b/frontend/tailwind.config.js @@ -0,0 +1,17 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + './app/**/*.{js,ts,jsx,tsx}', + './components/**/*.{js,ts,jsx,tsx}', + './lib/**/*.{js,ts,jsx,tsx}', + './services/**/*.{js,ts,jsx,tsx}', + ], + safelist: [], + blocklist: [ + './public/**/*', + './data/**/*', + '!./assets/big-models/**/*' + ], + theme: { extend: {} }, + plugins: [], +}; \ No newline at end of file