Fixed Memory Leak and Improved Performance
This commit is contained in:
@@ -105,6 +105,8 @@ if (window.innerWidth <= 600) {
|
|||||||
const loaderContainer = document.getElementById('loader-container');
|
const loaderContainer = document.getElementById('loader-container');
|
||||||
const loadingText = document.getElementById('loading-text');
|
const loadingText = document.getElementById('loading-text');
|
||||||
|
|
||||||
|
let latestModelPath = null;
|
||||||
|
|
||||||
//Load Function
|
//Load Function
|
||||||
function loadModel(modelPath) {
|
function loadModel(modelPath) {
|
||||||
if (currentModel) {
|
if (currentModel) {
|
||||||
@@ -147,6 +149,7 @@ function loadModel(modelPath) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startApp() {
|
function startApp() {
|
||||||
// 1. Create an object to hold the currently selected values
|
// 1. Create an object to hold the currently selected values
|
||||||
const modelsData = loadData;
|
const modelsData = loadData;
|
||||||
@@ -237,7 +240,6 @@ scene.environment = env_texture;
|
|||||||
renderer.setAnimationLoop( animate );
|
renderer.setAnimationLoop( animate );
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
requestAnimationFrame(animate);
|
|
||||||
const delta = clock.getDelta();
|
const delta = clock.getDelta();
|
||||||
if (mixer) {
|
if (mixer) {
|
||||||
mixer.update(delta);
|
mixer.update(delta);
|
||||||
@@ -246,7 +248,6 @@ function animate() {
|
|||||||
renderer.render( scene, camera );
|
renderer.render( scene, camera );
|
||||||
}
|
}
|
||||||
|
|
||||||
animate();
|
|
||||||
|
|
||||||
//Toggle GUI
|
//Toggle GUI
|
||||||
function setGuiEnabled(guiInstance, isEnabled) {
|
function setGuiEnabled(guiInstance, isEnabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user