@gltf-transform/functions
Advanced tools
Comparing version 4.0.0-alpha.7 to 4.0.0-alpha.8
{ | ||
"name": "@gltf-transform/functions", | ||
"version": "4.0.0-alpha.7", | ||
"version": "4.0.0-alpha.8", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -38,4 +38,4 @@ "homepage": "https://gltf-transform.dev/functions.html", | ||
"dependencies": { | ||
"@gltf-transform/core": "^4.0.0-alpha.7", | ||
"@gltf-transform/extensions": "^4.0.0-alpha.7", | ||
"@gltf-transform/core": "^4.0.0-alpha.8", | ||
"@gltf-transform/extensions": "^4.0.0-alpha.8", | ||
"ktx-parse": "^0.6.0", | ||
@@ -56,3 +56,3 @@ "ndarray": "^1.0.19", | ||
}, | ||
"gitHead": "ae33e33ea1ff07be469b019ec50b67361af7a478" | ||
"gitHead": "d1267237e48c282dea49abc4d1ca3178853ada58" | ||
} |
@@ -319,6 +319,20 @@ import { | ||
const indices = prim.getIndices(); | ||
const indicesArray = indices && indices.getArray(); | ||
const attribute = prim.listAttributes()[0]; | ||
if (indices && attribute && indices.getCount() === attribute.getCount()) { | ||
prim.setIndices(null); | ||
if (!indicesArray || !attribute) { | ||
return; | ||
} | ||
if (indices.getCount() !== attribute.getCount()) { | ||
return; | ||
} | ||
for (let i = 0, il = indicesArray.length; i < il; i++) { | ||
if (i !== indicesArray[i]) { | ||
return; | ||
} | ||
} | ||
prim.setIndices(null); | ||
} | ||
@@ -325,0 +339,0 @@ |
@@ -134,16 +134,13 @@ import { Accessor, BufferUtils, Document, Primitive, PropertyType, Transform, vec3 } from '@gltf-transform/core'; | ||
if (options.tolerance > 0) { | ||
// If tolerance is greater than 0, welding may remove a mesh, so we prune | ||
await doc.transform( | ||
prune({ | ||
propertyTypes: [PropertyType.ACCESSOR, PropertyType.NODE], | ||
keepAttributes: true, | ||
keepIndices: true, | ||
keepLeaves: false, | ||
}), | ||
); | ||
} | ||
// Welding removes degenerate meshes; prune leaf nodes afterward. | ||
await doc.transform( | ||
prune({ | ||
propertyTypes: [PropertyType.ACCESSOR, PropertyType.NODE], | ||
keepAttributes: true, | ||
keepIndices: true, | ||
keepLeaves: false, | ||
}), | ||
dedup({ propertyTypes: [PropertyType.ACCESSOR] }), | ||
); | ||
await doc.transform(dedup({ propertyTypes: [PropertyType.ACCESSOR] })); | ||
logger.debug(`${NAME}: Complete.`); | ||
@@ -150,0 +147,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2145533
25299