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
@@ -3,18 +3,22 @@
3
3
  define(function() {
4
4
  "use strict";
5
5
  return "attribute vec4 position;\n\
6
+ \n\
6
7
  varying vec3 v_positionEC;\n\
7
8
  varying vec3 v_sensorVertexWC;\n\
8
9
  varying vec3 v_sensorVertexEC;\n\
9
10
  varying vec3 v_sensorAxisEC;\n\
11
+ \n\
10
12
  void main()\n\
11
13
  {\n\
12
- gl_Position = czm_modelViewInfiniteProjection * position;\n\
13
- v_positionEC = (czm_modelView * position).xyz;\n\
14
- vec4 sensorVertexMC = vec4(0.0, 0.0, 0.0, 1.0);\n\
15
- v_sensorVertexWC = (czm_model * sensorVertexMC).xyz;\n\
16
- v_sensorVertexEC = (czm_modelView * sensorVertexMC).xyz;\n\
17
- v_sensorAxisEC = czm_normal * vec3(0.0, 0.0, 1.0);\n\
18
- }\n\
19
- ";
14
+ gl_Position = czm_modelViewInfiniteProjection * position;\n\
15
+ v_positionEC = (czm_modelView * position).xyz;\n\
16
+ \n\
17
+ // These transforms could be done once on the CPU, but there are only five vertices.\n\
18
+ // We could also hand-optimize the zeros out if the compiler doesn't already.\n\
19
+ vec4 sensorVertexMC = vec4(0.0, 0.0, 0.0, 1.0);\n\
20
+ v_sensorVertexWC = (czm_model * sensorVertexMC).xyz;\n\
21
+ v_sensorVertexEC = (czm_modelView * sensorVertexMC).xyz;\n\
22
+ v_sensorAxisEC = czm_normal * vec3(0.0, 0.0, 1.0);\n\
23
+ }";
20
24
  });
@@ -4,583 +4,889 @@ define(function() {
4
4
  "use strict";
5
5
  return "float _czm_addWithCancellationCheck(float left, float right, float tolerance)\n\
6
6
  {\n\
7
- float difference = left + right;\n\
8
- if ((sign(left) != sign(right)) && abs(difference / max(abs(left), abs(right))) < tolerance)\n\
9
- {\n\
10
- return 0.0;\n\
11
- }\n\
12
- else\n\
13
- {\n\
14
- return difference;\n\
15
- }\n\
16
- }\n\
7
+ float difference = left + right;\n\
8
+ if ((sign(left) != sign(right)) && abs(difference / max(abs(left), abs(right))) < tolerance)\n\
9
+ {\n\
10
+ return 0.0;\n\
11
+ }\n\
12
+ else\n\
13
+ {\n\
14
+ return difference;\n\
15
+ }\n\
16
+ }\n\
17
+ \n\
18
+ /**\n\
19
+ * DOC_TBA\n\
20
+ *\n\
21
+ * @name czm_quadraticRoots\n\
22
+ * @glslStruct\n\
23
+ */\n\
17
24
  struct czm_quadraticRoots\n\
18
25
  {\n\
19
- int numberOfRoots;\n\
20
- float root0;\n\
21
- float root1;\n\
26
+ int numberOfRoots;\n\
27
+ float root0;\n\
28
+ float root1;\n\
22
29
  };\n\
30
+ \n\
31
+ /**\n\
32
+ * Computes the real-valued roots of the 2nd order polynomial function of one variable with only real coefficients.\n\
33
+ *\n\
34
+ * @name czm_quadraticRealPolynomialRealRoots\n\
35
+ * @glslFunction\n\
36
+ *\n\
37
+ * @param {float} a The coefficient of the 2nd order monomial.\n\
38
+ * @param {float} b The coefficient of the 1st order monomial.\n\
39
+ * @param {float} c The coefficient of the 0th order monomial.\n\
40
+ * \n\
41
+ * @returns {czm_quadraticRoots} Zero, one, or two real-valued roots.\n\
42
+ * \n\
43
+ * @example\n\
44
+ * czm_quadraticRoots r = czm_quadraticRealPolynomialRealRoots(2.0, -4.0, -6.0); // 2(x + 1)(x - 3)\n\
45
+ * // The result is r.numberOfRoots = 2, r.root0 = -1.0, and r.root1 = 3.0.\n\
46
+ */\n\
23
47
  czm_quadraticRoots czm_quadraticRealPolynomialRealRoots(float a, float b, float c)\n\
24
48
  {\n\
25
- const float tolerance = czm_epsilon7;\n\
26
- if (a == 0.0)\n\
27
- {\n\
28
- if (b == 0.0)\n\
29
- {\n\
30
- czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
31
- return r;\n\
32
- }\n\
33
- else\n\
34
- {\n\
35
- czm_quadraticRoots r = czm_quadraticRoots(1, -c / b, 0.0);\n\
36
- return r;\n\
37
- }\n\
38
- }\n\
39
- else if (b == 0.0)\n\
40
- {\n\
41
- if (c == 0.0)\n\
42
- {\n\
43
- czm_quadraticRoots r = czm_quadraticRoots(2, 0.0, 0.0);\n\
44
- return r;\n\
45
- }\n\
46
- else\n\
47
- {\n\
48
- float cMagnitude = abs(c);\n\
49
- float aMagnitude = abs(a);\n\
50
- if ((cMagnitude < aMagnitude) && (cMagnitude / aMagnitude < tolerance))\n\
51
- {\n\
52
- czm_quadraticRoots r = czm_quadraticRoots(2, 0.0, 0.0);\n\
53
- return r;\n\
54
- }\n\
55
- else if ((cMagnitude > aMagnitude) && (aMagnitude / cMagnitude < tolerance))\n\
56
- {\n\
57
- czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
58
- return r;\n\
59
- }\n\
60
- else\n\
61
- {\n\
62
- float ratio = -c / a;\n\
63
- if (ratio < 0.0)\n\
64
- {\n\
65
- czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
66
- return r;\n\
67
- }\n\
68
- else\n\
69
- {\n\
70
- float root = sqrt(ratio);\n\
71
- czm_quadraticRoots r = czm_quadraticRoots(2, -root, root);\n\
72
- return r;\n\
73
- }\n\
74
- }\n\
75
- }\n\
76
- }\n\
77
- else if (c == 0.0)\n\
78
- {\n\
79
- float ratio = -b / a;\n\
80
- if (ratio < 0.0)\n\
81
- {\n\
82
- czm_quadraticRoots r = czm_quadraticRoots(2, ratio, 0.0);\n\
83
- return r;\n\
84
- }\n\
85
- else\n\
86
- {\n\
87
- czm_quadraticRoots r = czm_quadraticRoots(2, 0.0, ratio);\n\
88
- return r;\n\
89
- }\n\
90
- }\n\
91
- else\n\
92
- {\n\
93
- float b2 = b * b;\n\
94
- float four_ac = 4.0 * a * c;\n\
95
- float radicand = _czm_addWithCancellationCheck(b2, -four_ac, tolerance);\n\
96
- if (radicand < 0.0)\n\
97
- {\n\
98
- czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
99
- return r;\n\
100
- }\n\
101
- else\n\
102
- {\n\
103
- float q = -0.5 * _czm_addWithCancellationCheck(b, sign(b) * sqrt(radicand), tolerance);\n\
104
- if (b > 0.0)\n\
105
- {\n\
106
- czm_quadraticRoots r = czm_quadraticRoots(2, q / a, c / q);\n\
107
- return r;\n\
108
- }\n\
109
- else\n\
110
- {\n\
111
- czm_quadraticRoots r = czm_quadraticRoots(2, c / q, q / a);\n\
112
- return r;\n\
113
- }\n\
114
- }\n\
115
- }\n\
116
- }\n\
49
+ // This function's return statements have an ANGLE workaround: http://code.google.com/p/angleproject/issues/detail?id=185\n\
50
+ \n\
51
+ const float tolerance = czm_epsilon7;\n\
52
+ \n\
53
+ if (a == 0.0)\n\
54
+ {\n\
55
+ if (b == 0.0)\n\
56
+ {\n\
57
+ // Constant function: c = 0. No real polynomial roots possible.\n\
58
+ czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
59
+ return r;\n\
60
+ }\n\
61
+ else\n\
62
+ {\n\
63
+ // Linear function: b * x + c = 0.\n\
64
+ czm_quadraticRoots r = czm_quadraticRoots(1, -c / b, 0.0);\n\
65
+ return r; \n\
66
+ }\n\
67
+ }\n\
68
+ else if (b == 0.0)\n\
69
+ {\n\
70
+ if (c == 0.0)\n\
71
+ {\n\
72
+ // 2nd order monomial: a * x^2 = 0.\n\
73
+ czm_quadraticRoots r = czm_quadraticRoots(2, 0.0, 0.0);\n\
74
+ return r;\n\
75
+ }\n\
76
+ else\n\
77
+ {\n\
78
+ float cMagnitude = abs(c);\n\
79
+ float aMagnitude = abs(a);\n\
80
+ \n\
81
+ if ((cMagnitude < aMagnitude) && (cMagnitude / aMagnitude < tolerance)) // c ~= 0.0.\n\
82
+ {\n\
83
+ // 2nd order monomial: a * x^2 = 0.\n\
84
+ czm_quadraticRoots r = czm_quadraticRoots(2, 0.0, 0.0);\n\
85
+ return r;\n\
86
+ }\n\
87
+ else if ((cMagnitude > aMagnitude) && (aMagnitude / cMagnitude < tolerance)) // a ~= 0.0.\n\
88
+ {\n\
89
+ // Constant function: c = 0.\n\
90
+ czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
91
+ return r;\n\
92
+ }\n\
93
+ else\n\
94
+ {\n\
95
+ // a * x^2 + c = 0\n\
96
+ float ratio = -c / a;\n\
97
+ \n\
98
+ if (ratio < 0.0)\n\
99
+ {\n\
100
+ // Both roots are complex.\n\
101
+ czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
102
+ return r;\n\
103
+ }\n\
104
+ else\n\
105
+ {\n\
106
+ // Both roots are real.\n\
107
+ float root = sqrt(ratio);\n\
108
+ \n\
109
+ // Return them in ascending order.\n\
110
+ czm_quadraticRoots r = czm_quadraticRoots(2, -root, root);\n\
111
+ return r;\n\
112
+ }\n\
113
+ }\n\
114
+ }\n\
115
+ }\n\
116
+ else if (c == 0.0)\n\
117
+ {\n\
118
+ // a * x^2 + b * x = 0\n\
119
+ float ratio = -b / a;\n\
120
+ \n\
121
+ // Return them in ascending order.\n\
122
+ if (ratio < 0.0)\n\
123
+ {\n\
124
+ czm_quadraticRoots r = czm_quadraticRoots(2, ratio, 0.0);\n\
125
+ return r; \n\
126
+ }\n\
127
+ else\n\
128
+ {\n\
129
+ czm_quadraticRoots r = czm_quadraticRoots(2, 0.0, ratio);\n\
130
+ return r;\n\
131
+ }\n\
132
+ }\n\
133
+ else\n\
134
+ {\n\
135
+ // a * x^2 + b * x + c = 0\n\
136
+ float b2 = b * b;\n\
137
+ float four_ac = 4.0 * a * c;\n\
138
+ float radicand = _czm_addWithCancellationCheck(b2, -four_ac, tolerance);\n\
139
+ \n\
140
+ if (radicand < 0.0)\n\
141
+ {\n\
142
+ // Both roots are complex.\n\
143
+ czm_quadraticRoots r = czm_quadraticRoots(0, 0.0, 0.0);\n\
144
+ return r;\n\
145
+ }\n\
146
+ else\n\
147
+ {\n\
148
+ // Both roots are real.\n\
149
+ float q = -0.5 * _czm_addWithCancellationCheck(b, sign(b) * sqrt(radicand), tolerance);\n\
150
+ \n\
151
+ // Return them in ascending order.\n\
152
+ if (b > 0.0)\n\
153
+ {\n\
154
+ // q < 0.0\n\
155
+ czm_quadraticRoots r = czm_quadraticRoots(2, q / a, c / q);\n\
156
+ return r; \n\
157
+ }\n\
158
+ else\n\
159
+ {\n\
160
+ // q > 0.0\n\
161
+ czm_quadraticRoots r = czm_quadraticRoots(2, c / q, q / a);\n\
162
+ return r; \n\
163
+ }\n\
164
+ }\n\
165
+ }\n\
166
+ }\n\
167
+ \n\
168
+ ///////////////////////////////////////////////////////////////////////////////\n\
169
+ \n\
170
+ /**\n\
171
+ * DOC_TBA\n\
172
+ *\n\
173
+ * @name czm_sphere\n\
174
+ * @glslStruct\n\
175
+ */\n\
117
176
  struct czm_sphere\n\
118
177
  {\n\
119
- vec3 center;\n\
120
- float radius;\n\
178
+ vec3 center;\n\
179
+ float radius;\n\
121
180
  };\n\
181
+ \n\
182
+ /**\n\
183
+ * DOC_TBA\n\
184
+ *\n\
185
+ * @name czm_raySphereIntersectionInterval\n\
186
+ * @glslFunction\n\
187
+ *\n\
188
+ * @see czm_sphereNormal\n\
189
+ */\n\
122
190
  czm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, czm_sphere sphere)\n\
123
191
  {\n\
124
- vec3 l = sphere.center - ray.origin;\n\
125
- float s = dot(l, ray.direction);\n\
126
- float l2 = dot(l, l);\n\
127
- float r2 = sphere.radius * sphere.radius;\n\
128
- if ((s < 0.0)\n\
129
- && (l2 > r2))\n\
130
- {\n\
131
- return czm_emptyRaySegment;\n\
132
- }\n\
133
- float s2 = s * s;\n\
134
- float m2 = l2 - s2;\n\
135
- if (m2 > r2)\n\
136
- {\n\
137
- return czm_emptyRaySegment;\n\
138
- }\n\
139
- float q = sqrt(r2 - m2);\n\
140
- if (czm_equalsEpsilon(q, 0.0))\n\
141
- {\n\
142
- return czm_raySegment(s, s);\n\
143
- }\n\
144
- if (l2 > r2)\n\
145
- {\n\
146
- czm_raySegment i = czm_raySegment(s - q, s + q);\n\
147
- return i;\n\
148
- }\n\
149
- else if (l2 < r2)\n\
150
- {\n\
151
- czm_raySegment i = czm_raySegment(0.0, s + q);\n\
152
- return i;\n\
153
- }\n\
154
- else if (s > 0.0)\n\
155
- {\n\
156
- czm_raySegment i = czm_raySegment(0.0, s + q);\n\
157
- return i;\n\
158
- }\n\
159
- else\n\
160
- {\n\
161
- return czm_emptyRaySegment;\n\
162
- }\n\
163
- }\n\
192
+ // From Real-Time Rendering, Section 16.6.2, Optimized Ray/Sphere Intersection Solution, Page 741\n\
193
+ \n\
194
+ // This function's return statements have an ANGLE workaround: http://code.google.com/p/angleproject/issues/detail?id=185\n\
195
+ \n\
196
+ // PERFORMANCE_IDEA: A more optimized but less friendly function could take radius squared directly, \n\
197
+ // assume a center or origin of zero, etc.\n\
198
+ \n\
199
+ vec3 l = sphere.center - ray.origin;\n\
200
+ float s = dot(l, ray.direction);\n\
201
+ float l2 = dot(l, l);\n\
202
+ float r2 = sphere.radius * sphere.radius;\n\
203
+ \n\
204
+ if ((s < 0.0) // Looking away from sphere.\n\
205
+ && (l2 > r2)) // Outside of sphere.\n\
206
+ {\n\
207
+ return czm_emptyRaySegment; // ray does not intersect (at least not along the indicated direction).\n\
208
+ }\n\
209
+ \n\
210
+ float s2 = s * s;\n\
211
+ float m2 = l2 - s2;\n\
212
+ \n\
213
+ if (m2 > r2) // Discriminant is negative, yielding only imaginary roots.\n\
214
+ {\n\
215
+ return czm_emptyRaySegment; // ray does not intersect.\n\
216
+ }\n\
217
+ \n\
218
+ float q = sqrt(r2 - m2);\n\
219
+ \n\
220
+ if (czm_equalsEpsilon(q, 0.0)) // Discriminant is zero, yielding a double root.\n\
221
+ {\n\
222
+ return czm_raySegment(s, s); // ray is tangent.\n\
223
+ }\n\
224
+ \n\
225
+ if (l2 > r2) // Outside of sphere.\n\
226
+ {\n\
227
+ czm_raySegment i = czm_raySegment(s - q, s + q);\n\
228
+ return i;\n\
229
+ }\n\
230
+ else if (l2 < r2) // Inside of sphere.\n\
231
+ {\n\
232
+ czm_raySegment i = czm_raySegment(0.0, s + q);\n\
233
+ return i;\n\
234
+ }\n\
235
+ else if (s > 0.0) // On sphere and looking inward.\n\
236
+ {\n\
237
+ czm_raySegment i = czm_raySegment(0.0, s + q);\n\
238
+ return i;\n\
239
+ }\n\
240
+ else // On sphere and looking outward or tangent.\n\
241
+ {\n\
242
+ return czm_emptyRaySegment;\n\
243
+ }\n\
244
+ }\n\
245
+ \n\
246
+ /**\n\
247
+ * DOC_TBA\n\
248
+ *\n\
249
+ * @name czm_sphereNormal\n\
250
+ * @glslFunction\n\
251
+ *\n\
252
+ * @see czm_raySphereIntersectionInterval \n\
253
+ * @see czm_pointAlongRay\n\
254
+ */\n\
164
255
  vec3 czm_sphereNormal(czm_sphere sphere, vec3 pointOnSphere)\n\
165
256
  {\n\
166
- return normalize(pointOnSphere - sphere.center);\n\
167
- }\n\
257
+ return normalize(pointOnSphere - sphere.center);\n\
258
+ }\n\
259
+ \n\
260
+ ///////////////////////////////////////////////////////////////////////////////\n\
261
+ \n\
262
+ /**\n\
263
+ * DOC_TBA\n\
264
+ *\n\
265
+ * @name czm_cone\n\
266
+ * @glslStruct\n\
267
+ */\n\
168
268
  struct czm_cone\n\
169
269
  {\n\
170
- vec3 vertex;\n\
171
- vec3 axis;\n\
172
- float halfAperture;\n\
173
- float cosineOfHalfAperture;\n\
174
- float cosineSquaredOfHalfAperture;\n\
175
- float sineOfHalfAperture;\n\
176
- float sineSquaredOfHalfAperture;\n\
177
- mat3 intersectionMatrix;\n\
270
+ vec3 vertex;\n\
271
+ vec3 axis; // Unit-length direction vector\n\
272
+ float halfAperture; // Measured from the cone axis to the cone wall\n\
273
+ // PERFORMANCE_IDEA: Make sure all of these are used...\n\
274
+ float cosineOfHalfAperture;\n\
275
+ float cosineSquaredOfHalfAperture;\n\
276
+ float sineOfHalfAperture;\n\
277
+ float sineSquaredOfHalfAperture;\n\
278
+ mat3 intersectionMatrix;\n\
178
279
  };\n\
280
+ \n\
179
281
  czm_cone czm_coneNew(vec3 vertex, vec3 axis, float halfAperture)\n\
180
282
  {\n\
181
- float cosineOfHalfAperture = cos(halfAperture);\n\
182
- float cosineSquaredOfHalfAperture = cosineOfHalfAperture * cosineOfHalfAperture;\n\
183
- float sineOfHalfAperture = sin(halfAperture);\n\
184
- float sineSquaredOfHalfAperture = sineOfHalfAperture * sineOfHalfAperture;\n\
185
- float x2 = axis.x * axis.x;\n\
186
- float y2 = axis.y * axis.y;\n\
187
- float z2 = axis.z * axis.z;\n\
188
- float xy = axis.x * axis.y;\n\
189
- float yz = axis.y * axis.z;\n\
190
- float zx = axis.z * axis.x;\n\
191
- mat3 intersectionMatrix = mat3(\n\
192
- cosineSquaredOfHalfAperture - x2, -xy, -zx,\n\
193
- -xy, cosineSquaredOfHalfAperture - y2, -yz,\n\
194
- -zx, -yz, cosineSquaredOfHalfAperture - z2);\n\
195
- czm_cone temp = czm_cone(vertex, axis, halfAperture,\n\
196
- cosineOfHalfAperture, cosineSquaredOfHalfAperture,\n\
197
- sineOfHalfAperture, sineSquaredOfHalfAperture, intersectionMatrix);\n\
198
- return temp;\n\
199
- }\n\
283
+ float cosineOfHalfAperture = cos(halfAperture);\n\
284
+ float cosineSquaredOfHalfAperture = cosineOfHalfAperture * cosineOfHalfAperture;\n\
285
+ float sineOfHalfAperture = sin(halfAperture);\n\
286
+ float sineSquaredOfHalfAperture = sineOfHalfAperture * sineOfHalfAperture;\n\
287
+ \n\
288
+ float x2 = axis.x * axis.x;\n\
289
+ float y2 = axis.y * axis.y;\n\
290
+ float z2 = axis.z * axis.z;\n\
291
+ float xy = axis.x * axis.y;\n\
292
+ float yz = axis.y * axis.z;\n\
293
+ float zx = axis.z * axis.x;\n\
294
+ \n\
295
+ // This is a symmetric matrix.\n\
296
+ mat3 intersectionMatrix = mat3(\n\
297
+ cosineSquaredOfHalfAperture - x2, -xy, -zx,\n\
298
+ -xy, cosineSquaredOfHalfAperture - y2, -yz,\n\
299
+ -zx, -yz, cosineSquaredOfHalfAperture - z2); \n\
300
+ \n\
301
+ czm_cone temp = czm_cone(vertex, axis, halfAperture,\n\
302
+ cosineOfHalfAperture, cosineSquaredOfHalfAperture,\n\
303
+ sineOfHalfAperture, sineSquaredOfHalfAperture, intersectionMatrix);\n\
304
+ return temp;\n\
305
+ }\n\
306
+ \n\
307
+ /**\n\
308
+ * Determines if a point is in, or on the boundary, of an infinite cone.\n\
309
+ *\n\
310
+ * @name czm_coneContainsPoint\n\
311
+ * @glslFunction\n\
312
+ *\n\
313
+ * @param {czm_cone} cone The infinite cone.\n\
314
+ * @param {vec3} point The point to test for containment.\n\
315
+ *\n\
316
+ * @returns {bool} <code>true</code> if the point is in the infinite cone; otherwise, <code>false</code>.\n\
317
+ *\n\
318
+ * @see czm_rayConeIntersectionInterval\n\
319
+ *\n\
320
+ * @example\n\
321
+ * czm_cone cone = czm_coneNew(vec3(0.0), vec3(0.0, 0.0, 1.0), radians(45.0)); // vertex, axis, halfAperture\n\
322
+ * vec3 point = vec3(1.0, 0.0, 0.0);\n\
323
+ * bool b = czm_coneContainsPoint(cone, point)); // false\n\
324
+ */\n\
200
325
  bool czm_coneContainsPoint(czm_cone cone, vec3 point)\n\
201
326
  {\n\
202
- vec3 n = normalize(point - cone.vertex);\n\
203
- return (dot(n, cone.axis) >= cone.cosineOfHalfAperture);\n\
327
+ vec3 n = normalize(point - cone.vertex);\n\
328
+ return (dot(n, cone.axis) >= cone.cosineOfHalfAperture);\n\
204
329
  }\n\
330
+ \n\
205
331
  bool _czm_rayIntersectsReflectedCone(czm_ray ray, czm_cone cone, float time, float cosine)\n\
206
332
  {\n\
207
- vec3 s = ray.origin + (time * ray.direction) - cone.vertex;\n\
208
- vec3 sUnit = normalize(s);\n\
209
- float c = dot(sUnit, cone.axis);\n\
210
- return (sign(c) != sign(cosine));\n\
211
- }\n\
333
+ vec3 s = ray.origin + (time * ray.direction) - cone.vertex; // The vector from the origin is at (vertex + s)\n\
334
+ vec3 sUnit = normalize(s);\n\
335
+ float c = dot(sUnit, cone.axis);\n\
336
+ \n\
337
+ return (sign(c) != sign(cosine));\n\
338
+ }\n\
339
+ \n\
340
+ /**\n\
341
+ * DOC_TBA\n\
342
+ *\n\
343
+ * @name czm_rayConeIntersectionInterval\n\
344
+ * @glslFunction\n\
345
+ *\n\
346
+ * @see czm_coneNormal\n\
347
+ * @see czm_coneContainsPoint\n\
348
+ */\n\
212
349
  czm_raySegmentCollection czm_rayConeIntersectionInterval(czm_ray ray, czm_cone cone)\n\
213
350
  {\n\
214
- vec3 temp = ray.origin - cone.vertex;\n\
215
- float t2 = dot(temp, temp);\n\
216
- float cosineNu = dot(ray.direction, cone.axis);\n\
217
- if (t2 == 0.0)\n\
218
- {\n\
219
- if (cosineNu >= cone.cosineOfHalfAperture)\n\
220
- {\n\
221
- return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
222
- }\n\
223
- else\n\
224
- {\n\
225
- return czm_raySegmentCollectionNew();\n\
226
- }\n\
227
- }\n\
228
- else\n\
229
- {\n\
230
- float projection = dot(normalize(temp), cone.axis);\n\
231
- if (projection == cone.cosineOfHalfAperture)\n\
232
- {\n\
233
- vec3 u = ray.direction;\n\
234
- mat3 crossProductMatrix = mat3(0.0, -u.z, u.y,\n\
235
- u.z, 0.0, -u.x,\n\
236
- -u.y, u.x, 0.0);\n\
237
- if (length(crossProductMatrix * temp) == 0.0)\n\
238
- {\n\
239
- if (dot(temp, u) > 0.0)\n\
240
- {\n\
241
- return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
242
- }\n\
243
- else\n\
244
- {\n\
245
- czm_raySegment i = czm_raySegment(0.0, length(temp));\n\
246
- return czm_raySegmentCollectionNew(i);\n\
247
- }\n\
248
- }\n\
249
- else\n\
250
- {\n\
251
- return czm_raySegmentCollectionNew();\n\
252
- }\n\
253
- }\n\
254
- else\n\
255
- {\n\
256
- vec3 t = normalize(temp);\n\
257
- float cosineAlpha2 = cone.cosineOfHalfAperture * cone.cosineOfHalfAperture;\n\
258
- float cosineTau = dot(t, cone.axis);\n\
259
- float cosineDelta = dot(t, ray.direction);\n\
260
- float cosineNu2 = cosineNu * cosineNu;\n\
261
- float cosineTau2 = cosineTau * cosineTau;\n\
262
- float stuff = cosineTau * cosineNu;\n\
263
- float positiveTerm = cosineNu2 + cosineTau2;\n\
264
- float negativeTerm = (cosineDelta * cosineDelta - 1.0) * cosineAlpha2;\n\
265
- float signedTerm = -2.0 * stuff * cosineDelta;\n\
266
- if (signedTerm > 0.0)\n\
267
- {\n\
268
- positiveTerm = positiveTerm + signedTerm;\n\
269
- }\n\
270
- else if (signedTerm < 0.0)\n\
271
- {\n\
272
- negativeTerm = negativeTerm + signedTerm;\n\
273
- }\n\
274
- float d = 4.0 * cosineAlpha2 * (positiveTerm + negativeTerm);\n\
275
- if (d < 0.0)\n\
276
- {\n\
277
- if (cone.cosineOfHalfAperture < 0.0)\n\
278
- {\n\
279
- return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
280
- }\n\
281
- else\n\
282
- {\n\
283
- return czm_raySegmentCollectionNew();\n\
284
- }\n\
285
- }\n\
286
- else if (d > 0.0)\n\
287
- {\n\
288
- float a = cosineNu2 - cosineAlpha2;\n\
289
- float c = cosineTau2 - cosineAlpha2;\n\
290
- float b = 2.0 * (stuff - cosineDelta * cosineAlpha2);\n\
291
- float s = (b == 0.0) ? 1.0 : sign(b);\n\
292
- float q = -(b + s * sqrt(d)) / 2.0;\n\
293
- float first = q / a;\n\
294
- float second = c / q;\n\
295
- if (second < first)\n\
296
- {\n\
297
- float thing = first;\n\
298
- first = second;\n\
299
- second = thing;\n\
300
- }\n\
301
- bool firstTest = (first >= 0.0) && !(sign(dot(t + first * ray.direction, cone.axis)) == -sign(cone.cosineOfHalfAperture));\n\
302
- bool secondTest = (second >= 0.0) && !(sign(dot(t + second * ray.direction, cone.axis)) == -sign(cone.cosineOfHalfAperture));\n\
303
- float m = sqrt(t2);\n\
304
- if (cosineTau > cone.cosineOfHalfAperture)\n\
305
- {\n\
306
- if (firstTest && secondTest)\n\
307
- {\n\
308
- czm_raySegment one = czm_raySegment(0.0, m * first);\n\
309
- czm_raySegment two = czm_raySegment(m * second, czm_infinity);\n\
310
- return czm_raySegmentCollectionNew(one, two);\n\
311
- }\n\
312
- else if (firstTest)\n\
313
- {\n\
314
- czm_raySegment i = czm_raySegment(0.0, m * first);\n\
315
- return czm_raySegmentCollectionNew(i);\n\
316
- }\n\
317
- else if (secondTest)\n\
318
- {\n\
319
- czm_raySegment i = czm_raySegment(0.0, m * second);\n\
320
- return czm_raySegmentCollectionNew(i);\n\
321
- }\n\
322
- else\n\
323
- {\n\
324
- return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
325
- }\n\
326
- }\n\
327
- else\n\
328
- {\n\
329
- if (firstTest && secondTest)\n\
330
- {\n\
331
- czm_raySegment i = czm_raySegment(m * first, m * second);\n\
332
- return czm_raySegmentCollectionNew(i);\n\
333
- }\n\
334
- else if (firstTest)\n\
335
- {\n\
336
- czm_raySegment i = czm_raySegment(m * first, czm_infinity);\n\
337
- return czm_raySegmentCollectionNew(i);\n\
338
- }\n\
339
- else if (secondTest)\n\
340
- {\n\
341
- czm_raySegment i = czm_raySegment(m * second, czm_infinity);\n\
342
- return czm_raySegmentCollectionNew(i);\n\
343
- }\n\
344
- else\n\
345
- {\n\
346
- return czm_raySegmentCollectionNew();\n\
347
- }\n\
348
- }\n\
349
- }\n\
350
- else\n\
351
- {\n\
352
- if (cone.cosineOfHalfAperture == 0.0)\n\
353
- {\n\
354
- if (cosineTau >= 0.0)\n\
355
- {\n\
356
- if (cosineNu >= 0.0)\n\
357
- {\n\
358
- return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
359
- }\n\
360
- else\n\
361
- {\n\
362
- czm_raySegment i = czm_raySegment(0.0, -sqrt(t2) * cosineTau / cosineNu);\n\
363
- return czm_raySegmentCollectionNew(i);\n\
364
- }\n\
365
- }\n\
366
- else\n\
367
- {\n\
368
- if (cosineNu <= 0.0)\n\
369
- {\n\
370
- return czm_raySegmentCollectionNew();\n\
371
- }\n\
372
- else\n\
373
- {\n\
374
- czm_raySegment i = czm_raySegment(-sqrt(t2) * cosineTau / cosineNu, czm_infinity);\n\
375
- return czm_raySegmentCollectionNew(i);\n\
376
- }\n\
377
- }\n\
378
- }\n\
379
- else\n\
380
- {\n\
381
- float a = cosineNu2 - cosineAlpha2;\n\
382
- float c = cosineTau2 - cosineAlpha2;\n\
383
- float b = 2.0 * (stuff - cosineDelta * cosineAlpha2);\n\
384
- float root = (a == 0.0) ? -sign(b) * czm_infinity : (-sign(b) / sign(a)) * sqrt(c / a);\n\
385
- bool rootTest = (root >= 0.0) && !(sign(dot(t + root * ray.direction, cone.axis)) == -sign(cone.cosineOfHalfAperture));\n\
386
- float m = sqrt(t2);\n\
387
- if (cosineTau > cone.cosineOfHalfAperture)\n\
388
- {\n\
389
- if (rootTest)\n\
390
- {\n\
391
- czm_raySegment i = czm_raySegment(0.0, m * root);\n\
392
- return czm_raySegmentCollectionNew(i);\n\
393
- }\n\
394
- else\n\
395
- {\n\
396
- return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
397
- }\n\
398
- }\n\
399
- else\n\
400
- {\n\
401
- if (rootTest)\n\
402
- {\n\
403
- if (c < 0.0)\n\
404
- {\n\
405
- float thing = m * root;\n\
406
- czm_raySegment i = czm_raySegment(thing, thing);\n\
407
- return czm_raySegmentCollectionNew(i);\n\
408
- }\n\
409
- else\n\
410
- {\n\
411
- float thing = m * root;\n\
412
- czm_raySegment i = czm_raySegment(thing, czm_infinity);\n\
413
- return czm_raySegmentCollectionNew(i);\n\
414
- }\n\
415
- }\n\
416
- else\n\
417
- {\n\
418
- return czm_raySegmentCollectionNew();\n\
419
- }\n\
420
- }\n\
421
- }\n\
422
- }\n\
423
- }\n\
424
- }\n\
425
- }\n\
351
+ vec3 temp = ray.origin - cone.vertex;\n\
352
+ \n\
353
+ float t2 = dot(temp, temp);\n\
354
+ \n\
355
+ float cosineNu = dot(ray.direction, cone.axis);\n\
356
+ \n\
357
+ if (t2 == 0.0) // At vertex.\n\
358
+ {\n\
359
+ if (cosineNu >= cone.cosineOfHalfAperture) // Looking inward or along surface.\n\
360
+ {\n\
361
+ return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
362
+ }\n\
363
+ else // Looking outward.\n\
364
+ {\n\
365
+ return czm_raySegmentCollectionNew();\n\
366
+ }\n\
367
+ }\n\
368
+ else // Not at vertex\n\
369
+ {\n\
370
+ float projection = dot(normalize(temp), cone.axis);\n\
371
+ \n\
372
+ if (projection == cone.cosineOfHalfAperture) // On surface.\n\
373
+ {\n\
374
+ vec3 u = ray.direction;\n\
375
+ \n\
376
+ mat3 crossProductMatrix = mat3(0.0, -u.z, u.y,\n\
377
+ u.z, 0.0, -u.x,\n\
378
+ -u.y, u.x, 0.0);\n\
379
+ if (length(crossProductMatrix * temp) == 0.0) // Looking along surface.\n\
380
+ {\n\
381
+ if (dot(temp, u) > 0.0) // Looking away from vertex.\n\
382
+ {\n\
383
+ return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
384
+ }\n\
385
+ else // Looking toward vertex.\n\
386
+ {\n\
387
+ czm_raySegment i = czm_raySegment(0.0, length(temp));\n\
388
+ return czm_raySegmentCollectionNew(i);\n\
389
+ }\n\
390
+ }\n\
391
+ else // Looking tangent at surface.\n\
392
+ {\n\
393
+ return czm_raySegmentCollectionNew();\n\
394
+ }\n\
395
+ }\n\
396
+ else // Not on surface\n\
397
+ {\n\
398
+ vec3 t = normalize(temp);\n\
399
+ \n\
400
+ float cosineAlpha2 = cone.cosineOfHalfAperture * cone.cosineOfHalfAperture;\n\
401
+ \n\
402
+ float cosineTau = dot(t, cone.axis);\n\
403
+ float cosineDelta = dot(t, ray.direction);\n\
404
+ \n\
405
+ float cosineNu2 = cosineNu * cosineNu;\n\
406
+ float cosineTau2 = cosineTau * cosineTau;\n\
407
+ \n\
408
+ float stuff = cosineTau * cosineNu;\n\
409
+ \n\
410
+ float positiveTerm = cosineNu2 + cosineTau2;\n\
411
+ float negativeTerm = (cosineDelta * cosineDelta - 1.0) * cosineAlpha2;\n\
412
+ float signedTerm = -2.0 * stuff * cosineDelta;\n\
413
+ \n\
414
+ if (signedTerm > 0.0)\n\
415
+ {\n\
416
+ positiveTerm = positiveTerm + signedTerm;\n\
417
+ }\n\
418
+ else if (signedTerm < 0.0)\n\
419
+ {\n\
420
+ negativeTerm = negativeTerm + signedTerm;\n\
421
+ }\n\
422
+ \n\
423
+ float d = 4.0 * cosineAlpha2 * (positiveTerm + negativeTerm);\n\
424
+ \n\
425
+ if (d < 0.0) // Imaginary roots. No intersections.\n\
426
+ {\n\
427
+ if (cone.cosineOfHalfAperture < 0.0) // Obtuse cone.\n\
428
+ {\n\
429
+ return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
430
+ }\n\
431
+ else // Acute cone.\n\
432
+ {\n\
433
+ return czm_raySegmentCollectionNew();\n\
434
+ }\n\
435
+ }\n\
436
+ else if (d > 0.0) // Distinct real roots. Two intersections.\n\
437
+ {\n\
438
+ float a = cosineNu2 - cosineAlpha2;\n\
439
+ float c = cosineTau2 - cosineAlpha2;\n\
440
+ float b = 2.0 * (stuff - cosineDelta * cosineAlpha2);\n\
441
+ \n\
442
+ float s = (b == 0.0) ? 1.0 : sign(b);\n\
443
+ float q = -(b + s * sqrt(d)) / 2.0;\n\
444
+ \n\
445
+ float first = q / a;\n\
446
+ float second = c / q;\n\
447
+ if (second < first)\n\
448
+ {\n\
449
+ float thing = first;\n\
450
+ first = second;\n\
451
+ second = thing;\n\
452
+ }\n\
453
+ \n\
454
+ // Check roots to ensure that they are non-negative and intersect the desired nape of the cone.\n\
455
+ bool firstTest = (first >= 0.0) && !(sign(dot(t + first * ray.direction, cone.axis)) == -sign(cone.cosineOfHalfAperture));\n\
456
+ bool secondTest = (second >= 0.0) && !(sign(dot(t + second * ray.direction, cone.axis)) == -sign(cone.cosineOfHalfAperture));\n\
457
+ \n\
458
+ float m = sqrt(t2);\n\
459
+ \n\
460
+ if (cosineTau > cone.cosineOfHalfAperture) // Inside cone.\n\
461
+ {\n\
462
+ if (firstTest && secondTest)\n\
463
+ {\n\
464
+ // Ray starts inside cone and exits; then enters and never exits.\n\
465
+ czm_raySegment one = czm_raySegment(0.0, m * first);\n\
466
+ czm_raySegment two = czm_raySegment(m * second, czm_infinity);\n\
467
+ return czm_raySegmentCollectionNew(one, two);\n\
468
+ }\n\
469
+ else if (firstTest)\n\
470
+ {\n\
471
+ // Ray starts inside cone and exits.\n\
472
+ czm_raySegment i = czm_raySegment(0.0, m * first);\n\
473
+ return czm_raySegmentCollectionNew(i);\n\
474
+ }\n\
475
+ else if (secondTest)\n\
476
+ {\n\
477
+ // Ray starts inside cone and exits.\n\
478
+ czm_raySegment i = czm_raySegment(0.0, m * second);\n\
479
+ return czm_raySegmentCollectionNew(i);\n\
480
+ }\n\
481
+ else\n\
482
+ {\n\
483
+ // Ray starts inside cone and never exits.\n\
484
+ return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
485
+ }\n\
486
+ }\n\
487
+ else\n\
488
+ {\n\
489
+ if (firstTest && secondTest)\n\
490
+ {\n\
491
+ // Ray enters and exits.\n\
492
+ czm_raySegment i = czm_raySegment(m * first, m * second);\n\
493
+ return czm_raySegmentCollectionNew(i);\n\
494
+ }\n\
495
+ else if (firstTest)\n\
496
+ {\n\
497
+ // Ray enters and never exits.\n\
498
+ czm_raySegment i = czm_raySegment(m * first, czm_infinity);\n\
499
+ return czm_raySegmentCollectionNew(i);\n\
500
+ }\n\
501
+ else if (secondTest)\n\
502
+ {\n\
503
+ // Ray enters and never exits.\n\
504
+ czm_raySegment i = czm_raySegment(m * second, czm_infinity);\n\
505
+ return czm_raySegmentCollectionNew(i);\n\
506
+ }\n\
507
+ else\n\
508
+ {\n\
509
+ // Ray never enters.\n\
510
+ return czm_raySegmentCollectionNew();\n\
511
+ }\n\
512
+ }\n\
513
+ }\n\
514
+ else // (d == 0.0) Repeated real roots. Two intersections.\n\
515
+ {\n\
516
+ if (cone.cosineOfHalfAperture == 0.0) // Planar cone.\n\
517
+ {\n\
518
+ if (cosineTau >= 0.0) // Inside or on surface.\n\
519
+ {\n\
520
+ if (cosineNu >= 0.0) // Looking inward or tangent.\n\
521
+ {\n\
522
+ // Ray starts inside cone and never exits.\n\
523
+ return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
524
+ }\n\
525
+ else\n\
526
+ {\n\
527
+ // Ray starts inside cone and intersects.\n\
528
+ czm_raySegment i = czm_raySegment(0.0, -sqrt(t2) * cosineTau / cosineNu);\n\
529
+ return czm_raySegmentCollectionNew(i);\n\
530
+ }\n\
531
+ }\n\
532
+ else // Outside.\n\
533
+ {\n\
534
+ if (cosineNu <= 0.0) // Looking outward or tangent.\n\
535
+ {\n\
536
+ // Ray starts outside cone and never enters.\n\
537
+ return czm_raySegmentCollectionNew();\n\
538
+ }\n\
539
+ else\n\
540
+ {\n\
541
+ // Ray starts outside cone and intersects.\n\
542
+ czm_raySegment i = czm_raySegment(-sqrt(t2) * cosineTau / cosineNu, czm_infinity);\n\
543
+ return czm_raySegmentCollectionNew(i);\n\
544
+ }\n\
545
+ }\n\
546
+ }\n\
547
+ else\n\
548
+ {\n\
549
+ float a = cosineNu2 - cosineAlpha2;\n\
550
+ float c = cosineTau2 - cosineAlpha2;\n\
551
+ float b = 2.0 * (stuff - cosineDelta * cosineAlpha2);\n\
552
+ \n\
553
+ float root = (a == 0.0) ? -sign(b) * czm_infinity : (-sign(b) / sign(a)) * sqrt(c / a);\n\
554
+ \n\
555
+ // Check roots to ensure that they are non-negative and intersect the desired nape of the cone.\n\
556
+ bool rootTest = (root >= 0.0) && !(sign(dot(t + root * ray.direction, cone.axis)) == -sign(cone.cosineOfHalfAperture));\n\
557
+ \n\
558
+ float m = sqrt(t2);\n\
559
+ \n\
560
+ if (cosineTau > cone.cosineOfHalfAperture) // Inside cone.\n\
561
+ {\n\
562
+ if (rootTest)\n\
563
+ {\n\
564
+ // Ray starts inside cone and exits or becomes tangent.\n\
565
+ czm_raySegment i = czm_raySegment(0.0, m * root);\n\
566
+ return czm_raySegmentCollectionNew(i);\n\
567
+ }\n\
568
+ else\n\
569
+ {\n\
570
+ // Ray starts inside cone and never exits.\n\
571
+ return czm_raySegmentCollectionNew(czm_fullRaySegment);\n\
572
+ }\n\
573
+ }\n\
574
+ else\n\
575
+ {\n\
576
+ if (rootTest)\n\
577
+ {\n\
578
+ if (c < 0.0) // Outside both napes of the cone.\n\
579
+ {\n\
580
+ // Ray starts outside cone and becomes tangent.\n\
581
+ float thing = m * root;\n\
582
+ czm_raySegment i = czm_raySegment(thing, thing);\n\
583
+ return czm_raySegmentCollectionNew(i);\n\
584
+ }\n\
585
+ else\n\
586
+ {\n\
587
+ // Ray starts outside cone and enters at vertex.\n\
588
+ float thing = m * root;\n\
589
+ czm_raySegment i = czm_raySegment(thing, czm_infinity);\n\
590
+ return czm_raySegmentCollectionNew(i);\n\
591
+ }\n\
592
+ }\n\
593
+ else\n\
594
+ {\n\
595
+ // Ray never enters.\n\
596
+ return czm_raySegmentCollectionNew();\n\
597
+ }\n\
598
+ }\n\
599
+ }\n\
600
+ }\n\
601
+ }\n\
602
+ }\n\
603
+ }\n\
604
+ \n\
605
+ /**\n\
606
+ * DOC_TBA\n\
607
+ *\n\
608
+ * @name czm_rayConeIntersectNormal\n\
609
+ * @glslFunction \n\
610
+ *\n\
611
+ * @see czm_rayConeIntersectionInterval\n\
612
+ * @see czm_pointAlongRay\n\
613
+ *\n\
614
+ * @example\n\
615
+ * // Compute the outward-facing cone normal where a ray first intersects a cone\n\
616
+ * czm_ray ray = czm_ray(vec3(0.0), vec3(0.0, 0.0, 1.0)); // origin, direction\n\
617
+ * czm_cone cone = czm_coneNew(vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 1.0), radians(45.0)); // vertex, axis, halfAperture\n\
618
+ * czm_raySegment i = czm_rayConeIntersectionInterval(ray, cone);\n\
619
+ * vec3 normal = czm_coneNormal(cone, czm_pointAlongRay(ray, i.start));\n\
620
+ */\n\
426
621
  vec3 czm_coneNormal(czm_cone cone, vec3 pointOnCone)\n\
427
622
  {\n\
428
- vec3 s = pointOnCone - cone.vertex;\n\
429
- vec3 sUnit = normalize(s);\n\
430
- return normalize((cone.cosineOfHalfAperture * sUnit - cone.axis) / cone.sineOfHalfAperture);\n\
431
- }\n\
623
+ // PERFORMANCE_IDEA: Remove duplicate computation with _czm_rayIntersectsReflectedCone\n\
624
+ vec3 s = pointOnCone - cone.vertex; // Vector from the origin is at (vertex + s)\n\
625
+ vec3 sUnit = normalize(s);\n\
626
+ return normalize((cone.cosineOfHalfAperture * sUnit - cone.axis) / cone.sineOfHalfAperture);\n\
627
+ }\n\
628
+ \n\
629
+ ///////////////////////////////////////////////////////////////////////////////\n\
630
+ \n\
631
+ /**\n\
632
+ * DOC_TBA\n\
633
+ *\n\
634
+ * @name czm_ellipsoidSilhouetteCone\n\
635
+ * @glslStruct\n\
636
+ */\n\
432
637
  struct czm_ellipsoidSilhouetteCone\n\
433
638
  {\n\
434
- czm_ellipsoid ellipsoid;\n\
435
- vec3 pointOutsideEllipsoid;\n\
436
- czm_cone coneInScaledSpace;\n\
639
+ czm_ellipsoid ellipsoid;\n\
640
+ vec3 pointOutsideEllipsoid;\n\
641
+ czm_cone coneInScaledSpace;\n\
437
642
  };\n\
643
+ \n\
644
+ /**\n\
645
+ * DOC_TBA\n\
646
+ *\n\
647
+ * @name czm_ellipsoidSilhouetteConeNormal\n\
648
+ * @glslFunction\n\
649
+ *\n\
650
+ */\n\
438
651
  vec3 czm_ellipsoidSilhouetteConeNormal(czm_ellipsoidSilhouetteCone cone, vec3 pointOnCone)\n\
439
652
  {\n\
440
- vec3 pointOnScaledCone = cone.ellipsoid.inverseRadii * (czm_inverseView * vec4(pointOnCone, 1.0)).xyz;\n\
441
- vec3 scaledNormal = czm_coneNormal(cone.coneInScaledSpace, pointOnScaledCone);\n\
442
- vec3 temp = -normalize(czm_viewRotation * (cone.ellipsoid.radii * scaledNormal));\n\
443
- return temp;\n\
444
- }\n\
653
+ vec3 pointOnScaledCone = cone.ellipsoid.inverseRadii * (czm_inverseView * vec4(pointOnCone, 1.0)).xyz;\n\
654
+ \n\
655
+ vec3 scaledNormal = czm_coneNormal(cone.coneInScaledSpace, pointOnScaledCone);\n\
656
+ \n\
657
+ vec3 temp = -normalize(czm_viewRotation * (cone.ellipsoid.radii * scaledNormal));\n\
658
+ \n\
659
+ return temp;\n\
660
+ }\n\
661
+ \n\
662
+ /**\n\
663
+ * DOC_TBA\n\
664
+ *\n\
665
+ * @name czm_ellipsoidSilhouetteConeNew\n\
666
+ * @glslFunction\n\
667
+ *\n\
668
+ */\n\
445
669
  czm_ellipsoidSilhouetteCone czm_ellipsoidSilhouetteConeNew(czm_ellipsoid ellipsoid, vec3 pointOutsideEllipsoid)\n\
446
670
  {\n\
447
- vec3 q = ellipsoid.inverseRadii * (czm_inverseView * vec4(pointOutsideEllipsoid, 1.0)).xyz;\n\
448
- vec3 axis = -normalize(q);\n\
449
- float q2 = dot(q, q);\n\
450
- float sineSquaredOfHalfAperture = 1.0 / q2;\n\
451
- float sineOfHalfAperture = sqrt(sineSquaredOfHalfAperture);\n\
452
- float cosineSquaredOfHalfAperture = 1.0 - sineSquaredOfHalfAperture;\n\
453
- float cosineOfHalfAperture = sqrt(cosineSquaredOfHalfAperture);\n\
454
- float halfAperture = atan(sineOfHalfAperture / cosineOfHalfAperture);\n\
455
- float x2 = axis.x * axis.x;\n\
456
- float y2 = axis.y * axis.y;\n\
457
- float z2 = axis.z * axis.z;\n\
458
- float xy = axis.x * axis.y;\n\
459
- float yz = axis.y * axis.z;\n\
460
- float zx = axis.z * axis.x;\n\
461
- mat3 intersectionMatrix = mat3(\n\
462
- cosineSquaredOfHalfAperture - x2, -xy, -zx,\n\
463
- -xy, cosineSquaredOfHalfAperture - y2, -yz,\n\
464
- -zx, -yz, cosineSquaredOfHalfAperture - z2);\n\
465
- czm_cone coneInScaledSpace = czm_cone(q, axis, halfAperture,\n\
466
- cosineOfHalfAperture, cosineSquaredOfHalfAperture,\n\
467
- sineOfHalfAperture, sineSquaredOfHalfAperture, intersectionMatrix);\n\
468
- czm_ellipsoidSilhouetteCone temp = czm_ellipsoidSilhouetteCone(ellipsoid, pointOutsideEllipsoid, coneInScaledSpace);\n\
469
- return temp;\n\
470
- }\n\
671
+ vec3 q = ellipsoid.inverseRadii * (czm_inverseView * vec4(pointOutsideEllipsoid, 1.0)).xyz;\n\
672
+ vec3 axis = -normalize(q);\n\
673
+ \n\
674
+ float q2 = dot(q, q);\n\
675
+ float sineSquaredOfHalfAperture = 1.0 / q2;\n\
676
+ float sineOfHalfAperture = sqrt(sineSquaredOfHalfAperture);\n\
677
+ float cosineSquaredOfHalfAperture = 1.0 - sineSquaredOfHalfAperture;\n\
678
+ float cosineOfHalfAperture = sqrt(cosineSquaredOfHalfAperture);\n\
679
+ float halfAperture = atan(sineOfHalfAperture / cosineOfHalfAperture);\n\
680
+ \n\
681
+ float x2 = axis.x * axis.x;\n\
682
+ float y2 = axis.y * axis.y;\n\
683
+ float z2 = axis.z * axis.z;\n\
684
+ float xy = axis.x * axis.y;\n\
685
+ float yz = axis.y * axis.z;\n\
686
+ float zx = axis.z * axis.x;\n\
687
+ \n\
688
+ // This is a symmetric matrix.\n\
689
+ mat3 intersectionMatrix = mat3(\n\
690
+ cosineSquaredOfHalfAperture - x2, -xy, -zx,\n\
691
+ -xy, cosineSquaredOfHalfAperture - y2, -yz,\n\
692
+ -zx, -yz, cosineSquaredOfHalfAperture - z2); \n\
693
+ \n\
694
+ czm_cone coneInScaledSpace = czm_cone(q, axis, halfAperture,\n\
695
+ cosineOfHalfAperture, cosineSquaredOfHalfAperture,\n\
696
+ sineOfHalfAperture, sineSquaredOfHalfAperture, intersectionMatrix);\n\
697
+ \n\
698
+ // ANGLE workaround: http://code.google.com/p/angleproject/issues/detail?id=185 \n\
699
+ czm_ellipsoidSilhouetteCone temp = czm_ellipsoidSilhouetteCone(ellipsoid, pointOutsideEllipsoid, coneInScaledSpace);\n\
700
+ return temp;\n\
701
+ }\n\
702
+ \n\
703
+ /**\n\
704
+ * DOC_TBA\n\
705
+ *\n\
706
+ * @name czm_rayEllipsoidSilhouetteConeIntersectionInterval\n\
707
+ * @glslFunction\n\
708
+ *\n\
709
+ */\n\
471
710
  czm_raySegment czm_rayEllipsoidSilhouetteConeIntersectionInterval(czm_ray ray, czm_ellipsoidSilhouetteCone cone)\n\
472
711
  {\n\
473
- vec3 origin = cone.ellipsoid.inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz;\n\
474
- vec3 direction = normalize(cone.ellipsoid.inverseRadii * (czm_inverseViewRotation * ray.direction));\n\
475
- czm_ray rayInScaledSpace = czm_ray(origin, direction);\n\
476
- czm_raySegmentCollection collection = czm_rayConeIntersectionInterval(rayInScaledSpace, cone.coneInScaledSpace);\n\
477
- if (collection.count == 0)\n\
478
- {\n\
479
- return czm_emptyRaySegment;\n\
480
- }\n\
481
- else\n\
482
- {\n\
483
- czm_raySegment interval = collection.intervals[0];\n\
484
- float start = interval.start;\n\
485
- if (start != 0.0)\n\
486
- {\n\
487
- vec3 temp = (czm_view * vec4(cone.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, start), 1.0)).xyz;\n\
488
- start = dot(temp, ray.direction);\n\
489
- }\n\
490
- float stop = interval.stop;\n\
491
- if (stop != czm_infinity)\n\
492
- {\n\
493
- vec3 temp = (czm_view * vec4(cone.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, stop), 1.0)).xyz;\n\
494
- stop = dot(temp, ray.direction);\n\
495
- }\n\
496
- return czm_raySegment(start, stop);\n\
497
- }\n\
498
- }\n\
712
+ // Determine the ray in the scaled space.\n\
713
+ vec3 origin = cone.ellipsoid.inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz;\n\
714
+ vec3 direction = normalize(cone.ellipsoid.inverseRadii * (czm_inverseViewRotation * ray.direction));\n\
715
+ czm_ray rayInScaledSpace = czm_ray(origin, direction);\n\
716
+ \n\
717
+ // Perform the intersection in the scaled space.\n\
718
+ czm_raySegmentCollection collection = czm_rayConeIntersectionInterval(rayInScaledSpace, cone.coneInScaledSpace);\n\
719
+ \n\
720
+ if (collection.count == 0) // No intersection.\n\
721
+ {\n\
722
+ return czm_emptyRaySegment;\n\
723
+ }\n\
724
+ else // Intersection.\n\
725
+ {\n\
726
+ czm_raySegment interval = collection.intervals[0];\n\
727
+ \n\
728
+ // Honor ray origin case (start == 0.0).\n\
729
+ float start = interval.start;\n\
730
+ if (start != 0.0)\n\
731
+ {\n\
732
+ // Determine start in unscaled space.\n\
733
+ vec3 temp = (czm_view * vec4(cone.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, start), 1.0)).xyz;\n\
734
+ start = dot(temp, ray.direction);\n\
735
+ }\n\
736
+ \n\
737
+ // Honor infinite ray (stop == infinity).\n\
738
+ float stop = interval.stop;\n\
739
+ if (stop != czm_infinity)\n\
740
+ {\n\
741
+ // Determine stop in unscaled space.\n\
742
+ vec3 temp = (czm_view * vec4(cone.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, stop), 1.0)).xyz;\n\
743
+ stop = dot(temp, ray.direction);\n\
744
+ }\n\
745
+ \n\
746
+ return czm_raySegment(start, stop);\n\
747
+ }\n\
748
+ }\n\
749
+ \n\
750
+ ///////////////////////////////////////////////////////////////////////////////\n\
751
+ \n\
752
+ /**\n\
753
+ * DOC_TBA\n\
754
+ *\n\
755
+ * @name czm_halfspace\n\
756
+ * @glslStruct\n\
757
+ */\n\
499
758
  struct czm_halfspace\n\
500
759
  {\n\
501
- vec3 center;\n\
502
- vec3 normal;\n\
760
+ vec3 center;\n\
761
+ vec3 normal; // Unit vector.\n\
503
762
  };\n\
763
+ \n\
764
+ /**\n\
765
+ * DOC_TBA\n\
766
+ *\n\
767
+ * @name czm_rayHalfspaceIntersectionInterval\n\
768
+ * @glslFunction\n\
769
+ *\n\
770
+ */\n\
504
771
  czm_raySegment czm_rayHalfspaceIntersectionInterval(czm_ray ray, czm_halfspace halfspace)\n\
505
772
  {\n\
506
- float numerator = dot(halfspace.center - ray.origin, halfspace.normal);\n\
507
- float denominator = dot(ray.direction, halfspace.normal);\n\
508
- if (numerator > 0.0)\n\
509
- {\n\
510
- if (denominator > 0.0)\n\
511
- {\n\
512
- return czm_raySegment(0.0, numerator / denominator);\n\
513
- }\n\
514
- else\n\
515
- {\n\
516
- return czm_fullRaySegment;\n\
517
- }\n\
518
- }\n\
519
- else if (numerator < 0.0)\n\
520
- {\n\
521
- if (denominator < 0.0 )\n\
522
- {\n\
523
- return czm_raySegment(numerator / denominator, czm_infinity);\n\
524
- }\n\
525
- else\n\
526
- {\n\
527
- return czm_emptyRaySegment;\n\
528
- }\n\
529
- }\n\
530
- else\n\
531
- {\n\
532
- if (denominator < 0.0 )\n\
533
- {\n\
534
- return czm_fullRaySegment;\n\
535
- }\n\
536
- else\n\
537
- {\n\
538
- return czm_emptyRaySegment;\n\
539
- }\n\
540
- }\n\
541
- }\n\
773
+ float numerator = dot(halfspace.center - ray.origin, halfspace.normal);\n\
774
+ float denominator = dot(ray.direction, halfspace.normal);\n\
775
+ \n\
776
+ if (numerator > 0.0) // Inside.\n\
777
+ {\n\
778
+ if (denominator > 0.0) // Looking outward.\n\
779
+ {\n\
780
+ return czm_raySegment(0.0, numerator / denominator);\n\
781
+ }\n\
782
+ else // Looking inward or parallel.\n\
783
+ {\n\
784
+ return czm_fullRaySegment; \n\
785
+ }\n\
786
+ }\n\
787
+ else if (numerator < 0.0) // Outside.\n\
788
+ {\n\
789
+ if (denominator < 0.0 ) // Looking inward.\n\
790
+ {\n\
791
+ return czm_raySegment(numerator / denominator, czm_infinity); \n\
792
+ }\n\
793
+ else // Looking outward or parallel.\n\
794
+ {\n\
795
+ return czm_emptyRaySegment;\n\
796
+ }\n\
797
+ }\n\
798
+ else // On surface.\n\
799
+ {\n\
800
+ if (denominator < 0.0 ) // Looking inward.\n\
801
+ {\n\
802
+ return czm_fullRaySegment; \n\
803
+ }\n\
804
+ else // Looking outward or parallel.\n\
805
+ {\n\
806
+ return czm_emptyRaySegment;\n\
807
+ }\n\
808
+ }\n\
809
+ }\n\
810
+ \n\
811
+ ///////////////////////////////////////////////////////////////////////////////\n\
812
+ \n\
813
+ /**\n\
814
+ * DOC_TBA\n\
815
+ *\n\
816
+ * @name czm_ellipsoidSilhouetteHalfspace\n\
817
+ * @glslStruct\n\
818
+ */\n\
542
819
  struct czm_ellipsoidSilhouetteHalfspace\n\
543
820
  {\n\
544
- czm_ellipsoid ellipsoid;\n\
545
- vec3 pointOutsideEllipsoid;\n\
546
- czm_halfspace halfspaceInScaledSpace;\n\
821
+ czm_ellipsoid ellipsoid;\n\
822
+ vec3 pointOutsideEllipsoid;\n\
823
+ czm_halfspace halfspaceInScaledSpace;\n\
547
824
  };\n\
825
+ \n\
826
+ /**\n\
827
+ * DOC_TBA\n\
828
+ *\n\
829
+ * @name czm_ellipsoidSilhouetteHalfspaceNew\n\
830
+ * @glslFunction\n\
831
+ *\n\
832
+ */\n\
548
833
  czm_ellipsoidSilhouetteHalfspace czm_ellipsoidSilhouetteHalfspaceNew(czm_ellipsoid ellipsoid, vec3 pointOutsideEllipsoid)\n\
549
834
  {\n\
550
- vec3 q = ellipsoid.inverseRadii * (czm_inverseView * vec4(pointOutsideEllipsoid, 1.0)).xyz;\n\
551
- float magnitude = 1.0 / length(q);\n\
552
- vec3 normal = normalize(q);\n\
553
- vec3 center = magnitude * normal;\n\
554
- czm_halfspace halfspaceInScaledSpace = czm_halfspace(center, normal);\n\
555
- czm_ellipsoidSilhouetteHalfspace temp = czm_ellipsoidSilhouetteHalfspace(ellipsoid, pointOutsideEllipsoid, halfspaceInScaledSpace);\n\
556
- return temp;\n\
557
- }\n\
835
+ vec3 q = ellipsoid.inverseRadii * (czm_inverseView * vec4(pointOutsideEllipsoid, 1.0)).xyz;\n\
836
+ float magnitude = 1.0 / length(q);\n\
837
+ vec3 normal = normalize(q);\n\
838
+ vec3 center = magnitude * normal; \n\
839
+ \n\
840
+ czm_halfspace halfspaceInScaledSpace = czm_halfspace(center, normal);\n\
841
+ \n\
842
+ // ANGLE workaround: http://code.google.com/p/angleproject/issues/detail?id=185 \n\
843
+ czm_ellipsoidSilhouetteHalfspace temp = czm_ellipsoidSilhouetteHalfspace(ellipsoid, pointOutsideEllipsoid, halfspaceInScaledSpace);\n\
844
+ return temp;\n\
845
+ }\n\
846
+ \n\
847
+ /**\n\
848
+ * DOC_TBA\n\
849
+ *\n\
850
+ * @name czm_rayEllipsoidSilhouetteHalfspaceIntersectionInterval\n\
851
+ * @glslFunction\n\
852
+ *\n\
853
+ */\n\
558
854
  czm_raySegment czm_rayEllipsoidSilhouetteHalfspaceIntersectionInterval(czm_ray ray, czm_ellipsoidSilhouetteHalfspace halfspace)\n\
559
855
  {\n\
560
- vec3 origin = halfspace.ellipsoid.inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz;\n\
561
- vec3 direction = halfspace.ellipsoid.inverseRadii * (czm_inverseViewRotation * ray.direction);\n\
562
- czm_ray rayInScaledSpace = czm_ray(origin, direction);\n\
563
- czm_raySegment interval = czm_rayHalfspaceIntersectionInterval(rayInScaledSpace, halfspace.halfspaceInScaledSpace);\n\
564
- if (czm_isEmpty(interval))\n\
565
- {\n\
566
- return interval;\n\
567
- }\n\
568
- else\n\
569
- {\n\
570
- float start = interval.start;\n\
571
- if (start != 0.0)\n\
572
- {\n\
573
- vec3 temp = (czm_view * vec4(halfspace.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, start), 1.0)).xyz;\n\
574
- start = dot(temp, ray.direction);\n\
575
- }\n\
576
- float stop = interval.stop;\n\
577
- if (stop != czm_infinity)\n\
578
- {\n\
579
- vec3 temp = (czm_view * vec4(halfspace.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, stop), 1.0)).xyz;\n\
580
- stop = dot(temp, ray.direction);\n\
581
- }\n\
582
- return czm_raySegment(start, stop);\n\
583
- }\n\
856
+ // Determine the ray in the scaled space.\n\
857
+ vec3 origin = halfspace.ellipsoid.inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz;\n\
858
+ vec3 direction = halfspace.ellipsoid.inverseRadii * (czm_inverseViewRotation * ray.direction);\n\
859
+ czm_ray rayInScaledSpace = czm_ray(origin, direction);\n\
860
+ \n\
861
+ // Perform the intersection in the scaled space.\n\
862
+ czm_raySegment interval = czm_rayHalfspaceIntersectionInterval(rayInScaledSpace, halfspace.halfspaceInScaledSpace);\n\
863
+ \n\
864
+ if (czm_isEmpty(interval)) // No intersection.\n\
865
+ {\n\
866
+ return interval;\n\
867
+ }\n\
868
+ else // Intersection.\n\
869
+ {\n\
870
+ // Honor ray origin case (start == 0.0).\n\
871
+ float start = interval.start;\n\
872
+ if (start != 0.0)\n\
873
+ {\n\
874
+ // Determine start in unscaled space.\n\
875
+ vec3 temp = (czm_view * vec4(halfspace.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, start), 1.0)).xyz;\n\
876
+ start = dot(temp, ray.direction);\n\
877
+ }\n\
878
+ \n\
879
+ // Honor infinite ray (stop == infinity).\n\
880
+ float stop = interval.stop;\n\
881
+ if (stop != czm_infinity)\n\
882
+ {\n\
883
+ // Determine stop in unscaled space.\n\
884
+ vec3 temp = (czm_view * vec4(halfspace.ellipsoid.radii * czm_pointAlongRay(rayInScaledSpace, stop), 1.0)).xyz;\n\
885
+ stop = dot(temp, ray.direction);\n\
886
+ }\n\
887
+ \n\
888
+ return czm_raySegment(start, stop);\n\
889
+ }\n\
584
890
  }\n\
585
891
  ";
586
892
  });