From 8de2c3004bfe0b09322ca1cc8a83ace370ac5082 Mon Sep 17 00:00:00 2001 From: Impaczus Date: Wed, 5 Aug 2026 02:22:02 +0800 Subject: [PATCH] Fixed Memory Leak and Improved Performance --- main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 571e07c..0989f8c 100644 --- a/main.js +++ b/main.js @@ -105,6 +105,8 @@ if (window.innerWidth <= 600) { const loaderContainer = document.getElementById('loader-container'); const loadingText = document.getElementById('loading-text'); +let latestModelPath = null; + //Load Function function loadModel(modelPath) { if (currentModel) { @@ -147,6 +149,7 @@ function loadModel(modelPath) { }); } + function startApp() { // 1. Create an object to hold the currently selected values const modelsData = loadData; @@ -237,7 +240,6 @@ scene.environment = env_texture; renderer.setAnimationLoop( animate ); function animate() { - requestAnimationFrame(animate); const delta = clock.getDelta(); if (mixer) { mixer.update(delta); @@ -246,7 +248,6 @@ function animate() { renderer.render( scene, camera ); } -animate(); //Toggle GUI function setGuiEnabled(guiInstance, isEnabled) {