mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-03-01 22:13:49 -05:00
Clear vertex cache too
This commit is contained in:
parent
07d1c9cdef
commit
43e78f3651
@ -107,6 +107,11 @@ function loadObj(objPath, options) {
|
||||
|
||||
var vertexIndices = [];
|
||||
|
||||
function clearVertexCache() {
|
||||
vertexCache = {};
|
||||
vertexCacheCount = 0;
|
||||
}
|
||||
|
||||
function getName(name) {
|
||||
return (name === '' ? undefined : name);
|
||||
}
|
||||
@ -130,8 +135,7 @@ function loadObj(objPath, options) {
|
||||
mesh.primitives.push(primitive);
|
||||
|
||||
// Clear the vertex cache for each new primitive
|
||||
vertexCache = {};
|
||||
vertexCacheCount = 0;
|
||||
clearVertexCache();
|
||||
vertexCount = 0;
|
||||
}
|
||||
|
||||
@ -143,6 +147,7 @@ function loadObj(objPath, options) {
|
||||
for (var i = 0; i < primitivesLength; ++i) {
|
||||
if (primitives[i].material === material) {
|
||||
primitive = primitives[i];
|
||||
clearVertexCache();
|
||||
vertexCount = primitive.positions.length / 3;
|
||||
return;
|
||||
}
|
||||
@ -205,8 +210,7 @@ function loadObj(objPath, options) {
|
||||
// may be some duplicate vertices.
|
||||
vertexCacheCount++;
|
||||
if (vertexCacheCount > vertexCacheLimit) {
|
||||
vertexCacheCount = 0;
|
||||
vertexCache = {};
|
||||
clearVertexCache();
|
||||
}
|
||||
}
|
||||
return index;
|
||||
|
Loading…
x
Reference in New Issue
Block a user