From 43ecc72b8f68ce08823c3f10904c13be29356e37 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 20 Jan 2017 17:21:01 -0500 Subject: [PATCH 1/5] Add support for rtc and ecef models in 2D/CV. --- Source/Core/Transforms.js | 42 ++++++++++++++++++++++++++ Source/Scene/Model.js | 31 +++++++++++++++++-- Specs/Data/Models/Boxes-ECEF/ecef.glb | Bin 0 -> 14108 bytes Specs/Scene/ModelSpec.js | 23 ++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 Specs/Data/Models/Boxes-ECEF/ecef.glb diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index b9ebfef6f1ff..86466f801c3c 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -1001,5 +1001,47 @@ define([ return result; }; + var swizzleMatrix = new Matrix4( + 0.0, 0.0, 1.0, 0.0, + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 1.0); + + /** + * @private + */ + Transforms.wgs84To2DModelMatrix = function(projection, center, result) { + //>>includeStart('debug', pragmas.debug); + if (!defined(projection)) { + throw new DeveloperError('projection is required.'); + } + if (!defined(center)) { + throw new DeveloperError('center is required.'); + } + if (!defined(result)) { + throw new DeveloperError('result is required.'); + } + //>>includeEnd('debug'); + + var ellipsoid = projection.ellipsoid; + + var fromENU = Transforms.eastNorthUpToFixedFrame(center, ellipsoid, scratchFromENU); + var toENU = Matrix4.inverseTransformation(fromENU, scratchToENU); + + var cartographic = ellipsoid.cartesianToCartographic(center, scratchCartographic); + var projectedPosition = projection.project(cartographic, scratchCartesian3Projection); + var newOrigin = scratchCartesian4NewOrigin; + newOrigin.x = projectedPosition.z; + newOrigin.y = projectedPosition.x; + newOrigin.z = projectedPosition.y; + newOrigin.w = 1.0; + + var translation = Matrix4.fromTranslation(newOrigin, scratchFromENU); + Matrix4.multiply(swizzleMatrix, toENU, result); + Matrix4.multiply(translation, result, result); + + return result; + }; + return Transforms; }); diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 3d6cc75f72eb..b52e96117904 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -671,8 +671,10 @@ define([ this._pickIds = []; // CESIUM_RTC extension - this._rtcCenter = undefined; // in world coordinates + this._rtcCenter = undefined; // reference to either 3D or 2D this._rtcCenterEye = undefined; // in eye coordinates + this._rtcCenter3D = undefined; // in world coordinates + this._rtcCenter2D = undefined; // in projected world coordinates } defineProperties(Model.prototype, { @@ -3325,6 +3327,7 @@ define([ } var scratchNodeStack = []; + var scratchComputedTranslation = new Cartesian4(); var scratchComputedMatrixIn2D = new Matrix4(); function updateNodeHierarchyModelMatrix(model, modelTransformChanged, justLoaded, projection) { @@ -3338,7 +3341,20 @@ define([ var computedModelMatrix = model._computedModelMatrix; if (model._mode !== SceneMode.SCENE3D) { - computedModelMatrix = Transforms.basisTo2D(projection, computedModelMatrix, scratchComputedMatrixIn2D); + var translation = Matrix4.getColumn(computedModelMatrix, 3, scratchComputedTranslation); + if (!Cartesian4.equals(translation, Cartesian4.UNIT_W)) { + computedModelMatrix = Transforms.basisTo2D(projection, computedModelMatrix, scratchComputedMatrixIn2D); + model._rtcCenter = model._rtcCenter3D; + } else { + var center = model.boundingSphere.center; + var to2D = Transforms.wgs84To2DModelMatrix(projection, center, scratchComputedMatrixIn2D); + computedModelMatrix = Matrix4.multiply(to2D, computedModelMatrix, scratchComputedMatrixIn2D); + + if (defined(model._rtcCenter)) { + Matrix4.setTranslation(computedModelMatrix, Cartesian4.UNIT_W, computedModelMatrix); + model._rtcCenter = model._rtcCenter2D; + } + } } for (var i = 0; i < length; ++i) { @@ -4091,8 +4107,17 @@ define([ if (this._state !== ModelState.FAILED) { var extensions = this.gltf.extensions; if (defined(extensions) && defined(extensions.CESIUM_RTC)) { - this._rtcCenter = Cartesian3.fromArray(extensions.CESIUM_RTC.center); + this._rtcCenter3D = Cartesian3.fromArray(extensions.CESIUM_RTC.center); + + var projection = frameState.mapProjection; + var ellipsoid = projection.ellipsoid; + var cartographic = ellipsoid.cartesianToCartographic(this._rtcCenter3D); + var projectedCart = projection.project(cartographic); + Cartesian3.fromElements(projectedCart.z, projectedCart.x, projectedCart.y, projectedCart); + this._rtcCenter2D = projectedCart; + this._rtcCenterEye = new Cartesian3(); + this._rtcCenter = this._rtcCenter3D; } this._loadResources = new LoadResources(); diff --git a/Specs/Data/Models/Boxes-ECEF/ecef.glb b/Specs/Data/Models/Boxes-ECEF/ecef.glb new file mode 100644 index 0000000000000000000000000000000000000000..aad1c5b5e41f42a4aa63733961c4f3cc789a0f2b GIT binary patch literal 14108 zcmeHOd3an^6+dhRB9u*_Akgs@AuW?(woE38G)>c#PDzuJq%Aa*;broYymq#}nMs?5 zwrnDly@bjl70aTOP0J!{tH`1SK|l~tQ2{|w(LY@Hln?#gx1O0y`Vyl4fn>h#-rqa- zoZmV3+;i`{e7yE0JLm33L`T&SMGpYL-;g9H5=t(Y(Q;Cq^AOKwa%x`9q=m4%(A%qM zi&bTnRL36Te#t9!59XD&-rk&&m+Jh+V@F<7dldaKkx6AUX(gTS9Lz#e9SBCeQX*4G zLpvCTeqNVLi<_H5AWNz6*A)l`!nJ{bFIerZ3fF`pq3Rl6wKwdK2CBnBNS8rTUTr8= z`y&xwz|ssxqPkur8eF#4YtJm6&S)t)Ii9HmqtXA+Y^wae+DH_Whyehp~fEx2cy-&nrO(L=SYS!1Q3Y#xwoun#hEvAG8_?3ak%`62>Dy{Z>QmB+Cg(F6_Ft%{Dz7G$T$LmAN&||P(>JRW@QKuAwM;LR#9ZX8 z3aceb_sK07;EH}5`l+b>IXy>c?AV9eP0`pM9(re$p~-iI?p z(3;tmHBBBgw9FN2QPO?+eyJ|t57Y*|Qb7~$d*r-a=as~yoWsPRwa*qDC-zw*&Kc&< z$hXB@6S4LtJ9zT4)+f%OP`EY{EOHYMjFmTN*1Sb)IO5EqVrHuz#uj(DH0)^DFY2^3 za%197p2nJ&aCNk}Frzr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q_Ff0!Pn$7nm+?X-iwOW&i%(LPS!rzhx1dWxP#{}laz zen>mf?xbhvS^5z@N6({wj($up(2MjE`WNXZ^fJAI_7(amy-Kgq>u6u6pV80h7xV`G z68#(WEBZCPiS|u;i{7T+&^z=l`giEJ^gDWwevke=`UCxu-bedB{Ye!1xc+vd@%?tk zP8rW{5A3V){Px7|8_#bq?Ah`BCSh-n=eIY`gYo?K!I?3h-@Z6!#`Cj3BJ%VmGjiTz ze+XD#;S3EZi6BOtPsZvi@O5}X72nHx`qjSvtYKYWVSc{lNy+)JXTod>#inVSlqR+to#?48zDL21z8zHy8a~m;Wedy*47zKn+;H=NvMh@|B-A3de z^VR=pkyx{m<#bt^kjGAu0n{~0<$zf{#zKhoGv}x$(w?urwjpb*1;w0)f+(X(zt8XW zSdB#!@>nU+d8`MY*4M4CmZ(4TLqc7_#6{x+_=a|ls$sl}$Ll1(ab}vk#8sqqf*pQP zgl{wsV-jv1uZcCOc&?B}G{zUY%}u(dnI6NfMTn~QdaPzT$`AkCs Date: Tue, 24 Jan 2017 16:44:17 -0500 Subject: [PATCH 2/5] Update for RTC models where the center is the origin. --- Source/Scene/Model.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index b52e96117904..ee4952c7fcc5 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -2496,10 +2496,13 @@ define([ // CESIUM_RTC extension var mvRtc = new Matrix4(); return function() { - Matrix4.getTranslation(uniformState.model, scratchTranslationRtc); - Cartesian3.add(scratchTranslationRtc, model._rtcCenter, scratchTranslationRtc); - Matrix4.multiplyByPoint(uniformState.view, scratchTranslationRtc, scratchTranslationRtc); - return Matrix4.setTranslation(uniformState.modelView, scratchTranslationRtc, mvRtc); + if (defined(model._rtcCenter)) { + Matrix4.getTranslation(uniformState.model, scratchTranslationRtc); + Cartesian3.add(scratchTranslationRtc, model._rtcCenter, scratchTranslationRtc); + Matrix4.multiplyByPoint(uniformState.view, scratchTranslationRtc, scratchTranslationRtc); + return Matrix4.setTranslation(uniformState.modelView, scratchTranslationRtc, mvRtc); + } + return uniformState.modelView; }; }, MODELVIEWPROJECTION : function(uniformState, model) { @@ -4107,17 +4110,20 @@ define([ if (this._state !== ModelState.FAILED) { var extensions = this.gltf.extensions; if (defined(extensions) && defined(extensions.CESIUM_RTC)) { - this._rtcCenter3D = Cartesian3.fromArray(extensions.CESIUM_RTC.center); - - var projection = frameState.mapProjection; - var ellipsoid = projection.ellipsoid; - var cartographic = ellipsoid.cartesianToCartographic(this._rtcCenter3D); - var projectedCart = projection.project(cartographic); - Cartesian3.fromElements(projectedCart.z, projectedCart.x, projectedCart.y, projectedCart); - this._rtcCenter2D = projectedCart; - - this._rtcCenterEye = new Cartesian3(); - this._rtcCenter = this._rtcCenter3D; + var center = Cartesian3.fromArray(extensions.CESIUM_RTC.center); + if (!Cartesian3.equals(center, Cartesian3.ZERO)) { + this._rtcCenter3D = center; + + var projection = frameState.mapProjection; + var ellipsoid = projection.ellipsoid; + var cartographic = ellipsoid.cartesianToCartographic(this._rtcCenter3D); + var projectedCart = projection.project(cartographic); + Cartesian3.fromElements(projectedCart.z, projectedCart.x, projectedCart.y, projectedCart); + this._rtcCenter2D = projectedCart; + + this._rtcCenterEye = new Cartesian3(); + this._rtcCenter = this._rtcCenter3D; + } } this._loadResources = new LoadResources(); From b4edd3a5c5860baa791741743866f20882eb5f12 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 25 Jan 2017 14:16:19 -0500 Subject: [PATCH 3/5] Add CV tests. --- Specs/Data/Models/Boxes-ECEF/ecef.glb | Bin 14108 -> 5693 bytes Specs/Scene/ModelSpec.js | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Specs/Data/Models/Boxes-ECEF/ecef.glb b/Specs/Data/Models/Boxes-ECEF/ecef.glb index aad1c5b5e41f42a4aa63733961c4f3cc789a0f2b..5ce9b416c51edda2290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>u6u6pV80h7xV`G z68#(WEBZCPiS|u;i{7T+&^z=l`giEJ^gDWwevke=`UCxu-bedB{Ye!1xc+vd@%?tk zP8rW{5A3V){Px7|8_#bq?Ah`BCSh-n=eIY`gYo?K!I?3h-@Z6!#`Cj3BJ%VmGjiTz ze+XD#;S3EZi6BOtPsZvi@O5}X72nHx`qjSvtYKYWVSc{lNy+)JXTod>#inVSlqR+to#?48zDL21z8zHy8a~m;Wedy*47zKn+;H=NvMh@|B-A3de z^VR=pkyx{m<#bt^kjGAu0n{~0<$zf{#zKhoGv}x$(w?urwjpb*1;w0)f+(X(zt8XW zSdB#!@>nU+d8`MY*4M4CmZ(4TLqc7_#6{x+_=a|ls$sl}$Ll1(ab}vk#8sqqf*pQP zgl{wsV-jv1uZcCOc&?B}G{zUY%}u(dnI6NfMTn~QdaPzT$`AkCs Date: Wed, 25 Jan 2017 14:40:12 -0500 Subject: [PATCH 4/5] Add tests for wgs84To2DModelMatrix. --- Specs/Core/TransformsSpec.js | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 1d4682ca3b7a..da6f5de0943e 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -899,6 +899,34 @@ defineSuite([ expect(rotation2D).toEqualEpsilon(expected, CesiumMath.EPSILON3); }); + it('wgs84To2DModelMatrix creates a model matrix to transform vertices centered origin to 2D', function() { + var ellipsoid = Ellipsoid.WGS84; + var projection = new GeographicProjection(ellipsoid); + var origin = Cartesian3.fromDegrees(-72.0, 40.0, 100.0, ellipsoid); + + var actual = Transforms.wgs84To2DModelMatrix(projection, origin, new Matrix4()); + var expected = Matrix4.fromTranslation(origin); + Transforms.basisTo2D(projection, expected, expected); + + var actualRotation = Matrix4.getRotation(actual, new Matrix3()); + var expectedRotation = Matrix4.getRotation(expected, new Matrix3()); + expect(actualRotation).toEqualEpsilon(expectedRotation, CesiumMath.EPSILON14); + + var fromENU = Transforms.eastNorthUpToFixedFrame(origin, ellipsoid, new Matrix4()); + var toENU = Matrix4.inverseTransformation(fromENU, new Matrix4()); + var toENUTranslation = Matrix4.getTranslation(toENU, new Cartesian4()); + var projectedTranslation = Matrix4.getTranslation(expected, new Cartesian4()); + + var expectedTranslation = new Cartesian4(); + expectedTranslation.x = projectedTranslation.x + toENUTranslation.z; + expectedTranslation.y = projectedTranslation.y + toENUTranslation.x; + expectedTranslation.z = projectedTranslation.z + toENUTranslation.y; + + var actualTranslation = Matrix4.getTranslation(actual, new Cartesian4()); + + expect(actualTranslation).toEqualEpsilon(expectedTranslation, CesiumMath.EPSILON14); + }); + it('eastNorthUpToFixedFrame throws without an origin', function() { expect(function() { Transforms.eastNorthUpToFixedFrame(undefined, Ellipsoid.WGS84); @@ -970,4 +998,22 @@ defineSuite([ Transforms.basisTo2D(new GeographicProjection(), Matrix4.IDENTITY, undefined); }).toThrowDeveloperError(); }); + + it ('wgs84To2DModelMatrix throws without projection', function() { + expect(function() { + Transforms.wgs84To2DModelMatrix(undefined, Cartesian3.UNIT_X, new Matrix4()); + }).toThrowDeveloperError(); + }); + + it ('wgs84To2DModelMatrix throws without center', function() { + expect(function() { + Transforms.wgs84To2DModelMatrix(new GeographicProjection(), undefined, new Matrix4()); + }).toThrowDeveloperError(); + }); + + it ('wgs84To2DModelMatrix throws without result', function() { + expect(function() { + Transforms.wgs84To2DModelMatrix(new GeographicProjection(), Cartesian3.UNIT_X, undefined); + }).toThrowDeveloperError(); + }); }); From e4c3a5d56715991aac705935ae4ec16e5a472383 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 25 Jan 2017 14:44:26 -0500 Subject: [PATCH 5/5] Update CHANGES.md. --- CHANGES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 92a1b5b5849b..9bde16b43bfa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ Change Log ========== ### 1.30 - 2017-02-01 + * Deprecated * The properties `url` and `key` will be removed from `GeocoderViewModel` in 1.31. These properties will be available on geocoder services that support them, like `BingMapsGeocoderService`. * The function `createBinormalAndBitangent` of `GeometryPipeline` will be removed in 1.31. Use the function `createTangentAndBitangent` instead. [#4856](https://github.com/AnalyticalGraphicsInc/cesium/pull/4856) @@ -23,8 +24,10 @@ Change Log * Added support for WMS version 1.3 by using CRS vice SRS query string parameter to request projection. SRS is still used for older versions. * The attribute `perInstanceAttribute` of `DebugAppearance` has been made optional and defaults to `false`. * Fixed a bug that would cause a crash when `debugShowFrustums` is enabled with OIT [#4864](https://github.com/AnalyticalGraphicsInc/cesium/pull/4864) +* Added 2D and Columbus View support for models using the RTC extension or whose vertices are in WGS84 coordinates. [#4922](https://github.com/AnalyticalGraphicsInc/cesium/pull/4922) ### 1.29 - 2017-01-02 + * Improved 3D Models * Added the ability to blend a `Model` with a color/translucency. Added `color`, `colorBlendMode`, and `colorBlendAmount` properties to `Model`, `ModelGraphics`, and CZML. Also added `ColorBlendMode` enum. [#4547](https://github.com/AnalyticalGraphicsInc/cesium/pull/4547) * Added the ability to render a `Model` with a silhouette. Added `silhouetteColor` and `silhouetteSize` properties to `Model`, `ModelGraphics`, and CZML. [#4314](https://github.com/AnalyticalGraphicsInc/cesium/pull/4314) @@ -60,6 +63,7 @@ Change Log * Fixed `Cartographic.fromCartesian` when the cartesian is not on the ellipsoid surface. [#4611](https://github.com/AnalyticalGraphicsInc/cesium/issues/4611) ### 1.27 - 2016-11-01 + * Deprecated * Individual heading, pitch, and roll options to `Transforms.headingPitchRollToFixedFrame` and `Transforms.headingPitchRollQuaternion` have been deprecated and will be removed in 1.30. Pass the new `HeadingPitchRoll` object instead. [#4498](https://github.com/AnalyticalGraphicsInc/cesium/pull/4498) * Breaking changes @@ -198,9 +202,11 @@ Change Log * Added `packArray` and `unpackArray` functions to `Cartesian2`, `Cartesian3`, and `Cartesian4`. ### 1.22.2 - 2016-06-14 + * This is an npm only release to fix the improperly published 1.22.1. There were no code changes. ### 1.22.1 - 2016-06-13 + * Fixed default Bing Key and added a watermark to notify users that they need to sign up for their own key. ### 1.22 - 2016-06-01 @@ -319,6 +325,7 @@ Change Log * Fixed hole that appeared in the top of in dynamic ellipsoids ### 1.18 - 2016-02-01 + * Breaking changes * Removed support for `CESIUM_binary_glTF`. Use `KHR_binary_glTF` instead, which is the default for the online [COLLADA-to-glTF converter](http://cesiumjs.org/convertmodel.html). * Deprecated