MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / fixAttributeNames

Function fixAttributeNames

CesiumGltfReader/src/decodeSpz.cpp:366–384  ·  view source on GitHub ↗

Maps attribute names from older versions of the extension to the names from the current version of the extension.

Source from the content-addressed store, hash-verified

364// Maps attribute names from older versions of the extension to the names from
365// the current version of the extension.
366void fixAttributeNames(CesiumGltf::MeshPrimitive& primitive) {
367 std::vector<std::string> attributesToConvert;
368 attributesToConvert.reserve(primitive.attributes.size());
369 for (const std::pair<const std::string, int32_t>& attribute :
370 primitive.attributes) {
371 if (attribute.first == "_SCALE" || attribute.first == "_ROTATION" ||
372 attribute.first.starts_with("_SH_DEGREE_")) {
373 attributesToConvert.push_back(attribute.first);
374 }
375 }
376
377 for (const std::string& oldName : attributesToConvert) {
378 const int32_t accessorIndex = primitive.attributes[oldName];
379 primitive.attributes.erase(oldName);
380 primitive.attributes.emplace(
381 "KHR_gaussian_splatting:" + oldName.substr(1),
382 accessorIndex);
383 }
384}
385
386CesiumGltf::ExtensionKhrGaussianSplattingCompressionSpz2*
387getAndMaybeConvertSpzExtension(

Callers 1

decodeSpzFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected