@vcmap/ui 5.0.0-rc.18 → 5.0.0-rc.20

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 (379) hide show
  1. package/README.md +6 -6
  2. package/build/build.js +2 -2
  3. package/build/buildCesium.js +3 -3
  4. package/build/buildHelpers.js +2 -1
  5. package/config/base.config.json +0 -4
  6. package/config/dev.config.json +35 -14
  7. package/config/www.config.json +4 -0
  8. package/dist/assets/cesium/Workers/ArcType-ce2e50ab.js +37 -0
  9. package/dist/assets/cesium/Workers/AttributeCompression-b646d393.js +716 -0
  10. package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-ff186ccc.js +258 -0
  11. package/dist/assets/cesium/Workers/BoundingRectangle-be5924f4.js +369 -0
  12. package/dist/assets/cesium/Workers/BoxGeometry-12eeccaf.js +884 -0
  13. package/dist/assets/cesium/Workers/Check-666ab1a0.js +290 -0
  14. package/dist/assets/cesium/Workers/Color-a84038cb.js +2262 -0
  15. package/dist/assets/cesium/Workers/ComponentDatatype-f7b11d02.js +341 -0
  16. package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-3272c1b3.js +132 -0
  17. package/dist/assets/cesium/Workers/CorridorGeometryLibrary-0170e093.js +498 -0
  18. package/dist/assets/cesium/Workers/CylinderGeometry-7c5da648.js +467 -0
  19. package/dist/assets/cesium/Workers/CylinderGeometryLibrary-372c07d8.js +63 -0
  20. package/dist/assets/cesium/Workers/EllipseGeometry-797d580e.js +1304 -0
  21. package/dist/assets/cesium/Workers/EllipseGeometryLibrary-2939e1dc.js +366 -0
  22. package/dist/assets/cesium/Workers/EllipseOutlineGeometry-8b50870f.js +443 -0
  23. package/dist/assets/cesium/Workers/EllipsoidGeodesic-98c62a56.js +520 -0
  24. package/dist/assets/cesium/Workers/EllipsoidGeometry-21c0e3a5.js +637 -0
  25. package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-eff247c8.js +454 -0
  26. package/dist/assets/cesium/Workers/EllipsoidRhumbLine-19756602.js +741 -0
  27. package/dist/assets/cesium/Workers/EllipsoidTangentPlane-214683dc.js +373 -0
  28. package/dist/assets/cesium/Workers/EncodedCartesian3-81f70735.js +171 -0
  29. package/dist/assets/cesium/Workers/FrustumGeometry-ac42a6d9.js +2512 -0
  30. package/dist/assets/cesium/Workers/GeometryAttribute-7d6f1732.js +619 -0
  31. package/dist/assets/cesium/Workers/GeometryAttributes-f06a2792.js +91 -0
  32. package/dist/assets/cesium/Workers/GeometryInstance-451dc1cd.js +121 -0
  33. package/dist/assets/cesium/Workers/GeometryOffsetAttribute-04332ce7.js +16 -0
  34. package/dist/assets/cesium/Workers/GeometryPipeline-ce4339ed.js +3690 -0
  35. package/dist/assets/cesium/Workers/IndexDatatype-a55ceaa1.js +200 -0
  36. package/dist/assets/cesium/Workers/IntersectionTests-f6e6bd8a.js +1836 -0
  37. package/dist/assets/cesium/Workers/Math-2dbd6b93.js +1330 -0
  38. package/dist/assets/cesium/Workers/Matrix2-13178034.js +7086 -0
  39. package/dist/assets/cesium/Workers/Matrix3-315394f6.js +4283 -0
  40. package/dist/assets/cesium/Workers/OrientedBoundingBox-04920dc7.js +1257 -0
  41. package/dist/assets/cesium/Workers/Plane-900aa728.js +309 -0
  42. package/dist/assets/cesium/Workers/PolygonGeometryLibrary-a8680d96.js +1074 -0
  43. package/dist/assets/cesium/Workers/PolygonPipeline-844aab0a.js +1345 -0
  44. package/dist/assets/cesium/Workers/PolylinePipeline-32f36d2a.js +573 -0
  45. package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-a510d657.js +781 -0
  46. package/dist/assets/cesium/Workers/PrimitivePipeline-ba38434a.js +966 -0
  47. package/dist/assets/cesium/Workers/RectangleGeometryLibrary-bdba697e.js +280 -0
  48. package/dist/assets/cesium/Workers/RuntimeError-06c93819.js +68 -0
  49. package/dist/assets/cesium/Workers/TerrainEncoding-833187da.js +1227 -0
  50. package/dist/assets/cesium/Workers/Transforms-40229881.js +14696 -0
  51. package/dist/assets/cesium/Workers/VertexFormat-6b480673.js +312 -0
  52. package/dist/assets/cesium/Workers/WallGeometryLibrary-919eed92.js +211 -0
  53. package/dist/assets/cesium/Workers/WebGLConstants-a8cc3e8c.js +620 -0
  54. package/dist/assets/cesium/Workers/WebMercatorProjection-13a90d41.js +151 -0
  55. package/dist/assets/cesium/Workers/arrayRemoveDuplicates-c2038105.js +129 -0
  56. package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +1336 -4
  57. package/dist/assets/cesium/Workers/combine-ca22a614.js +82 -0
  58. package/dist/assets/cesium/Workers/combineGeometry.js +17 -25
  59. package/dist/assets/cesium/Workers/createBoxGeometry.js +12 -25
  60. package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +313 -25
  61. package/dist/assets/cesium/Workers/createCircleGeometry.js +213 -25
  62. package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +160 -25
  63. package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +586 -25
  64. package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +236 -25
  65. package/dist/assets/cesium/Workers/createCorridorGeometry.js +1407 -25
  66. package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +603 -25
  67. package/dist/assets/cesium/Workers/createCylinderGeometry.js +12 -25
  68. package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +265 -25
  69. package/dist/assets/cesium/Workers/createEllipseGeometry.js +14 -25
  70. package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +14 -25
  71. package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +12 -25
  72. package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +15 -25
  73. package/dist/assets/cesium/Workers/createFrustumGeometry.js +12 -25
  74. package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +251 -25
  75. package/dist/assets/cesium/Workers/createGeometry.js +55 -25
  76. package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +2134 -25
  77. package/dist/assets/cesium/Workers/createPlaneGeometry.js +250 -25
  78. package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +115 -25
  79. package/dist/assets/cesium/Workers/createPolygonGeometry.js +1420 -25
  80. package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +683 -25
  81. package/dist/assets/cesium/Workers/createPolylineGeometry.js +571 -25
  82. package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +411 -25
  83. package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +301 -25
  84. package/dist/assets/cesium/Workers/createRectangleGeometry.js +1476 -25
  85. package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +535 -25
  86. package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +458 -25
  87. package/dist/assets/cesium/Workers/createSphereGeometry.js +123 -25
  88. package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +126 -25
  89. package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +127 -25
  90. package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +535 -25
  91. package/dist/assets/cesium/Workers/createVectorTileGeometries.js +445 -25
  92. package/dist/assets/cesium/Workers/createVectorTilePoints.js +79 -25
  93. package/dist/assets/cesium/Workers/createVectorTilePolygons.js +406 -25
  94. package/dist/assets/cesium/Workers/createVectorTilePolylines.js +254 -25
  95. package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +640 -25
  96. package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +2711 -27
  97. package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +994 -25
  98. package/dist/assets/cesium/Workers/createWallGeometry.js +623 -25
  99. package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +432 -25
  100. package/dist/assets/cesium/Workers/decodeDraco.js +381 -25
  101. package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +3687 -25
  102. package/dist/assets/cesium/Workers/decodeI3S.js +1040 -0
  103. package/dist/assets/cesium/Workers/defaultValue-0a909f67.js +51 -0
  104. package/dist/assets/cesium/Workers/package.js +2 -2
  105. package/dist/assets/cesium/Workers/transcodeKTX2.js +1516 -25
  106. package/dist/assets/cesium/Workers/transferTypedArrayTest.js +18 -2
  107. package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +1023 -25
  108. package/dist/assets/{cesium.2f992f.js → cesium.adbd45.js} +112161 -108735
  109. package/dist/assets/cesium.js +1 -1
  110. package/dist/assets/{core.cb0408.js → core.60e74d.js} +1616 -1629
  111. package/dist/assets/core.f198cf.js +15993 -0
  112. package/dist/assets/core.js +1 -1
  113. package/dist/assets/{index.bccdf969.js → index.884a53ef.js} +1 -1
  114. package/dist/assets/{ol.5e3fd0.js → ol.c6ff35.js} +6992 -6972
  115. package/dist/assets/ol.dbd604.js +44299 -0
  116. package/dist/assets/ol.js +1 -1
  117. package/dist/assets/ui.bf504d.css +1 -0
  118. package/dist/assets/{ui.08c48f.js → ui.bf504d.js} +6121 -6785
  119. package/dist/assets/ui.js +1 -1
  120. package/dist/assets/{vue.228ead.js → vue.75b819.js} +0 -0
  121. package/dist/assets/vue.a831f1.js +4675 -0
  122. package/dist/assets/vue.js +2 -2
  123. package/dist/assets/{vuetify.0b5039.css → vuetify.0d7360.css} +0 -0
  124. package/dist/assets/{vuetify.0b5039.js → vuetify.0d7360.js} +1 -1
  125. package/dist/assets/vuetify.js +2 -2
  126. package/dist/index.html +1 -1
  127. package/index.js +2 -1
  128. package/lib/cesium.js +1 -1
  129. package/package.json +3 -4
  130. package/plugins/{simple-graph → @vcmap/simple-graph}/README.md +1 -1
  131. package/plugins/{simple-graph → @vcmap/simple-graph}/SimpleGraphComponent.vue +0 -0
  132. package/plugins/{simple-graph → @vcmap/simple-graph}/index.js +0 -0
  133. package/plugins/{simple-graph → @vcmap/simple-graph}/package.json +0 -0
  134. package/plugins/{simple-graph → @vcmap/simple-graph}/simpleGraphView.js +0 -0
  135. package/plugins/@vcmap-show-case/README.md +20 -0
  136. package/plugins/{buttonExamples/ButtonExamples.vue → @vcmap-show-case/buttons-example/ButtonsExample.vue} +1 -1
  137. package/plugins/@vcmap-show-case/buttons-example/README.md +4 -0
  138. package/plugins/{buttonExamples → @vcmap-show-case/buttons-example}/index.js +16 -8
  139. package/plugins/@vcmap-show-case/buttons-example/package.json +5 -0
  140. package/plugins/{categoryTest → @vcmap-show-case/category-tester}/Categories.vue +7 -6
  141. package/plugins/{categoryTest → @vcmap-show-case/category-tester}/Category.vue +4 -3
  142. package/plugins/@vcmap-show-case/category-tester/README.md +3 -0
  143. package/plugins/{categoryTest → @vcmap-show-case/category-tester}/index.js +12 -4
  144. package/plugins/@vcmap-show-case/category-tester/package.json +5 -0
  145. package/plugins/@vcmap-show-case/config-editor/README.md +3 -0
  146. package/plugins/{test → @vcmap-show-case/config-editor}/editor.vue +0 -0
  147. package/plugins/@vcmap-show-case/config-editor/index.js +47 -0
  148. package/plugins/@vcmap-show-case/config-editor/package.json +5 -0
  149. package/plugins/@vcmap-show-case/context-menu-tester/README.md +3 -0
  150. package/plugins/@vcmap-show-case/context-menu-tester/index.js +33 -0
  151. package/plugins/@vcmap-show-case/context-menu-tester/package.json +5 -0
  152. package/plugins/{@vcmap/pluginExample/pluginExampleComponent.vue → @vcmap-show-case/form-inputs-example/FormInputsExample.vue} +14 -13
  153. package/plugins/@vcmap-show-case/form-inputs-example/README.md +4 -0
  154. package/plugins/@vcmap-show-case/form-inputs-example/config.json +5 -0
  155. package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/exampleActions.js +1 -1
  156. package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/index.js +23 -22
  157. package/plugins/@vcmap-show-case/form-inputs-example/package.json +5 -0
  158. package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/validation.js +0 -0
  159. package/plugins/@vcmap-show-case/icons-example/README.md +5 -0
  160. package/plugins/@vcmap-show-case/icons-example/allIconsComponent.vue +51 -0
  161. package/plugins/@vcmap-show-case/icons-example/index.js +44 -0
  162. package/plugins/@vcmap-show-case/icons-example/package.json +5 -0
  163. package/plugins/{test/testList.vue → @vcmap-show-case/list-example/ListExample.vue} +1 -1
  164. package/plugins/@vcmap-show-case/list-example/README.md +3 -0
  165. package/plugins/@vcmap-show-case/list-example/index.js +44 -0
  166. package/plugins/@vcmap-show-case/list-example/package.json +5 -0
  167. package/plugins/@vcmap-show-case/notifier-tester/README.md +3 -0
  168. package/plugins/{notifier → @vcmap-show-case/notifier-tester}/index.js +11 -6
  169. package/plugins/{notifier → @vcmap-show-case/notifier-tester}/notifierTester.vue +0 -0
  170. package/plugins/@vcmap-show-case/notifier-tester/package.json +5 -0
  171. package/plugins/@vcmap-show-case/textfields-example/README.md +3 -0
  172. package/plugins/{example/mySuperComponent.vue → @vcmap-show-case/textfields-example/TextfieldsExample.vue} +1 -7
  173. package/plugins/{example → @vcmap-show-case/textfields-example}/index.js +58 -62
  174. package/plugins/@vcmap-show-case/textfields-example/package.json +5 -0
  175. package/plugins/@vcmap-show-case/window-tester/README.md +3 -0
  176. package/plugins/{test/windowManagerExample.vue → @vcmap-show-case/window-tester/WindowExample.vue} +36 -20
  177. package/plugins/{test → @vcmap-show-case/window-tester}/emptyComponent.vue +8 -3
  178. package/plugins/@vcmap-show-case/window-tester/index.js +62 -0
  179. package/plugins/{test → @vcmap-show-case/window-tester}/myCustomHeader.vue +0 -0
  180. package/plugins/@vcmap-show-case/window-tester/package.json +5 -0
  181. package/plugins/{test → @vcmap-show-case/window-tester}/toolbox-data.js +9 -9
  182. package/plugins/{test/vcsContent.vue → @vcmap-show-case/window-tester/windowExampleContent.vue} +1 -5
  183. package/plugins/@vcmap-show-case/wizard-example/README.md +3 -0
  184. package/plugins/{wizardExample → @vcmap-show-case/wizard-example}/index.js +12 -6
  185. package/plugins/@vcmap-show-case/wizard-example/package.json +5 -0
  186. package/plugins/@vcmap-show-case/wizard-example/wizardExample.vue +95 -0
  187. package/plugins/package.json +2 -1
  188. package/src/actions/actionHelper.js +1 -3
  189. package/src/actions/stateRefAction.js +0 -10
  190. package/src/application/VcsApp.vue +42 -23
  191. package/src/application/VcsMap.vue +9 -0
  192. package/src/components/buttons/VcsActionButtonList.vue +1 -0
  193. package/src/components/form-inputs-controls/VcsCheckbox.vue +3 -1
  194. package/src/components/form-inputs-controls/VcsWizard.vue +17 -20
  195. package/src/components/form-inputs-controls/VcsWizardStep.vue +160 -0
  196. package/src/{icons → components/icons}/+all.js +0 -0
  197. package/src/{icons → components/icons}/2DAreaIcon.vue +0 -0
  198. package/src/{icons → components/icons}/2DDistanceIcon.vue +0 -0
  199. package/src/{icons → components/icons}/3DAreaIcon.vue +0 -0
  200. package/src/{icons → components/icons}/3DDistanceIcon.vue +0 -0
  201. package/src/{icons → components/icons}/3DHeightIcon.vue +0 -0
  202. package/src/{icons → components/icons}/AngleIcon.vue +0 -0
  203. package/src/{icons → components/icons}/AssociationsIcon.vue +0 -0
  204. package/src/{icons → components/icons}/AxisIcon.vue +0 -0
  205. package/src/{icons → components/icons}/BoundingBoxIcon.vue +0 -0
  206. package/src/{icons → components/icons}/CheckboxCheckedIcon.vue +0 -0
  207. package/src/{icons → components/icons}/CheckboxIcon.vue +0 -0
  208. package/src/{icons → components/icons}/CheckboxIndeterminateIcon.vue +0 -0
  209. package/src/{icons → components/icons}/CircleIcon.vue +0 -0
  210. package/src/{icons → components/icons}/ClippingHorizontalIcon.vue +0 -0
  211. package/src/{icons → components/icons}/ClippingIcon.vue +0 -0
  212. package/src/{icons → components/icons}/ClippingVerticalIcon.vue +0 -0
  213. package/src/{icons → components/icons}/ColorPickerIcon.vue +0 -0
  214. package/src/{icons → components/icons}/ColorSwatchIcon.vue +0 -0
  215. package/src/{icons → components/icons}/CommentIcon.vue +0 -0
  216. package/src/{icons → components/icons}/CompassIcon.vue +0 -0
  217. package/src/{icons → components/icons}/ComponentsIcon.vue +0 -0
  218. package/src/{icons → components/icons}/ConeIcon.vue +0 -0
  219. package/src/{icons → components/icons}/DimensionsHouseIcon.vue +0 -0
  220. package/src/{icons → components/icons}/EditIcon.vue +0 -0
  221. package/src/{icons → components/icons}/ElevationProfileIcon.vue +0 -0
  222. package/src/{icons → components/icons}/ExportAreaIcon.vue +0 -0
  223. package/src/{icons → components/icons}/ExportFlightIcon.vue +0 -0
  224. package/src/{icons → components/icons}/ExportIcon.vue +0 -0
  225. package/src/{icons → components/icons}/ExternalLinkIcon.vue +0 -0
  226. package/src/{icons → components/icons}/EyeIcon.vue +0 -0
  227. package/src/{icons → components/icons}/FastForwardIcon.vue +0 -0
  228. package/src/{icons → components/icons}/FilterIcon.vue +0 -0
  229. package/src/{icons → components/icons}/GlobalTerrainIcon.vue +0 -0
  230. package/src/{icons → components/icons}/GlobeNatureIcon.vue +0 -0
  231. package/src/{icons → components/icons}/GroundIcon.vue +0 -0
  232. package/src/{icons → components/icons}/HealthCareIndustriesIcon.vue +0 -0
  233. package/src/{icons → components/icons}/HelpIcon.vue +0 -0
  234. package/src/{icons → components/icons}/HideIcon.vue +0 -0
  235. package/src/{icons → components/icons}/HomePointIcon.vue +0 -0
  236. package/src/{icons → components/icons}/HospitalsIcon.vue +0 -0
  237. package/src/{icons → components/icons}/HouseIcon.vue +0 -0
  238. package/src/{icons → components/icons}/ImportIcon.vue +0 -0
  239. package/src/{icons → components/icons}/InfoIcon.vue +0 -0
  240. package/src/{icons → components/icons}/KebabIcon.vue +0 -0
  241. package/src/{icons → components/icons}/LabelIcon.vue +0 -0
  242. package/src/{icons → components/icons}/LayersIcon.vue +0 -0
  243. package/src/{icons → components/icons}/LegendIcon.vue +0 -0
  244. package/src/{icons → components/icons}/LineIcon.vue +0 -0
  245. package/src/{icons → components/icons}/LinkIcon.vue +0 -0
  246. package/src/{icons → components/icons}/LogoutIcon.vue +0 -0
  247. package/src/{icons → components/icons}/MapIcon.vue +0 -0
  248. package/src/{icons → components/icons}/MenuIcon.vue +0 -0
  249. package/src/{icons → components/icons}/MinusIcon.vue +0 -0
  250. package/src/{icons → components/icons}/ObjectAttributeIcon.vue +0 -0
  251. package/src/{icons → components/icons}/ObjectSelectIcon.vue +0 -0
  252. package/src/{icons → components/icons}/ObliqueViewIcon.vue +0 -0
  253. package/src/{icons → components/icons}/PdfIcon.vue +0 -0
  254. package/src/{icons → components/icons}/PedestrianIcon.vue +0 -0
  255. package/src/{icons → components/icons}/PenIcon.vue +0 -0
  256. package/src/{icons → components/icons}/PlayCircleIcon.vue +0 -0
  257. package/src/{icons → components/icons}/PlusIcon.vue +0 -0
  258. package/src/{icons → components/icons}/PoiIcon.vue +0 -0
  259. package/src/{icons → components/icons}/PointSelectIcon.vue +0 -0
  260. package/src/{icons → components/icons}/PolygonIcon.vue +0 -0
  261. package/src/{icons → components/icons}/PresentationModeIcon.vue +0 -0
  262. package/src/{icons → components/icons}/ProgressIcon.vue +0 -0
  263. package/src/{icons → components/icons}/QueryIcon.vue +0 -0
  264. package/src/{icons → components/icons}/RectangleIcon.vue +0 -0
  265. package/src/{icons → components/icons}/ReturnIcon.vue +0 -0
  266. package/src/{icons → components/icons}/RewindIcon.vue +0 -0
  267. package/src/{icons → components/icons}/RotateLeftIcon.vue +0 -0
  268. package/src/{icons → components/icons}/RotateRightIcon.vue +0 -0
  269. package/src/{icons → components/icons}/ScreenshotIcon.vue +0 -0
  270. package/src/{icons → components/icons}/SearchIcon.vue +0 -0
  271. package/src/{icons → components/icons}/ShadowIcon.vue +0 -0
  272. package/src/{icons → components/icons}/ShapesIcon.vue +0 -0
  273. package/src/{icons → components/icons}/ShareIcon.vue +0 -0
  274. package/src/{icons → components/icons}/SimpleCircleFilledIcon.vue +0 -0
  275. package/src/{icons → components/icons}/SimpleCircleHalfFilledIcon.vue +0 -0
  276. package/src/{icons → components/icons}/SimpleCircleOutlinedIcon.vue +0 -0
  277. package/src/{icons → components/icons}/SkipNextIcon.vue +0 -0
  278. package/src/{icons → components/icons}/SkipPreviousIcon.vue +0 -0
  279. package/src/{icons → components/icons}/SplitViewIcon.vue +0 -0
  280. package/src/{icons → components/icons}/TerrainBoxIcon.vue +0 -0
  281. package/src/{icons → components/icons}/TextStyleIcon.vue +0 -0
  282. package/src/{icons → components/icons}/ThreeDimensionsIcon.vue +0 -0
  283. package/src/{icons → components/icons}/ToolsIcon.vue +0 -0
  284. package/src/{icons → components/icons}/TouchIcon.vue +0 -0
  285. package/src/{icons → components/icons}/TrashCanIcon.vue +0 -0
  286. package/src/{icons → components/icons}/TriangleIcon.vue +0 -0
  287. package/src/{icons → components/icons}/TwoDimensionsIcon.vue +0 -0
  288. package/src/{icons → components/icons}/UploadIcon.vue +0 -0
  289. package/src/{icons → components/icons}/UserProfileIcon.vue +0 -0
  290. package/src/{icons → components/icons}/UserShareIcon.vue +0 -0
  291. package/src/{icons → components/icons}/VideoRecorderIcon.vue +0 -0
  292. package/src/{icons → components/icons}/ViewpointFlightIcon.vue +0 -0
  293. package/src/{icons → components/icons}/ViewpointIcon.vue +0 -0
  294. package/src/{icons → components/icons}/Viewshed360Icon.vue +0 -0
  295. package/src/{icons → components/icons}/ViewshedConeIcon.vue +0 -0
  296. package/src/{icons → components/icons}/ViewshedIcon.vue +0 -0
  297. package/src/{icons → components/icons}/WalkingIcon.vue +0 -0
  298. package/src/{icons → components/icons}/WallIcon.vue +0 -0
  299. package/src/{icons → components/icons}/WandIcon.vue +0 -0
  300. package/src/components/lists/VcsList.vue +21 -12
  301. package/src/components/lists/VcsTreeviewLeaf.vue +14 -2
  302. package/src/components/notification/VcsTooltip.vue +1 -1
  303. package/src/featureInfo/abstractFeatureInfoView.js +1 -1
  304. package/src/featureInfo/addressBalloonFeatureInfoView.js +1 -1
  305. package/src/featureInfo/balloonFeatureInfoView.js +1 -1
  306. package/src/featureInfo/balloonHelper.js +6 -6
  307. package/src/featureInfo/featureInfo.js +2 -2
  308. package/src/i18n/de.js +2 -6
  309. package/src/i18n/en.js +2 -6
  310. package/src/legend/legendHelper.js +4 -3
  311. package/src/legend/vcsLegend.vue +21 -2
  312. package/src/manager/window/WindowComponent.vue +42 -4
  313. package/src/manager/window/WindowComponentHeader.vue +1 -1
  314. package/src/manager/window/windowHelper.js +7 -11
  315. package/src/manager/window/windowManager.js +15 -11
  316. package/src/navigation/mapNavCompass.vue +13 -7
  317. package/src/navigation/mapNavigation.vue +66 -4
  318. package/src/navigation/orientationToolsButton.vue +1 -1
  319. package/src/navigation/overviewMap.js +26 -10
  320. package/src/navigation/vcsCompass.vue +4 -73
  321. package/src/setup.js +1 -1
  322. package/src/vuePlugins/vuetify.js +1 -1
  323. package/dist/assets/cesium/Workers/ArcType-c9b2b290.js +0 -25
  324. package/dist/assets/cesium/Workers/AttributeCompression-7b0f288d.js +0 -25
  325. package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-d0c22774.js +0 -25
  326. package/dist/assets/cesium/Workers/BoundingRectangle-201b1a81.js +0 -25
  327. package/dist/assets/cesium/Workers/BoxGeometry-4985457c.js +0 -25
  328. package/dist/assets/cesium/Workers/Color-cc8c18b3.js +0 -25
  329. package/dist/assets/cesium/Workers/ComponentDatatype-0200bf8c.js +0 -25
  330. package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-4345acdf.js +0 -25
  331. package/dist/assets/cesium/Workers/CorridorGeometryLibrary-850a6c35.js +0 -25
  332. package/dist/assets/cesium/Workers/CylinderGeometry-57a1051a.js +0 -25
  333. package/dist/assets/cesium/Workers/CylinderGeometryLibrary-62ce5a1f.js +0 -25
  334. package/dist/assets/cesium/Workers/EllipseGeometry-8627398f.js +0 -25
  335. package/dist/assets/cesium/Workers/EllipseGeometryLibrary-e5919563.js +0 -25
  336. package/dist/assets/cesium/Workers/EllipseOutlineGeometry-96fd4ae1.js +0 -25
  337. package/dist/assets/cesium/Workers/EllipsoidGeodesic-8bfefbff.js +0 -25
  338. package/dist/assets/cesium/Workers/EllipsoidGeometry-377329b9.js +0 -25
  339. package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-e6e16e49.js +0 -25
  340. package/dist/assets/cesium/Workers/EllipsoidRhumbLine-03528f73.js +0 -25
  341. package/dist/assets/cesium/Workers/EllipsoidTangentPlane-c080fd1b.js +0 -25
  342. package/dist/assets/cesium/Workers/EncodedCartesian3-ea0e408f.js +0 -25
  343. package/dist/assets/cesium/Workers/FrustumGeometry-a8b5d817.js +0 -25
  344. package/dist/assets/cesium/Workers/GeometryAttribute-8458a8fd.js +0 -25
  345. package/dist/assets/cesium/Workers/GeometryAttributes-ac0f8485.js +0 -25
  346. package/dist/assets/cesium/Workers/GeometryInstance-ee3aa3ba.js +0 -25
  347. package/dist/assets/cesium/Workers/GeometryOffsetAttribute-08ae0c50.js +0 -25
  348. package/dist/assets/cesium/Workers/GeometryPipeline-33ca229c.js +0 -25
  349. package/dist/assets/cesium/Workers/IndexDatatype-e713bfd2.js +0 -25
  350. package/dist/assets/cesium/Workers/IntersectionTests-eb4db8e0.js +0 -25
  351. package/dist/assets/cesium/Workers/Matrix2-eefef8eb.js +0 -25
  352. package/dist/assets/cesium/Workers/OrientedBoundingBox-5193f9a2.js +0 -25
  353. package/dist/assets/cesium/Workers/Plane-b0299683.js +0 -25
  354. package/dist/assets/cesium/Workers/PolygonGeometryLibrary-b61295f3.js +0 -25
  355. package/dist/assets/cesium/Workers/PolygonPipeline-eb527514.js +0 -25
  356. package/dist/assets/cesium/Workers/PolylinePipeline-0f23dd84.js +0 -25
  357. package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-2d903430.js +0 -25
  358. package/dist/assets/cesium/Workers/PrimitivePipeline-e2640413.js +0 -25
  359. package/dist/assets/cesium/Workers/RectangleGeometryLibrary-ae8bf8a5.js +0 -25
  360. package/dist/assets/cesium/Workers/RuntimeError-5baf5c66.js +0 -25
  361. package/dist/assets/cesium/Workers/TerrainEncoding-bc10ab54.js +0 -25
  362. package/dist/assets/cesium/Workers/Transforms-d2e5867e.js +0 -63
  363. package/dist/assets/cesium/Workers/VertexFormat-5ec0d9ff.js +0 -25
  364. package/dist/assets/cesium/Workers/WallGeometryLibrary-1a33e416.js +0 -25
  365. package/dist/assets/cesium/Workers/WebGLConstants-5b50ced1.js +0 -25
  366. package/dist/assets/cesium/Workers/WebMercatorProjection-cd2f30c2.js +0 -25
  367. package/dist/assets/cesium/Workers/_commonjsHelpers-bc29abbc.js +0 -25
  368. package/dist/assets/cesium/Workers/arrayRemoveDuplicates-f13aceb1.js +0 -25
  369. package/dist/assets/cesium/Workers/combine-7533016d.js +0 -25
  370. package/dist/assets/cesium/Workers/defaultValue-0c475b81.js +0 -25
  371. package/dist/assets/cesium/Workers/package.json +0 -1
  372. package/dist/assets/ui.08c48f.css +0 -1
  373. package/plugins/@vcmap/pluginExample/config.json +0 -6
  374. package/plugins/@vcmap/pluginExample/package.json +0 -7
  375. package/plugins/categoryTest/ItemEditor.vue +0 -13
  376. package/plugins/test/allIconsComponent.vue +0 -50
  377. package/plugins/test/index.js +0 -209
  378. package/plugins/wizardExample/wizardExample.vue +0 -77
  379. package/src/components/form-inputs-controls/VcsColorPicker.vue +0 -85
@@ -0,0 +1,2512 @@
1
+ define(['exports', './Transforms-40229881', './Matrix3-315394f6', './Matrix2-13178034', './Check-666ab1a0', './ComponentDatatype-f7b11d02', './defaultValue-0a909f67', './GeometryAttribute-7d6f1732', './GeometryAttributes-f06a2792', './Math-2dbd6b93', './Plane-900aa728', './VertexFormat-6b480673'], (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
+
847
+ /**
848
+ * Creates a culling volume for this frustum.
849
+ *
850
+ * @param {Cartesian3} position The eye position.
851
+ * @param {Cartesian3} direction The view direction.
852
+ * @param {Cartesian3} up The up direction.
853
+ * @returns {CullingVolume} A culling volume at the given position and orientation.
854
+ *
855
+ * @example
856
+ * // Check if a bounding volume intersects the frustum.
857
+ * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
858
+ * const intersect = cullingVolume.computeVisibility(boundingVolume);
859
+ */
860
+ OrthographicFrustum.prototype.computeCullingVolume = function (
861
+ position,
862
+ direction,
863
+ up
864
+ ) {
865
+ update$2(this);
866
+ return this._offCenterFrustum.computeCullingVolume(position, direction, up);
867
+ };
868
+
869
+ /**
870
+ * Returns the pixel's width and height in meters.
871
+ *
872
+ * @param {Number} drawingBufferWidth The width of the drawing buffer.
873
+ * @param {Number} drawingBufferHeight The height of the drawing buffer.
874
+ * @param {Number} distance The distance to the near plane in meters.
875
+ * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space.
876
+ * @param {Cartesian2} result The object onto which to store the result.
877
+ * @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.
878
+ *
879
+ * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
880
+ * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
881
+ * @exception {DeveloperError} pixelRatio must be greater than zero.
882
+ *
883
+ * @example
884
+ * // Example 1
885
+ * // Get the width and height of a pixel.
886
+ * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cesium.Cartesian2());
887
+ */
888
+ OrthographicFrustum.prototype.getPixelDimensions = function (
889
+ drawingBufferWidth,
890
+ drawingBufferHeight,
891
+ distance,
892
+ pixelRatio,
893
+ result
894
+ ) {
895
+ update$2(this);
896
+ return this._offCenterFrustum.getPixelDimensions(
897
+ drawingBufferWidth,
898
+ drawingBufferHeight,
899
+ distance,
900
+ pixelRatio,
901
+ result
902
+ );
903
+ };
904
+
905
+ /**
906
+ * Returns a duplicate of a OrthographicFrustum instance.
907
+ *
908
+ * @param {OrthographicFrustum} [result] The object onto which to store the result.
909
+ * @returns {OrthographicFrustum} The modified result parameter or a new OrthographicFrustum instance if one was not provided.
910
+ */
911
+ OrthographicFrustum.prototype.clone = function (result) {
912
+ if (!defaultValue.defined(result)) {
913
+ result = new OrthographicFrustum();
914
+ }
915
+
916
+ result.aspectRatio = this.aspectRatio;
917
+ result.width = this.width;
918
+ result.near = this.near;
919
+ result.far = this.far;
920
+
921
+ // force update of clone to compute matrices
922
+ result._aspectRatio = undefined;
923
+ result._width = undefined;
924
+ result._near = undefined;
925
+ result._far = undefined;
926
+
927
+ this._offCenterFrustum.clone(result._offCenterFrustum);
928
+
929
+ return result;
930
+ };
931
+
932
+ /**
933
+ * Compares the provided OrthographicFrustum componentwise and returns
934
+ * <code>true</code> if they are equal, <code>false</code> otherwise.
935
+ *
936
+ * @param {OrthographicFrustum} [other] The right hand side OrthographicFrustum.
937
+ * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
938
+ */
939
+ OrthographicFrustum.prototype.equals = function (other) {
940
+ if (!defaultValue.defined(other) || !(other instanceof OrthographicFrustum)) {
941
+ return false;
942
+ }
943
+
944
+ update$2(this);
945
+ update$2(other);
946
+
947
+ return (
948
+ this.width === other.width &&
949
+ this.aspectRatio === other.aspectRatio &&
950
+ this._offCenterFrustum.equals(other._offCenterFrustum)
951
+ );
952
+ };
953
+
954
+ /**
955
+ * Compares the provided OrthographicFrustum componentwise and returns
956
+ * <code>true</code> if they pass an absolute or relative tolerance test,
957
+ * <code>false</code> otherwise.
958
+ *
959
+ * @param {OrthographicFrustum} other The right hand side OrthographicFrustum.
960
+ * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
961
+ * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
962
+ * @returns {Boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
963
+ */
964
+ OrthographicFrustum.prototype.equalsEpsilon = function (
965
+ other,
966
+ relativeEpsilon,
967
+ absoluteEpsilon
968
+ ) {
969
+ if (!defaultValue.defined(other) || !(other instanceof OrthographicFrustum)) {
970
+ return false;
971
+ }
972
+
973
+ update$2(this);
974
+ update$2(other);
975
+
976
+ return (
977
+ Math$1.CesiumMath.equalsEpsilon(
978
+ this.width,
979
+ other.width,
980
+ relativeEpsilon,
981
+ absoluteEpsilon
982
+ ) &&
983
+ Math$1.CesiumMath.equalsEpsilon(
984
+ this.aspectRatio,
985
+ other.aspectRatio,
986
+ relativeEpsilon,
987
+ absoluteEpsilon
988
+ ) &&
989
+ this._offCenterFrustum.equalsEpsilon(
990
+ other._offCenterFrustum,
991
+ relativeEpsilon,
992
+ absoluteEpsilon
993
+ )
994
+ );
995
+ };
996
+
997
+ /**
998
+ * The viewing frustum is defined by 6 planes.
999
+ * Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
1000
+ * define the unit vector normal to the plane, and the w component is the distance of the
1001
+ * plane from the origin/camera position.
1002
+ *
1003
+ * @alias PerspectiveOffCenterFrustum
1004
+ * @constructor
1005
+ *
1006
+ * @param {Object} [options] An object with the following properties:
1007
+ * @param {Number} [options.left] The left clipping plane distance.
1008
+ * @param {Number} [options.right] The right clipping plane distance.
1009
+ * @param {Number} [options.top] The top clipping plane distance.
1010
+ * @param {Number} [options.bottom] The bottom clipping plane distance.
1011
+ * @param {Number} [options.near=1.0] The near clipping plane distance.
1012
+ * @param {Number} [options.far=500000000.0] The far clipping plane distance.
1013
+ *
1014
+ * @example
1015
+ * const frustum = new Cesium.PerspectiveOffCenterFrustum({
1016
+ * left : -1.0,
1017
+ * right : 1.0,
1018
+ * top : 1.0,
1019
+ * bottom : -1.0,
1020
+ * near : 1.0,
1021
+ * far : 100.0
1022
+ * });
1023
+ *
1024
+ * @see PerspectiveFrustum
1025
+ */
1026
+ function PerspectiveOffCenterFrustum(options) {
1027
+ options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
1028
+
1029
+ /**
1030
+ * Defines the left clipping plane.
1031
+ * @type {Number}
1032
+ * @default undefined
1033
+ */
1034
+ this.left = options.left;
1035
+ this._left = undefined;
1036
+
1037
+ /**
1038
+ * Defines the right clipping plane.
1039
+ * @type {Number}
1040
+ * @default undefined
1041
+ */
1042
+ this.right = options.right;
1043
+ this._right = undefined;
1044
+
1045
+ /**
1046
+ * Defines the top clipping plane.
1047
+ * @type {Number}
1048
+ * @default undefined
1049
+ */
1050
+ this.top = options.top;
1051
+ this._top = undefined;
1052
+
1053
+ /**
1054
+ * Defines the bottom clipping plane.
1055
+ * @type {Number}
1056
+ * @default undefined
1057
+ */
1058
+ this.bottom = options.bottom;
1059
+ this._bottom = undefined;
1060
+
1061
+ /**
1062
+ * The distance of the near plane.
1063
+ * @type {Number}
1064
+ * @default 1.0
1065
+ */
1066
+ this.near = defaultValue.defaultValue(options.near, 1.0);
1067
+ this._near = this.near;
1068
+
1069
+ /**
1070
+ * The distance of the far plane.
1071
+ * @type {Number}
1072
+ * @default 500000000.0
1073
+ */
1074
+ this.far = defaultValue.defaultValue(options.far, 500000000.0);
1075
+ this._far = this.far;
1076
+
1077
+ this._cullingVolume = new CullingVolume();
1078
+ this._perspectiveMatrix = new Matrix2.Matrix4();
1079
+ this._infinitePerspective = new Matrix2.Matrix4();
1080
+ }
1081
+
1082
+ function update$1(frustum) {
1083
+ //>>includeStart('debug', pragmas.debug);
1084
+ if (
1085
+ !defaultValue.defined(frustum.right) ||
1086
+ !defaultValue.defined(frustum.left) ||
1087
+ !defaultValue.defined(frustum.top) ||
1088
+ !defaultValue.defined(frustum.bottom) ||
1089
+ !defaultValue.defined(frustum.near) ||
1090
+ !defaultValue.defined(frustum.far)
1091
+ ) {
1092
+ throw new Check.DeveloperError(
1093
+ "right, left, top, bottom, near, or far parameters are not set."
1094
+ );
1095
+ }
1096
+ //>>includeEnd('debug');
1097
+
1098
+ const t = frustum.top;
1099
+ const b = frustum.bottom;
1100
+ const r = frustum.right;
1101
+ const l = frustum.left;
1102
+ const n = frustum.near;
1103
+ const f = frustum.far;
1104
+
1105
+ if (
1106
+ t !== frustum._top ||
1107
+ b !== frustum._bottom ||
1108
+ l !== frustum._left ||
1109
+ r !== frustum._right ||
1110
+ n !== frustum._near ||
1111
+ f !== frustum._far
1112
+ ) {
1113
+ //>>includeStart('debug', pragmas.debug);
1114
+ if (frustum.near <= 0 || frustum.near > frustum.far) {
1115
+ throw new Check.DeveloperError(
1116
+ "near must be greater than zero and less than far."
1117
+ );
1118
+ }
1119
+ //>>includeEnd('debug');
1120
+
1121
+ frustum._left = l;
1122
+ frustum._right = r;
1123
+ frustum._top = t;
1124
+ frustum._bottom = b;
1125
+ frustum._near = n;
1126
+ frustum._far = f;
1127
+ frustum._perspectiveMatrix = Matrix2.Matrix4.computePerspectiveOffCenter(
1128
+ l,
1129
+ r,
1130
+ b,
1131
+ t,
1132
+ n,
1133
+ f,
1134
+ frustum._perspectiveMatrix
1135
+ );
1136
+ frustum._infinitePerspective = Matrix2.Matrix4.computeInfinitePerspectiveOffCenter(
1137
+ l,
1138
+ r,
1139
+ b,
1140
+ t,
1141
+ n,
1142
+ frustum._infinitePerspective
1143
+ );
1144
+ }
1145
+ }
1146
+
1147
+ Object.defineProperties(PerspectiveOffCenterFrustum.prototype, {
1148
+ /**
1149
+ * Gets the perspective projection matrix computed from the view frustum.
1150
+ * @memberof PerspectiveOffCenterFrustum.prototype
1151
+ * @type {Matrix4}
1152
+ * @readonly
1153
+ *
1154
+ * @see PerspectiveOffCenterFrustum#infiniteProjectionMatrix
1155
+ */
1156
+ projectionMatrix: {
1157
+ get: function () {
1158
+ update$1(this);
1159
+ return this._perspectiveMatrix;
1160
+ },
1161
+ },
1162
+
1163
+ /**
1164
+ * Gets the perspective projection matrix computed from the view frustum with an infinite far plane.
1165
+ * @memberof PerspectiveOffCenterFrustum.prototype
1166
+ * @type {Matrix4}
1167
+ * @readonly
1168
+ *
1169
+ * @see PerspectiveOffCenterFrustum#projectionMatrix
1170
+ */
1171
+ infiniteProjectionMatrix: {
1172
+ get: function () {
1173
+ update$1(this);
1174
+ return this._infinitePerspective;
1175
+ },
1176
+ },
1177
+ });
1178
+
1179
+ const getPlanesRight = new Matrix3.Cartesian3();
1180
+ const getPlanesNearCenter = new Matrix3.Cartesian3();
1181
+ const getPlanesFarCenter = new Matrix3.Cartesian3();
1182
+ const getPlanesNormal = new Matrix3.Cartesian3();
1183
+ /**
1184
+ * Creates a culling volume for this frustum.
1185
+ *
1186
+ * @param {Cartesian3} position The eye position.
1187
+ * @param {Cartesian3} direction The view direction.
1188
+ * @param {Cartesian3} up The up direction.
1189
+ * @returns {CullingVolume} A culling volume at the given position and orientation.
1190
+ *
1191
+ * @example
1192
+ * // Check if a bounding volume intersects the frustum.
1193
+ * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
1194
+ * const intersect = cullingVolume.computeVisibility(boundingVolume);
1195
+ */
1196
+ PerspectiveOffCenterFrustum.prototype.computeCullingVolume = function (
1197
+ position,
1198
+ direction,
1199
+ up
1200
+ ) {
1201
+ //>>includeStart('debug', pragmas.debug);
1202
+ if (!defaultValue.defined(position)) {
1203
+ throw new Check.DeveloperError("position is required.");
1204
+ }
1205
+
1206
+ if (!defaultValue.defined(direction)) {
1207
+ throw new Check.DeveloperError("direction is required.");
1208
+ }
1209
+
1210
+ if (!defaultValue.defined(up)) {
1211
+ throw new Check.DeveloperError("up is required.");
1212
+ }
1213
+ //>>includeEnd('debug');
1214
+
1215
+ const planes = this._cullingVolume.planes;
1216
+
1217
+ const t = this.top;
1218
+ const b = this.bottom;
1219
+ const r = this.right;
1220
+ const l = this.left;
1221
+ const n = this.near;
1222
+ const f = this.far;
1223
+
1224
+ const right = Matrix3.Cartesian3.cross(direction, up, getPlanesRight);
1225
+
1226
+ const nearCenter = getPlanesNearCenter;
1227
+ Matrix3.Cartesian3.multiplyByScalar(direction, n, nearCenter);
1228
+ Matrix3.Cartesian3.add(position, nearCenter, nearCenter);
1229
+
1230
+ const farCenter = getPlanesFarCenter;
1231
+ Matrix3.Cartesian3.multiplyByScalar(direction, f, farCenter);
1232
+ Matrix3.Cartesian3.add(position, farCenter, farCenter);
1233
+
1234
+ const normal = getPlanesNormal;
1235
+
1236
+ //Left plane computation
1237
+ Matrix3.Cartesian3.multiplyByScalar(right, l, normal);
1238
+ Matrix3.Cartesian3.add(nearCenter, normal, normal);
1239
+ Matrix3.Cartesian3.subtract(normal, position, normal);
1240
+ Matrix3.Cartesian3.normalize(normal, normal);
1241
+ Matrix3.Cartesian3.cross(normal, up, normal);
1242
+ Matrix3.Cartesian3.normalize(normal, normal);
1243
+
1244
+ let plane = planes[0];
1245
+ if (!defaultValue.defined(plane)) {
1246
+ plane = planes[0] = new Matrix2.Cartesian4();
1247
+ }
1248
+ plane.x = normal.x;
1249
+ plane.y = normal.y;
1250
+ plane.z = normal.z;
1251
+ plane.w = -Matrix3.Cartesian3.dot(normal, position);
1252
+
1253
+ //Right plane computation
1254
+ Matrix3.Cartesian3.multiplyByScalar(right, r, normal);
1255
+ Matrix3.Cartesian3.add(nearCenter, normal, normal);
1256
+ Matrix3.Cartesian3.subtract(normal, position, normal);
1257
+ Matrix3.Cartesian3.cross(up, normal, normal);
1258
+ Matrix3.Cartesian3.normalize(normal, normal);
1259
+
1260
+ plane = planes[1];
1261
+ if (!defaultValue.defined(plane)) {
1262
+ plane = planes[1] = new Matrix2.Cartesian4();
1263
+ }
1264
+ plane.x = normal.x;
1265
+ plane.y = normal.y;
1266
+ plane.z = normal.z;
1267
+ plane.w = -Matrix3.Cartesian3.dot(normal, position);
1268
+
1269
+ //Bottom plane computation
1270
+ Matrix3.Cartesian3.multiplyByScalar(up, b, normal);
1271
+ Matrix3.Cartesian3.add(nearCenter, normal, normal);
1272
+ Matrix3.Cartesian3.subtract(normal, position, normal);
1273
+ Matrix3.Cartesian3.cross(right, normal, normal);
1274
+ Matrix3.Cartesian3.normalize(normal, normal);
1275
+
1276
+ plane = planes[2];
1277
+ if (!defaultValue.defined(plane)) {
1278
+ plane = planes[2] = new Matrix2.Cartesian4();
1279
+ }
1280
+ plane.x = normal.x;
1281
+ plane.y = normal.y;
1282
+ plane.z = normal.z;
1283
+ plane.w = -Matrix3.Cartesian3.dot(normal, position);
1284
+
1285
+ //Top plane computation
1286
+ Matrix3.Cartesian3.multiplyByScalar(up, t, normal);
1287
+ Matrix3.Cartesian3.add(nearCenter, normal, normal);
1288
+ Matrix3.Cartesian3.subtract(normal, position, normal);
1289
+ Matrix3.Cartesian3.cross(normal, right, normal);
1290
+ Matrix3.Cartesian3.normalize(normal, normal);
1291
+
1292
+ plane = planes[3];
1293
+ if (!defaultValue.defined(plane)) {
1294
+ plane = planes[3] = new Matrix2.Cartesian4();
1295
+ }
1296
+ plane.x = normal.x;
1297
+ plane.y = normal.y;
1298
+ plane.z = normal.z;
1299
+ plane.w = -Matrix3.Cartesian3.dot(normal, position);
1300
+
1301
+ //Near plane computation
1302
+ plane = planes[4];
1303
+ if (!defaultValue.defined(plane)) {
1304
+ plane = planes[4] = new Matrix2.Cartesian4();
1305
+ }
1306
+ plane.x = direction.x;
1307
+ plane.y = direction.y;
1308
+ plane.z = direction.z;
1309
+ plane.w = -Matrix3.Cartesian3.dot(direction, nearCenter);
1310
+
1311
+ //Far plane computation
1312
+ Matrix3.Cartesian3.negate(direction, normal);
1313
+
1314
+ plane = planes[5];
1315
+ if (!defaultValue.defined(plane)) {
1316
+ plane = planes[5] = new Matrix2.Cartesian4();
1317
+ }
1318
+ plane.x = normal.x;
1319
+ plane.y = normal.y;
1320
+ plane.z = normal.z;
1321
+ plane.w = -Matrix3.Cartesian3.dot(normal, farCenter);
1322
+
1323
+ return this._cullingVolume;
1324
+ };
1325
+
1326
+ /**
1327
+ * Returns the pixel's width and height in meters.
1328
+ *
1329
+ * @param {Number} drawingBufferWidth The width of the drawing buffer.
1330
+ * @param {Number} drawingBufferHeight The height of the drawing buffer.
1331
+ * @param {Number} distance The distance to the near plane in meters.
1332
+ * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space.
1333
+ * @param {Cartesian2} result The object onto which to store the result.
1334
+ * @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.
1335
+ *
1336
+ * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
1337
+ * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
1338
+ * @exception {DeveloperError} pixelRatio must be greater than zero.
1339
+ *
1340
+ * @example
1341
+ * // Example 1
1342
+ * // Get the width and height of a pixel.
1343
+ * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2());
1344
+ *
1345
+ * @example
1346
+ * // Example 2
1347
+ * // Get the width and height of a pixel if the near plane was set to 'distance'.
1348
+ * // For example, get the size of a pixel of an image on a billboard.
1349
+ * const position = camera.position;
1350
+ * const direction = camera.direction;
1351
+ * const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive
1352
+ * const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
1353
+ * const distance = Cesium.Cartesian3.magnitude(toCenterProj);
1354
+ * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());
1355
+ */
1356
+ PerspectiveOffCenterFrustum.prototype.getPixelDimensions = function (
1357
+ drawingBufferWidth,
1358
+ drawingBufferHeight,
1359
+ distance,
1360
+ pixelRatio,
1361
+ result
1362
+ ) {
1363
+ update$1(this);
1364
+
1365
+ //>>includeStart('debug', pragmas.debug);
1366
+ if (!defaultValue.defined(drawingBufferWidth) || !defaultValue.defined(drawingBufferHeight)) {
1367
+ throw new Check.DeveloperError(
1368
+ "Both drawingBufferWidth and drawingBufferHeight are required."
1369
+ );
1370
+ }
1371
+ if (drawingBufferWidth <= 0) {
1372
+ throw new Check.DeveloperError("drawingBufferWidth must be greater than zero.");
1373
+ }
1374
+ if (drawingBufferHeight <= 0) {
1375
+ throw new Check.DeveloperError("drawingBufferHeight must be greater than zero.");
1376
+ }
1377
+ if (!defaultValue.defined(distance)) {
1378
+ throw new Check.DeveloperError("distance is required.");
1379
+ }
1380
+ if (!defaultValue.defined(pixelRatio)) {
1381
+ throw new Check.DeveloperError("pixelRatio is required");
1382
+ }
1383
+ if (pixelRatio <= 0) {
1384
+ throw new Check.DeveloperError("pixelRatio must be greater than zero.");
1385
+ }
1386
+ if (!defaultValue.defined(result)) {
1387
+ throw new Check.DeveloperError("A result object is required.");
1388
+ }
1389
+ //>>includeEnd('debug');
1390
+
1391
+ const inverseNear = 1.0 / this.near;
1392
+ let tanTheta = this.top * inverseNear;
1393
+ const pixelHeight =
1394
+ (2.0 * pixelRatio * distance * tanTheta) / drawingBufferHeight;
1395
+ tanTheta = this.right * inverseNear;
1396
+ const pixelWidth =
1397
+ (2.0 * pixelRatio * distance * tanTheta) / drawingBufferWidth;
1398
+
1399
+ result.x = pixelWidth;
1400
+ result.y = pixelHeight;
1401
+ return result;
1402
+ };
1403
+
1404
+ /**
1405
+ * Returns a duplicate of a PerspectiveOffCenterFrustum instance.
1406
+ *
1407
+ * @param {PerspectiveOffCenterFrustum} [result] The object onto which to store the result.
1408
+ * @returns {PerspectiveOffCenterFrustum} The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
1409
+ */
1410
+ PerspectiveOffCenterFrustum.prototype.clone = function (result) {
1411
+ if (!defaultValue.defined(result)) {
1412
+ result = new PerspectiveOffCenterFrustum();
1413
+ }
1414
+
1415
+ result.right = this.right;
1416
+ result.left = this.left;
1417
+ result.top = this.top;
1418
+ result.bottom = this.bottom;
1419
+ result.near = this.near;
1420
+ result.far = this.far;
1421
+
1422
+ // force update of clone to compute matrices
1423
+ result._left = undefined;
1424
+ result._right = undefined;
1425
+ result._top = undefined;
1426
+ result._bottom = undefined;
1427
+ result._near = undefined;
1428
+ result._far = undefined;
1429
+
1430
+ return result;
1431
+ };
1432
+
1433
+ /**
1434
+ * Compares the provided PerspectiveOffCenterFrustum componentwise and returns
1435
+ * <code>true</code> if they are equal, <code>false</code> otherwise.
1436
+ *
1437
+ * @param {PerspectiveOffCenterFrustum} [other] The right hand side PerspectiveOffCenterFrustum.
1438
+ * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
1439
+ */
1440
+ PerspectiveOffCenterFrustum.prototype.equals = function (other) {
1441
+ return (
1442
+ defaultValue.defined(other) &&
1443
+ other instanceof PerspectiveOffCenterFrustum &&
1444
+ this.right === other.right &&
1445
+ this.left === other.left &&
1446
+ this.top === other.top &&
1447
+ this.bottom === other.bottom &&
1448
+ this.near === other.near &&
1449
+ this.far === other.far
1450
+ );
1451
+ };
1452
+
1453
+ /**
1454
+ * Compares the provided PerspectiveOffCenterFrustum componentwise and returns
1455
+ * <code>true</code> if they pass an absolute or relative tolerance test,
1456
+ * <code>false</code> otherwise.
1457
+ *
1458
+ * @param {PerspectiveOffCenterFrustum} other The right hand side PerspectiveOffCenterFrustum.
1459
+ * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
1460
+ * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
1461
+ * @returns {Boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
1462
+ */
1463
+ PerspectiveOffCenterFrustum.prototype.equalsEpsilon = function (
1464
+ other,
1465
+ relativeEpsilon,
1466
+ absoluteEpsilon
1467
+ ) {
1468
+ return (
1469
+ other === this ||
1470
+ (defaultValue.defined(other) &&
1471
+ other instanceof PerspectiveOffCenterFrustum &&
1472
+ Math$1.CesiumMath.equalsEpsilon(
1473
+ this.right,
1474
+ other.right,
1475
+ relativeEpsilon,
1476
+ absoluteEpsilon
1477
+ ) &&
1478
+ Math$1.CesiumMath.equalsEpsilon(
1479
+ this.left,
1480
+ other.left,
1481
+ relativeEpsilon,
1482
+ absoluteEpsilon
1483
+ ) &&
1484
+ Math$1.CesiumMath.equalsEpsilon(
1485
+ this.top,
1486
+ other.top,
1487
+ relativeEpsilon,
1488
+ absoluteEpsilon
1489
+ ) &&
1490
+ Math$1.CesiumMath.equalsEpsilon(
1491
+ this.bottom,
1492
+ other.bottom,
1493
+ relativeEpsilon,
1494
+ absoluteEpsilon
1495
+ ) &&
1496
+ Math$1.CesiumMath.equalsEpsilon(
1497
+ this.near,
1498
+ other.near,
1499
+ relativeEpsilon,
1500
+ absoluteEpsilon
1501
+ ) &&
1502
+ Math$1.CesiumMath.equalsEpsilon(
1503
+ this.far,
1504
+ other.far,
1505
+ relativeEpsilon,
1506
+ absoluteEpsilon
1507
+ ))
1508
+ );
1509
+ };
1510
+
1511
+ /**
1512
+ * The viewing frustum is defined by 6 planes.
1513
+ * Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
1514
+ * define the unit vector normal to the plane, and the w component is the distance of the
1515
+ * plane from the origin/camera position.
1516
+ *
1517
+ * @alias PerspectiveFrustum
1518
+ * @constructor
1519
+ *
1520
+ * @param {Object} [options] An object with the following properties:
1521
+ * @param {Number} [options.fov] The angle of the field of view (FOV), in radians.
1522
+ * @param {Number} [options.aspectRatio] The aspect ratio of the frustum's width to it's height.
1523
+ * @param {Number} [options.near=1.0] The distance of the near plane.
1524
+ * @param {Number} [options.far=500000000.0] The distance of the far plane.
1525
+ * @param {Number} [options.xOffset=0.0] The offset in the x direction.
1526
+ * @param {Number} [options.yOffset=0.0] The offset in the y direction.
1527
+ *
1528
+ * @example
1529
+ * const frustum = new Cesium.PerspectiveFrustum({
1530
+ * fov : Cesium.Math.PI_OVER_THREE,
1531
+ * aspectRatio : canvas.clientWidth / canvas.clientHeight
1532
+ * near : 1.0,
1533
+ * far : 1000.0
1534
+ * });
1535
+ *
1536
+ * @see PerspectiveOffCenterFrustum
1537
+ */
1538
+ function PerspectiveFrustum(options) {
1539
+ options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
1540
+
1541
+ this._offCenterFrustum = new PerspectiveOffCenterFrustum();
1542
+
1543
+ /**
1544
+ * The angle of the field of view (FOV), in radians. This angle will be used
1545
+ * as the horizontal FOV if the width is greater than the height, otherwise
1546
+ * it will be the vertical FOV.
1547
+ * @type {Number}
1548
+ * @default undefined
1549
+ */
1550
+ this.fov = options.fov;
1551
+ this._fov = undefined;
1552
+ this._fovy = undefined;
1553
+
1554
+ this._sseDenominator = undefined;
1555
+
1556
+ /**
1557
+ * The aspect ratio of the frustum's width to it's height.
1558
+ * @type {Number}
1559
+ * @default undefined
1560
+ */
1561
+ this.aspectRatio = options.aspectRatio;
1562
+ this._aspectRatio = undefined;
1563
+
1564
+ /**
1565
+ * The distance of the near plane.
1566
+ * @type {Number}
1567
+ * @default 1.0
1568
+ */
1569
+ this.near = defaultValue.defaultValue(options.near, 1.0);
1570
+ this._near = this.near;
1571
+
1572
+ /**
1573
+ * The distance of the far plane.
1574
+ * @type {Number}
1575
+ * @default 500000000.0
1576
+ */
1577
+ this.far = defaultValue.defaultValue(options.far, 500000000.0);
1578
+ this._far = this.far;
1579
+
1580
+ /**
1581
+ * Offsets the frustum in the x direction.
1582
+ * @type {Number}
1583
+ * @default 0.0
1584
+ */
1585
+ this.xOffset = defaultValue.defaultValue(options.xOffset, 0.0);
1586
+ this._xOffset = this.xOffset;
1587
+
1588
+ /**
1589
+ * Offsets the frustum in the y direction.
1590
+ * @type {Number}
1591
+ * @default 0.0
1592
+ */
1593
+ this.yOffset = defaultValue.defaultValue(options.yOffset, 0.0);
1594
+ this._yOffset = this.yOffset;
1595
+ }
1596
+
1597
+ /**
1598
+ * The number of elements used to pack the object into an array.
1599
+ * @type {Number}
1600
+ */
1601
+ PerspectiveFrustum.packedLength = 6;
1602
+
1603
+ /**
1604
+ * Stores the provided instance into the provided array.
1605
+ *
1606
+ * @param {PerspectiveFrustum} value The value to pack.
1607
+ * @param {Number[]} array The array to pack into.
1608
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
1609
+ *
1610
+ * @returns {Number[]} The array that was packed into
1611
+ */
1612
+ PerspectiveFrustum.pack = function (value, array, startingIndex) {
1613
+ //>>includeStart('debug', pragmas.debug);
1614
+ Check.Check.typeOf.object("value", value);
1615
+ Check.Check.defined("array", array);
1616
+ //>>includeEnd('debug');
1617
+
1618
+ startingIndex = defaultValue.defaultValue(startingIndex, 0);
1619
+
1620
+ array[startingIndex++] = value.fov;
1621
+ array[startingIndex++] = value.aspectRatio;
1622
+ array[startingIndex++] = value.near;
1623
+ array[startingIndex++] = value.far;
1624
+ array[startingIndex++] = value.xOffset;
1625
+ array[startingIndex] = value.yOffset;
1626
+
1627
+ return array;
1628
+ };
1629
+
1630
+ /**
1631
+ * Retrieves an instance from a packed array.
1632
+ *
1633
+ * @param {Number[]} array The packed array.
1634
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
1635
+ * @param {PerspectiveFrustum} [result] The object into which to store the result.
1636
+ * @returns {PerspectiveFrustum} The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
1637
+ */
1638
+ PerspectiveFrustum.unpack = function (array, startingIndex, result) {
1639
+ //>>includeStart('debug', pragmas.debug);
1640
+ Check.Check.defined("array", array);
1641
+ //>>includeEnd('debug');
1642
+
1643
+ startingIndex = defaultValue.defaultValue(startingIndex, 0);
1644
+
1645
+ if (!defaultValue.defined(result)) {
1646
+ result = new PerspectiveFrustum();
1647
+ }
1648
+
1649
+ result.fov = array[startingIndex++];
1650
+ result.aspectRatio = array[startingIndex++];
1651
+ result.near = array[startingIndex++];
1652
+ result.far = array[startingIndex++];
1653
+ result.xOffset = array[startingIndex++];
1654
+ result.yOffset = array[startingIndex];
1655
+
1656
+ return result;
1657
+ };
1658
+
1659
+ function update(frustum) {
1660
+ //>>includeStart('debug', pragmas.debug);
1661
+ if (
1662
+ !defaultValue.defined(frustum.fov) ||
1663
+ !defaultValue.defined(frustum.aspectRatio) ||
1664
+ !defaultValue.defined(frustum.near) ||
1665
+ !defaultValue.defined(frustum.far)
1666
+ ) {
1667
+ throw new Check.DeveloperError(
1668
+ "fov, aspectRatio, near, or far parameters are not set."
1669
+ );
1670
+ }
1671
+ //>>includeEnd('debug');
1672
+
1673
+ const f = frustum._offCenterFrustum;
1674
+
1675
+ if (
1676
+ frustum.fov !== frustum._fov ||
1677
+ frustum.aspectRatio !== frustum._aspectRatio ||
1678
+ frustum.near !== frustum._near ||
1679
+ frustum.far !== frustum._far ||
1680
+ frustum.xOffset !== frustum._xOffset ||
1681
+ frustum.yOffset !== frustum._yOffset
1682
+ ) {
1683
+ //>>includeStart('debug', pragmas.debug);
1684
+ if (frustum.fov < 0 || frustum.fov >= Math.PI) {
1685
+ throw new Check.DeveloperError("fov must be in the range [0, PI).");
1686
+ }
1687
+
1688
+ if (frustum.aspectRatio < 0) {
1689
+ throw new Check.DeveloperError("aspectRatio must be positive.");
1690
+ }
1691
+
1692
+ if (frustum.near < 0 || frustum.near > frustum.far) {
1693
+ throw new Check.DeveloperError(
1694
+ "near must be greater than zero and less than far."
1695
+ );
1696
+ }
1697
+ //>>includeEnd('debug');
1698
+
1699
+ frustum._aspectRatio = frustum.aspectRatio;
1700
+ frustum._fov = frustum.fov;
1701
+ frustum._fovy =
1702
+ frustum.aspectRatio <= 1
1703
+ ? frustum.fov
1704
+ : Math.atan(Math.tan(frustum.fov * 0.5) / frustum.aspectRatio) * 2.0;
1705
+ frustum._near = frustum.near;
1706
+ frustum._far = frustum.far;
1707
+ frustum._sseDenominator = 2.0 * Math.tan(0.5 * frustum._fovy);
1708
+ frustum._xOffset = frustum.xOffset;
1709
+ frustum._yOffset = frustum.yOffset;
1710
+
1711
+ f.top = frustum.near * Math.tan(0.5 * frustum._fovy);
1712
+ f.bottom = -f.top;
1713
+ f.right = frustum.aspectRatio * f.top;
1714
+ f.left = -f.right;
1715
+ f.near = frustum.near;
1716
+ f.far = frustum.far;
1717
+
1718
+ f.right += frustum.xOffset;
1719
+ f.left += frustum.xOffset;
1720
+ f.top += frustum.yOffset;
1721
+ f.bottom += frustum.yOffset;
1722
+ }
1723
+ }
1724
+
1725
+ Object.defineProperties(PerspectiveFrustum.prototype, {
1726
+ /**
1727
+ * Gets the perspective projection matrix computed from the view frustum.
1728
+ * @memberof PerspectiveFrustum.prototype
1729
+ * @type {Matrix4}
1730
+ * @readonly
1731
+ *
1732
+ * @see PerspectiveFrustum#infiniteProjectionMatrix
1733
+ */
1734
+ projectionMatrix: {
1735
+ get: function () {
1736
+ update(this);
1737
+ return this._offCenterFrustum.projectionMatrix;
1738
+ },
1739
+ },
1740
+
1741
+ /**
1742
+ * The perspective projection matrix computed from the view frustum with an infinite far plane.
1743
+ * @memberof PerspectiveFrustum.prototype
1744
+ * @type {Matrix4}
1745
+ * @readonly
1746
+ *
1747
+ * @see PerspectiveFrustum#projectionMatrix
1748
+ */
1749
+ infiniteProjectionMatrix: {
1750
+ get: function () {
1751
+ update(this);
1752
+ return this._offCenterFrustum.infiniteProjectionMatrix;
1753
+ },
1754
+ },
1755
+
1756
+ /**
1757
+ * Gets the angle of the vertical field of view, in radians.
1758
+ * @memberof PerspectiveFrustum.prototype
1759
+ * @type {Number}
1760
+ * @readonly
1761
+ * @default undefined
1762
+ */
1763
+ fovy: {
1764
+ get: function () {
1765
+ update(this);
1766
+ return this._fovy;
1767
+ },
1768
+ },
1769
+
1770
+ /**
1771
+ * @readonly
1772
+ * @private
1773
+ */
1774
+ sseDenominator: {
1775
+ get: function () {
1776
+ update(this);
1777
+ return this._sseDenominator;
1778
+ },
1779
+ },
1780
+ });
1781
+
1782
+ /**
1783
+ * Creates a culling volume for this frustum.
1784
+ *
1785
+ * @param {Cartesian3} position The eye position.
1786
+ * @param {Cartesian3} direction The view direction.
1787
+ * @param {Cartesian3} up The up direction.
1788
+ * @returns {CullingVolume} A culling volume at the given position and orientation.
1789
+ *
1790
+ * @example
1791
+ * // Check if a bounding volume intersects the frustum.
1792
+ * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
1793
+ * const intersect = cullingVolume.computeVisibility(boundingVolume);
1794
+ */
1795
+ PerspectiveFrustum.prototype.computeCullingVolume = function (
1796
+ position,
1797
+ direction,
1798
+ up
1799
+ ) {
1800
+ update(this);
1801
+ return this._offCenterFrustum.computeCullingVolume(position, direction, up);
1802
+ };
1803
+
1804
+ /**
1805
+ * Returns the pixel's width and height in meters.
1806
+ *
1807
+ * @param {Number} drawingBufferWidth The width of the drawing buffer.
1808
+ * @param {Number} drawingBufferHeight The height of the drawing buffer.
1809
+ * @param {Number} distance The distance to the near plane in meters.
1810
+ * @param {Number} pixelRatio The scaling factor from pixel space to coordinate space.
1811
+ * @param {Cartesian2} result The object onto which to store the result.
1812
+ * @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.
1813
+ *
1814
+ * @exception {DeveloperError} drawingBufferWidth must be greater than zero.
1815
+ * @exception {DeveloperError} drawingBufferHeight must be greater than zero.
1816
+ * @exception {DeveloperError} pixelRatio must be greater than zero.
1817
+ *
1818
+ * @example
1819
+ * // Example 1
1820
+ * // Get the width and height of a pixel.
1821
+ * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2());
1822
+ *
1823
+ * @example
1824
+ * // Example 2
1825
+ * // Get the width and height of a pixel if the near plane was set to 'distance'.
1826
+ * // For example, get the size of a pixel of an image on a billboard.
1827
+ * const position = camera.position;
1828
+ * const direction = camera.direction;
1829
+ * const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive
1830
+ * const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
1831
+ * const distance = Cesium.Cartesian3.magnitude(toCenterProj);
1832
+ * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());
1833
+ */
1834
+ PerspectiveFrustum.prototype.getPixelDimensions = function (
1835
+ drawingBufferWidth,
1836
+ drawingBufferHeight,
1837
+ distance,
1838
+ pixelRatio,
1839
+ result
1840
+ ) {
1841
+ update(this);
1842
+ return this._offCenterFrustum.getPixelDimensions(
1843
+ drawingBufferWidth,
1844
+ drawingBufferHeight,
1845
+ distance,
1846
+ pixelRatio,
1847
+ result
1848
+ );
1849
+ };
1850
+
1851
+ /**
1852
+ * Returns a duplicate of a PerspectiveFrustum instance.
1853
+ *
1854
+ * @param {PerspectiveFrustum} [result] The object onto which to store the result.
1855
+ * @returns {PerspectiveFrustum} The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
1856
+ */
1857
+ PerspectiveFrustum.prototype.clone = function (result) {
1858
+ if (!defaultValue.defined(result)) {
1859
+ result = new PerspectiveFrustum();
1860
+ }
1861
+
1862
+ result.aspectRatio = this.aspectRatio;
1863
+ result.fov = this.fov;
1864
+ result.near = this.near;
1865
+ result.far = this.far;
1866
+
1867
+ // force update of clone to compute matrices
1868
+ result._aspectRatio = undefined;
1869
+ result._fov = undefined;
1870
+ result._near = undefined;
1871
+ result._far = undefined;
1872
+
1873
+ this._offCenterFrustum.clone(result._offCenterFrustum);
1874
+
1875
+ return result;
1876
+ };
1877
+
1878
+ /**
1879
+ * Compares the provided PerspectiveFrustum componentwise and returns
1880
+ * <code>true</code> if they are equal, <code>false</code> otherwise.
1881
+ *
1882
+ * @param {PerspectiveFrustum} [other] The right hand side PerspectiveFrustum.
1883
+ * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
1884
+ */
1885
+ PerspectiveFrustum.prototype.equals = function (other) {
1886
+ if (!defaultValue.defined(other) || !(other instanceof PerspectiveFrustum)) {
1887
+ return false;
1888
+ }
1889
+
1890
+ update(this);
1891
+ update(other);
1892
+
1893
+ return (
1894
+ this.fov === other.fov &&
1895
+ this.aspectRatio === other.aspectRatio &&
1896
+ this._offCenterFrustum.equals(other._offCenterFrustum)
1897
+ );
1898
+ };
1899
+
1900
+ /**
1901
+ * Compares the provided PerspectiveFrustum componentwise and returns
1902
+ * <code>true</code> if they pass an absolute or relative tolerance test,
1903
+ * <code>false</code> otherwise.
1904
+ *
1905
+ * @param {PerspectiveFrustum} other The right hand side PerspectiveFrustum.
1906
+ * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing.
1907
+ * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
1908
+ * @returns {Boolean} <code>true</code> if this and other are within the provided epsilon, <code>false</code> otherwise.
1909
+ */
1910
+ PerspectiveFrustum.prototype.equalsEpsilon = function (
1911
+ other,
1912
+ relativeEpsilon,
1913
+ absoluteEpsilon
1914
+ ) {
1915
+ if (!defaultValue.defined(other) || !(other instanceof PerspectiveFrustum)) {
1916
+ return false;
1917
+ }
1918
+
1919
+ update(this);
1920
+ update(other);
1921
+
1922
+ return (
1923
+ Math$1.CesiumMath.equalsEpsilon(
1924
+ this.fov,
1925
+ other.fov,
1926
+ relativeEpsilon,
1927
+ absoluteEpsilon
1928
+ ) &&
1929
+ Math$1.CesiumMath.equalsEpsilon(
1930
+ this.aspectRatio,
1931
+ other.aspectRatio,
1932
+ relativeEpsilon,
1933
+ absoluteEpsilon
1934
+ ) &&
1935
+ this._offCenterFrustum.equalsEpsilon(
1936
+ other._offCenterFrustum,
1937
+ relativeEpsilon,
1938
+ absoluteEpsilon
1939
+ )
1940
+ );
1941
+ };
1942
+
1943
+ const PERSPECTIVE = 0;
1944
+ const ORTHOGRAPHIC = 1;
1945
+
1946
+ /**
1947
+ * Describes a frustum at the given the origin and orientation.
1948
+ *
1949
+ * @alias FrustumGeometry
1950
+ * @constructor
1951
+ *
1952
+ * @param {Object} options Object with the following properties:
1953
+ * @param {PerspectiveFrustum|OrthographicFrustum} options.frustum The frustum.
1954
+ * @param {Cartesian3} options.origin The origin of the frustum.
1955
+ * @param {Quaternion} options.orientation The orientation of the frustum.
1956
+ * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
1957
+ */
1958
+ function FrustumGeometry(options) {
1959
+ //>>includeStart('debug', pragmas.debug);
1960
+ Check.Check.typeOf.object("options", options);
1961
+ Check.Check.typeOf.object("options.frustum", options.frustum);
1962
+ Check.Check.typeOf.object("options.origin", options.origin);
1963
+ Check.Check.typeOf.object("options.orientation", options.orientation);
1964
+ //>>includeEnd('debug');
1965
+
1966
+ const frustum = options.frustum;
1967
+ const orientation = options.orientation;
1968
+ const origin = options.origin;
1969
+ const vertexFormat = defaultValue.defaultValue(options.vertexFormat, VertexFormat.VertexFormat.DEFAULT);
1970
+
1971
+ // This is private because it is used by DebugCameraPrimitive to draw a multi-frustum by
1972
+ // creating multiple FrustumGeometrys. This way the near plane of one frustum doesn't overlap
1973
+ // the far plane of another.
1974
+ const drawNearPlane = defaultValue.defaultValue(options._drawNearPlane, true);
1975
+
1976
+ let frustumType;
1977
+ let frustumPackedLength;
1978
+ if (frustum instanceof PerspectiveFrustum) {
1979
+ frustumType = PERSPECTIVE;
1980
+ frustumPackedLength = PerspectiveFrustum.packedLength;
1981
+ } else if (frustum instanceof OrthographicFrustum) {
1982
+ frustumType = ORTHOGRAPHIC;
1983
+ frustumPackedLength = OrthographicFrustum.packedLength;
1984
+ }
1985
+
1986
+ this._frustumType = frustumType;
1987
+ this._frustum = frustum.clone();
1988
+ this._origin = Matrix3.Cartesian3.clone(origin);
1989
+ this._orientation = Transforms.Quaternion.clone(orientation);
1990
+ this._drawNearPlane = drawNearPlane;
1991
+ this._vertexFormat = vertexFormat;
1992
+ this._workerName = "createFrustumGeometry";
1993
+
1994
+ /**
1995
+ * The number of elements used to pack the object into an array.
1996
+ * @type {Number}
1997
+ */
1998
+ this.packedLength =
1999
+ 2 +
2000
+ frustumPackedLength +
2001
+ Matrix3.Cartesian3.packedLength +
2002
+ Transforms.Quaternion.packedLength +
2003
+ VertexFormat.VertexFormat.packedLength;
2004
+ }
2005
+
2006
+ /**
2007
+ * Stores the provided instance into the provided array.
2008
+ *
2009
+ * @param {FrustumGeometry} value The value to pack.
2010
+ * @param {Number[]} array The array to pack into.
2011
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
2012
+ *
2013
+ * @returns {Number[]} The array that was packed into
2014
+ */
2015
+ FrustumGeometry.pack = function (value, array, startingIndex) {
2016
+ //>>includeStart('debug', pragmas.debug);
2017
+ Check.Check.typeOf.object("value", value);
2018
+ Check.Check.defined("array", array);
2019
+ //>>includeEnd('debug');
2020
+
2021
+ startingIndex = defaultValue.defaultValue(startingIndex, 0);
2022
+
2023
+ const frustumType = value._frustumType;
2024
+ const frustum = value._frustum;
2025
+
2026
+ array[startingIndex++] = frustumType;
2027
+
2028
+ if (frustumType === PERSPECTIVE) {
2029
+ PerspectiveFrustum.pack(frustum, array, startingIndex);
2030
+ startingIndex += PerspectiveFrustum.packedLength;
2031
+ } else {
2032
+ OrthographicFrustum.pack(frustum, array, startingIndex);
2033
+ startingIndex += OrthographicFrustum.packedLength;
2034
+ }
2035
+
2036
+ Matrix3.Cartesian3.pack(value._origin, array, startingIndex);
2037
+ startingIndex += Matrix3.Cartesian3.packedLength;
2038
+ Transforms.Quaternion.pack(value._orientation, array, startingIndex);
2039
+ startingIndex += Transforms.Quaternion.packedLength;
2040
+ VertexFormat.VertexFormat.pack(value._vertexFormat, array, startingIndex);
2041
+ startingIndex += VertexFormat.VertexFormat.packedLength;
2042
+ array[startingIndex] = value._drawNearPlane ? 1.0 : 0.0;
2043
+
2044
+ return array;
2045
+ };
2046
+
2047
+ const scratchPackPerspective = new PerspectiveFrustum();
2048
+ const scratchPackOrthographic = new OrthographicFrustum();
2049
+ const scratchPackQuaternion = new Transforms.Quaternion();
2050
+ const scratchPackorigin = new Matrix3.Cartesian3();
2051
+ const scratchVertexFormat = new VertexFormat.VertexFormat();
2052
+
2053
+ /**
2054
+ * Retrieves an instance from a packed array.
2055
+ *
2056
+ * @param {Number[]} array The packed array.
2057
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
2058
+ * @param {FrustumGeometry} [result] The object into which to store the result.
2059
+ */
2060
+ FrustumGeometry.unpack = function (array, startingIndex, result) {
2061
+ //>>includeStart('debug', pragmas.debug);
2062
+ Check.Check.defined("array", array);
2063
+ //>>includeEnd('debug');
2064
+
2065
+ startingIndex = defaultValue.defaultValue(startingIndex, 0);
2066
+
2067
+ const frustumType = array[startingIndex++];
2068
+
2069
+ let frustum;
2070
+ if (frustumType === PERSPECTIVE) {
2071
+ frustum = PerspectiveFrustum.unpack(
2072
+ array,
2073
+ startingIndex,
2074
+ scratchPackPerspective
2075
+ );
2076
+ startingIndex += PerspectiveFrustum.packedLength;
2077
+ } else {
2078
+ frustum = OrthographicFrustum.unpack(
2079
+ array,
2080
+ startingIndex,
2081
+ scratchPackOrthographic
2082
+ );
2083
+ startingIndex += OrthographicFrustum.packedLength;
2084
+ }
2085
+
2086
+ const origin = Matrix3.Cartesian3.unpack(array, startingIndex, scratchPackorigin);
2087
+ startingIndex += Matrix3.Cartesian3.packedLength;
2088
+ const orientation = Transforms.Quaternion.unpack(
2089
+ array,
2090
+ startingIndex,
2091
+ scratchPackQuaternion
2092
+ );
2093
+ startingIndex += Transforms.Quaternion.packedLength;
2094
+ const vertexFormat = VertexFormat.VertexFormat.unpack(
2095
+ array,
2096
+ startingIndex,
2097
+ scratchVertexFormat
2098
+ );
2099
+ startingIndex += VertexFormat.VertexFormat.packedLength;
2100
+ const drawNearPlane = array[startingIndex] === 1.0;
2101
+
2102
+ if (!defaultValue.defined(result)) {
2103
+ return new FrustumGeometry({
2104
+ frustum: frustum,
2105
+ origin: origin,
2106
+ orientation: orientation,
2107
+ vertexFormat: vertexFormat,
2108
+ _drawNearPlane: drawNearPlane,
2109
+ });
2110
+ }
2111
+
2112
+ const frustumResult =
2113
+ frustumType === result._frustumType ? result._frustum : undefined;
2114
+ result._frustum = frustum.clone(frustumResult);
2115
+
2116
+ result._frustumType = frustumType;
2117
+ result._origin = Matrix3.Cartesian3.clone(origin, result._origin);
2118
+ result._orientation = Transforms.Quaternion.clone(orientation, result._orientation);
2119
+ result._vertexFormat = VertexFormat.VertexFormat.clone(vertexFormat, result._vertexFormat);
2120
+ result._drawNearPlane = drawNearPlane;
2121
+
2122
+ return result;
2123
+ };
2124
+
2125
+ function getAttributes(
2126
+ offset,
2127
+ normals,
2128
+ tangents,
2129
+ bitangents,
2130
+ st,
2131
+ normal,
2132
+ tangent,
2133
+ bitangent
2134
+ ) {
2135
+ const stOffset = (offset / 3) * 2;
2136
+
2137
+ for (let i = 0; i < 4; ++i) {
2138
+ if (defaultValue.defined(normals)) {
2139
+ normals[offset] = normal.x;
2140
+ normals[offset + 1] = normal.y;
2141
+ normals[offset + 2] = normal.z;
2142
+ }
2143
+ if (defaultValue.defined(tangents)) {
2144
+ tangents[offset] = tangent.x;
2145
+ tangents[offset + 1] = tangent.y;
2146
+ tangents[offset + 2] = tangent.z;
2147
+ }
2148
+ if (defaultValue.defined(bitangents)) {
2149
+ bitangents[offset] = bitangent.x;
2150
+ bitangents[offset + 1] = bitangent.y;
2151
+ bitangents[offset + 2] = bitangent.z;
2152
+ }
2153
+ offset += 3;
2154
+ }
2155
+
2156
+ st[stOffset] = 0.0;
2157
+ st[stOffset + 1] = 0.0;
2158
+ st[stOffset + 2] = 1.0;
2159
+ st[stOffset + 3] = 0.0;
2160
+ st[stOffset + 4] = 1.0;
2161
+ st[stOffset + 5] = 1.0;
2162
+ st[stOffset + 6] = 0.0;
2163
+ st[stOffset + 7] = 1.0;
2164
+ }
2165
+
2166
+ const scratchRotationMatrix = new Matrix3.Matrix3();
2167
+ const scratchViewMatrix = new Matrix2.Matrix4();
2168
+ const scratchInverseMatrix = new Matrix2.Matrix4();
2169
+
2170
+ const scratchXDirection = new Matrix3.Cartesian3();
2171
+ const scratchYDirection = new Matrix3.Cartesian3();
2172
+ const scratchZDirection = new Matrix3.Cartesian3();
2173
+ const scratchNegativeX = new Matrix3.Cartesian3();
2174
+ const scratchNegativeY = new Matrix3.Cartesian3();
2175
+ const scratchNegativeZ = new Matrix3.Cartesian3();
2176
+
2177
+ const frustumSplits = new Array(3);
2178
+
2179
+ const frustumCornersNDC = new Array(4);
2180
+ frustumCornersNDC[0] = new Matrix2.Cartesian4(-1.0, -1.0, 1.0, 1.0);
2181
+ frustumCornersNDC[1] = new Matrix2.Cartesian4(1.0, -1.0, 1.0, 1.0);
2182
+ frustumCornersNDC[2] = new Matrix2.Cartesian4(1.0, 1.0, 1.0, 1.0);
2183
+ frustumCornersNDC[3] = new Matrix2.Cartesian4(-1.0, 1.0, 1.0, 1.0);
2184
+
2185
+ const scratchFrustumCorners = new Array(4);
2186
+ for (let i = 0; i < 4; ++i) {
2187
+ scratchFrustumCorners[i] = new Matrix2.Cartesian4();
2188
+ }
2189
+
2190
+ FrustumGeometry._computeNearFarPlanes = function (
2191
+ origin,
2192
+ orientation,
2193
+ frustumType,
2194
+ frustum,
2195
+ positions,
2196
+ xDirection,
2197
+ yDirection,
2198
+ zDirection
2199
+ ) {
2200
+ const rotationMatrix = Matrix3.Matrix3.fromQuaternion(
2201
+ orientation,
2202
+ scratchRotationMatrix
2203
+ );
2204
+ let x = defaultValue.defaultValue(xDirection, scratchXDirection);
2205
+ let y = defaultValue.defaultValue(yDirection, scratchYDirection);
2206
+ let z = defaultValue.defaultValue(zDirection, scratchZDirection);
2207
+
2208
+ x = Matrix3.Matrix3.getColumn(rotationMatrix, 0, x);
2209
+ y = Matrix3.Matrix3.getColumn(rotationMatrix, 1, y);
2210
+ z = Matrix3.Matrix3.getColumn(rotationMatrix, 2, z);
2211
+
2212
+ Matrix3.Cartesian3.normalize(x, x);
2213
+ Matrix3.Cartesian3.normalize(y, y);
2214
+ Matrix3.Cartesian3.normalize(z, z);
2215
+
2216
+ Matrix3.Cartesian3.negate(x, x);
2217
+
2218
+ const view = Matrix2.Matrix4.computeView(origin, z, y, x, scratchViewMatrix);
2219
+
2220
+ let inverseView;
2221
+ let inverseViewProjection;
2222
+ if (frustumType === PERSPECTIVE) {
2223
+ const projection = frustum.projectionMatrix;
2224
+ const viewProjection = Matrix2.Matrix4.multiply(
2225
+ projection,
2226
+ view,
2227
+ scratchInverseMatrix
2228
+ );
2229
+ inverseViewProjection = Matrix2.Matrix4.inverse(
2230
+ viewProjection,
2231
+ scratchInverseMatrix
2232
+ );
2233
+ } else {
2234
+ inverseView = Matrix2.Matrix4.inverseTransformation(view, scratchInverseMatrix);
2235
+ }
2236
+
2237
+ if (defaultValue.defined(inverseViewProjection)) {
2238
+ frustumSplits[0] = frustum.near;
2239
+ frustumSplits[1] = frustum.far;
2240
+ } else {
2241
+ frustumSplits[0] = 0.0;
2242
+ frustumSplits[1] = frustum.near;
2243
+ frustumSplits[2] = frustum.far;
2244
+ }
2245
+
2246
+ for (let i = 0; i < 2; ++i) {
2247
+ for (let j = 0; j < 4; ++j) {
2248
+ let corner = Matrix2.Cartesian4.clone(
2249
+ frustumCornersNDC[j],
2250
+ scratchFrustumCorners[j]
2251
+ );
2252
+
2253
+ if (!defaultValue.defined(inverseViewProjection)) {
2254
+ if (defaultValue.defined(frustum._offCenterFrustum)) {
2255
+ frustum = frustum._offCenterFrustum;
2256
+ }
2257
+
2258
+ const near = frustumSplits[i];
2259
+ const far = frustumSplits[i + 1];
2260
+
2261
+ corner.x =
2262
+ (corner.x * (frustum.right - frustum.left) +
2263
+ frustum.left +
2264
+ frustum.right) *
2265
+ 0.5;
2266
+ corner.y =
2267
+ (corner.y * (frustum.top - frustum.bottom) +
2268
+ frustum.bottom +
2269
+ frustum.top) *
2270
+ 0.5;
2271
+ corner.z = (corner.z * (near - far) - near - far) * 0.5;
2272
+ corner.w = 1.0;
2273
+
2274
+ Matrix2.Matrix4.multiplyByVector(inverseView, corner, corner);
2275
+ } else {
2276
+ corner = Matrix2.Matrix4.multiplyByVector(
2277
+ inverseViewProjection,
2278
+ corner,
2279
+ corner
2280
+ );
2281
+
2282
+ // Reverse perspective divide
2283
+ const w = 1.0 / corner.w;
2284
+ Matrix3.Cartesian3.multiplyByScalar(corner, w, corner);
2285
+
2286
+ Matrix3.Cartesian3.subtract(corner, origin, corner);
2287
+ Matrix3.Cartesian3.normalize(corner, corner);
2288
+
2289
+ const fac = Matrix3.Cartesian3.dot(z, corner);
2290
+ Matrix3.Cartesian3.multiplyByScalar(corner, frustumSplits[i] / fac, corner);
2291
+ Matrix3.Cartesian3.add(corner, origin, corner);
2292
+ }
2293
+
2294
+ positions[12 * i + j * 3] = corner.x;
2295
+ positions[12 * i + j * 3 + 1] = corner.y;
2296
+ positions[12 * i + j * 3 + 2] = corner.z;
2297
+ }
2298
+ }
2299
+ };
2300
+
2301
+ /**
2302
+ * Computes the geometric representation of a frustum, including its vertices, indices, and a bounding sphere.
2303
+ *
2304
+ * @param {FrustumGeometry} frustumGeometry A description of the frustum.
2305
+ * @returns {Geometry|undefined} The computed vertices and indices.
2306
+ */
2307
+ FrustumGeometry.createGeometry = function (frustumGeometry) {
2308
+ const frustumType = frustumGeometry._frustumType;
2309
+ const frustum = frustumGeometry._frustum;
2310
+ const origin = frustumGeometry._origin;
2311
+ const orientation = frustumGeometry._orientation;
2312
+ const drawNearPlane = frustumGeometry._drawNearPlane;
2313
+ const vertexFormat = frustumGeometry._vertexFormat;
2314
+
2315
+ const numberOfPlanes = drawNearPlane ? 6 : 5;
2316
+ let positions = new Float64Array(3 * 4 * 6);
2317
+ FrustumGeometry._computeNearFarPlanes(
2318
+ origin,
2319
+ orientation,
2320
+ frustumType,
2321
+ frustum,
2322
+ positions
2323
+ );
2324
+
2325
+ // -x plane
2326
+ let offset = 3 * 4 * 2;
2327
+ positions[offset] = positions[3 * 4];
2328
+ positions[offset + 1] = positions[3 * 4 + 1];
2329
+ positions[offset + 2] = positions[3 * 4 + 2];
2330
+ positions[offset + 3] = positions[0];
2331
+ positions[offset + 4] = positions[1];
2332
+ positions[offset + 5] = positions[2];
2333
+ positions[offset + 6] = positions[3 * 3];
2334
+ positions[offset + 7] = positions[3 * 3 + 1];
2335
+ positions[offset + 8] = positions[3 * 3 + 2];
2336
+ positions[offset + 9] = positions[3 * 7];
2337
+ positions[offset + 10] = positions[3 * 7 + 1];
2338
+ positions[offset + 11] = positions[3 * 7 + 2];
2339
+
2340
+ // -y plane
2341
+ offset += 3 * 4;
2342
+ positions[offset] = positions[3 * 5];
2343
+ positions[offset + 1] = positions[3 * 5 + 1];
2344
+ positions[offset + 2] = positions[3 * 5 + 2];
2345
+ positions[offset + 3] = positions[3];
2346
+ positions[offset + 4] = positions[3 + 1];
2347
+ positions[offset + 5] = positions[3 + 2];
2348
+ positions[offset + 6] = positions[0];
2349
+ positions[offset + 7] = positions[1];
2350
+ positions[offset + 8] = positions[2];
2351
+ positions[offset + 9] = positions[3 * 4];
2352
+ positions[offset + 10] = positions[3 * 4 + 1];
2353
+ positions[offset + 11] = positions[3 * 4 + 2];
2354
+
2355
+ // +x plane
2356
+ offset += 3 * 4;
2357
+ positions[offset] = positions[3];
2358
+ positions[offset + 1] = positions[3 + 1];
2359
+ positions[offset + 2] = positions[3 + 2];
2360
+ positions[offset + 3] = positions[3 * 5];
2361
+ positions[offset + 4] = positions[3 * 5 + 1];
2362
+ positions[offset + 5] = positions[3 * 5 + 2];
2363
+ positions[offset + 6] = positions[3 * 6];
2364
+ positions[offset + 7] = positions[3 * 6 + 1];
2365
+ positions[offset + 8] = positions[3 * 6 + 2];
2366
+ positions[offset + 9] = positions[3 * 2];
2367
+ positions[offset + 10] = positions[3 * 2 + 1];
2368
+ positions[offset + 11] = positions[3 * 2 + 2];
2369
+
2370
+ // +y plane
2371
+ offset += 3 * 4;
2372
+ positions[offset] = positions[3 * 2];
2373
+ positions[offset + 1] = positions[3 * 2 + 1];
2374
+ positions[offset + 2] = positions[3 * 2 + 2];
2375
+ positions[offset + 3] = positions[3 * 6];
2376
+ positions[offset + 4] = positions[3 * 6 + 1];
2377
+ positions[offset + 5] = positions[3 * 6 + 2];
2378
+ positions[offset + 6] = positions[3 * 7];
2379
+ positions[offset + 7] = positions[3 * 7 + 1];
2380
+ positions[offset + 8] = positions[3 * 7 + 2];
2381
+ positions[offset + 9] = positions[3 * 3];
2382
+ positions[offset + 10] = positions[3 * 3 + 1];
2383
+ positions[offset + 11] = positions[3 * 3 + 2];
2384
+
2385
+ if (!drawNearPlane) {
2386
+ positions = positions.subarray(3 * 4);
2387
+ }
2388
+
2389
+ const attributes = new GeometryAttributes.GeometryAttributes({
2390
+ position: new GeometryAttribute.GeometryAttribute({
2391
+ componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
2392
+ componentsPerAttribute: 3,
2393
+ values: positions,
2394
+ }),
2395
+ });
2396
+
2397
+ if (
2398
+ defaultValue.defined(vertexFormat.normal) ||
2399
+ defaultValue.defined(vertexFormat.tangent) ||
2400
+ defaultValue.defined(vertexFormat.bitangent) ||
2401
+ defaultValue.defined(vertexFormat.st)
2402
+ ) {
2403
+ const normals = defaultValue.defined(vertexFormat.normal)
2404
+ ? new Float32Array(3 * 4 * numberOfPlanes)
2405
+ : undefined;
2406
+ const tangents = defaultValue.defined(vertexFormat.tangent)
2407
+ ? new Float32Array(3 * 4 * numberOfPlanes)
2408
+ : undefined;
2409
+ const bitangents = defaultValue.defined(vertexFormat.bitangent)
2410
+ ? new Float32Array(3 * 4 * numberOfPlanes)
2411
+ : undefined;
2412
+ const st = defaultValue.defined(vertexFormat.st)
2413
+ ? new Float32Array(2 * 4 * numberOfPlanes)
2414
+ : undefined;
2415
+
2416
+ const x = scratchXDirection;
2417
+ const y = scratchYDirection;
2418
+ const z = scratchZDirection;
2419
+
2420
+ const negativeX = Matrix3.Cartesian3.negate(x, scratchNegativeX);
2421
+ const negativeY = Matrix3.Cartesian3.negate(y, scratchNegativeY);
2422
+ const negativeZ = Matrix3.Cartesian3.negate(z, scratchNegativeZ);
2423
+
2424
+ offset = 0;
2425
+ if (drawNearPlane) {
2426
+ getAttributes(offset, normals, tangents, bitangents, st, negativeZ, x, y); // near
2427
+ offset += 3 * 4;
2428
+ }
2429
+ getAttributes(offset, normals, tangents, bitangents, st, z, negativeX, y); // far
2430
+ offset += 3 * 4;
2431
+ getAttributes(
2432
+ offset,
2433
+ normals,
2434
+ tangents,
2435
+ bitangents,
2436
+ st,
2437
+ negativeX,
2438
+ negativeZ,
2439
+ y
2440
+ ); // -x
2441
+ offset += 3 * 4;
2442
+ getAttributes(
2443
+ offset,
2444
+ normals,
2445
+ tangents,
2446
+ bitangents,
2447
+ st,
2448
+ negativeY,
2449
+ negativeZ,
2450
+ negativeX
2451
+ ); // -y
2452
+ offset += 3 * 4;
2453
+ getAttributes(offset, normals, tangents, bitangents, st, x, z, y); // +x
2454
+ offset += 3 * 4;
2455
+ getAttributes(offset, normals, tangents, bitangents, st, y, z, negativeX); // +y
2456
+
2457
+ if (defaultValue.defined(normals)) {
2458
+ attributes.normal = new GeometryAttribute.GeometryAttribute({
2459
+ componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2460
+ componentsPerAttribute: 3,
2461
+ values: normals,
2462
+ });
2463
+ }
2464
+ if (defaultValue.defined(tangents)) {
2465
+ attributes.tangent = new GeometryAttribute.GeometryAttribute({
2466
+ componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2467
+ componentsPerAttribute: 3,
2468
+ values: tangents,
2469
+ });
2470
+ }
2471
+ if (defaultValue.defined(bitangents)) {
2472
+ attributes.bitangent = new GeometryAttribute.GeometryAttribute({
2473
+ componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2474
+ componentsPerAttribute: 3,
2475
+ values: bitangents,
2476
+ });
2477
+ }
2478
+ if (defaultValue.defined(st)) {
2479
+ attributes.st = new GeometryAttribute.GeometryAttribute({
2480
+ componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
2481
+ componentsPerAttribute: 2,
2482
+ values: st,
2483
+ });
2484
+ }
2485
+ }
2486
+
2487
+ const indices = new Uint16Array(6 * numberOfPlanes);
2488
+ for (let i = 0; i < numberOfPlanes; ++i) {
2489
+ const indexOffset = i * 6;
2490
+ const index = i * 4;
2491
+
2492
+ indices[indexOffset] = index;
2493
+ indices[indexOffset + 1] = index + 1;
2494
+ indices[indexOffset + 2] = index + 2;
2495
+ indices[indexOffset + 3] = index;
2496
+ indices[indexOffset + 4] = index + 2;
2497
+ indices[indexOffset + 5] = index + 3;
2498
+ }
2499
+
2500
+ return new GeometryAttribute.Geometry({
2501
+ attributes: attributes,
2502
+ indices: indices,
2503
+ primitiveType: GeometryAttribute.PrimitiveType.TRIANGLES,
2504
+ boundingSphere: Transforms.BoundingSphere.fromVertices(positions),
2505
+ });
2506
+ };
2507
+
2508
+ exports.FrustumGeometry = FrustumGeometry;
2509
+ exports.OrthographicFrustum = OrthographicFrustum;
2510
+ exports.PerspectiveFrustum = PerspectiveFrustum;
2511
+
2512
+ }));