Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
03d0b21a
Commit
03d0b21a
authored
6 years ago
by
Marshall Quander
Browse files
Options
Downloads
Patches
Plain Diff
Fix a bug in GLTF cache
parent
30abc47c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/gltf-model-plus.js
+7
-22
7 additions, 22 deletions
src/components/gltf-model-plus.js
with
7 additions
and
22 deletions
src/components/gltf-model-plus.js
+
7
−
22
View file @
03d0b21a
...
...
@@ -168,30 +168,15 @@ function nextTick() {
}
function
cachedLoadGLTF
(
src
,
preferredTechnique
,
onProgress
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// Load the gltf model from the cache if it exists.
if
(
GLTFCache
[
src
])
{
// Use a cloned copy of the cached model.
resolve
(
cloneGltf
(
GLTFCache
[
src
]));
}
else
{
// Otherwise load the new gltf model.
// Load the gltf model from the cache if it exists.
if
(
!
GLTFCache
[
src
])
{
GLTFCache
[
src
]
=
new
Promise
((
resolve
,
reject
)
=>
{
const
gltfLoader
=
new
THREE
.
GLTFLoader
();
gltfLoader
.
preferredTechnique
=
preferredTechnique
;
gltfLoader
.
load
(
src
,
model
=>
{
if
(
!
GLTFCache
[
src
])
{
// Store a cloned copy of the gltf model.
GLTFCache
[
src
]
=
cloneGltf
(
model
);
}
resolve
(
model
);
},
onProgress
,
reject
);
}
});
gltfLoader
.
load
(
src
,
resolve
,
onProgress
,
reject
);
});
}
return
GLTFCache
[
src
].
then
(
cloneGltf
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment