diff --git a/Source/WorkersES6/decodeDraco.js b/Source/WorkersES6/decodeDraco.js index 0a5dd1823a57..a4390e34b32e 100644 --- a/Source/WorkersES6/decodeDraco.js +++ b/Source/WorkersES6/decodeDraco.js @@ -288,17 +288,7 @@ function decodePrimitive(parameters) { const dracoDecoder = new draco.Decoder(); // Skip all parameter types except generic - // Note: As a temporary work-around until GetAttributeByUniqueId() works after - // calling SkipAttributeTransform(), we will not skip attributes with multiple - // sets of data in the glTF. - const attributesToSkip = ["POSITION", "NORMAL"]; - const compressedAttributes = parameters.compressedAttributes; - if (!defined(compressedAttributes["COLOR_1"])) { - attributesToSkip.push("COLOR"); - } - if (!defined(compressedAttributes["TEXCOORD_1"])) { - attributesToSkip.push("TEX_COORD"); - } + const attributesToSkip = ["POSITION", "NORMAL", "COLOR", "TEX_COORD"]; if (parameters.dequantizeInShader) { for (let i = 0; i < attributesToSkip.length; ++i) { dracoDecoder.SkipAttributeTransform(draco[attributesToSkip[i]]); @@ -325,37 +315,15 @@ function decodePrimitive(parameters) { draco.destroy(buffer); const attributeData = {}; + + const compressedAttributes = parameters.compressedAttributes; for (const attributeName in compressedAttributes) { if (compressedAttributes.hasOwnProperty(attributeName)) { - // Since GetAttributeByUniqueId() only works on attributes that we have not called - // SkipAttributeTransform() on, we must first store a `dracoAttributeName` in case - // we call GetAttributeId() instead. - let dracoAttributeName = attributeName; - if (attributeName === "TEXCOORD_0") { - dracoAttributeName = "TEX_COORD"; - } - if (attributeName === "COLOR_0") { - dracoAttributeName = "COLOR"; - } - - let dracoAttribute; - if (attributesToSkip.includes(dracoAttributeName)) { - const dracoAttributeId = dracoDecoder.GetAttributeId( - dracoGeometry, - draco[dracoAttributeName] - ); - dracoAttribute = dracoDecoder.GetAttribute( - dracoGeometry, - dracoAttributeId - ); - } else { - const compressedAttribute = compressedAttributes[attributeName]; - dracoAttribute = dracoDecoder.GetAttributeByUniqueId( - dracoGeometry, - compressedAttribute - ); - } - + const compressedAttribute = compressedAttributes[attributeName]; + const dracoAttribute = dracoDecoder.GetAttributeByUniqueId( + dracoGeometry, + compressedAttribute + ); attributeData[attributeName] = decodeAttribute( dracoGeometry, dracoDecoder, diff --git a/package.json b/package.json index 698017ecf8d4..ea7371592a83 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "cloc": "^2.8.0", "compression": "^1.7.4", "dompurify": "^2.2.2", - "draco3d": "^1.4.1", + "draco3d": "^1.5.1", "earcut": "^2.2.2", "eslint": "^7.29.0", "eslint-config-prettier": "^8.3.0",