| 170 | } // namespace |
| 171 | |
| 172 | void dequantizeMeshData(Model& model) { |
| 173 | for (Mesh& mesh : model.meshes) { |
| 174 | for (MeshPrimitive& primitive : mesh.primitives) { |
| 175 | for (const std::pair<const std::string, int32_t>& attribute : |
| 176 | primitive.attributes) { |
| 177 | Accessor* pAccessor = |
| 178 | Model::getSafe(&model.accessors, attribute.second); |
| 179 | if (!pAccessor) { |
| 180 | continue; |
| 181 | } |
| 182 | if (pAccessor->componentType == Accessor::ComponentType::FLOAT) { |
| 183 | continue; |
| 184 | } |
| 185 | const std::string& attributeName = attribute.first; |
| 186 | if (attributeName == "POSITION" || attributeName == "NORMAL" || |
| 187 | attributeName == "TANGENT" || |
| 188 | attributeName.starts_with("TEXCOORD")) { |
| 189 | dequantizeAccessor(model, *pAccessor); |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | model.removeExtensionRequired("KHR_mesh_quantization"); |
| 196 | } |
| 197 | } // namespace CesiumGltfReader |
no test coverage detected