From c598f946369666ddb0154e722e5afc0d01a85bdc Mon Sep 17 00:00:00 2001 From: Son-HNguyen Date: Wed, 2 Jan 2019 15:53:25 +0100 Subject: [PATCH] Fix Cesium's breaking changes: +X and +Z faces (gltf_version=[0.8|1.0]) --- js/CitydbKmlDataSource.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/CitydbKmlDataSource.js b/js/CitydbKmlDataSource.js index 7981e642..e3cc6f52 100644 --- a/js/CitydbKmlDataSource.js +++ b/js/CitydbKmlDataSource.js @@ -1599,6 +1599,10 @@ rollValue = 0; } + // by default in glTF 2.0 +Z faces forward, while earlier version of Cesium uses +X + // https://github.com/AnalyticalGraphicsInc/cesium/pull/6632 + headingValue = headingValue + 90; + var heading = Cesium.Math.toRadians(headingValue); var pitch = Cesium.Math.toRadians(tiltValue); var roll = Cesium.Math.toRadians(rollValue); @@ -1606,8 +1610,10 @@ // Backward compatible.... var gltfVersion = CitydbUtil.parse_query_string('gltf_version', window.location.href); if (gltfVersion == '0.8') { - var heading = Cesium.Math.toRadians(headingValue - 180); - var pitch = Cesium.Math.toRadians(180); + heading = Cesium.Math.toRadians(headingValue - 180); + pitch = Cesium.Math.toRadians(180); + } else if (gltfVersion == '1.0') { + heading = Cesium.Math.toRadians(headingValue - 90); } var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);