@geoblocks/cesium-post-process 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/dist/analog-video.d.ts +71 -0
  2. package/dist/analog-video.d.ts.map +1 -0
  3. package/dist/analog-video.js +128 -0
  4. package/dist/analog-video.js.map +1 -0
  5. package/dist/blur.d.ts +13 -0
  6. package/dist/blur.d.ts.map +1 -0
  7. package/dist/blur.js +36 -0
  8. package/dist/blur.js.map +1 -0
  9. package/dist/cesium-post-process.d.ts +30 -0
  10. package/dist/cesium-post-process.d.ts.map +1 -0
  11. package/dist/cesium-post-process.js +31 -0
  12. package/dist/cesium-post-process.js.map +1 -0
  13. package/dist/cloud-cover.d.ts +28 -0
  14. package/dist/cloud-cover.d.ts.map +1 -0
  15. package/dist/cloud-cover.js +45 -0
  16. package/dist/cloud-cover.js.map +1 -0
  17. package/dist/cloud-map.d.ts +7 -0
  18. package/dist/cloud-map.d.ts.map +1 -0
  19. package/dist/cloud-map.js +118 -0
  20. package/dist/cloud-map.js.map +1 -0
  21. package/dist/cloud-noise.d.ts +13 -0
  22. package/dist/cloud-noise.d.ts.map +1 -0
  23. package/dist/cloud-noise.js +222 -0
  24. package/dist/cloud-noise.js.map +1 -0
  25. package/dist/clouds.d.ts +275 -0
  26. package/dist/clouds.d.ts.map +1 -0
  27. package/dist/clouds.js +642 -0
  28. package/dist/clouds.js.map +1 -0
  29. package/dist/color-isolation.d.ts +38 -0
  30. package/dist/color-isolation.d.ts.map +1 -0
  31. package/dist/color-isolation.js +61 -0
  32. package/dist/color-isolation.js.map +1 -0
  33. package/dist/depth-test.d.ts +9 -0
  34. package/dist/depth-test.d.ts.map +1 -0
  35. package/dist/depth-test.js +35 -0
  36. package/dist/depth-test.js.map +1 -0
  37. package/dist/digital-video.d.ts +47 -0
  38. package/dist/digital-video.d.ts.map +1 -0
  39. package/dist/digital-video.js +102 -0
  40. package/dist/digital-video.js.map +1 -0
  41. package/dist/drone-display.d.ts +70 -0
  42. package/dist/drone-display.d.ts.map +1 -0
  43. package/dist/drone-display.js +158 -0
  44. package/dist/drone-display.js.map +1 -0
  45. package/dist/dufour.d.ts +108 -0
  46. package/dist/dufour.d.ts.map +1 -0
  47. package/dist/dufour.js +201 -0
  48. package/dist/dufour.js.map +1 -0
  49. package/dist/effect.d.ts +33 -0
  50. package/dist/effect.d.ts.map +1 -0
  51. package/dist/effect.js +60 -0
  52. package/dist/effect.js.map +1 -0
  53. package/dist/focus.d.ts +11 -0
  54. package/dist/focus.d.ts.map +1 -0
  55. package/dist/focus.js +23 -0
  56. package/dist/focus.js.map +1 -0
  57. package/dist/frame-clock.d.ts +11 -0
  58. package/dist/frame-clock.d.ts.map +1 -0
  59. package/dist/frame-clock.js +57 -0
  60. package/dist/frame-clock.js.map +1 -0
  61. package/dist/height.d.ts +12 -0
  62. package/dist/height.d.ts.map +1 -0
  63. package/dist/height.js +22 -0
  64. package/dist/height.js.map +1 -0
  65. package/dist/infrared.d.ts +23 -0
  66. package/dist/infrared.d.ts.map +1 -0
  67. package/dist/infrared.js +36 -0
  68. package/dist/infrared.js.map +1 -0
  69. package/dist/jello.d.ts +52 -0
  70. package/dist/jello.d.ts.map +1 -0
  71. package/dist/jello.js +136 -0
  72. package/dist/jello.js.map +1 -0
  73. package/dist/lens-distortion.d.ts +33 -0
  74. package/dist/lens-distortion.d.ts.map +1 -0
  75. package/dist/lens-distortion.js +61 -0
  76. package/dist/lens-distortion.js.map +1 -0
  77. package/dist/lightning.d.ts +124 -0
  78. package/dist/lightning.d.ts.map +1 -0
  79. package/dist/lightning.js +301 -0
  80. package/dist/lightning.js.map +1 -0
  81. package/dist/local-frame.d.ts +38 -0
  82. package/dist/local-frame.d.ts.map +1 -0
  83. package/dist/local-frame.js +52 -0
  84. package/dist/local-frame.js.map +1 -0
  85. package/dist/motion-blur.d.ts +50 -0
  86. package/dist/motion-blur.d.ts.map +1 -0
  87. package/dist/motion-blur.js +108 -0
  88. package/dist/motion-blur.js.map +1 -0
  89. package/dist/precipitation.d.ts +146 -0
  90. package/dist/precipitation.d.ts.map +1 -0
  91. package/dist/precipitation.js +454 -0
  92. package/dist/precipitation.js.map +1 -0
  93. package/dist/rain-rings.d.ts +100 -0
  94. package/dist/rain-rings.d.ts.map +1 -0
  95. package/dist/rain-rings.js +181 -0
  96. package/dist/rain-rings.js.map +1 -0
  97. package/dist/shaders/Alpenglow.d.ts +3 -0
  98. package/dist/shaders/Alpenglow.d.ts.map +1 -0
  99. package/dist/shaders/Alpenglow.js +3 -0
  100. package/dist/shaders/Alpenglow.js.map +1 -0
  101. package/dist/shaders/AnalogVideo.d.ts +3 -0
  102. package/dist/shaders/AnalogVideo.d.ts.map +1 -0
  103. package/dist/shaders/AnalogVideo.js +3 -0
  104. package/dist/shaders/AnalogVideo.js.map +1 -0
  105. package/dist/shaders/Beam.d.ts +3 -0
  106. package/dist/shaders/Beam.d.ts.map +1 -0
  107. package/dist/shaders/Beam.js +3 -0
  108. package/dist/shaders/Beam.js.map +1 -0
  109. package/dist/shaders/CloudsBlur.d.ts +3 -0
  110. package/dist/shaders/CloudsBlur.d.ts.map +1 -0
  111. package/dist/shaders/CloudsBlur.js +3 -0
  112. package/dist/shaders/CloudsBlur.js.map +1 -0
  113. package/dist/shaders/CloudsComposite.d.ts +3 -0
  114. package/dist/shaders/CloudsComposite.d.ts.map +1 -0
  115. package/dist/shaders/CloudsComposite.js +3 -0
  116. package/dist/shaders/CloudsComposite.js.map +1 -0
  117. package/dist/shaders/CloudsDensity.d.ts +3 -0
  118. package/dist/shaders/CloudsDensity.d.ts.map +1 -0
  119. package/dist/shaders/CloudsDensity.js +3 -0
  120. package/dist/shaders/CloudsDensity.js.map +1 -0
  121. package/dist/shaders/CloudsDepth.d.ts +3 -0
  122. package/dist/shaders/CloudsDepth.d.ts.map +1 -0
  123. package/dist/shaders/CloudsDepth.js +3 -0
  124. package/dist/shaders/CloudsDepth.js.map +1 -0
  125. package/dist/shaders/CloudsMarch.d.ts +3 -0
  126. package/dist/shaders/CloudsMarch.d.ts.map +1 -0
  127. package/dist/shaders/CloudsMarch.js +3 -0
  128. package/dist/shaders/CloudsMarch.js.map +1 -0
  129. package/dist/shaders/CloudsResolve.d.ts +3 -0
  130. package/dist/shaders/CloudsResolve.d.ts.map +1 -0
  131. package/dist/shaders/CloudsResolve.js +3 -0
  132. package/dist/shaders/CloudsResolve.js.map +1 -0
  133. package/dist/shaders/CloudsShadow.d.ts +3 -0
  134. package/dist/shaders/CloudsShadow.d.ts.map +1 -0
  135. package/dist/shaders/CloudsShadow.js +3 -0
  136. package/dist/shaders/CloudsShadow.js.map +1 -0
  137. package/dist/shaders/CloudsShadowMap.d.ts +3 -0
  138. package/dist/shaders/CloudsShadowMap.d.ts.map +1 -0
  139. package/dist/shaders/CloudsShadowMap.js +3 -0
  140. package/dist/shaders/CloudsShadowMap.js.map +1 -0
  141. package/dist/shaders/CloudsSlab.d.ts +3 -0
  142. package/dist/shaders/CloudsSlab.d.ts.map +1 -0
  143. package/dist/shaders/CloudsSlab.js +3 -0
  144. package/dist/shaders/CloudsSlab.js.map +1 -0
  145. package/dist/shaders/ColorIsolation.d.ts +3 -0
  146. package/dist/shaders/ColorIsolation.d.ts.map +1 -0
  147. package/dist/shaders/ColorIsolation.js +3 -0
  148. package/dist/shaders/ColorIsolation.js.map +1 -0
  149. package/dist/shaders/DepthEdges.d.ts +3 -0
  150. package/dist/shaders/DepthEdges.d.ts.map +1 -0
  151. package/dist/shaders/DepthEdges.js +3 -0
  152. package/dist/shaders/DepthEdges.js.map +1 -0
  153. package/dist/shaders/DigitalVideo.d.ts +3 -0
  154. package/dist/shaders/DigitalVideo.d.ts.map +1 -0
  155. package/dist/shaders/DigitalVideo.js +3 -0
  156. package/dist/shaders/DigitalVideo.js.map +1 -0
  157. package/dist/shaders/DroneDisplay.d.ts +3 -0
  158. package/dist/shaders/DroneDisplay.d.ts.map +1 -0
  159. package/dist/shaders/DroneDisplay.js +3 -0
  160. package/dist/shaders/DroneDisplay.js.map +1 -0
  161. package/dist/shaders/Dufour.d.ts +3 -0
  162. package/dist/shaders/Dufour.d.ts.map +1 -0
  163. package/dist/shaders/Dufour.js +3 -0
  164. package/dist/shaders/Dufour.js.map +1 -0
  165. package/dist/shaders/EyeFromDepth.d.ts +3 -0
  166. package/dist/shaders/EyeFromDepth.d.ts.map +1 -0
  167. package/dist/shaders/EyeFromDepth.js +3 -0
  168. package/dist/shaders/EyeFromDepth.js.map +1 -0
  169. package/dist/shaders/Filmic.d.ts +3 -0
  170. package/dist/shaders/Filmic.d.ts.map +1 -0
  171. package/dist/shaders/Filmic.js +3 -0
  172. package/dist/shaders/Filmic.js.map +1 -0
  173. package/dist/shaders/Flashlight.d.ts +3 -0
  174. package/dist/shaders/Flashlight.d.ts.map +1 -0
  175. package/dist/shaders/Flashlight.js +3 -0
  176. package/dist/shaders/Flashlight.js.map +1 -0
  177. package/dist/shaders/Fog.d.ts +3 -0
  178. package/dist/shaders/Fog.d.ts.map +1 -0
  179. package/dist/shaders/Fog.js +3 -0
  180. package/dist/shaders/Fog.js.map +1 -0
  181. package/dist/shaders/Frame.d.ts +3 -0
  182. package/dist/shaders/Frame.d.ts.map +1 -0
  183. package/dist/shaders/Frame.js +3 -0
  184. package/dist/shaders/Frame.js.map +1 -0
  185. package/dist/shaders/Hash.d.ts +3 -0
  186. package/dist/shaders/Hash.d.ts.map +1 -0
  187. package/dist/shaders/Hash.js +3 -0
  188. package/dist/shaders/Hash.js.map +1 -0
  189. package/dist/shaders/Height.d.ts +3 -0
  190. package/dist/shaders/Height.d.ts.map +1 -0
  191. package/dist/shaders/Height.js +3 -0
  192. package/dist/shaders/Height.js.map +1 -0
  193. package/dist/shaders/Infrared.d.ts +3 -0
  194. package/dist/shaders/Infrared.d.ts.map +1 -0
  195. package/dist/shaders/Infrared.js +3 -0
  196. package/dist/shaders/Infrared.js.map +1 -0
  197. package/dist/shaders/Jello.d.ts +3 -0
  198. package/dist/shaders/Jello.d.ts.map +1 -0
  199. package/dist/shaders/Jello.js +3 -0
  200. package/dist/shaders/Jello.js.map +1 -0
  201. package/dist/shaders/LensDistortion.d.ts +3 -0
  202. package/dist/shaders/LensDistortion.d.ts.map +1 -0
  203. package/dist/shaders/LensDistortion.js +3 -0
  204. package/dist/shaders/LensDistortion.js.map +1 -0
  205. package/dist/shaders/Lightning.d.ts +3 -0
  206. package/dist/shaders/Lightning.d.ts.map +1 -0
  207. package/dist/shaders/Lightning.js +3 -0
  208. package/dist/shaders/Lightning.js.map +1 -0
  209. package/dist/shaders/MotionBlur.d.ts +3 -0
  210. package/dist/shaders/MotionBlur.d.ts.map +1 -0
  211. package/dist/shaders/MotionBlur.js +3 -0
  212. package/dist/shaders/MotionBlur.js.map +1 -0
  213. package/dist/shaders/MotionBlurVelocity.d.ts +3 -0
  214. package/dist/shaders/MotionBlurVelocity.d.ts.map +1 -0
  215. package/dist/shaders/MotionBlurVelocity.js +3 -0
  216. package/dist/shaders/MotionBlurVelocity.js.map +1 -0
  217. package/dist/shaders/Noise.d.ts +3 -0
  218. package/dist/shaders/Noise.d.ts.map +1 -0
  219. package/dist/shaders/Noise.js +3 -0
  220. package/dist/shaders/Noise.js.map +1 -0
  221. package/dist/shaders/Normal.d.ts +3 -0
  222. package/dist/shaders/Normal.d.ts.map +1 -0
  223. package/dist/shaders/Normal.js +3 -0
  224. package/dist/shaders/Normal.js.map +1 -0
  225. package/dist/shaders/Phase.d.ts +3 -0
  226. package/dist/shaders/Phase.d.ts.map +1 -0
  227. package/dist/shaders/Phase.js +3 -0
  228. package/dist/shaders/Phase.js.map +1 -0
  229. package/dist/shaders/Precipitation.d.ts +3 -0
  230. package/dist/shaders/Precipitation.d.ts.map +1 -0
  231. package/dist/shaders/Precipitation.js +3 -0
  232. package/dist/shaders/Precipitation.js.map +1 -0
  233. package/dist/shaders/PrecipitationShaftBlur.d.ts +3 -0
  234. package/dist/shaders/PrecipitationShaftBlur.d.ts.map +1 -0
  235. package/dist/shaders/PrecipitationShaftBlur.js +3 -0
  236. package/dist/shaders/PrecipitationShaftBlur.js.map +1 -0
  237. package/dist/shaders/PrecipitationShafts.d.ts +3 -0
  238. package/dist/shaders/PrecipitationShafts.d.ts.map +1 -0
  239. package/dist/shaders/PrecipitationShafts.js +3 -0
  240. package/dist/shaders/PrecipitationShafts.js.map +1 -0
  241. package/dist/shaders/PrecipitationWind.d.ts +3 -0
  242. package/dist/shaders/PrecipitationWind.d.ts.map +1 -0
  243. package/dist/shaders/PrecipitationWind.js +3 -0
  244. package/dist/shaders/PrecipitationWind.js.map +1 -0
  245. package/dist/shaders/RainHaze.d.ts +3 -0
  246. package/dist/shaders/RainHaze.d.ts.map +1 -0
  247. package/dist/shaders/RainHaze.js +3 -0
  248. package/dist/shaders/RainHaze.js.map +1 -0
  249. package/dist/shaders/RainRings.d.ts +3 -0
  250. package/dist/shaders/RainRings.d.ts.map +1 -0
  251. package/dist/shaders/RainRings.js +3 -0
  252. package/dist/shaders/RainRings.js.map +1 -0
  253. package/dist/shaders/Shockwave.d.ts +3 -0
  254. package/dist/shaders/Shockwave.d.ts.map +1 -0
  255. package/dist/shaders/Shockwave.js +3 -0
  256. package/dist/shaders/Shockwave.js.map +1 -0
  257. package/dist/shaders/SkyTable.d.ts +3 -0
  258. package/dist/shaders/SkyTable.d.ts.map +1 -0
  259. package/dist/shaders/SkyTable.js +3 -0
  260. package/dist/shaders/SkyTable.js.map +1 -0
  261. package/dist/shaders/SnowLine.d.ts +3 -0
  262. package/dist/shaders/SnowLine.d.ts.map +1 -0
  263. package/dist/shaders/SnowLine.js +3 -0
  264. package/dist/shaders/SnowLine.js.map +1 -0
  265. package/dist/shaders/SpeedLines.d.ts +3 -0
  266. package/dist/shaders/SpeedLines.d.ts.map +1 -0
  267. package/dist/shaders/SpeedLines.js +3 -0
  268. package/dist/shaders/SpeedLines.js.map +1 -0
  269. package/dist/shaders/Spotlight.d.ts +3 -0
  270. package/dist/shaders/Spotlight.d.ts.map +1 -0
  271. package/dist/shaders/Spotlight.js +3 -0
  272. package/dist/shaders/Spotlight.js.map +1 -0
  273. package/dist/shaders/SpotlightBeam.d.ts +3 -0
  274. package/dist/shaders/SpotlightBeam.d.ts.map +1 -0
  275. package/dist/shaders/SpotlightBeam.js +3 -0
  276. package/dist/shaders/SpotlightBeam.js.map +1 -0
  277. package/dist/shaders/SpotlightBeamBlur.d.ts +3 -0
  278. package/dist/shaders/SpotlightBeamBlur.d.ts.map +1 -0
  279. package/dist/shaders/SpotlightBeamBlur.js +3 -0
  280. package/dist/shaders/SpotlightBeamBlur.js.map +1 -0
  281. package/dist/shaders/SpotlightCone.d.ts +3 -0
  282. package/dist/shaders/SpotlightCone.d.ts.map +1 -0
  283. package/dist/shaders/SpotlightCone.js +3 -0
  284. package/dist/shaders/SpotlightCone.js.map +1 -0
  285. package/dist/shaders/Super8.d.ts +3 -0
  286. package/dist/shaders/Super8.d.ts.map +1 -0
  287. package/dist/shaders/Super8.js +3 -0
  288. package/dist/shaders/Super8.js.map +1 -0
  289. package/dist/shaders/Technicolor.d.ts +3 -0
  290. package/dist/shaders/Technicolor.d.ts.map +1 -0
  291. package/dist/shaders/Technicolor.js +3 -0
  292. package/dist/shaders/Technicolor.js.map +1 -0
  293. package/dist/shaders/TiltShift.d.ts +3 -0
  294. package/dist/shaders/TiltShift.d.ts.map +1 -0
  295. package/dist/shaders/TiltShift.js +3 -0
  296. package/dist/shaders/TiltShift.js.map +1 -0
  297. package/dist/shaders/Toy.d.ts +3 -0
  298. package/dist/shaders/Toy.d.ts.map +1 -0
  299. package/dist/shaders/Toy.js +3 -0
  300. package/dist/shaders/Toy.js.map +1 -0
  301. package/dist/shaders/Trails.d.ts +3 -0
  302. package/dist/shaders/Trails.d.ts.map +1 -0
  303. package/dist/shaders/Trails.js +3 -0
  304. package/dist/shaders/Trails.js.map +1 -0
  305. package/dist/shaders/ValleyFog.d.ts +3 -0
  306. package/dist/shaders/ValleyFog.d.ts.map +1 -0
  307. package/dist/shaders/ValleyFog.js +3 -0
  308. package/dist/shaders/ValleyFog.js.map +1 -0
  309. package/dist/shaders/WeatherMap.d.ts +3 -0
  310. package/dist/shaders/WeatherMap.d.ts.map +1 -0
  311. package/dist/shaders/WeatherMap.js +3 -0
  312. package/dist/shaders/WeatherMap.js.map +1 -0
  313. package/dist/shaders/WhiteModel.d.ts +3 -0
  314. package/dist/shaders/WhiteModel.d.ts.map +1 -0
  315. package/dist/shaders/WhiteModel.js +3 -0
  316. package/dist/shaders/WhiteModel.js.map +1 -0
  317. package/dist/snow-line.d.ts +117 -0
  318. package/dist/snow-line.d.ts.map +1 -0
  319. package/dist/snow-line.js +201 -0
  320. package/dist/snow-line.js.map +1 -0
  321. package/dist/speed-lines.d.ts +36 -0
  322. package/dist/speed-lines.d.ts.map +1 -0
  323. package/dist/speed-lines.js +65 -0
  324. package/dist/speed-lines.js.map +1 -0
  325. package/dist/spotlight.d.ts +84 -0
  326. package/dist/spotlight.d.ts.map +1 -0
  327. package/dist/spotlight.js +175 -0
  328. package/dist/spotlight.js.map +1 -0
  329. package/dist/strikes.d.ts +17 -0
  330. package/dist/strikes.d.ts.map +1 -0
  331. package/dist/strikes.js +30 -0
  332. package/dist/strikes.js.map +1 -0
  333. package/dist/super8.d.ts +78 -0
  334. package/dist/super8.d.ts.map +1 -0
  335. package/dist/super8.js +146 -0
  336. package/dist/super8.js.map +1 -0
  337. package/dist/technicolor.d.ts +32 -0
  338. package/dist/technicolor.d.ts.map +1 -0
  339. package/dist/technicolor.js +51 -0
  340. package/dist/technicolor.js.map +1 -0
  341. package/dist/tilt-shift.d.ts +60 -0
  342. package/dist/tilt-shift.d.ts.map +1 -0
  343. package/dist/tilt-shift.js +112 -0
  344. package/dist/tilt-shift.js.map +1 -0
  345. package/dist/toy.d.ts +110 -0
  346. package/dist/toy.d.ts.map +1 -0
  347. package/dist/toy.js +173 -0
  348. package/dist/toy.js.map +1 -0
  349. package/dist/valley-fog.d.ts +56 -0
  350. package/dist/valley-fog.d.ts.map +1 -0
  351. package/dist/valley-fog.js +94 -0
  352. package/dist/valley-fog.js.map +1 -0
  353. package/dist/weather-map.d.ts +132 -0
  354. package/dist/weather-map.d.ts.map +1 -0
  355. package/dist/weather-map.js +266 -0
  356. package/dist/weather-map.js.map +1 -0
  357. package/dist/white-model.d.ts +70 -0
  358. package/dist/white-model.d.ts.map +1 -0
  359. package/dist/white-model.js +94 -0
  360. package/dist/white-model.js.map +1 -0
  361. package/package.json +19 -40
  362. package/{cesium-post-process.js → src/cesium-post-process.js} +2 -0
  363. package/src/shaders/AnalogVideo.glsl +132 -0
  364. package/src/shaders/Beam.glsl +108 -0
  365. package/src/shaders/CloudsBlur.glsl +30 -0
  366. package/src/shaders/CloudsComposite.glsl +59 -0
  367. package/src/shaders/CloudsDensity.glsl +129 -0
  368. package/src/shaders/CloudsDepth.glsl +26 -0
  369. package/src/shaders/CloudsMarch.glsl +174 -0
  370. package/src/shaders/CloudsResolve.glsl +46 -0
  371. package/src/shaders/CloudsShadow.glsl +50 -0
  372. package/src/shaders/CloudsShadowMap.glsl +68 -0
  373. package/src/shaders/CloudsSlab.glsl +58 -0
  374. package/src/shaders/ColorIsolation.glsl +26 -0
  375. package/src/shaders/DepthEdges.glsl +81 -0
  376. package/src/shaders/DigitalVideo.glsl +65 -0
  377. package/src/shaders/DroneDisplay.glsl +337 -0
  378. package/src/shaders/Dufour.glsl +109 -0
  379. package/src/shaders/EyeFromDepth.glsl +36 -0
  380. package/src/shaders/Filmic.glsl +5 -0
  381. package/src/shaders/Fog.glsl +18 -0
  382. package/src/shaders/Frame.glsl +10 -0
  383. package/src/shaders/Hash.glsl +12 -0
  384. package/src/shaders/Height.glsl +25 -0
  385. package/src/shaders/Infrared.glsl +44 -0
  386. package/src/shaders/Jello.glsl +41 -0
  387. package/src/shaders/LensDistortion.glsl +24 -0
  388. package/src/shaders/Lightning.glsl +257 -0
  389. package/src/shaders/MotionBlur.glsl +71 -0
  390. package/src/shaders/MotionBlurVelocity.glsl +31 -0
  391. package/src/shaders/Noise.glsl +43 -0
  392. package/src/shaders/Normal.glsl +21 -0
  393. package/src/shaders/Phase.glsl +6 -0
  394. package/src/shaders/Precipitation.glsl +199 -0
  395. package/src/shaders/PrecipitationShaftBlur.glsl +21 -0
  396. package/src/shaders/PrecipitationShafts.glsl +84 -0
  397. package/src/shaders/PrecipitationWind.glsl +33 -0
  398. package/src/shaders/RainHaze.glsl +145 -0
  399. package/src/shaders/RainRings.glsl +64 -0
  400. package/src/shaders/SkyTable.glsl +23 -0
  401. package/src/shaders/SnowLine.glsl +97 -0
  402. package/src/shaders/SpeedLines.glsl +61 -0
  403. package/src/shaders/Spotlight.glsl +89 -0
  404. package/src/shaders/SpotlightBeam.glsl +49 -0
  405. package/src/shaders/SpotlightBeamBlur.glsl +27 -0
  406. package/src/shaders/SpotlightCone.glsl +37 -0
  407. package/src/shaders/Super8.glsl +90 -0
  408. package/src/shaders/Technicolor.glsl +30 -0
  409. package/src/shaders/TiltShift.glsl +34 -0
  410. package/src/shaders/Toy.glsl +46 -0
  411. package/src/shaders/ValleyFog.glsl +40 -0
  412. package/src/shaders/WeatherMap.glsl +33 -0
  413. package/src/shaders/WhiteModel.glsl +108 -0
  414. /package/{analog-video.js → src/analog-video.js} +0 -0
  415. /package/{blur.js → src/blur.js} +0 -0
  416. /package/{cloud-cover.js → src/cloud-cover.js} +0 -0
  417. /package/{cloud-map.js → src/cloud-map.js} +0 -0
  418. /package/{cloud-noise.js → src/cloud-noise.js} +0 -0
  419. /package/{clouds.js → src/clouds.js} +0 -0
  420. /package/{color-isolation.js → src/color-isolation.js} +0 -0
  421. /package/{depth-test.js → src/depth-test.js} +0 -0
  422. /package/{digital-video.js → src/digital-video.js} +0 -0
  423. /package/{drone-display.js → src/drone-display.js} +0 -0
  424. /package/{dufour.js → src/dufour.js} +0 -0
  425. /package/{effect.js → src/effect.js} +0 -0
  426. /package/{focus.js → src/focus.js} +0 -0
  427. /package/{frame-clock.js → src/frame-clock.js} +0 -0
  428. /package/{height.js → src/height.js} +0 -0
  429. /package/{infrared.js → src/infrared.js} +0 -0
  430. /package/{jello.js → src/jello.js} +0 -0
  431. /package/{lens-distortion.js → src/lens-distortion.js} +0 -0
  432. /package/{lightning.js → src/lightning.js} +0 -0
  433. /package/{local-frame.js → src/local-frame.js} +0 -0
  434. /package/{motion-blur.js → src/motion-blur.js} +0 -0
  435. /package/{precipitation.js → src/precipitation.js} +0 -0
  436. /package/{rain-rings.js → src/rain-rings.js} +0 -0
  437. /package/{shaders → src/shaders}/Alpenglow.js +0 -0
  438. /package/{shaders → src/shaders}/AnalogVideo.js +0 -0
  439. /package/{shaders → src/shaders}/Beam.js +0 -0
  440. /package/{shaders → src/shaders}/CloudsBlur.js +0 -0
  441. /package/{shaders → src/shaders}/CloudsComposite.js +0 -0
  442. /package/{shaders → src/shaders}/CloudsDensity.js +0 -0
  443. /package/{shaders → src/shaders}/CloudsDepth.js +0 -0
  444. /package/{shaders → src/shaders}/CloudsMarch.js +0 -0
  445. /package/{shaders → src/shaders}/CloudsResolve.js +0 -0
  446. /package/{shaders → src/shaders}/CloudsShadow.js +0 -0
  447. /package/{shaders → src/shaders}/CloudsShadowMap.js +0 -0
  448. /package/{shaders → src/shaders}/CloudsSlab.js +0 -0
  449. /package/{shaders → src/shaders}/ColorIsolation.js +0 -0
  450. /package/{shaders → src/shaders}/DepthEdges.js +0 -0
  451. /package/{shaders → src/shaders}/DigitalVideo.js +0 -0
  452. /package/{shaders → src/shaders}/DroneDisplay.js +0 -0
  453. /package/{shaders → src/shaders}/Dufour.js +0 -0
  454. /package/{shaders → src/shaders}/EyeFromDepth.js +0 -0
  455. /package/{shaders → src/shaders}/Filmic.js +0 -0
  456. /package/{shaders → src/shaders}/Flashlight.js +0 -0
  457. /package/{shaders → src/shaders}/Fog.js +0 -0
  458. /package/{shaders → src/shaders}/Frame.js +0 -0
  459. /package/{shaders → src/shaders}/Hash.js +0 -0
  460. /package/{shaders → src/shaders}/Height.js +0 -0
  461. /package/{shaders → src/shaders}/Infrared.js +0 -0
  462. /package/{shaders → src/shaders}/Jello.js +0 -0
  463. /package/{shaders → src/shaders}/LensDistortion.js +0 -0
  464. /package/{shaders → src/shaders}/Lightning.js +0 -0
  465. /package/{shaders → src/shaders}/MotionBlur.js +0 -0
  466. /package/{shaders → src/shaders}/MotionBlurVelocity.js +0 -0
  467. /package/{shaders → src/shaders}/Noise.js +0 -0
  468. /package/{shaders → src/shaders}/Normal.js +0 -0
  469. /package/{shaders → src/shaders}/Phase.js +0 -0
  470. /package/{shaders → src/shaders}/Precipitation.js +0 -0
  471. /package/{shaders → src/shaders}/PrecipitationShaftBlur.js +0 -0
  472. /package/{shaders → src/shaders}/PrecipitationShafts.js +0 -0
  473. /package/{shaders → src/shaders}/PrecipitationWind.js +0 -0
  474. /package/{shaders → src/shaders}/RainHaze.js +0 -0
  475. /package/{shaders → src/shaders}/RainRings.js +0 -0
  476. /package/{shaders → src/shaders}/Shockwave.js +0 -0
  477. /package/{shaders → src/shaders}/SkyTable.js +0 -0
  478. /package/{shaders → src/shaders}/SnowLine.js +0 -0
  479. /package/{shaders → src/shaders}/SpeedLines.js +0 -0
  480. /package/{shaders → src/shaders}/Spotlight.js +0 -0
  481. /package/{shaders → src/shaders}/SpotlightBeam.js +0 -0
  482. /package/{shaders → src/shaders}/SpotlightBeamBlur.js +0 -0
  483. /package/{shaders → src/shaders}/SpotlightCone.js +0 -0
  484. /package/{shaders → src/shaders}/Super8.js +0 -0
  485. /package/{shaders → src/shaders}/Technicolor.js +0 -0
  486. /package/{shaders → src/shaders}/TiltShift.js +0 -0
  487. /package/{shaders → src/shaders}/Toy.js +0 -0
  488. /package/{shaders → src/shaders}/Trails.js +0 -0
  489. /package/{shaders → src/shaders}/ValleyFog.js +0 -0
  490. /package/{shaders → src/shaders}/WeatherMap.js +0 -0
  491. /package/{shaders → src/shaders}/WhiteModel.js +0 -0
  492. /package/{snow-line.js → src/snow-line.js} +0 -0
  493. /package/{speed-lines.js → src/speed-lines.js} +0 -0
  494. /package/{spotlight.js → src/spotlight.js} +0 -0
  495. /package/{strikes.js → src/strikes.js} +0 -0
  496. /package/{super8.js → src/super8.js} +0 -0
  497. /package/{technicolor.js → src/technicolor.js} +0 -0
  498. /package/{tilt-shift.js → src/tilt-shift.js} +0 -0
  499. /package/{toy.js → src/toy.js} +0 -0
  500. /package/{valley-fog.js → src/valley-fog.js} +0 -0
  501. /package/{weather-map.js → src/weather-map.js} +0 -0
  502. /package/{white-model.js → src/white-model.js} +0 -0
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The clouds accumulated over the frames, at the march's resolution: each frame's march, jittered\n// anew, blended into the clouds of the previous frames, reprojected to where they are seen now, as\n// Frostbite's, whose 14 samples a frame \"look converged\" (Hillaire 2016, sec. 5.5.3). The previous\n// frames' clouds are reprojected through where the ray enters the slab, near what is seen of them\n// from outside, rather than through their transmittance-weighted distance (Sakmary 2022), which the\n// march has no channel left for, and clamped to the current frame's 3 x 3 neighborhood so that they\n// do not trail behind what moved. Needs EyeFromDepth, Height and CloudsSlab.\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n// the farthest distance of the scene in this texel's block of pixels, from CloudsDepth.glsl\nuniform sampler2D cloudDepth;\n// this frame's march, and the accumulation of the previous frames, from clouds.js\nuniform sampler2D cloudTexture;\nuniform sampler2D historyTexture;\n// from the eye coordinates of this frame to the clip coordinates of the previous one\nuniform mat4 reprojection;\n// the share of the previous frames in the blend, 0 when there are none\nuniform float historyWeight;\nin vec2 v_textureCoordinates;\n\n// inside the slab, the clouds are reprojected through a point this far along the ray, in meters\nconst float INSIDE_DISTANCE = 2000.0;\n\nvoid main() {\n vec4 current = texture(cloudTexture, v_textureCoordinates);\n // czm_viewport is this pass's texture, the march's size\n vec2 texel = 1.0 / czm_viewport.zw;\n vec4 low = current;\n vec4 high = current;\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec4 neighbor = texture(cloudTexture, v_textureCoordinates + vec2(float(x), float(y)) * texel);\n low = min(low, neighbor);\n high = max(high, neighbor);\n }\n }\n vec3 direction = normalize(eyeAt(depthTexture, v_textureCoordinates).xyz);\n vec2 segment = slab(dot(direction, up), texture(cloudDepth, v_textureCoordinates).r, slabTop);\n // where the ray misses the slab, nothing is there to move: only the view turns\n vec4 point = segment.y > segment.x ? vec4(direction * max(segment.x, min(segment.y, INSIDE_DISTANCE)), 1.0) : vec4(direction, 0.0);\n vec4 clip = reprojection * point;\n vec2 previous = clip.xy / clip.w * 0.5 + 0.5;\n bool seen = clip.w > 0.0 && all(greaterThanEqual(previous, vec2(0.0))) && all(lessThanEqual(previous, vec2(1.0)));\n vec4 history = clamp(texture(historyTexture, previous), low, high);\n out_FragColor = mix(current, history, seen ? historyWeight : 0.0);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=CloudsResolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsResolve.d.ts","sourceRoot":"","sources":["../../src/shaders/CloudsResolve.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from CloudsResolve.glsl.
2
+ export default "// The clouds accumulated over the frames, at the march's resolution: each frame's march, jittered\n// anew, blended into the clouds of the previous frames, reprojected to where they are seen now, as\n// Frostbite's, whose 14 samples a frame \"look converged\" (Hillaire 2016, sec. 5.5.3). The previous\n// frames' clouds are reprojected through where the ray enters the slab, near what is seen of them\n// from outside, rather than through their transmittance-weighted distance (Sakmary 2022), which the\n// march has no channel left for, and clamped to the current frame's 3 x 3 neighborhood so that they\n// do not trail behind what moved. Needs EyeFromDepth, Height and CloudsSlab.\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n// the farthest distance of the scene in this texel's block of pixels, from CloudsDepth.glsl\nuniform sampler2D cloudDepth;\n// this frame's march, and the accumulation of the previous frames, from clouds.js\nuniform sampler2D cloudTexture;\nuniform sampler2D historyTexture;\n// from the eye coordinates of this frame to the clip coordinates of the previous one\nuniform mat4 reprojection;\n// the share of the previous frames in the blend, 0 when there are none\nuniform float historyWeight;\nin vec2 v_textureCoordinates;\n\n// inside the slab, the clouds are reprojected through a point this far along the ray, in meters\nconst float INSIDE_DISTANCE = 2000.0;\n\nvoid main() {\n vec4 current = texture(cloudTexture, v_textureCoordinates);\n // czm_viewport is this pass's texture, the march's size\n vec2 texel = 1.0 / czm_viewport.zw;\n vec4 low = current;\n vec4 high = current;\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec4 neighbor = texture(cloudTexture, v_textureCoordinates + vec2(float(x), float(y)) * texel);\n low = min(low, neighbor);\n high = max(high, neighbor);\n }\n }\n vec3 direction = normalize(eyeAt(depthTexture, v_textureCoordinates).xyz);\n vec2 segment = slab(dot(direction, up), texture(cloudDepth, v_textureCoordinates).r, slabTop);\n // where the ray misses the slab, nothing is there to move: only the view turns\n vec4 point = segment.y > segment.x ? vec4(direction * max(segment.x, min(segment.y, INSIDE_DISTANCE)), 1.0) : vec4(direction, 0.0);\n vec4 clip = reprojection * point;\n vec2 previous = clip.xy / clip.w * 0.5 + 0.5;\n bool seen = clip.w > 0.0 && all(greaterThanEqual(previous, vec2(0.0))) && all(lessThanEqual(previous, vec2(1.0)));\n vec4 history = clamp(texture(historyTexture, previous), low, high);\n out_FragColor = mix(current, history, seen ? historyWeight : 0.0);\n}\n";
3
+ //# sourceMappingURL=CloudsResolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsResolve.js","sourceRoot":"","sources":["../../src/shaders/CloudsResolve.js"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAe,8kFAA8kF,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The clouds' shadow map, a Beer shadow map: across an area around the camera, seen from the sun,\n// the optical depth of the clouds along the sun's rays, from the top of the slab down to each\n// quarter of its height, so that a point finds how much cloud lies between it and the sun. One\n// read rather than a march toward the sun, as Unreal's (it loses only the \"volumetric self shadow\n// color\") and three-clouds' in WebGL2.\nprecision highp sampler2D;\nuniform sampler2D shadowMap;\n// the ground point the map is centered on, in world coordinates, and the base and the top of the\n// slab it covers, in meters above the ellipsoid, from clouds.js\nuniform vec3 shadowCenter;\n// the map's side, in meters, wider as the camera is higher, from clouds.js\nuniform float shadowExtent;\nuniform float shadowBase;\nuniform float shadowTop;\n\n// the shadow fades out over the outer share of the map's half side, so that its edge does not show\nconst float SHADOW_FADE = 0.2;\n\n// the axes of the map, across the sun's rays: the sun's direction in world coordinates crossed\n// with the up at its center, and the third direction\nvoid shadowAxes(out vec3 across, out vec3 along) {\n vec3 up = normalize(shadowCenter);\n across = cross(czm_lightDirectionWC, up);\n across = dot(across, across) > 1e-6 ? normalize(across) : normalize(cross(czm_lightDirectionWC, vec3(1.0, 0.0, 0.0)));\n along = cross(czm_lightDirectionWC, across);\n}\n\n// a point's height above the sphere through the map's center: over the map, it differs from the\n// height above the ellipsoid by meters\nfloat shadowHeight(vec3 positionWC) {\n return length(positionWC) - length(shadowCenter);\n}\n\n// the optical depth of the clouds between a point in world coordinates and the sun, 0 off the map\nfloat shadowDepth(vec3 positionWC) {\n vec3 across;\n vec3 along;\n shadowAxes(across, along);\n vec3 offset = positionWC - shadowCenter;\n vec2 uv = vec2(dot(offset, across), dot(offset, along)) / shadowExtent + 0.5;\n float edge = 2.0 * max(abs(uv.x - 0.5), abs(uv.y - 0.5));\n if (edge >= 1.0) {\n return 0.0;\n }\n float fade = 1.0 - smoothstep(1.0 - SHADOW_FADE, 1.0, edge);\n vec4 depths = texture(shadowMap, uv);\n // the share of the slab above the point, in quarters, through the depths at each\n float f = 4.0 * clamp((shadowTop - shadowHeight(positionWC)) / max(shadowTop - shadowBase, 1.0), 0.0, 1.0);\n return fade * (f < 1.0 ? f * depths.x : f < 2.0 ? mix(depths.x, depths.y, f - 1.0) : f < 3.0 ? mix(depths.y, depths.z, f - 2.0) : mix(depths.z, depths.w, f - 3.0));\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=CloudsShadow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsShadow.d.ts","sourceRoot":"","sources":["../../src/shaders/CloudsShadow.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from CloudsShadow.glsl.
2
+ export default "// The clouds' shadow map, a Beer shadow map: across an area around the camera, seen from the sun,\n// the optical depth of the clouds along the sun's rays, from the top of the slab down to each\n// quarter of its height, so that a point finds how much cloud lies between it and the sun. One\n// read rather than a march toward the sun, as Unreal's (it loses only the \"volumetric self shadow\n// color\") and three-clouds' in WebGL2.\nprecision highp sampler2D;\nuniform sampler2D shadowMap;\n// the ground point the map is centered on, in world coordinates, and the base and the top of the\n// slab it covers, in meters above the ellipsoid, from clouds.js\nuniform vec3 shadowCenter;\n// the map's side, in meters, wider as the camera is higher, from clouds.js\nuniform float shadowExtent;\nuniform float shadowBase;\nuniform float shadowTop;\n\n// the shadow fades out over the outer share of the map's half side, so that its edge does not show\nconst float SHADOW_FADE = 0.2;\n\n// the axes of the map, across the sun's rays: the sun's direction in world coordinates crossed\n// with the up at its center, and the third direction\nvoid shadowAxes(out vec3 across, out vec3 along) {\n vec3 up = normalize(shadowCenter);\n across = cross(czm_lightDirectionWC, up);\n across = dot(across, across) > 1e-6 ? normalize(across) : normalize(cross(czm_lightDirectionWC, vec3(1.0, 0.0, 0.0)));\n along = cross(czm_lightDirectionWC, across);\n}\n\n// a point's height above the sphere through the map's center: over the map, it differs from the\n// height above the ellipsoid by meters\nfloat shadowHeight(vec3 positionWC) {\n return length(positionWC) - length(shadowCenter);\n}\n\n// the optical depth of the clouds between a point in world coordinates and the sun, 0 off the map\nfloat shadowDepth(vec3 positionWC) {\n vec3 across;\n vec3 along;\n shadowAxes(across, along);\n vec3 offset = positionWC - shadowCenter;\n vec2 uv = vec2(dot(offset, across), dot(offset, along)) / shadowExtent + 0.5;\n float edge = 2.0 * max(abs(uv.x - 0.5), abs(uv.y - 0.5));\n if (edge >= 1.0) {\n return 0.0;\n }\n float fade = 1.0 - smoothstep(1.0 - SHADOW_FADE, 1.0, edge);\n vec4 depths = texture(shadowMap, uv);\n // the share of the slab above the point, in quarters, through the depths at each\n float f = 4.0 * clamp((shadowTop - shadowHeight(positionWC)) / max(shadowTop - shadowBase, 1.0), 0.0, 1.0);\n return fade * (f < 1.0 ? f * depths.x : f < 2.0 ? mix(depths.x, depths.y, f - 1.0) : f < 3.0 ? mix(depths.y, depths.z, f - 2.0) : mix(depths.z, depths.w, f - 3.0));\n}\n";
3
+ //# sourceMappingURL=CloudsShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsShadow.js","sourceRoot":"","sources":["../../src/shaders/CloudsShadow.js"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAe,whFAAwhF,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The clouds' shadow map, drawn by clouds.js into its own texture: for each texel, the sun's ray\n// through it marched from the top of the slab down to its base, the optical depth of the clouds\n// kept at each quarter of the slab's height, unless the ray crosses no clouds. Needs CloudsSlab,\n// WeatherMap, Noise, CloudsDensity and CloudsShadow.\n// the highest coverage around each block of the clouds' map, from weather-map.js\nprecision highp sampler2D;\nuniform sampler2D maxMap;\nin vec2 v_textureCoordinates;\n\n// the steps along each ray, 4 for each quarter, and the texels across, clouds.js's SHADOW_SIZE, for\n// a texel's footprint, for the noise's mipmap\nconst int SHADOW_STEPS = 16;\nconst float SHADOW_SIZE = 512.0;\n// the ray is probed at this many points of the max map before its march, as the clouds' march, and\n// skipped where they find no clouds: the max map's 12 km windows overlap between probes as long as\n// the ray crosses the slab over less than about 100 km, the sun above about 4 degrees; lower, a\n// small cell between two probes casts no shadow\nconst int SHADOW_PROBES = 8;\n// the sun is taken this high at least, the sine of its height: lower, its rays cross the slab over\n// more than 100 km\nconst float LOW_SUN = 0.05;\n\nvoid main() {\n vec3 across;\n vec3 along;\n shadowAxes(across, along);\n vec2 xy = (v_textureCoordinates - 0.5) * shadowExtent;\n vec3 start = shadowCenter + across * xy.x + along * xy.y;\n float sine = dot(czm_lightDirectionWC, normalize(start));\n if (sine <= 0.0) {\n // the sun is down: no shadows to speak of\n out_FragColor = vec4(0.0);\n return;\n }\n sine = max(sine, LOW_SUN);\n float h0 = shadowHeight(start);\n // from the top of the slab down to its base, along the ray\n float top = (slabTop - h0) / sine;\n float base = (cloudBase - h0) / sine;\n float covered = 0.0;\n for (int k = 0; k < SHADOW_PROBES; k++) {\n vec2 uv = mapUv(start + czm_lightDirectionWC * mix(top, base, (float(k) + 0.5) / float(SHADOW_PROBES)));\n if (all(greaterThanEqual(uv, vec2(0.0))) && all(lessThanEqual(uv, vec2(1.0)))) {\n covered = max(covered, texture(maxMap, uv).g);\n }\n }\n if (covered <= 0.0) {\n out_FragColor = vec4(0.0);\n return;\n }\n float ds = (top - base) / float(SHADOW_STEPS);\n float depth = 0.0;\n vec4 depths = vec4(0.0);\n float unused;\n for (int i = 0; i < SHADOW_STEPS; i++) {\n vec3 point = start + czm_lightDirectionWC * mix(top, base, (float(i) + 0.5) / float(SHADOW_STEPS));\n depth += EXTINCTION * cloudDensity(point, shadowHeight(point), shadowExtent / SHADOW_SIZE, unused, unused, unused) * ds;\n if (i == SHADOW_STEPS / 4 - 1) {\n depths.x = depth;\n } else if (i == SHADOW_STEPS / 2 - 1) {\n depths.y = depth;\n } else if (i == 3 * SHADOW_STEPS / 4 - 1) {\n depths.z = depth;\n }\n }\n depths.w = depth;\n out_FragColor = depths;\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=CloudsShadowMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsShadowMap.d.ts","sourceRoot":"","sources":["../../src/shaders/CloudsShadowMap.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from CloudsShadowMap.glsl.
2
+ export default "// The clouds' shadow map, drawn by clouds.js into its own texture: for each texel, the sun's ray\n// through it marched from the top of the slab down to its base, the optical depth of the clouds\n// kept at each quarter of the slab's height, unless the ray crosses no clouds. Needs CloudsSlab,\n// WeatherMap, Noise, CloudsDensity and CloudsShadow.\n// the highest coverage around each block of the clouds' map, from weather-map.js\nprecision highp sampler2D;\nuniform sampler2D maxMap;\nin vec2 v_textureCoordinates;\n\n// the steps along each ray, 4 for each quarter, and the texels across, clouds.js's SHADOW_SIZE, for\n// a texel's footprint, for the noise's mipmap\nconst int SHADOW_STEPS = 16;\nconst float SHADOW_SIZE = 512.0;\n// the ray is probed at this many points of the max map before its march, as the clouds' march, and\n// skipped where they find no clouds: the max map's 12 km windows overlap between probes as long as\n// the ray crosses the slab over less than about 100 km, the sun above about 4 degrees; lower, a\n// small cell between two probes casts no shadow\nconst int SHADOW_PROBES = 8;\n// the sun is taken this high at least, the sine of its height: lower, its rays cross the slab over\n// more than 100 km\nconst float LOW_SUN = 0.05;\n\nvoid main() {\n vec3 across;\n vec3 along;\n shadowAxes(across, along);\n vec2 xy = (v_textureCoordinates - 0.5) * shadowExtent;\n vec3 start = shadowCenter + across * xy.x + along * xy.y;\n float sine = dot(czm_lightDirectionWC, normalize(start));\n if (sine <= 0.0) {\n // the sun is down: no shadows to speak of\n out_FragColor = vec4(0.0);\n return;\n }\n sine = max(sine, LOW_SUN);\n float h0 = shadowHeight(start);\n // from the top of the slab down to its base, along the ray\n float top = (slabTop - h0) / sine;\n float base = (cloudBase - h0) / sine;\n float covered = 0.0;\n for (int k = 0; k < SHADOW_PROBES; k++) {\n vec2 uv = mapUv(start + czm_lightDirectionWC * mix(top, base, (float(k) + 0.5) / float(SHADOW_PROBES)));\n if (all(greaterThanEqual(uv, vec2(0.0))) && all(lessThanEqual(uv, vec2(1.0)))) {\n covered = max(covered, texture(maxMap, uv).g);\n }\n }\n if (covered <= 0.0) {\n out_FragColor = vec4(0.0);\n return;\n }\n float ds = (top - base) / float(SHADOW_STEPS);\n float depth = 0.0;\n vec4 depths = vec4(0.0);\n float unused;\n for (int i = 0; i < SHADOW_STEPS; i++) {\n vec3 point = start + czm_lightDirectionWC * mix(top, base, (float(i) + 0.5) / float(SHADOW_STEPS));\n depth += EXTINCTION * cloudDensity(point, shadowHeight(point), shadowExtent / SHADOW_SIZE, unused, unused, unused) * ds;\n if (i == SHADOW_STEPS / 4 - 1) {\n depths.x = depth;\n } else if (i == SHADOW_STEPS / 2 - 1) {\n depths.y = depth;\n } else if (i == 3 * SHADOW_STEPS / 4 - 1) {\n depths.z = depth;\n }\n }\n depths.w = depth;\n out_FragColor = depths;\n}\n";
3
+ //# sourceMappingURL=CloudsShadowMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsShadowMap.js","sourceRoot":"","sources":["../../src/shaders/CloudsShadowMap.js"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,eAAe,02FAA02F,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The slab of the clouds along a view ray, which the march and the resolve share: where the ray's\n// height reaches a height, and the part of the ray in the slab. Needs Height.\n// meters above the ellipsoid\nuniform float cloudBase;\n// the top of the tallest cloud the map makes, where the march starts from above, from clouds.js\nuniform float slabTop;\n\n// the ray is marched as far as this from where it enters the slab, in meters, not from the camera:\n// from far above, the slab itself is farther than that. A grazing ray marched farther would take\n// steps longer than the billows and turn the far clouds into streaks; deeper than this into the\n// slab, it is nearly always behind a cloud\nconst float MAX_DISTANCE = 40000.0;\n\n// where the height along the view ray, at a distance t in direction k = dot(direction, up), reaches\n// c: the height is cameraHeight + k t + (1 - k k) t t / (2 radius), as heightAt's. False if it never\n// does. Without the cancellation of the textbook formula, also for a vertical ray, where the\n// quadratic term is 0\nbool crossings(float c, float k, out float near, out float far) {\n float a = (1.0 - k * k) / (2.0 * radius);\n float d = cameraHeight - c;\n float discriminant = k * k - 4.0 * a * d;\n if (discriminant < 0.0) {\n return false;\n }\n float q = -0.5 * (k + (k < 0.0 ? -1.0 : 1.0) * sqrt(discriminant));\n q = q == 0.0 ? 1e-9 : q;\n float r0 = a > 1e-12 ? q / a : (q > 0.0 ? 1e20 : -1e20);\n float r1 = d / q;\n near = min(r0, r1);\n far = max(r0, r1);\n return true;\n}\n\n// the part of the ray in the slab up to a top, from where it enters it to where it leaves it, meets\n// the ground or is MAX_DISTANCE long; empty when it misses the slab\nvec2 slab(float k, float sceneDistance, float top) {\n float near;\n float far;\n // always above the tops\n if (!crossings(top, k, near, far)) {\n return vec2(0.0);\n }\n float start = max(near, 0.0);\n float end = far;\n if (crossings(cloudBase, k, near, far)) {\n if (cameraHeight >= cloudBase) {\n // going down below the base\n if (near > 0.0) {\n end = min(end, near);\n }\n } else {\n // coming up through the base\n start = max(start, far);\n }\n }\n end = min(end, min(sceneDistance, start + MAX_DISTANCE));\n return vec2(start, max(end, start));\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=CloudsSlab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsSlab.d.ts","sourceRoot":"","sources":["../../src/shaders/CloudsSlab.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from CloudsSlab.glsl.
2
+ export default "// The slab of the clouds along a view ray, which the march and the resolve share: where the ray's\n// height reaches a height, and the part of the ray in the slab. Needs Height.\n// meters above the ellipsoid\nuniform float cloudBase;\n// the top of the tallest cloud the map makes, where the march starts from above, from clouds.js\nuniform float slabTop;\n\n// the ray is marched as far as this from where it enters the slab, in meters, not from the camera:\n// from far above, the slab itself is farther than that. A grazing ray marched farther would take\n// steps longer than the billows and turn the far clouds into streaks; deeper than this into the\n// slab, it is nearly always behind a cloud\nconst float MAX_DISTANCE = 40000.0;\n\n// where the height along the view ray, at a distance t in direction k = dot(direction, up), reaches\n// c: the height is cameraHeight + k t + (1 - k k) t t / (2 radius), as heightAt's. False if it never\n// does. Without the cancellation of the textbook formula, also for a vertical ray, where the\n// quadratic term is 0\nbool crossings(float c, float k, out float near, out float far) {\n float a = (1.0 - k * k) / (2.0 * radius);\n float d = cameraHeight - c;\n float discriminant = k * k - 4.0 * a * d;\n if (discriminant < 0.0) {\n return false;\n }\n float q = -0.5 * (k + (k < 0.0 ? -1.0 : 1.0) * sqrt(discriminant));\n q = q == 0.0 ? 1e-9 : q;\n float r0 = a > 1e-12 ? q / a : (q > 0.0 ? 1e20 : -1e20);\n float r1 = d / q;\n near = min(r0, r1);\n far = max(r0, r1);\n return true;\n}\n\n// the part of the ray in the slab up to a top, from where it enters it to where it leaves it, meets\n// the ground or is MAX_DISTANCE long; empty when it misses the slab\nvec2 slab(float k, float sceneDistance, float top) {\n float near;\n float far;\n // always above the tops\n if (!crossings(top, k, near, far)) {\n return vec2(0.0);\n }\n float start = max(near, 0.0);\n float end = far;\n if (crossings(cloudBase, k, near, far)) {\n if (cameraHeight >= cloudBase) {\n // going down below the base\n if (near > 0.0) {\n end = min(end, near);\n }\n } else {\n // coming up through the base\n start = max(start, far);\n }\n }\n end = min(end, min(sceneDistance, start + MAX_DISTANCE));\n return vec2(start, max(end, start));\n}\n";
3
+ //# sourceMappingURL=CloudsSlab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudsSlab.js","sourceRoot":"","sources":["../../src/shaders/CloudsSlab.js"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAe,uyEAAuyE,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// Color isolation: one hue keeps its color, the rest of the scene turns gray. After prod80's\n// ReShade Color Isolation (MIT), https://github.com/prod80/prod80-ReShade-Repository\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// the hue kept and the half width of the selection, 0 to 1 for the whole circle\nuniform float hue;\nuniform float range;\n// 0 to 1\nuniform float strength;\nin vec2 v_textureCoordinates;\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = clamp(sceneColor.rgb, 0.0, 1.0);\n float gray = czm_luminance(color);\n float h = czm_RGBToHSL(color).x;\n // a triangle around the hue, on the circle\n float r = 1.0 / max(range, 1e-3);\n float weight = max(1.0 - abs((h - hue) * r), 0.0)\n + max(1.0 - abs((h + 1.0 - hue) * r), 0.0)\n + max(1.0 - abs((h - 1.0 - hue) * r), 0.0);\n float w = clamp(weight, 0.0, 1.0);\n float keep = w * w * w * (w * (w * 6.0 - 15.0) + 10.0);\n vec3 isolated = mix(vec3(gray), color, keep);\n out_FragColor = vec4(mix(color, isolated, strength), sceneColor.a);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=ColorIsolation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorIsolation.d.ts","sourceRoot":"","sources":["../../src/shaders/ColorIsolation.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from ColorIsolation.glsl.
2
+ export default "// Color isolation: one hue keeps its color, the rest of the scene turns gray. After prod80's\n// ReShade Color Isolation (MIT), https://github.com/prod80/prod80-ReShade-Repository\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// the hue kept and the half width of the selection, 0 to 1 for the whole circle\nuniform float hue;\nuniform float range;\n// 0 to 1\nuniform float strength;\nin vec2 v_textureCoordinates;\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = clamp(sceneColor.rgb, 0.0, 1.0);\n float gray = czm_luminance(color);\n float h = czm_RGBToHSL(color).x;\n // a triangle around the hue, on the circle\n float r = 1.0 / max(range, 1e-3);\n float weight = max(1.0 - abs((h - hue) * r), 0.0)\n + max(1.0 - abs((h + 1.0 - hue) * r), 0.0)\n + max(1.0 - abs((h - 1.0 - hue) * r), 0.0);\n float w = clamp(weight, 0.0, 1.0);\n float keep = w * w * w * (w * (w * 6.0 - 15.0) + 10.0);\n vec3 isolated = mix(vec3(gray), color, keep);\n out_FragColor = vec4(mix(color, isolated, strength), sceneColor.a);\n}\n";
3
+ //# sourceMappingURL=ColorIsolation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorIsolation.js","sourceRoot":"","sources":["../../src/shaders/ColorIsolation.js"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,eAAe,wkCAAwkC,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The edges found in the depth, shared by Toy and WhiteModel, after EyeFromDepth: how far a pixel\n// lies, how large a pixel is there, the depth's neighbors around it, how sharply it bends between\n// them (a crease, not across a jump: an edge in front of something farther, nor the gentle bends\n// between the terrain's triangles), the outline on the near side of a jump; the sky's gradient.\n// its samplers read in high precision, whatever comes before (a phone's GPU's default is low)\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n\n// how much the depth bends, in pixels' sizes, to start and to end lighting an edge\nconst vec2 CREASE = vec2(0.6, 1.6);\n// how far the depth jumps, in pixels' sizes, to be an edge in front of something farther, not a crease\nuniform float jump;\n// the bevel's widest, in pixels: its neighbors read that far at the most\nconst float BEVEL = 8.0;\n// the sky's depth, far off\nconst float SKY = 1e9;\n\n// how far the pixel at uv lies, in meters: in an orthographic view past its near plane, small\n// numbers whose differences keep their precision (its camera thousands of meters back: some\n// phones' GPUs, Mali, lose it subtracting depths that large), in a perspective one from the camera\nfloat depthAt(vec2 uv) {\n if (czm_orthographicIn3D == 1.0) {\n float raw = texture(depthTexture, uv).r;\n return raw >= 1.0 ? SKY : raw * (czm_currentFrustum.y - czm_currentFrustum.x);\n }\n vec4 eye = eyeAt(depthTexture, uv);\n return eye.w == 0.0 ? SKY : -eye.z;\n}\n\n// a pixel's size in meters at a depth: an orthographic view's the same everywhere, a perspective's\n// growing with the depth\nfloat pixelAt(float depth) {\n return 2.0 / (czm_projection[0][0] * czm_viewport.z) * (czm_orthographicIn3D == 1.0 ? 1.0 : depth);\n}\n\n// the depths of the neighbors steps pixels away from uv, less its own c: right, left, up, down\nvec4 neighborsAt(vec2 uv, float c, float steps) {\n vec2 o = steps / czm_viewport.zw;\n return vec4(depthAt(uv + vec2(o.x, 0.0)), depthAt(uv - vec2(o.x, 0.0)), depthAt(uv + vec2(0.0, o.y)), depthAt(uv - vec2(0.0, o.y))) - c;\n}\n\n// how sharply the depth bends between neighbors n a span of meters apart, from 0 to 1, none across\n// a jump; convex where they lie farther than the middle, their sum positive\nfloat creaseOf(vec4 n, float span, float pixel) {\n float far = max(max(abs(n.x), abs(n.y)), max(abs(n.z), abs(n.w)));\n return smoothstep(CREASE.x, CREASE.y, (abs(n.x + n.y) + abs(n.z + n.w)) / span) * (1.0 - step(jump * pixel, far));\n}\n\n// how far the surface beyond the pixel at uv lies behind it, in one direction o (a pixel's step): the two neighbours\n// that way extrapolated back to the pixel, linearly in an orthographic view, where the depth is affine on the screen,\n// in its reciprocal in a perspective one. A plane at any slope extrapolates exactly to the pixel, so a face seen at a\n// grazing angle is never a jump, only a nearer thing standing in front of a farther one. The nearer of the extrapolation\n// and the neighbour itself: beside a thin thing two pixels away, the extrapolation through it runs far behind the pixel\nfloat farSide(vec2 uv, vec2 o, float c) {\n float d1 = depthAt(uv + o);\n float d2 = depthAt(uv + 2.0 * o);\n if (d1 == SKY) {\n return SKY;\n }\n if (czm_orthographicIn3D == 1.0) {\n return min(d1, d2 == SKY ? d1 : 2.0 * d1 - d2) - c;\n }\n float r = d2 == SKY ? 1.0 / d1 : 2.0 / d1 - 1.0 / d2;\n return (r <= 0.0 ? d1 : min(d1, 1.0 / r)) - c;\n}\n\n// the outline, a pixel wide, on the near side of a jump: the farthest of the four directions' surfaces behind the pixel,\n// against the jump, anti-aliased over a quarter of it each way (n and steps, the creases' neighbours, unused here: the\n// outline reads its own)\nfloat outlineAt(vec2 uv, float c, vec4 n, float steps, float pixel) {\n vec2 texel = 1.0 / czm_viewport.zw;\n float farther = max(max(farSide(uv, vec2(texel.x, 0.0), c), farSide(uv, vec2(-texel.x, 0.0), c)),\n max(farSide(uv, vec2(0.0, texel.y), c), farSide(uv, vec2(0.0, -texel.y), c)));\n float limit = jump * pixel;\n return smoothstep(0.75 * limit, 1.25 * limit, farther);\n}\n\n// the sky's gradient at uv, from the top of the screen to its bottom\nvec3 skyAt(vec2 uv, vec4 top, vec4 bottom) {\n return mix(bottom.rgb, top.rgb, smoothstep(0.0, 1.0, uv.y));\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=DepthEdges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepthEdges.d.ts","sourceRoot":"","sources":["../../src/shaders/DepthEdges.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from DepthEdges.glsl.
2
+ export default "// The edges found in the depth, shared by Toy and WhiteModel, after EyeFromDepth: how far a pixel\n// lies, how large a pixel is there, the depth's neighbors around it, how sharply it bends between\n// them (a crease, not across a jump: an edge in front of something farther, nor the gentle bends\n// between the terrain's triangles), the outline on the near side of a jump; the sky's gradient.\n// its samplers read in high precision, whatever comes before (a phone's GPU's default is low)\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n\n// how much the depth bends, in pixels' sizes, to start and to end lighting an edge\nconst vec2 CREASE = vec2(0.6, 1.6);\n// how far the depth jumps, in pixels' sizes, to be an edge in front of something farther, not a crease\nuniform float jump;\n// the bevel's widest, in pixels: its neighbors read that far at the most\nconst float BEVEL = 8.0;\n// the sky's depth, far off\nconst float SKY = 1e9;\n\n// how far the pixel at uv lies, in meters: in an orthographic view past its near plane, small\n// numbers whose differences keep their precision (its camera thousands of meters back: some\n// phones' GPUs, Mali, lose it subtracting depths that large), in a perspective one from the camera\nfloat depthAt(vec2 uv) {\n if (czm_orthographicIn3D == 1.0) {\n float raw = texture(depthTexture, uv).r;\n return raw >= 1.0 ? SKY : raw * (czm_currentFrustum.y - czm_currentFrustum.x);\n }\n vec4 eye = eyeAt(depthTexture, uv);\n return eye.w == 0.0 ? SKY : -eye.z;\n}\n\n// a pixel's size in meters at a depth: an orthographic view's the same everywhere, a perspective's\n// growing with the depth\nfloat pixelAt(float depth) {\n return 2.0 / (czm_projection[0][0] * czm_viewport.z) * (czm_orthographicIn3D == 1.0 ? 1.0 : depth);\n}\n\n// the depths of the neighbors steps pixels away from uv, less its own c: right, left, up, down\nvec4 neighborsAt(vec2 uv, float c, float steps) {\n vec2 o = steps / czm_viewport.zw;\n return vec4(depthAt(uv + vec2(o.x, 0.0)), depthAt(uv - vec2(o.x, 0.0)), depthAt(uv + vec2(0.0, o.y)), depthAt(uv - vec2(0.0, o.y))) - c;\n}\n\n// how sharply the depth bends between neighbors n a span of meters apart, from 0 to 1, none across\n// a jump; convex where they lie farther than the middle, their sum positive\nfloat creaseOf(vec4 n, float span, float pixel) {\n float far = max(max(abs(n.x), abs(n.y)), max(abs(n.z), abs(n.w)));\n return smoothstep(CREASE.x, CREASE.y, (abs(n.x + n.y) + abs(n.z + n.w)) / span) * (1.0 - step(jump * pixel, far));\n}\n\n// how far the surface beyond the pixel at uv lies behind it, in one direction o (a pixel's step): the two neighbours\n// that way extrapolated back to the pixel, linearly in an orthographic view, where the depth is affine on the screen,\n// in its reciprocal in a perspective one. A plane at any slope extrapolates exactly to the pixel, so a face seen at a\n// grazing angle is never a jump, only a nearer thing standing in front of a farther one. The nearer of the extrapolation\n// and the neighbour itself: beside a thin thing two pixels away, the extrapolation through it runs far behind the pixel\nfloat farSide(vec2 uv, vec2 o, float c) {\n float d1 = depthAt(uv + o);\n float d2 = depthAt(uv + 2.0 * o);\n if (d1 == SKY) {\n return SKY;\n }\n if (czm_orthographicIn3D == 1.0) {\n return min(d1, d2 == SKY ? d1 : 2.0 * d1 - d2) - c;\n }\n float r = d2 == SKY ? 1.0 / d1 : 2.0 / d1 - 1.0 / d2;\n return (r <= 0.0 ? d1 : min(d1, 1.0 / r)) - c;\n}\n\n// the outline, a pixel wide, on the near side of a jump: the farthest of the four directions' surfaces behind the pixel,\n// against the jump, anti-aliased over a quarter of it each way (n and steps, the creases' neighbours, unused here: the\n// outline reads its own)\nfloat outlineAt(vec2 uv, float c, vec4 n, float steps, float pixel) {\n vec2 texel = 1.0 / czm_viewport.zw;\n float farther = max(max(farSide(uv, vec2(texel.x, 0.0), c), farSide(uv, vec2(-texel.x, 0.0), c)),\n max(farSide(uv, vec2(0.0, texel.y), c), farSide(uv, vec2(0.0, -texel.y), c)));\n float limit = jump * pixel;\n return smoothstep(0.75 * limit, 1.25 * limit, farther);\n}\n\n// the sky's gradient at uv, from the top of the screen to its bottom\nvec3 skyAt(vec2 uv, vec4 top, vec4 bottom) {\n return mix(bottom.rgb, top.rgb, smoothstep(0.0, 1.0, uv.y));\n}\n";
3
+ //# sourceMappingURL=DepthEdges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepthEdges.js","sourceRoot":"","sources":["../../src/shaders/DepthEdges.js"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAe,gxIAAgxI,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// A digital FPV video feed and its breakups: clean, slightly punchy colors, until a weak signal\n// breaks the picture into macroblocks, some displaced, strips shifted sideways and the color\n// channels split, and at worst a short black screen. A block keeps only its lowest frequencies,\n// as a codec that has thrown its detail away: a gradient between its corners, with fewer colors.\n// The displaced blocks and strips follow three.js's DigitalGlitch. Without the previous frames,\n// there are no freezes.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// how broken the picture is, 0 to 1, and 1 during a black screen\nuniform float severity;\nuniform float blackout;\n// the video frame number, for the random patterns\nuniform float frame;\nin vec2 v_textureCoordinates;\n\n// a macroblock, in CSS pixels\nconst float BLOCK = 16.0;\n\nvoid main() {\n vec2 size = czm_viewport.zw;\n vec2 pixel = gl_FragCoord.xy / czm_pixelRatio;\n vec2 uv = v_textureCoordinates;\n vec4 sceneColor = texture(colorTexture, uv);\n // clean: slightly crushed blacks, a little more color\n vec3 rgb = sceneColor.rgb;\n rgb = czm_saturation(rgb, 1.1);\n rgb = max(rgb - 0.02, 0.0) / 0.98;\n\n if (severity > 0.0) {\n // the pattern changes every few frames, as the decoder stutters\n float pattern = floor(frame / 3.0);\n // strips shifted sideways\n float strip = floor(pixel.y / (BLOCK * 2.0));\n if (hash(vec2(strip, pattern + 7.0)) < 0.25 * severity) {\n uv.x += (hash(vec2(strip, pattern + 11.0)) - 0.5) * 0.2 * severity;\n }\n // macroblocks: more of them as the signal gets worse; some show the picture displaced\n vec2 block = floor(uv * size / czm_pixelRatio / BLOCK);\n if (hash(block + pattern * 0.37) < 1.2 * severity) {\n vec2 displaced = hash(block + pattern + 3.0) < 0.3\n ? floor((vec2(hash(block + 5.0), hash(block + 9.0)) - 0.5) * 4.0)\n : vec2(0.0);\n vec2 cell = BLOCK * czm_pixelRatio / size;\n vec2 origin = (block + displaced) * cell;\n // the block's corners, and a gradient between them\n vec2 inset = 0.5 / size;\n vec3 c00 = texture(colorTexture, origin + inset).rgb;\n vec3 c10 = texture(colorTexture, origin + vec2(cell.x - inset.x, inset.y)).rgb;\n vec3 c01 = texture(colorTexture, origin + vec2(inset.x, cell.y - inset.y)).rgb;\n vec3 c11 = texture(colorTexture, origin + cell - inset).rgb;\n vec2 f = fract(uv * size / czm_pixelRatio / BLOCK);\n rgb = mix(mix(c00, c10, f.x), mix(c01, c11, f.x), f.y);\n // fewer colors\n float levels = mix(24.0, 6.0, severity);\n rgb = floor(rgb * levels + 0.5) / levels;\n } else if (uv != v_textureCoordinates) {\n rgb = texture(colorTexture, uv).rgb;\n }\n // the color channels split sideways\n vec2 split = vec2(3.0 * severity * czm_pixelRatio / size.x, 0.0);\n rgb.r = mix(rgb.r, texture(colorTexture, uv + split).r, severity);\n rgb.b = mix(rgb.b, texture(colorTexture, uv - split).b, severity);\n }\n out_FragColor = vec4(rgb * (1.0 - blackout), sceneColor.a);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=DigitalVideo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DigitalVideo.d.ts","sourceRoot":"","sources":["../../src/shaders/DigitalVideo.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from DigitalVideo.glsl.
2
+ export default "// A digital FPV video feed and its breakups: clean, slightly punchy colors, until a weak signal\n// breaks the picture into macroblocks, some displaced, strips shifted sideways and the color\n// channels split, and at worst a short black screen. A block keeps only its lowest frequencies,\n// as a codec that has thrown its detail away: a gradient between its corners, with fewer colors.\n// The displaced blocks and strips follow three.js's DigitalGlitch. Without the previous frames,\n// there are no freezes.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// how broken the picture is, 0 to 1, and 1 during a black screen\nuniform float severity;\nuniform float blackout;\n// the video frame number, for the random patterns\nuniform float frame;\nin vec2 v_textureCoordinates;\n\n// a macroblock, in CSS pixels\nconst float BLOCK = 16.0;\n\nvoid main() {\n vec2 size = czm_viewport.zw;\n vec2 pixel = gl_FragCoord.xy / czm_pixelRatio;\n vec2 uv = v_textureCoordinates;\n vec4 sceneColor = texture(colorTexture, uv);\n // clean: slightly crushed blacks, a little more color\n vec3 rgb = sceneColor.rgb;\n rgb = czm_saturation(rgb, 1.1);\n rgb = max(rgb - 0.02, 0.0) / 0.98;\n\n if (severity > 0.0) {\n // the pattern changes every few frames, as the decoder stutters\n float pattern = floor(frame / 3.0);\n // strips shifted sideways\n float strip = floor(pixel.y / (BLOCK * 2.0));\n if (hash(vec2(strip, pattern + 7.0)) < 0.25 * severity) {\n uv.x += (hash(vec2(strip, pattern + 11.0)) - 0.5) * 0.2 * severity;\n }\n // macroblocks: more of them as the signal gets worse; some show the picture displaced\n vec2 block = floor(uv * size / czm_pixelRatio / BLOCK);\n if (hash(block + pattern * 0.37) < 1.2 * severity) {\n vec2 displaced = hash(block + pattern + 3.0) < 0.3\n ? floor((vec2(hash(block + 5.0), hash(block + 9.0)) - 0.5) * 4.0)\n : vec2(0.0);\n vec2 cell = BLOCK * czm_pixelRatio / size;\n vec2 origin = (block + displaced) * cell;\n // the block's corners, and a gradient between them\n vec2 inset = 0.5 / size;\n vec3 c00 = texture(colorTexture, origin + inset).rgb;\n vec3 c10 = texture(colorTexture, origin + vec2(cell.x - inset.x, inset.y)).rgb;\n vec3 c01 = texture(colorTexture, origin + vec2(inset.x, cell.y - inset.y)).rgb;\n vec3 c11 = texture(colorTexture, origin + cell - inset).rgb;\n vec2 f = fract(uv * size / czm_pixelRatio / BLOCK);\n rgb = mix(mix(c00, c10, f.x), mix(c01, c11, f.x), f.y);\n // fewer colors\n float levels = mix(24.0, 6.0, severity);\n rgb = floor(rgb * levels + 0.5) / levels;\n } else if (uv != v_textureCoordinates) {\n rgb = texture(colorTexture, uv).rgb;\n }\n // the color channels split sideways\n vec2 split = vec2(3.0 * severity * czm_pixelRatio / size.x, 0.0);\n rgb.r = mix(rgb.r, texture(colorTexture, uv + split).r, severity);\n rgb.b = mix(rgb.b, texture(colorTexture, uv - split).b, severity);\n }\n out_FragColor = vec4(rgb * (1.0 - blackout), sceneColor.a);\n}\n";
3
+ //# sourceMappingURL=DigitalVideo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DigitalVideo.js","sourceRoot":"","sources":["../../src/shaders/DigitalVideo.js"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAe,uhGAAuhG,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// A drone's OSD, as ArduPilot draws it on an HD video system: 50 columns and 18 rows of 12 x 18\n// pixel character cells over the whole picture, with the readouts near its edges, here in the\n// blocky white glyphs of an analog chip with their black outline, and some in color. The layout\n// follows a fixed-wing plane's display; the glyphs are drawn here, not copied from a font.\n// - The horizon: 9 dots of 2 x 2 pixels around the middle, as ArduPilot's draw_horizon: pitch (at\n// most 20 degrees) moves it a row per 5 degrees, and roll tilts it at its angle on the screen;\n// each dot is at one of 9 heights in its cell, or past 45 degrees of roll, one per row at one of\n// 9 places across its cell. A dot more than 4 cells from the middle is not drawn, and upside\n// down the horizon blinks. It is a symbol, not lined up with the real horizon.\n// - The flight mode, top left: FBWA, RTL in failsafe; the heading, top middle.\n// - Top right, the link bar, green, orange then red as the link quality drops, and the battery,\n// its symbol filled in green in 7 steps, and its voltage.\n// - The right column: the altitude since the display turned on, under a mountain with a green\n// dot; the vertical speed, with one or two green arrows; the throttle.\n// - The air speed, bottom middle, after its pale blue label.\n// - The FAILSAFE warning, blinking red in the lower part of the middle while the control link is\n// lost.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// 0 to 1\nuniform float opacity;\n// degrees, negative looking down\nuniform float pitch;\n// degrees, positive to the right\nuniform float roll;\n// degrees, 0 to 360\nuniform float heading;\n// meters, since the display turned on\nuniform float altitude;\n// m/s, positive climbing\nuniform float verticalSpeed;\n// km/h\nuniform float speed;\n// volts\nuniform float voltage;\n// 0 to 99\nuniform float linkQuality;\n// percent\nuniform float throttle;\n// 1 while the control link is lost, 0 otherwise\nuniform float failsafe;\n// 1 or 0, twice per second: the blinking of the warning and of the horizon upside down\nuniform float blink;\nin vec2 v_textureCoordinates;\n\nconst float COLUMNS = 50.0;\nconst float ROWS = 18.0;\n// a cell, in pixels\nconst float CELL_WIDTH = 12.0;\nconst float CELL_HEIGHT = 18.0;\n// the middle cell, where the horizon is\nconst int MIDDLE_COLUMN = 24;\nconst int MIDDLE_ROW = 8;\n// ArduPilot's horizon: its limit in pitch, rows per degree of it (16 rows per 80 degrees), and\n// rows per column at 45 degrees of roll, for the line to tilt at its angle\nconst float MAX_PITCH = 20.0;\nconst float ROWS_PER_DEGREE = 0.2;\nconst float RATIO = CELL_WIDTH / CELL_HEIGHT;\n// battery: volts full and empty of a 3S, and the steps of its symbol's fill (full, 5 to 1, empty)\nconst float FULL_VOLTS = 12.6;\nconst float EMPTY_VOLTS = 10.5;\nconst float BATTERY_STEPS = 6.0;\n// the right column: the units in its last column, right of the numbers\nconst int UNIT_COLUMN = 41;\n// the link bar: its first column, and its length in cells\nconst int LINK_COLUMN = 36;\nconst float LINK_CELLS = 6.0;\n\nconst vec3 WHITE = vec3(1.0);\nconst vec3 GREEN = vec3(0.2, 0.85, 0.35);\nconst vec3 ORANGE = vec3(1.0, 0.6, 0.1);\nconst vec3 RED = vec3(0.95, 0.15, 0.15);\nconst vec3 PALE_BLUE = vec3(0.55, 0.75, 0.95);\n\n// the glyphs, at 12 x 18 pixels: one row of 12 bits each, the leftmost bit highest; the table is\n// written by scripts/osd-font.js from its pixel drawings\nconst int DOT = 10;\nconst int SPACE = 11;\nconst int MINUS = 12;\nconst int VOLT = 13;\nconst int DEGREE = 14;\nconst int PERCENT = 15;\n// the units of the altitude, the vertical speed and the air speed, and the air speed's label\nconst int ALTITUDE = 16;\nconst int METERS_PER_SECOND = 17;\nconst int KILOMETERS_PER_HOUR = 18;\nconst int AIR_SPEED = 19;\n// the vertical speed's arrows\nconst int UP = 20;\nconst int UP_TWO = 21;\nconst int DOWN = 22;\nconst int DOWN_TWO = 23;\n// the letters of the flight modes and the warning\nconst int LETTER_F = 24;\nconst int LETTER_B = 25;\nconst int LETTER_W = 26;\nconst int LETTER_A = 27;\nconst int LETTER_R = 28;\nconst int LETTER_T = 29;\nconst int LETTER_L = 30;\nconst int LETTER_I = 31;\nconst int LETTER_E = 32;\nconst int LETTER_S = 33;\n// the warning's row and first column: FAILSAFE, centered under the middle\nconst int WARNING_ROW = 12;\nconst int WARNING_COLUMN = 21;\n\nconst int FONT[612] = int[612](\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1474704, 1474704, 1474704, 1474704, 1671264, 983040, 0, 0, 0, 0, // 0\n 0, 0, 0, 917504, 1704000, 1179840, 1704000, 655424, 655424, 655424, 655424, 1769536, 1114336, 2031616, 0, 0, 0, 0, // 1\n 0, 0, 0, 983040, 1671264, 1474704, 1998864, 426000, 884768, 1769536, 1441920, 1540224, 1081584, 2064384, 0, 0, 0, 0, // 2\n 0, 0, 0, 2031616, 1147104, 1998864, 163856, 950288, 622688, 950288, 163856, 1998864, 1147104, 2031616, 0, 0, 0, 0, // 3\n 0, 0, 0, 2064384, 1474704, 1474704, 1474704, 1474704, 1081584, 1998864, 163856, 163856, 163856, 229376, 0, 0, 0, 0, // 4\n 0, 0, 0, 2064384, 1081584, 1540224, 1507456, 1147104, 1998864, 163856, 1998864, 1474704, 1671264, 983040, 0, 0, 0, 0, // 5\n 0, 0, 0, 983040, 1638496, 1507456, 1507456, 1147104, 1474704, 1474704, 1474704, 1474704, 1671264, 983040, 0, 0, 0, 0, // 6\n 0, 0, 0, 2064384, 1081584, 1998864, 426000, 360480, 852000, 720960, 655424, 655424, 655424, 917504, 0, 0, 0, 0, // 7\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1671264, 1474704, 1474704, 1474704, 1671264, 983040, 0, 0, 0, 0, // 8\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1605744, 950288, 163856, 950288, 622688, 983040, 0, 0, 0, 0, // 9\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 983040, 589920, 589920, 983040, 0, 0, 0, 0, // .\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // space\n 0, 0, 0, 0, 0, 0, 0, 2064384, 1081584, 2064384, 0, 0, 0, 0, 0, 0, 0, 0, // -\n 0, 0, 0, 0, 0, 0, 3899392, 2785552, 2785552, 3047696, 3506336, 1376416, 1769536, 917504, 0, 0, 0, 0, // v, volts\n 0, 0, 1966080, 3342528, 2949408, 2949408, 3342528, 1966080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // \u00B0, degrees\n 0, 0, 0, 0, 7979008, 4932360, 5161744, 8224800, 1769536, 3653760, 7225624, 5915160, 7585792, 0, 0, 0, 0, 0, // %\n 1835008, 3539072, 7061824, 14508584, 11973652, 6543362, 12611584, 0, 4128768, 2195936, 2785616, 2785616, 2785616, 4161536, 0, 0, 0, 0, // a mountain over m, the altitude; the shader adds a green dot inside\n 0, 4128768, 2195936, 2785616, 2785616, 2785616, 4161536, 0, 983040, 1638496, 1507456, 1769536, 1900576, 1245376, 1966080, 0, 0, 0, // m over s, meters per second\n 14680064, 12567552, 11036024, 10135124, 11183444, 11183444, 16769024, 917504, 655424, 720960, 622688, 688208, 688208, 1015808, 0, 0, 0, 0, // km over h, kilometers per hour\n 0, 8257536, 14410304, 11445524, 9070424, 11191632, 11175248, 16744448, 15757312, 2022914, 7575750, 1400490, 13849290, 1547910, 16576512, 0, 0, 0, // Air over Spd, the air speed\n 0, 0, 0, 0, 0, 0, 917504, 1769536, 3244256, 6341104, 4211704, 8372224, 0, 0, 0, 0, 0, 0, // an arrow up\n 0, 0, 917504, 1769536, 3244256, 6341104, 4211704, 8372224, 0, 917504, 1769536, 3244256, 6341104, 4211704, 8372224, 0, 0, 0, // two arrows up\n 0, 0, 0, 0, 0, 0, 8372224, 4211704, 6341104, 3244256, 1769536, 917504, 0, 0, 0, 0, 0, 0, // an arrow down\n 0, 0, 8372224, 4211704, 6341104, 3244256, 1769536, 917504, 0, 8372224, 4211704, 6341104, 3244256, 1769536, 917504, 0, 0, 0, // two arrows down\n 0, 0, 0, 2064384, 1081584, 1540224, 1310848, 1507456, 1114336, 1507456, 1310848, 1310848, 1310848, 1835008, 0, 0, 0, 0, // F\n 0, 0, 0, 2031616, 1147104, 1474704, 1474704, 1474704, 1147104, 1474704, 1474704, 1474704, 1147104, 2031616, 0, 0, 0, 0, // B\n 0, 0, 0, 3899392, 2785552, 2785552, 2785552, 3047696, 2785616, 2785616, 2785616, 2785616, 3506336, 2031616, 0, 0, 0, 0, // W\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1081584, 1474704, 1474704, 1474704, 1474704, 2064384, 0, 0, 0, 0, // A\n 0, 0, 0, 2031616, 1147104, 1474704, 1474704, 1474704, 1147104, 1409184, 1474704, 1474704, 1474704, 2064384, 0, 0, 0, 0, // R\n 0, 0, 0, 4161536, 2130416, 3899456, 655424, 655424, 655424, 655424, 655424, 655424, 655424, 917504, 0, 0, 0, 0, // T\n 0, 0, 0, 1835008, 1310848, 1310848, 1310848, 1310848, 1310848, 1310848, 1310848, 1540224, 1081584, 2064384, 0, 0, 0, 0, // L\n 0, 0, 0, 2031616, 1114336, 1769536, 655424, 655424, 655424, 655424, 655424, 1769536, 1114336, 2031616, 0, 0, 0, 0, // I\n 0, 0, 0, 2064384, 1081584, 1540224, 1310848, 1507456, 1114336, 1507456, 1310848, 1540224, 1081584, 2064384, 0, 0, 0, 0, // E\n 0, 0, 0, 1015808, 1605744, 1540224, 1310848, 1507456, 1671264, 950288, 163856, 1998864, 1147104, 2031616, 0, 0, 0, 0 // S\n);\n\nint digit(float value, float power) {\n return int(mod(floor(value / power), 10.0));\n}\n\n// 10 to the n, exactly: pow may be off by a little on the GPU\nfloat powerOfTen(int n) {\n return n == 3 ? 1000.0 : n == 2 ? 100.0 : n == 1 ? 10.0 : 1.0;\n}\n\n// a number right-aligned to end at the column last: its whole part, and its tenths after a dot,\n// and a minus before it when negative; -1 left of it\nint numberAt(float value, bool tenths, int column, int last) {\n float scaled = floor(abs(value) * (tenths ? 10.0 : 1.0) + 0.5);\n float whole = tenths ? floor(scaled / 10.0) : scaled;\n int digits = whole >= 1000.0 ? 4 : whole >= 100.0 ? 3 : whole >= 10.0 ? 2 : 1;\n int i = last - column;\n if (tenths) {\n if (i == 0) {\n return digit(scaled, 1.0);\n }\n if (i == 1) {\n return DOT;\n }\n i -= 2;\n }\n if (i >= 0 && i < digits) {\n return digit(whole, powerOfTen(i));\n }\n return i == digits && value < 0.0 && scaled > 0.0 ? MINUS : -1;\n}\n\n// the glyph in this cell and its color, or -1\nint glyphAt(int column, int row, out vec3 color) {\n color = WHITE;\n // the flight mode, top left\n if (row == 1 && column >= 3 && column <= 6) {\n int i = column - 3;\n if (failsafe > 0.5) {\n return i == 0 ? LETTER_R : i == 1 ? LETTER_T : i == 2 ? LETTER_L : -1;\n }\n return i == 0 ? LETTER_F : i == 1 ? LETTER_B : i == 2 ? LETTER_W : LETTER_A;\n }\n // the heading, top middle\n if (row == 1 && column >= 23 && column <= 26) {\n return column == 26 ? DEGREE : numberAt(mod(floor(heading + 0.5), 360.0), false, column, 25);\n }\n // the battery voltage, top right after its symbol: 12.0v\n if (row == 2 && column > LINK_COLUMN && column <= UNIT_COLUMN) {\n return column == UNIT_COLUMN ? VOLT : numberAt(clamp(voltage, 0.0, 99.9), true, column, UNIT_COLUMN - 1);\n }\n // the right column: the altitude, the vertical speed after its arrows, the throttle\n bool right = column >= UNIT_COLUMN - 6 && column <= UNIT_COLUMN;\n if (row == MIDDLE_ROW && right) {\n return column == UNIT_COLUMN ? ALTITUDE : numberAt(clamp(altitude, -999.0, 9999.0), false, column, UNIT_COLUMN - 1);\n }\n if (row == MIDDLE_ROW + 1 && right) {\n if (column == UNIT_COLUMN) {\n return METERS_PER_SECOND;\n }\n float climb = min(abs(verticalSpeed), 99.9);\n int width = climb >= 9.95 ? 4 : 3;\n if (column == UNIT_COLUMN - 1 - width) {\n color = GREEN;\n bool up = verticalSpeed > 0.0;\n return climb < 0.05 ? -1 : climb < 5.0 ? (up ? UP : DOWN) : (up ? UP_TWO : DOWN_TWO);\n }\n return numberAt(climb, true, column, UNIT_COLUMN - 1);\n }\n if (row == MIDDLE_ROW + 3 && right) {\n return column == UNIT_COLUMN ? PERCENT : numberAt(clamp(throttle, 0.0, 100.0), false, column, UNIT_COLUMN - 1);\n }\n // the warning\n if (failsafe > 0.5 && blink > 0.5 && row == WARNING_ROW && column >= WARNING_COLUMN && column < WARNING_COLUMN + 8) {\n int i = column - WARNING_COLUMN;\n color = RED;\n return i == 0 ? LETTER_F : i == 1 ? LETTER_A : i == 2 ? LETTER_I : i == 3 ? LETTER_L : i == 4 ? LETTER_S : i == 5 ? LETTER_A : i == 6 ? LETTER_F : LETTER_E;\n }\n // the air speed, bottom middle: its label, whole km/h and the unit\n if (row == 16 && column >= 20 && column <= 25) {\n if (column == 20) {\n color = PALE_BLUE;\n return AIR_SPEED;\n }\n return column == 25 ? KILOMETERS_PER_HOUR : numberAt(clamp(speed, 0.0, 999.0), false, column, 24);\n }\n return -1;\n}\n\n// 2 where the glyph is drawn, 1 on its black outline, 0 elsewhere; x and y in the cell's pixels.\n// A row of the table holds the glyph in its low 12 bits and the outline in the 12 above, the\n// leftmost pixel highest\nfloat glyphInk(int glyph, int x, int y) {\n if (glyph < 0) {\n return 0.0;\n }\n int row = FONT[glyph * int(CELL_HEIGHT) + y] >> (int(CELL_WIDTH) - 1 - x);\n return (row & 1) == 1 ? 2.0 : ((row >> int(CELL_WIDTH)) & 1) == 1 ? 1.0 : 0.0;\n}\n\n// 2 inside the box, 1 on its outline a pixel around, 0 elsewhere; in pixels\nfloat boxInk(vec2 p, vec2 low, vec2 high) {\n if (all(greaterThanEqual(p, low)) && all(lessThan(p, high))) {\n return 2.0;\n }\n return all(greaterThanEqual(p, low - 1.0)) && all(lessThan(p, high + 1.0)) ? 1.0 : 0.0;\n}\n\n// what is drawn over what is under it, its outline under what is drawn\nvoid paint(inout float ink, inout vec3 fill, float layer, vec3 color) {\n if (layer > ink) {\n ink = layer;\n fill = color;\n }\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n // the grid as large as fits the screen, centered, from its top left, in pixels\n vec2 size = czm_viewport.zw;\n vec2 grid = vec2(COLUMNS * CELL_WIDTH, ROWS * CELL_HEIGHT);\n float scale = min(size.x / grid.x, size.y / grid.y);\n vec2 fromCorner = vec2(gl_FragCoord.x - czm_viewport.x, czm_viewport.y + size.y - gl_FragCoord.y) - 0.5 * (size - grid * scale);\n vec2 p = floor(fromCorner / scale);\n int column = int(floor(p.x / CELL_WIDTH));\n int row = int(floor(p.y / CELL_HEIGHT));\n if (column < 0 || column >= int(COLUMNS) || row < 0 || row >= int(ROWS)) {\n out_FragColor = sceneColor;\n return;\n }\n vec2 inCell = p - vec2(float(column) * CELL_WIDTH, float(row) * CELL_HEIGHT);\n\n vec3 glyphColor;\n int glyph = glyphAt(column, row, glyphColor);\n float ink = 0.0;\n vec3 fill = WHITE;\n paint(ink, fill, glyphInk(glyph, int(inCell.x), int(inCell.y)), glyphColor);\n\n // the horizon, as ArduPilot's draw_horizon in rows and columns from the middle cell, with the\n // pitch (positive nose down) raising it: a dot per column, at its height in the cell in ninths,\n // or past 45 degrees of roll a dot per row, at its place across the cell in ninths\n bool nearMiddle = abs(column - MIDDLE_COLUMN) <= 5 && abs(row - MIDDLE_ROW) <= 5;\n if (nearMiddle && (abs(roll) < 90.0 || blink > 0.5)) {\n float level = clamp(-pitch, -MAX_PITCH, MAX_PITCH) * ROWS_PER_DEGREE;\n float ky = sin(radians(roll));\n float kx = cos(radians(roll));\n bool steep = abs(ky) >= abs(kx);\n for (int k = -4; k <= 4; k++) {\n float along = steep ? (float(k) - level) / RATIO * kx / ky + 0.5 : RATIO * float(k) * ky / kx + level + 0.5;\n float cell = floor(along);\n float ninth = floor((along - cell) * 9.0);\n if (abs(cell) > 4.0) {\n continue;\n }\n vec2 center = steep\n ? vec2(float(MIDDLE_COLUMN) + cell, float(MIDDLE_ROW - k)) * vec2(CELL_WIDTH, CELL_HEIGHT) + vec2(2.0 + ninth, 9.0)\n : vec2(float(MIDDLE_COLUMN + k), float(MIDDLE_ROW) - cell) * vec2(CELL_WIDTH, CELL_HEIGHT) + vec2(6.0, 17.0 - 2.0 * ninth);\n float d = length(p + 0.5 - center);\n paint(ink, fill, d < 1.0 ? 2.0 : d < 2.0 ? 1.0 : 0.0, WHITE);\n }\n }\n\n // the link bar, top right: as long as the link quality, its color by it; full and red in\n // failsafe\n if (row == 1) {\n float quality = failsafe > 0.5 ? 99.0 : clamp(linkQuality, 0.0, 99.0);\n vec3 color = failsafe > 0.5 || quality < 40.0 ? RED : quality < 70.0 ? ORANGE : GREEN;\n float left = float(LINK_COLUMN) * CELL_WIDTH;\n float bar = floor(LINK_CELLS * CELL_WIDTH * (quality + 1.0) / 100.0);\n if (bar > 0.0) {\n paint(ink, fill, boxInk(p, vec2(left, CELL_HEIGHT + 7.0), vec2(left + bar, CELL_HEIGHT + 11.0)), color);\n }\n }\n\n // the battery symbol, top right before its voltage: a white frame with a cap, filled in green\n // from the bottom in steps as the voltage drops, black inside above the fill\n if (column == LINK_COLUMN && row == 2) {\n float charge = clamp((voltage - EMPTY_VOLTS) / (FULL_VOLTS - EMPTY_VOLTS), 0.0, 1.0);\n float fillTop = 17.0 - 13.0 * ceil(charge * BATTERY_STEPS) / BATTERY_STEPS;\n paint(ink, fill, max(boxInk(inCell, vec2(2.0, 3.0), vec2(10.0, 18.0)), boxInk(inCell, vec2(4.0, 1.0), vec2(8.0, 3.0))), WHITE);\n if (all(greaterThanEqual(inCell, vec2(3.0, 4.0))) && all(lessThan(inCell, vec2(9.0, 17.0)))) {\n ink = inCell.y >= fillTop ? 2.0 : 1.0;\n fill = GREEN;\n }\n }\n\n // the green dot inside the altitude's mountain\n if (glyph == ALTITUDE) {\n paint(ink, fill, all(greaterThanEqual(inCell, vec2(3.0, 4.0))) && all(lessThan(inCell, vec2(5.0, 6.0))) ? 2.0 : 0.0, GREEN);\n }\n\n vec3 color = ink == 2.0 ? fill : ink == 1.0 ? vec3(0.0) : sceneColor.rgb;\n out_FragColor = vec4(mix(sceneColor.rgb, color, ink > 0.0 ? opacity : 0.0), sceneColor.a);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=DroneDisplay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroneDisplay.d.ts","sourceRoot":"","sources":["../../src/shaders/DroneDisplay.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from DroneDisplay.glsl.
2
+ export default "// A drone's OSD, as ArduPilot draws it on an HD video system: 50 columns and 18 rows of 12 x 18\n// pixel character cells over the whole picture, with the readouts near its edges, here in the\n// blocky white glyphs of an analog chip with their black outline, and some in color. The layout\n// follows a fixed-wing plane's display; the glyphs are drawn here, not copied from a font.\n// - The horizon: 9 dots of 2 x 2 pixels around the middle, as ArduPilot's draw_horizon: pitch (at\n// most 20 degrees) moves it a row per 5 degrees, and roll tilts it at its angle on the screen;\n// each dot is at one of 9 heights in its cell, or past 45 degrees of roll, one per row at one of\n// 9 places across its cell. A dot more than 4 cells from the middle is not drawn, and upside\n// down the horizon blinks. It is a symbol, not lined up with the real horizon.\n// - The flight mode, top left: FBWA, RTL in failsafe; the heading, top middle.\n// - Top right, the link bar, green, orange then red as the link quality drops, and the battery,\n// its symbol filled in green in 7 steps, and its voltage.\n// - The right column: the altitude since the display turned on, under a mountain with a green\n// dot; the vertical speed, with one or two green arrows; the throttle.\n// - The air speed, bottom middle, after its pale blue label.\n// - The FAILSAFE warning, blinking red in the lower part of the middle while the control link is\n// lost.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// 0 to 1\nuniform float opacity;\n// degrees, negative looking down\nuniform float pitch;\n// degrees, positive to the right\nuniform float roll;\n// degrees, 0 to 360\nuniform float heading;\n// meters, since the display turned on\nuniform float altitude;\n// m/s, positive climbing\nuniform float verticalSpeed;\n// km/h\nuniform float speed;\n// volts\nuniform float voltage;\n// 0 to 99\nuniform float linkQuality;\n// percent\nuniform float throttle;\n// 1 while the control link is lost, 0 otherwise\nuniform float failsafe;\n// 1 or 0, twice per second: the blinking of the warning and of the horizon upside down\nuniform float blink;\nin vec2 v_textureCoordinates;\n\nconst float COLUMNS = 50.0;\nconst float ROWS = 18.0;\n// a cell, in pixels\nconst float CELL_WIDTH = 12.0;\nconst float CELL_HEIGHT = 18.0;\n// the middle cell, where the horizon is\nconst int MIDDLE_COLUMN = 24;\nconst int MIDDLE_ROW = 8;\n// ArduPilot's horizon: its limit in pitch, rows per degree of it (16 rows per 80 degrees), and\n// rows per column at 45 degrees of roll, for the line to tilt at its angle\nconst float MAX_PITCH = 20.0;\nconst float ROWS_PER_DEGREE = 0.2;\nconst float RATIO = CELL_WIDTH / CELL_HEIGHT;\n// battery: volts full and empty of a 3S, and the steps of its symbol's fill (full, 5 to 1, empty)\nconst float FULL_VOLTS = 12.6;\nconst float EMPTY_VOLTS = 10.5;\nconst float BATTERY_STEPS = 6.0;\n// the right column: the units in its last column, right of the numbers\nconst int UNIT_COLUMN = 41;\n// the link bar: its first column, and its length in cells\nconst int LINK_COLUMN = 36;\nconst float LINK_CELLS = 6.0;\n\nconst vec3 WHITE = vec3(1.0);\nconst vec3 GREEN = vec3(0.2, 0.85, 0.35);\nconst vec3 ORANGE = vec3(1.0, 0.6, 0.1);\nconst vec3 RED = vec3(0.95, 0.15, 0.15);\nconst vec3 PALE_BLUE = vec3(0.55, 0.75, 0.95);\n\n// the glyphs, at 12 x 18 pixels: one row of 12 bits each, the leftmost bit highest; the table is\n// written by scripts/osd-font.js from its pixel drawings\nconst int DOT = 10;\nconst int SPACE = 11;\nconst int MINUS = 12;\nconst int VOLT = 13;\nconst int DEGREE = 14;\nconst int PERCENT = 15;\n// the units of the altitude, the vertical speed and the air speed, and the air speed's label\nconst int ALTITUDE = 16;\nconst int METERS_PER_SECOND = 17;\nconst int KILOMETERS_PER_HOUR = 18;\nconst int AIR_SPEED = 19;\n// the vertical speed's arrows\nconst int UP = 20;\nconst int UP_TWO = 21;\nconst int DOWN = 22;\nconst int DOWN_TWO = 23;\n// the letters of the flight modes and the warning\nconst int LETTER_F = 24;\nconst int LETTER_B = 25;\nconst int LETTER_W = 26;\nconst int LETTER_A = 27;\nconst int LETTER_R = 28;\nconst int LETTER_T = 29;\nconst int LETTER_L = 30;\nconst int LETTER_I = 31;\nconst int LETTER_E = 32;\nconst int LETTER_S = 33;\n// the warning's row and first column: FAILSAFE, centered under the middle\nconst int WARNING_ROW = 12;\nconst int WARNING_COLUMN = 21;\n\nconst int FONT[612] = int[612](\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1474704, 1474704, 1474704, 1474704, 1671264, 983040, 0, 0, 0, 0, // 0\n 0, 0, 0, 917504, 1704000, 1179840, 1704000, 655424, 655424, 655424, 655424, 1769536, 1114336, 2031616, 0, 0, 0, 0, // 1\n 0, 0, 0, 983040, 1671264, 1474704, 1998864, 426000, 884768, 1769536, 1441920, 1540224, 1081584, 2064384, 0, 0, 0, 0, // 2\n 0, 0, 0, 2031616, 1147104, 1998864, 163856, 950288, 622688, 950288, 163856, 1998864, 1147104, 2031616, 0, 0, 0, 0, // 3\n 0, 0, 0, 2064384, 1474704, 1474704, 1474704, 1474704, 1081584, 1998864, 163856, 163856, 163856, 229376, 0, 0, 0, 0, // 4\n 0, 0, 0, 2064384, 1081584, 1540224, 1507456, 1147104, 1998864, 163856, 1998864, 1474704, 1671264, 983040, 0, 0, 0, 0, // 5\n 0, 0, 0, 983040, 1638496, 1507456, 1507456, 1147104, 1474704, 1474704, 1474704, 1474704, 1671264, 983040, 0, 0, 0, 0, // 6\n 0, 0, 0, 2064384, 1081584, 1998864, 426000, 360480, 852000, 720960, 655424, 655424, 655424, 917504, 0, 0, 0, 0, // 7\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1671264, 1474704, 1474704, 1474704, 1671264, 983040, 0, 0, 0, 0, // 8\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1605744, 950288, 163856, 950288, 622688, 983040, 0, 0, 0, 0, // 9\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 983040, 589920, 589920, 983040, 0, 0, 0, 0, // .\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // space\n 0, 0, 0, 0, 0, 0, 0, 2064384, 1081584, 2064384, 0, 0, 0, 0, 0, 0, 0, 0, // -\n 0, 0, 0, 0, 0, 0, 3899392, 2785552, 2785552, 3047696, 3506336, 1376416, 1769536, 917504, 0, 0, 0, 0, // v, volts\n 0, 0, 1966080, 3342528, 2949408, 2949408, 3342528, 1966080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // °, degrees\n 0, 0, 0, 0, 7979008, 4932360, 5161744, 8224800, 1769536, 3653760, 7225624, 5915160, 7585792, 0, 0, 0, 0, 0, // %\n 1835008, 3539072, 7061824, 14508584, 11973652, 6543362, 12611584, 0, 4128768, 2195936, 2785616, 2785616, 2785616, 4161536, 0, 0, 0, 0, // a mountain over m, the altitude; the shader adds a green dot inside\n 0, 4128768, 2195936, 2785616, 2785616, 2785616, 4161536, 0, 983040, 1638496, 1507456, 1769536, 1900576, 1245376, 1966080, 0, 0, 0, // m over s, meters per second\n 14680064, 12567552, 11036024, 10135124, 11183444, 11183444, 16769024, 917504, 655424, 720960, 622688, 688208, 688208, 1015808, 0, 0, 0, 0, // km over h, kilometers per hour\n 0, 8257536, 14410304, 11445524, 9070424, 11191632, 11175248, 16744448, 15757312, 2022914, 7575750, 1400490, 13849290, 1547910, 16576512, 0, 0, 0, // Air over Spd, the air speed\n 0, 0, 0, 0, 0, 0, 917504, 1769536, 3244256, 6341104, 4211704, 8372224, 0, 0, 0, 0, 0, 0, // an arrow up\n 0, 0, 917504, 1769536, 3244256, 6341104, 4211704, 8372224, 0, 917504, 1769536, 3244256, 6341104, 4211704, 8372224, 0, 0, 0, // two arrows up\n 0, 0, 0, 0, 0, 0, 8372224, 4211704, 6341104, 3244256, 1769536, 917504, 0, 0, 0, 0, 0, 0, // an arrow down\n 0, 0, 8372224, 4211704, 6341104, 3244256, 1769536, 917504, 0, 8372224, 4211704, 6341104, 3244256, 1769536, 917504, 0, 0, 0, // two arrows down\n 0, 0, 0, 2064384, 1081584, 1540224, 1310848, 1507456, 1114336, 1507456, 1310848, 1310848, 1310848, 1835008, 0, 0, 0, 0, // F\n 0, 0, 0, 2031616, 1147104, 1474704, 1474704, 1474704, 1147104, 1474704, 1474704, 1474704, 1147104, 2031616, 0, 0, 0, 0, // B\n 0, 0, 0, 3899392, 2785552, 2785552, 2785552, 3047696, 2785616, 2785616, 2785616, 2785616, 3506336, 2031616, 0, 0, 0, 0, // W\n 0, 0, 0, 983040, 1671264, 1474704, 1474704, 1474704, 1081584, 1474704, 1474704, 1474704, 1474704, 2064384, 0, 0, 0, 0, // A\n 0, 0, 0, 2031616, 1147104, 1474704, 1474704, 1474704, 1147104, 1409184, 1474704, 1474704, 1474704, 2064384, 0, 0, 0, 0, // R\n 0, 0, 0, 4161536, 2130416, 3899456, 655424, 655424, 655424, 655424, 655424, 655424, 655424, 917504, 0, 0, 0, 0, // T\n 0, 0, 0, 1835008, 1310848, 1310848, 1310848, 1310848, 1310848, 1310848, 1310848, 1540224, 1081584, 2064384, 0, 0, 0, 0, // L\n 0, 0, 0, 2031616, 1114336, 1769536, 655424, 655424, 655424, 655424, 655424, 1769536, 1114336, 2031616, 0, 0, 0, 0, // I\n 0, 0, 0, 2064384, 1081584, 1540224, 1310848, 1507456, 1114336, 1507456, 1310848, 1540224, 1081584, 2064384, 0, 0, 0, 0, // E\n 0, 0, 0, 1015808, 1605744, 1540224, 1310848, 1507456, 1671264, 950288, 163856, 1998864, 1147104, 2031616, 0, 0, 0, 0 // S\n);\n\nint digit(float value, float power) {\n return int(mod(floor(value / power), 10.0));\n}\n\n// 10 to the n, exactly: pow may be off by a little on the GPU\nfloat powerOfTen(int n) {\n return n == 3 ? 1000.0 : n == 2 ? 100.0 : n == 1 ? 10.0 : 1.0;\n}\n\n// a number right-aligned to end at the column last: its whole part, and its tenths after a dot,\n// and a minus before it when negative; -1 left of it\nint numberAt(float value, bool tenths, int column, int last) {\n float scaled = floor(abs(value) * (tenths ? 10.0 : 1.0) + 0.5);\n float whole = tenths ? floor(scaled / 10.0) : scaled;\n int digits = whole >= 1000.0 ? 4 : whole >= 100.0 ? 3 : whole >= 10.0 ? 2 : 1;\n int i = last - column;\n if (tenths) {\n if (i == 0) {\n return digit(scaled, 1.0);\n }\n if (i == 1) {\n return DOT;\n }\n i -= 2;\n }\n if (i >= 0 && i < digits) {\n return digit(whole, powerOfTen(i));\n }\n return i == digits && value < 0.0 && scaled > 0.0 ? MINUS : -1;\n}\n\n// the glyph in this cell and its color, or -1\nint glyphAt(int column, int row, out vec3 color) {\n color = WHITE;\n // the flight mode, top left\n if (row == 1 && column >= 3 && column <= 6) {\n int i = column - 3;\n if (failsafe > 0.5) {\n return i == 0 ? LETTER_R : i == 1 ? LETTER_T : i == 2 ? LETTER_L : -1;\n }\n return i == 0 ? LETTER_F : i == 1 ? LETTER_B : i == 2 ? LETTER_W : LETTER_A;\n }\n // the heading, top middle\n if (row == 1 && column >= 23 && column <= 26) {\n return column == 26 ? DEGREE : numberAt(mod(floor(heading + 0.5), 360.0), false, column, 25);\n }\n // the battery voltage, top right after its symbol: 12.0v\n if (row == 2 && column > LINK_COLUMN && column <= UNIT_COLUMN) {\n return column == UNIT_COLUMN ? VOLT : numberAt(clamp(voltage, 0.0, 99.9), true, column, UNIT_COLUMN - 1);\n }\n // the right column: the altitude, the vertical speed after its arrows, the throttle\n bool right = column >= UNIT_COLUMN - 6 && column <= UNIT_COLUMN;\n if (row == MIDDLE_ROW && right) {\n return column == UNIT_COLUMN ? ALTITUDE : numberAt(clamp(altitude, -999.0, 9999.0), false, column, UNIT_COLUMN - 1);\n }\n if (row == MIDDLE_ROW + 1 && right) {\n if (column == UNIT_COLUMN) {\n return METERS_PER_SECOND;\n }\n float climb = min(abs(verticalSpeed), 99.9);\n int width = climb >= 9.95 ? 4 : 3;\n if (column == UNIT_COLUMN - 1 - width) {\n color = GREEN;\n bool up = verticalSpeed > 0.0;\n return climb < 0.05 ? -1 : climb < 5.0 ? (up ? UP : DOWN) : (up ? UP_TWO : DOWN_TWO);\n }\n return numberAt(climb, true, column, UNIT_COLUMN - 1);\n }\n if (row == MIDDLE_ROW + 3 && right) {\n return column == UNIT_COLUMN ? PERCENT : numberAt(clamp(throttle, 0.0, 100.0), false, column, UNIT_COLUMN - 1);\n }\n // the warning\n if (failsafe > 0.5 && blink > 0.5 && row == WARNING_ROW && column >= WARNING_COLUMN && column < WARNING_COLUMN + 8) {\n int i = column - WARNING_COLUMN;\n color = RED;\n return i == 0 ? LETTER_F : i == 1 ? LETTER_A : i == 2 ? LETTER_I : i == 3 ? LETTER_L : i == 4 ? LETTER_S : i == 5 ? LETTER_A : i == 6 ? LETTER_F : LETTER_E;\n }\n // the air speed, bottom middle: its label, whole km/h and the unit\n if (row == 16 && column >= 20 && column <= 25) {\n if (column == 20) {\n color = PALE_BLUE;\n return AIR_SPEED;\n }\n return column == 25 ? KILOMETERS_PER_HOUR : numberAt(clamp(speed, 0.0, 999.0), false, column, 24);\n }\n return -1;\n}\n\n// 2 where the glyph is drawn, 1 on its black outline, 0 elsewhere; x and y in the cell's pixels.\n// A row of the table holds the glyph in its low 12 bits and the outline in the 12 above, the\n// leftmost pixel highest\nfloat glyphInk(int glyph, int x, int y) {\n if (glyph < 0) {\n return 0.0;\n }\n int row = FONT[glyph * int(CELL_HEIGHT) + y] >> (int(CELL_WIDTH) - 1 - x);\n return (row & 1) == 1 ? 2.0 : ((row >> int(CELL_WIDTH)) & 1) == 1 ? 1.0 : 0.0;\n}\n\n// 2 inside the box, 1 on its outline a pixel around, 0 elsewhere; in pixels\nfloat boxInk(vec2 p, vec2 low, vec2 high) {\n if (all(greaterThanEqual(p, low)) && all(lessThan(p, high))) {\n return 2.0;\n }\n return all(greaterThanEqual(p, low - 1.0)) && all(lessThan(p, high + 1.0)) ? 1.0 : 0.0;\n}\n\n// what is drawn over what is under it, its outline under what is drawn\nvoid paint(inout float ink, inout vec3 fill, float layer, vec3 color) {\n if (layer > ink) {\n ink = layer;\n fill = color;\n }\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n // the grid as large as fits the screen, centered, from its top left, in pixels\n vec2 size = czm_viewport.zw;\n vec2 grid = vec2(COLUMNS * CELL_WIDTH, ROWS * CELL_HEIGHT);\n float scale = min(size.x / grid.x, size.y / grid.y);\n vec2 fromCorner = vec2(gl_FragCoord.x - czm_viewport.x, czm_viewport.y + size.y - gl_FragCoord.y) - 0.5 * (size - grid * scale);\n vec2 p = floor(fromCorner / scale);\n int column = int(floor(p.x / CELL_WIDTH));\n int row = int(floor(p.y / CELL_HEIGHT));\n if (column < 0 || column >= int(COLUMNS) || row < 0 || row >= int(ROWS)) {\n out_FragColor = sceneColor;\n return;\n }\n vec2 inCell = p - vec2(float(column) * CELL_WIDTH, float(row) * CELL_HEIGHT);\n\n vec3 glyphColor;\n int glyph = glyphAt(column, row, glyphColor);\n float ink = 0.0;\n vec3 fill = WHITE;\n paint(ink, fill, glyphInk(glyph, int(inCell.x), int(inCell.y)), glyphColor);\n\n // the horizon, as ArduPilot's draw_horizon in rows and columns from the middle cell, with the\n // pitch (positive nose down) raising it: a dot per column, at its height in the cell in ninths,\n // or past 45 degrees of roll a dot per row, at its place across the cell in ninths\n bool nearMiddle = abs(column - MIDDLE_COLUMN) <= 5 && abs(row - MIDDLE_ROW) <= 5;\n if (nearMiddle && (abs(roll) < 90.0 || blink > 0.5)) {\n float level = clamp(-pitch, -MAX_PITCH, MAX_PITCH) * ROWS_PER_DEGREE;\n float ky = sin(radians(roll));\n float kx = cos(radians(roll));\n bool steep = abs(ky) >= abs(kx);\n for (int k = -4; k <= 4; k++) {\n float along = steep ? (float(k) - level) / RATIO * kx / ky + 0.5 : RATIO * float(k) * ky / kx + level + 0.5;\n float cell = floor(along);\n float ninth = floor((along - cell) * 9.0);\n if (abs(cell) > 4.0) {\n continue;\n }\n vec2 center = steep\n ? vec2(float(MIDDLE_COLUMN) + cell, float(MIDDLE_ROW - k)) * vec2(CELL_WIDTH, CELL_HEIGHT) + vec2(2.0 + ninth, 9.0)\n : vec2(float(MIDDLE_COLUMN + k), float(MIDDLE_ROW) - cell) * vec2(CELL_WIDTH, CELL_HEIGHT) + vec2(6.0, 17.0 - 2.0 * ninth);\n float d = length(p + 0.5 - center);\n paint(ink, fill, d < 1.0 ? 2.0 : d < 2.0 ? 1.0 : 0.0, WHITE);\n }\n }\n\n // the link bar, top right: as long as the link quality, its color by it; full and red in\n // failsafe\n if (row == 1) {\n float quality = failsafe > 0.5 ? 99.0 : clamp(linkQuality, 0.0, 99.0);\n vec3 color = failsafe > 0.5 || quality < 40.0 ? RED : quality < 70.0 ? ORANGE : GREEN;\n float left = float(LINK_COLUMN) * CELL_WIDTH;\n float bar = floor(LINK_CELLS * CELL_WIDTH * (quality + 1.0) / 100.0);\n if (bar > 0.0) {\n paint(ink, fill, boxInk(p, vec2(left, CELL_HEIGHT + 7.0), vec2(left + bar, CELL_HEIGHT + 11.0)), color);\n }\n }\n\n // the battery symbol, top right before its voltage: a white frame with a cap, filled in green\n // from the bottom in steps as the voltage drops, black inside above the fill\n if (column == LINK_COLUMN && row == 2) {\n float charge = clamp((voltage - EMPTY_VOLTS) / (FULL_VOLTS - EMPTY_VOLTS), 0.0, 1.0);\n float fillTop = 17.0 - 13.0 * ceil(charge * BATTERY_STEPS) / BATTERY_STEPS;\n paint(ink, fill, max(boxInk(inCell, vec2(2.0, 3.0), vec2(10.0, 18.0)), boxInk(inCell, vec2(4.0, 1.0), vec2(8.0, 3.0))), WHITE);\n if (all(greaterThanEqual(inCell, vec2(3.0, 4.0))) && all(lessThan(inCell, vec2(9.0, 17.0)))) {\n ink = inCell.y >= fillTop ? 2.0 : 1.0;\n fill = GREEN;\n }\n }\n\n // the green dot inside the altitude's mountain\n if (glyph == ALTITUDE) {\n paint(ink, fill, all(greaterThanEqual(inCell, vec2(3.0, 4.0))) && all(lessThan(inCell, vec2(5.0, 6.0))) ? 2.0 : 0.0, GREEN);\n }\n\n vec3 color = ink == 2.0 ? fill : ink == 1.0 ? vec3(0.0) : sceneColor.rgb;\n out_FragColor = vec4(mix(sceneColor.rgb, color, ink > 0.0 ? opacity : 0.0), sceneColor.a);\n}\n";
3
+ //# sourceMappingURL=DroneDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroneDisplay.js","sourceRoot":"","sources":["../../src/shaders/DroneDisplay.js"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAe,k2hBAAk2hB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The Dufour map's look, after EyeFromDepth, DepthEdges, Height, Normal and Hash: the slopes drawn in hachures, ink\n// strokes down the steepest slope, broken along their length, thicker where it is steeper and on the slopes away from a\n// light from the north-west, the flat ground left blank; the silhouettes outlined; black ink on white paper.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// the strokes' spacing on the screen, in pixels, their length in spacings, the ink's weight\nuniform float spacing;\nuniform float strokeLength;\nuniform float weight;\n// how much thinner the strokes facing the light, and thicker away from it, 0 to 1\nuniform float oblique;\n// the slope under which the ground is left blank, radians\nuniform float flatSlope;\nuniform float outline;\nuniform vec3 paper;\nuniform vec3 ink;\n// the hachures' frame, in eye coordinates: its origin on the ground below the camera, east and north there (dufour.js)\nuniform vec3 originEC;\nuniform vec3 eastEC;\nuniform vec3 northEC;\nin vec2 v_textureCoordinates;\n\n// the strokes' finest spacing, in meters\nconst float BASE = 1.0;\n// the strokes' directions: the way down the slope snapped to one of these many, the two nearest blended, so that the\n// strokes are straight lines, parallel on a slope, rather than turning with each pixel's normal\nconst float DIRECTIONS = 12.0;\n// a stroke's breaks: its length in spacings, strokeLength long on average, and the share of it left blank\nconst float BREAK = 0.08;\n// the light, from the north-west, in east and north\nconst vec2 LIGHT = vec2(-0.7071, 0.7071);\n// the ink's share grows with the slope, none on the flat, all of it at 60 degrees (radians), Lehmann's scale\n// stretched for the Alps, whose slopes are mostly past his 45; the\n// widest share of the spacing a stroke covers, the paper showing between them, an engraving's\nconst float LEHMANN = 1.047;\nconst float MAX_COVER = 0.45;\n// the slopes over which the strokes fade in above the flat ground, radians (2 degrees): the terrain's triangles,\n// slightly tilted, would show as patches\nconst float FLAT_RAMP = 0.035;\n\n// the strokes' ink at a point of the ground, en its east and north, s their spacing in meters, angle the direction\n// down the slope they run along, cover the share of the spacing they cover. Each stroke is a straight line along it,\n// broken every strokeLength spacings or so, its breaks staggered from the next stroke's: no line across the strokes\nfloat hachuresAt(vec2 en, float angle, vec2 across, float cover, float s) {\n vec2 down = vec2(-across.y, across.x);\n // a phase of each direction, so that two directions' strokes do not meet in a pattern\n float u = dot(en, across) / s + hash(vec2(angle, s));\n float stroke = floor(u);\n float w = dot(en, down) / (strokeLength * s) + hash(vec2(stroke, s));\n float dash = step(BREAK, fract(w * mix(0.8, 1.25, hash(vec2(s, stroke)))));\n // antialiased, and its mean, the share it covers, where the strokes grow too close to tell apart (a slope seen\n // edge on): no ink where it covers none\n float halfWidth = 0.5 * cover;\n float aa = fwidth(u);\n float sharp = 1.0 - smoothstep(halfWidth - aa, halfWidth + aa, abs(fract(u) - 0.5));\n return mix(sharp * dash, 2.0 * halfWidth * (1.0 - BREAK), smoothstep(0.2, 0.5, aa)) * step(1e-3, halfWidth);\n}\n\n// the strokes in one direction, their spacing a power of two of meters, crossfaded with the next, so that they stay at\n// least spacing pixels apart: taken from the ground a pixel covers across them, far more than its width where a slope\n// is seen at a grazing angle\nfloat directionAt(vec2 en, float angle, float cover) {\n vec2 across = vec2(-sin(angle), cos(angle));\n float lod = log2(max(spacing * fwidth(dot(en, across)), BASE) / BASE);\n float s = BASE * exp2(floor(lod));\n return mix(hachuresAt(en, angle, across, cover, s), hachuresAt(en, angle, across, cover, 2.0 * s), fract(lod));\n}\n\n// the strokes in both of the directions nearest the way down, blended\nfloat strokesAt(vec2 en, vec2 down, float cover) {\n // the strokes are lines: a direction and its opposite are the same\n float t = mod(atan(down.y, down.x), czm_pi) / czm_pi * DIRECTIONS;\n float bin = floor(t);\n float width = czm_pi / DIRECTIONS;\n return mix(directionAt(en, bin * width, cover), directionAt(en, (bin + 1.0) * width, cover), smoothstep(0.4, 0.6, fract(t)));\n}\n\nvoid main() {\n vec2 uv = v_textureCoordinates;\n vec4 sceneColor = texture(colorTexture, uv);\n vec4 eye = eyeAt(depthTexture, uv);\n if (eye.w == 0.0) {\n out_FragColor = vec4(paper, 1.0);\n return;\n }\n float px = czm_pixelRatio;\n // averaged wider than smoothNormalAt: the slopes of the terrain's triangles would set the strokes' width\n vec3 normal = normalize(normalAt(depthTexture, uv, eye.xyz, 4.0 * px) + normalAt(depthTexture, uv, eye.xyz, 12.0 * px) + normalAt(depthTexture, uv, eye.xyz, 24.0 * px));\n float rise = dot(normal, up);\n float slope = acos(clamp(rise, -1.0, 1.0));\n float c = depthAt(uv);\n\n // the way down the slope, the horizontal part of a normal smoothed wider: the strokes' direction would wobble with\n // the terrain's triangles\n vec3 wide = normalize(normal + normalAt(depthTexture, uv, eye.xyz, 32.0 * px));\n vec3 horizontal = wide - dot(wide, up) * up;\n vec2 down = normalize(vec2(dot(horizontal, eastEC), dot(horizontal, northEC)) + 1e-6);\n vec3 rel = eye.xyz - originEC;\n vec2 en = vec2(dot(rel, eastEC), dot(rel, northEC));\n float steep = smoothstep(flatSlope, flatSlope + FLAT_RAMP, slope) * clamp(slope / LEHMANN, 0.0, 1.0);\n float cover = clamp(weight * steep * (1.0 - oblique * dot(down, LIGHT)), 0.0, MAX_COVER);\n // read everywhere, outside any branch, for its derivatives\n float amount = strokesAt(en, down, cover);\n\n if (outline > 0.0) {\n amount = max(amount, outline * outlineAt(uv, c, vec4(0.0), 1.0, pixelAt(c)));\n }\n out_FragColor = vec4(mix(paper, ink, amount), sceneColor.a);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Dufour.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dufour.d.ts","sourceRoot":"","sources":["../../src/shaders/Dufour.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Dufour.glsl.
2
+ export default "// The Dufour map's look, after EyeFromDepth, DepthEdges, Height, Normal and Hash: the slopes drawn in hachures, ink\n// strokes down the steepest slope, broken along their length, thicker where it is steeper and on the slopes away from a\n// light from the north-west, the flat ground left blank; the silhouettes outlined; black ink on white paper.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// the strokes' spacing on the screen, in pixels, their length in spacings, the ink's weight\nuniform float spacing;\nuniform float strokeLength;\nuniform float weight;\n// how much thinner the strokes facing the light, and thicker away from it, 0 to 1\nuniform float oblique;\n// the slope under which the ground is left blank, radians\nuniform float flatSlope;\nuniform float outline;\nuniform vec3 paper;\nuniform vec3 ink;\n// the hachures' frame, in eye coordinates: its origin on the ground below the camera, east and north there (dufour.js)\nuniform vec3 originEC;\nuniform vec3 eastEC;\nuniform vec3 northEC;\nin vec2 v_textureCoordinates;\n\n// the strokes' finest spacing, in meters\nconst float BASE = 1.0;\n// the strokes' directions: the way down the slope snapped to one of these many, the two nearest blended, so that the\n// strokes are straight lines, parallel on a slope, rather than turning with each pixel's normal\nconst float DIRECTIONS = 12.0;\n// a stroke's breaks: its length in spacings, strokeLength long on average, and the share of it left blank\nconst float BREAK = 0.08;\n// the light, from the north-west, in east and north\nconst vec2 LIGHT = vec2(-0.7071, 0.7071);\n// the ink's share grows with the slope, none on the flat, all of it at 60 degrees (radians), Lehmann's scale\n// stretched for the Alps, whose slopes are mostly past his 45; the\n// widest share of the spacing a stroke covers, the paper showing between them, an engraving's\nconst float LEHMANN = 1.047;\nconst float MAX_COVER = 0.45;\n// the slopes over which the strokes fade in above the flat ground, radians (2 degrees): the terrain's triangles,\n// slightly tilted, would show as patches\nconst float FLAT_RAMP = 0.035;\n\n// the strokes' ink at a point of the ground, en its east and north, s their spacing in meters, angle the direction\n// down the slope they run along, cover the share of the spacing they cover. Each stroke is a straight line along it,\n// broken every strokeLength spacings or so, its breaks staggered from the next stroke's: no line across the strokes\nfloat hachuresAt(vec2 en, float angle, vec2 across, float cover, float s) {\n vec2 down = vec2(-across.y, across.x);\n // a phase of each direction, so that two directions' strokes do not meet in a pattern\n float u = dot(en, across) / s + hash(vec2(angle, s));\n float stroke = floor(u);\n float w = dot(en, down) / (strokeLength * s) + hash(vec2(stroke, s));\n float dash = step(BREAK, fract(w * mix(0.8, 1.25, hash(vec2(s, stroke)))));\n // antialiased, and its mean, the share it covers, where the strokes grow too close to tell apart (a slope seen\n // edge on): no ink where it covers none\n float halfWidth = 0.5 * cover;\n float aa = fwidth(u);\n float sharp = 1.0 - smoothstep(halfWidth - aa, halfWidth + aa, abs(fract(u) - 0.5));\n return mix(sharp * dash, 2.0 * halfWidth * (1.0 - BREAK), smoothstep(0.2, 0.5, aa)) * step(1e-3, halfWidth);\n}\n\n// the strokes in one direction, their spacing a power of two of meters, crossfaded with the next, so that they stay at\n// least spacing pixels apart: taken from the ground a pixel covers across them, far more than its width where a slope\n// is seen at a grazing angle\nfloat directionAt(vec2 en, float angle, float cover) {\n vec2 across = vec2(-sin(angle), cos(angle));\n float lod = log2(max(spacing * fwidth(dot(en, across)), BASE) / BASE);\n float s = BASE * exp2(floor(lod));\n return mix(hachuresAt(en, angle, across, cover, s), hachuresAt(en, angle, across, cover, 2.0 * s), fract(lod));\n}\n\n// the strokes in both of the directions nearest the way down, blended\nfloat strokesAt(vec2 en, vec2 down, float cover) {\n // the strokes are lines: a direction and its opposite are the same\n float t = mod(atan(down.y, down.x), czm_pi) / czm_pi * DIRECTIONS;\n float bin = floor(t);\n float width = czm_pi / DIRECTIONS;\n return mix(directionAt(en, bin * width, cover), directionAt(en, (bin + 1.0) * width, cover), smoothstep(0.4, 0.6, fract(t)));\n}\n\nvoid main() {\n vec2 uv = v_textureCoordinates;\n vec4 sceneColor = texture(colorTexture, uv);\n vec4 eye = eyeAt(depthTexture, uv);\n if (eye.w == 0.0) {\n out_FragColor = vec4(paper, 1.0);\n return;\n }\n float px = czm_pixelRatio;\n // averaged wider than smoothNormalAt: the slopes of the terrain's triangles would set the strokes' width\n vec3 normal = normalize(normalAt(depthTexture, uv, eye.xyz, 4.0 * px) + normalAt(depthTexture, uv, eye.xyz, 12.0 * px) + normalAt(depthTexture, uv, eye.xyz, 24.0 * px));\n float rise = dot(normal, up);\n float slope = acos(clamp(rise, -1.0, 1.0));\n float c = depthAt(uv);\n\n // the way down the slope, the horizontal part of a normal smoothed wider: the strokes' direction would wobble with\n // the terrain's triangles\n vec3 wide = normalize(normal + normalAt(depthTexture, uv, eye.xyz, 32.0 * px));\n vec3 horizontal = wide - dot(wide, up) * up;\n vec2 down = normalize(vec2(dot(horizontal, eastEC), dot(horizontal, northEC)) + 1e-6);\n vec3 rel = eye.xyz - originEC;\n vec2 en = vec2(dot(rel, eastEC), dot(rel, northEC));\n float steep = smoothstep(flatSlope, flatSlope + FLAT_RAMP, slope) * clamp(slope / LEHMANN, 0.0, 1.0);\n float cover = clamp(weight * steep * (1.0 - oblique * dot(down, LIGHT)), 0.0, MAX_COVER);\n // read everywhere, outside any branch, for its derivatives\n float amount = strokesAt(en, down, cover);\n\n if (outline > 0.0) {\n amount = max(amount, outline * outlineAt(uv, c, vec4(0.0), 1.0, pixelAt(c)));\n }\n out_FragColor = vec4(mix(paper, ink, amount), sceneColor.a);\n}\n";
3
+ //# sourceMappingURL=Dufour.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dufour.js","sourceRoot":"","sources":["../../src/shaders/Dufour.js"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAe,q4LAAq4L,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// Eye coordinates of the pixel at uv, from the depth texture; w is 0 for the sky. With a\n// logarithmic depth buffer, czm_readDepth's perspective depth is about 1 beyond a few meters,\n// so the distance is decoded from the logarithmic depth directly. An orthographic camera's depth\n// is linear between the near and far planes Cesium fits to the scene each frame, not the\n// projection's, and its rays are parallel; Cesium gives it no inverse projection (zero).\n\n// A sampler's default precision is low: some phones' GPUs (Mali) then read the depth as a half float,\n// steps of centimeters a few hundred meters away.\nprecision highp sampler2D;\n\nvec4 eyeAt(sampler2D depthTexture, vec2 uv) {\n float raw = texture(depthTexture, uv).r;\n if (czm_orthographicIn3D == 1.0) {\n vec2 xy = (2.0 * uv - 1.0 - czm_projection[3].xy) / vec2(czm_projection[0][0], czm_projection[1][1]);\n return raw >= 1.0 ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(xy, -mix(czm_currentFrustum.x, czm_currentFrustum.y, raw), 1.0);\n }\n // the pixel's view ray, through the near plane\n vec4 ray = czm_inverseProjection * vec4(2.0 * uv - 1.0, -1.0, 1.0);\n ray.xyz /= ray.w;\n if (raw >= 1.0) {\n return vec4(normalize(ray.xyz), 0.0);\n }\n#ifdef LOG_DEPTH\n float viewDepth = exp2(raw * czm_log2FarDepthFromNearPlusOne) - 1.0 + czm_currentFrustum.x;\n#else\n vec4 eye = czm_inverseProjection * vec4(2.0 * uv - 1.0, 2.0 * raw - 1.0, 1.0);\n float viewDepth = -eye.z / eye.w;\n#endif\n return vec4(ray.xyz * (viewDepth / -ray.z), 1.0);\n}\n\n// the distance to the pixel at uv, in meters, and the sky as far as a given distance\nfloat eyeDistance(sampler2D depthTexture, vec2 uv, float skyDistance) {\n vec4 eye = eyeAt(depthTexture, uv);\n return eye.w == 0.0 ? skyDistance : length(eye.xyz);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=EyeFromDepth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EyeFromDepth.d.ts","sourceRoot":"","sources":["../../src/shaders/EyeFromDepth.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from EyeFromDepth.glsl.
2
+ export default "// Eye coordinates of the pixel at uv, from the depth texture; w is 0 for the sky. With a\n// logarithmic depth buffer, czm_readDepth's perspective depth is about 1 beyond a few meters,\n// so the distance is decoded from the logarithmic depth directly. An orthographic camera's depth\n// is linear between the near and far planes Cesium fits to the scene each frame, not the\n// projection's, and its rays are parallel; Cesium gives it no inverse projection (zero).\n\n// A sampler's default precision is low: some phones' GPUs (Mali) then read the depth as a half float,\n// steps of centimeters a few hundred meters away.\nprecision highp sampler2D;\n\nvec4 eyeAt(sampler2D depthTexture, vec2 uv) {\n float raw = texture(depthTexture, uv).r;\n if (czm_orthographicIn3D == 1.0) {\n vec2 xy = (2.0 * uv - 1.0 - czm_projection[3].xy) / vec2(czm_projection[0][0], czm_projection[1][1]);\n return raw >= 1.0 ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(xy, -mix(czm_currentFrustum.x, czm_currentFrustum.y, raw), 1.0);\n }\n // the pixel's view ray, through the near plane\n vec4 ray = czm_inverseProjection * vec4(2.0 * uv - 1.0, -1.0, 1.0);\n ray.xyz /= ray.w;\n if (raw >= 1.0) {\n return vec4(normalize(ray.xyz), 0.0);\n }\n#ifdef LOG_DEPTH\n float viewDepth = exp2(raw * czm_log2FarDepthFromNearPlusOne) - 1.0 + czm_currentFrustum.x;\n#else\n vec4 eye = czm_inverseProjection * vec4(2.0 * uv - 1.0, 2.0 * raw - 1.0, 1.0);\n float viewDepth = -eye.z / eye.w;\n#endif\n return vec4(ray.xyz * (viewDepth / -ray.z), 1.0);\n}\n\n// the distance to the pixel at uv, in meters, and the sky as far as a given distance\nfloat eyeDistance(sampler2D depthTexture, vec2 uv, float skyDistance) {\n vec4 eye = eyeAt(depthTexture, uv);\n return eye.w == 0.0 ? skyDistance : length(eye.xyz);\n}\n";
3
+ //# sourceMappingURL=EyeFromDepth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EyeFromDepth.js","sourceRoot":"","sources":["../../src/shaders/EyeFromDepth.js"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAe,qwDAAqwD,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// a filmic roll-off (ACES, Narkowicz's fit) for the effects that add light to the picture: Cesium\n// has already tone mapped it, so their light would clip to flat white without it\nvec3 filmic(vec3 x) {\n return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Filmic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filmic.d.ts","sourceRoot":"","sources":["../../src/shaders/Filmic.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Filmic.glsl.
2
+ export default "// a filmic roll-off (ACES, Narkowicz's fit) for the effects that add light to the picture: Cesium\n// has already tone mapped it, so their light would clip to flat white without it\nvec3 filmic(vec3 x) {\n return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);\n}\n";
3
+ //# sourceMappingURL=Filmic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filmic.js","sourceRoot":"","sources":["../../src/shaders/Filmic.js"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAe,wSAAwS,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// A torch held to the right of and below the eye, pointing where the camera looks: a narrow\n// hotspot and a wide, dim spill around it, fading with distance, shading the relief they fall\n// on; and the hotspot's beam in the haze, raymarched through its shaft, which enters the picture\n// from the corner and ends on the bright circle it makes; the rest of the scene darkens and loses\n// its color. Without a target, it stays on toward the sky.\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// brightness of the LED, 1 for a pocket torch: the pool and the beam scale with it\nuniform float power;\n// half angle of the cone of the spill, radians\nuniform float angle;\n// meters: distance at which the light has fallen to a half\nuniform float range;\n// 0 to 1\nuniform float darkness;\n// brightness of the beam in the air, 0 to 1\nuniform float beam;\n// half angle of the hotspot, radians, the bright core of the pool and the beam's shaft in the\n// air, which is that light on its way; and its radius at the torch, meters\nuniform float beamAngle;\nuniform float beamWidth;\n// how far the beam lights the haze, meters\nuniform float beamReach;\n// brightness of the lit haze\nuniform float beamDensity;\n// Henyey-Greenstein asymmetry of the haze, 0 to 1: it scatters mostly forward, so the beam is\n// brightest looking along it\nuniform float beamAnisotropy;\nin vec2 v_textureCoordinates;\n\n// the cool white of an LED torch\nconst vec3 LIGHT_COLOR = vec3(0.7, 0.85, 1.0);\nconst float INTENSITY = 1.4;\n// shading of a surface facing away from the torch, relative to one facing it: a torch held at\n// chest height lights the ground at a grazing angle, where Lambert's law alone leaves it dark\nconst float WRAP = 0.4;\n// the torch, in eye coordinates: to the right of, below and a little behind the eye, so that its\n// beam enters the picture from the corner\nconst vec3 HAND = vec3(0.6, -0.4, 0.2);\n// the beam converges on the middle of the screen this far ahead, meters\nconst float AIM = 20.0;\n// brightness of the spill outside the hotspot, relative to it\nconst float SPILL = 0.3;\n// the beam in the haze is the hot shaft of the reflector, not the pool's wide cone: a cone from\n// a virtual source behind the hand, as far as its width at the torch and its angle put it, so\n// that a wide shaft looks almost parallel; a hot core over this fraction of its angle, the edge\n// soft outside it, crisp\nconst float BEAM_CORE = 0.8;\n// the distance from the torch at which the lit haze has fallen to a quarter, meters: short, so\n// that the shaft is as bright at its root, which the view rays cross over a few centimeters, as\n// at its far end, which they follow for meters\nconst float BEAM_REFERENCE = 1.0;\n// the haze also dims the light on its way, per meter\nconst float BEAM_EXTINCTION = 0.02;\n// the lit haze fades in over the first meters of the view ray, so that the root of the beam does\n// not stand as a wall of light in the corner of the picture\nconst vec2 BEAM_NEAR_FADE = vec2(0.5, 2.0);\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = sceneColor.rgb;\n vec3 ambient = mix(color, vec3(dot(color, vec3(0.2126, 0.7152, 0.0722))), darkness) * (1.0 - darkness);\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n // the axis points from what the torch lights back to it, as the beam expects\n vec3 axis = normalize(HAND - vec3(0.0, 0.0, -AIM));\n float coneCos = cos(angle);\n float coreCos = cos(beamAngle);\n\n // eye.w is 0 for the sky, where the view ray goes on\n float sceneDistance = eye.w == 0.0 ? 1e30 : length(eye.xyz);\n float scattered = 0.0;\n if (beam > 0.0) {\n Beam shaft;\n shaft.apex = HAND + axis * (beamWidth / tan(beamAngle));\n shaft.forward = -axis;\n shaft.edgeCos = cos(beamAngle);\n shaft.coreCos = cos(beamAngle * BEAM_CORE);\n shaft.hotCore = 1.0;\n shaft.light = HAND;\n shaft.reference = BEAM_REFERENCE;\n shaft.core = BEAM_REFERENCE;\n shaft.reach = beamReach;\n shaft.extinction = BEAM_EXTINCTION;\n shaft.anisotropy = beamAnisotropy;\n shaft.spacing = 2.0;\n shaft.nearFade = BEAM_NEAR_FADE;\n shaft.dust = 0.0;\n shaft.dustScale = 1.0;\n scattered = beamDensity * beamAlong(normalize(eye.xyz), sceneDistance, shaft);\n }\n vec3 haze = LIGHT_COLOR * (power * beam * scattered);\n if (eye.w == 0.0) {\n out_FragColor = vec4(filmic(ambient + haze), sceneColor.a);\n return;\n }\n\n vec3 fromLight = eye.xyz - HAND;\n float lightDistance = length(fromLight);\n vec3 direction = fromLight / lightDistance;\n float cosine = dot(direction, -axis);\n // 1 in the core, SPILL at the edge of the cone, 0 outside\n float core = smoothstep(coreCos, 1.0, cosine);\n float spill = smoothstep(coneCos, coreCos, cosine);\n float cone = max(core, SPILL * spill);\n float falloff = 1.0 / (1.0 + lightDistance * lightDistance / (range * range));\n\n // the normal over wider steps than the spotlight's: at the grazing angles of a torch held at\n // chest height, the facets of the terrain mesh would show as dark blotches on the ground\n vec3 normal = normalize(normalAt(depthTexture, v_textureCoordinates, eye.xyz, 6.0 * czm_pixelRatio)\n + normalAt(depthTexture, v_textureCoordinates, eye.xyz, 18.0 * czm_pixelRatio));\n float shade = mix(WRAP, 1.0, max(dot(normal, -direction), 0.0));\n vec3 light = LIGHT_COLOR * (power * INTENSITY * cone * falloff * shade);\n out_FragColor = vec4(filmic(ambient + color * light + haze), sceneColor.a);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Flashlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Flashlight.d.ts","sourceRoot":"","sources":["../../src/shaders/Flashlight.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Flashlight.glsl.
2
+ export default "// A torch held to the right of and below the eye, pointing where the camera looks: a narrow\n// hotspot and a wide, dim spill around it, fading with distance, shading the relief they fall\n// on; and the hotspot's beam in the haze, raymarched through its shaft, which enters the picture\n// from the corner and ends on the bright circle it makes; the rest of the scene darkens and loses\n// its color. Without a target, it stays on toward the sky.\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// brightness of the LED, 1 for a pocket torch: the pool and the beam scale with it\nuniform float power;\n// half angle of the cone of the spill, radians\nuniform float angle;\n// meters: distance at which the light has fallen to a half\nuniform float range;\n// 0 to 1\nuniform float darkness;\n// brightness of the beam in the air, 0 to 1\nuniform float beam;\n// half angle of the hotspot, radians, the bright core of the pool and the beam's shaft in the\n// air, which is that light on its way; and its radius at the torch, meters\nuniform float beamAngle;\nuniform float beamWidth;\n// how far the beam lights the haze, meters\nuniform float beamReach;\n// brightness of the lit haze\nuniform float beamDensity;\n// Henyey-Greenstein asymmetry of the haze, 0 to 1: it scatters mostly forward, so the beam is\n// brightest looking along it\nuniform float beamAnisotropy;\nin vec2 v_textureCoordinates;\n\n// the cool white of an LED torch\nconst vec3 LIGHT_COLOR = vec3(0.7, 0.85, 1.0);\nconst float INTENSITY = 1.4;\n// shading of a surface facing away from the torch, relative to one facing it: a torch held at\n// chest height lights the ground at a grazing angle, where Lambert's law alone leaves it dark\nconst float WRAP = 0.4;\n// the torch, in eye coordinates: to the right of, below and a little behind the eye, so that its\n// beam enters the picture from the corner\nconst vec3 HAND = vec3(0.6, -0.4, 0.2);\n// the beam converges on the middle of the screen this far ahead, meters\nconst float AIM = 20.0;\n// brightness of the spill outside the hotspot, relative to it\nconst float SPILL = 0.3;\n// the beam in the haze is the hot shaft of the reflector, not the pool's wide cone: a cone from\n// a virtual source behind the hand, as far as its width at the torch and its angle put it, so\n// that a wide shaft looks almost parallel; a hot core over this fraction of its angle, the edge\n// soft outside it, crisp\nconst float BEAM_CORE = 0.8;\n// the distance from the torch at which the lit haze has fallen to a quarter, meters: short, so\n// that the shaft is as bright at its root, which the view rays cross over a few centimeters, as\n// at its far end, which they follow for meters\nconst float BEAM_REFERENCE = 1.0;\n// the haze also dims the light on its way, per meter\nconst float BEAM_EXTINCTION = 0.02;\n// the lit haze fades in over the first meters of the view ray, so that the root of the beam does\n// not stand as a wall of light in the corner of the picture\nconst vec2 BEAM_NEAR_FADE = vec2(0.5, 2.0);\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = sceneColor.rgb;\n vec3 ambient = mix(color, vec3(dot(color, vec3(0.2126, 0.7152, 0.0722))), darkness) * (1.0 - darkness);\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n // the axis points from what the torch lights back to it, as the beam expects\n vec3 axis = normalize(HAND - vec3(0.0, 0.0, -AIM));\n float coneCos = cos(angle);\n float coreCos = cos(beamAngle);\n\n // eye.w is 0 for the sky, where the view ray goes on\n float sceneDistance = eye.w == 0.0 ? 1e30 : length(eye.xyz);\n float scattered = 0.0;\n if (beam > 0.0) {\n Beam shaft;\n shaft.apex = HAND + axis * (beamWidth / tan(beamAngle));\n shaft.forward = -axis;\n shaft.edgeCos = cos(beamAngle);\n shaft.coreCos = cos(beamAngle * BEAM_CORE);\n shaft.hotCore = 1.0;\n shaft.light = HAND;\n shaft.reference = BEAM_REFERENCE;\n shaft.core = BEAM_REFERENCE;\n shaft.reach = beamReach;\n shaft.extinction = BEAM_EXTINCTION;\n shaft.anisotropy = beamAnisotropy;\n shaft.spacing = 2.0;\n shaft.nearFade = BEAM_NEAR_FADE;\n shaft.dust = 0.0;\n shaft.dustScale = 1.0;\n scattered = beamDensity * beamAlong(normalize(eye.xyz), sceneDistance, shaft);\n }\n vec3 haze = LIGHT_COLOR * (power * beam * scattered);\n if (eye.w == 0.0) {\n out_FragColor = vec4(filmic(ambient + haze), sceneColor.a);\n return;\n }\n\n vec3 fromLight = eye.xyz - HAND;\n float lightDistance = length(fromLight);\n vec3 direction = fromLight / lightDistance;\n float cosine = dot(direction, -axis);\n // 1 in the core, SPILL at the edge of the cone, 0 outside\n float core = smoothstep(coreCos, 1.0, cosine);\n float spill = smoothstep(coneCos, coreCos, cosine);\n float cone = max(core, SPILL * spill);\n float falloff = 1.0 / (1.0 + lightDistance * lightDistance / (range * range));\n\n // the normal over wider steps than the spotlight's: at the grazing angles of a torch held at\n // chest height, the facets of the terrain mesh would show as dark blotches on the ground\n vec3 normal = normalize(normalAt(depthTexture, v_textureCoordinates, eye.xyz, 6.0 * czm_pixelRatio)\n + normalAt(depthTexture, v_textureCoordinates, eye.xyz, 18.0 * czm_pixelRatio));\n float shade = mix(WRAP, 1.0, max(dot(normal, -direction), 0.0));\n vec3 light = LIGHT_COLOR * (power * INTENSITY * cone * falloff * shade);\n out_FragColor = vec4(filmic(ambient + color * light + haze), sceneColor.a);\n}\n";
3
+ //# sourceMappingURL=Flashlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Flashlight.js","sourceRoot":"","sources":["../../src/shaders/Flashlight.js"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAe,m8KAAm8K,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// What ValleyFog's fog and the rain's and the snow's haze share: the sky as a ray this long, and\n// their light, lit by the sun as Cesium's fog, turning around sunset to a moonlit blue as bright as\n// the scene's fog.minimumBrightness, rather than a flat gray. Needs Height.\n\n// the sky is a ray this long, in meters\nconst float SKY_DISTANCE = 50000.0;\n// tint of the fog at night, scaled by fog.minimumBrightness\nconst vec3 NIGHT = vec3(0.45, 0.55, 0.85);\n\n// 0 at night to 1 by day, from the sun's height at the camera\nfloat daylight() {\n return smoothstep(-0.1, 0.3, dot(up, czm_sunDirectionEC));\n}\n\n// a fog's color by day, turning to the moonlit blue at night\nvec3 byDaylight(vec3 color, float day) {\n return mix(NIGHT * czm_fogMinimumBrightness, color, day);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Fog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fog.d.ts","sourceRoot":"","sources":["../../src/shaders/Fog.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Fog.glsl.
2
+ export default "// What ValleyFog's fog and the rain's and the snow's haze share: the sky as a ray this long, and\n// their light, lit by the sun as Cesium's fog, turning around sunset to a moonlit blue as bright as\n// the scene's fog.minimumBrightness, rather than a flat gray. Needs Height.\n\n// the sky is a ray this long, in meters\nconst float SKY_DISTANCE = 50000.0;\n// tint of the fog at night, scaled by fog.minimumBrightness\nconst vec3 NIGHT = vec3(0.45, 0.55, 0.85);\n\n// 0 at night to 1 by day, from the sun's height at the camera\nfloat daylight() {\n return smoothstep(-0.1, 0.3, dot(up, czm_sunDirectionEC));\n}\n\n// a fog's color by day, turning to the moonlit blue at night\nvec3 byDaylight(vec3 color, float day) {\n return mix(NIGHT * czm_fogMinimumBrightness, color, day);\n}\n";
3
+ //# sourceMappingURL=Fog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fog.js","sourceRoot":"","sources":["../../src/shaders/Fog.js"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,eAAe,sxBAAsxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// Size of the visible frame of the given width over height, centered in the canvas, in texture\n// coordinates: bars above and below when the canvas is narrower than the ratio, on the sides when\n// it is wider; the whole canvas for a ratio of 0.\nvec2 frameSize(float aspectRatio) {\n if (aspectRatio <= 0.0) {\n return vec2(1.0);\n }\n float canvas = czm_viewport.z / czm_viewport.w;\n return aspectRatio < canvas ? vec2(aspectRatio / canvas, 1.0) : vec2(1.0, canvas / aspectRatio);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Frame.d.ts","sourceRoot":"","sources":["../../src/shaders/Frame.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Frame.glsl.
2
+ export default "// Size of the visible frame of the given width over height, centered in the canvas, in texture\n// coordinates: bars above and below when the canvas is narrower than the ratio, on the sides when\n// it is wider; the whole canvas for a ratio of 0.\nvec2 frameSize(float aspectRatio) {\n if (aspectRatio <= 0.0) {\n return vec2(1.0);\n }\n float canvas = czm_viewport.z / czm_viewport.w;\n return aspectRatio < canvas ? vec2(aspectRatio / canvas, 1.0) : vec2(1.0, canvas / aspectRatio);\n}\n";
3
+ //# sourceMappingURL=Frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Frame.js","sourceRoot":"","sources":["../../src/shaders/Frame.js"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,eAAe,mfAAmf,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// random in [0, 1) for a point, without sin, which GPUs compute poorly for large numbers\nfloat hash(vec2 p) {\n vec3 p3 = fract(p.xyx * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// per pixel noise in [0, 1), \"interleaved gradient noise\" (Jimenez 2014): a dither that\n// spreads the sample positions of a blur between neighbouring pixels\nfloat pixelNoise(vec2 pixel) {\n return fract(52.9829189 * fract(dot(pixel, vec2(0.06711056, 0.00583715))));\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../src/shaders/Hash.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Hash.glsl.
2
+ export default "// random in [0, 1) for a point, without sin, which GPUs compute poorly for large numbers\nfloat hash(vec2 p) {\n vec3 p3 = fract(p.xyx * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// per pixel noise in [0, 1), \"interleaved gradient noise\" (Jimenez 2014): a dither that\n// spreads the sample positions of a blur between neighbouring pixels\nfloat pixelNoise(vec2 pixel) {\n return fract(52.9829189 * fract(dot(pixel, vec2(0.06711056, 0.00583715))));\n}\n";
3
+ //# sourceMappingURL=Hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hash.js","sourceRoot":"","sources":["../../src/shaders/Hash.js"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,eAAe,0fAA0f,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// Height above the ellipsoid of a point in eye coordinates, computed relative to the camera: in\n// world coordinates, single precision would round the position to about half a meter. The\n// uniforms come from the CPU in double precision (height.js).\nuniform float cameraHeight;\nuniform vec3 up;\nuniform float radius;\n\nfloat heightAt(vec3 eye) {\n // the camera is at the origin of eye coordinates; away from it horizontally, the ground falls\n // below the horizontal by the Earth's curvature\n float rise = dot(eye, up);\n float across = dot(eye, eye) - rise * rise;\n return cameraHeight + rise + across / (2.0 * radius);\n}\n\n// the part below a height of the ray from the camera to a point in eye coordinates, as shares of\n// it, from its start to its end, the height taken as linear along it; none when both ends are above\nvec2 belowHeight(vec3 rayEnd, float height) {\n float h0 = cameraHeight;\n float h1 = heightAt(rayEnd);\n if (min(h0, h1) >= height) {\n return vec2(0.0);\n }\n return vec2(h0 > height ? (h0 - height) / (h0 - h1) : 0.0, h1 > height ? (height - h0) / (h1 - h0) : 1.0);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Height.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Height.d.ts","sourceRoot":"","sources":["../../src/shaders/Height.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Height.glsl.
2
+ export default "// Height above the ellipsoid of a point in eye coordinates, computed relative to the camera: in\n// world coordinates, single precision would round the position to about half a meter. The\n// uniforms come from the CPU in double precision (height.js).\nuniform float cameraHeight;\nuniform vec3 up;\nuniform float radius;\n\nfloat heightAt(vec3 eye) {\n // the camera is at the origin of eye coordinates; away from it horizontally, the ground falls\n // below the horizontal by the Earth's curvature\n float rise = dot(eye, up);\n float across = dot(eye, eye) - rise * rise;\n return cameraHeight + rise + across / (2.0 * radius);\n}\n\n// the part below a height of the ray from the camera to a point in eye coordinates, as shares of\n// it, from its start to its end, the height taken as linear along it; none when both ends are above\nvec2 belowHeight(vec3 rayEnd, float height) {\n float h0 = cameraHeight;\n float h1 = heightAt(rayEnd);\n if (min(h0, h1) >= height) {\n return vec2(0.0);\n }\n return vec2(h0 > height ? (h0 - height) / (h0 - h1) : 0.0, h1 > height ? (height - h0) / (h1 - h0) : 1.0);\n}\n";
3
+ //# sourceMappingURL=Height.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Height.js","sourceRoot":"","sources":["../../src/shaders/Height.js"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAe,smCAAsmC,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// Black and white infrared film: foliage, which reflects the near infrared, turns bright, the sky\n// and water dark. The gray is the lightness raised or lowered by a weight per hue. After prod80's\n// ReShade Black & White (MIT), its Infrared preset, https://github.com/prod80/prod80-ReShade-Repository\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// 0 to 1\nuniform float strength;\nin vec2 v_textureCoordinates;\n\n// weights of the red, yellow, green, cyan, blue and magenta hues\nconst float RED = -1.35;\nconst float YELLOW = 2.35;\nconst float GREEN = 1.35;\nconst float CYAN = -1.35;\nconst float BLUE = -1.6;\nconst float MAGENTA = -1.07;\n// shape of the hue selections\nconst float CURVE = 1.5;\n\nfloat curve(float x, float k) {\n float s = sign(x - 0.5);\n float o = 0.5 * (1.0 + s);\n return o - 0.5 * s * pow(max(2.0 * (o - s * x), 0.0), k);\n}\n\n// how much of the hue centered at center there is in hue\nfloat hueWeight(float hue, float center) {\n return curve(max(1.0 - abs((hue - center) * 6.0), 0.0), CURVE);\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec3 hsl = czm_RGBToHSL(clamp(sceneColor.rgb, 0.0, 1.0));\n float h = hsl.x;\n float weight = RED * (hueWeight(h, 0.0) + hueWeight(h, 1.0))\n + YELLOW * hueWeight(h, 1.0 / 6.0)\n + GREEN * hueWeight(h, 2.0 / 6.0)\n + CYAN * hueWeight(h, 3.0 / 6.0)\n + BLUE * hueWeight(h, 4.0 / 6.0)\n + MAGENTA * hueWeight(h, 5.0 / 6.0);\n float saturation = hsl.y * (1.0 - hsl.y) + hsl.y;\n float gray = clamp(hsl.z + hsl.z * weight * saturation * (1.0 - hsl.z), 0.0, 1.0);\n out_FragColor = vec4(mix(sceneColor.rgb, vec3(gray), strength), sceneColor.a);\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Infrared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Infrared.d.ts","sourceRoot":"","sources":["../../src/shaders/Infrared.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ // This file is automatically rebuilt from Infrared.glsl.
2
+ export default "// Black and white infrared film: foliage, which reflects the near infrared, turns bright, the sky\n// and water dark. The gray is the lightness raised or lowered by a weight per hue. After prod80's\n// ReShade Black & White (MIT), its Infrared preset, https://github.com/prod80/prod80-ReShade-Repository\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// 0 to 1\nuniform float strength;\nin vec2 v_textureCoordinates;\n\n// weights of the red, yellow, green, cyan, blue and magenta hues\nconst float RED = -1.35;\nconst float YELLOW = 2.35;\nconst float GREEN = 1.35;\nconst float CYAN = -1.35;\nconst float BLUE = -1.6;\nconst float MAGENTA = -1.07;\n// shape of the hue selections\nconst float CURVE = 1.5;\n\nfloat curve(float x, float k) {\n float s = sign(x - 0.5);\n float o = 0.5 * (1.0 + s);\n return o - 0.5 * s * pow(max(2.0 * (o - s * x), 0.0), k);\n}\n\n// how much of the hue centered at center there is in hue\nfloat hueWeight(float hue, float center) {\n return curve(max(1.0 - abs((hue - center) * 6.0), 0.0), CURVE);\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec3 hsl = czm_RGBToHSL(clamp(sceneColor.rgb, 0.0, 1.0));\n float h = hsl.x;\n float weight = RED * (hueWeight(h, 0.0) + hueWeight(h, 1.0))\n + YELLOW * hueWeight(h, 1.0 / 6.0)\n + GREEN * hueWeight(h, 2.0 / 6.0)\n + CYAN * hueWeight(h, 3.0 / 6.0)\n + BLUE * hueWeight(h, 4.0 / 6.0)\n + MAGENTA * hueWeight(h, 5.0 / 6.0);\n float saturation = hsl.y * (1.0 - hsl.y) + hsl.y;\n float gray = clamp(hsl.z + hsl.z * weight * saturation * (1.0 - hsl.z), 0.0, 1.0);\n out_FragColor = vec4(mix(sceneColor.rgb, vec3(gray), strength), sceneColor.a);\n}\n";
3
+ //# sourceMappingURL=Infrared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Infrared.js","sourceRoot":"","sources":["../../src/shaders/Infrared.js"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,eAAe,4qDAA4qD,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default = "// The jello of a vibrating camera with a rolling shutter: the sensor reads its rows one after\n// another, so each row sees the camera at a different moment of its shake, and straight edges\n// wobble. After Readout's readout pass (stoatworks-labs, MIT): row r of H is read\n// `readout * (1 - r / H)` before the frame, the camera's pose is taken at the middle of the row's\n// exposure, and the shake is a few sinusoids in x, y and rotation. The phases come from the CPU,\n// in double precision; the picture is magnified by zoom so that its edges do not show.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// the shake: frequencies in Hz, phases at the frame's time in radians, amplitudes in picture\n// heights (x, y) and radians (rotation)\nuniform vec4 shakeHz;\nuniform vec4 phaseX;\nuniform vec4 phaseY;\nuniform vec4 phaseRotation;\nuniform vec4 amplitudeX;\nuniform vec4 amplitudeY;\nuniform vec4 amplitudeRotation;\nuniform float zoom;\nin vec2 v_textureCoordinates;\n\n// seconds to read all the rows, top down, and to expose each\nconst float READOUT = 0.02;\nconst float EXPOSURE = 0.004;\n\nvoid main() {\n vec2 size = czm_viewport.zw;\n // the row, from the top, and how long before the frame it was read, at the middle of its exposure\n float row = floor((1.0 - v_textureCoordinates.y) * size.y);\n float tau = READOUT * (1.0 - row / size.y) + 0.5 * EXPOSURE;\n vec4 arg = czm_twoPi * shakeHz * tau;\n vec2 shift = vec2(dot(amplitudeX, sin(phaseX - arg)), dot(amplitudeY, sin(phaseY - arg)));\n float rotation = dot(amplitudeRotation, sin(phaseRotation - arg));\n\n // centred, in picture heights, so that a rotation is not a shear\n float aspect = size.x / size.y;\n vec2 p = vec2((v_textureCoordinates.x - 0.5) * aspect, v_textureCoordinates.y - 0.5);\n float c = cos(rotation);\n float s = sin(rotation);\n p = (vec2(p.x * c - p.y * s, p.x * s + p.y * c) + shift) / zoom;\n out_FragColor = texture(colorTexture, vec2(p.x / aspect + 0.5, p.y + 0.5));\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=Jello.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Jello.d.ts","sourceRoot":"","sources":["../../src/shaders/Jello.js"],"names":[],"mappings":""}