diff --git a/demo/cesium/examples/ext_structural_metadata/PlantCover.glb b/demo/cesium/examples/ext_structural_metadata/PlantCover.glb index 996cefc0b..60c3d7638 100644 Binary files a/demo/cesium/examples/ext_structural_metadata/PlantCover.glb and b/demo/cesium/examples/ext_structural_metadata/PlantCover.glb differ diff --git a/demo/cesium/examples/ext_structural_metadata/SolitaryVegetationObject.glb b/demo/cesium/examples/ext_structural_metadata/SolitaryVegetationObject.glb index 17a32155c..010dee102 100644 Binary files a/demo/cesium/examples/ext_structural_metadata/SolitaryVegetationObject.glb and b/demo/cesium/examples/ext_structural_metadata/SolitaryVegetationObject.glb differ diff --git a/demo/cesium/examples/ext_structural_metadata/tileset.json b/demo/cesium/examples/ext_structural_metadata/tileset.json index eaa53b04d..e0ee9620a 100644 --- a/demo/cesium/examples/ext_structural_metadata/tileset.json +++ b/demo/cesium/examples/ext_structural_metadata/tileset.json @@ -1,23 +1,27 @@ { - "asset": { - "version": "1.1" - }, - "geometricError": 1e100, - "root": { - "boundingVolume": { - "region": [ - 2.423545352784276, 0.6126113632476141, 2.423568686412357, - 0.6126530152363875, 48.27812072424482, 61.914851977799785 - ] - }, - "geometricError": 0.0, - "contents": [ - { - "uri": "PlantCover.glb" - }, - { - "uri": "SolitaryVegetationObject.glb" - } - ] - } -} + "asset": { + "version": "1.1" + }, + "geometricError": 1e100, + "root": { + "boundingVolume": { + "region": [ + 2.423545352784276, + 0.6126113632476141, + 2.423568686412357, + 0.6126530152363875, + 48.27812072424482, + 61.914851977799785 + ] + }, + "geometricError": 0.0, + "contents": [ + { + "uri": "PlantCover.glb" + }, + { + "uri": "SolitaryVegetationObject.glb" + } + ] + } +} \ No newline at end of file diff --git a/nusamai/src/sink/gltf/gltf_writer.rs b/nusamai/src/sink/gltf/gltf_writer.rs index 5845406d1..f4b790d3f 100644 --- a/nusamai/src/sink/gltf/gltf_writer.rs +++ b/nusamai/src/sink/gltf/gltf_writer.rs @@ -134,9 +134,10 @@ pub fn build_base_gltf(class_name: &str, buffer: &Buffers, translation: [f64; 3] let feature_ids_offset = bin_content.len(); let mut feature_ids_count = 0; for vertex in buffer.vertices.clone() { - bin_content - .write_all(&vertex.feature_id.to_le_bytes()) - .unwrap(); + // UnsignedInt cannot be used as vertix attributes in MeshPrimitive + // https://github.com/CesiumGS/glTF/blob/proposal-EXT_mesh_features/extensions/2.0/Vendor/EXT_mesh_features/README.md#feature-id-by-vertex + let vertex = vertex.feature_id as f32; + bin_content.write_all(&vertex.to_le_bytes()).unwrap(); feature_ids_count += 1; } let feature_ids_len = bin_content.len() - feature_ids_offset; @@ -154,7 +155,7 @@ pub fn build_base_gltf(class_name: &str, buffer: &Buffers, translation: [f64; 3] let feature_id_max = buffer.vertices.iter().map(|v| v.feature_id).max().unwrap(); let accessor = Accessor { buffer_view: Some(buffer_view_length), - component_type: ComponentType::UnsignedInt, + component_type: ComponentType::Float, count: feature_ids_count, type_: AccessorType::Scalar, min: Some(vec![feature_id_min as f64]),