Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfakhori
Gengenbach
Commits
b59e55dd
Commit
b59e55dd
authored
Sep 21, 2026
by
Alfakhori
Browse files
cache function
parent
5d402653
Pipeline
#12462
passed with stage
in 25 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
public/ar_main.js
View file @
b59e55dd
...
...
@@ -366,25 +366,58 @@ function placeModel(
);
const
loader
=
new
THREE
.
GLTFLoader
();
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
)
{
model
.
scale
.
set
(
modelConfig
.
scale
.
x
,
modelConfig
.
scale
.
y
,
modelConfig
.
scale
.
z
);
}
model
.
position
.
copy
(
position
);
model
.
isPlacedModel
=
true
;
model
.
modelConfig
=
modelConfig
;
scene
.
add
(
model
);
if
(
onPlace
)
{
onPlace
(
model
);
}
}
else
{
// Model has not been loaded yet
loader
.
load
(
filePath
,
(
gltf
)
=>
{
const
model
=
gltf
.
scene
;
// Store the original model in the cache
modelCache
.
set
(
filePath
,
gltf
.
scene
);
const
model
=
gltf
.
scene
.
clone
(
true
);
if
(
modelConfig
&&
modelConfig
.
scale
)
{
model
.
scale
.
set
(
modelConfig
.
scale
.
x
,
modelConfig
.
scale
.
y
,
...
...
@@ -392,7 +425,6 @@ function placeModel(
);
}
model
.
position
.
copy
(
position
);
model
.
isPlacedModel
=
true
;
...
...
@@ -402,9 +434,7 @@ function placeModel(
scene
.
add
(
model
);
if
(
onPlace
)
{
onPlace
(
model
);
}
},
...
...
@@ -421,6 +451,8 @@ function placeModel(
);
}
}
function
selectModel
(
modelId
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment