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( ...@@ -366,22 +366,18 @@ function placeModel(
); );
const loader = new THREE.GLTFLoader(); const loader = new THREE.GLTFLoader();
if (modelCache.has(filePath)) {
if (modelCache.has(filePath)) {
// Use the already loaded model // Use the already loaded model
const cachedModel = modelCache.get(filePath); const cachedModel = modelCache.get(filePath);
const model = cachedModel.clone(true); const model = cachedModel.clone(true);
if ( if (modelConfig && modelConfig.scale) {
modelConfig &&
modelConfig.scale
) {
model.scale.set( model.scale.set(
modelConfig.scale.x, modelConfig.scale.x,
modelConfig.scale.y, modelConfig.scale.y,
modelConfig.scale.z modelConfig.scale.z,
); );
} }
...@@ -395,33 +391,22 @@ if (modelCache.has(filePath)) { ...@@ -395,33 +391,22 @@ if (modelCache.has(filePath)) {
if (onPlace) { if (onPlace) {
onPlace(model); onPlace(model);
} }
} else {
} else {
// Model has not been loaded yet // Model has not been loaded yet
loader.load( loader.load(
filePath, filePath,
(gltf) => { (gltf) => {
// Store the original model in the cache // Store the original model in the cache
modelCache.set( modelCache.set(filePath, gltf.scene);
filePath,
gltf.scene
);
const model = const model = gltf.scene.clone(true);
gltf.scene.clone(true);
if ( if (modelConfig && modelConfig.scale) {
modelConfig &&
modelConfig.scale
) {
model.scale.set( model.scale.set(
modelConfig.scale.x, modelConfig.scale.x,
modelConfig.scale.y, modelConfig.scale.y,
modelConfig.scale.z modelConfig.scale.z,
); );
} }
...@@ -429,8 +414,7 @@ if (modelCache.has(filePath)) { ...@@ -429,8 +414,7 @@ if (modelCache.has(filePath)) {
model.isPlacedModel = true; model.isPlacedModel = true;
model.modelConfig = model.modelConfig = modelConfig;
modelConfig;
scene.add(model); scene.add(model);
...@@ -442,14 +426,11 @@ if (modelCache.has(filePath)) { ...@@ -442,14 +426,11 @@ if (modelCache.has(filePath)) {
undefined, undefined,
(error) => { (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