@vcmap/ui 5.0.0-rc.30 → 5.0.0-rc.31

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 (323) hide show
  1. package/build/buildHelpers.js +4 -3
  2. package/config/base.config.json +5 -4
  3. package/config/dev.config.json +4 -0
  4. package/config/graphFeatureInfo.config.json +1 -1
  5. package/config/projects.config.json +2 -2
  6. package/dist/assets/cesium/ThirdParty/Workers/basis_transcoder.js +1 -1
  7. package/dist/assets/cesium/Workers/chunk-227AJNOA.js +59 -0
  8. package/dist/assets/cesium/Workers/chunk-2R5O53JW.js +157 -0
  9. package/dist/assets/cesium/Workers/chunk-34YUDLRP.js +781 -0
  10. package/dist/assets/cesium/Workers/chunk-3W63OHNJ.js +100 -0
  11. package/dist/assets/cesium/Workers/chunk-4MFFIWUA.js +163 -0
  12. package/dist/assets/cesium/Workers/chunk-66QLLS45.js +218 -0
  13. package/dist/assets/cesium/Workers/chunk-6BTKZDRG.js +77 -0
  14. package/dist/assets/cesium/Workers/chunk-A4JVFBQ3.js +101 -0
  15. package/dist/assets/cesium/Workers/chunk-ABADGKYE.js +58 -0
  16. package/dist/assets/cesium/Workers/chunk-AFFLIKOH.js +353 -0
  17. package/dist/assets/cesium/Workers/chunk-AHKEZ2OE.js +629 -0
  18. package/dist/assets/cesium/Workers/chunk-C3SXRKRW.js +476 -0
  19. package/dist/assets/cesium/Workers/chunk-CCFQRR6D.js +55 -0
  20. package/dist/assets/cesium/Workers/chunk-CHHNOC2C.js +1860 -0
  21. package/dist/assets/cesium/Workers/chunk-CTELOFLA.js +196 -0
  22. package/dist/assets/cesium/Workers/chunk-DUHWWBQQ.js +3273 -0
  23. package/dist/assets/cesium/Workers/chunk-EW2GWJYB.js +44 -0
  24. package/dist/assets/cesium/Workers/chunk-GLZBE3ML.js +421 -0
  25. package/dist/assets/cesium/Workers/chunk-HARLBUOL.js +236 -0
  26. package/dist/assets/cesium/Workers/chunk-HQF437NJ.js +117 -0
  27. package/dist/assets/cesium/Workers/chunk-IPA4EACJ.js +368 -0
  28. package/dist/assets/cesium/Workers/chunk-J3JY6I2C.js +1009 -0
  29. package/dist/assets/cesium/Workers/chunk-JB2LWGH4.js +390 -0
  30. package/dist/assets/cesium/Workers/chunk-JS3AW5BK.js +634 -0
  31. package/dist/assets/cesium/Workers/chunk-K36FEYS7.js +452 -0
  32. package/dist/assets/cesium/Workers/chunk-KD4Y7CZL.js +400 -0
  33. package/dist/assets/cesium/Workers/chunk-KTJSNCK4.js +842 -0
  34. package/dist/assets/cesium/Workers/chunk-LLUNNUJV.js +258 -0
  35. package/dist/assets/cesium/Workers/{package.js → chunk-MPAZH4BF.js} +13 -2
  36. package/dist/assets/cesium/Workers/chunk-MYZB7C4T.js +1258 -0
  37. package/dist/assets/cesium/Workers/chunk-N3JIFFX2.js +501 -0
  38. package/dist/assets/cesium/Workers/chunk-O5AMBQ36.js +430 -0
  39. package/dist/assets/cesium/Workers/chunk-OAVNIRB4.js +124 -0
  40. package/dist/assets/cesium/Workers/chunk-OYFCF4PL.js +171 -0
  41. package/dist/assets/cesium/Workers/chunk-OZJDGN5F.js +1477 -0
  42. package/dist/assets/cesium/Workers/chunk-PCJWUS4M.js +2041 -0
  43. package/dist/assets/cesium/Workers/chunk-PFQBCKBM.js +8644 -0
  44. package/dist/assets/cesium/Workers/chunk-QIKODV5G.js +305 -0
  45. package/dist/assets/cesium/Workers/chunk-QJ3DFBH3.js +73 -0
  46. package/dist/assets/cesium/Workers/chunk-QMEMZIJI.js +138 -0
  47. package/dist/assets/cesium/Workers/chunk-QT3MPEMI.js +102 -0
  48. package/dist/assets/cesium/Workers/chunk-RP2A7BR5.js +289 -0
  49. package/dist/assets/cesium/Workers/chunk-RW6LU2CJ.js +138 -0
  50. package/dist/assets/cesium/Workers/chunk-TFC6TZ3S.js +757 -0
  51. package/dist/assets/cesium/Workers/chunk-V3NGATMV.js +693 -0
  52. package/dist/assets/cesium/Workers/chunk-VLGOATD6.js +1075 -0
  53. package/dist/assets/cesium/Workers/chunk-WXTV4ATB.js +39 -0
  54. package/dist/assets/cesium/Workers/chunk-X4SU25DT.js +302 -0
  55. package/dist/assets/cesium/Workers/chunk-XTY7B2N6.js +2716 -0
  56. package/dist/assets/cesium/Workers/chunk-XY7MGBKC.js +513 -0
  57. package/dist/assets/cesium/Workers/chunk-Z24VKNDO.js +834 -0
  58. package/dist/assets/cesium/Workers/chunk-ZA25DG4Y.js +684 -0
  59. package/dist/assets/cesium/Workers/chunk-ZFOBYDGF.js +73 -0
  60. package/dist/assets/cesium/Workers/combineGeometry.js +65 -15
  61. package/dist/assets/cesium/Workers/createBoxGeometry.js +55 -10
  62. package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +231 -310
  63. package/dist/assets/cesium/Workers/createCircleGeometry.js +185 -202
  64. package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +141 -155
  65. package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +477 -557
  66. package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  67. package/dist/assets/cesium/Workers/createCorridorGeometry.js +1162 -1307
  68. package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +533 -569
  69. package/dist/assets/cesium/Workers/createCylinderGeometry.js +57 -10
  70. package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +224 -258
  71. package/dist/assets/cesium/Workers/createEllipseGeometry.js +68 -12
  72. package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +61 -12
  73. package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +56 -10
  74. package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +58 -13
  75. package/dist/assets/cesium/Workers/createFrustumGeometry.js +55 -10
  76. package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +226 -243
  77. package/dist/assets/cesium/Workers/createGeometry.js +143 -48
  78. package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +1484 -2011
  79. package/dist/assets/cesium/Workers/createPlaneGeometry.js +216 -243
  80. package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +121 -113
  81. package/dist/assets/cesium/Workers/createPolygonGeometry.js +1041 -1327
  82. package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +516 -657
  83. package/dist/assets/cesium/Workers/createPolylineGeometry.js +471 -547
  84. package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +352 -384
  85. package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +271 -295
  86. package/dist/assets/cesium/Workers/createRectangleGeometry.js +1128 -1331
  87. package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +445 -500
  88. package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +381 -440
  89. package/dist/assets/cesium/Workers/createSphereGeometry.js +112 -118
  90. package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +112 -121
  91. package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +32 -127
  92. package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +462 -505
  93. package/dist/assets/cesium/Workers/createVectorTileGeometries.js +377 -436
  94. package/dist/assets/cesium/Workers/createVectorTilePoints.js +110 -77
  95. package/dist/assets/cesium/Workers/createVectorTilePolygons.js +369 -391
  96. package/dist/assets/cesium/Workers/createVectorTilePolylines.js +252 -244
  97. package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  98. package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +2244 -2677
  99. package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -926
  100. package/dist/assets/cesium/Workers/createWallGeometry.js +459 -593
  101. package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +324 -419
  102. package/dist/assets/cesium/Workers/decodeDraco.js +327 -347
  103. package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  104. package/dist/assets/cesium/Workers/decodeI3S.js +765 -970
  105. package/dist/assets/cesium/Workers/transcodeKTX2.js +3353 -1464
  106. package/dist/assets/cesium/Workers/transferTypedArrayTest.js +3 -4
  107. package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  108. package/dist/assets/{cesium.eaf7cc.js → cesium.77d0f7.js} +8915 -13165
  109. package/dist/assets/cesium.js +1 -1
  110. package/dist/assets/{core.b16511.js → core.720589.js} +3421 -3365
  111. package/dist/assets/core.js +1 -1
  112. package/dist/assets/index-dd539204.js +1 -0
  113. package/dist/assets/{ol.4bbf0f.js → ol.e48649.js} +4 -4
  114. package/dist/assets/ol.js +1 -1
  115. package/dist/assets/{ui.ab815e.css → ui.50452a.css} +1 -1
  116. package/dist/assets/{ui.ab815e.js → ui.50452a.js} +4270 -4355
  117. package/dist/assets/ui.js +1 -1
  118. package/dist/assets/vue.js +2 -2
  119. package/dist/assets/{vuetify.ea3fa8.js → vuetify.f0a769.js} +1 -1
  120. package/dist/assets/vuetify.js +2 -2
  121. package/dist/index.html +27 -23
  122. package/index.html +23 -22
  123. package/package.json +5 -5
  124. package/plugins/@vcmap-show-case/plugin-editors/PluginEditors.vue +119 -0
  125. package/plugins/@vcmap-show-case/plugin-editors/index.js +41 -0
  126. package/plugins/@vcmap-show-case/plugin-editors/package.json +5 -0
  127. package/plugins/{@vcmap → @vcmap-show-case}/project-selector/ProjectSelectorComponent.vue +1 -1
  128. package/plugins/{@vcmap → @vcmap-show-case}/project-selector/config.json +2 -2
  129. package/plugins/{@vcmap → @vcmap-show-case}/project-selector/package.json +1 -1
  130. package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/package.json +1 -1
  131. package/plugins/@vcmap-show-case/table-example/DataTableExample.vue +1 -1
  132. package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/ThemeChangerComponent.vue +1 -1
  133. package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/config.json +2 -2
  134. package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/package.json +1 -1
  135. package/plugins/@vcmap-show-case/vector-properties-example/vectorPropertiesExample.vue +20 -1
  136. package/plugins/package.json +6 -2
  137. package/src/application/VcsAttributions.vue +27 -20
  138. package/src/components/form-inputs-controls/VcsChipArrayInput.vue +22 -14
  139. package/src/components/form-inputs-controls/VcsSlider.vue +1 -0
  140. package/src/components/icons/2DAreaIcon.vue +2 -17
  141. package/src/components/icons/2DDistanceIcon.vue +0 -3
  142. package/src/components/icons/3DAreaIcon.vue +2 -17
  143. package/src/components/icons/3DDistanceIcon.vue +0 -3
  144. package/src/components/icons/3DHeightIcon.vue +0 -3
  145. package/src/components/icons/AngleIcon.vue +0 -1
  146. package/src/components/icons/AssociationsIcon.vue +1 -3
  147. package/src/components/icons/AxisIcon.vue +0 -4
  148. package/src/components/icons/BoundingBoxIcon.vue +1 -4
  149. package/src/components/icons/CheckboxIcon.vue +0 -2
  150. package/src/components/icons/CheckboxIndeterminateIcon.vue +1 -5
  151. package/src/components/icons/CircleIcon.vue +1 -6
  152. package/src/components/icons/ClippingHorizontalIcon.vue +0 -1
  153. package/src/components/icons/ClippingIcon.vue +0 -1
  154. package/src/components/icons/ClippingVerticalIcon.vue +0 -1
  155. package/src/components/icons/ColorPickerIcon.vue +0 -1
  156. package/src/components/icons/ColorSwatchIcon.vue +0 -2
  157. package/src/components/icons/CommentIcon.vue +0 -1
  158. package/src/components/icons/CompassIcon.vue +0 -2
  159. package/src/components/icons/ComponentsIcon.vue +0 -1
  160. package/src/components/icons/ConeIcon.vue +1 -4
  161. package/src/components/icons/DimensionsHouseIcon.vue +0 -2
  162. package/src/components/icons/EditIcon.vue +0 -1
  163. package/src/components/icons/EditVerticesIcon.vue +0 -4
  164. package/src/components/icons/ElevationProfileIcon.vue +1 -13
  165. package/src/components/icons/ExportAreaIcon.vue +0 -1
  166. package/src/components/icons/ExportFlightIcon.vue +0 -1
  167. package/src/components/icons/ExportIcon.vue +12 -8
  168. package/src/components/icons/ExternalLinkIcon.vue +0 -2
  169. package/src/components/icons/FastForwardIcon.vue +0 -1
  170. package/src/components/icons/FilterIcon.vue +0 -1
  171. package/src/components/icons/GlobeNatureIcon.vue +0 -3
  172. package/src/components/icons/GroundIcon.vue +0 -1
  173. package/src/components/icons/HealthCareIndustriesIcon.vue +1 -11
  174. package/src/components/icons/HideIcon.vue +0 -1
  175. package/src/components/icons/HomePointIcon.vue +0 -1
  176. package/src/components/icons/HospitalsIcon.vue +1 -20
  177. package/src/components/icons/HouseIcon.vue +3 -13
  178. package/src/components/icons/ImportIcon.vue +6 -14
  179. package/src/components/icons/InfoIcon.vue +0 -2
  180. package/src/components/icons/KebabIcon.vue +1 -9
  181. package/src/components/icons/LabelIcon.vue +0 -2
  182. package/src/components/icons/LayersIcon.vue +1 -9
  183. package/src/components/icons/LegendIcon.vue +0 -1
  184. package/src/components/icons/LineIcon.vue +0 -2
  185. package/src/components/icons/LinkIcon.vue +0 -1
  186. package/src/components/icons/LogoutIcon.vue +0 -1
  187. package/src/components/icons/MapIcon.vue +0 -2
  188. package/src/components/icons/MenuIcon.vue +1 -5
  189. package/src/components/icons/MinusIcon.vue +0 -2
  190. package/src/components/icons/ObjectSelectIcon.vue +0 -2
  191. package/src/components/icons/ObliqueViewIcon.vue +0 -1
  192. package/src/components/icons/PdfIcon.vue +0 -1
  193. package/src/components/icons/PedestrianIcon.vue +0 -1
  194. package/src/components/icons/PenIcon.vue +0 -1
  195. package/src/components/icons/PlayCircleIcon.vue +1 -8
  196. package/src/components/icons/PlusIcon.vue +0 -2
  197. package/src/components/icons/PoiIcon.vue +0 -1
  198. package/src/components/icons/PointIcon.vue +2 -6
  199. package/src/components/icons/PointSelectIcon.vue +0 -1
  200. package/src/components/icons/PresentationModeIcon.vue +0 -1
  201. package/src/components/icons/ProgressIcon.vue +1 -1
  202. package/src/components/icons/QueryIcon.vue +0 -1
  203. package/src/components/icons/RectangleIcon.vue +1 -6
  204. package/src/components/icons/ReturnIcon.vue +0 -1
  205. package/src/components/icons/RewindIcon.vue +0 -1
  206. package/src/components/icons/RotateLeftIcon.vue +0 -1
  207. package/src/components/icons/RotateRightIcon.vue +0 -1
  208. package/src/components/icons/ScreenshotIcon.vue +1 -6
  209. package/src/components/icons/SearchIcon.vue +0 -1
  210. package/src/components/icons/ShadowIcon.vue +0 -2
  211. package/src/components/icons/ShapesIcon.vue +1 -4
  212. package/src/components/icons/ShareIcon.vue +0 -1
  213. package/src/components/icons/SimpleCircleFilledIcon.vue +0 -1
  214. package/src/components/icons/SimpleCircleHalfFilledIcon.vue +0 -1
  215. package/src/components/icons/SimpleCircleOutlinedIcon.vue +1 -7
  216. package/src/components/icons/SkipPreviousIcon.vue +1 -6
  217. package/src/components/icons/SplitViewIcon.vue +0 -1
  218. package/src/components/icons/TextStyleIcon.vue +0 -3
  219. package/src/components/icons/ThreeDimensionsIcon.vue +0 -1
  220. package/src/components/icons/ToolsIcon.vue +0 -1
  221. package/src/components/icons/TouchIcon.vue +0 -1
  222. package/src/components/icons/TriangleIcon.vue +0 -3
  223. package/src/components/icons/TwoDimensionsIcon.vue +0 -2
  224. package/src/components/icons/UploadIcon.vue +0 -1
  225. package/src/components/icons/UserProfileIcon.vue +0 -1
  226. package/src/components/icons/UserShareIcon.vue +0 -1
  227. package/src/components/icons/ViewpointFlightIcon.vue +0 -1
  228. package/src/components/icons/ViewpointIcon.vue +0 -1
  229. package/src/components/icons/Viewshed360Icon.vue +0 -1
  230. package/src/components/icons/ViewshedConeIcon.vue +0 -1
  231. package/src/components/icons/ViewshedIcon.vue +0 -1
  232. package/src/components/icons/WalkingIcon.vue +0 -1
  233. package/src/components/icons/WallIcon.vue +1 -4
  234. package/src/components/icons/WandIcon.vue +22 -70
  235. package/src/components/lists/VcsList.vue +18 -12
  236. package/src/components/plugins/AbstractConfigEditor.vue +2 -2
  237. package/src/components/tables/VcsDataTable.vue +1 -1
  238. package/src/components/vector-properties/VcsVectorPropertiesComponent.vue +57 -14
  239. package/src/contentTree/contentTreeCollection.js +30 -9
  240. package/src/i18n/de.js +8 -5
  241. package/src/i18n/en.js +8 -5
  242. package/src/i18n/i18nCollection.js +19 -65
  243. package/src/manager/buttonManager.js +4 -0
  244. package/src/manager/contextMenu/contextMenuManager.js +2 -0
  245. package/src/pluginHelper.js +2 -2
  246. package/src/vcsUiApp.js +9 -4
  247. package/src/vuePlugins/i18n.js +0 -8
  248. package/dist/assets/cesium/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  249. package/dist/assets/cesium/Workers/ArcType-2d9abbbc.js +0 -37
  250. package/dist/assets/cesium/Workers/AttributeCompression-f9f6c717.js +0 -716
  251. package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-4140c51f.js +0 -258
  252. package/dist/assets/cesium/Workers/BoundingRectangle-c714b156.js +0 -369
  253. package/dist/assets/cesium/Workers/BoxGeometry-6f3da43d.js +0 -884
  254. package/dist/assets/cesium/Workers/Check-6ede7e26.js +0 -290
  255. package/dist/assets/cesium/Workers/Color-8a565ff2.js +0 -2262
  256. package/dist/assets/cesium/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  257. package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-4b4d4096.js +0 -132
  258. package/dist/assets/cesium/Workers/CorridorGeometryLibrary-7b94502b.js +0 -498
  259. package/dist/assets/cesium/Workers/CylinderGeometry-ca070b87.js +0 -467
  260. package/dist/assets/cesium/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  261. package/dist/assets/cesium/Workers/EllipseGeometry-122e51fa.js +0 -1304
  262. package/dist/assets/cesium/Workers/EllipseGeometryLibrary-4d326efc.js +0 -366
  263. package/dist/assets/cesium/Workers/EllipseOutlineGeometry-16cc2bd7.js +0 -443
  264. package/dist/assets/cesium/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  265. package/dist/assets/cesium/Workers/EllipsoidGeometry-cb148ca2.js +0 -637
  266. package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-0fa10c79.js +0 -454
  267. package/dist/assets/cesium/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  268. package/dist/assets/cesium/Workers/EllipsoidTangentPlane-6dd1b7af.js +0 -373
  269. package/dist/assets/cesium/Workers/EncodedCartesian3-57415c8a.js +0 -171
  270. package/dist/assets/cesium/Workers/FrustumGeometry-ee73037c.js +0 -2540
  271. package/dist/assets/cesium/Workers/GeometryAttribute-ff5b4fb1.js +0 -619
  272. package/dist/assets/cesium/Workers/GeometryAttributes-ad136444.js +0 -91
  273. package/dist/assets/cesium/Workers/GeometryInstance-34d9e21e.js +0 -121
  274. package/dist/assets/cesium/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  275. package/dist/assets/cesium/Workers/GeometryPipeline-1f8fbf05.js +0 -3690
  276. package/dist/assets/cesium/Workers/IndexDatatype-2643aa47.js +0 -200
  277. package/dist/assets/cesium/Workers/IntersectionTests-70d39ba9.js +0 -1836
  278. package/dist/assets/cesium/Workers/Math-0a2ac845.js +0 -1340
  279. package/dist/assets/cesium/Workers/Matrix2-e1298525.js +0 -7086
  280. package/dist/assets/cesium/Workers/Matrix3-41c58dde.js +0 -4283
  281. package/dist/assets/cesium/Workers/OrientedBoundingBox-159cf1d6.js +0 -1259
  282. package/dist/assets/cesium/Workers/Plane-4c3d403b.js +0 -309
  283. package/dist/assets/cesium/Workers/PolygonGeometryLibrary-076a5d25.js +0 -1074
  284. package/dist/assets/cesium/Workers/PolygonPipeline-b9f2810a.js +0 -1344
  285. package/dist/assets/cesium/Workers/PolylinePipeline-639192e0.js +0 -573
  286. package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-b73549fb.js +0 -781
  287. package/dist/assets/cesium/Workers/PrimitivePipeline-10ede1b6.js +0 -966
  288. package/dist/assets/cesium/Workers/RectangleGeometryLibrary-c35a7356.js +0 -280
  289. package/dist/assets/cesium/Workers/RuntimeError-ef395448.js +0 -68
  290. package/dist/assets/cesium/Workers/TerrainEncoding-668d242f.js +0 -1227
  291. package/dist/assets/cesium/Workers/Transforms-a2a85221.js +0 -14712
  292. package/dist/assets/cesium/Workers/VertexFormat-030f11ff.js +0 -312
  293. package/dist/assets/cesium/Workers/WallGeometryLibrary-1938bf0d.js +0 -211
  294. package/dist/assets/cesium/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  295. package/dist/assets/cesium/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  296. package/dist/assets/cesium/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  297. package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +0 -1363
  298. package/dist/assets/cesium/Workers/combine-d9581036.js +0 -82
  299. package/dist/assets/cesium/Workers/defaultValue-fe22d8c0.js +0 -51
  300. package/dist/assets/index-c115e3a1.js +0 -1
  301. package/plugins/@vcmap/create-link/fallbackCreateLink.vue +0 -76
  302. package/plugins/@vcmap/create-link/index.js +0 -95
  303. package/plugins/@vcmap/create-link/package.json +0 -6
  304. package/plugins/@vcmap/search-nominatim/LICENSE.md +0 -13
  305. package/plugins/@vcmap/search-nominatim/README.md +0 -3
  306. package/plugins/@vcmap/search-nominatim/SearchNominatimEditor.vue +0 -90
  307. package/plugins/@vcmap/search-nominatim/config.json +0 -3
  308. package/plugins/@vcmap/search-nominatim/index.js +0 -66
  309. package/plugins/@vcmap/search-nominatim/nominatim.js +0 -175
  310. package/plugins/@vcmap/search-nominatim/package.json +0 -9
  311. /package/dist/assets/{vue.67e80f.js → vue.5d696e.js} +0 -0
  312. /package/dist/assets/{vuetify.ea3fa8.css → vuetify.f0a769.css} +0 -0
  313. /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/ModulesListComponent.vue +0 -0
  314. /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/README.md +0 -0
  315. /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/de.json +0 -0
  316. /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/en.json +0 -0
  317. /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/index.js +0 -0
  318. /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/README.md +0 -0
  319. /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/SimpleGraphComponent.vue +0 -0
  320. /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/index.js +0 -0
  321. /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/simpleGraphView.js +0 -0
  322. /package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/README.md +0 -0
  323. /package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/index.js +0 -0
@@ -1,2540 +0,0 @@
1
- define(['exports', './Transforms-a2a85221', './Matrix3-41c58dde', './Matrix2-e1298525', './Check-6ede7e26', './ComponentDatatype-cf1fa08e', './defaultValue-fe22d8c0', './GeometryAttribute-ff5b4fb1', './GeometryAttributes-ad136444', './Math-0a2ac845', './Plane-4c3d403b', './VertexFormat-030f11ff'], (function (exports, Transforms, Matrix3, Matrix2, Check, ComponentDatatype, defaultValue, GeometryAttribute, GeometryAttributes, Math$1, Plane, VertexFormat) { 'use strict';
2
-
3
- /**
4
- * The culling volume defined by planes.
5
- *
6
- * @alias CullingVolume
7
- * @constructor
8
- *
9
- * @param {Cartesian4[]} [planes] An array of clipping planes.
10
- */
11
- function CullingVolume(planes) {
12
- /**
13
- * Each plane is represented by a Cartesian4 object, where the x, y, and z components
14
- * define the unit vector normal to the plane, and the w component is the distance of the
15
- * plane from the origin.
16
- * @type {Cartesian4[]}
17
- * @default []
18
- */
19
- this.planes = defaultValue.defaultValue(planes, []);
20
- }
21
-
22
- const faces = [new Matrix3.Cartesian3(), new Matrix3.Cartesian3(), new Matrix3.Cartesian3()];
23
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.UNIT_X, faces[0]);
24
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.UNIT_Y, faces[1]);
25
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.UNIT_Z, faces[2]);
26
-
27
- const scratchPlaneCenter = new Matrix3.Cartesian3();
28
- const scratchPlaneNormal = new Matrix3.Cartesian3();
29
- const scratchPlane = new Plane.Plane(new Matrix3.Cartesian3(1.0, 0.0, 0.0), 0.0);
30
-
31
- /**
32
- * Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.
33
- * The planes are aligned to the x, y, and z axes in world coordinates.
34
- *
35
- * @param {BoundingSphere} boundingSphere The bounding sphere used to create the culling volume.
36
- * @param {CullingVolume} [result] The object onto which to store the result.
37
- * @returns {CullingVolume} The culling volume created from the bounding sphere.
38
- */
39
- CullingVolume.fromBoundingSphere = function (boundingSphere, result) {
40
- //>>includeStart('debug', pragmas.debug);
41
- if (!defaultValue.defined(boundingSphere)) {
42
- throw new Check.DeveloperError("boundingSphere is required.");
43
- }
44
- //>>includeEnd('debug');
45
-
46
- if (!defaultValue.defined(result)) {
47
- result = new CullingVolume();
48
- }
49
-
50
- const length = faces.length;
51
- const planes = result.planes;
52
- planes.length = 2 * length;
53
-
54
- const center = boundingSphere.center;
55
- const radius = boundingSphere.radius;
56
-
57
- let planeIndex = 0;
58
-
59
- for (let i = 0; i < length; ++i) {
60
- const faceNormal = faces[i];
61
-
62
- let plane0 = planes[planeIndex];
63
- let plane1 = planes[planeIndex + 1];
64
-
65
- if (!defaultValue.defined(plane0)) {
66
- plane0 = planes[planeIndex] = new Matrix2.Cartesian4();
67
- }
68
- if (!defaultValue.defined(plane1)) {
69
- plane1 = planes[planeIndex + 1] = new Matrix2.Cartesian4();
70
- }
71
-
72
- Matrix3.Cartesian3.multiplyByScalar(faceNormal, -radius, scratchPlaneCenter);
73
- Matrix3.Cartesian3.add(center, scratchPlaneCenter, scratchPlaneCenter);
74
-
75
- plane0.x = faceNormal.x;
76
- plane0.y = faceNormal.y;
77
- plane0.z = faceNormal.z;
78
- plane0.w = -Matrix3.Cartesian3.dot(faceNormal, scratchPlaneCenter);
79
-
80
- Matrix3.Cartesian3.multiplyByScalar(faceNormal, radius, scratchPlaneCenter);
81
- Matrix3.Cartesian3.add(center, scratchPlaneCenter, scratchPlaneCenter);
82
-
83
- plane1.x = -faceNormal.x;
84
- plane1.y = -faceNormal.y;
85
- plane1.z = -faceNormal.z;
86
- plane1.w = -Matrix3.Cartesian3.dot(
87
- Matrix3.Cartesian3.negate(faceNormal, scratchPlaneNormal),
88
- scratchPlaneCenter
89
- );
90
-
91
- planeIndex += 2;
92
- }
93
-
94
- return result;
95
- };
96
-
97
- /**
98
- * Determines whether a bounding volume intersects the culling volume.
99
- *
100
- * @param {object} boundingVolume The bounding volume whose intersection with the culling volume is to be tested.
101
- * @returns {Intersect} Intersect.OUTSIDE, Intersect.INTERSECTING, or Intersect.INSIDE.
102
- */
103
- CullingVolume.prototype.computeVisibility = function (boundingVolume) {
104
- //>>includeStart('debug', pragmas.debug);
105
- if (!defaultValue.defined(boundingVolume)) {
106
- throw new Check.DeveloperError("boundingVolume is required.");
107
- }
108
- //>>includeEnd('debug');
109
-
110
- const planes = this.planes;
111
- let intersecting = false;
112
- for (let k = 0, len = planes.length; k < len; ++k) {
113
- const result = boundingVolume.intersectPlane(
114
- Plane.Plane.fromCartesian4(planes[k], scratchPlane)
115
- );
116
- if (result === Transforms.Intersect.OUTSIDE) {
117
- return Transforms.Intersect.OUTSIDE;
118
- } else if (result === Transforms.Intersect.INTERSECTING) {
119
- intersecting = true;
120
- }
121
- }
122
-
123
- return intersecting ? Transforms.Intersect.INTERSECTING : Transforms.Intersect.INSIDE;
124
- };
125
-
126
- /**
127
- * Determines whether a bounding volume intersects the culling volume.
128
- *
129
- * @param {object} boundingVolume The bounding volume whose intersection with the culling volume is to be tested.
130
- * @param {number} parentPlaneMask A bit mask from the boundingVolume's parent's check against the same culling
131
- * volume, such that if (planeMask & (1 << planeIndex) === 0), for k < 31, then
132
- * the parent (and therefore this) volume is completely inside plane[planeIndex]
133
- * and that plane check can be skipped.
134
- * @returns {number} A plane mask as described above (which can be applied to this boundingVolume's children).
135
- *
136
- * @private
137
- */
138
- CullingVolume.prototype.computeVisibilityWithPlaneMask = function (
139
- boundingVolume,
140
- parentPlaneMask
141
- ) {
142
- //>>includeStart('debug', pragmas.debug);
143
- if (!defaultValue.defined(boundingVolume)) {
144
- throw new Check.DeveloperError("boundingVolume is required.");
145
- }
146
- if (!defaultValue.defined(parentPlaneMask)) {
147
- throw new Check.DeveloperError("parentPlaneMask is required.");
148
- }
149
- //>>includeEnd('debug');
150
-
151
- if (
152
- parentPlaneMask === CullingVolume.MASK_OUTSIDE ||
153
- parentPlaneMask === CullingVolume.MASK_INSIDE
154
- ) {
155
- // parent is completely outside or completely inside, so this child is as well.
156
- return parentPlaneMask;
157
- }
158
-
159
- // Start with MASK_INSIDE (all zeros) so that after the loop, the return value can be compared with MASK_INSIDE.
160
- // (Because if there are fewer than 31 planes, the upper bits wont be changed.)
161
- let mask = CullingVolume.MASK_INSIDE;
162
-
163
- const planes = this.planes;
164
- for (let k = 0, len = planes.length; k < len; ++k) {
165
- // For k greater than 31 (since 31 is the maximum number of INSIDE/INTERSECTING bits we can store), skip the optimization.
166
- const flag = k < 31 ? 1 << k : 0;
167
- if (k < 31 && (parentPlaneMask & flag) === 0) {
168
- // boundingVolume is known to be INSIDE this plane.
169
- continue;
170
- }
171
-
172
- const result = boundingVolume.intersectPlane(
173
- Plane.Plane.fromCartesian4(planes[k], scratchPlane)
174
- );
175
- if (result === Transforms.Intersect.OUTSIDE) {
176
- return CullingVolume.MASK_OUTSIDE;
177
- } else if (result === Transforms.Intersect.INTERSECTING) {
178
- mask |= flag;
179
- }
180
- }
181
-
182
- return mask;
183
- };
184
-
185
- /**
186
- * For plane masks (as used in {@link CullingVolume#computeVisibilityWithPlaneMask}), this special value
187
- * represents the case where the object bounding volume is entirely outside the culling volume.
188
- *
189
- * @type {number}
190
- * @private
191
- */
192
- CullingVolume.MASK_OUTSIDE = 0xffffffff;
193
-
194
- /**
195
- * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value
196
- * represents the case where the object bounding volume is entirely inside the culling volume.
197
- *
198
- * @type {number}
199
- * @private
200
- */
201
- CullingVolume.MASK_INSIDE = 0x00000000;
202
-
203
- /**
204
- * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value
205
- * represents the case where the object bounding volume (may) intersect all planes of the culling volume.
206
- *
207
- * @type {number}
208
- * @private
209
- */
210
- CullingVolume.MASK_INDETERMINATE = 0x7fffffff;
211
-
212
- /**
213
- * The viewing frustum is defined by 6 planes.
214
- * Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
215
- * define the unit vector normal to the plane, and the w component is the distance of the
216
- * plane from the origin/camera position.
217
- *
218
- * @alias OrthographicOffCenterFrustum
219
- * @constructor
220
- *
221
- * @param {object} [options] An object with the following properties:
222
- * @param {number} [options.left] The left clipping plane distance.
223
- * @param {number} [options.right] The right clipping plane distance.
224
- * @param {number} [options.top] The top clipping plane distance.
225
- * @param {number} [options.bottom] The bottom clipping plane distance.
226
- * @param {number} [options.near=1.0] The near clipping plane distance.
227
- * @param {number} [options.far=500000000.0] The far clipping plane distance.
228
- *
229
- * @example
230
- * const maxRadii = ellipsoid.maximumRadius;
231
- *
232
- * const frustum = new Cesium.OrthographicOffCenterFrustum();
233
- * frustum.right = maxRadii * Cesium.Math.PI;
234
- * frustum.left = -c.frustum.right;
235
- * frustum.top = c.frustum.right * (canvas.clientHeight / canvas.clientWidth);
236
- * frustum.bottom = -c.frustum.top;
237
- * frustum.near = 0.01 * maxRadii;
238
- * frustum.far = 50.0 * maxRadii;
239
- */
240
- function OrthographicOffCenterFrustum(options) {
241
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
242
-
243
- /**
244
- * The left clipping plane.
245
- * @type {number}
246
- * @default undefined
247
- */
248
- this.left = options.left;
249
- this._left = undefined;
250
-
251
- /**
252
- * The right clipping plane.
253
- * @type {number}
254
- * @default undefined
255
- */
256
- this.right = options.right;
257
- this._right = undefined;
258
-
259
- /**
260
- * The top clipping plane.
261
- * @type {number}
262
- * @default undefined
263
- */
264
- this.top = options.top;
265
- this._top = undefined;
266
-
267
- /**
268
- * The bottom clipping plane.
269
- * @type {number}
270
- * @default undefined
271
- */
272
- this.bottom = options.bottom;
273
- this._bottom = undefined;
274
-
275
- /**
276
- * The distance of the near plane.
277
- * @type {number}
278
- * @default 1.0
279
- */
280
- this.near = defaultValue.defaultValue(options.near, 1.0);
281
- this._near = this.near;
282
-
283
- /**
284
- * The distance of the far plane.
285
- * @type {number}
286
- * @default 500000000.0;
287
- */
288
- this.far = defaultValue.defaultValue(options.far, 500000000.0);
289
- this._far = this.far;
290
-
291
- this._cullingVolume = new CullingVolume();
292
- this._orthographicMatrix = new Matrix2.Matrix4();
293
- }
294
-
295
- function update$3(frustum) {
296
- //>>includeStart('debug', pragmas.debug);
297
- if (
298
- !defaultValue.defined(frustum.right) ||
299
- !defaultValue.defined(frustum.left) ||
300
- !defaultValue.defined(frustum.top) ||
301
- !defaultValue.defined(frustum.bottom) ||
302
- !defaultValue.defined(frustum.near) ||
303
- !defaultValue.defined(frustum.far)
304
- ) {
305
- throw new Check.DeveloperError(
306
- "right, left, top, bottom, near, or far parameters are not set."
307
- );
308
- }
309
- //>>includeEnd('debug');
310
-
311
- if (
312
- frustum.top !== frustum._top ||
313
- frustum.bottom !== frustum._bottom ||
314
- frustum.left !== frustum._left ||
315
- frustum.right !== frustum._right ||
316
- frustum.near !== frustum._near ||
317
- frustum.far !== frustum._far
318
- ) {
319
- //>>includeStart('debug', pragmas.debug);
320
- if (frustum.left > frustum.right) {
321
- throw new Check.DeveloperError("right must be greater than left.");
322
- }
323
- if (frustum.bottom > frustum.top) {
324
- throw new Check.DeveloperError("top must be greater than bottom.");
325
- }
326
- if (frustum.near <= 0 || frustum.near > frustum.far) {
327
- throw new Check.DeveloperError(
328
- "near must be greater than zero and less than far."
329
- );
330
- }
331
- //>>includeEnd('debug');
332
-
333
- frustum._left = frustum.left;
334
- frustum._right = frustum.right;
335
- frustum._top = frustum.top;
336
- frustum._bottom = frustum.bottom;
337
- frustum._near = frustum.near;
338
- frustum._far = frustum.far;
339
- frustum._orthographicMatrix = Matrix2.Matrix4.computeOrthographicOffCenter(
340
- frustum.left,
341
- frustum.right,
342
- frustum.bottom,
343
- frustum.top,
344
- frustum.near,
345
- frustum.far,
346
- frustum._orthographicMatrix
347
- );
348
- }
349
- }
350
-
351
- Object.defineProperties(OrthographicOffCenterFrustum.prototype, {
352
- /**
353
- * Gets the orthographic projection matrix computed from the view frustum.
354
- * @memberof OrthographicOffCenterFrustum.prototype
355
- * @type {Matrix4}
356
- * @readonly
357
- */
358
- projectionMatrix: {
359
- get: function () {
360
- update$3(this);
361
- return this._orthographicMatrix;
362
- },
363
- },
364
- });
365
-
366
- const getPlanesRight$1 = new Matrix3.Cartesian3();
367
- const getPlanesNearCenter$1 = new Matrix3.Cartesian3();
368
- const getPlanesPoint = new Matrix3.Cartesian3();
369
- const negateScratch = new Matrix3.Cartesian3();
370
-
371
- /**
372
- * Creates a culling volume for this frustum.
373
- *
374
- * @param {Cartesian3} position The eye position.
375
- * @param {Cartesian3} direction The view direction.
376
- * @param {Cartesian3} up The up direction.
377
- * @returns {CullingVolume} A culling volume at the given position and orientation.
378
- *
379
- * @example
380
- * // Check if a bounding volume intersects the frustum.
381
- * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
382
- * const intersect = cullingVolume.computeVisibility(boundingVolume);
383
- */
384
- OrthographicOffCenterFrustum.prototype.computeCullingVolume = function (
385
- position,
386
- direction,
387
- up
388
- ) {
389
- //>>includeStart('debug', pragmas.debug);
390
- if (!defaultValue.defined(position)) {
391
- throw new Check.DeveloperError("position is required.");
392
- }
393
- if (!defaultValue.defined(direction)) {
394
- throw new Check.DeveloperError("direction is required.");
395
- }
396
- if (!defaultValue.defined(up)) {
397
- throw new Check.DeveloperError("up is required.");
398
- }
399
- //>>includeEnd('debug');
400
-
401
- const planes = this._cullingVolume.planes;
402
- const t = this.top;
403
- const b = this.bottom;
404
- const r = this.right;
405
- const l = this.left;
406
- const n = this.near;
407
- const f = this.far;
408
-
409
- const right = Matrix3.Cartesian3.cross(direction, up, getPlanesRight$1);
410
- Matrix3.Cartesian3.normalize(right, right);
411
- const nearCenter = getPlanesNearCenter$1;
412
- Matrix3.Cartesian3.multiplyByScalar(direction, n, nearCenter);
413
- Matrix3.Cartesian3.add(position, nearCenter, nearCenter);
414
-
415
- const point = getPlanesPoint;
416
-
417
- // Left plane
418
- Matrix3.Cartesian3.multiplyByScalar(right, l, point);
419
- Matrix3.Cartesian3.add(nearCenter, point, point);
420
-
421
- let plane = planes[0];
422
- if (!defaultValue.defined(plane)) {
423
- plane = planes[0] = new Matrix2.Cartesian4();
424
- }
425
- plane.x = right.x;
426
- plane.y = right.y;
427
- plane.z = right.z;
428
- plane.w = -Matrix3.Cartesian3.dot(right, point);
429
-
430
- // Right plane
431
- Matrix3.Cartesian3.multiplyByScalar(right, r, point);
432
- Matrix3.Cartesian3.add(nearCenter, point, point);
433
-
434
- plane = planes[1];
435
- if (!defaultValue.defined(plane)) {
436
- plane = planes[1] = new Matrix2.Cartesian4();
437
- }
438
- plane.x = -right.x;
439
- plane.y = -right.y;
440
- plane.z = -right.z;
441
- plane.w = -Matrix3.Cartesian3.dot(Matrix3.Cartesian3.negate(right, negateScratch), point);
442
-
443
- // Bottom plane
444
- Matrix3.Cartesian3.multiplyByScalar(up, b, point);
445
- Matrix3.Cartesian3.add(nearCenter, point, point);
446
-
447
- plane = planes[2];
448
- if (!defaultValue.defined(plane)) {
449
- plane = planes[2] = new Matrix2.Cartesian4();
450
- }
451
- plane.x = up.x;
452
- plane.y = up.y;
453
- plane.z = up.z;
454
- plane.w = -Matrix3.Cartesian3.dot(up, point);
455
-
456
- // Top plane
457
- Matrix3.Cartesian3.multiplyByScalar(up, t, point);
458
- Matrix3.Cartesian3.add(nearCenter, point, point);
459
-
460
- plane = planes[3];
461
- if (!defaultValue.defined(plane)) {
462
- plane = planes[3] = new Matrix2.Cartesian4();
463
- }
464
- plane.x = -up.x;
465
- plane.y = -up.y;
466
- plane.z = -up.z;
467
- plane.w = -Matrix3.Cartesian3.dot(Matrix3.Cartesian3.negate(up, negateScratch), point);
468
-
469
- // Near plane
470
- plane = planes[4];
471
- if (!defaultValue.defined(plane)) {
472
- plane = planes[4] = new Matrix2.Cartesian4();
473
- }
474
- plane.x = direction.x;
475
- plane.y = direction.y;
476
- plane.z = direction.z;
477
- plane.w = -Matrix3.Cartesian3.dot(direction, nearCenter);
478
-
479
- // Far plane
480
- Matrix3.Cartesian3.multiplyByScalar(direction, f, point);
481
- Matrix3.Cartesian3.add(position, point, point);
482
-
483
- plane = planes[5];
484
- if (!defaultValue.defined(plane)) {
485
- plane = planes[5] = new Matrix2.Cartesian4();
486
- }
487
- plane.x = -direction.x;
488
- plane.y = -direction.y;
489
- plane.z = -direction.z;
490
- plane.w = -Matrix3.Cartesian3.dot(Matrix3.Cartesian3.negate(direction, negateScratch), point);
491
-
492
- return this._cullingVolume;
493
- };
494
-
495
- /**
496
- * Returns the pixel's width and height in meters.
497
- *
498
- * @param {number} drawingBufferWidth The width of the drawing buffer.
499
- * @param {number} drawingBufferHeight The height of the drawing buffer.
500
- * @param {number} distance The distance to the near plane in meters.
501
- * @param {number} pixelRatio The scaling factor from pixel space to coordinate space.
502
- * @param {Cartesian2} result The object onto which to store the result.
503
- * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
504
- *
505
- * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
506
- * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
507
- * @exception {DeveloperError} pixelRatio must be greater than zero.
508
- *
509
- * @example
510
- * // Example 1
511
- * // Get the width and height of a pixel.
512
- * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cesium.Cartesian2());
513
- */
514
- OrthographicOffCenterFrustum.prototype.getPixelDimensions = function (
515
- drawingBufferWidth,
516
- drawingBufferHeight,
517
- distance,
518
- pixelRatio,
519
- result
520
- ) {
521
- update$3(this);
522
-
523
- //>>includeStart('debug', pragmas.debug);
524
- if (!defaultValue.defined(drawingBufferWidth) || !defaultValue.defined(drawingBufferHeight)) {
525
- throw new Check.DeveloperError(
526
- "Both drawingBufferWidth and drawingBufferHeight are required."
527
- );
528
- }
529
- if (drawingBufferWidth <= 0) {
530
- throw new Check.DeveloperError("drawingBufferWidth must be greater than zero.");
531
- }
532
- if (drawingBufferHeight <= 0) {
533
- throw new Check.DeveloperError("drawingBufferHeight must be greater than zero.");
534
- }
535
- if (!defaultValue.defined(distance)) {
536
- throw new Check.DeveloperError("distance is required.");
537
- }
538
- if (!defaultValue.defined(pixelRatio)) {
539
- throw new Check.DeveloperError("pixelRatio is required.");
540
- }
541
- if (pixelRatio <= 0) {
542
- throw new Check.DeveloperError("pixelRatio must be greater than zero.");
543
- }
544
- if (!defaultValue.defined(result)) {
545
- throw new Check.DeveloperError("A result object is required.");
546
- }
547
- //>>includeEnd('debug');
548
-
549
- const frustumWidth = this.right - this.left;
550
- const frustumHeight = this.top - this.bottom;
551
- const pixelWidth = (pixelRatio * frustumWidth) / drawingBufferWidth;
552
- const pixelHeight = (pixelRatio * frustumHeight) / drawingBufferHeight;
553
-
554
- result.x = pixelWidth;
555
- result.y = pixelHeight;
556
- return result;
557
- };
558
-
559
- /**
560
- * Returns a duplicate of a OrthographicOffCenterFrustum instance.
561
- *
562
- * @param {OrthographicOffCenterFrustum} [result] The object onto which to store the result.
563
- * @returns {OrthographicOffCenterFrustum} The modified result parameter or a new OrthographicOffCenterFrustum instance if one was not provided.
564
- */
565
- OrthographicOffCenterFrustum.prototype.clone = function (result) {
566
- if (!defaultValue.defined(result)) {
567
- result = new OrthographicOffCenterFrustum();
568
- }
569
-
570
- result.left = this.left;
571
- result.right = this.right;
572
- result.top = this.top;
573
- result.bottom = this.bottom;
574
- result.near = this.near;
575
- result.far = this.far;
576
-
577
- // force update of clone to compute matrices
578
- result._left = undefined;
579
- result._right = undefined;
580
- result._top = undefined;
581
- result._bottom = undefined;
582
- result._near = undefined;
583
- result._far = undefined;
584
-
585
- return result;
586
- };
587
-
588
- /**
589
- * Compares the provided OrthographicOffCenterFrustum componentwise and returns
590
- * <code>true</code> if they are equal, <code>false</code> otherwise.
591
- *
592
- * @param {OrthographicOffCenterFrustum} [other] The right hand side OrthographicOffCenterFrustum.
593
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
594
- */
595
- OrthographicOffCenterFrustum.prototype.equals = function (other) {
596
- return (
597
- defaultValue.defined(other) &&
598
- other instanceof OrthographicOffCenterFrustum &&
599
- this.right === other.right &&
600
- this.left === other.left &&
601
- this.top === other.top &&
602
- this.bottom === other.bottom &&
603
- this.near === other.near &&
604
- this.far === other.far
605
- );
606
- };
607
-
608
- /**
609
- * Compares the provided OrthographicOffCenterFrustum componentwise and returns
610
- * <code>true</code> if they pass an absolute or relative tolerance test,
611
- * <code>false</code> otherwise.
612
- *
613
- * @param {OrthographicOffCenterFrustum} other The right hand side OrthographicOffCenterFrustum.
614
- * @param {number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
615
- * @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
616
- * @returns {boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
617
- */
618
- OrthographicOffCenterFrustum.prototype.equalsEpsilon = function (
619
- other,
620
- relativeEpsilon,
621
- absoluteEpsilon
622
- ) {
623
- return (
624
- other === this ||
625
- (defaultValue.defined(other) &&
626
- other instanceof OrthographicOffCenterFrustum &&
627
- Math$1.CesiumMath.equalsEpsilon(
628
- this.right,
629
- other.right,
630
- relativeEpsilon,
631
- absoluteEpsilon
632
- ) &&
633
- Math$1.CesiumMath.equalsEpsilon(
634
- this.left,
635
- other.left,
636
- relativeEpsilon,
637
- absoluteEpsilon
638
- ) &&
639
- Math$1.CesiumMath.equalsEpsilon(
640
- this.top,
641
- other.top,
642
- relativeEpsilon,
643
- absoluteEpsilon
644
- ) &&
645
- Math$1.CesiumMath.equalsEpsilon(
646
- this.bottom,
647
- other.bottom,
648
- relativeEpsilon,
649
- absoluteEpsilon
650
- ) &&
651
- Math$1.CesiumMath.equalsEpsilon(
652
- this.near,
653
- other.near,
654
- relativeEpsilon,
655
- absoluteEpsilon
656
- ) &&
657
- Math$1.CesiumMath.equalsEpsilon(
658
- this.far,
659
- other.far,
660
- relativeEpsilon,
661
- absoluteEpsilon
662
- ))
663
- );
664
- };
665
-
666
- /**
667
- * The viewing frustum is defined by 6 planes.
668
- * Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
669
- * define the unit vector normal to the plane, and the w component is the distance of the
670
- * plane from the origin/camera position.
671
- *
672
- * @alias OrthographicFrustum
673
- * @constructor
674
- *
675
- * @param {object} [options] An object with the following properties:
676
- * @param {number} [options.width] The width of the frustum in meters.
677
- * @param {number} [options.aspectRatio] The aspect ratio of the frustum's width to it's height.
678
- * @param {number} [options.near=1.0] The distance of the near plane.
679
- * @param {number} [options.far=500000000.0] The distance of the far plane.
680
- *
681
- * @example
682
- * const maxRadii = ellipsoid.maximumRadius;
683
- *
684
- * const frustum = new Cesium.OrthographicFrustum();
685
- * frustum.near = 0.01 * maxRadii;
686
- * frustum.far = 50.0 * maxRadii;
687
- */
688
- function OrthographicFrustum(options) {
689
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
690
-
691
- this._offCenterFrustum = new OrthographicOffCenterFrustum();
692
-
693
- /**
694
- * The horizontal width of the frustum in meters.
695
- * @type {number}
696
- * @default undefined
697
- */
698
- this.width = options.width;
699
- this._width = undefined;
700
-
701
- /**
702
- * The aspect ratio of the frustum's width to it's height.
703
- * @type {number}
704
- * @default undefined
705
- */
706
- this.aspectRatio = options.aspectRatio;
707
- this._aspectRatio = undefined;
708
-
709
- /**
710
- * The distance of the near plane.
711
- * @type {number}
712
- * @default 1.0
713
- */
714
- this.near = defaultValue.defaultValue(options.near, 1.0);
715
- this._near = this.near;
716
-
717
- /**
718
- * The distance of the far plane.
719
- * @type {number}
720
- * @default 500000000.0;
721
- */
722
- this.far = defaultValue.defaultValue(options.far, 500000000.0);
723
- this._far = this.far;
724
- }
725
-
726
- /**
727
- * The number of elements used to pack the object into an array.
728
- * @type {number}
729
- */
730
- OrthographicFrustum.packedLength = 4;
731
-
732
- /**
733
- * Stores the provided instance into the provided array.
734
- *
735
- * @param {OrthographicFrustum} value The value to pack.
736
- * @param {number[]} array The array to pack into.
737
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
738
- *
739
- * @returns {number[]} The array that was packed into
740
- */
741
- OrthographicFrustum.pack = function (value, array, startingIndex) {
742
- //>>includeStart('debug', pragmas.debug);
743
- Check.Check.typeOf.object("value", value);
744
- Check.Check.defined("array", array);
745
- //>>includeEnd('debug');
746
-
747
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
748
-
749
- array[startingIndex++] = value.width;
750
- array[startingIndex++] = value.aspectRatio;
751
- array[startingIndex++] = value.near;
752
- array[startingIndex] = value.far;
753
-
754
- return array;
755
- };
756
-
757
- /**
758
- * Retrieves an instance from a packed array.
759
- *
760
- * @param {number[]} array The packed array.
761
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
762
- * @param {OrthographicFrustum} [result] The object into which to store the result.
763
- * @returns {OrthographicFrustum} The modified result parameter or a new OrthographicFrustum instance if one was not provided.
764
- */
765
- OrthographicFrustum.unpack = function (array, startingIndex, result) {
766
- //>>includeStart('debug', pragmas.debug);
767
- Check.Check.defined("array", array);
768
- //>>includeEnd('debug');
769
-
770
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
771
-
772
- if (!defaultValue.defined(result)) {
773
- result = new OrthographicFrustum();
774
- }
775
-
776
- result.width = array[startingIndex++];
777
- result.aspectRatio = array[startingIndex++];
778
- result.near = array[startingIndex++];
779
- result.far = array[startingIndex];
780
-
781
- return result;
782
- };
783
-
784
- function update$2(frustum) {
785
- //>>includeStart('debug', pragmas.debug);
786
- if (
787
- !defaultValue.defined(frustum.width) ||
788
- !defaultValue.defined(frustum.aspectRatio) ||
789
- !defaultValue.defined(frustum.near) ||
790
- !defaultValue.defined(frustum.far)
791
- ) {
792
- throw new Check.DeveloperError(
793
- "width, aspectRatio, near, or far parameters are not set."
794
- );
795
- }
796
- //>>includeEnd('debug');
797
-
798
- const f = frustum._offCenterFrustum;
799
-
800
- if (
801
- frustum.width !== frustum._width ||
802
- frustum.aspectRatio !== frustum._aspectRatio ||
803
- frustum.near !== frustum._near ||
804
- frustum.far !== frustum._far
805
- ) {
806
- //>>includeStart('debug', pragmas.debug);
807
- if (frustum.aspectRatio < 0) {
808
- throw new Check.DeveloperError("aspectRatio must be positive.");
809
- }
810
- if (frustum.near < 0 || frustum.near > frustum.far) {
811
- throw new Check.DeveloperError(
812
- "near must be greater than zero and less than far."
813
- );
814
- }
815
- //>>includeEnd('debug');
816
-
817
- frustum._aspectRatio = frustum.aspectRatio;
818
- frustum._width = frustum.width;
819
- frustum._near = frustum.near;
820
- frustum._far = frustum.far;
821
-
822
- const ratio = 1.0 / frustum.aspectRatio;
823
- f.right = frustum.width * 0.5;
824
- f.left = -f.right;
825
- f.top = ratio * f.right;
826
- f.bottom = -f.top;
827
- f.near = frustum.near;
828
- f.far = frustum.far;
829
- }
830
- }
831
-
832
- Object.defineProperties(OrthographicFrustum.prototype, {
833
- /**
834
- * Gets the orthographic projection matrix computed from the view frustum.
835
- * @memberof OrthographicFrustum.prototype
836
- * @type {Matrix4}
837
- * @readonly
838
- */
839
- projectionMatrix: {
840
- get: function () {
841
- update$2(this);
842
- return this._offCenterFrustum.projectionMatrix;
843
- },
844
- },
845
- /**
846
- * Gets the orthographic projection matrix computed from the view frustum.
847
- * @memberof OrthographicFrustum.prototype
848
- * @type {OrthographicOffCenterFrustum}
849
- * @readonly
850
- * @private
851
- */
852
- offCenterFrustum: {
853
- get: function () {
854
- update$2(this);
855
- return this._offCenterFrustum;
856
- },
857
- },
858
- });
859
-
860
- /**
861
- * Creates a culling volume for this frustum.
862
- *
863
- * @param {Cartesian3} position The eye position.
864
- * @param {Cartesian3} direction The view direction.
865
- * @param {Cartesian3} up The up direction.
866
- * @returns {CullingVolume} A culling volume at the given position and orientation.
867
- *
868
- * @example
869
- * // Check if a bounding volume intersects the frustum.
870
- * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
871
- * const intersect = cullingVolume.computeVisibility(boundingVolume);
872
- */
873
- OrthographicFrustum.prototype.computeCullingVolume = function (
874
- position,
875
- direction,
876
- up
877
- ) {
878
- update$2(this);
879
- return this._offCenterFrustum.computeCullingVolume(position, direction, up);
880
- };
881
-
882
- /**
883
- * Returns the pixel's width and height in meters.
884
- *
885
- * @param {number} drawingBufferWidth The width of the drawing buffer.
886
- * @param {number} drawingBufferHeight The height of the drawing buffer.
887
- * @param {number} distance The distance to the near plane in meters.
888
- * @param {number} pixelRatio The scaling factor from pixel space to coordinate space.
889
- * @param {Cartesian2} result The object onto which to store the result.
890
- * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
891
- *
892
- * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
893
- * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
894
- * @exception {DeveloperError} pixelRatio must be greater than zero.
895
- *
896
- * @example
897
- * // Example 1
898
- * // Get the width and height of a pixel.
899
- * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cesium.Cartesian2());
900
- */
901
- OrthographicFrustum.prototype.getPixelDimensions = function (
902
- drawingBufferWidth,
903
- drawingBufferHeight,
904
- distance,
905
- pixelRatio,
906
- result
907
- ) {
908
- update$2(this);
909
- return this._offCenterFrustum.getPixelDimensions(
910
- drawingBufferWidth,
911
- drawingBufferHeight,
912
- distance,
913
- pixelRatio,
914
- result
915
- );
916
- };
917
-
918
- /**
919
- * Returns a duplicate of a OrthographicFrustum instance.
920
- *
921
- * @param {OrthographicFrustum} [result] The object onto which to store the result.
922
- * @returns {OrthographicFrustum} The modified result parameter or a new OrthographicFrustum instance if one was not provided.
923
- */
924
- OrthographicFrustum.prototype.clone = function (result) {
925
- if (!defaultValue.defined(result)) {
926
- result = new OrthographicFrustum();
927
- }
928
-
929
- result.aspectRatio = this.aspectRatio;
930
- result.width = this.width;
931
- result.near = this.near;
932
- result.far = this.far;
933
-
934
- // force update of clone to compute matrices
935
- result._aspectRatio = undefined;
936
- result._width = undefined;
937
- result._near = undefined;
938
- result._far = undefined;
939
-
940
- this._offCenterFrustum.clone(result._offCenterFrustum);
941
-
942
- return result;
943
- };
944
-
945
- /**
946
- * Compares the provided OrthographicFrustum componentwise and returns
947
- * <code>true</code> if they are equal, <code>false</code> otherwise.
948
- *
949
- * @param {OrthographicFrustum} [other] The right hand side OrthographicFrustum.
950
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
951
- */
952
- OrthographicFrustum.prototype.equals = function (other) {
953
- if (!defaultValue.defined(other) || !(other instanceof OrthographicFrustum)) {
954
- return false;
955
- }
956
-
957
- update$2(this);
958
- update$2(other);
959
-
960
- return (
961
- this.width === other.width &&
962
- this.aspectRatio === other.aspectRatio &&
963
- this._offCenterFrustum.equals(other._offCenterFrustum)
964
- );
965
- };
966
-
967
- /**
968
- * Compares the provided OrthographicFrustum componentwise and returns
969
- * <code>true</code> if they pass an absolute or relative tolerance test,
970
- * <code>false</code> otherwise.
971
- *
972
- * @param {OrthographicFrustum} other The right hand side OrthographicFrustum.
973
- * @param {number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
974
- * @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
975
- * @returns {boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
976
- */
977
- OrthographicFrustum.prototype.equalsEpsilon = function (
978
- other,
979
- relativeEpsilon,
980
- absoluteEpsilon
981
- ) {
982
- if (!defaultValue.defined(other) || !(other instanceof OrthographicFrustum)) {
983
- return false;
984
- }
985
-
986
- update$2(this);
987
- update$2(other);
988
-
989
- return (
990
- Math$1.CesiumMath.equalsEpsilon(
991
- this.width,
992
- other.width,
993
- relativeEpsilon,
994
- absoluteEpsilon
995
- ) &&
996
- Math$1.CesiumMath.equalsEpsilon(
997
- this.aspectRatio,
998
- other.aspectRatio,
999
- relativeEpsilon,
1000
- absoluteEpsilon
1001
- ) &&
1002
- this._offCenterFrustum.equalsEpsilon(
1003
- other._offCenterFrustum,
1004
- relativeEpsilon,
1005
- absoluteEpsilon
1006
- )
1007
- );
1008
- };
1009
-
1010
- /**
1011
- * The viewing frustum is defined by 6 planes.
1012
- * Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
1013
- * define the unit vector normal to the plane, and the w component is the distance of the
1014
- * plane from the origin/camera position.
1015
- *
1016
- * @alias PerspectiveOffCenterFrustum
1017
- * @constructor
1018
- *
1019
- * @param {object} [options] An object with the following properties:
1020
- * @param {number} [options.left] The left clipping plane distance.
1021
- * @param {number} [options.right] The right clipping plane distance.
1022
- * @param {number} [options.top] The top clipping plane distance.
1023
- * @param {number} [options.bottom] The bottom clipping plane distance.
1024
- * @param {number} [options.near=1.0] The near clipping plane distance.
1025
- * @param {number} [options.far=500000000.0] The far clipping plane distance.
1026
- *
1027
- * @example
1028
- * const frustum = new Cesium.PerspectiveOffCenterFrustum({
1029
- * left : -1.0,
1030
- * right : 1.0,
1031
- * top : 1.0,
1032
- * bottom : -1.0,
1033
- * near : 1.0,
1034
- * far : 100.0
1035
- * });
1036
- *
1037
- * @see PerspectiveFrustum
1038
- */
1039
- function PerspectiveOffCenterFrustum(options) {
1040
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
1041
-
1042
- /**
1043
- * Defines the left clipping plane.
1044
- * @type {number}
1045
- * @default undefined
1046
- */
1047
- this.left = options.left;
1048
- this._left = undefined;
1049
-
1050
- /**
1051
- * Defines the right clipping plane.
1052
- * @type {number}
1053
- * @default undefined
1054
- */
1055
- this.right = options.right;
1056
- this._right = undefined;
1057
-
1058
- /**
1059
- * Defines the top clipping plane.
1060
- * @type {number}
1061
- * @default undefined
1062
- */
1063
- this.top = options.top;
1064
- this._top = undefined;
1065
-
1066
- /**
1067
- * Defines the bottom clipping plane.
1068
- * @type {number}
1069
- * @default undefined
1070
- */
1071
- this.bottom = options.bottom;
1072
- this._bottom = undefined;
1073
-
1074
- /**
1075
- * The distance of the near plane.
1076
- * @type {number}
1077
- * @default 1.0
1078
- */
1079
- this.near = defaultValue.defaultValue(options.near, 1.0);
1080
- this._near = this.near;
1081
-
1082
- /**
1083
- * The distance of the far plane.
1084
- * @type {number}
1085
- * @default 500000000.0
1086
- */
1087
- this.far = defaultValue.defaultValue(options.far, 500000000.0);
1088
- this._far = this.far;
1089
-
1090
- this._cullingVolume = new CullingVolume();
1091
- this._perspectiveMatrix = new Matrix2.Matrix4();
1092
- this._infinitePerspective = new Matrix2.Matrix4();
1093
- }
1094
-
1095
- function update$1(frustum) {
1096
- //>>includeStart('debug', pragmas.debug);
1097
- if (
1098
- !defaultValue.defined(frustum.right) ||
1099
- !defaultValue.defined(frustum.left) ||
1100
- !defaultValue.defined(frustum.top) ||
1101
- !defaultValue.defined(frustum.bottom) ||
1102
- !defaultValue.defined(frustum.near) ||
1103
- !defaultValue.defined(frustum.far)
1104
- ) {
1105
- throw new Check.DeveloperError(
1106
- "right, left, top, bottom, near, or far parameters are not set."
1107
- );
1108
- }
1109
- //>>includeEnd('debug');
1110
-
1111
- const t = frustum.top;
1112
- const b = frustum.bottom;
1113
- const r = frustum.right;
1114
- const l = frustum.left;
1115
- const n = frustum.near;
1116
- const f = frustum.far;
1117
-
1118
- if (
1119
- t !== frustum._top ||
1120
- b !== frustum._bottom ||
1121
- l !== frustum._left ||
1122
- r !== frustum._right ||
1123
- n !== frustum._near ||
1124
- f !== frustum._far
1125
- ) {
1126
- //>>includeStart('debug', pragmas.debug);
1127
- if (frustum.near <= 0 || frustum.near > frustum.far) {
1128
- throw new Check.DeveloperError(
1129
- "near must be greater than zero and less than far."
1130
- );
1131
- }
1132
- //>>includeEnd('debug');
1133
-
1134
- frustum._left = l;
1135
- frustum._right = r;
1136
- frustum._top = t;
1137
- frustum._bottom = b;
1138
- frustum._near = n;
1139
- frustum._far = f;
1140
- frustum._perspectiveMatrix = Matrix2.Matrix4.computePerspectiveOffCenter(
1141
- l,
1142
- r,
1143
- b,
1144
- t,
1145
- n,
1146
- f,
1147
- frustum._perspectiveMatrix
1148
- );
1149
- frustum._infinitePerspective = Matrix2.Matrix4.computeInfinitePerspectiveOffCenter(
1150
- l,
1151
- r,
1152
- b,
1153
- t,
1154
- n,
1155
- frustum._infinitePerspective
1156
- );
1157
- }
1158
- }
1159
-
1160
- Object.defineProperties(PerspectiveOffCenterFrustum.prototype, {
1161
- /**
1162
- * Gets the perspective projection matrix computed from the view frustum.
1163
- * @memberof PerspectiveOffCenterFrustum.prototype
1164
- * @type {Matrix4}
1165
- * @readonly
1166
- *
1167
- * @see PerspectiveOffCenterFrustum#infiniteProjectionMatrix
1168
- */
1169
- projectionMatrix: {
1170
- get: function () {
1171
- update$1(this);
1172
- return this._perspectiveMatrix;
1173
- },
1174
- },
1175
-
1176
- /**
1177
- * Gets the perspective projection matrix computed from the view frustum with an infinite far plane.
1178
- * @memberof PerspectiveOffCenterFrustum.prototype
1179
- * @type {Matrix4}
1180
- * @readonly
1181
- *
1182
- * @see PerspectiveOffCenterFrustum#projectionMatrix
1183
- */
1184
- infiniteProjectionMatrix: {
1185
- get: function () {
1186
- update$1(this);
1187
- return this._infinitePerspective;
1188
- },
1189
- },
1190
- });
1191
-
1192
- const getPlanesRight = new Matrix3.Cartesian3();
1193
- const getPlanesNearCenter = new Matrix3.Cartesian3();
1194
- const getPlanesFarCenter = new Matrix3.Cartesian3();
1195
- const getPlanesNormal = new Matrix3.Cartesian3();
1196
- /**
1197
- * Creates a culling volume for this frustum.
1198
- *
1199
- * @param {Cartesian3} position The eye position.
1200
- * @param {Cartesian3} direction The view direction.
1201
- * @param {Cartesian3} up The up direction.
1202
- * @returns {CullingVolume} A culling volume at the given position and orientation.
1203
- *
1204
- * @example
1205
- * // Check if a bounding volume intersects the frustum.
1206
- * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
1207
- * const intersect = cullingVolume.computeVisibility(boundingVolume);
1208
- */
1209
- PerspectiveOffCenterFrustum.prototype.computeCullingVolume = function (
1210
- position,
1211
- direction,
1212
- up
1213
- ) {
1214
- //>>includeStart('debug', pragmas.debug);
1215
- if (!defaultValue.defined(position)) {
1216
- throw new Check.DeveloperError("position is required.");
1217
- }
1218
-
1219
- if (!defaultValue.defined(direction)) {
1220
- throw new Check.DeveloperError("direction is required.");
1221
- }
1222
-
1223
- if (!defaultValue.defined(up)) {
1224
- throw new Check.DeveloperError("up is required.");
1225
- }
1226
- //>>includeEnd('debug');
1227
-
1228
- const planes = this._cullingVolume.planes;
1229
-
1230
- const t = this.top;
1231
- const b = this.bottom;
1232
- const r = this.right;
1233
- const l = this.left;
1234
- const n = this.near;
1235
- const f = this.far;
1236
-
1237
- const right = Matrix3.Cartesian3.cross(direction, up, getPlanesRight);
1238
-
1239
- const nearCenter = getPlanesNearCenter;
1240
- Matrix3.Cartesian3.multiplyByScalar(direction, n, nearCenter);
1241
- Matrix3.Cartesian3.add(position, nearCenter, nearCenter);
1242
-
1243
- const farCenter = getPlanesFarCenter;
1244
- Matrix3.Cartesian3.multiplyByScalar(direction, f, farCenter);
1245
- Matrix3.Cartesian3.add(position, farCenter, farCenter);
1246
-
1247
- const normal = getPlanesNormal;
1248
-
1249
- //Left plane computation
1250
- Matrix3.Cartesian3.multiplyByScalar(right, l, normal);
1251
- Matrix3.Cartesian3.add(nearCenter, normal, normal);
1252
- Matrix3.Cartesian3.subtract(normal, position, normal);
1253
- Matrix3.Cartesian3.normalize(normal, normal);
1254
- Matrix3.Cartesian3.cross(normal, up, normal);
1255
- Matrix3.Cartesian3.normalize(normal, normal);
1256
-
1257
- let plane = planes[0];
1258
- if (!defaultValue.defined(plane)) {
1259
- plane = planes[0] = new Matrix2.Cartesian4();
1260
- }
1261
- plane.x = normal.x;
1262
- plane.y = normal.y;
1263
- plane.z = normal.z;
1264
- plane.w = -Matrix3.Cartesian3.dot(normal, position);
1265
-
1266
- //Right plane computation
1267
- Matrix3.Cartesian3.multiplyByScalar(right, r, normal);
1268
- Matrix3.Cartesian3.add(nearCenter, normal, normal);
1269
- Matrix3.Cartesian3.subtract(normal, position, normal);
1270
- Matrix3.Cartesian3.cross(up, normal, normal);
1271
- Matrix3.Cartesian3.normalize(normal, normal);
1272
-
1273
- plane = planes[1];
1274
- if (!defaultValue.defined(plane)) {
1275
- plane = planes[1] = new Matrix2.Cartesian4();
1276
- }
1277
- plane.x = normal.x;
1278
- plane.y = normal.y;
1279
- plane.z = normal.z;
1280
- plane.w = -Matrix3.Cartesian3.dot(normal, position);
1281
-
1282
- //Bottom plane computation
1283
- Matrix3.Cartesian3.multiplyByScalar(up, b, normal);
1284
- Matrix3.Cartesian3.add(nearCenter, normal, normal);
1285
- Matrix3.Cartesian3.subtract(normal, position, normal);
1286
- Matrix3.Cartesian3.cross(right, normal, normal);
1287
- Matrix3.Cartesian3.normalize(normal, normal);
1288
-
1289
- plane = planes[2];
1290
- if (!defaultValue.defined(plane)) {
1291
- plane = planes[2] = new Matrix2.Cartesian4();
1292
- }
1293
- plane.x = normal.x;
1294
- plane.y = normal.y;
1295
- plane.z = normal.z;
1296
- plane.w = -Matrix3.Cartesian3.dot(normal, position);
1297
-
1298
- //Top plane computation
1299
- Matrix3.Cartesian3.multiplyByScalar(up, t, normal);
1300
- Matrix3.Cartesian3.add(nearCenter, normal, normal);
1301
- Matrix3.Cartesian3.subtract(normal, position, normal);
1302
- Matrix3.Cartesian3.cross(normal, right, normal);
1303
- Matrix3.Cartesian3.normalize(normal, normal);
1304
-
1305
- plane = planes[3];
1306
- if (!defaultValue.defined(plane)) {
1307
- plane = planes[3] = new Matrix2.Cartesian4();
1308
- }
1309
- plane.x = normal.x;
1310
- plane.y = normal.y;
1311
- plane.z = normal.z;
1312
- plane.w = -Matrix3.Cartesian3.dot(normal, position);
1313
-
1314
- //Near plane computation
1315
- plane = planes[4];
1316
- if (!defaultValue.defined(plane)) {
1317
- plane = planes[4] = new Matrix2.Cartesian4();
1318
- }
1319
- plane.x = direction.x;
1320
- plane.y = direction.y;
1321
- plane.z = direction.z;
1322
- plane.w = -Matrix3.Cartesian3.dot(direction, nearCenter);
1323
-
1324
- //Far plane computation
1325
- Matrix3.Cartesian3.negate(direction, normal);
1326
-
1327
- plane = planes[5];
1328
- if (!defaultValue.defined(plane)) {
1329
- plane = planes[5] = new Matrix2.Cartesian4();
1330
- }
1331
- plane.x = normal.x;
1332
- plane.y = normal.y;
1333
- plane.z = normal.z;
1334
- plane.w = -Matrix3.Cartesian3.dot(normal, farCenter);
1335
-
1336
- return this._cullingVolume;
1337
- };
1338
-
1339
- /**
1340
- * Returns the pixel's width and height in meters.
1341
- *
1342
- * @param {number} drawingBufferWidth The width of the drawing buffer.
1343
- * @param {number} drawingBufferHeight The height of the drawing buffer.
1344
- * @param {number} distance The distance to the near plane in meters.
1345
- * @param {number} pixelRatio The scaling factor from pixel space to coordinate space.
1346
- * @param {Cartesian2} result The object onto which to store the result.
1347
- * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
1348
- *
1349
- * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
1350
- * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
1351
- * @exception {DeveloperError} pixelRatio must be greater than zero.
1352
- *
1353
- * @example
1354
- * // Example 1
1355
- * // Get the width and height of a pixel.
1356
- * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2());
1357
- *
1358
- * @example
1359
- * // Example 2
1360
- * // Get the width and height of a pixel if the near plane was set to 'distance'.
1361
- * // For example, get the size of a pixel of an image on a billboard.
1362
- * const position = camera.position;
1363
- * const direction = camera.direction;
1364
- * const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive
1365
- * const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
1366
- * const distance = Cesium.Cartesian3.magnitude(toCenterProj);
1367
- * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());
1368
- */
1369
- PerspectiveOffCenterFrustum.prototype.getPixelDimensions = function (
1370
- drawingBufferWidth,
1371
- drawingBufferHeight,
1372
- distance,
1373
- pixelRatio,
1374
- result
1375
- ) {
1376
- update$1(this);
1377
-
1378
- //>>includeStart('debug', pragmas.debug);
1379
- if (!defaultValue.defined(drawingBufferWidth) || !defaultValue.defined(drawingBufferHeight)) {
1380
- throw new Check.DeveloperError(
1381
- "Both drawingBufferWidth and drawingBufferHeight are required."
1382
- );
1383
- }
1384
- if (drawingBufferWidth <= 0) {
1385
- throw new Check.DeveloperError("drawingBufferWidth must be greater than zero.");
1386
- }
1387
- if (drawingBufferHeight <= 0) {
1388
- throw new Check.DeveloperError("drawingBufferHeight must be greater than zero.");
1389
- }
1390
- if (!defaultValue.defined(distance)) {
1391
- throw new Check.DeveloperError("distance is required.");
1392
- }
1393
- if (!defaultValue.defined(pixelRatio)) {
1394
- throw new Check.DeveloperError("pixelRatio is required");
1395
- }
1396
- if (pixelRatio <= 0) {
1397
- throw new Check.DeveloperError("pixelRatio must be greater than zero.");
1398
- }
1399
- if (!defaultValue.defined(result)) {
1400
- throw new Check.DeveloperError("A result object is required.");
1401
- }
1402
- //>>includeEnd('debug');
1403
-
1404
- const inverseNear = 1.0 / this.near;
1405
- let tanTheta = this.top * inverseNear;
1406
- const pixelHeight =
1407
- (2.0 * pixelRatio * distance * tanTheta) / drawingBufferHeight;
1408
- tanTheta = this.right * inverseNear;
1409
- const pixelWidth =
1410
- (2.0 * pixelRatio * distance * tanTheta) / drawingBufferWidth;
1411
-
1412
- result.x = pixelWidth;
1413
- result.y = pixelHeight;
1414
- return result;
1415
- };
1416
-
1417
- /**
1418
- * Returns a duplicate of a PerspectiveOffCenterFrustum instance.
1419
- *
1420
- * @param {PerspectiveOffCenterFrustum} [result] The object onto which to store the result.
1421
- * @returns {PerspectiveOffCenterFrustum} The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
1422
- */
1423
- PerspectiveOffCenterFrustum.prototype.clone = function (result) {
1424
- if (!defaultValue.defined(result)) {
1425
- result = new PerspectiveOffCenterFrustum();
1426
- }
1427
-
1428
- result.right = this.right;
1429
- result.left = this.left;
1430
- result.top = this.top;
1431
- result.bottom = this.bottom;
1432
- result.near = this.near;
1433
- result.far = this.far;
1434
-
1435
- // force update of clone to compute matrices
1436
- result._left = undefined;
1437
- result._right = undefined;
1438
- result._top = undefined;
1439
- result._bottom = undefined;
1440
- result._near = undefined;
1441
- result._far = undefined;
1442
-
1443
- return result;
1444
- };
1445
-
1446
- /**
1447
- * Compares the provided PerspectiveOffCenterFrustum componentwise and returns
1448
- * <code>true</code> if they are equal, <code>false</code> otherwise.
1449
- *
1450
- * @param {PerspectiveOffCenterFrustum} [other] The right hand side PerspectiveOffCenterFrustum.
1451
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
1452
- */
1453
- PerspectiveOffCenterFrustum.prototype.equals = function (other) {
1454
- return (
1455
- defaultValue.defined(other) &&
1456
- other instanceof PerspectiveOffCenterFrustum &&
1457
- this.right === other.right &&
1458
- this.left === other.left &&
1459
- this.top === other.top &&
1460
- this.bottom === other.bottom &&
1461
- this.near === other.near &&
1462
- this.far === other.far
1463
- );
1464
- };
1465
-
1466
- /**
1467
- * Compares the provided PerspectiveOffCenterFrustum componentwise and returns
1468
- * <code>true</code> if they pass an absolute or relative tolerance test,
1469
- * <code>false</code> otherwise.
1470
- *
1471
- * @param {PerspectiveOffCenterFrustum} other The right hand side PerspectiveOffCenterFrustum.
1472
- * @param {number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
1473
- * @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
1474
- * @returns {boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
1475
- */
1476
- PerspectiveOffCenterFrustum.prototype.equalsEpsilon = function (
1477
- other,
1478
- relativeEpsilon,
1479
- absoluteEpsilon
1480
- ) {
1481
- return (
1482
- other === this ||
1483
- (defaultValue.defined(other) &&
1484
- other instanceof PerspectiveOffCenterFrustum &&
1485
- Math$1.CesiumMath.equalsEpsilon(
1486
- this.right,
1487
- other.right,
1488
- relativeEpsilon,
1489
- absoluteEpsilon
1490
- ) &&
1491
- Math$1.CesiumMath.equalsEpsilon(
1492
- this.left,
1493
- other.left,
1494
- relativeEpsilon,
1495
- absoluteEpsilon
1496
- ) &&
1497
- Math$1.CesiumMath.equalsEpsilon(
1498
- this.top,
1499
- other.top,
1500
- relativeEpsilon,
1501
- absoluteEpsilon
1502
- ) &&
1503
- Math$1.CesiumMath.equalsEpsilon(
1504
- this.bottom,
1505
- other.bottom,
1506
- relativeEpsilon,
1507
- absoluteEpsilon
1508
- ) &&
1509
- Math$1.CesiumMath.equalsEpsilon(
1510
- this.near,
1511
- other.near,
1512
- relativeEpsilon,
1513
- absoluteEpsilon
1514
- ) &&
1515
- Math$1.CesiumMath.equalsEpsilon(
1516
- this.far,
1517
- other.far,
1518
- relativeEpsilon,
1519
- absoluteEpsilon
1520
- ))
1521
- );
1522
- };
1523
-
1524
- /**
1525
- * The viewing frustum is defined by 6 planes.
1526
- * Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
1527
- * define the unit vector normal to the plane, and the w component is the distance of the
1528
- * plane from the origin/camera position.
1529
- *
1530
- * @alias PerspectiveFrustum
1531
- * @constructor
1532
- *
1533
- * @param {object} [options] An object with the following properties:
1534
- * @param {number} [options.fov] The angle of the field of view (FOV), in radians.
1535
- * @param {number} [options.aspectRatio] The aspect ratio of the frustum's width to it's height.
1536
- * @param {number} [options.near=1.0] The distance of the near plane.
1537
- * @param {number} [options.far=500000000.0] The distance of the far plane.
1538
- * @param {number} [options.xOffset=0.0] The offset in the x direction.
1539
- * @param {number} [options.yOffset=0.0] The offset in the y direction.
1540
- *
1541
- * @example
1542
- * const frustum = new Cesium.PerspectiveFrustum({
1543
- * fov : Cesium.Math.PI_OVER_THREE,
1544
- * aspectRatio : canvas.clientWidth / canvas.clientHeight
1545
- * near : 1.0,
1546
- * far : 1000.0
1547
- * });
1548
- *
1549
- * @see PerspectiveOffCenterFrustum
1550
- */
1551
- function PerspectiveFrustum(options) {
1552
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
1553
-
1554
- this._offCenterFrustum = new PerspectiveOffCenterFrustum();
1555
-
1556
- /**
1557
- * The angle of the field of view (FOV), in radians. This angle will be used
1558
- * as the horizontal FOV if the width is greater than the height, otherwise
1559
- * it will be the vertical FOV.
1560
- * @type {number}
1561
- * @default undefined
1562
- */
1563
- this.fov = options.fov;
1564
- this._fov = undefined;
1565
- this._fovy = undefined;
1566
-
1567
- this._sseDenominator = undefined;
1568
-
1569
- /**
1570
- * The aspect ratio of the frustum's width to it's height.
1571
- * @type {number}
1572
- * @default undefined
1573
- */
1574
- this.aspectRatio = options.aspectRatio;
1575
- this._aspectRatio = undefined;
1576
-
1577
- /**
1578
- * The distance of the near plane.
1579
- * @type {number}
1580
- * @default 1.0
1581
- */
1582
- this.near = defaultValue.defaultValue(options.near, 1.0);
1583
- this._near = this.near;
1584
-
1585
- /**
1586
- * The distance of the far plane.
1587
- * @type {number}
1588
- * @default 500000000.0
1589
- */
1590
- this.far = defaultValue.defaultValue(options.far, 500000000.0);
1591
- this._far = this.far;
1592
-
1593
- /**
1594
- * Offsets the frustum in the x direction.
1595
- * @type {number}
1596
- * @default 0.0
1597
- */
1598
- this.xOffset = defaultValue.defaultValue(options.xOffset, 0.0);
1599
- this._xOffset = this.xOffset;
1600
-
1601
- /**
1602
- * Offsets the frustum in the y direction.
1603
- * @type {number}
1604
- * @default 0.0
1605
- */
1606
- this.yOffset = defaultValue.defaultValue(options.yOffset, 0.0);
1607
- this._yOffset = this.yOffset;
1608
- }
1609
-
1610
- /**
1611
- * The number of elements used to pack the object into an array.
1612
- * @type {number}
1613
- */
1614
- PerspectiveFrustum.packedLength = 6;
1615
-
1616
- /**
1617
- * Stores the provided instance into the provided array.
1618
- *
1619
- * @param {PerspectiveFrustum} value The value to pack.
1620
- * @param {number[]} array The array to pack into.
1621
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
1622
- *
1623
- * @returns {number[]} The array that was packed into
1624
- */
1625
- PerspectiveFrustum.pack = function (value, array, startingIndex) {
1626
- //>>includeStart('debug', pragmas.debug);
1627
- Check.Check.typeOf.object("value", value);
1628
- Check.Check.defined("array", array);
1629
- //>>includeEnd('debug');
1630
-
1631
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
1632
-
1633
- array[startingIndex++] = value.fov;
1634
- array[startingIndex++] = value.aspectRatio;
1635
- array[startingIndex++] = value.near;
1636
- array[startingIndex++] = value.far;
1637
- array[startingIndex++] = value.xOffset;
1638
- array[startingIndex] = value.yOffset;
1639
-
1640
- return array;
1641
- };
1642
-
1643
- /**
1644
- * Retrieves an instance from a packed array.
1645
- *
1646
- * @param {number[]} array The packed array.
1647
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
1648
- * @param {PerspectiveFrustum} [result] The object into which to store the result.
1649
- * @returns {PerspectiveFrustum} The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
1650
- */
1651
- PerspectiveFrustum.unpack = function (array, startingIndex, result) {
1652
- //>>includeStart('debug', pragmas.debug);
1653
- Check.Check.defined("array", array);
1654
- //>>includeEnd('debug');
1655
-
1656
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
1657
-
1658
- if (!defaultValue.defined(result)) {
1659
- result = new PerspectiveFrustum();
1660
- }
1661
-
1662
- result.fov = array[startingIndex++];
1663
- result.aspectRatio = array[startingIndex++];
1664
- result.near = array[startingIndex++];
1665
- result.far = array[startingIndex++];
1666
- result.xOffset = array[startingIndex++];
1667
- result.yOffset = array[startingIndex];
1668
-
1669
- return result;
1670
- };
1671
-
1672
- function update(frustum) {
1673
- //>>includeStart('debug', pragmas.debug);
1674
- if (
1675
- !defaultValue.defined(frustum.fov) ||
1676
- !defaultValue.defined(frustum.aspectRatio) ||
1677
- !defaultValue.defined(frustum.near) ||
1678
- !defaultValue.defined(frustum.far)
1679
- ) {
1680
- throw new Check.DeveloperError(
1681
- "fov, aspectRatio, near, or far parameters are not set."
1682
- );
1683
- }
1684
- //>>includeEnd('debug');
1685
-
1686
- const f = frustum._offCenterFrustum;
1687
-
1688
- if (
1689
- frustum.fov !== frustum._fov ||
1690
- frustum.aspectRatio !== frustum._aspectRatio ||
1691
- frustum.near !== frustum._near ||
1692
- frustum.far !== frustum._far ||
1693
- frustum.xOffset !== frustum._xOffset ||
1694
- frustum.yOffset !== frustum._yOffset
1695
- ) {
1696
- //>>includeStart('debug', pragmas.debug);
1697
- if (frustum.fov < 0 || frustum.fov >= Math.PI) {
1698
- throw new Check.DeveloperError("fov must be in the range [0, PI).");
1699
- }
1700
-
1701
- if (frustum.aspectRatio < 0) {
1702
- throw new Check.DeveloperError("aspectRatio must be positive.");
1703
- }
1704
-
1705
- if (frustum.near < 0 || frustum.near > frustum.far) {
1706
- throw new Check.DeveloperError(
1707
- "near must be greater than zero and less than far."
1708
- );
1709
- }
1710
- //>>includeEnd('debug');
1711
-
1712
- frustum._aspectRatio = frustum.aspectRatio;
1713
- frustum._fov = frustum.fov;
1714
- frustum._fovy =
1715
- frustum.aspectRatio <= 1
1716
- ? frustum.fov
1717
- : Math.atan(Math.tan(frustum.fov * 0.5) / frustum.aspectRatio) * 2.0;
1718
- frustum._near = frustum.near;
1719
- frustum._far = frustum.far;
1720
- frustum._sseDenominator = 2.0 * Math.tan(0.5 * frustum._fovy);
1721
- frustum._xOffset = frustum.xOffset;
1722
- frustum._yOffset = frustum.yOffset;
1723
-
1724
- f.top = frustum.near * Math.tan(0.5 * frustum._fovy);
1725
- f.bottom = -f.top;
1726
- f.right = frustum.aspectRatio * f.top;
1727
- f.left = -f.right;
1728
- f.near = frustum.near;
1729
- f.far = frustum.far;
1730
-
1731
- f.right += frustum.xOffset;
1732
- f.left += frustum.xOffset;
1733
- f.top += frustum.yOffset;
1734
- f.bottom += frustum.yOffset;
1735
- }
1736
- }
1737
-
1738
- Object.defineProperties(PerspectiveFrustum.prototype, {
1739
- /**
1740
- * Gets the perspective projection matrix computed from the view frustum.
1741
- * @memberof PerspectiveFrustum.prototype
1742
- * @type {Matrix4}
1743
- * @readonly
1744
- *
1745
- * @see PerspectiveFrustum#infiniteProjectionMatrix
1746
- */
1747
- projectionMatrix: {
1748
- get: function () {
1749
- update(this);
1750
- return this._offCenterFrustum.projectionMatrix;
1751
- },
1752
- },
1753
-
1754
- /**
1755
- * The perspective projection matrix computed from the view frustum with an infinite far plane.
1756
- * @memberof PerspectiveFrustum.prototype
1757
- * @type {Matrix4}
1758
- * @readonly
1759
- *
1760
- * @see PerspectiveFrustum#projectionMatrix
1761
- */
1762
- infiniteProjectionMatrix: {
1763
- get: function () {
1764
- update(this);
1765
- return this._offCenterFrustum.infiniteProjectionMatrix;
1766
- },
1767
- },
1768
-
1769
- /**
1770
- * Gets the angle of the vertical field of view, in radians.
1771
- * @memberof PerspectiveFrustum.prototype
1772
- * @type {number}
1773
- * @readonly
1774
- * @default undefined
1775
- */
1776
- fovy: {
1777
- get: function () {
1778
- update(this);
1779
- return this._fovy;
1780
- },
1781
- },
1782
-
1783
- /**
1784
- * @readonly
1785
- * @private
1786
- */
1787
- sseDenominator: {
1788
- get: function () {
1789
- update(this);
1790
- return this._sseDenominator;
1791
- },
1792
- },
1793
-
1794
- /**
1795
- * Gets the orthographic projection matrix computed from the view frustum.
1796
- * @memberof PerspectiveFrustum.prototype
1797
- * @type {PerspectiveOffCenterFrustum}
1798
- * @readonly
1799
- * @private
1800
- */
1801
- offCenterFrustum: {
1802
- get: function () {
1803
- update(this);
1804
- return this._offCenterFrustum;
1805
- },
1806
- },
1807
- });
1808
-
1809
- /**
1810
- * Creates a culling volume for this frustum.
1811
- *
1812
- * @param {Cartesian3} position The eye position.
1813
- * @param {Cartesian3} direction The view direction.
1814
- * @param {Cartesian3} up The up direction.
1815
- * @returns {CullingVolume} A culling volume at the given position and orientation.
1816
- *
1817
- * @example
1818
- * // Check if a bounding volume intersects the frustum.
1819
- * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
1820
- * const intersect = cullingVolume.computeVisibility(boundingVolume);
1821
- */
1822
- PerspectiveFrustum.prototype.computeCullingVolume = function (
1823
- position,
1824
- direction,
1825
- up
1826
- ) {
1827
- update(this);
1828
- return this._offCenterFrustum.computeCullingVolume(position, direction, up);
1829
- };
1830
-
1831
- /**
1832
- * Returns the pixel's width and height in meters.
1833
- *
1834
- * @param {number} drawingBufferWidth The width of the drawing buffer.
1835
- * @param {number} drawingBufferHeight The height of the drawing buffer.
1836
- * @param {number} distance The distance to the near plane in meters.
1837
- * @param {number} pixelRatio The scaling factor from pixel space to coordinate space.
1838
- * @param {Cartesian2} result The object onto which to store the result.
1839
- * @returns {Cartesian2} The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
1840
- *
1841
- * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
1842
- * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
1843
- * @exception {DeveloperError} pixelRatio must be greater than zero.
1844
- *
1845
- * @example
1846
- * // Example 1
1847
- * // Get the width and height of a pixel.
1848
- * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2());
1849
- *
1850
- * @example
1851
- * // Example 2
1852
- * // Get the width and height of a pixel if the near plane was set to 'distance'.
1853
- * // For example, get the size of a pixel of an image on a billboard.
1854
- * const position = camera.position;
1855
- * const direction = camera.direction;
1856
- * const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive
1857
- * const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
1858
- * const distance = Cesium.Cartesian3.magnitude(toCenterProj);
1859
- * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());
1860
- */
1861
- PerspectiveFrustum.prototype.getPixelDimensions = function (
1862
- drawingBufferWidth,
1863
- drawingBufferHeight,
1864
- distance,
1865
- pixelRatio,
1866
- result
1867
- ) {
1868
- update(this);
1869
- return this._offCenterFrustum.getPixelDimensions(
1870
- drawingBufferWidth,
1871
- drawingBufferHeight,
1872
- distance,
1873
- pixelRatio,
1874
- result
1875
- );
1876
- };
1877
-
1878
- /**
1879
- * Returns a duplicate of a PerspectiveFrustum instance.
1880
- *
1881
- * @param {PerspectiveFrustum} [result] The object onto which to store the result.
1882
- * @returns {PerspectiveFrustum} The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
1883
- */
1884
- PerspectiveFrustum.prototype.clone = function (result) {
1885
- if (!defaultValue.defined(result)) {
1886
- result = new PerspectiveFrustum();
1887
- }
1888
-
1889
- result.aspectRatio = this.aspectRatio;
1890
- result.fov = this.fov;
1891
- result.near = this.near;
1892
- result.far = this.far;
1893
-
1894
- // force update of clone to compute matrices
1895
- result._aspectRatio = undefined;
1896
- result._fov = undefined;
1897
- result._near = undefined;
1898
- result._far = undefined;
1899
-
1900
- this._offCenterFrustum.clone(result._offCenterFrustum);
1901
-
1902
- return result;
1903
- };
1904
-
1905
- /**
1906
- * Compares the provided PerspectiveFrustum componentwise and returns
1907
- * <code>true</code> if they are equal, <code>false</code> otherwise.
1908
- *
1909
- * @param {PerspectiveFrustum} [other] The right hand side PerspectiveFrustum.
1910
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
1911
- */
1912
- PerspectiveFrustum.prototype.equals = function (other) {
1913
- if (!defaultValue.defined(other) || !(other instanceof PerspectiveFrustum)) {
1914
- return false;
1915
- }
1916
-
1917
- update(this);
1918
- update(other);
1919
-
1920
- return (
1921
- this.fov === other.fov &&
1922
- this.aspectRatio === other.aspectRatio &&
1923
- this._offCenterFrustum.equals(other._offCenterFrustum)
1924
- );
1925
- };
1926
-
1927
- /**
1928
- * Compares the provided PerspectiveFrustum componentwise and returns
1929
- * <code>true</code> if they pass an absolute or relative tolerance test,
1930
- * <code>false</code> otherwise.
1931
- *
1932
- * @param {PerspectiveFrustum} other The right hand side PerspectiveFrustum.
1933
- * @param {number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
1934
- * @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
1935
- * @returns {boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
1936
- */
1937
- PerspectiveFrustum.prototype.equalsEpsilon = function (
1938
- other,
1939
- relativeEpsilon,
1940
- absoluteEpsilon
1941
- ) {
1942
- if (!defaultValue.defined(other) || !(other instanceof PerspectiveFrustum)) {
1943
- return false;
1944
- }
1945
-
1946
- update(this);
1947
- update(other);
1948
-
1949
- return (
1950
- Math$1.CesiumMath.equalsEpsilon(
1951
- this.fov,
1952
- other.fov,
1953
- relativeEpsilon,
1954
- absoluteEpsilon
1955
- ) &&
1956
- Math$1.CesiumMath.equalsEpsilon(
1957
- this.aspectRatio,
1958
- other.aspectRatio,
1959
- relativeEpsilon,
1960
- absoluteEpsilon
1961
- ) &&
1962
- this._offCenterFrustum.equalsEpsilon(
1963
- other._offCenterFrustum,
1964
- relativeEpsilon,
1965
- absoluteEpsilon
1966
- )
1967
- );
1968
- };
1969
-
1970
- const PERSPECTIVE = 0;
1971
- const ORTHOGRAPHIC = 1;
1972
-
1973
- /**
1974
- * Describes a frustum at the given the origin and orientation.
1975
- *
1976
- * @alias FrustumGeometry
1977
- * @constructor
1978
- *
1979
- * @param {object} options Object with the following properties:
1980
- * @param {PerspectiveFrustum|OrthographicFrustum} options.frustum The frustum.
1981
- * @param {Cartesian3} options.origin The origin of the frustum.
1982
- * @param {Quaternion} options.orientation The orientation of the frustum.
1983
- * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
1984
- */
1985
- function FrustumGeometry(options) {
1986
- //>>includeStart('debug', pragmas.debug);
1987
- Check.Check.typeOf.object("options", options);
1988
- Check.Check.typeOf.object("options.frustum", options.frustum);
1989
- Check.Check.typeOf.object("options.origin", options.origin);
1990
- Check.Check.typeOf.object("options.orientation", options.orientation);
1991
- //>>includeEnd('debug');
1992
-
1993
- const frustum = options.frustum;
1994
- const orientation = options.orientation;
1995
- const origin = options.origin;
1996
- const vertexFormat = defaultValue.defaultValue(options.vertexFormat, VertexFormat.VertexFormat.DEFAULT);
1997
-
1998
- // This is private because it is used by DebugCameraPrimitive to draw a multi-frustum by
1999
- // creating multiple FrustumGeometrys. This way the near plane of one frustum doesn't overlap
2000
- // the far plane of another.
2001
- const drawNearPlane = defaultValue.defaultValue(options._drawNearPlane, true);
2002
-
2003
- let frustumType;
2004
- let frustumPackedLength;
2005
- if (frustum instanceof PerspectiveFrustum) {
2006
- frustumType = PERSPECTIVE;
2007
- frustumPackedLength = PerspectiveFrustum.packedLength;
2008
- } else if (frustum instanceof OrthographicFrustum) {
2009
- frustumType = ORTHOGRAPHIC;
2010
- frustumPackedLength = OrthographicFrustum.packedLength;
2011
- }
2012
-
2013
- this._frustumType = frustumType;
2014
- this._frustum = frustum.clone();
2015
- this._origin = Matrix3.Cartesian3.clone(origin);
2016
- this._orientation = Transforms.Quaternion.clone(orientation);
2017
- this._drawNearPlane = drawNearPlane;
2018
- this._vertexFormat = vertexFormat;
2019
- this._workerName = "createFrustumGeometry";
2020
-
2021
- /**
2022
- * The number of elements used to pack the object into an array.
2023
- * @type {number}
2024
- */
2025
- this.packedLength =
2026
- 2 +
2027
- frustumPackedLength +
2028
- Matrix3.Cartesian3.packedLength +
2029
- Transforms.Quaternion.packedLength +
2030
- VertexFormat.VertexFormat.packedLength;
2031
- }
2032
-
2033
- /**
2034
- * Stores the provided instance into the provided array.
2035
- *
2036
- * @param {FrustumGeometry} value The value to pack.
2037
- * @param {number[]} array The array to pack into.
2038
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
2039
- *
2040
- * @returns {number[]} The array that was packed into
2041
- */
2042
- FrustumGeometry.pack = function (value, array, startingIndex) {
2043
- //>>includeStart('debug', pragmas.debug);
2044
- Check.Check.typeOf.object("value", value);
2045
- Check.Check.defined("array", array);
2046
- //>>includeEnd('debug');
2047
-
2048
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
2049
-
2050
- const frustumType = value._frustumType;
2051
- const frustum = value._frustum;
2052
-
2053
- array[startingIndex++] = frustumType;
2054
-
2055
- if (frustumType === PERSPECTIVE) {
2056
- PerspectiveFrustum.pack(frustum, array, startingIndex);
2057
- startingIndex += PerspectiveFrustum.packedLength;
2058
- } else {
2059
- OrthographicFrustum.pack(frustum, array, startingIndex);
2060
- startingIndex += OrthographicFrustum.packedLength;
2061
- }
2062
-
2063
- Matrix3.Cartesian3.pack(value._origin, array, startingIndex);
2064
- startingIndex += Matrix3.Cartesian3.packedLength;
2065
- Transforms.Quaternion.pack(value._orientation, array, startingIndex);
2066
- startingIndex += Transforms.Quaternion.packedLength;
2067
- VertexFormat.VertexFormat.pack(value._vertexFormat, array, startingIndex);
2068
- startingIndex += VertexFormat.VertexFormat.packedLength;
2069
- array[startingIndex] = value._drawNearPlane ? 1.0 : 0.0;
2070
-
2071
- return array;
2072
- };
2073
-
2074
- const scratchPackPerspective = new PerspectiveFrustum();
2075
- const scratchPackOrthographic = new OrthographicFrustum();
2076
- const scratchPackQuaternion = new Transforms.Quaternion();
2077
- const scratchPackorigin = new Matrix3.Cartesian3();
2078
- const scratchVertexFormat = new VertexFormat.VertexFormat();
2079
-
2080
- /**
2081
- * Retrieves an instance from a packed array.
2082
- *
2083
- * @param {number[]} array The packed array.
2084
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
2085
- * @param {FrustumGeometry} [result] The object into which to store the result.
2086
- */
2087
- FrustumGeometry.unpack = function (array, startingIndex, result) {
2088
- //>>includeStart('debug', pragmas.debug);
2089
- Check.Check.defined("array", array);
2090
- //>>includeEnd('debug');
2091
-
2092
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
2093
-
2094
- const frustumType = array[startingIndex++];
2095
-
2096
- let frustum;
2097
- if (frustumType === PERSPECTIVE) {
2098
- frustum = PerspectiveFrustum.unpack(
2099
- array,
2100
- startingIndex,
2101
- scratchPackPerspective
2102
- );
2103
- startingIndex += PerspectiveFrustum.packedLength;
2104
- } else {
2105
- frustum = OrthographicFrustum.unpack(
2106
- array,
2107
- startingIndex,
2108
- scratchPackOrthographic
2109
- );
2110
- startingIndex += OrthographicFrustum.packedLength;
2111
- }
2112
-
2113
- const origin = Matrix3.Cartesian3.unpack(array, startingIndex, scratchPackorigin);
2114
- startingIndex += Matrix3.Cartesian3.packedLength;
2115
- const orientation = Transforms.Quaternion.unpack(
2116
- array,
2117
- startingIndex,
2118
- scratchPackQuaternion
2119
- );
2120
- startingIndex += Transforms.Quaternion.packedLength;
2121
- const vertexFormat = VertexFormat.VertexFormat.unpack(
2122
- array,
2123
- startingIndex,
2124
- scratchVertexFormat
2125
- );
2126
- startingIndex += VertexFormat.VertexFormat.packedLength;
2127
- const drawNearPlane = array[startingIndex] === 1.0;
2128
-
2129
- if (!defaultValue.defined(result)) {
2130
- return new FrustumGeometry({
2131
- frustum: frustum,
2132
- origin: origin,
2133
- orientation: orientation,
2134
- vertexFormat: vertexFormat,
2135
- _drawNearPlane: drawNearPlane,
2136
- });
2137
- }
2138
-
2139
- const frustumResult =
2140
- frustumType === result._frustumType ? result._frustum : undefined;
2141
- result._frustum = frustum.clone(frustumResult);
2142
-
2143
- result._frustumType = frustumType;
2144
- result._origin = Matrix3.Cartesian3.clone(origin, result._origin);
2145
- result._orientation = Transforms.Quaternion.clone(orientation, result._orientation);
2146
- result._vertexFormat = VertexFormat.VertexFormat.clone(vertexFormat, result._vertexFormat);
2147
- result._drawNearPlane = drawNearPlane;
2148
-
2149
- return result;
2150
- };
2151
-
2152
- function getAttributes(
2153
- offset,
2154
- normals,
2155
- tangents,
2156
- bitangents,
2157
- st,
2158
- normal,
2159
- tangent,
2160
- bitangent
2161
- ) {
2162
- const stOffset = (offset / 3) * 2;
2163
-
2164
- for (let i = 0; i < 4; ++i) {
2165
- if (defaultValue.defined(normals)) {
2166
- normals[offset] = normal.x;
2167
- normals[offset + 1] = normal.y;
2168
- normals[offset + 2] = normal.z;
2169
- }
2170
- if (defaultValue.defined(tangents)) {
2171
- tangents[offset] = tangent.x;
2172
- tangents[offset + 1] = tangent.y;
2173
- tangents[offset + 2] = tangent.z;
2174
- }
2175
- if (defaultValue.defined(bitangents)) {
2176
- bitangents[offset] = bitangent.x;
2177
- bitangents[offset + 1] = bitangent.y;
2178
- bitangents[offset + 2] = bitangent.z;
2179
- }
2180
- offset += 3;
2181
- }
2182
-
2183
- st[stOffset] = 0.0;
2184
- st[stOffset + 1] = 0.0;
2185
- st[stOffset + 2] = 1.0;
2186
- st[stOffset + 3] = 0.0;
2187
- st[stOffset + 4] = 1.0;
2188
- st[stOffset + 5] = 1.0;
2189
- st[stOffset + 6] = 0.0;
2190
- st[stOffset + 7] = 1.0;
2191
- }
2192
-
2193
- const scratchRotationMatrix = new Matrix3.Matrix3();
2194
- const scratchViewMatrix = new Matrix2.Matrix4();
2195
- const scratchInverseMatrix = new Matrix2.Matrix4();
2196
-
2197
- const scratchXDirection = new Matrix3.Cartesian3();
2198
- const scratchYDirection = new Matrix3.Cartesian3();
2199
- const scratchZDirection = new Matrix3.Cartesian3();
2200
- const scratchNegativeX = new Matrix3.Cartesian3();
2201
- const scratchNegativeY = new Matrix3.Cartesian3();
2202
- const scratchNegativeZ = new Matrix3.Cartesian3();
2203
-
2204
- const frustumSplits = new Array(3);
2205
-
2206
- const frustumCornersNDC = new Array(4);
2207
- frustumCornersNDC[0] = new Matrix2.Cartesian4(-1.0, -1.0, 1.0, 1.0);
2208
- frustumCornersNDC[1] = new Matrix2.Cartesian4(1.0, -1.0, 1.0, 1.0);
2209
- frustumCornersNDC[2] = new Matrix2.Cartesian4(1.0, 1.0, 1.0, 1.0);
2210
- frustumCornersNDC[3] = new Matrix2.Cartesian4(-1.0, 1.0, 1.0, 1.0);
2211
-
2212
- const scratchFrustumCorners = new Array(4);
2213
- for (let i = 0; i < 4; ++i) {
2214
- scratchFrustumCorners[i] = new Matrix2.Cartesian4();
2215
- }
2216
-
2217
- FrustumGeometry._computeNearFarPlanes = function (
2218
- origin,
2219
- orientation,
2220
- frustumType,
2221
- frustum,
2222
- positions,
2223
- xDirection,
2224
- yDirection,
2225
- zDirection
2226
- ) {
2227
- const rotationMatrix = Matrix3.Matrix3.fromQuaternion(
2228
- orientation,
2229
- scratchRotationMatrix
2230
- );
2231
- let x = defaultValue.defaultValue(xDirection, scratchXDirection);
2232
- let y = defaultValue.defaultValue(yDirection, scratchYDirection);
2233
- let z = defaultValue.defaultValue(zDirection, scratchZDirection);
2234
-
2235
- x = Matrix3.Matrix3.getColumn(rotationMatrix, 0, x);
2236
- y = Matrix3.Matrix3.getColumn(rotationMatrix, 1, y);
2237
- z = Matrix3.Matrix3.getColumn(rotationMatrix, 2, z);
2238
-
2239
- Matrix3.Cartesian3.normalize(x, x);
2240
- Matrix3.Cartesian3.normalize(y, y);
2241
- Matrix3.Cartesian3.normalize(z, z);
2242
-
2243
- Matrix3.Cartesian3.negate(x, x);
2244
-
2245
- const view = Matrix2.Matrix4.computeView(origin, z, y, x, scratchViewMatrix);
2246
-
2247
- let inverseView;
2248
- let inverseViewProjection;
2249
- const projection = frustum.projectionMatrix;
2250
- if (frustumType === PERSPECTIVE) {
2251
- const viewProjection = Matrix2.Matrix4.multiply(
2252
- projection,
2253
- view,
2254
- scratchInverseMatrix
2255
- );
2256
- inverseViewProjection = Matrix2.Matrix4.inverse(
2257
- viewProjection,
2258
- scratchInverseMatrix
2259
- );
2260
- } else {
2261
- inverseView = Matrix2.Matrix4.inverseTransformation(view, scratchInverseMatrix);
2262
- }
2263
-
2264
- if (defaultValue.defined(inverseViewProjection)) {
2265
- frustumSplits[0] = frustum.near;
2266
- frustumSplits[1] = frustum.far;
2267
- } else {
2268
- frustumSplits[0] = 0.0;
2269
- frustumSplits[1] = frustum.near;
2270
- frustumSplits[2] = frustum.far;
2271
- }
2272
-
2273
- for (let i = 0; i < 2; ++i) {
2274
- for (let j = 0; j < 4; ++j) {
2275
- let corner = Matrix2.Cartesian4.clone(
2276
- frustumCornersNDC[j],
2277
- scratchFrustumCorners[j]
2278
- );
2279
-
2280
- if (!defaultValue.defined(inverseViewProjection)) {
2281
- const offCenterFrustum = frustum.offCenterFrustum;
2282
- if (defaultValue.defined(offCenterFrustum)) {
2283
- frustum = offCenterFrustum;
2284
- }
2285
-
2286
- const near = frustumSplits[i];
2287
- const far = frustumSplits[i + 1];
2288
-
2289
- corner.x =
2290
- (corner.x * (frustum.right - frustum.left) +
2291
- frustum.left +
2292
- frustum.right) *
2293
- 0.5;
2294
- corner.y =
2295
- (corner.y * (frustum.top - frustum.bottom) +
2296
- frustum.bottom +
2297
- frustum.top) *
2298
- 0.5;
2299
- corner.z = (corner.z * (near - far) - near - far) * 0.5;
2300
- corner.w = 1.0;
2301
-
2302
- Matrix2.Matrix4.multiplyByVector(inverseView, corner, corner);
2303
- } else {
2304
- corner = Matrix2.Matrix4.multiplyByVector(
2305
- inverseViewProjection,
2306
- corner,
2307
- corner
2308
- );
2309
-
2310
- // Reverse perspective divide
2311
- const w = 1.0 / corner.w;
2312
- Matrix3.Cartesian3.multiplyByScalar(corner, w, corner);
2313
-
2314
- Matrix3.Cartesian3.subtract(corner, origin, corner);
2315
- Matrix3.Cartesian3.normalize(corner, corner);
2316
-
2317
- const fac = Matrix3.Cartesian3.dot(z, corner);
2318
- Matrix3.Cartesian3.multiplyByScalar(corner, frustumSplits[i] / fac, corner);
2319
- Matrix3.Cartesian3.add(corner, origin, corner);
2320
- }
2321
-
2322
- positions[12 * i + j * 3] = corner.x;
2323
- positions[12 * i + j * 3 + 1] = corner.y;
2324
- positions[12 * i + j * 3 + 2] = corner.z;
2325
- }
2326
- }
2327
- };
2328
-
2329
- /**
2330
- * Computes the geometric representation of a frustum, including its vertices, indices, and a bounding sphere.
2331
- *
2332
- * @param {FrustumGeometry} frustumGeometry A description of the frustum.
2333
- * @returns {Geometry|undefined} The computed vertices and indices.
2334
- */
2335
- FrustumGeometry.createGeometry = function (frustumGeometry) {
2336
- const frustumType = frustumGeometry._frustumType;
2337
- const frustum = frustumGeometry._frustum;
2338
- const origin = frustumGeometry._origin;
2339
- const orientation = frustumGeometry._orientation;
2340
- const drawNearPlane = frustumGeometry._drawNearPlane;
2341
- const vertexFormat = frustumGeometry._vertexFormat;
2342
-
2343
- const numberOfPlanes = drawNearPlane ? 6 : 5;
2344
- let positions = new Float64Array(3 * 4 * 6);
2345
- FrustumGeometry._computeNearFarPlanes(
2346
- origin,
2347
- orientation,
2348
- frustumType,
2349
- frustum,
2350
- positions
2351
- );
2352
-
2353
- // -x plane
2354
- let offset = 3 * 4 * 2;
2355
- positions[offset] = positions[3 * 4];
2356
- positions[offset + 1] = positions[3 * 4 + 1];
2357
- positions[offset + 2] = positions[3 * 4 + 2];
2358
- positions[offset + 3] = positions[0];
2359
- positions[offset + 4] = positions[1];
2360
- positions[offset + 5] = positions[2];
2361
- positions[offset + 6] = positions[3 * 3];
2362
- positions[offset + 7] = positions[3 * 3 + 1];
2363
- positions[offset + 8] = positions[3 * 3 + 2];
2364
- positions[offset + 9] = positions[3 * 7];
2365
- positions[offset + 10] = positions[3 * 7 + 1];
2366
- positions[offset + 11] = positions[3 * 7 + 2];
2367
-
2368
- // -y plane
2369
- offset += 3 * 4;
2370
- positions[offset] = positions[3 * 5];
2371
- positions[offset + 1] = positions[3 * 5 + 1];
2372
- positions[offset + 2] = positions[3 * 5 + 2];
2373
- positions[offset + 3] = positions[3];
2374
- positions[offset + 4] = positions[3 + 1];
2375
- positions[offset + 5] = positions[3 + 2];
2376
- positions[offset + 6] = positions[0];
2377
- positions[offset + 7] = positions[1];
2378
- positions[offset + 8] = positions[2];
2379
- positions[offset + 9] = positions[3 * 4];
2380
- positions[offset + 10] = positions[3 * 4 + 1];
2381
- positions[offset + 11] = positions[3 * 4 + 2];
2382
-
2383
- // +x plane
2384
- offset += 3 * 4;
2385
- positions[offset] = positions[3];
2386
- positions[offset + 1] = positions[3 + 1];
2387
- positions[offset + 2] = positions[3 + 2];
2388
- positions[offset + 3] = positions[3 * 5];
2389
- positions[offset + 4] = positions[3 * 5 + 1];
2390
- positions[offset + 5] = positions[3 * 5 + 2];
2391
- positions[offset + 6] = positions[3 * 6];
2392
- positions[offset + 7] = positions[3 * 6 + 1];
2393
- positions[offset + 8] = positions[3 * 6 + 2];
2394
- positions[offset + 9] = positions[3 * 2];
2395
- positions[offset + 10] = positions[3 * 2 + 1];
2396
- positions[offset + 11] = positions[3 * 2 + 2];
2397
-
2398
- // +y plane
2399
- offset += 3 * 4;
2400
- positions[offset] = positions[3 * 2];
2401
- positions[offset + 1] = positions[3 * 2 + 1];
2402
- positions[offset + 2] = positions[3 * 2 + 2];
2403
- positions[offset + 3] = positions[3 * 6];
2404
- positions[offset + 4] = positions[3 * 6 + 1];
2405
- positions[offset + 5] = positions[3 * 6 + 2];
2406
- positions[offset + 6] = positions[3 * 7];
2407
- positions[offset + 7] = positions[3 * 7 + 1];
2408
- positions[offset + 8] = positions[3 * 7 + 2];
2409
- positions[offset + 9] = positions[3 * 3];
2410
- positions[offset + 10] = positions[3 * 3 + 1];
2411
- positions[offset + 11] = positions[3 * 3 + 2];
2412
-
2413
- if (!drawNearPlane) {
2414
- positions = positions.subarray(3 * 4);
2415
- }
2416
-
2417
- const attributes = new GeometryAttributes.GeometryAttributes({
2418
- position: new GeometryAttribute.GeometryAttribute({
2419
- componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
2420
- componentsPerAttribute: 3,
2421
- values: positions,
2422
- }),
2423
- });
2424
-
2425
- if (
2426
- defaultValue.defined(vertexFormat.normal) ||
2427
- defaultValue.defined(vertexFormat.tangent) ||
2428
- defaultValue.defined(vertexFormat.bitangent) ||
2429
- defaultValue.defined(vertexFormat.st)
2430
- ) {
2431
- const normals = defaultValue.defined(vertexFormat.normal)
2432
- ? new Float32Array(3 * 4 * numberOfPlanes)
2433
- : undefined;
2434
- const tangents = defaultValue.defined(vertexFormat.tangent)
2435
- ? new Float32Array(3 * 4 * numberOfPlanes)
2436
- : undefined;
2437
- const bitangents = defaultValue.defined(vertexFormat.bitangent)
2438
- ? new Float32Array(3 * 4 * numberOfPlanes)
2439
- : undefined;
2440
- const st = defaultValue.defined(vertexFormat.st)
2441
- ? new Float32Array(2 * 4 * numberOfPlanes)
2442
- : undefined;
2443
-
2444
- const x = scratchXDirection;
2445
- const y = scratchYDirection;
2446
- const z = scratchZDirection;
2447
-
2448
- const negativeX = Matrix3.Cartesian3.negate(x, scratchNegativeX);
2449
- const negativeY = Matrix3.Cartesian3.negate(y, scratchNegativeY);
2450
- const negativeZ = Matrix3.Cartesian3.negate(z, scratchNegativeZ);
2451
-
2452
- offset = 0;
2453
- if (drawNearPlane) {
2454
- getAttributes(offset, normals, tangents, bitangents, st, negativeZ, x, y); // near
2455
- offset += 3 * 4;
2456
- }
2457
- getAttributes(offset, normals, tangents, bitangents, st, z, negativeX, y); // far
2458
- offset += 3 * 4;
2459
- getAttributes(
2460
- offset,
2461
- normals,
2462
- tangents,
2463
- bitangents,
2464
- st,
2465
- negativeX,
2466
- negativeZ,
2467
- y
2468
- ); // -x
2469
- offset += 3 * 4;
2470
- getAttributes(
2471
- offset,
2472
- normals,
2473
- tangents,
2474
- bitangents,
2475
- st,
2476
- negativeY,
2477
- negativeZ,
2478
- negativeX
2479
- ); // -y
2480
- offset += 3 * 4;
2481
- getAttributes(offset, normals, tangents, bitangents, st, x, z, y); // +x
2482
- offset += 3 * 4;
2483
- getAttributes(offset, normals, tangents, bitangents, st, y, z, negativeX); // +y
2484
-
2485
- if (defaultValue.defined(normals)) {
2486
- attributes.normal = new GeometryAttribute.GeometryAttribute({
2487
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2488
- componentsPerAttribute: 3,
2489
- values: normals,
2490
- });
2491
- }
2492
- if (defaultValue.defined(tangents)) {
2493
- attributes.tangent = new GeometryAttribute.GeometryAttribute({
2494
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2495
- componentsPerAttribute: 3,
2496
- values: tangents,
2497
- });
2498
- }
2499
- if (defaultValue.defined(bitangents)) {
2500
- attributes.bitangent = new GeometryAttribute.GeometryAttribute({
2501
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2502
- componentsPerAttribute: 3,
2503
- values: bitangents,
2504
- });
2505
- }
2506
- if (defaultValue.defined(st)) {
2507
- attributes.st = new GeometryAttribute.GeometryAttribute({
2508
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2509
- componentsPerAttribute: 2,
2510
- values: st,
2511
- });
2512
- }
2513
- }
2514
-
2515
- const indices = new Uint16Array(6 * numberOfPlanes);
2516
- for (let i = 0; i < numberOfPlanes; ++i) {
2517
- const indexOffset = i * 6;
2518
- const index = i * 4;
2519
-
2520
- indices[indexOffset] = index;
2521
- indices[indexOffset + 1] = index + 1;
2522
- indices[indexOffset + 2] = index + 2;
2523
- indices[indexOffset + 3] = index;
2524
- indices[indexOffset + 4] = index + 2;
2525
- indices[indexOffset + 5] = index + 3;
2526
- }
2527
-
2528
- return new GeometryAttribute.Geometry({
2529
- attributes: attributes,
2530
- indices: indices,
2531
- primitiveType: GeometryAttribute.PrimitiveType.TRIANGLES,
2532
- boundingSphere: Transforms.BoundingSphere.fromVertices(positions),
2533
- });
2534
- };
2535
-
2536
- exports.FrustumGeometry = FrustumGeometry;
2537
- exports.OrthographicFrustum = OrthographicFrustum;
2538
- exports.PerspectiveFrustum = PerspectiveFrustum;
2539
-
2540
- }));