cesium 0.13.2 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. data/app/assets/javascripts/Cesium.js +2 -2
  2. data/app/assets/javascripts/Core/Clock.js +81 -81
  3. data/app/assets/javascripts/Core/ClockRange.js +5 -3
  4. data/app/assets/javascripts/Core/ClockStep.js +7 -1
  5. data/app/assets/javascripts/Core/Event.js +12 -11
  6. data/app/assets/javascripts/Core/JulianDate.js +16 -0
  7. data/app/assets/javascripts/DynamicScene/CompositeDynamicObjectCollection.js +1 -1
  8. data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +1 -1
  9. data/app/assets/javascripts/DynamicScene/DynamicConeVisualizer.js +1 -1
  10. data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +1 -1
  11. data/app/assets/javascripts/DynamicScene/DynamicEllipsoidVisualizer.js +1 -1
  12. data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +1 -1
  13. data/app/assets/javascripts/DynamicScene/DynamicPathVisualizer.js +1 -1
  14. data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +1 -1
  15. data/app/assets/javascripts/DynamicScene/DynamicPolygonVisualizer.js +1 -1
  16. data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +1 -1
  17. data/app/assets/javascripts/DynamicScene/DynamicPyramidVisualizer.js +1 -1
  18. data/app/assets/javascripts/Renderer/ClearCommand.js +1 -1
  19. data/app/assets/javascripts/Renderer/Context.js +23 -0
  20. data/app/assets/javascripts/Renderer/DrawCommand.js +1 -1
  21. data/app/assets/javascripts/Scene/BillboardCollection.js +14 -24
  22. data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +8 -31
  23. data/app/assets/javascripts/Scene/PerformanceDisplay.js +13 -4
  24. data/app/assets/javascripts/Scene/Tile.js +11 -6
  25. data/app/assets/javascripts/Scene/ViewportQuad.js +21 -36
  26. data/app/assets/javascripts/Shaders/BillboardCollectionFS.js +15 -11
  27. data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +47 -27
  28. data/app/assets/javascripts/Shaders/BuiltinFunctions.js +886 -228
  29. data/app/assets/javascripts/Shaders/CentralBodyFS.js +173 -40
  30. data/app/assets/javascripts/Shaders/CentralBodyFSDepth.js +17 -14
  31. data/app/assets/javascripts/Shaders/CentralBodyFSPole.js +25 -19
  32. data/app/assets/javascripts/Shaders/CentralBodyVS.js +61 -31
  33. data/app/assets/javascripts/Shaders/CentralBodyVSDepth.js +5 -4
  34. data/app/assets/javascripts/Shaders/CentralBodyVSPole.js +9 -7
  35. data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.js +392 -299
  36. data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.js +12 -8
  37. data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.js +836 -530
  38. data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.js +95 -58
  39. data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.js +7 -6
  40. data/app/assets/javascripts/Shaders/EllipsoidFS.js +34 -26
  41. data/app/assets/javascripts/Shaders/EllipsoidVS.js +21 -5
  42. data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.js +19 -11
  43. data/app/assets/javascripts/Shaders/Materials/BlobMaterial.js +13 -9
  44. data/app/assets/javascripts/Shaders/Materials/BrickMaterial.js +33 -22
  45. data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.js +24 -17
  46. data/app/assets/javascripts/Shaders/Materials/CementMaterial.js +14 -10
  47. data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.js +32 -20
  48. data/app/assets/javascripts/Shaders/Materials/DotMaterial.js +11 -6
  49. data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.js +18 -13
  50. data/app/assets/javascripts/Shaders/Materials/FacetMaterial.js +12 -7
  51. data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.js +9 -6
  52. data/app/assets/javascripts/Shaders/Materials/GrassMaterial.js +23 -16
  53. data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.js +14 -11
  54. data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.js +10 -8
  55. data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.js +10 -8
  56. data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.js +12 -7
  57. data/app/assets/javascripts/Shaders/Materials/StripeMaterial.js +21 -12
  58. data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.js +11 -7
  59. data/app/assets/javascripts/Shaders/Materials/Water.js +46 -45
  60. data/app/assets/javascripts/Shaders/Materials/WoodMaterial.js +29 -19
  61. data/app/assets/javascripts/Shaders/Noise.js +408 -173
  62. data/app/assets/javascripts/Shaders/PolygonFS.js +20 -10
  63. data/app/assets/javascripts/Shaders/PolygonFSPick.js +3 -3
  64. data/app/assets/javascripts/Shaders/PolygonVS.js +27 -22
  65. data/app/assets/javascripts/Shaders/PolygonVSPick.js +23 -19
  66. data/app/assets/javascripts/Shaders/PolylineFS.js +3 -3
  67. data/app/assets/javascripts/Shaders/PolylineVS.js +24 -19
  68. data/app/assets/javascripts/Shaders/Ray.js +496 -315
  69. data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.js +16 -6
  70. data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.js +5 -2
  71. data/app/assets/javascripts/Shaders/SensorVolume.js +32 -15
  72. data/app/assets/javascripts/Shaders/SkyAtmosphereFS.js +61 -16
  73. data/app/assets/javascripts/Shaders/SkyAtmosphereVS.js +106 -53
  74. data/app/assets/javascripts/Shaders/SkyBoxFS.js +4 -2
  75. data/app/assets/javascripts/Shaders/SkyBoxVS.js +5 -3
  76. data/app/assets/javascripts/Shaders/ViewportQuadFS.js +14 -10
  77. data/app/assets/javascripts/Shaders/ViewportQuadVS.js +6 -5
  78. data/app/assets/javascripts/ThirdParty/knockout.js +88 -0
  79. data/app/assets/javascripts/Widgets/Animation/Animation.css +141 -0
  80. data/app/assets/javascripts/Widgets/Animation/Animation.js +944 -0
  81. data/app/assets/javascripts/Widgets/Animation/AnimationViewModel.js +503 -0
  82. data/app/assets/javascripts/Widgets/Animation/darker.css +69 -0
  83. data/app/assets/javascripts/Widgets/ClockViewModel.js +167 -0
  84. data/app/assets/javascripts/Widgets/Command.js +33 -0
  85. data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.css +54 -77
  86. data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.html +6 -27
  87. data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.js +124 -187
  88. data/app/assets/javascripts/Widgets/Fullscreen/FullscreenViewModel.js +88 -0
  89. data/app/assets/javascripts/Widgets/Fullscreen/FullscreenWidget.css +16 -0
  90. data/app/assets/javascripts/Widgets/Fullscreen/FullscreenWidget.js +50 -0
  91. data/app/assets/javascripts/Widgets/Fullscreen/darker.css +14 -0
  92. data/app/assets/javascripts/Widgets/Images/enterFullscreen-darker.svg +18 -0
  93. data/app/assets/javascripts/Widgets/Images/enterFullscreen.svg +18 -0
  94. data/app/assets/javascripts/Widgets/Images/exitFullscreen-darker.svg +18 -0
  95. data/app/assets/javascripts/Widgets/Images/exitFullscreen.svg +18 -0
  96. data/app/assets/javascripts/Widgets/Observable.js +29 -0
  97. data/app/assets/javascripts/Widgets/{Timeline.css → Timeline/Timeline.css} +18 -21
  98. data/app/assets/javascripts/Widgets/{Timeline.js → Timeline/Timeline.js} +12 -7
  99. data/app/assets/javascripts/Widgets/{TimelineHighlightRange.js → Timeline/TimelineHighlightRange.js} +0 -0
  100. data/app/assets/javascripts/Widgets/{TimelineTrack.js → Timeline/TimelineTrack.js} +1 -1
  101. data/app/assets/javascripts/Widgets/Timeline/darker.css +20 -0
  102. data/app/assets/javascripts/Widgets/ToggleButtonViewModel.js +40 -0
  103. data/app/assets/javascripts/Widgets/createCommand.js +41 -0
  104. data/lib/cesium/version.rb +1 -1
  105. data/test/dummy/log/development.log +3300 -0
  106. data/test/dummy/tmp/cache/assets/C0D/D90/sprockets%2F297417de8571859510683b028659bf97 +0 -0
  107. data/test/dummy/tmp/cache/assets/C5E/6E0/sprockets%2F990a847694744e4ac598dc125572a243 +0 -0
  108. data/test/dummy/tmp/cache/assets/C64/470/sprockets%2Fa605a34504c3a61f1e0309374154a4f2 +0 -0
  109. data/test/dummy/tmp/cache/assets/C6C/D20/sprockets%2F8214271b512224e3f7a73a322e85b15c +0 -0
  110. data/test/dummy/tmp/cache/assets/C6E/8C0/sprockets%2F13ad4320ee685ee062033b0806b07756 +0 -0
  111. data/test/dummy/tmp/cache/assets/C71/D40/sprockets%2F191b5a7162930434c9ea09419d2c0c42 +0 -0
  112. data/test/dummy/tmp/cache/assets/C75/FC0/sprockets%2F7100611b808c367104f4537af8b467ca +0 -0
  113. data/test/dummy/tmp/cache/assets/C77/C90/sprockets%2F5c6d277228741022bef80d17b5422c55 +0 -0
  114. data/test/dummy/tmp/cache/assets/C7B/2E0/sprockets%2F049f5400e934154d876d9e7a110d0b72 +0 -0
  115. data/test/dummy/tmp/cache/assets/C7D/290/sprockets%2F07b270a59082157be139ee653b4435b9 +0 -0
  116. data/test/dummy/tmp/cache/assets/C82/860/sprockets%2Fbd185743a7cf9fa41b72715364178414 +0 -0
  117. data/test/dummy/tmp/cache/assets/C83/5B0/sprockets%2F11288f143903cfc5595d8a5771f51f20 +0 -0
  118. data/test/dummy/tmp/cache/assets/C84/210/sprockets%2F5e7c3418b40688a85916fd18512fc213 +0 -0
  119. data/test/dummy/tmp/cache/assets/C85/2A0/sprockets%2F409dfb449462105286e47c6a8c32860e +0 -0
  120. data/test/dummy/tmp/cache/assets/C87/790/sprockets%2F49d9e234d84217773d540a5b4813fc64 +0 -0
  121. data/test/dummy/tmp/cache/assets/C8C/C50/sprockets%2F87a1327314e4aa2a3ea44a33a4730420 +0 -0
  122. data/test/dummy/tmp/cache/assets/C9C/B20/sprockets%2Fc3000c708c2d95253d8a414d6c087d10 +0 -0
  123. data/test/dummy/tmp/cache/assets/C9E/DC0/sprockets%2F2f7b17e380320fe9d0650d3aa4614432 +0 -0
  124. data/test/dummy/tmp/cache/assets/C9F/9B0/sprockets%2Faeb280e1126521372c0bd6660e22969b +0 -0
  125. data/test/dummy/tmp/cache/assets/CA0/9A0/sprockets%2Fc1e9542f7960491862764447bf6d7f9e +0 -0
  126. data/test/dummy/tmp/cache/assets/CA1/C10/sprockets%2F804602800eb2e183aa91825b5f881b0d +0 -0
  127. data/test/dummy/tmp/cache/assets/CA6/DD0/sprockets%2F8b2532b8158e7333d5392bb505ca512f +0 -0
  128. data/test/dummy/tmp/cache/assets/CA8/4C0/sprockets%2Fbe667b320658d0297c210cb43c77b760 +0 -0
  129. data/test/dummy/tmp/cache/assets/CA9/340/sprockets%2Fd3c10509ea49a62e909622f77f4b3220 +0 -0
  130. data/test/dummy/tmp/cache/assets/CA9/430/sprockets%2F68e71052d60ebac0303e9e883c541265 +0 -0
  131. data/test/dummy/tmp/cache/assets/CAB/380/sprockets%2Fc2d6119b9334706b0b40e54f93f431f7 +0 -0
  132. data/test/dummy/tmp/cache/assets/CAC/820/sprockets%2F6b14c16171e49a1128966926eade622b +0 -0
  133. data/test/dummy/tmp/cache/assets/CB2/A60/sprockets%2F5583541ee042c37a846d149d80c8a36d +0 -0
  134. data/test/dummy/tmp/cache/assets/CB2/F30/sprockets%2Fcd4160d432937934435655ca7c56c5fa +0 -0
  135. data/test/dummy/tmp/cache/assets/CB3/280/sprockets%2F7e73589c2b0009c3748f7a068242cc7a +0 -0
  136. data/test/dummy/tmp/cache/assets/CB4/A90/sprockets%2F8fa8411bd1707443dcf02695b9a80776 +0 -0
  137. data/test/dummy/tmp/cache/assets/CB4/F10/sprockets%2F06ee620db145798202a9fd4c1849944b +0 -0
  138. data/test/dummy/tmp/cache/assets/CB8/3B0/sprockets%2Fd03836e3d10fb91125597086f6dcc848 +0 -0
  139. data/test/dummy/tmp/cache/assets/CB9/280/sprockets%2F0e4025fc9a78a70774353617a9b7e96a +0 -0
  140. data/test/dummy/tmp/cache/assets/CBB/3F0/sprockets%2F410c0a86475946a391fc849c9c34e5e4 +0 -0
  141. data/test/dummy/tmp/cache/assets/CBE/B60/sprockets%2F872738245c2698dd11952e55f1d2cd5f +0 -0
  142. data/test/dummy/tmp/cache/assets/CC2/090/sprockets%2F1f4c818e07baa8b05de5987748339952 +0 -0
  143. data/test/dummy/tmp/cache/assets/CC3/D90/sprockets%2Fd7e90e060a9924b61d0b2c6d102c0024 +0 -0
  144. data/test/dummy/tmp/cache/assets/CC8/310/sprockets%2F3d942c768ca693e08155d8a9b2195e99 +0 -0
  145. data/test/dummy/tmp/cache/assets/CC8/9F0/sprockets%2Fbc7ef55837e5097405e3f5097fe35961 +0 -0
  146. data/test/dummy/tmp/cache/assets/CC8/A80/sprockets%2F887a36c292044706f9d58ee02f659eb9 +0 -0
  147. data/test/dummy/tmp/cache/assets/CC8/E20/sprockets%2F27297a29159534cf493ff55576c9faa5 +0 -0
  148. data/test/dummy/tmp/cache/assets/CCD/040/sprockets%2Faf449bc1503080d6262424c20bb97b6d +0 -0
  149. data/test/dummy/tmp/cache/assets/CCD/210/sprockets%2F33c821e4b3b2538af0c79006df1318d0 +0 -0
  150. data/test/dummy/tmp/cache/assets/CCD/8B0/sprockets%2F738651415c65eb022af5ec9230a6b2b1 +0 -0
  151. data/test/dummy/tmp/cache/assets/CCF/180/sprockets%2F39ad17e27f30e3d0080675315bdae602 +0 -0
  152. data/test/dummy/tmp/cache/assets/CD0/CB0/sprockets%2F139767c003a27a8b5da08fc3714c072b +0 -0
  153. data/test/dummy/tmp/cache/assets/CD2/6E0/sprockets%2F161543077a1e9c52a2d577bbc3d41e62 +0 -0
  154. data/test/dummy/tmp/cache/assets/CD3/5A0/sprockets%2F3b02ea5d52854a16dea8336c339c5090 +0 -0
  155. data/test/dummy/tmp/cache/assets/CD5/9F0/sprockets%2F72d2b1b535d37251fb45c4754d62e2a6 +0 -0
  156. data/test/dummy/tmp/cache/assets/CDA/170/sprockets%2Ffae3735873d2d340da1827ee6246500e +0 -0
  157. data/test/dummy/tmp/cache/assets/CDA/C40/sprockets%2F1d06e02833dd2620777ee9818ec61bb0 +0 -0
  158. data/test/dummy/tmp/cache/assets/CDC/080/sprockets%2Fb33c033c645ff28315cc958538cd5b13 +0 -0
  159. data/test/dummy/tmp/cache/assets/CDC/990/sprockets%2F913dd1f104b8b71495b00d798c2922de +0 -0
  160. data/test/dummy/tmp/cache/assets/CDD/090/sprockets%2F62a239aa6b1847f0cd82f6e5b7187303 +0 -0
  161. data/test/dummy/tmp/cache/assets/CDF/E30/sprockets%2F27d4b1eb52518a0667aef8525455b57c +0 -0
  162. data/test/dummy/tmp/cache/assets/CE6/E20/sprockets%2F0c20945489c7228a66bb54fd7cc449f0 +0 -0
  163. data/test/dummy/tmp/cache/assets/CE8/F00/sprockets%2Fd5833932a705129ff7ce6072ee0fb945 +0 -0
  164. data/test/dummy/tmp/cache/assets/CE9/C20/sprockets%2F5c49d701727e703847268f9fffdba020 +0 -0
  165. data/test/dummy/tmp/cache/assets/CED/610/sprockets%2F678ef9639f922616c1ced8f3b1b12931 +0 -0
  166. data/test/dummy/tmp/cache/assets/CEE/300/sprockets%2Fc27f86c561d6e1e8c08d5f852857b025 +0 -0
  167. data/test/dummy/tmp/cache/assets/CEF/B50/sprockets%2F877a93d34cbc7b4cf1837a56398f0185 +0 -0
  168. data/test/dummy/tmp/cache/assets/CF2/6B0/sprockets%2F8c7e5aab44b8703a6379569d887145be +0 -0
  169. data/test/dummy/tmp/cache/assets/CF3/2A0/sprockets%2Fcf7fca385a816577b9a3a8583117696d +0 -0
  170. data/test/dummy/tmp/cache/assets/CF5/5E0/sprockets%2Fdaf7891f7f08019202f8576899bb51ce +0 -0
  171. data/test/dummy/tmp/cache/assets/CF5/F60/sprockets%2Fbf00d9de7199bf7775c55128a295b677 +0 -0
  172. data/test/dummy/tmp/cache/assets/CF6/F60/sprockets%2Fc8e90a0ee2521916c1aa1a41b6463a63 +0 -0
  173. data/test/dummy/tmp/cache/assets/CF8/AB0/sprockets%2F7755643d4dc601cdf47e9886b4f379a5 +0 -0
  174. data/test/dummy/tmp/cache/assets/CF8/FA0/sprockets%2F853bda27091dea80f5121d20a08b53a7 +0 -0
  175. data/test/dummy/tmp/cache/assets/CFC/970/sprockets%2Fbe27af53c78bc90a6113a41620a448e1 +0 -0
  176. data/test/dummy/tmp/cache/assets/D01/160/sprockets%2Fa74c8a20e3158be3fb170499a11093db +0 -0
  177. data/test/dummy/tmp/cache/assets/D01/4A0/sprockets%2F9e53138a5fa453940a6190c1ba3ac36e +0 -0
  178. data/test/dummy/tmp/cache/assets/D09/360/sprockets%2Fe5d09aa6884c385437dbb18ca301e353 +0 -0
  179. data/test/dummy/tmp/cache/assets/D0D/990/sprockets%2F9cbe1835abd85d521b876411a56cb672 +0 -0
  180. data/test/dummy/tmp/cache/assets/D0E/610/sprockets%2F3e14d0cbb1493615f7d23438bf8fd068 +0 -0
  181. data/test/dummy/tmp/cache/assets/D0F/870/sprockets%2F7597efb306ce615354e507d02edd14d4 +0 -0
  182. data/test/dummy/tmp/cache/assets/D10/590/sprockets%2F80386d276f6569b0a12ae1be155f9b3e +0 -0
  183. data/test/dummy/tmp/cache/assets/D11/060/sprockets%2F6d0bee24e84229bd6014301c878ff6d6 +0 -0
  184. data/test/dummy/tmp/cache/assets/D11/6A0/sprockets%2Ff21a9f2e8f4075086e68cda0059b25e2 +0 -0
  185. data/test/dummy/tmp/cache/assets/D11/A30/sprockets%2F210c5ab2fecdef47005c7308685e9297 +0 -0
  186. data/test/dummy/tmp/cache/assets/D12/460/sprockets%2F9c0db7ab725c7c7b15d2450657fe2369 +0 -0
  187. data/test/dummy/tmp/cache/assets/D12/760/sprockets%2F03c39aaab0669a6e9670a29f048db686 +0 -0
  188. data/test/dummy/tmp/cache/assets/D12/A90/sprockets%2F5f4bf0f279ca050491c07688df6d7c02 +0 -0
  189. data/test/dummy/tmp/cache/assets/D14/020/sprockets%2F0c3544de7e7bd74ee6e2040477f04a88 +0 -0
  190. data/test/dummy/tmp/cache/assets/D15/9B0/sprockets%2F015d78bcd557b68b039a7abd33b47679 +0 -0
  191. data/test/dummy/tmp/cache/assets/D19/B40/sprockets%2F1f58b7a260a18bcc697883f96e266a1b +0 -0
  192. data/test/dummy/tmp/cache/assets/D1A/520/sprockets%2Fe32e6a17fb333c5883939fcb234d2f69 +0 -0
  193. data/test/dummy/tmp/cache/assets/D1C/6B0/sprockets%2F3c7df42c4a83942ffb31d85d827595b4 +0 -0
  194. data/test/dummy/tmp/cache/assets/D1C/BD0/sprockets%2Ff389718cb2ba6fe3e0e0c420398f9486 +0 -0
  195. data/test/dummy/tmp/cache/assets/D21/E90/sprockets%2F2fe752c3566ccd57f7ee339086fc3427 +0 -0
  196. data/test/dummy/tmp/cache/assets/D23/CD0/sprockets%2F20f79a5d5570f3efef4de79621355e49 +0 -0
  197. data/test/dummy/tmp/cache/assets/D23/D30/sprockets%2F71867caa2cf28987ed0048cf7d3a7569 +0 -0
  198. data/test/dummy/tmp/cache/assets/D24/EF0/sprockets%2F776d054d84f539061bd8ddffa66906c8 +0 -0
  199. data/test/dummy/tmp/cache/assets/D25/4D0/sprockets%2Fde6d162f5e2a587d9564e88d90c773a3 +0 -0
  200. data/test/dummy/tmp/cache/assets/D27/A90/sprockets%2F1a25693899836d58cad4cbfe8c7a7707 +0 -0
  201. data/test/dummy/tmp/cache/assets/D2D/F30/sprockets%2Fc75a2beb051b582840cf3800d55b26dc +0 -0
  202. data/test/dummy/tmp/cache/assets/D2D/F80/sprockets%2F0293aae3c8d8a4fda11a0883c48b5222 +0 -0
  203. data/test/dummy/tmp/cache/assets/D2E/600/sprockets%2Fda9f7539b9df0aa7d763d14999870d94 +0 -0
  204. data/test/dummy/tmp/cache/assets/D33/040/sprockets%2F6593d8c52e0b617a12ae2c49aa6e3b07 +0 -0
  205. data/test/dummy/tmp/cache/assets/D34/7A0/sprockets%2F4b4a0c9775248b2e49c1bae8a72a05c3 +0 -0
  206. data/test/dummy/tmp/cache/assets/D36/770/sprockets%2F2942b9a5caa50e9107de74eca152619c +0 -0
  207. data/test/dummy/tmp/cache/assets/D37/9C0/sprockets%2Fdfa99409821a9d0d1d6f30b5461b1ae5 +0 -0
  208. data/test/dummy/tmp/cache/assets/D38/930/sprockets%2F1dd724d3466a12a84bb248dc7e6d06c6 +0 -0
  209. data/test/dummy/tmp/cache/assets/D39/7E0/sprockets%2F0a236c2722565068da14f7ecf7b7a8da +0 -0
  210. data/test/dummy/tmp/cache/assets/D3A/420/sprockets%2Fbd47498d7cbba00ab9c8201883915f2a +0 -0
  211. data/test/dummy/tmp/cache/assets/D3B/BB0/sprockets%2Ff533a1adca88a3594ec94233f71eb812 +0 -0
  212. data/test/dummy/tmp/cache/assets/D3B/E20/sprockets%2Fd20320e720f8dc2779b4ec627eb15fb6 +0 -0
  213. data/test/dummy/tmp/cache/assets/D3D/080/sprockets%2F007ac06f3c784668b28baba6902eec76 +0 -0
  214. data/test/dummy/tmp/cache/assets/D3D/D30/sprockets%2F5fa8cd221b97c829234dc81721eea60e +0 -0
  215. data/test/dummy/tmp/cache/assets/D3E/1F0/sprockets%2F6e84e3f3e420bd5ad7f336ce41750d36 +0 -0
  216. data/test/dummy/tmp/cache/assets/D3F/960/sprockets%2F237931317e014eabd96932637ffadddc +0 -0
  217. data/test/dummy/tmp/cache/assets/D42/460/sprockets%2Fb195b37929fa63c85fbfb573aa05d209 +0 -0
  218. data/test/dummy/tmp/cache/assets/D42/F90/sprockets%2F632555653af85b04e418abb9dee238cf +0 -0
  219. data/test/dummy/tmp/cache/assets/D44/400/sprockets%2F3cdc153bbcae4ac07e75193678d61996 +0 -0
  220. data/test/dummy/tmp/cache/assets/D46/D10/sprockets%2F3399d1c2c5dbc7c9e0f2106296d82fd7 +0 -0
  221. data/test/dummy/tmp/cache/assets/D47/A70/sprockets%2F526b1eb3f0c2369b0c16c96ddf775f96 +0 -0
  222. data/test/dummy/tmp/cache/assets/D48/180/sprockets%2Ffce9aa3720b73d2259e644a2e3a99c89 +0 -0
  223. data/test/dummy/tmp/cache/assets/D48/6F0/sprockets%2F7a67d797a92f48d3104ecf5e42b5bc71 +0 -0
  224. data/test/dummy/tmp/cache/assets/D4A/7B0/sprockets%2F8cbd4e8cdea7e3e486565d92b2271561 +0 -0
  225. data/test/dummy/tmp/cache/assets/D4C/2C0/sprockets%2F096baecb9254aaa68d12c0a3c34a2121 +0 -0
  226. data/test/dummy/tmp/cache/assets/D4E/440/sprockets%2F141dfe7665828ab1d5ee647d0e797e5a +0 -0
  227. data/test/dummy/tmp/cache/assets/D4F/D90/sprockets%2F1e4fde9a33bb918796edc96eb0805564 +0 -0
  228. data/test/dummy/tmp/cache/assets/D50/390/sprockets%2F04f3299f7c28fa65842d4bda257df9d5 +0 -0
  229. data/test/dummy/tmp/cache/assets/D51/330/sprockets%2F0e113bb1dc7050041be6f8d28c4ebb41 +0 -0
  230. data/test/dummy/tmp/cache/assets/D57/370/sprockets%2F102e7ebfa287ea2e1b58052b052c1ee2 +0 -0
  231. data/test/dummy/tmp/cache/assets/D57/C50/sprockets%2F28a22bacabfe4b780402b3ca83a54843 +0 -0
  232. data/test/dummy/tmp/cache/assets/D57/D00/sprockets%2Fbb9c7666fe4175a054557fff4ccf5983 +0 -0
  233. data/test/dummy/tmp/cache/assets/D59/E30/sprockets%2Fa8a09c836fc128ee889ce97d72e6444c +0 -0
  234. data/test/dummy/tmp/cache/assets/D5C/800/sprockets%2Fdd1b21cea3433ac792403e3de4f84f11 +0 -0
  235. data/test/dummy/tmp/cache/assets/D5D/140/sprockets%2Ffca988958f2a37ce8eb6b77337e793c0 +0 -0
  236. data/test/dummy/tmp/cache/assets/D5F/630/sprockets%2Ff2df01200f9420db5285f15bbdf4e34e +0 -0
  237. data/test/dummy/tmp/cache/assets/D61/420/sprockets%2F79102ecb63d32f0f43e46f481acab0c7 +0 -0
  238. data/test/dummy/tmp/cache/assets/D61/B10/sprockets%2F56a7f22ca114fc32e60a2ca8e5c946e1 +0 -0
  239. data/test/dummy/tmp/cache/assets/D61/C00/sprockets%2F71ad51ea200867d43de03b8b25eb3e6f +0 -0
  240. data/test/dummy/tmp/cache/assets/D63/400/sprockets%2F30721d1c6698a64ac1cdc7e8d3ad37a0 +0 -0
  241. data/test/dummy/tmp/cache/assets/D65/3D0/sprockets%2Fc70f23593414be8a0daf25149ecb06fd +0 -0
  242. data/test/dummy/tmp/cache/assets/D68/020/sprockets%2Fc393ddcb5c7dbaf1665bc90491523d23 +0 -0
  243. data/test/dummy/tmp/cache/assets/D68/9F0/sprockets%2F0a2eac996cb10aab983963ec21c9d166 +0 -0
  244. data/test/dummy/tmp/cache/assets/D68/FA0/sprockets%2F315d926695d2ababc102ded8362e7c7b +0 -0
  245. data/test/dummy/tmp/cache/assets/D69/810/sprockets%2F8a4fedc6fc72ca37c7403924c01b374d +0 -0
  246. data/test/dummy/tmp/cache/assets/D6A/400/sprockets%2F7797a681a0c8c541bad4febaa526920e +0 -0
  247. data/test/dummy/tmp/cache/assets/D6A/800/sprockets%2F9e3ba44ae81df1dc8c541a05e0239c79 +0 -0
  248. data/test/dummy/tmp/cache/assets/D6B/890/sprockets%2Fdacdb6e192b1709870319bbb0feb3669 +0 -0
  249. data/test/dummy/tmp/cache/assets/D6D/DD0/sprockets%2Ffbfa79e06a10e3016c741fff74c5e652 +0 -0
  250. data/test/dummy/tmp/cache/assets/D6E/540/sprockets%2F1ec9a9013efe375e03b9ba538af9b515 +0 -0
  251. data/test/dummy/tmp/cache/assets/D70/D70/sprockets%2Fd7f6a9d69e31ff706e22c0b283b6a1e4 +0 -0
  252. data/test/dummy/tmp/cache/assets/D70/F70/sprockets%2Ff296c418125b7be0bc89c34eec50e82d +0 -0
  253. data/test/dummy/tmp/cache/assets/D71/6E0/sprockets%2F8c3e23061d8826cf63999adbe4a0d5ba +0 -0
  254. data/test/dummy/tmp/cache/assets/D73/3D0/sprockets%2Fbad4cc5e382119c131bd5947dd7c96e7 +0 -0
  255. data/test/dummy/tmp/cache/assets/D74/9D0/sprockets%2F1893ad2efa07114b729fd1f09ae97f4e +0 -0
  256. data/test/dummy/tmp/cache/assets/D74/EE0/sprockets%2Fe68a01853f554a88bb865bc94ba1bbd9 +0 -0
  257. data/test/dummy/tmp/cache/assets/D75/900/sprockets%2F857ad23ff231bc76bec12fd9a966538a +0 -0
  258. data/test/dummy/tmp/cache/assets/D76/060/sprockets%2Fd80d293a509fdecc872163f94b8fcc13 +0 -0
  259. data/test/dummy/tmp/cache/assets/D76/350/sprockets%2F66508d9698453a0ffabcf1368ca7a1fc +0 -0
  260. data/test/dummy/tmp/cache/assets/D79/820/sprockets%2F99bcacecd3fb76124a968b4b8341e729 +0 -0
  261. data/test/dummy/tmp/cache/assets/D7E/130/sprockets%2F1affef8c994fdc43ba85491b2724627f +0 -0
  262. data/test/dummy/tmp/cache/assets/D7E/C00/sprockets%2F8ed69e6fd77505a244caf6dde36822e3 +0 -0
  263. data/test/dummy/tmp/cache/assets/D80/7A0/sprockets%2F68e74ee988b46d128ff3020bc0e9c7fd +0 -0
  264. data/test/dummy/tmp/cache/assets/D82/800/sprockets%2F9f0d326f40e88f324ff3a367d9b3fc9f +0 -0
  265. data/test/dummy/tmp/cache/assets/D84/650/sprockets%2Fea05e644410721afbbd8fd1a3a7a1c08 +0 -0
  266. data/test/dummy/tmp/cache/assets/D89/3A0/sprockets%2F53ef2870ac0bb142a8322eee9adca207 +0 -0
  267. data/test/dummy/tmp/cache/assets/D8B/240/sprockets%2Faddf06da0d70aa150d16b97b6816d0d6 +0 -0
  268. data/test/dummy/tmp/cache/assets/D8B/3B0/sprockets%2Fd0c134b0b275ea2f800380fcaebc95f5 +0 -0
  269. data/test/dummy/tmp/cache/assets/D8D/F70/sprockets%2F70d5fc5c803f7ba21c3a7374003bfcdd +0 -0
  270. data/test/dummy/tmp/cache/assets/D8F/B90/sprockets%2F5468bccabc20d4cf562bd110508df3d8 +0 -0
  271. data/test/dummy/tmp/cache/assets/D92/3B0/sprockets%2Fc03a95a4b2eb432d9f5ceda3fb082860 +0 -0
  272. data/test/dummy/tmp/cache/assets/D93/FE0/sprockets%2Fac1c5a644564a7fd2861539dbaf2a0fb +0 -0
  273. data/test/dummy/tmp/cache/assets/D95/500/sprockets%2Fa3c0fdf5260f72d128f7cbb2a64fd408 +0 -0
  274. data/test/dummy/tmp/cache/assets/D97/2E0/sprockets%2F93c35b873a3c8ea35f1628e1ad2deb2b +0 -0
  275. data/test/dummy/tmp/cache/assets/D97/4A0/sprockets%2F2fae66f8ad04be7ce8109005c735acf1 +0 -0
  276. data/test/dummy/tmp/cache/assets/D98/E90/sprockets%2F04cdcb52b072efd49452f2cde9721fb4 +0 -0
  277. data/test/dummy/tmp/cache/assets/D9C/E90/sprockets%2F7d2da4bd8ee5b4ff754581d41806aba2 +0 -0
  278. data/test/dummy/tmp/cache/assets/DA0/2C0/sprockets%2F61c0dfd9a973f9891cd3d6b322bc33ea +0 -0
  279. data/test/dummy/tmp/cache/assets/DA0/C70/sprockets%2Ff29a718bce262c8d86f3abe9443b41cb +0 -0
  280. data/test/dummy/tmp/cache/assets/DA3/A00/sprockets%2F7e7df285dbb4694a5f1583fba12ab84d +0 -0
  281. data/test/dummy/tmp/cache/assets/DA3/EC0/sprockets%2F159d528ec53e415cbc9d29be3a2b96fb +0 -0
  282. data/test/dummy/tmp/cache/assets/DA5/170/sprockets%2F6a564a0e1afd718a07d87f069bc48dff +0 -0
  283. data/test/dummy/tmp/cache/assets/DA6/730/sprockets%2F5758d9d4ad2c22c9ffd113a78f6d36bb +0 -0
  284. data/test/dummy/tmp/cache/assets/DA7/6F0/sprockets%2F3e39ce593cda9b3bce9c3c8e014829b5 +0 -0
  285. data/test/dummy/tmp/cache/assets/DA9/0B0/sprockets%2F66e39ce1e6e7adc58cb01550fe58c93d +0 -0
  286. data/test/dummy/tmp/cache/assets/DAD/9D0/sprockets%2Fc99ec7c84f8f79200eda8424c6bda6e1 +0 -0
  287. data/test/dummy/tmp/cache/assets/DAE/B70/sprockets%2F278f525bc64f4ead949d9dfa1f1a37c8 +0 -0
  288. data/test/dummy/tmp/cache/assets/DB3/740/sprockets%2F3fc2be88f7fa50a9992fe961ffc50a83 +0 -0
  289. data/test/dummy/tmp/cache/assets/DB3/770/sprockets%2F47998ff4ce9a2b5383b95bd54ded3c3d +0 -0
  290. data/test/dummy/tmp/cache/assets/DB6/6C0/sprockets%2Fe710d8fbf4ca41d29a742b22a21a0fec +0 -0
  291. data/test/dummy/tmp/cache/assets/DBC/330/sprockets%2Ffc79d797d11878bc435b668cdfbc94cf +0 -0
  292. data/test/dummy/tmp/cache/assets/DBF/270/sprockets%2F820ebc60d1be685f4044d1cb8cabdd17 +0 -0
  293. data/test/dummy/tmp/cache/assets/DBF/E80/sprockets%2F41d82531e91fc1ca0c806beacf0cfc84 +0 -0
  294. data/test/dummy/tmp/cache/assets/DC1/E40/sprockets%2F57aebd4c69abf9331b4770bd3ced100d +0 -0
  295. data/test/dummy/tmp/cache/assets/DC1/FD0/sprockets%2Ff97fb61e211912bbc1eaed82c4ad740c +0 -0
  296. data/test/dummy/tmp/cache/assets/DC2/250/sprockets%2Ffddac1268ff054c12ea32cc6619c46ac +0 -0
  297. data/test/dummy/tmp/cache/assets/DC2/5F0/sprockets%2F68dc2f8cab31bbd8ab65220c685eb15b +0 -0
  298. data/test/dummy/tmp/cache/assets/DC3/7C0/sprockets%2Fa78b7c0aa57b250e05d5ad1e56ac9ed5 +0 -0
  299. data/test/dummy/tmp/cache/assets/DC9/330/sprockets%2Fc5fe138ffe1adb009a407c172fcb9b49 +0 -0
  300. data/test/dummy/tmp/cache/assets/DCC/F10/sprockets%2F4fb860d9bb2c56165fae6ecc193bd1f2 +0 -0
  301. data/test/dummy/tmp/cache/assets/DCE/0E0/sprockets%2Fc1845aeaffa0d9c887108b5cf1a77dc2 +0 -0
  302. data/test/dummy/tmp/cache/assets/DCE/920/sprockets%2F5208ac969dfa6f4dd531ef2d2afb454b +0 -0
  303. data/test/dummy/tmp/cache/assets/DCE/950/sprockets%2F2d0d1caef1b638f88de704d1eb07be88 +0 -0
  304. data/test/dummy/tmp/cache/assets/DCE/9C0/sprockets%2Fc6b7fd0b623a5b66692ed21dafe5ee18 +0 -0
  305. data/test/dummy/tmp/cache/assets/DD2/190/sprockets%2F3662cdc2f2f551c51ec9bddb9177deb7 +0 -0
  306. data/test/dummy/tmp/cache/assets/DD2/C80/sprockets%2Fe94b85ec5d4eeb0616972dd03cadf06f +0 -0
  307. data/test/dummy/tmp/cache/assets/DD3/B30/sprockets%2Ff1eab781d903ebdf7d9379cca92533ba +0 -0
  308. data/test/dummy/tmp/cache/assets/DD5/8F0/sprockets%2F4bfcc6fffb235da87a162efc721985e2 +0 -0
  309. data/test/dummy/tmp/cache/assets/DD6/8B0/sprockets%2F8ab6728b7ab04dbec482fe5fb7ef8604 +0 -0
  310. data/test/dummy/tmp/cache/assets/DD6/E50/sprockets%2F1ce8c04cfee001955cf5fd9ed7d59a52 +0 -0
  311. data/test/dummy/tmp/cache/assets/DD9/D30/sprockets%2F9abfa5c86dbf28fd7be89b650c3d5225 +0 -0
  312. data/test/dummy/tmp/cache/assets/DE7/E30/sprockets%2F18bca0215ecdc63ba01a2ee5cd7c34f8 +0 -0
  313. data/test/dummy/tmp/cache/assets/DE8/C20/sprockets%2Fc91409dc1b447ba1beaa0be9b33ef14d +0 -0
  314. data/test/dummy/tmp/cache/assets/DED/270/sprockets%2Fdee70d8becb01a00e2d7420c6a646dff +0 -0
  315. data/test/dummy/tmp/cache/assets/DF4/2D0/sprockets%2Ffd83bba93ef8ca1a70c63ee4b625a6b0 +0 -0
  316. data/test/dummy/tmp/cache/assets/DF8/E50/sprockets%2Fbb1bdc05e895b8c08cb6ca4491ed51cf +0 -0
  317. data/test/dummy/tmp/cache/assets/DFB/EC0/sprockets%2F94ccf06d9a630eaa4a9865d7e74aaaba +0 -0
  318. data/test/dummy/tmp/cache/assets/DFC/FC0/sprockets%2Fd8badee5b41f9328df1d3fe153eef401 +0 -0
  319. data/test/dummy/tmp/cache/assets/DFD/F30/sprockets%2Fd60da4793bab6bff313a6bfc25985dfb +0 -0
  320. data/test/dummy/tmp/cache/assets/DFE/230/sprockets%2Fd260ce7fb8bf41f914b57c0dde9b0af6 +0 -0
  321. data/test/dummy/tmp/cache/assets/DFE/2E0/sprockets%2F813f277df6cd78babbdb7f5c34f3ab05 +0 -0
  322. data/test/dummy/tmp/cache/assets/DFE/E50/sprockets%2F59b3e0cbbf99e92737aab0bcfc205f5f +0 -0
  323. data/test/dummy/tmp/cache/assets/DFF/9F0/sprockets%2Fb4677ae08ff6f9edaf3b2bcbb115a963 +0 -0
  324. data/test/dummy/tmp/cache/assets/E05/480/sprockets%2F789f3eb9b0ee9d3fb684066acaebd4a1 +0 -0
  325. data/test/dummy/tmp/cache/assets/E08/8A0/sprockets%2F3cb6916a9933fdfd43d6defe3e4a6d1d +0 -0
  326. data/test/dummy/tmp/cache/assets/E09/A00/sprockets%2F77913b88dec083cedb3875beae2efd5a +0 -0
  327. data/test/dummy/tmp/cache/assets/E16/E60/sprockets%2Ffe5e3c5af908e8cc7ff70976fdc14db7 +0 -0
  328. data/test/dummy/tmp/cache/assets/E28/B70/sprockets%2Fb2fa75ae01dda6654abd60c78c8bf5cf +0 -0
  329. data/test/dummy/tmp/cache/assets/E30/8A0/sprockets%2F5d3fccefabad47a78655a5c92adb3c76 +0 -0
  330. data/test/dummy/tmp/cache/assets/E36/9F0/sprockets%2Fb2bdf95afd8ecf06ce9b8407a2f9b1b8 +0 -0
  331. data/test/dummy/tmp/cache/assets/E3E/C60/sprockets%2F8b3bfb5dbc23d849d4f2fc6dd7fe45d9 +0 -0
  332. data/test/dummy/tmp/cache/assets/E3F/B10/sprockets%2F7b1af74e67b27fff762f3cdfebe5f4a7 +0 -0
  333. data/test/dummy/tmp/cache/assets/E50/740/sprockets%2F0578ebbffb5c27d00cc86b1dd7b1eada +0 -0
  334. data/test/dummy/tmp/cache/assets/E50/9F0/sprockets%2Fddfa62aba6a56ed6ab5e44ae36b175ad +0 -0
  335. data/test/dummy/tmp/cache/assets/E5D/160/sprockets%2F44a9be8a9b567fceec2bdc4ab074bbb9 +0 -0
  336. data/test/dummy/tmp/cache/assets/E61/FB0/sprockets%2F97c2b65cafddc7ac59ae4a5e2a18afe8 +0 -0
  337. data/test/dummy/tmp/cache/assets/E73/680/sprockets%2F1a4d0b08b6fdbacbfe0d1cb7df5db251 +0 -0
  338. data/test/dummy/tmp/cache/assets/ED1/C10/sprockets%2Fa9a13ad3bb3a6ccbb6faac3fac0b6c8e +0 -0
  339. data/test/dummy/tmp/cache/assets/EF0/E30/sprockets%2F3ac422b66adec6cffa8edecf9bdea48d +0 -0
  340. data/test/dummy/tmp/pids/server.pid +1 -1
  341. metadata +33 -15
  342. data/app/assets/javascripts/Core/AnimationController.js +0 -148
  343. data/app/assets/javascripts/Scene/ImageryProviderError.js +0 -149
  344. data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.css +0 -1
  345. data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.js +0 -47
  346. data/app/assets/javascripts/Widgets/Images/Bing_Logo_51x19_White.png +0 -0
  347. data/app/assets/javascripts/Widgets/Images/animationBar.png +0 -0
  348. data/app/assets/javascripts/Workers/createVerticesFromExtent.js +0 -24
@@ -4,50 +4,70 @@ define(function() {
4
4
  "use strict";
5
5
  return "attribute vec3 positionHigh;\n\
6
6
  attribute vec3 positionLow;\n\
7
- attribute vec2 direction;\n\
8
- attribute vec4 textureCoordinatesAndImageSize;\n\
9
- attribute vec3 originAndShow;\n\
7
+ attribute vec2 direction; // in screen space\n\
8
+ attribute vec4 textureCoordinatesAndImageSize; // size in normalized texture coordinates\n\
9
+ attribute vec3 originAndShow; // show is 0.0 (false) or 1.0 (true)\n\
10
10
  attribute vec2 pixelOffset;\n\
11
- attribute vec4 eyeOffsetAndScale;\n\
11
+ attribute vec4 eyeOffsetAndScale; // eye offset in meters\n\
12
+ \n\
12
13
  #ifdef RENDER_FOR_PICK\n\
13
14
  attribute vec4 pickColor;\n\
14
15
  #else\n\
15
16
  attribute vec4 color;\n\
16
17
  #endif\n\
18
+ \n\
17
19
  uniform vec2 u_atlasSize;\n\
18
- uniform float u_clampToPixel;\n\
20
+ uniform float u_clampToPixel; // clamp is 1.0 (true) or 0.0 (false)\n\
21
+ \n\
19
22
  uniform float u_morphTime;\n\
20
- const vec2 czm_highResolutionSnapScale = vec2(1.0, 1.0);\n\
23
+ \n\
24
+ const vec2 czm_highResolutionSnapScale = vec2(1.0, 1.0); // TODO\n\
25
+ \n\
21
26
  varying vec2 v_textureCoordinates;\n\
27
+ \n\
22
28
  #ifdef RENDER_FOR_PICK\n\
23
29
  varying vec4 v_pickColor;\n\
24
30
  #else\n\
25
31
  varying vec4 v_color;\n\
26
32
  #endif\n\
27
- void main()\n\
33
+ \n\
34
+ void main() \n\
28
35
  {\n\
29
- vec3 eyeOffset = eyeOffsetAndScale.xyz;\n\
30
- float scale = eyeOffsetAndScale.w;\n\
31
- vec2 textureCoordinates = textureCoordinatesAndImageSize.xy;\n\
32
- vec2 imageSize = textureCoordinatesAndImageSize.zw;\n\
33
- vec2 origin = originAndShow.xy;\n\
34
- float show = originAndShow.z;\n\
35
- vec4 p = vec4(czm_translateRelativeToEye(positionHigh, positionLow), 1.0);\n\
36
- vec4 positionEC = czm_modelViewRelativeToEye * p;\n\
37
- positionEC = czm_eyeOffset(positionEC, eyeOffset);\n\
38
- positionEC.xyz *= show;\n\
39
- vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\
40
- vec2 halfSize = u_atlasSize * imageSize * 0.5 * scale * czm_highResolutionSnapScale;\n\
41
- halfSize *= ((direction * 2.0) - 1.0);\n\
42
- positionWC.xy += (origin * abs(halfSize)) + halfSize;\n\
43
- positionWC.xy += (pixelOffset * czm_highResolutionSnapScale);\n\
44
- positionWC.xy = mix(positionWC.xy, floor(positionWC.xy), u_clampToPixel);\n\
45
- gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n\
46
- v_textureCoordinates = textureCoordinates;\n\
36
+ // Modifying this shader may also require modifications to Billboard.computeScreenSpacePosition\n\
37
+ \n\
38
+ // unpack attributes\n\
39
+ vec3 eyeOffset = eyeOffsetAndScale.xyz;\n\
40
+ float scale = eyeOffsetAndScale.w;\n\
41
+ vec2 textureCoordinates = textureCoordinatesAndImageSize.xy;\n\
42
+ vec2 imageSize = textureCoordinatesAndImageSize.zw;\n\
43
+ vec2 origin = originAndShow.xy;\n\
44
+ float show = originAndShow.z;\n\
45
+ \n\
46
+ ///////////////////////////////////////////////////////////////////////////\n\
47
+ \n\
48
+ vec4 p = vec4(czm_translateRelativeToEye(positionHigh, positionLow), 1.0);\n\
49
+ vec4 positionEC = czm_modelViewRelativeToEye * p;\n\
50
+ positionEC = czm_eyeOffset(positionEC, eyeOffset);\n\
51
+ positionEC.xyz *= show;\n\
52
+ \n\
53
+ /////////////////////////////////////////////////////////////////////////// \n\
54
+ \n\
55
+ vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\
56
+ \n\
57
+ vec2 halfSize = u_atlasSize * imageSize * 0.5 * scale * czm_highResolutionSnapScale;\n\
58
+ halfSize *= ((direction * 2.0) - 1.0);\n\
59
+ \n\
60
+ positionWC.xy += (origin * abs(halfSize)) + halfSize;\n\
61
+ positionWC.xy += (pixelOffset * czm_highResolutionSnapScale);\n\
62
+ positionWC.xy = mix(positionWC.xy, floor(positionWC.xy), u_clampToPixel);\n\
63
+ \n\
64
+ gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n\
65
+ v_textureCoordinates = textureCoordinates;\n\
66
+ \n\
47
67
  #ifdef RENDER_FOR_PICK\n\
48
- v_pickColor = pickColor;\n\
68
+ v_pickColor = pickColor;\n\
49
69
  #else\n\
50
- v_color = color;\n\
70
+ v_color = color;\n\
51
71
  #endif\n\
52
72
  }\n\
53
73
  ";
@@ -2,321 +2,979 @@
2
2
  /*global define*/
3
3
  define(function() {
4
4
  "use strict";
5
- return "const float czm_infinity = 5906376272000.0;\n\
5
+ return "/**\n\
6
+ * DOC_TBA\n\
7
+ *\n\
8
+ * @name czm_infinity\n\
9
+ * @glslConstant \n\
10
+ */\n\
11
+ const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?\n\
12
+ \n\
13
+ /**\n\
14
+ * DOC_TBA\n\
15
+ *\n\
16
+ * @name czm_epsilon1\n\
17
+ * @glslConstant \n\
18
+ */\n\
6
19
  const float czm_epsilon1 = 0.1;\n\
20
+ \n\
21
+ /**\n\
22
+ * DOC_TBA\n\
23
+ *\n\
24
+ * @name czm_epsilon2\n\
25
+ * @glslConstant \n\
26
+ */\n\
7
27
  const float czm_epsilon2 = 0.01;\n\
28
+ \n\
29
+ /**\n\
30
+ * DOC_TBA\n\
31
+ *\n\
32
+ * @name czm_epsilon3\n\
33
+ * @glslConstant \n\
34
+ */\n\
8
35
  const float czm_epsilon3 = 0.001;\n\
36
+ \n\
37
+ /**\n\
38
+ * DOC_TBA\n\
39
+ *\n\
40
+ * @name czm_epsilon4\n\
41
+ * @glslConstant \n\
42
+ */\n\
9
43
  const float czm_epsilon4 = 0.0001;\n\
44
+ \n\
45
+ /**\n\
46
+ * DOC_TBA\n\
47
+ *\n\
48
+ * @name czm_epsilon5\n\
49
+ * @glslConstant \n\
50
+ */\n\
10
51
  const float czm_epsilon5 = 0.00001;\n\
52
+ \n\
53
+ /**\n\
54
+ * DOC_TBA\n\
55
+ *\n\
56
+ * @name czm_epsilon6\n\
57
+ * @glslConstant \n\
58
+ */\n\
11
59
  const float czm_epsilon6 = 0.000001;\n\
60
+ \n\
61
+ /**\n\
62
+ * DOC_TBA\n\
63
+ *\n\
64
+ * @name czm_epsilon7\n\
65
+ * @glslConstant \n\
66
+ */\n\
12
67
  const float czm_epsilon7 = 0.0000001;\n\
68
+ \n\
69
+ /**\n\
70
+ * DOC_TBA\n\
71
+ *\n\
72
+ * @name czm_equalsEpsilon\n\
73
+ * @glslFunction\n\
74
+ */\n\
13
75
  bool czm_equalsEpsilon(float left, float right, float epsilon) {\n\
14
- return (abs(left - right) <= epsilon);\n\
76
+ return (abs(left - right) <= epsilon);\n\
15
77
  }\n\
78
+ \n\
16
79
  bool czm_equalsEpsilon(float left, float right) {\n\
17
- return (abs(left - right) <= czm_epsilon7);\n\
18
- }\n\
80
+ // Workaround bug in Opera Next 12. Do not delegate to the other czm_equalsEpsilon.\n\
81
+ return (abs(left - right) <= czm_epsilon7);\n\
82
+ }\n\
83
+ \n\
84
+ ///////////////////////////////////////////////////////////////////////////////\n\
85
+ \n\
86
+ /**\n\
87
+ * Returns the transpose of the matrix. The input <code>matrix</code> can be \n\
88
+ * a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.\n\
89
+ *\n\
90
+ * @name czm_transpose\n\
91
+ * @glslFunction\n\
92
+ *\n\
93
+ * @param {} matrix The matrix to transpose.\n\
94
+ *\n\
95
+ * @returns {} The transposed matrix.\n\
96
+ *\n\
97
+ * @example\n\
98
+ * // GLSL declarations\n\
99
+ * mat2 czm_transpose(mat2 matrix);\n\
100
+ * mat3 czm_transpose(mat3 matrix);\n\
101
+ * mat4 czm_transpose(mat4 matrix);\n\
102
+ *\n\
103
+ * // Tranpose a 3x3 rotation matrix to find its inverse.\n\
104
+ * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(\n\
105
+ * positionMC, normalEC);\n\
106
+ * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);\n\
107
+ */\n\
19
108
  mat2 czm_transpose(mat2 matrix)\n\
20
109
  {\n\
21
- return mat2(\n\
22
- matrix[0][0], matrix[1][0],\n\
23
- matrix[0][1], matrix[1][1]);\n\
110
+ return mat2(\n\
111
+ matrix[0][0], matrix[1][0],\n\
112
+ matrix[0][1], matrix[1][1]);\n\
24
113
  }\n\
114
+ \n\
25
115
  mat3 czm_transpose(mat3 matrix)\n\
26
116
  {\n\
27
- return mat3(\n\
28
- matrix[0][0], matrix[1][0], matrix[2][0],\n\
29
- matrix[0][1], matrix[1][1], matrix[2][1],\n\
30
- matrix[0][2], matrix[1][2], matrix[2][2]);\n\
117
+ return mat3(\n\
118
+ matrix[0][0], matrix[1][0], matrix[2][0],\n\
119
+ matrix[0][1], matrix[1][1], matrix[2][1],\n\
120
+ matrix[0][2], matrix[1][2], matrix[2][2]);\n\
31
121
  }\n\
122
+ \n\
32
123
  mat4 czm_transpose(mat4 matrix)\n\
33
124
  {\n\
34
- return mat4(\n\
35
- matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\n\
36
- matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\n\
37
- matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\n\
38
- matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n\
39
- }\n\
125
+ return mat4(\n\
126
+ matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\n\
127
+ matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\n\
128
+ matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\n\
129
+ matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n\
130
+ }\n\
131
+ \n\
132
+ ///////////////////////////////////////////////////////////////////////////////\n\
133
+ \n\
134
+ /**\n\
135
+ * Transforms a position from model to window coordinates. The transformation\n\
136
+ * from model to clip coordinates is done using {@link czm_modelViewProjection}.\n\
137
+ * The transform from normalized device coordinates to window coordinates is\n\
138
+ * done using {@link czm_viewportTransformation}, which assumes a depth range\n\
139
+ * of <code>near = 0</code> and <code>far = 1</code>.\n\
140
+ * <br /><br />\n\
141
+ * This transform is useful when there is a need to manipulate window coordinates\n\
142
+ * in a vertex shader as done by {@link BillboardCollection}.\n\
143
+ * <br /><br />\n\
144
+ * This function should not be confused with {@link czm_viewportOrthographic},\n\
145
+ * which is an orthographic projection matrix that transforms from window \n\
146
+ * coordinates to clip coordinates.\n\
147
+ *\n\
148
+ * @name czm_modelToWindowCoordinates\n\
149
+ * @glslFunction\n\
150
+ *\n\
151
+ * @param {vec4} position The position in model coordinates to transform.\n\
152
+ *\n\
153
+ * @returns {vec4} The transformed position in window coordinates.\n\
154
+ *\n\
155
+ * @see czm_eyeToWindowCoordinates\n\
156
+ * @see czm_modelViewProjection\n\
157
+ * @see czm_viewportTransformation\n\
158
+ * @see czm_viewportOrthographic\n\
159
+ * @see BillboardCollection\n\
160
+ *\n\
161
+ * @example\n\
162
+ * vec4 positionWC = czm_modelToWindowCoordinates(positionMC);\n\
163
+ */\n\
40
164
  vec4 czm_modelToWindowCoordinates(vec4 position)\n\
41
165
  {\n\
42
- vec4 q = czm_modelViewProjection * position;\n\
43
- q.xyz /= q.w;\n\
44
- q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\n\
45
- return q;\n\
46
- }\n\
166
+ vec4 q = czm_modelViewProjection * position; // clip coordinates\n\
167
+ q.xyz /= q.w; // normalized device coordinates\n\
168
+ q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\
169
+ return q;\n\
170
+ }\n\
171
+ \n\
172
+ /**\n\
173
+ * Transforms a position from eye to window coordinates. The transformation\n\
174
+ * from eye to clip coordinates is done using {@link czm_projection}.\n\
175
+ * The transform from normalized device coordinates to window coordinates is\n\
176
+ * done using {@link czm_viewportTransformation}, which assumes a depth range\n\
177
+ * of <code>near = 0</code> and <code>far = 1</code>.\n\
178
+ * <br /><br />\n\
179
+ * This transform is useful when there is a need to manipulate window coordinates\n\
180
+ * in a vertex shader as done by {@link BillboardCollection}.\n\
181
+ *\n\
182
+ * @name czm_eyeToWindowCoordinates\n\
183
+ * @glslFunction\n\
184
+ *\n\
185
+ * @param {vec4} position The position in eye coordinates to transform.\n\
186
+ *\n\
187
+ * @returns {vec4} The transformed position in window coordinates.\n\
188
+ *\n\
189
+ * @see czm_modelToWindowCoordinates\n\
190
+ * @see czm_projection\n\
191
+ * @see czm_viewportTransformation\n\
192
+ * @see BillboardCollection\n\
193
+ *\n\
194
+ * @example\n\
195
+ * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\
196
+ */\n\
47
197
  vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n\
48
198
  {\n\
49
- vec4 q = czm_projection * positionEC;\n\
50
- q.xyz /= q.w;\n\
51
- q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\n\
52
- return q;\n\
53
- }\n\
199
+ vec4 q = czm_projection * positionEC; // clip coordinates\n\
200
+ q.xyz /= q.w; // normalized device coordinates\n\
201
+ q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\
202
+ return q;\n\
203
+ }\n\
204
+ \n\
205
+ /**\n\
206
+ * Transforms a position from window to eye coordinates.\n\
207
+ * The transform from window to normalized device coordinates is done using components\n\
208
+ * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n\
209
+ * the inverse of <code>czm_viewportTransformation</code>. The transformation from \n\
210
+ * normalized device coordinates to clip coordinates is done using <code>positionWC.w</code>,\n\
211
+ * which is expected to be the scalar used in the perspective divide. The transformation\n\
212
+ * from clip to eye coordinates is done using {@link czm_inverseProjection}.\n\
213
+ *\n\
214
+ * @name czm_windowToEyeCoordinates\n\
215
+ * @glslFunction\n\
216
+ *\n\
217
+ * @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n\
218
+ *\n\
219
+ * @returns {vec4} The transformed position in eye coordinates.\n\
220
+ *\n\
221
+ * @see czm_modelToWindowCoordinates\n\
222
+ * @see czm_eyeToWindowCoordinates\n\
223
+ * @see czm_inverseProjection\n\
224
+ * @see czm_viewport\n\
225
+ * @see czm_viewportTransformation\n\
226
+ *\n\
227
+ * @example\n\
228
+ * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n\
229
+ */\n\
54
230
  vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\
55
231
  {\n\
56
- float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\n\
57
- float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\n\
58
- float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\
59
- vec4 q = vec4(x, y, z, 1.0);\n\
60
- q /= fragmentCoordinate.w;\n\
61
- q = czm_inverseProjection * q;\n\
62
- return q;\n\
63
- }\n\
232
+ float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\n\
233
+ float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\n\
234
+ float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\
235
+ vec4 q = vec4(x, y, z, 1.0);\n\
236
+ q /= fragmentCoordinate.w;\n\
237
+ q = czm_inverseProjection * q;\n\
238
+ return q;\n\
239
+ }\n\
240
+ \n\
241
+ ///////////////////////////////////////////////////////////////////////////////\n\
242
+ \n\
243
+ /**\n\
244
+ * DOC_TBA\n\
245
+ *\n\
246
+ * @name czm_eyeOffset\n\
247
+ * @glslFunction\n\
248
+ *\n\
249
+ * @param {vec4} positionEC DOC_TBA.\n\
250
+ * @param {vec3} eyeOffset DOC_TBA.\n\
251
+ *\n\
252
+ * @returns {vec4} DOC_TBA.\n\
253
+ */\n\
64
254
  vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n\
65
255
  {\n\
66
- vec4 p = positionEC;\n\
67
- vec4 zEyeOffset = normalize(p) * eyeOffset.z;\n\
68
- p.xy += eyeOffset.xy + zEyeOffset.xy;\n\
69
- p.z += zEyeOffset.z;\n\
70
- return p;\n\
71
- }\n\
256
+ // This equation is approximate in x and y.\n\
257
+ vec4 p = positionEC;\n\
258
+ vec4 zEyeOffset = normalize(p) * eyeOffset.z;\n\
259
+ p.xy += eyeOffset.xy + zEyeOffset.xy;\n\
260
+ p.z += zEyeOffset.z;\n\
261
+ return p;\n\
262
+ }\n\
263
+ \n\
264
+ ///////////////////////////////////////////////////////////////////////////////\n\
265
+ \n\
266
+ /**\n\
267
+ * DOC_TBA\n\
268
+ *\n\
269
+ * @name czm_geodeticSurfaceNormal\n\
270
+ * @glslFunction\n\
271
+ *\n\
272
+ * @param {vec3} positionOnEllipsoid DOC_TBA\n\
273
+ * @param {vec3} ellipsoidCenter DOC_TBA\n\
274
+ * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA\n\
275
+ * \n\
276
+ * @returns {vec3} DOC_TBA.\n\
277
+ */\n\
72
278
  vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n\
73
279
  {\n\
74
- return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n\
280
+ return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n\
75
281
  }\n\
282
+ \n\
283
+ /**\n\
284
+ * DOC_TBA\n\
285
+ *\n\
286
+ * @name czm_ellipsoidWgs84TextureCoordinates\n\
287
+ * @glslFunction\n\
288
+ */\n\
76
289
  vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n\
77
290
  {\n\
78
- return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n\
79
- }\n\
291
+ return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n\
292
+ }\n\
293
+ \n\
294
+ /**\n\
295
+ * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system \n\
296
+ * to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the \n\
297
+ * surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.\n\
298
+ * <br /><br />\n\
299
+ * The ellipsoid is assumed to be centered at the model coordinate's origin.\n\
300
+ *\n\
301
+ * @name czm_eastNorthUpToEyeCoordinates\n\
302
+ * @glslFunction\n\
303
+ *\n\
304
+ * @param {vec3} positionMC The position on the ellipsoid in model coordinates.\n\
305
+ * @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.\n\
306
+ *\n\
307
+ * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.\n\
308
+ *\n\
309
+ * @example\n\
310
+ * // Transform a vector defined in the east-north-up coordinate \n\
311
+ * // system, (0, 0, 1) which is the surface normal, to eye \n\
312
+ * // coordinates.\n\
313
+ * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n\
314
+ * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);\n\
315
+ */\n\
80
316
  mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n\
81
317
  {\n\
82
- vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\n\
83
- vec3 tangentEC = normalize(czm_normal * tangentMC);\n\
84
- vec3 bitangentEC = normalize(cross(normalEC, tangentEC));\n\
85
- return mat3(\n\
86
- tangentEC.x, tangentEC.y, tangentEC.z,\n\
87
- bitangentEC.x, bitangentEC.y, bitangentEC.z,\n\
88
- normalEC.x, normalEC.y, normalEC.z);\n\
89
- }\n\
318
+ vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates\n\
319
+ vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordiantes\n\
320
+ vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates\n\
321
+ \n\
322
+ return mat3(\n\
323
+ tangentEC.x, tangentEC.y, tangentEC.z,\n\
324
+ bitangentEC.x, bitangentEC.y, bitangentEC.z,\n\
325
+ normalEC.x, normalEC.y, normalEC.z);\n\
326
+ }\n\
327
+ \n\
328
+ ///////////////////////////////////////////////////////////////////////////////\n\
329
+ \n\
330
+ /**\n\
331
+ * Used as input to every material's czm_getMaterial function. \n\
332
+ *\n\
333
+ * @name czm_materialInput\n\
334
+ * @glslStruct\n\
335
+ *\n\
336
+ * @property {float} s 1D texture coordinates.\n\
337
+ * @property {vec2} st 2D texture coordinates.\n\
338
+ * @property {vec3} str 3D texture coordinates.\n\
339
+ * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.\n\
340
+ * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.\n\
341
+ * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.\n\
342
+ * @property {vec3} positionMC Position in model coordinates.\n\
343
+ */\n\
90
344
  struct czm_materialInput\n\
91
345
  {\n\
92
- float s;\n\
93
- vec2 st;\n\
94
- vec3 str;\n\
95
- vec3 normalEC;\n\
96
- mat3 tangentToEyeMatrix;\n\
97
- vec3 positionToEyeEC;\n\
98
- vec3 positionMC;\n\
346
+ float s;\n\
347
+ vec2 st;\n\
348
+ vec3 str;\n\
349
+ vec3 normalEC;\n\
350
+ mat3 tangentToEyeMatrix;\n\
351
+ vec3 positionToEyeEC;\n\
352
+ vec3 positionMC;\n\
99
353
  };\n\
354
+ \n\
355
+ /**\n\
356
+ * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.\n\
357
+ *\n\
358
+ * @name czm_material\n\
359
+ * @glslStruct\n\
360
+ *\n\
361
+ * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n\
362
+ * @property {float} specular Intensity of incoming light reflecting in a single direction.\n\
363
+ * @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n\
364
+ * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n\
365
+ * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n\
366
+ * @property {float} alpha Opacity of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n\
367
+ */\n\
100
368
  struct czm_material\n\
101
369
  {\n\
102
- vec3 diffuse;\n\
103
- float specular;\n\
104
- float shininess;\n\
105
- vec3 normal;\n\
106
- vec3 emission;\n\
107
- float alpha;\n\
370
+ vec3 diffuse;\n\
371
+ float specular;\n\
372
+ float shininess;\n\
373
+ vec3 normal;\n\
374
+ vec3 emission;\n\
375
+ float alpha;\n\
108
376
  };\n\
377
+ \n\
378
+ /**\n\
379
+ * An czm_material with default values. Every material's czm_getMaterial\n\
380
+ * should use this default material as a base for the material it returns.\n\
381
+ * The default normal value is given by materialInput.normalEC.\n\
382
+ *\n\
383
+ * @name czm_getDefaultMaterial\n\
384
+ * @glslFunction \n\
385
+ *\n\
386
+ * @param {czm_materialInput} input The input used to construct the default material.\n\
387
+ * \n\
388
+ * @returns {czm_material} The default material.\n\
389
+ *\n\
390
+ * @see czm_materialInput\n\
391
+ * @see czm_material\n\
392
+ * @see czm_getMaterial\n\
393
+ */\n\
109
394
  czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n\
110
395
  {\n\
111
- czm_material material;\n\
112
- material.diffuse = vec3(0.0);\n\
113
- material.specular = 0.0;\n\
114
- material.shininess = 1.0;\n\
115
- material.normal = materialInput.normalEC;\n\
116
- material.emission = vec3(0.0);\n\
117
- material.alpha = 1.0;\n\
118
- return material;\n\
119
- }\n\
120
- float getLambertDiffuse(vec3 lightDirection, czm_material material)\n\
121
- {\n\
122
- return max(dot(lightDirection, material.normal), 0.0);\n\
123
- }\n\
124
- float getSpecular(vec3 lightDirection, vec3 toEye, czm_material material)\n\
125
- {\n\
126
- vec3 toReflectedLight = reflect(-lightDirection, material.normal);\n\
127
- float specular = max(dot(toReflectedLight, toEye), 0.0);\n\
128
- return pow(specular, material.shininess);\n\
129
- }\n\
396
+ czm_material material;\n\
397
+ material.diffuse = vec3(0.0);\n\
398
+ material.specular = 0.0;\n\
399
+ material.shininess = 1.0;\n\
400
+ material.normal = materialInput.normalEC;\n\
401
+ material.emission = vec3(0.0);\n\
402
+ material.alpha = 1.0;\n\
403
+ return material;\n\
404
+ }\n\
405
+ \n\
406
+ float getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n\
407
+ {\n\
408
+ return max(dot(lightDirectionEC, normalEC), 0.0);\n\
409
+ }\n\
410
+ \n\
411
+ float getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n\
412
+ {\n\
413
+ return getLambertDiffuse(lightDirectionEC, material.normal);\n\
414
+ }\n\
415
+ \n\
416
+ float getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n\
417
+ {\n\
418
+ vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\n\
419
+ float specular = max(dot(toReflectedLight, toEyeEC), 0.0);\n\
420
+ return pow(specular, shininess);\n\
421
+ }\n\
422
+ \n\
423
+ float getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n\
424
+ {\n\
425
+ return getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n\
426
+ }\n\
427
+ \n\
428
+ /**\n\
429
+ * Computes a color using the Phong lighting model.\n\
430
+ *\n\
431
+ * @name czm_phong\n\
432
+ * @glslFunction\n\
433
+ *\n\
434
+ * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.\n\
435
+ * @param {czm_material} material The fragment's material.\n\
436
+ * \n\
437
+ * @returns {vec4} The computed color.\n\
438
+ * \n\
439
+ * @example\n\
440
+ * vec3 positionToEyeEC = // ...\n\
441
+ * czm_material material = // ...\n\
442
+ * gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\
443
+ *\n\
444
+ * @see czm_getMaterial\n\
445
+ */\n\
130
446
  vec4 czm_phong(vec3 toEye, czm_material material)\n\
131
447
  {\n\
132
- float diffuse = getLambertDiffuse(vec3(0.0, 0.0, 1.0), material) + getLambertDiffuse(vec3(0.0, 1.0, 0.0), material);\n\
133
- float specular = getSpecular(czm_sunDirectionEC, toEye, material) + getSpecular(czm_moonDirectionEC, toEye, material);\n\
134
- vec3 ambient = vec3(0.0);\n\
135
- vec3 color = ambient + material.emission;\n\
136
- color += material.diffuse * diffuse;\n\
137
- color += material.specular * specular;\n\
138
- return vec4(color, material.alpha);\n\
139
- }\n\
448
+ // Diffuse from directional light sources at eye (for top-down and horizon views)\n\
449
+ float diffuse = getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material) + getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n\
450
+ \n\
451
+ // Specular from sun and pseudo-moon\n\
452
+ float specular = getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + getSpecularOfMaterial(czm_moonDirectionEC, toEye, material);\n\
453
+ \n\
454
+ vec3 ambient = vec3(0.0);\n\
455
+ vec3 color = ambient + material.emission;\n\
456
+ color += material.diffuse * diffuse;\n\
457
+ color += material.specular * specular;\n\
458
+ \n\
459
+ return vec4(color, material.alpha);\n\
460
+ }\n\
461
+ \n\
462
+ /**\n\
463
+ * Computes the luminance of a color. \n\
464
+ *\n\
465
+ * @name czm_luminance\n\
466
+ * @glslFunction\n\
467
+ *\n\
468
+ * @param {vec3} rgb The color.\n\
469
+ * \n\
470
+ * @returns {float} The luminance.\n\
471
+ *\n\
472
+ * @example\n\
473
+ * float light = czm_luminance(vec3(0.0)); // 0.0\n\
474
+ * float dark = czm_luminance(vec3(1.0)); // ~1.0 \n\
475
+ */\n\
140
476
  float czm_luminance(vec3 rgb)\n\
141
477
  {\n\
142
- const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\
143
- return dot(rgb, W);\n\
144
- }\n\
478
+ // Algorithm from Chapter 10 of Graphics Shaders.\n\
479
+ const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\
480
+ return dot(rgb, W);\n\
481
+ }\n\
482
+ \n\
483
+ /**\n\
484
+ * Adjusts the hue of a color.\n\
485
+ * \n\
486
+ * @name czm_hue\n\
487
+ * @glslFunction\n\
488
+ * \n\
489
+ * @param {vec3} rgb The color.\n\
490
+ * @param {float} adjustment The amount to adjust the hue of the color in radians.\n\
491
+ *\n\
492
+ * @returns {float} The color with the hue adjusted.\n\
493
+ *\n\
494
+ * @example\n\
495
+ * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)\n\
496
+ */\n\
145
497
  vec3 czm_hue(vec3 rgb, float adjustment)\n\
146
498
  {\n\
147
- const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n\
148
- 0.595716, -0.274453, -0.321263,\n\
149
- 0.211456, -0.522591, 0.311135);\n\
150
- const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n\
151
- 1.0, -0.2721, -0.6474,\n\
152
- 1.0, -1.107, 1.7046);\n\
153
- vec3 yiq = toYIQ * rgb;\n\
154
- float hue = atan(yiq.z, yiq.y) + adjustment;\n\
155
- float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n\
156
- vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n\
157
- return toRGB * color;\n\
158
- }\n\
499
+ const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n\
500
+ 0.595716, -0.274453, -0.321263,\n\
501
+ 0.211456, -0.522591, 0.311135);\n\
502
+ const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n\
503
+ 1.0, -0.2721, -0.6474,\n\
504
+ 1.0, -1.107, 1.7046);\n\
505
+ \n\
506
+ vec3 yiq = toYIQ * rgb;\n\
507
+ float hue = atan(yiq.z, yiq.y) + adjustment;\n\
508
+ float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n\
509
+ \n\
510
+ vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n\
511
+ return toRGB * color;\n\
512
+ }\n\
513
+ \n\
514
+ /**\n\
515
+ * Adjusts the saturation of a color.\n\
516
+ * \n\
517
+ * @name czm_saturation\n\
518
+ * @glslFunction\n\
519
+ * \n\
520
+ * @param {vec3} rgb The color.\n\
521
+ * @param {float} adjustment The amount to adjust the saturation of the color.\n\
522
+ *\n\
523
+ * @returns {float} The color with the saturation adjusted.\n\
524
+ *\n\
525
+ * @example\n\
526
+ * vec3 greyScale = czm_saturation(color, 0.0);\n\
527
+ * vec3 doubleSaturation = czm_saturation(color, 2.0);\n\
528
+ */\n\
159
529
  vec3 czm_saturation(vec3 rgb, float adjustment)\n\
160
530
  {\n\
161
- vec3 intensity = vec3(czm_luminance(rgb));\n\
162
- return mix(intensity, rgb, adjustment);\n\
163
- }\n\
531
+ // Algorithm from Chapter 16 of OpenGL Shading Language\n\
532
+ vec3 intensity = vec3(czm_luminance(rgb));\n\
533
+ return mix(intensity, rgb, adjustment);\n\
534
+ }\n\
535
+ \n\
536
+ /**\n\
537
+ * DOC_TBA\n\
538
+ *\n\
539
+ * @name czm_multiplyWithColorBalance\n\
540
+ * @glslFunction\n\
541
+ */\n\
164
542
  vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n\
165
543
  {\n\
166
- const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\
167
- vec3 target = left * right;\n\
168
- float leftLuminance = dot(left, W);\n\
169
- float rightLuminance = dot(right, W);\n\
170
- float targetLuminance = dot(target, W);\n\
171
- return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n\
172
- }\n\
544
+ // Algorithm from Chapter 10 of Graphics Shaders.\n\
545
+ const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\
546
+ \n\
547
+ vec3 target = left * right;\n\
548
+ float leftLuminance = dot(left, W);\n\
549
+ float rightLuminance = dot(right, W);\n\
550
+ float targetLuminance = dot(target, W);\n\
551
+ \n\
552
+ return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n\
553
+ }\n\
554
+ \n\
555
+ ///////////////////////////////////////////////////////////////////////////////\n\
556
+ \n\
557
+ /**\n\
558
+ * The maximum latitude, in radians, both North and South, supported by a Web Mercator\n\
559
+ * (EPSG:3857) projection. Technically, the Mercator projection is defined\n\
560
+ * for any latitude up to (but not including) 90 degrees, but it makes sense\n\
561
+ * to cut it off sooner because it grows exponentially with increasing latitude.\n\
562
+ * The logic behind this particular cutoff value, which is the one used by\n\
563
+ * Google Maps, Bing Maps, and Esri, is that it makes the projection\n\
564
+ * square. That is, the extent is equal in the X and Y directions.\n\
565
+ *\n\
566
+ * The constant value is computed as follows:\n\
567
+ * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))\n\
568
+ *\n\
569
+ * @name czm_webMercatorMaxLatitude\n\
570
+ * @glslConstant\n\
571
+ */\n\
173
572
  const float czm_webMercatorMaxLatitude = 1.4844222297453323669610967939;\n\
573
+ \n\
574
+ /**\n\
575
+ * Specifies a flat, 2D map.\n\
576
+ *\n\
577
+ * @name czm_scene2D\n\
578
+ * @glslConstant \n\
579
+ */\n\
174
580
  const int czm_scene2D = 0;\n\
581
+ \n\
582
+ /**\n\
583
+ * Specifies 2.D Columbus View.\n\
584
+ *\n\
585
+ * @name czm_columbusView\n\
586
+ * @glslConstant \n\
587
+ */\n\
175
588
  const int czm_columbusView = 1;\n\
589
+ \n\
590
+ /**\n\
591
+ * Specifies a 3D globe.\n\
592
+ *\n\
593
+ * @name czm_scene3D\n\
594
+ * @glslConstant \n\
595
+ */\n\
176
596
  const int czm_scene3D = 2;\n\
597
+ \n\
598
+ /**\n\
599
+ * Specifies that the scene is morphing between modes.\n\
600
+ * \n\
601
+ * @name czm_morphing\n\
602
+ * @glslConstant\n\
603
+ */\n\
177
604
  const int czm_morphing = 3;\n\
605
+ \n\
606
+ /**\n\
607
+ * DOC_TBA\n\
608
+ *\n\
609
+ * @name czm_columbusViewMorph\n\
610
+ * @glslFunction\n\
611
+ */\n\
178
612
  vec4 czm_columbusViewMorph(vec3 position2D, vec3 position3D, float time)\n\
179
613
  {\n\
180
- vec3 p = mix(position2D, position3D, time);\n\
181
- return vec4(p, 1.0);\n\
182
- }\n\
614
+ // Just linear for now.\n\
615
+ vec3 p = mix(position2D, position3D, time);\n\
616
+ return vec4(p, 1.0);\n\
617
+ } \n\
618
+ \n\
619
+ ///////////////////////////////////////////////////////////////////////////////\n\
620
+ \n\
621
+ /**\n\
622
+ * DOC_TBA\n\
623
+ *\n\
624
+ * @name czm_ray\n\
625
+ * @glslStruct\n\
626
+ */\n\
183
627
  struct czm_ray\n\
184
628
  {\n\
185
- vec3 origin;\n\
186
- vec3 direction;\n\
629
+ vec3 origin;\n\
630
+ vec3 direction;\n\
187
631
  };\n\
632
+ \n\
633
+ /**\n\
634
+ * Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.\n\
635
+ *\n\
636
+ * @name czm_pointAlongRay\n\
637
+ * @glslFunction\n\
638
+ *\n\
639
+ * @param {czm_ray} ray The ray to compute the point along.\n\
640
+ * @param {float} time The time along the ray.\n\
641
+ * \n\
642
+ * @returns {vec3} The point along the ray at the given time.\n\
643
+ * \n\
644
+ * @example\n\
645
+ * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction\n\
646
+ * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)\n\
647
+ */\n\
188
648
  vec3 czm_pointAlongRay(czm_ray ray, float time)\n\
189
649
  {\n\
190
- return ray.origin + (time * ray.direction);\n\
191
- }\n\
650
+ return ray.origin + (time * ray.direction);\n\
651
+ }\n\
652
+ \n\
653
+ ///////////////////////////////////////////////////////////////////////////////\n\
654
+ \n\
655
+ /**\n\
656
+ * DOC_TBA\n\
657
+ *\n\
658
+ * @name czm_raySegment\n\
659
+ * @glslStruct\n\
660
+ */\n\
192
661
  struct czm_raySegment\n\
193
662
  {\n\
194
- float start;\n\
195
- float stop;\n\
663
+ float start;\n\
664
+ float stop;\n\
196
665
  };\n\
666
+ \n\
667
+ /**\n\
668
+ * DOC_TBA\n\
669
+ *\n\
670
+ * @name czm_emptyRaySegment\n\
671
+ * @glslConstant \n\
672
+ */\n\
197
673
  const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\n\
674
+ \n\
675
+ /**\n\
676
+ * DOC_TBA\n\
677
+ *\n\
678
+ * @name czm_fullRaySegment\n\
679
+ * @glslConstant \n\
680
+ */\n\
198
681
  const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n\
682
+ \n\
683
+ /**\n\
684
+ * Determines if a time interval is empty.\n\
685
+ *\n\
686
+ * @name czm_isEmpty\n\
687
+ * @glslFunction \n\
688
+ * \n\
689
+ * @param {czm_raySegment} interval The interval to test.\n\
690
+ * \n\
691
+ * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.\n\
692
+ *\n\
693
+ * @example\n\
694
+ * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n\
695
+ * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n\
696
+ * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n\
697
+ */\n\
199
698
  bool czm_isEmpty(czm_raySegment interval)\n\
200
699
  {\n\
201
- return (interval.stop < 0.0);\n\
202
- }\n\
700
+ return (interval.stop < 0.0);\n\
701
+ }\n\
702
+ \n\
703
+ /**\n\
704
+ * Determines if a time interval is empty.\n\
705
+ *\n\
706
+ * @name czm_isFull\n\
707
+ * @glslFunction \n\
708
+ * \n\
709
+ * @param {czm_raySegment} interval The interval to test.\n\
710
+ * \n\
711
+ * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.\n\
712
+ *\n\
713
+ * @example\n\
714
+ * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n\
715
+ * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n\
716
+ * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n\
717
+ */\n\
203
718
  bool czm_isFull(czm_raySegment interval)\n\
204
719
  {\n\
205
- return (interval.start == 0.0 && interval.stop == czm_infinity);\n\
206
- }\n\
720
+ return (interval.start == 0.0 && interval.stop == czm_infinity);\n\
721
+ }\n\
722
+ \n\
723
+ ///////////////////////////////////////////////////////////////////////////////\n\
724
+ \n\
725
+ /**\n\
726
+ * DOC_TBA\n\
727
+ *\n\
728
+ * @name czm_ellipsoid\n\
729
+ * @glslStruct\n\
730
+ */\n\
207
731
  struct czm_ellipsoid\n\
208
732
  {\n\
209
- vec3 center;\n\
210
- vec3 radii;\n\
211
- vec3 inverseRadii;\n\
212
- vec3 inverseRadiiSquared;\n\
733
+ vec3 center;\n\
734
+ vec3 radii;\n\
735
+ vec3 inverseRadii;\n\
736
+ vec3 inverseRadiiSquared;\n\
213
737
  };\n\
738
+ \n\
739
+ /**\n\
740
+ * DOC_TBA\n\
741
+ *\n\
742
+ * @name czm_ellipsoidNew\n\
743
+ * @glslFunction\n\
744
+ *\n\
745
+ */\n\
214
746
  czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)\n\
215
747
  {\n\
216
- vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\n\
217
- vec3 inverseRadiiSquared = inverseRadii * inverseRadii;\n\
218
- czm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\n\
219
- return temp;\n\
220
- }\n\
748
+ vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\n\
749
+ vec3 inverseRadiiSquared = inverseRadii * inverseRadii;\n\
750
+ czm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\n\
751
+ return temp;\n\
752
+ }\n\
753
+ \n\
754
+ /**\n\
755
+ * DOC_TBA\n\
756
+ *\n\
757
+ * @name czm_ellipsoidContainsPoint\n\
758
+ * @glslFunction\n\
759
+ *\n\
760
+ */\n\
221
761
  bool czm_ellipsoidContainsPoint(czm_ellipsoid ellipsoid, vec3 point)\n\
222
762
  {\n\
223
- vec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\n\
224
- return (dot(scaled, scaled) <= 1.0);\n\
225
- }\n\
763
+ vec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\n\
764
+ return (dot(scaled, scaled) <= 1.0);\n\
765
+ }\n\
766
+ \n\
767
+ /**\n\
768
+ * DOC_TBA\n\
769
+ *\n\
770
+ *\n\
771
+ * @name czm_rayEllipsoidIntersectionInterval\n\
772
+ * @glslFunction\n\
773
+ */\n\
226
774
  czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, czm_ellipsoid ellipsoid)\n\
227
775
  {\n\
228
- vec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\n\
229
- vec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\n\
230
- q = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;\n\
231
- float q2 = dot(q, q);\n\
232
- float qw = dot(q, w);\n\
233
- if (q2 > 1.0)\n\
234
- {\n\
235
- if (qw >= 0.0)\n\
236
- {\n\
237
- return czm_emptyRaySegment;\n\
238
- }\n\
239
- else\n\
240
- {\n\
241
- float qw2 = qw * qw;\n\
242
- float difference = q2 - 1.0;\n\
243
- float w2 = dot(w, w);\n\
244
- float product = w2 * difference;\n\
245
- if (qw2 < product)\n\
246
- {\n\
247
- return czm_emptyRaySegment;\n\
248
- }\n\
249
- else if (qw2 > product)\n\
250
- {\n\
251
- float discriminant = qw * qw - product;\n\
252
- float temp = -qw + sqrt(discriminant);\n\
253
- float root0 = temp / w2;\n\
254
- float root1 = difference / temp;\n\
255
- if (root0 < root1)\n\
256
- {\n\
257
- czm_raySegment i = czm_raySegment(root0, root1);\n\
258
- return i;\n\
259
- }\n\
260
- else\n\
261
- {\n\
262
- czm_raySegment i = czm_raySegment(root1, root0);\n\
263
- return i;\n\
264
- }\n\
265
- }\n\
266
- else\n\
267
- {\n\
268
- float root = sqrt(difference / w2);\n\
269
- czm_raySegment i = czm_raySegment(root, root);\n\
270
- return i;\n\
271
- }\n\
272
- }\n\
273
- }\n\
274
- else if (q2 < 1.0)\n\
275
- {\n\
276
- float difference = q2 - 1.0;\n\
277
- float w2 = dot(w, w);\n\
278
- float product = w2 * difference;\n\
279
- float discriminant = qw * qw - product;\n\
280
- float temp = -qw + sqrt(discriminant);\n\
281
- czm_raySegment i = czm_raySegment(0.0, temp / w2);\n\
282
- return i;\n\
283
- }\n\
284
- else\n\
285
- {\n\
286
- if (qw < 0.0)\n\
287
- {\n\
288
- float w2 = dot(w, w);\n\
289
- czm_raySegment i = czm_raySegment(0.0, -qw / w2);\n\
290
- return i;\n\
291
- }\n\
292
- else\n\
293
- {\n\
294
- return czm_emptyRaySegment;\n\
295
- }\n\
296
- }\n\
297
- }\n\
776
+ // ray and ellipsoid center in eye coordinates. radii in model coordinates.\n\
777
+ vec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\n\
778
+ vec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\n\
779
+ \n\
780
+ q = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;\n\
781
+ \n\
782
+ float q2 = dot(q, q);\n\
783
+ float qw = dot(q, w);\n\
784
+ \n\
785
+ if (q2 > 1.0) // Outside ellipsoid.\n\
786
+ {\n\
787
+ if (qw >= 0.0) // Looking outward or tangent (0 intersections).\n\
788
+ {\n\
789
+ return czm_emptyRaySegment;\n\
790
+ }\n\
791
+ else // qw < 0.0.\n\
792
+ {\n\
793
+ float qw2 = qw * qw;\n\
794
+ float difference = q2 - 1.0; // Positively valued.\n\
795
+ float w2 = dot(w, w);\n\
796
+ float product = w2 * difference;\n\
797
+ \n\
798
+ if (qw2 < product) // Imaginary roots (0 intersections).\n\
799
+ {\n\
800
+ return czm_emptyRaySegment; \n\
801
+ } \n\
802
+ else if (qw2 > product) // Distinct roots (2 intersections).\n\
803
+ {\n\
804
+ float discriminant = qw * qw - product;\n\
805
+ float temp = -qw + sqrt(discriminant); // Avoid cancellation.\n\
806
+ float root0 = temp / w2;\n\
807
+ float root1 = difference / temp;\n\
808
+ if (root0 < root1)\n\
809
+ {\n\
810
+ czm_raySegment i = czm_raySegment(root0, root1);\n\
811
+ return i;\n\
812
+ }\n\
813
+ else\n\
814
+ {\n\
815
+ czm_raySegment i = czm_raySegment(root1, root0);\n\
816
+ return i;\n\
817
+ }\n\
818
+ }\n\
819
+ else // qw2 == product. Repeated roots (2 intersections).\n\
820
+ {\n\
821
+ float root = sqrt(difference / w2);\n\
822
+ czm_raySegment i = czm_raySegment(root, root);\n\
823
+ return i;\n\
824
+ }\n\
825
+ }\n\
826
+ }\n\
827
+ else if (q2 < 1.0) // Inside ellipsoid (2 intersections).\n\
828
+ {\n\
829
+ float difference = q2 - 1.0; // Negatively valued.\n\
830
+ float w2 = dot(w, w);\n\
831
+ float product = w2 * difference; // Negatively valued.\n\
832
+ float discriminant = qw * qw - product;\n\
833
+ float temp = -qw + sqrt(discriminant); // Positively valued.\n\
834
+ czm_raySegment i = czm_raySegment(0.0, temp / w2);\n\
835
+ return i;\n\
836
+ }\n\
837
+ else // q2 == 1.0. On ellipsoid.\n\
838
+ {\n\
839
+ if (qw < 0.0) // Looking inward.\n\
840
+ {\n\
841
+ float w2 = dot(w, w);\n\
842
+ czm_raySegment i = czm_raySegment(0.0, -qw / w2);\n\
843
+ return i;\n\
844
+ }\n\
845
+ else // qw >= 0.0. Looking outward or tangent.\n\
846
+ {\n\
847
+ return czm_emptyRaySegment;\n\
848
+ }\n\
849
+ }\n\
850
+ }\n\
851
+ \n\
852
+ /**\n\
853
+ * Returns the WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.\n\
854
+ *\n\
855
+ * @name czm_getWgs84EllipsoidEC\n\
856
+ * @glslFunction\n\
857
+ *\n\
858
+ * @returns {czm_ellipsoid} The WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.\n\
859
+ *\n\
860
+ * @see Ellipsoid.getWgs84\n\
861
+ *\n\
862
+ * @example\n\
863
+ * czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n\
864
+ */\n\
298
865
  czm_ellipsoid czm_getWgs84EllipsoidEC()\n\
299
866
  {\n\
300
- return czm_ellipsoidNew(\n\
301
- czm_view[3].xyz,\n\
302
- vec3(6378137.0, 6378137.0, 6356752.314245));\n\
303
- }\n\
867
+ return czm_ellipsoidNew(\n\
868
+ czm_view[3].xyz, // center\n\
869
+ vec3(6378137.0, 6378137.0, 6356752.314245)); // radii\n\
870
+ }\n\
871
+ \n\
872
+ /**\n\
873
+ * Computes the fraction of a Web Wercator extent at which a given geodetic latitude is located.\n\
874
+ *\n\
875
+ * @name czm_latitudeToWebMercatorFraction\n\
876
+ * @glslFunction\n\
877
+ *\n\
878
+ * @param {float} The geodetic latitude, in radians.\n\
879
+ * @param {float} The low portion of the Web Mercator coordinate of the southern boundary of the extent.\n\
880
+ * @param {float} The high portion of the Web Mercator coordinate of the southern boundary of the extent.\n\
881
+ * @param {float} The total height of the extent in Web Mercator coordinates.\n\
882
+ *\n\
883
+ * @returns {float} The fraction of the extent at which the latitude occurs. If the latitude is the southern\n\
884
+ * boundary of the extent, the return value will be zero. If it is the northern boundary, the return\n\
885
+ * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.\n\
886
+ */ \n\
304
887
  float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorYLow, float southMercatorYHigh, float oneOverMercatorHeight)\n\
305
888
  {\n\
306
- float sinLatitude = sin(latitude);\n\
307
- float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\n\
308
- float t1 = 0.0 - southMercatorYLow;\n\
309
- float e = t1 - 0.0;\n\
310
- float t2 = ((-southMercatorYLow - e) + (0.0 - (t1 - e))) + mercatorY - southMercatorYHigh;\n\
311
- float highDifference = t1 + t2;\n\
312
- float lowDifference = t2 - (highDifference - t1);\n\
313
- return highDifference * oneOverMercatorHeight + lowDifference * oneOverMercatorHeight;\n\
314
- }\n\
889
+ float sinLatitude = sin(latitude);\n\
890
+ float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\n\
891
+ \n\
892
+ // mercatorY - southMercatorY in simulated double precision.\n\
893
+ float t1 = 0.0 - southMercatorYLow;\n\
894
+ float e = t1 - 0.0;\n\
895
+ float t2 = ((-southMercatorYLow - e) + (0.0 - (t1 - e))) + mercatorY - southMercatorYHigh;\n\
896
+ float highDifference = t1 + t2;\n\
897
+ float lowDifference = t2 - (highDifference - t1);\n\
898
+ \n\
899
+ return highDifference * oneOverMercatorHeight + lowDifference * oneOverMercatorHeight;\n\
900
+ }\n\
901
+ \n\
902
+ /**\n\
903
+ * Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},\n\
904
+ * and then provided to the shader as separate <code>high</code> and <code>low</code> bits to\n\
905
+ * be relative to the eye. As shown in the example, the position can then be transformed in eye\n\
906
+ * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},\n\
907
+ * respectively.\n\
908
+ * <p>\n\
909
+ * This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as\n\
910
+ * described in <a href=\"http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/\">Precisions, Precisions</a>.\n\
911
+ * </p>\n\
912
+ *\n\
913
+ * @name czm_translateRelativeToEye\n\
914
+ * @glslFunction\n\
915
+ *\n\
916
+ * @param {vec3} high The position's high bits.\n\
917
+ * @param {vec3} low The position's low bits.\n\
918
+ * @returns {vec3} The position translated to be relative to the camera's position.\n\
919
+ *\n\
920
+ * @example\n\
921
+ * attribute vec3 positionHigh;\n\
922
+ * attribute vec3 positionLow;\n\
923
+ * \n\
924
+ * void main() \n\
925
+ * {\n\
926
+ * vec3 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\
927
+ * gl_Position = czm_modelViewProjectionRelativeToEye * vec4(p, 1.0);\n\
928
+ * }\n\
929
+ *\n\
930
+ * @see czm_modelViewRelativeToEye\n\
931
+ * @see czm_modelViewProjectionRelativeToEye\n\
932
+ * @see EncodedCartesian3\n\
933
+ */\n\
315
934
  vec3 czm_translateRelativeToEye(vec3 high, vec3 low)\n\
316
935
  {\n\
317
- vec3 highDifference = high - czm_encodedCameraPositionMCHigh;\n\
318
- vec3 lowDifference = low - czm_encodedCameraPositionMCLow;\n\
319
- return highDifference + lowDifference;\n\
936
+ vec3 highDifference = high - czm_encodedCameraPositionMCHigh;\n\
937
+ vec3 lowDifference = low - czm_encodedCameraPositionMCLow;\n\
938
+ \n\
939
+ return highDifference + lowDifference;\n\
940
+ }\n\
941
+ \n\
942
+ /**\n\
943
+ * @private\n\
944
+ */\n\
945
+ vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n\
946
+ {\n\
947
+ float cosAngle = cos(angleInRadians);\n\
948
+ float sinAngle = sin(angleInRadians);\n\
949
+ \n\
950
+ // time dependent sampling directions\n\
951
+ vec2 s0 = vec2(1.0/17.0, 0.0);\n\
952
+ vec2 s1 = vec2(-1.0/29.0, 0.0);\n\
953
+ vec2 s2 = vec2(1.0/101.0, 1.0/59.0);\n\
954
+ vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\n\
955
+ \n\
956
+ // rotate sampling direction by specified angle\n\
957
+ s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\n\
958
+ s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\n\
959
+ s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\n\
960
+ s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\n\
961
+ \n\
962
+ vec2 uv0 = (uv/103.0) + (time * s0);\n\
963
+ vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\n\
964
+ vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\n\
965
+ vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\n\
966
+ \n\
967
+ uv0 = fract(uv0);\n\
968
+ uv1 = fract(uv1);\n\
969
+ uv2 = fract(uv2);\n\
970
+ uv3 = fract(uv3);\n\
971
+ vec4 noise = (texture2D(normalMap, uv0)) +\n\
972
+ (texture2D(normalMap, uv1)) +\n\
973
+ (texture2D(normalMap, uv2)) +\n\
974
+ (texture2D(normalMap, uv3));\n\
975
+ \n\
976
+ // average and scale to between -1 and 1\n\
977
+ return ((noise / 4.0) - 0.5) * 2.0;\n\
320
978
  }\n\
321
979
  ";
322
980
  });