Commit 436b1908 authored by Alfakhori's avatar Alfakhori
Browse files

prettier

parent b59e55dd
Pipeline #12463 passed with stage
in 26 seconds
......@@ -366,22 +366,18 @@ function placeModel(
);
const loader = new THREE.GLTFLoader();
if (modelCache.has(filePath)) {
const loader = new THREE.GLTFLoader();
if (modelCache.has(filePath)) {
// Use the already loaded model
const cachedModel = modelCache.get(filePath);
const model = cachedModel.clone(true);
if (
modelConfig &&
modelConfig.scale
) {
if (modelConfig && modelConfig.scale) {
model.scale.set(
modelConfig.scale.x,
modelConfig.scale.y,
modelConfig.scale.z
modelConfig.scale.z,
);
}
......@@ -395,33 +391,22 @@ if (modelCache.has(filePath)) {
if (onPlace) {
onPlace(model);
}
} else {
} else {
// Model has not been loaded yet
loader.load(
filePath,
(gltf) => {
// Store the original model in the cache
modelCache.set(
filePath,
gltf.scene
);
modelCache.set(filePath, gltf.scene);
const model =
gltf.scene.clone(true);
const model = gltf.scene.clone(true);
if (
modelConfig &&
modelConfig.scale
) {
if (modelConfig && modelConfig.scale) {
model.scale.set(
modelConfig.scale.x,
modelConfig.scale.y,
modelConfig.scale.z
modelConfig.scale.z,
);
}
......@@ -429,8 +414,7 @@ if (modelCache.has(filePath)) {
model.isPlacedModel = true;
model.modelConfig =
modelConfig;
model.modelConfig = modelConfig;
scene.add(model);
......@@ -442,14 +426,11 @@ if (modelCache.has(filePath)) {
undefined,
(error) => {
console.error(
"Fehler beim Laden des Modells:",
error
console.error("Fehler beim Laden des Modells:", error);
},
);
}
);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment