diff --git a/README.md b/README.md index 1839c36..0071a94 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Converter.exe --format --input --output [OPTIONS] ```sh # from osgb dataset -Converter.exe --format osgb -input E:\osgb_path -o E:\out_path --yUpAxis true +Converter.exe --format osgb -input E:\osgb_path --output E:\out_path --yUpAxis true # from single shp file Converter.exe --format gdal --input --output --field height --layer @@ -60,7 +60,7 @@ Converter.exe --format gdal --input --output --field height -- - `--thread` 处理线程数量(仅对OSGB生效) - `--yUpAxis` 是否将gltf模型转为y轴朝上 - `yUpAxis` 可选: true, false + `yUpAxis` 可选: true, false 如果是用`Cesium for Unreal`加载数据,需要启用yUpAxis # 数据要求及说明 diff --git a/include/OSGBConvertJob.h b/include/OSGBConvertJob.h index d6126b6..f74129d 100644 --- a/include/OSGBConvertJob.h +++ b/include/OSGBConvertJob.h @@ -70,7 +70,9 @@ namespace scially { } } - void setYUpAxis(bool y) {osgbLevel.setYUpAxis(y);} + void setYUpAxis(bool y) { + osgbLevel.setYUpAxis(y); + } OSGBLevel osgbLevel; bool isSucceed; diff --git a/src/OSGBConvertJob.cpp b/src/OSGBConvertJob.cpp index 9ec0be8..9be1735 100644 --- a/src/OSGBConvertJob.cpp +++ b/src/OSGBConvertJob.cpp @@ -36,7 +36,11 @@ namespace scially { // 合并子节点 BaseTile baseTile; baseTile.geometricError = 2000; - baseTile.asset.assets["gltfUpAxis"] = "Y"; + if(yUpAxis) + baseTile.asset.assets["gltfUpAxis"] = "Y"; + else + baseTile.asset.assets["gltfUpAxis"] = "Z"; + baseTile.asset.assets["version"] = "1.0"; baseTile.root.transform = TileMatrix::fromXYZ(lon, lat, height); baseTile.root.geometricError = 1000; diff --git a/src/OSGBLevel.cpp b/src/OSGBLevel.cpp index 367d6c1..0d36be4 100644 --- a/src/OSGBLevel.cpp +++ b/src/OSGBLevel.cpp @@ -60,6 +60,7 @@ namespace scially { for (int i = 0; i < lodVisitor.subNodeNames.size(); i++) { OSGBLevel subLevel(lodVisitor.subNodeNames[i]); + subLevel.setYUpAxis(yUpAxis); if (subLevel.getAllOSGBLevels(maxLevel)) { subNodes.append(subLevel); } @@ -89,7 +90,10 @@ namespace scially { // update root tile tile.geometricError = 2000; - tile.asset.assets["gltfUpAxis"] = "Y"; + if(yUpAxis) + tile.asset.assets["gltfUpAxis"] = "Y"; + else + tile.asset.assets["gltfUpAxis"] = "Z"; tile.asset.assets["version"] = "1.0"; tile.root.children.append(childTile); diff --git a/src/main.cpp b/src/main.cpp index b5dbe1d..f52d8a0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,7 +84,7 @@ int main(int argc, char** argv){ } else{ - qCritical() << "Only support osgb and shape format"; + qCritical() << "Only support OSGB and GDAL format"; return 1; } qInfo() << "Finish convert in " << beginTime.secsTo( QTime::currentTime()) << "s";