From: Lanius Trolling Date: Fri, 24 Feb 2023 17:36:30 +0000 (-0500) Subject: Fix optimizations X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=90e77c2a1d003137008902849817a536ad6bc40a;p=factbooks Fix optimizations --- diff --git a/src/main/resources/static/init.js b/src/main/resources/static/init.js index 6b3f6cd..0b8e41c 100644 --- a/src/main/resources/static/init.js +++ b/src/main/resources/static/init.js @@ -67,13 +67,10 @@ }); window.addEventListener("load", function () { - const mtlLoader = (new THREE.MTLLoader()).setPath("/assets/meshes/").setResourcePath("/assets/meshes/"); - const objLoader = (new THREE.OBJLoader()).setPath("/assets/meshes/").setResourcePath("/assets/meshes/"); - async function loadObj(modelName) { - const mtlLib = await mtlLoader.loadAsync(modelName + ".mtl"); + const mtlLib = await (new THREE.MTLLoader()).setPath("/assets/meshes/").setResourcePath("/assets/meshes/").loadAsync(modelName + ".mtl"); mtlLib.preload(); - return await objLoader.setMaterials(mtlLib).loadAsync(modelName + ".obj"); + return await (new THREE.OBJLoader()).setPath("/assets/meshes/").setResourcePath("/assets/meshes/").setMaterials(mtlLib).loadAsync(modelName + ".obj"); } // Mesh viewing