Cesium-Native How to read quantized Mesh

Hi,

I would like to read QuantizedMesh data with cesium-native.

I could read the layer.json and then would like to read the tiles

 QuadtreeTileID tileID((uint32_t)i, (uint32_t)k, (uint32_t)l);

 CesiumGeometry::Rectangle tileRectangle =
     tilingScheme.tileToRectangle(tileID);
 BoundingRegion boundingVolume = BoundingRegion(
     GlobeRectangle(
         tileRectangle.minimumX,
         tileRectangle.minimumY,
         tileRectangle.maximumX,
         tileRectangle.maximumY),
     0.0,
     0.0,
     Ellipsoid::WGS84);

 QuantizedMesh<uint16_t> quantizedMesh = createGridQuantizedMesh<uint16_t>(
     boundingVolume,
     verticesWidth,
     verticesHeight);

 std::vector<std::byte> quantizedMeshBin =
     convertQuantizedMeshToBinary(quantizedMesh);
 std::span<const std::byte> data(
     quantizedMeshBin.data(),
     quantizedMeshBin.size());

 QuantizedMeshLoadResult loadResult =
     QuantizedMeshLoader::load(tileID, boundingVolume, "myUrl", data, false);

As a result I get QuantizedMeshLoadResult.

Is there a description of this objekt - where do I find the mesh-data ? Is this in CesiumUtility::ExtensibleObject ?

Could you help me ?

Best Regards

Rüdiger

Hi @Ruediger_Brand,

The loadResult.model property is an in-memory representation of a glTF model. The best way to understand how the mesh data is represented is to read the glTF spec:
https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html

This glTF overview may be helpful as well:

Hello Kevin,

thank you for the tip - this helps.

With the a file produced from ctb everything is ok.

Now I would like to read *.terrain files downloaded from Cesium.ion and now the decompression doesn’t work. I got messages incorrect header check using zlib_ng.

Do you have one more tip - are the *.terrain files from Cesium ion compressed or not ?

Best regards

Rüdiger

The .terrain files are stored and sent compressed from Cesium ion. However, the client you use to download them may very well see the HTTP header indicating that they’re gzip compressed and transparently decompress them. In which case the content you see will be the decompressed form.