"...gowanus-citygml-viewer.git" did not exist on "f734cbf37abb3d8efb72d33faa7bdfb814b23611"
Commit 436b1908 authored by Alfakhori's avatar Alfakhori
Browse files

prettier

parent b59e55dd
Pipeline #12463 passed with stage
in 26 seconds
...@@ -366,90 +366,71 @@ function placeModel( ...@@ -366,90 +366,71 @@ 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
const cachedModel = modelCache.get(filePath);
const model = cachedModel.clone(true);
// Use the already loaded model if (modelConfig && modelConfig.scale) {
const cachedModel = modelCache.get(filePath);
const model = cachedModel.clone(true);
if (
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,
); );
} }
model.position.copy(position); model.position.copy(position);
model.isPlacedModel = true; model.isPlacedModel = true;
model.modelConfig = modelConfig; model.modelConfig = modelConfig;
scene.add(model); scene.add(model);
if (onPlace) { if (onPlace) {
onPlace(model); onPlace(model);
} }
} else {
} else { // Model has not been loaded yet
loader.load(
// Model has not been loaded yet
loader.load(
filePath, filePath,
(gltf) => { (gltf) => {
// Store the original model in the cache
modelCache.set(filePath, gltf.scene);
// Store the original model in the cache const model = gltf.scene.clone(true);
modelCache.set(
filePath,
gltf.scene
);
const model =
gltf.scene.clone(true);
if ( if (modelConfig && modelConfig.scale) {
modelConfig && model.scale.set(
modelConfig.scale modelConfig.scale.x,
) { modelConfig.scale.y,
model.scale.set( modelConfig.scale.z,
modelConfig.scale.x, );
modelConfig.scale.y, }
modelConfig.scale.z
);
}
model.position.copy(position); model.position.copy(position);
model.isPlacedModel = true; model.isPlacedModel = true;
model.modelConfig = model.modelConfig = modelConfig;
modelConfig;
scene.add(model); scene.add(model);
if (onPlace) { if (onPlace) {
onPlace(model); onPlace(model);
} }
}, },
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