@rtzh/engine 0.0.4 → 0.0.6

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 (228) hide show
  1. package/Build/Workers/{chunk-HAY6YE7M.js → chunk-23CHWHW6.js} +4 -4
  2. package/Build/Workers/{chunk-3K2PK2OU.js → chunk-243UEBJF.js} +10 -10
  3. package/Build/Workers/{chunk-TSAJNE4K.js → chunk-27JI7F7B.js} +2 -2
  4. package/Build/Workers/{chunk-OVPPHDU7.js → chunk-2OWEFNS4.js} +4 -4
  5. package/Build/Workers/{chunk-YBVMSCW4.js → chunk-2VN5W6HA.js} +5 -5
  6. package/Build/Workers/{chunk-OOB2KZC6.js → chunk-2YAONTGQ.js} +7 -7
  7. package/Build/Workers/{chunk-JH27ZGLN.js → chunk-324L25HV.js} +6 -6
  8. package/Build/Workers/{chunk-6LZBBEA7.js → chunk-3EZBCDBK.js} +9 -9
  9. package/Build/Workers/{chunk-25BA4527.js → chunk-3JPA6GA3.js} +12 -12
  10. package/Build/Workers/{chunk-DP76S3IQ.js → chunk-3NSMZ3XW.js} +17 -17
  11. package/Build/Workers/chunk-3WRJXCJS.js +497 -0
  12. package/Build/Workers/{chunk-SBFTVHRW.js → chunk-3ZJ6X3BW.js} +5 -5
  13. package/Build/Workers/{chunk-B2VFNYD7.js → chunk-42I3QSKJ.js} +1 -1
  14. package/Build/Workers/{chunk-BXBGWQ3Z.js → chunk-4BJHO56J.js} +6 -6
  15. package/Build/Workers/{chunk-YPGJSFOO.js → chunk-4DIL24GG.js} +5 -5
  16. package/Build/Workers/{chunk-XOVHLPKW.js → chunk-4FEDW3WT.js} +8 -8
  17. package/Build/Workers/{chunk-WAS3IHIQ.js → chunk-4GPHI5UY.js} +10 -10
  18. package/Build/Workers/{chunk-3M5CRHSG.js → chunk-4NAHNN5G.js} +10 -10
  19. package/Build/Workers/{chunk-KFMCOG26.js → chunk-4SC4KVID.js} +10 -10
  20. package/Build/Workers/{chunk-J3FBVUY4.js → chunk-53AFSDGM.js} +1 -1
  21. package/Build/Workers/{chunk-Q2DXNFYW.js → chunk-54AFUJNV.js} +11 -11
  22. package/Build/Workers/{chunk-7NCJH26L.js → chunk-54SSO7NS.js} +5 -5
  23. package/Build/Workers/{chunk-2BLQ3B4Q.js → chunk-553BNJPP.js} +8 -8
  24. package/Build/Workers/{chunk-GDIBU55R.js → chunk-56MKFDJH.js} +12 -12
  25. package/Build/Workers/{chunk-K4IMD7KH.js → chunk-5DPCF65K.js} +5 -5
  26. package/Build/Workers/{chunk-5QTPACZQ.js → chunk-5MCUZL44.js} +6 -6
  27. package/Build/Workers/{chunk-VIYQ56Z7.js → chunk-5SVTAJRH.js} +12 -12
  28. package/Build/Workers/chunk-5T4DXPEL.js +299 -0
  29. package/Build/Workers/{chunk-56XTN5NJ.js → chunk-5UHIRI2A.js} +2 -2
  30. package/Build/Workers/{chunk-ACH67MPW.js → chunk-5W4ISZGQ.js} +14 -14
  31. package/Build/Workers/{chunk-KVDSJXRK.js → chunk-64VDO4BW.js} +6 -6
  32. package/Build/Workers/{chunk-5WAG5YKS.js → chunk-664SI23B.js} +12 -12
  33. package/Build/Workers/{chunk-TO7TWUET.js → chunk-6AUSOZOL.js} +7 -7
  34. package/Build/Workers/{chunk-SOR7PD4V.js → chunk-6GNLKYQO.js} +6 -6
  35. package/Build/Workers/{chunk-POY6ZE32.js → chunk-6ZF4QOFM.js} +6 -6
  36. package/Build/Workers/{chunk-4HXPSZRC.js → chunk-763Q2YKY.js} +14 -14
  37. package/Build/Workers/chunk-7MMYV5PM.js +288 -0
  38. package/Build/Workers/{chunk-TDI7UQBO.js → chunk-7QPQGSS3.js} +5 -5
  39. package/Build/Workers/{chunk-IELTSYPZ.js → chunk-7R74V5Z3.js} +8 -8
  40. package/Build/Workers/{chunk-PHB5MRHM.js → chunk-7X6CLAD2.js} +9 -9
  41. package/Build/Workers/{chunk-PV5B2YNB.js → chunk-ADQVXDEJ.js} +16 -16
  42. package/Build/Workers/{chunk-TWF4XRZ6.js → chunk-AEURJQ3B.js} +2 -2
  43. package/Build/Workers/{chunk-WLREXLZ7.js → chunk-AMJRLIO3.js} +11 -11
  44. package/Build/Workers/{chunk-7B23DD46.js → chunk-ATC2WXI4.js} +17 -17
  45. package/Build/Workers/{chunk-KVE5EAPO.js → chunk-B5ZUBUPB.js} +14 -14
  46. package/Build/Workers/{chunk-4Z26IS65.js → chunk-BCYABDWF.js} +18 -18
  47. package/Build/Workers/{chunk-E2CARZA7.js → chunk-BHTWF7UG.js} +2 -2
  48. package/Build/Workers/{chunk-UUJXSLQ2.js → chunk-BLZILZWF.js} +16 -16
  49. package/Build/Workers/{chunk-J4MIJCN5.js → chunk-CCPKBCZD.js} +6 -6
  50. package/Build/Workers/chunk-CMAG5O53.js +1483 -0
  51. package/Build/Workers/{chunk-KUAWPGSB.js → chunk-CTARL7CY.js} +13 -13
  52. package/Build/Workers/{chunk-FJREGHFG.js → chunk-D3FNWB3Q.js} +4 -4
  53. package/Build/Workers/{chunk-HI6X33GO.js → chunk-DAYNPAVN.js} +2 -2
  54. package/Build/Workers/{chunk-WMGESUDW.js → chunk-DIA4J2DB.js} +3 -3
  55. package/Build/Workers/{chunk-EISI2CR2.js → chunk-DKJMD2HX.js} +6 -6
  56. package/Build/Workers/{chunk-AL22JVIA.js → chunk-DVTKM7FF.js} +4 -4
  57. package/Build/Workers/{chunk-KBAGFNQ4.js → chunk-E5BSDIGY.js} +5 -5
  58. package/Build/Workers/{chunk-HU5P7PMU.js → chunk-EJVGOIOW.js} +7 -7
  59. package/Build/Workers/chunk-ERYOZBVC.js +171 -0
  60. package/Build/Workers/{chunk-UYT2PBMV.js → chunk-ET7LWDHA.js} +2 -2
  61. package/Build/Workers/{chunk-5BIQOSBV.js → chunk-FSYQE5XE.js} +1 -1
  62. package/Build/Workers/{chunk-ZV42SJKS.js → chunk-FTHCZAWE.js} +2 -2
  63. package/Build/Workers/{chunk-DSBEWMOQ.js → chunk-FTXEOX64.js} +17 -17
  64. package/Build/Workers/{chunk-R73BHGGI.js → chunk-FUFHIXPT.js} +4 -4
  65. package/Build/Workers/{chunk-I76SRIKN.js → chunk-G2KELS4I.js} +4 -4
  66. package/Build/Workers/{chunk-2CAIFJD5.js → chunk-G7PGTG3P.js} +13 -13
  67. package/Build/Workers/{chunk-KXB3AARU.js → chunk-GCZNJHST.js} +5 -5
  68. package/Build/Workers/{chunk-UTWLMOPM.js → chunk-GJFIEALZ.js} +13 -13
  69. package/Build/Workers/{chunk-VR2L2Y4Z.js → chunk-GZMTBQM2.js} +4 -4
  70. package/Build/Workers/{chunk-DBKYAGM6.js → chunk-HAR6Y2HP.js} +2 -2
  71. package/Build/Workers/{chunk-NOH3R3YY.js → chunk-HC6DDPFU.js} +7 -7
  72. package/Build/Workers/{chunk-ELXGXAYS.js → chunk-HHN2M3ES.js} +10 -10
  73. package/Build/Workers/chunk-HHUKBKWS.js +414 -0
  74. package/Build/Workers/chunk-HLIXASKN.js +476 -0
  75. package/Build/Workers/chunk-HM4MH5IG.js +138 -0
  76. package/Build/Workers/{chunk-2APW7KRS.js → chunk-IB2XQV6U.js} +2 -2
  77. package/Build/Workers/{chunk-6XJO625E.js → chunk-IEBTKCMB.js} +3 -3
  78. package/Build/Workers/{chunk-Z356SW7E.js → chunk-IXM65GBF.js} +4 -4
  79. package/Build/Workers/{chunk-LPM2FVDN.js → chunk-IYAZCFAC.js} +6 -6
  80. package/Build/Workers/{chunk-XJKMLTSH.js → chunk-IYXLSOLF.js} +10 -10
  81. package/Build/Workers/{chunk-6QVMKRJ4.js → chunk-JJD7S2CV.js} +18 -18
  82. package/Build/Workers/{chunk-D7TGILR3.js → chunk-JRPAFYGJ.js} +17 -17
  83. package/Build/Workers/{chunk-F5LAPCFC.js → chunk-K6PDZWHZ.js} +5 -5
  84. package/Build/Workers/{chunk-OAOREOSO.js → chunk-KWFCDTXS.js} +9 -9
  85. package/Build/Workers/{chunk-JURLMTV2.js → chunk-LENXRROQ.js} +14 -14
  86. package/Build/Workers/{chunk-BJ6WXQOW.js → chunk-LPJHTJDQ.js} +4 -4
  87. package/Build/Workers/{chunk-AIW5F22O.js → chunk-LRW2QXMW.js} +6 -6
  88. package/Build/Workers/{chunk-EKMWNF4U.js → chunk-MB2ZJQR3.js} +1 -1
  89. package/Build/Workers/{chunk-55IROWAX.js → chunk-MCNY7SPD.js} +5 -5
  90. package/Build/Workers/{chunk-S3AE3MZZ.js → chunk-MHEKNHOF.js} +13 -13
  91. package/Build/Workers/chunk-MRLJERN3.js +114 -0
  92. package/Build/Workers/{chunk-5CSRWY7L.js → chunk-MWN26ZEM.js} +1 -1
  93. package/Build/Workers/{chunk-PLLZB3R4.js → chunk-NIWB6UMY.js} +7 -7
  94. package/Build/Workers/{chunk-MLFVICFZ.js → chunk-NOJAQPXU.js} +4 -4
  95. package/Build/Workers/{chunk-5VZISKJF.js → chunk-O5QH7XD5.js} +1 -1
  96. package/Build/Workers/chunk-OAFZ26QL.js +837 -0
  97. package/Build/Workers/{chunk-AVSQILVI.js → chunk-OBM2JYMG.js} +1 -1
  98. package/Build/Workers/{chunk-245NZYCR.js → chunk-OBQVOEPZ.js} +5 -5
  99. package/Build/Workers/chunk-OC63Z35M.js +280 -0
  100. package/Build/Workers/{chunk-EDIUN7V3.js → chunk-ODZZZGXK.js} +7 -7
  101. package/Build/Workers/chunk-OEAC5XUG.js +73 -0
  102. package/Build/Workers/chunk-OQK27J4J.js +139 -0
  103. package/Build/Workers/{chunk-LN4NMLYY.js → chunk-OTDNJAYJ.js} +1 -1
  104. package/Build/Workers/{chunk-JFO3ELF3.js → chunk-PGYA2CMO.js} +6 -6
  105. package/Build/Workers/{chunk-64W2RXA4.js → chunk-PSDWIJMU.js} +7 -7
  106. package/Build/Workers/chunk-PW3GQAXA.js +3514 -0
  107. package/Build/Workers/chunk-Q2YRPH7V.js +1067 -0
  108. package/Build/Workers/{chunk-KKYQRQ57.js → chunk-QDNIPHD7.js} +12 -12
  109. package/Build/Workers/{chunk-WO5ZNC7S.js → chunk-QEGQDFX2.js} +10 -10
  110. package/Build/Workers/chunk-QY55DT53.js +97 -0
  111. package/Build/Workers/{chunk-BOV6T7FO.js → chunk-R3PTQZ6H.js} +2 -2
  112. package/Build/Workers/chunk-R5U3MYPS.js +198 -0
  113. package/Build/Workers/{chunk-IDVURFRN.js → chunk-RJIH4MDC.js} +8 -8
  114. package/Build/Workers/chunk-RO7SDGOD.js +352 -0
  115. package/Build/Workers/chunk-RT7PY6BH.js +2719 -0
  116. package/Build/Workers/{chunk-KH2OWUUA.js → chunk-RTJ6L5O4.js} +2 -2
  117. package/Build/Workers/{chunk-75UGCVME.js → chunk-SAD42JSM.js} +4 -4
  118. package/Build/Workers/chunk-SCNCHSTQ.js +642 -0
  119. package/Build/Workers/{chunk-U364CIW4.js → chunk-SFM3GNS2.js} +10 -10
  120. package/Build/Workers/{chunk-OFJRMGNX.js → chunk-SG56ZOPD.js} +11 -11
  121. package/Build/Workers/chunk-SHQEATE2.js +1045 -0
  122. package/Build/Workers/{chunk-FVYRV2T6.js → chunk-SLYUIIFB.js} +6 -6
  123. package/Build/Workers/chunk-SPL7JK6K.js +1054 -0
  124. package/Build/Workers/chunk-SQSWONTJ.js +241 -0
  125. package/Build/Workers/chunk-SRLJWNU2.js +368 -0
  126. package/Build/Workers/{chunk-QWV2DM66.js → chunk-SYCWSSRX.js} +4 -4
  127. package/Build/Workers/{chunk-HGIGANIQ.js → chunk-SZELHE7Q.js} +2 -2
  128. package/Build/Workers/{chunk-MQ62ZE2U.js → chunk-TBASKFFL.js} +5 -5
  129. package/Build/Workers/chunk-TDGGEIZE.js +398 -0
  130. package/Build/Workers/{chunk-HAWJ7FMN.js → chunk-TEZGNCXH.js} +8 -8
  131. package/Build/Workers/chunk-TIQZUI5N.js +44 -0
  132. package/Build/Workers/chunk-TKJHRY4V.js +511 -0
  133. package/Build/Workers/{chunk-KHKSE4WQ.js → chunk-TLXEQ5QY.js} +12 -12
  134. package/Build/Workers/chunk-U3VI26GL.js +162 -0
  135. package/Build/Workers/chunk-UIMHSWDJ.js +455 -0
  136. package/Build/Workers/chunk-UO3AWZR3.js +352 -0
  137. package/Build/Workers/{chunk-UOD5YNH3.js → chunk-UTXXZ7XH.js} +9 -9
  138. package/Build/Workers/{chunk-66YGZWBI.js → chunk-V2TRFTCU.js} +7 -7
  139. package/Build/Workers/chunk-V4I3IKAK.js +1460 -0
  140. package/Build/Workers/chunk-VLB25GGE.js +439 -0
  141. package/Build/Workers/{chunk-BN4WA7LX.js → chunk-W2EK42GB.js} +1 -1
  142. package/Build/Workers/chunk-W2OMUTYA.js +1800 -0
  143. package/Build/Workers/{chunk-KQIZ7AFF.js → chunk-W4DV7TAL.js} +8 -8
  144. package/Build/Workers/{chunk-P7M4VYFT.js → chunk-WFTPZ3ZX.js} +11 -11
  145. package/Build/Workers/chunk-WHOEQFL4.js +682 -0
  146. package/Build/Workers/{chunk-X65Y2JSA.js → chunk-WWLWTSMV.js} +1 -1
  147. package/Build/Workers/chunk-WX2ZANQC.js +940 -0
  148. package/Build/Workers/chunk-XFKTM6GN.js +2058 -0
  149. package/Build/Workers/chunk-XHNWVOIJ.js +219 -0
  150. package/Build/Workers/{chunk-DEIMB3B5.js → chunk-XNKQLSHI.js} +1 -1
  151. package/Build/Workers/chunk-XOXF37BU.js +1317 -0
  152. package/Build/Workers/chunk-YC6PFDXQ.js +8366 -0
  153. package/Build/Workers/chunk-YFJB3US4.js +102 -0
  154. package/Build/Workers/chunk-YMXATXRN.js +57 -0
  155. package/Build/Workers/chunk-YVRD2PO5.js +124 -0
  156. package/Build/Workers/chunk-Z24A5EMJ.js +387 -0
  157. package/Build/Workers/chunk-Z4IW5XUY.js +788 -0
  158. package/Build/Workers/chunk-Z5MHVJGN.js +778 -0
  159. package/Build/Workers/chunk-ZFHCP7RN.js +692 -0
  160. package/Build/Workers/{chunk-6H33B6OL.js → chunk-ZHHEFNHL.js} +1 -1
  161. package/Build/Workers/chunk-ZI5GDNEV.js +305 -0
  162. package/Build/Workers/chunk-ZYTMDBCR.js +1443 -0
  163. package/Build/Workers/combineGeometry.js +24 -24
  164. package/Build/Workers/createBoxGeometry.js +18 -18
  165. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  166. package/Build/Workers/createCircleGeometry.js +26 -26
  167. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  168. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  169. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  170. package/Build/Workers/createCorridorGeometry.js +29 -29
  171. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  172. package/Build/Workers/createCylinderGeometry.js +20 -20
  173. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  174. package/Build/Workers/createEllipseGeometry.js +26 -26
  175. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  176. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  177. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  178. package/Build/Workers/createFrustumGeometry.js +18 -18
  179. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  180. package/Build/Workers/createGeometry.js +24 -24
  181. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  182. package/Build/Workers/createPlaneGeometry.js +16 -16
  183. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  184. package/Build/Workers/createPolygonGeometry.js +32 -32
  185. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  186. package/Build/Workers/createPolylineGeometry.js +25 -25
  187. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  188. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  189. package/Build/Workers/createRectangleGeometry.js +27 -27
  190. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  191. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  192. package/Build/Workers/createSphereGeometry.js +19 -19
  193. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  194. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  195. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  196. package/Build/Workers/createVectorTileGeometries.js +24 -24
  197. package/Build/Workers/createVectorTilePoints.js +13 -13
  198. package/Build/Workers/createVectorTilePolygons.js +22 -22
  199. package/Build/Workers/createVectorTilePolylines.js +14 -14
  200. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  201. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  202. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  203. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  204. package/Build/Workers/createWallGeometry.js +24 -24
  205. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  206. package/Build/Workers/decodeDraco.js +10 -10
  207. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  208. package/Build/Workers/decodeI3S.js +10 -10
  209. package/Build/Workers/gaussianSplatSorter.js +4 -4
  210. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  211. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  212. package/Build/Workers/transcodeKTX2.js +6 -6
  213. package/Build/Workers/transferTypedArrayTest.js +1 -1
  214. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  215. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  216. package/Source/Scene/Cesium3DTileset.js +4121 -3932
  217. package/Source/Scene/Model/BarycentricWireframePipelineStage.js +355 -0
  218. package/Source/Scene/Model/Model.js +3584 -3340
  219. package/Source/Scene/Model/Model3DTileContent.js +568 -551
  220. package/Source/Scene/Model/ModelRuntimePrimitive.js +391 -380
  221. package/Source/Scene/Model/WireframePipelineStage.js +122 -118
  222. package/Source/Shaders/Model/ModelFS.glsl +14 -0
  223. package/Source/Shaders/Model/ModelFS.js +14 -0
  224. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  225. package/Source/Shaders/Model/ModelVS.js +4 -0
  226. package/index.d.ts +891 -697
  227. package/index.js +3 -2
  228. package/package.json +1 -1
@@ -1,551 +1,568 @@
1
- import Color from "../../Core/Color.js";
2
- import combine from "../../Core/combine.js";
3
- import defined from "../../Core/defined.js";
4
- import destroyObject from "../../Core/destroyObject.js";
5
- import DeveloperError from "../../Core/DeveloperError.js";
6
- import Ellipsoid from "../../Core/Ellipsoid.js";
7
- import Pass from "../../Renderer/Pass.js";
8
- import ModelAnimationLoop from "../ModelAnimationLoop.js";
9
- import Model from "./Model.js";
10
-
11
- /**
12
- * Represents the contents of a glTF, glb or
13
- * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel|Batched 3D Model}
14
- * tile in a {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification|3D Tiles} tileset.
15
- * <p>
16
- * Implements the {@link Cesium3DTileContent} interface.
17
- * </p>
18
- * This object is normally not instantiated directly, use {@link Model3DTileContent.fromGltf}, {@link Model3DTileContent.fromB3dm}, {@link Model3DTileContent.fromI3dm}, {@link Model3DTileContent.fromPnts}, or {@link Model3DTileContent.fromGeoJson}.
19
- *
20
- * @alias Model3DTileContent
21
- * @constructor
22
- * @private
23
- */
24
- function Model3DTileContent(tileset, tile, resource) {
25
- this._tileset = tileset;
26
- this._tile = tile;
27
- this._resource = resource;
28
-
29
- this._model = undefined;
30
- this._metadata = undefined;
31
- this._group = undefined;
32
- this._ready = false;
33
- }
34
-
35
- Object.defineProperties(Model3DTileContent.prototype, {
36
- featuresLength: {
37
- get: function () {
38
- const model = this._model;
39
- const featureTables = model.featureTables;
40
- const featureTableId = model.featureTableId;
41
-
42
- if (defined(featureTables) && defined(featureTables[featureTableId])) {
43
- return featureTables[featureTableId].featuresLength;
44
- }
45
-
46
- return 0;
47
- },
48
- },
49
-
50
- pointsLength: {
51
- get: function () {
52
- return this._model.statistics.pointsLength;
53
- },
54
- },
55
-
56
- trianglesLength: {
57
- get: function () {
58
- return this._model.statistics.trianglesLength;
59
- },
60
- },
61
-
62
- geometryByteLength: {
63
- get: function () {
64
- return this._model.statistics.geometryByteLength;
65
- },
66
- },
67
-
68
- texturesByteLength: {
69
- get: function () {
70
- return this._model.statistics.texturesByteLength;
71
- },
72
- },
73
-
74
- batchTableByteLength: {
75
- get: function () {
76
- const statistics = this._model.statistics;
77
- return (
78
- statistics.propertyTablesByteLength + statistics.batchTexturesByteLength
79
- );
80
- },
81
- },
82
-
83
- innerContents: {
84
- get: function () {
85
- return undefined;
86
- },
87
- },
88
-
89
- /**
90
- * Returns true when the tile's content is ready to render; otherwise false
91
- *
92
- * @memberof Model3DTileContent.prototype
93
- *
94
- * @type {boolean}
95
- * @readonly
96
- * @private
97
- */
98
- ready: {
99
- get: function () {
100
- return this._ready;
101
- },
102
- },
103
-
104
- tileset: {
105
- get: function () {
106
- return this._tileset;
107
- },
108
- },
109
-
110
- tile: {
111
- get: function () {
112
- return this._tile;
113
- },
114
- },
115
-
116
- url: {
117
- get: function () {
118
- return this._resource.getUrlComponent(true);
119
- },
120
- },
121
-
122
- batchTable: {
123
- get: function () {
124
- const model = this._model;
125
- const featureTables = model.featureTables;
126
- const featureTableId = model.featureTableId;
127
-
128
- if (defined(featureTables) && defined(featureTables[featureTableId])) {
129
- return featureTables[featureTableId];
130
- }
131
-
132
- return undefined;
133
- },
134
- },
135
-
136
- metadata: {
137
- get: function () {
138
- return this._metadata;
139
- },
140
- set: function (value) {
141
- this._metadata = value;
142
- },
143
- },
144
-
145
- group: {
146
- get: function () {
147
- return this._group;
148
- },
149
- set: function (value) {
150
- this._group = value;
151
- },
152
- },
153
- });
154
-
155
- /**
156
- * Returns an array containing the `texture.id` values for all textures
157
- * that are part of this content.
158
- *
159
- * @returns {string[]} The texture IDs
160
- */
161
- Model3DTileContent.prototype.getTextureIds = function () {
162
- return this._model.statistics.getTextureIds();
163
- };
164
-
165
- /**
166
- * Returns the length, in bytes, of the texture data for the texture with
167
- * the given ID that is part of this content, or `undefined` if this
168
- * content does not contain the texture with the given ID.
169
- *
170
- * @param {string} textureId The texture ID
171
- * @returns {number|undefined} The texture byte length
172
- */
173
- Model3DTileContent.prototype.getTextureByteLengthById = function (textureId) {
174
- return this._model.statistics.getTextureByteLengthById(textureId);
175
- };
176
-
177
- /**
178
- * Returns the object that was created for the given extension.
179
- *
180
- * The given name may be the name of a glTF extension, like `"EXT_example_extension"`.
181
- * If the specified extension was present in the root of the underlying glTF asset,
182
- * and a loader for the specified extension has processed the extension data, then
183
- * this will return the model representation of the extension.
184
- *
185
- * @param {string} extensionName The name of the extension
186
- * @returns {object|undefined} The object, or `undefined`
187
- *
188
- * @private
189
- */
190
- Model3DTileContent.prototype.getExtension = function (extensionName) {
191
- const model = this._model;
192
- const extension = model.getExtension(extensionName);
193
- return extension;
194
- };
195
-
196
- Model3DTileContent.prototype.getFeature = function (featureId) {
197
- const model = this._model;
198
- const featureTableId = model.featureTableId;
199
-
200
- //>>includeStart('debug', pragmas.debug);
201
- if (!defined(featureTableId)) {
202
- throw new DeveloperError(
203
- "No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined",
204
- );
205
- }
206
- //>>includeEnd('debug');
207
-
208
- const featureTable = model.featureTables[featureTableId];
209
-
210
- //>>includeStart('debug', pragmas.debug);
211
- if (!defined(featureTable)) {
212
- throw new DeveloperError(
213
- "No feature table found for the selected feature ID set",
214
- );
215
- }
216
- //>>includeEnd('debug');
217
-
218
- //>>includeStart('debug', pragmas.debug);
219
- const featuresLength = featureTable.featuresLength;
220
- if (!defined(featureId) || featureId < 0 || featureId >= featuresLength) {
221
- throw new DeveloperError(
222
- `featureId is required and must be between 0 and featuresLength - 1 (${
223
- featuresLength - 1
224
- }).`,
225
- );
226
- }
227
- //>>includeEnd('debug');
228
- return featureTable.getFeature(featureId);
229
- };
230
-
231
- Model3DTileContent.prototype.hasProperty = function (featureId, name) {
232
- const model = this._model;
233
- const featureTableId = model.featureTableId;
234
- if (!defined(featureTableId)) {
235
- return false;
236
- }
237
-
238
- const featureTable = model.featureTables[featureTableId];
239
- return featureTable.hasProperty(featureId, name);
240
- };
241
-
242
- Model3DTileContent.prototype.applyDebugSettings = function (enabled, color) {
243
- color = enabled ? color : Color.WHITE;
244
- if (this.featuresLength === 0) {
245
- this._model.color = color;
246
- } else if (defined(this.batchTable)) {
247
- this.batchTable.setAllColor(color);
248
- }
249
- };
250
-
251
- Model3DTileContent.prototype.applyStyle = function (style) {
252
- // the setter will call model.applyStyle()
253
- this._model.style = style;
254
- };
255
-
256
- Model3DTileContent.prototype.update = function (tileset, frameState) {
257
- const model = this._model;
258
- const tile = this._tile;
259
-
260
- model.colorBlendAmount = tileset.colorBlendAmount;
261
- model.colorBlendMode = tileset.colorBlendMode;
262
- model.modelMatrix = tile.computedTransform;
263
- model.customShader = tileset.customShader;
264
- model.featureIdLabel = tileset.featureIdLabel;
265
- model.instanceFeatureIdLabel = tileset.instanceFeatureIdLabel;
266
- model.lightColor = tileset.lightColor;
267
- model.imageBasedLighting = tileset.imageBasedLighting;
268
- model.backFaceCulling = tileset.backFaceCulling;
269
- model.shadows = tileset.shadows;
270
- model.showCreditsOnScreen = tileset.showCreditsOnScreen;
271
- model.splitDirection = tileset.splitDirection;
272
- model.debugWireframe = tileset.debugWireframe;
273
- model.showOutline = tileset.showOutline;
274
- model.outlineColor = tileset.outlineColor;
275
- model.pointCloudShading = tileset.pointCloudShading;
276
-
277
- // Updating clipping planes requires more effort because of ownership checks
278
- const tilesetClippingPlanes = tileset.clippingPlanes;
279
- model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
280
- if (defined(tilesetClippingPlanes) && tile.clippingPlanesDirty) {
281
- // Dereference the clipping planes from the model if they are irrelevant.
282
- model._clippingPlanes =
283
- tilesetClippingPlanes.enabled && tile._isClipped
284
- ? tilesetClippingPlanes
285
- : undefined;
286
- }
287
-
288
- const tilesetEnvironmentMapManager = tileset.environmentMapManager;
289
- if (model.environmentMapManager !== tilesetClippingPlanes) {
290
- model._environmentMapManager = tilesetEnvironmentMapManager;
291
- }
292
-
293
- // If the model references a different ClippingPlaneCollection from the tileset,
294
- // update the model to use the new ClippingPlaneCollection.
295
- if (
296
- defined(tilesetClippingPlanes) &&
297
- defined(model._clippingPlanes) &&
298
- model._clippingPlanes !== tilesetClippingPlanes
299
- ) {
300
- model._clippingPlanes = tilesetClippingPlanes;
301
- model._clippingPlanesState = 0;
302
- }
303
-
304
- // Updating clipping polygons requires more effort because of ownership checks
305
- const tilesetClippingPolygons = tileset.clippingPolygons;
306
- if (defined(tilesetClippingPolygons) && tile.clippingPolygonsDirty) {
307
- // Dereference the clipping polygons from the model if they are irrelevant.
308
- model._clippingPolygons =
309
- tilesetClippingPolygons.enabled && tile._isClippedByPolygon
310
- ? tilesetClippingPolygons
311
- : undefined;
312
- }
313
-
314
- // If the model references a different ClippingPolygonCollection from the tileset,
315
- // update the model to use the new ClippingPolygonCollection.
316
- if (
317
- defined(tilesetClippingPolygons) &&
318
- defined(model._clippingPolygons) &&
319
- model._clippingPolygons !== tilesetClippingPolygons
320
- ) {
321
- model._clippingPolygons = tilesetClippingPolygons;
322
- model._clippingPolygonsState = 0;
323
- }
324
-
325
- model.update(frameState);
326
-
327
- if (!this._ready && model.ready) {
328
- // Animation can only be added once the model is ready
329
- model.activeAnimations.addAll({
330
- loop: ModelAnimationLoop.REPEAT,
331
- });
332
-
333
- this._ready = true;
334
- }
335
- };
336
-
337
- Model3DTileContent.prototype.isDestroyed = function () {
338
- return false;
339
- };
340
-
341
- Model3DTileContent.prototype.destroy = function () {
342
- this._model = this._model && this._model.destroy();
343
- return destroyObject(this);
344
- };
345
-
346
- Model3DTileContent.fromGltf = async function (tileset, tile, resource, gltf) {
347
- const content = new Model3DTileContent(tileset, tile, resource);
348
-
349
- const additionalOptions = {
350
- gltf: gltf,
351
- basePath: resource,
352
- };
353
-
354
- const modelOptions = makeModelOptions(
355
- tileset,
356
- tile,
357
- content,
358
- additionalOptions,
359
- );
360
-
361
- const classificationType = tileset.vectorClassificationOnly
362
- ? undefined
363
- : tileset.classificationType;
364
-
365
- modelOptions.classificationType = classificationType;
366
-
367
- const model = await Model.fromGltfAsync(modelOptions);
368
- content._model = model;
369
-
370
- return content;
371
- };
372
-
373
- Model3DTileContent.fromB3dm = async function (
374
- tileset,
375
- tile,
376
- resource,
377
- arrayBuffer,
378
- byteOffset,
379
- ) {
380
- const content = new Model3DTileContent(tileset, tile, resource);
381
-
382
- const additionalOptions = {
383
- arrayBuffer: arrayBuffer,
384
- byteOffset: byteOffset,
385
- resource: resource,
386
- };
387
-
388
- const modelOptions = makeModelOptions(
389
- tileset,
390
- tile,
391
- content,
392
- additionalOptions,
393
- );
394
-
395
- const classificationType = tileset.vectorClassificationOnly
396
- ? undefined
397
- : tileset.classificationType;
398
-
399
- modelOptions.classificationType = classificationType;
400
-
401
- const model = await Model.fromB3dm(modelOptions);
402
- content._model = model;
403
-
404
- return content;
405
- };
406
-
407
- Model3DTileContent.fromI3dm = async function (
408
- tileset,
409
- tile,
410
- resource,
411
- arrayBuffer,
412
- byteOffset,
413
- ) {
414
- const content = new Model3DTileContent(tileset, tile, resource);
415
-
416
- const additionalOptions = {
417
- arrayBuffer: arrayBuffer,
418
- byteOffset: byteOffset,
419
- resource: resource,
420
- };
421
-
422
- const modelOptions = makeModelOptions(
423
- tileset,
424
- tile,
425
- content,
426
- additionalOptions,
427
- );
428
-
429
- const model = await Model.fromI3dm(modelOptions);
430
- content._model = model;
431
-
432
- return content;
433
- };
434
-
435
- Model3DTileContent.fromPnts = async function (
436
- tileset,
437
- tile,
438
- resource,
439
- arrayBuffer,
440
- byteOffset,
441
- ) {
442
- const content = new Model3DTileContent(tileset, tile, resource);
443
-
444
- const additionalOptions = {
445
- arrayBuffer: arrayBuffer,
446
- byteOffset: byteOffset,
447
- resource: resource,
448
- };
449
-
450
- const modelOptions = makeModelOptions(
451
- tileset,
452
- tile,
453
- content,
454
- additionalOptions,
455
- );
456
- const model = await Model.fromPnts(modelOptions);
457
- content._model = model;
458
-
459
- return content;
460
- };
461
-
462
- Model3DTileContent.fromGeoJson = async function (
463
- tileset,
464
- tile,
465
- resource,
466
- geoJson,
467
- ) {
468
- const content = new Model3DTileContent(tileset, tile, resource);
469
-
470
- const additionalOptions = {
471
- geoJson: geoJson,
472
- resource: resource,
473
- };
474
-
475
- const modelOptions = makeModelOptions(
476
- tileset,
477
- tile,
478
- content,
479
- additionalOptions,
480
- );
481
- const model = await Model.fromGeoJson(modelOptions);
482
- content._model = model;
483
-
484
- return content;
485
- };
486
-
487
- /**
488
- * Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
489
- *
490
- * @param {Ray} ray The ray to test for intersection.
491
- * @param {FrameState} frameState The frame state.
492
- * @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
493
- * @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
494
- *
495
- * @private
496
- */
497
- Model3DTileContent.prototype.pick = function (ray, frameState, result) {
498
- if (!defined(this._model) || !this._ready) {
499
- return undefined;
500
- }
501
-
502
- const verticalExaggeration = frameState.verticalExaggeration;
503
- const relativeHeight = frameState.verticalExaggerationRelativeHeight;
504
-
505
- // All tilesets assume a WGS84 ellipsoid
506
- return this._model.pick(
507
- ray,
508
- frameState,
509
- verticalExaggeration,
510
- relativeHeight,
511
- Ellipsoid.WGS84,
512
- result,
513
- );
514
- };
515
-
516
- function makeModelOptions(tileset, tile, content, additionalOptions) {
517
- const mainOptions = {
518
- cull: false, // The model is already culled by 3D Tiles
519
- releaseGltfJson: true, // Models are unique and will not benefit from caching so save memory
520
- opaquePass: Pass.CESIUM_3D_TILE, // Draw opaque portions of the model during the 3D Tiles pass
521
- modelMatrix: tile.computedTransform,
522
- upAxis: tileset._modelUpAxis,
523
- forwardAxis: tileset._modelForwardAxis,
524
- incrementallyLoadTextures: false,
525
- customShader: tileset.customShader,
526
- content: content,
527
- colorBlendMode: tileset.colorBlendMode,
528
- colorBlendAmount: tileset.colorBlendAmount,
529
- lightColor: tileset.lightColor,
530
- imageBasedLighting: tileset.imageBasedLighting,
531
- featureIdLabel: tileset.featureIdLabel,
532
- instanceFeatureIdLabel: tileset.instanceFeatureIdLabel,
533
- pointCloudShading: tileset.pointCloudShading,
534
- clippingPlanes: tileset.clippingPlanes,
535
- backFaceCulling: tileset.backFaceCulling,
536
- shadows: tileset.shadows,
537
- showCreditsOnScreen: tileset.showCreditsOnScreen,
538
- splitDirection: tileset.splitDirection,
539
- enableDebugWireframe: tileset._enableDebugWireframe,
540
- debugWireframe: tileset.debugWireframe,
541
- projectTo2D: tileset._projectTo2D,
542
- enablePick: tileset._enablePick,
543
- enableShowOutline: tileset._enableShowOutline,
544
- showOutline: tileset.showOutline,
545
- outlineColor: tileset.outlineColor,
546
- };
547
-
548
- return combine(additionalOptions, mainOptions);
549
- }
550
-
551
- export default Model3DTileContent;
1
+ import Color from "../../Core/Color.js";
2
+ import combine from "../../Core/combine.js";
3
+ import defined from "../../Core/defined.js";
4
+ import destroyObject from "../../Core/destroyObject.js";
5
+ import DeveloperError from "../../Core/DeveloperError.js";
6
+ import Ellipsoid from "../../Core/Ellipsoid.js";
7
+ import Pass from "../../Renderer/Pass.js";
8
+ import ModelAnimationLoop from "../ModelAnimationLoop.js";
9
+ import Model from "./Model.js";
10
+
11
+ /**
12
+ * Represents the contents of a glTF, glb or
13
+ * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel|Batched 3D Model}
14
+ * tile in a {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification|3D Tiles} tileset.
15
+ * <p>
16
+ * Implements the {@link Cesium3DTileContent} interface.
17
+ * </p>
18
+ * This object is normally not instantiated directly, use {@link Model3DTileContent.fromGltf}, {@link Model3DTileContent.fromB3dm}, {@link Model3DTileContent.fromI3dm}, {@link Model3DTileContent.fromPnts}, or {@link Model3DTileContent.fromGeoJson}.
19
+ *
20
+ * @alias Model3DTileContent
21
+ * @constructor
22
+ * @private
23
+ */
24
+ function Model3DTileContent(tileset, tile, resource) {
25
+ this._tileset = tileset;
26
+ this._tile = tile;
27
+ this._resource = resource;
28
+
29
+ this._model = undefined;
30
+ this._metadata = undefined;
31
+ this._group = undefined;
32
+ this._ready = false;
33
+ }
34
+
35
+ Object.defineProperties(Model3DTileContent.prototype, {
36
+ featuresLength: {
37
+ get: function () {
38
+ const model = this._model;
39
+ const featureTables = model.featureTables;
40
+ const featureTableId = model.featureTableId;
41
+
42
+ if (defined(featureTables) && defined(featureTables[featureTableId])) {
43
+ return featureTables[featureTableId].featuresLength;
44
+ }
45
+
46
+ return 0;
47
+ },
48
+ },
49
+
50
+ pointsLength: {
51
+ get: function () {
52
+ return this._model.statistics.pointsLength;
53
+ },
54
+ },
55
+
56
+ trianglesLength: {
57
+ get: function () {
58
+ return this._model.statistics.trianglesLength;
59
+ },
60
+ },
61
+
62
+ geometryByteLength: {
63
+ get: function () {
64
+ return this._model.statistics.geometryByteLength;
65
+ },
66
+ },
67
+
68
+ texturesByteLength: {
69
+ get: function () {
70
+ return this._model.statistics.texturesByteLength;
71
+ },
72
+ },
73
+
74
+ batchTableByteLength: {
75
+ get: function () {
76
+ const statistics = this._model.statistics;
77
+ return (
78
+ statistics.propertyTablesByteLength + statistics.batchTexturesByteLength
79
+ );
80
+ },
81
+ },
82
+
83
+ innerContents: {
84
+ get: function () {
85
+ return undefined;
86
+ },
87
+ },
88
+
89
+ /**
90
+ * Returns true when the tile's content is ready to render; otherwise false
91
+ *
92
+ * @memberof Model3DTileContent.prototype
93
+ *
94
+ * @type {boolean}
95
+ * @readonly
96
+ * @private
97
+ */
98
+ ready: {
99
+ get: function () {
100
+ return this._ready;
101
+ },
102
+ },
103
+
104
+ tileset: {
105
+ get: function () {
106
+ return this._tileset;
107
+ },
108
+ },
109
+
110
+ tile: {
111
+ get: function () {
112
+ return this._tile;
113
+ },
114
+ },
115
+
116
+ url: {
117
+ get: function () {
118
+ return this._resource.getUrlComponent(true);
119
+ },
120
+ },
121
+
122
+ batchTable: {
123
+ get: function () {
124
+ const model = this._model;
125
+ const featureTables = model.featureTables;
126
+ const featureTableId = model.featureTableId;
127
+
128
+ if (defined(featureTables) && defined(featureTables[featureTableId])) {
129
+ return featureTables[featureTableId];
130
+ }
131
+
132
+ return undefined;
133
+ },
134
+ },
135
+
136
+ metadata: {
137
+ get: function () {
138
+ return this._metadata;
139
+ },
140
+ set: function (value) {
141
+ this._metadata = value;
142
+ },
143
+ },
144
+
145
+ group: {
146
+ get: function () {
147
+ return this._group;
148
+ },
149
+ set: function (value) {
150
+ this._group = value;
151
+ },
152
+ },
153
+ });
154
+
155
+ /**
156
+ * Returns an array containing the `texture.id` values for all textures
157
+ * that are part of this content.
158
+ *
159
+ * @returns {string[]} The texture IDs
160
+ */
161
+ Model3DTileContent.prototype.getTextureIds = function () {
162
+ return this._model.statistics.getTextureIds();
163
+ };
164
+
165
+ /**
166
+ * Returns the length, in bytes, of the texture data for the texture with
167
+ * the given ID that is part of this content, or `undefined` if this
168
+ * content does not contain the texture with the given ID.
169
+ *
170
+ * @param {string} textureId The texture ID
171
+ * @returns {number|undefined} The texture byte length
172
+ */
173
+ Model3DTileContent.prototype.getTextureByteLengthById = function (textureId) {
174
+ return this._model.statistics.getTextureByteLengthById(textureId);
175
+ };
176
+
177
+ /**
178
+ * Returns the object that was created for the given extension.
179
+ *
180
+ * The given name may be the name of a glTF extension, like `"EXT_example_extension"`.
181
+ * If the specified extension was present in the root of the underlying glTF asset,
182
+ * and a loader for the specified extension has processed the extension data, then
183
+ * this will return the model representation of the extension.
184
+ *
185
+ * @param {string} extensionName The name of the extension
186
+ * @returns {object|undefined} The object, or `undefined`
187
+ *
188
+ * @private
189
+ */
190
+ Model3DTileContent.prototype.getExtension = function (extensionName) {
191
+ const model = this._model;
192
+ const extension = model.getExtension(extensionName);
193
+ return extension;
194
+ };
195
+
196
+ Model3DTileContent.prototype.getFeature = function (featureId) {
197
+ const model = this._model;
198
+ const featureTableId = model.featureTableId;
199
+
200
+ //>>includeStart('debug', pragmas.debug);
201
+ if (!defined(featureTableId)) {
202
+ throw new DeveloperError(
203
+ "No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined",
204
+ );
205
+ }
206
+ //>>includeEnd('debug');
207
+
208
+ const featureTable = model.featureTables[featureTableId];
209
+
210
+ //>>includeStart('debug', pragmas.debug);
211
+ if (!defined(featureTable)) {
212
+ throw new DeveloperError(
213
+ "No feature table found for the selected feature ID set",
214
+ );
215
+ }
216
+ //>>includeEnd('debug');
217
+
218
+ //>>includeStart('debug', pragmas.debug);
219
+ const featuresLength = featureTable.featuresLength;
220
+ if (!defined(featureId) || featureId < 0 || featureId >= featuresLength) {
221
+ throw new DeveloperError(
222
+ `featureId is required and must be between 0 and featuresLength - 1 (${
223
+ featuresLength - 1
224
+ }).`,
225
+ );
226
+ }
227
+ //>>includeEnd('debug');
228
+ return featureTable.getFeature(featureId);
229
+ };
230
+
231
+ Model3DTileContent.prototype.hasProperty = function (featureId, name) {
232
+ const model = this._model;
233
+ const featureTableId = model.featureTableId;
234
+ if (!defined(featureTableId)) {
235
+ return false;
236
+ }
237
+
238
+ const featureTable = model.featureTables[featureTableId];
239
+ return featureTable.hasProperty(featureId, name);
240
+ };
241
+
242
+ Model3DTileContent.prototype.applyDebugSettings = function (enabled, color) {
243
+ color = enabled ? color : Color.WHITE;
244
+ if (this.featuresLength === 0) {
245
+ this._model.color = color;
246
+ } else if (defined(this.batchTable)) {
247
+ this.batchTable.setAllColor(color);
248
+ }
249
+ };
250
+
251
+ Model3DTileContent.prototype.applyStyle = function (style) {
252
+ // the setter will call model.applyStyle()
253
+ this._model.style = style;
254
+ };
255
+
256
+ Model3DTileContent.prototype.update = function (tileset, frameState) {
257
+ const model = this._model;
258
+ const tile = this._tile;
259
+
260
+ model.colorBlendAmount = tileset.colorBlendAmount;
261
+ model.colorBlendMode = tileset.colorBlendMode;
262
+ model.modelMatrix = tile.computedTransform;
263
+ model.customShader = tileset.customShader;
264
+ model.featureIdLabel = tileset.featureIdLabel;
265
+ model.instanceFeatureIdLabel = tileset.instanceFeatureIdLabel;
266
+ model.lightColor = tileset.lightColor;
267
+ model.imageBasedLighting = tileset.imageBasedLighting;
268
+ model.backFaceCulling = tileset.backFaceCulling;
269
+ model.shadows = tileset.shadows;
270
+ model.showCreditsOnScreen = tileset.showCreditsOnScreen;
271
+ model.splitDirection = tileset.splitDirection;
272
+ model.debugWireframe = tileset.debugWireframe;
273
+ model.debugWireframeColor = tileset._debugWireframeColor;
274
+ model.debugWireframeFillAlpha = tileset._debugWireframeFillAlpha;
275
+ model.debugWireframeLineWidth = tileset.debugWireframeLineWidth;
276
+ model.debugWireframeMode = tileset.debugWireframeMode;
277
+ model.debugWireframeOverlay = tileset.debugWireframeOverlay;
278
+ model.showOutline = tileset.showOutline;
279
+ model.outlineColor = tileset.outlineColor;
280
+ model.pointCloudShading = tileset.pointCloudShading;
281
+
282
+ if (tileset.debugWireframe && defined(tileset._debugWireframeFillColor)) {
283
+ const fillColor = Color.clone(tileset._debugWireframeFillColor);
284
+ fillColor.alpha = tileset._debugWireframeFillAlpha;
285
+ model.color = fillColor;
286
+ model.colorBlendMode = tileset.colorBlendMode;
287
+ }
288
+
289
+ // Updating clipping planes requires more effort because of ownership checks
290
+ const tilesetClippingPlanes = tileset.clippingPlanes;
291
+ model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
292
+ if (defined(tilesetClippingPlanes) && tile.clippingPlanesDirty) {
293
+ // Dereference the clipping planes from the model if they are irrelevant.
294
+ model._clippingPlanes =
295
+ tilesetClippingPlanes.enabled && tile._isClipped
296
+ ? tilesetClippingPlanes
297
+ : undefined;
298
+ }
299
+
300
+ const tilesetEnvironmentMapManager = tileset.environmentMapManager;
301
+ if (model.environmentMapManager !== tilesetClippingPlanes) {
302
+ model._environmentMapManager = tilesetEnvironmentMapManager;
303
+ }
304
+
305
+ // If the model references a different ClippingPlaneCollection from the tileset,
306
+ // update the model to use the new ClippingPlaneCollection.
307
+ if (
308
+ defined(tilesetClippingPlanes) &&
309
+ defined(model._clippingPlanes) &&
310
+ model._clippingPlanes !== tilesetClippingPlanes
311
+ ) {
312
+ model._clippingPlanes = tilesetClippingPlanes;
313
+ model._clippingPlanesState = 0;
314
+ }
315
+
316
+ // Updating clipping polygons requires more effort because of ownership checks
317
+ const tilesetClippingPolygons = tileset.clippingPolygons;
318
+ if (defined(tilesetClippingPolygons) && tile.clippingPolygonsDirty) {
319
+ // Dereference the clipping polygons from the model if they are irrelevant.
320
+ model._clippingPolygons =
321
+ tilesetClippingPolygons.enabled && tile._isClippedByPolygon
322
+ ? tilesetClippingPolygons
323
+ : undefined;
324
+ }
325
+
326
+ // If the model references a different ClippingPolygonCollection from the tileset,
327
+ // update the model to use the new ClippingPolygonCollection.
328
+ if (
329
+ defined(tilesetClippingPolygons) &&
330
+ defined(model._clippingPolygons) &&
331
+ model._clippingPolygons !== tilesetClippingPolygons
332
+ ) {
333
+ model._clippingPolygons = tilesetClippingPolygons;
334
+ model._clippingPolygonsState = 0;
335
+ }
336
+
337
+ model.update(frameState);
338
+
339
+ if (!this._ready && model.ready) {
340
+ // Animation can only be added once the model is ready
341
+ model.activeAnimations.addAll({
342
+ loop: ModelAnimationLoop.REPEAT,
343
+ });
344
+
345
+ this._ready = true;
346
+ }
347
+ };
348
+
349
+ Model3DTileContent.prototype.isDestroyed = function () {
350
+ return false;
351
+ };
352
+
353
+ Model3DTileContent.prototype.destroy = function () {
354
+ this._model = this._model && this._model.destroy();
355
+ return destroyObject(this);
356
+ };
357
+
358
+ Model3DTileContent.fromGltf = async function (tileset, tile, resource, gltf) {
359
+ const content = new Model3DTileContent(tileset, tile, resource);
360
+
361
+ const additionalOptions = {
362
+ gltf: gltf,
363
+ basePath: resource,
364
+ };
365
+
366
+ const modelOptions = makeModelOptions(
367
+ tileset,
368
+ tile,
369
+ content,
370
+ additionalOptions,
371
+ );
372
+
373
+ const classificationType = tileset.vectorClassificationOnly
374
+ ? undefined
375
+ : tileset.classificationType;
376
+
377
+ modelOptions.classificationType = classificationType;
378
+
379
+ const model = await Model.fromGltfAsync(modelOptions);
380
+ content._model = model;
381
+
382
+ return content;
383
+ };
384
+
385
+ Model3DTileContent.fromB3dm = async function (
386
+ tileset,
387
+ tile,
388
+ resource,
389
+ arrayBuffer,
390
+ byteOffset,
391
+ ) {
392
+ const content = new Model3DTileContent(tileset, tile, resource);
393
+
394
+ const additionalOptions = {
395
+ arrayBuffer: arrayBuffer,
396
+ byteOffset: byteOffset,
397
+ resource: resource,
398
+ };
399
+
400
+ const modelOptions = makeModelOptions(
401
+ tileset,
402
+ tile,
403
+ content,
404
+ additionalOptions,
405
+ );
406
+
407
+ const classificationType = tileset.vectorClassificationOnly
408
+ ? undefined
409
+ : tileset.classificationType;
410
+
411
+ modelOptions.classificationType = classificationType;
412
+
413
+ const model = await Model.fromB3dm(modelOptions);
414
+ content._model = model;
415
+
416
+ return content;
417
+ };
418
+
419
+ Model3DTileContent.fromI3dm = async function (
420
+ tileset,
421
+ tile,
422
+ resource,
423
+ arrayBuffer,
424
+ byteOffset,
425
+ ) {
426
+ const content = new Model3DTileContent(tileset, tile, resource);
427
+
428
+ const additionalOptions = {
429
+ arrayBuffer: arrayBuffer,
430
+ byteOffset: byteOffset,
431
+ resource: resource,
432
+ };
433
+
434
+ const modelOptions = makeModelOptions(
435
+ tileset,
436
+ tile,
437
+ content,
438
+ additionalOptions,
439
+ );
440
+
441
+ const model = await Model.fromI3dm(modelOptions);
442
+ content._model = model;
443
+
444
+ return content;
445
+ };
446
+
447
+ Model3DTileContent.fromPnts = async function (
448
+ tileset,
449
+ tile,
450
+ resource,
451
+ arrayBuffer,
452
+ byteOffset,
453
+ ) {
454
+ const content = new Model3DTileContent(tileset, tile, resource);
455
+
456
+ const additionalOptions = {
457
+ arrayBuffer: arrayBuffer,
458
+ byteOffset: byteOffset,
459
+ resource: resource,
460
+ };
461
+
462
+ const modelOptions = makeModelOptions(
463
+ tileset,
464
+ tile,
465
+ content,
466
+ additionalOptions,
467
+ );
468
+ const model = await Model.fromPnts(modelOptions);
469
+ content._model = model;
470
+
471
+ return content;
472
+ };
473
+
474
+ Model3DTileContent.fromGeoJson = async function (
475
+ tileset,
476
+ tile,
477
+ resource,
478
+ geoJson,
479
+ ) {
480
+ const content = new Model3DTileContent(tileset, tile, resource);
481
+
482
+ const additionalOptions = {
483
+ geoJson: geoJson,
484
+ resource: resource,
485
+ };
486
+
487
+ const modelOptions = makeModelOptions(
488
+ tileset,
489
+ tile,
490
+ content,
491
+ additionalOptions,
492
+ );
493
+ const model = await Model.fromGeoJson(modelOptions);
494
+ content._model = model;
495
+
496
+ return content;
497
+ };
498
+
499
+ /**
500
+ * Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
501
+ *
502
+ * @param {Ray} ray The ray to test for intersection.
503
+ * @param {FrameState} frameState The frame state.
504
+ * @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
505
+ * @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
506
+ *
507
+ * @private
508
+ */
509
+ Model3DTileContent.prototype.pick = function (ray, frameState, result) {
510
+ if (!defined(this._model) || !this._ready) {
511
+ return undefined;
512
+ }
513
+
514
+ const verticalExaggeration = frameState.verticalExaggeration;
515
+ const relativeHeight = frameState.verticalExaggerationRelativeHeight;
516
+
517
+ // All tilesets assume a WGS84 ellipsoid
518
+ return this._model.pick(
519
+ ray,
520
+ frameState,
521
+ verticalExaggeration,
522
+ relativeHeight,
523
+ Ellipsoid.WGS84,
524
+ result,
525
+ );
526
+ };
527
+
528
+ function makeModelOptions(tileset, tile, content, additionalOptions) {
529
+ const mainOptions = {
530
+ cull: false, // The model is already culled by 3D Tiles
531
+ releaseGltfJson: true, // Models are unique and will not benefit from caching so save memory
532
+ opaquePass: Pass.CESIUM_3D_TILE, // Draw opaque portions of the model during the 3D Tiles pass
533
+ modelMatrix: tile.computedTransform,
534
+ upAxis: tileset._modelUpAxis,
535
+ forwardAxis: tileset._modelForwardAxis,
536
+ incrementallyLoadTextures: false,
537
+ customShader: tileset.customShader,
538
+ content: content,
539
+ colorBlendMode: tileset.colorBlendMode,
540
+ colorBlendAmount: tileset.colorBlendAmount,
541
+ lightColor: tileset.lightColor,
542
+ imageBasedLighting: tileset.imageBasedLighting,
543
+ featureIdLabel: tileset.featureIdLabel,
544
+ instanceFeatureIdLabel: tileset.instanceFeatureIdLabel,
545
+ pointCloudShading: tileset.pointCloudShading,
546
+ clippingPlanes: tileset.clippingPlanes,
547
+ backFaceCulling: tileset.backFaceCulling,
548
+ shadows: tileset.shadows,
549
+ showCreditsOnScreen: tileset.showCreditsOnScreen,
550
+ splitDirection: tileset.splitDirection,
551
+ enableDebugWireframe: tileset._enableDebugWireframe,
552
+ debugWireframe: tileset.debugWireframe,
553
+ debugWireframeColor: tileset._debugWireframeColor,
554
+ debugWireframeFillAlpha: tileset._debugWireframeFillAlpha,
555
+ debugWireframeLineWidth: tileset.debugWireframeLineWidth,
556
+ debugWireframeMode: tileset.debugWireframeMode,
557
+ debugWireframeOverlay: tileset.debugWireframeOverlay,
558
+ projectTo2D: tileset._projectTo2D,
559
+ enablePick: tileset._enablePick,
560
+ enableShowOutline: tileset._enableShowOutline,
561
+ showOutline: tileset.showOutline,
562
+ outlineColor: tileset.outlineColor,
563
+ };
564
+
565
+ return combine(additionalOptions, mainOptions);
566
+ }
567
+
568
+ export default Model3DTileContent;