@cesium/engine 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/Build/Workers/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
  2. package/Build/Workers/{AxisAlignedBoundingBox-a6f9f0e5.js → AxisAlignedBoundingBox-31fadcf0.js} +1 -1
  3. package/Build/Workers/{BoundingRectangle-b0a68595.js → BoundingRectangle-995f0079.js} +1 -1
  4. package/Build/Workers/{BoxGeometry-baedd794.js → BoxGeometry-7eb1af60.js} +1 -1
  5. package/Build/Workers/{Color-f85df1be.js → Color-2dc49658.js} +1 -1
  6. package/Build/Workers/{CoplanarPolygonGeometryLibrary-30516950.js → CoplanarPolygonGeometryLibrary-d7d972d6.js} +1 -1
  7. package/Build/Workers/{CorridorGeometryLibrary-5d5d3b3a.js → CorridorGeometryLibrary-1f5ef7b3.js} +1 -1
  8. package/Build/Workers/{CylinderGeometry-d899ae26.js → CylinderGeometry-23c67a6c.js} +1 -1
  9. package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
  10. package/Build/Workers/{EllipseGeometry-a49f8449.js → EllipseGeometry-37014da4.js} +1 -1
  11. package/Build/Workers/{EllipseGeometryLibrary-cba7edde.js → EllipseGeometryLibrary-92ab6b1e.js} +1 -1
  12. package/Build/Workers/{EllipseOutlineGeometry-8095c8cb.js → EllipseOutlineGeometry-12b6fef5.js} +1 -1
  13. package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
  14. package/Build/Workers/{EllipsoidGeometry-ed93f571.js → EllipsoidGeometry-508da15c.js} +1 -1
  15. package/Build/Workers/{EllipsoidOutlineGeometry-e4854854.js → EllipsoidOutlineGeometry-40d97455.js} +1 -1
  16. package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
  17. package/Build/Workers/{EllipsoidTangentPlane-7ae1aa9a.js → EllipsoidTangentPlane-46d4d9c2.js} +1 -1
  18. package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
  19. package/Build/Workers/{FrustumGeometry-b62db3e3.js → FrustumGeometry-38605e69.js} +32 -4
  20. package/Build/Workers/{GeometryAttribute-780af4fa.js → GeometryAttribute-a466e9c7.js} +1 -1
  21. package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
  22. package/Build/Workers/{GeometryPipeline-36b61c99.js → GeometryPipeline-dcf79306.js} +1 -1
  23. package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
  24. package/Build/Workers/{IntersectionTests-e889fcf0.js → IntersectionTests-88c49b2e.js} +1 -1
  25. package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
  26. package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
  27. package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
  28. package/Build/Workers/{OrientedBoundingBox-43478ac8.js → OrientedBoundingBox-2dd47921.js} +5 -3
  29. package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
  30. package/Build/Workers/{PolygonGeometryLibrary-38a98276.js → PolygonGeometryLibrary-59126025.js} +1 -1
  31. package/Build/Workers/PolygonPipeline-1fe328c0.js +1344 -0
  32. package/Build/Workers/{PolylinePipeline-30e4cec9.js → PolylinePipeline-896735cc.js} +1 -1
  33. package/Build/Workers/{PolylineVolumeGeometryLibrary-90551d26.js → PolylineVolumeGeometryLibrary-9c0639f7.js} +1 -1
  34. package/Build/Workers/{PrimitivePipeline-558d9cb0.js → PrimitivePipeline-fc1a47ff.js} +1 -1
  35. package/Build/Workers/{RectangleGeometryLibrary-815c68df.js → RectangleGeometryLibrary-a23c9ebe.js} +1 -1
  36. package/Build/Workers/{TerrainEncoding-341ead52.js → TerrainEncoding-51b8b33b.js} +1 -1
  37. package/Build/Workers/Transforms-bc45e707.js +14699 -0
  38. package/Build/Workers/{WallGeometryLibrary-ccf90976.js → WallGeometryLibrary-007e9883.js} +1 -1
  39. package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
  40. package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
  41. package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
  42. package/Build/Workers/combineGeometry.js +1 -1
  43. package/Build/Workers/createBoxGeometry.js +1 -1
  44. package/Build/Workers/createBoxOutlineGeometry.js +1 -1
  45. package/Build/Workers/createCircleGeometry.js +1 -1
  46. package/Build/Workers/createCircleOutlineGeometry.js +1 -1
  47. package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
  48. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  49. package/Build/Workers/createCorridorGeometry.js +1 -1
  50. package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
  51. package/Build/Workers/createCylinderGeometry.js +1 -1
  52. package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
  53. package/Build/Workers/createEllipseGeometry.js +1 -1
  54. package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
  55. package/Build/Workers/createEllipsoidGeometry.js +1 -1
  56. package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
  57. package/Build/Workers/createFrustumGeometry.js +1 -1
  58. package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
  59. package/Build/Workers/createGeometry.js +1 -1
  60. package/Build/Workers/createGroundPolylineGeometry.js +1 -1
  61. package/Build/Workers/createPlaneGeometry.js +1 -1
  62. package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
  63. package/Build/Workers/createPolygonGeometry.js +1 -1
  64. package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
  65. package/Build/Workers/createPolylineGeometry.js +1 -1
  66. package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
  67. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
  68. package/Build/Workers/createRectangleGeometry.js +1 -1
  69. package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
  70. package/Build/Workers/createSimplePolylineGeometry.js +1 -1
  71. package/Build/Workers/createSphereGeometry.js +1 -1
  72. package/Build/Workers/createSphereOutlineGeometry.js +1 -1
  73. package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
  74. package/Build/Workers/createVectorTileGeometries.js +1 -1
  75. package/Build/Workers/createVectorTilePoints.js +1 -1
  76. package/Build/Workers/createVectorTilePolygons.js +1 -1
  77. package/Build/Workers/createVectorTilePolylines.js +1 -1
  78. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
  79. package/Build/Workers/createVerticesFromHeightmap.js +5 -8
  80. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +10 -15
  81. package/Build/Workers/createWallGeometry.js +1 -1
  82. package/Build/Workers/createWallOutlineGeometry.js +1 -1
  83. package/Build/Workers/decodeDraco.js +1 -1
  84. package/Build/Workers/decodeI3S.js +1 -1
  85. package/Build/Workers/package.js +1 -1
  86. package/Build/Workers/transferTypedArrayTest.js +1 -1
  87. package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
  88. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +291 -191
  89. package/Source/Core/BingMapsGeocoderService.js +19 -1
  90. package/Source/Core/CartographicGeocoderService.js +15 -0
  91. package/Source/Core/CesiumTerrainProvider.js +571 -434
  92. package/Source/Core/Credit.js +1 -1
  93. package/Source/Core/CustomHeightmapTerrainProvider.js +12 -0
  94. package/Source/Core/EllipsoidTerrainProvider.js +17 -10
  95. package/Source/Core/FrustumGeometry.js +4 -3
  96. package/Source/Core/GeocoderService.js +32 -1
  97. package/Source/Core/GoogleEarthEnterpriseMetadata.js +86 -34
  98. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +119 -82
  99. package/Source/Core/Ion.js +1 -1
  100. package/Source/Core/IonGeocoderService.js +17 -2
  101. package/Source/Core/IonResource.js +14 -3
  102. package/Source/Core/OpenCageGeocoderService.js +18 -1
  103. package/Source/Core/OrientedBoundingBox.js +4 -2
  104. package/Source/Core/OrthographicFrustum.js +13 -0
  105. package/Source/Core/PeliasGeocoderService.js +14 -1
  106. package/Source/Core/PerspectiveFrustum.js +14 -0
  107. package/Source/Core/Request.js +3 -2
  108. package/Source/Core/RequestScheduler.js +10 -5
  109. package/Source/Core/Resource.js +230 -236
  110. package/Source/Core/TerrainProvider.js +9 -14
  111. package/Source/Core/TileProviderError.js +8 -8
  112. package/Source/Core/VRTheWorldTerrainProvider.js +193 -124
  113. package/Source/Core/buildModuleUrl.js +4 -3
  114. package/Source/Core/createWorldTerrain.js +20 -2
  115. package/Source/Core/createWorldTerrainAsync.js +48 -0
  116. package/Source/Core/sampleTerrain.js +9 -10
  117. package/Source/Core/sampleTerrainMostDetailed.js +66 -72
  118. package/Source/DataSources/Cesium3DTilesetVisualizer.js +37 -26
  119. package/Source/DataSources/DataSourceDisplay.js +2 -2
  120. package/Source/DataSources/Entity.js +6 -1
  121. package/Source/DataSources/EntityCluster.js +126 -128
  122. package/Source/DataSources/ModelVisualizer.js +104 -34
  123. package/Source/DataSources/PolygonGraphics.js +1 -1
  124. package/Source/Renderer/UniformState.js +3 -2
  125. package/Source/Renderer/demodernizeShader.js +5 -5
  126. package/Source/Scene/ArcGisBaseMapType.js +12 -0
  127. package/Source/Scene/ArcGisMapServerImageryProvider.js +694 -376
  128. package/Source/Scene/ArcGisMapService.js +83 -0
  129. package/Source/Scene/BingMapsImageryProvider.js +511 -305
  130. package/Source/Scene/BufferLoader.js +29 -34
  131. package/Source/Scene/Camera.js +8 -7
  132. package/Source/Scene/Cesium3DTile.js +392 -254
  133. package/Source/Scene/Cesium3DTileBatchTable.js +2 -2
  134. package/Source/Scene/Cesium3DTileContent.js +16 -0
  135. package/Source/Scene/Cesium3DTileContentFactory.js +4 -4
  136. package/Source/Scene/Cesium3DTilePass.js +8 -11
  137. package/Source/Scene/Cesium3DTileStyleEngine.js +1 -1
  138. package/Source/Scene/Cesium3DTilesVoxelProvider.js +225 -117
  139. package/Source/Scene/Cesium3DTileset.js +756 -482
  140. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +301 -0
  141. package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +33 -46
  142. package/Source/Scene/Cesium3DTilesetSkipTraversal.js +421 -0
  143. package/Source/Scene/Cesium3DTilesetTraversal.js +219 -671
  144. package/Source/Scene/ClassificationPrimitive.js +7 -0
  145. package/Source/Scene/Composite3DTileContent.js +69 -26
  146. package/Source/Scene/CreditDisplay.js +132 -20
  147. package/Source/Scene/DepthPlane.js +1 -1
  148. package/Source/Scene/Empty3DTileContent.js +31 -1
  149. package/Source/Scene/Geometry3DTileContent.js +47 -7
  150. package/Source/Scene/Globe.js +5 -1
  151. package/Source/Scene/GlobeSurfaceTile.js +2 -1
  152. package/Source/Scene/GlobeSurfaceTileProvider.js +53 -30
  153. package/Source/Scene/GltfBufferViewLoader.js +47 -91
  154. package/Source/Scene/GltfDracoLoader.js +110 -112
  155. package/Source/Scene/GltfImageLoader.js +71 -78
  156. package/Source/Scene/GltfIndexBufferLoader.js +108 -121
  157. package/Source/Scene/GltfJsonLoader.js +87 -74
  158. package/Source/Scene/GltfLoader.js +381 -300
  159. package/Source/Scene/GltfStructuralMetadataLoader.js +109 -110
  160. package/Source/Scene/GltfTextureLoader.js +97 -96
  161. package/Source/Scene/GltfVertexBufferLoader.js +128 -133
  162. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +353 -225
  163. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +491 -331
  164. package/Source/Scene/GridImageryProvider.js +267 -104
  165. package/Source/Scene/GroundPolylinePrimitive.js +12 -1
  166. package/Source/Scene/GroundPrimitive.js +8 -1
  167. package/Source/Scene/I3SDataProvider.js +214 -113
  168. package/Source/Scene/I3SFeature.js +7 -6
  169. package/Source/Scene/I3SLayer.js +26 -37
  170. package/Source/Scene/I3SNode.js +59 -66
  171. package/Source/Scene/Imagery.js +6 -1
  172. package/Source/Scene/ImageryLayer.js +299 -48
  173. package/Source/Scene/ImageryLayerCollection.js +26 -0
  174. package/Source/Scene/ImageryProvider.js +129 -111
  175. package/Source/Scene/Implicit3DTileContent.js +72 -23
  176. package/Source/Scene/ImplicitSubtree.js +66 -45
  177. package/Source/Scene/IonImageryProvider.js +482 -275
  178. package/Source/Scene/MapboxImageryProvider.js +272 -112
  179. package/Source/Scene/MapboxStyleImageryProvider.js +270 -111
  180. package/Source/Scene/MetadataSchemaLoader.js +26 -36
  181. package/Source/Scene/Model/B3dmLoader.js +42 -46
  182. package/Source/Scene/Model/GeoJsonLoader.js +8 -32
  183. package/Source/Scene/Model/I3dmLoader.js +48 -74
  184. package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
  185. package/Source/Scene/Model/Model.js +514 -135
  186. package/Source/Scene/Model/Model3DTileContent.js +83 -31
  187. package/Source/Scene/Model/ModelAnimationCollection.js +3 -3
  188. package/Source/Scene/Model/ModelDrawCommand.js +15 -26
  189. package/Source/Scene/Model/ModelUtility.js +16 -16
  190. package/Source/Scene/Model/PntsLoader.js +27 -32
  191. package/Source/Scene/Model/UniformType.js +1 -1
  192. package/Source/Scene/Multiple3DTileContent.js +134 -115
  193. package/Source/Scene/Picking.js +3 -2
  194. package/Source/Scene/PointCloud.js +11 -19
  195. package/Source/Scene/Primitive.js +20 -0
  196. package/Source/Scene/QuadtreePrimitive.js +5 -2
  197. package/Source/Scene/QuadtreeTileProvider.js +4 -8
  198. package/Source/Scene/ResourceCache.js +47 -105
  199. package/Source/Scene/ResourceCacheStatistics.js +24 -58
  200. package/Source/Scene/ResourceLoader.js +5 -17
  201. package/Source/Scene/ResourceLoaderState.js +12 -4
  202. package/Source/Scene/Scene.js +65 -0
  203. package/Source/Scene/SceneTransforms.js +3 -2
  204. package/Source/Scene/ScreenSpaceCameraController.js +2 -2
  205. package/Source/Scene/SingleTileImageryProvider.js +382 -209
  206. package/Source/Scene/Terrain.js +196 -0
  207. package/Source/Scene/TileCoordinatesImageryProvider.js +267 -104
  208. package/Source/Scene/TileMapServiceImageryProvider.js +177 -85
  209. package/Source/Scene/Tileset3DTileContent.js +47 -5
  210. package/Source/Scene/TimeDynamicPointCloud.js +15 -2
  211. package/Source/Scene/UrlTemplateImageryProvider.js +343 -215
  212. package/Source/Scene/Vector3DTileClampedPolylines.js +96 -84
  213. package/Source/Scene/Vector3DTileContent.js +47 -22
  214. package/Source/Scene/Vector3DTileGeometry.js +57 -52
  215. package/Source/Scene/Vector3DTilePoints.js +97 -81
  216. package/Source/Scene/Vector3DTilePolygons.js +118 -117
  217. package/Source/Scene/Vector3DTilePolylines.js +86 -82
  218. package/Source/Scene/Vector3DTilePrimitive.js +0 -1
  219. package/Source/Scene/VoxelContent.js +61 -63
  220. package/Source/Scene/VoxelPrimitive.js +39 -91
  221. package/Source/Scene/VoxelProvider.js +2 -2
  222. package/Source/Scene/WebMapServiceImageryProvider.js +272 -111
  223. package/Source/Scene/WebMapTileServiceImageryProvider.js +270 -107
  224. package/Source/Scene/computeFlyToLocationForRectangle.js +33 -37
  225. package/Source/Scene/createOsmBuildings.js +6 -0
  226. package/Source/Scene/createOsmBuildingsAsync.js +82 -0
  227. package/Source/Scene/createWorldImagery.js +14 -5
  228. package/Source/Scene/createWorldImageryAsync.js +39 -0
  229. package/Source/Shaders/AtmosphereCommon.glsl +51 -8
  230. package/Source/Shaders/AtmosphereCommon.js +51 -8
  231. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
  232. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
  233. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
  234. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
  235. package/Source/Widget/CesiumWidget.js +67 -27
  236. package/index.d.ts +2429 -1475
  237. package/index.js +324 -315
  238. package/package.json +4 -4
  239. package/Build/Workers/PolygonPipeline-d31ff61c.js +0 -1345
  240. package/Build/Workers/Transforms-9e9df299.js +0 -14714
@@ -69,20 +69,17 @@ ResourceCache.get = function (cacheKey) {
69
69
  };
70
70
 
71
71
  /**
72
- * Loads a resource and adds it to the cache.
72
+ * Adds it to the cache.
73
73
  *
74
- * @param {object} options Object with the following properties:
75
- * @param {ResourceLoader} options.resourceLoader The resource.
74
+ * @param {ResourceLoader} resourceLoader The resource.
75
+ * @returns {ResourceLoader} The resource.
76
76
  *
77
- * @exception {DeveloperError} Resource with this cacheKey is already in the cach
77
+ * @exception {DeveloperError} Resource with this cacheKey is already in the cache
78
78
  * @private
79
79
  */
80
- ResourceCache.load = function (options) {
81
- options = defaultValue(options, defaultValue.EMPTY_OBJECT);
82
- const resourceLoader = options.resourceLoader;
83
-
80
+ ResourceCache.add = function (resourceLoader) {
84
81
  //>>includeStart('debug', pragmas.debug);
85
- Check.typeOf.object("options.resourceLoader", resourceLoader);
82
+ Check.typeOf.object("resourceLoader", resourceLoader);
86
83
  //>>includeEnd('debug');
87
84
 
88
85
  const cacheKey = resourceLoader.cacheKey;
@@ -99,7 +96,7 @@ ResourceCache.load = function (options) {
99
96
 
100
97
  ResourceCache.cacheEntries[cacheKey] = new CacheEntry(resourceLoader);
101
98
 
102
- resourceLoader.load();
99
+ return resourceLoader;
103
100
  };
104
101
 
105
102
  /**
@@ -136,18 +133,18 @@ ResourceCache.unload = function (resourceLoader) {
136
133
  };
137
134
 
138
135
  /**
139
- * Loads a schema from the cache.
136
+ * Gets an existing schema loader from the cache, or creates a new loader if one does not already exist.
140
137
  *
141
138
  * @param {object} options Object with the following properties:
142
139
  * @param {object} [options.schema] An object that explicitly defines a schema JSON. Mutually exclusive with options.resource.
143
140
  * @param {Resource} [options.resource] The {@link Resource} pointing to the schema JSON. Mutually exclusive with options.schema.
144
141
  *
145
- * @returns {MetadataSchemaLoader} The schema resource.
142
+ * @returns {MetadataSchemaLoader} The cached schema resource.
146
143
  *
147
144
  * @exception {DeveloperError} One of options.schema and options.resource must be defined.
148
145
  * @private
149
146
  */
150
- ResourceCache.loadSchema = function (options) {
147
+ ResourceCache.getSchemaLoader = function (options) {
151
148
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
152
149
  const schema = options.schema;
153
150
  const resource = options.resource;
@@ -176,25 +173,21 @@ ResourceCache.loadSchema = function (options) {
176
173
  cacheKey: cacheKey,
177
174
  });
178
175
 
179
- ResourceCache.load({
180
- resourceLoader: schemaLoader,
181
- });
182
-
183
- return schemaLoader;
176
+ return ResourceCache.add(schemaLoader);
184
177
  };
185
178
 
186
179
  /**
187
- * Load an embedded buffer from the cache.
180
+ * Gets an existing embedded buffer loader from the cache, or creates a new loader if one does not already exist.
188
181
  *
189
182
  * @param {object} options Object with the following properties:
190
183
  * @param {Resource} options.parentResource The {@link Resource} containing the embedded buffer.
191
184
  * @param {number} options.bufferId A unique identifier of the embedded buffer within the parent resource.
192
185
  * @param {Uint8Array} [options.typedArray] The typed array containing the embedded buffer contents.
193
186
  *
194
- * @returns {BufferLoader} The buffer loader.
187
+ * @returns {BufferLoader} The cached buffer loader.
195
188
  * @private
196
189
  */
197
- ResourceCache.loadEmbeddedBuffer = function (options) {
190
+ ResourceCache.getEmbeddedBufferLoader = function (options) {
198
191
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
199
192
  const parentResource = options.parentResource;
200
193
  const bufferId = options.bufferId;
@@ -224,23 +217,19 @@ ResourceCache.loadEmbeddedBuffer = function (options) {
224
217
  cacheKey: cacheKey,
225
218
  });
226
219
 
227
- ResourceCache.load({
228
- resourceLoader: bufferLoader,
229
- });
230
-
231
- return bufferLoader;
220
+ return ResourceCache.add(bufferLoader);
232
221
  };
233
222
 
234
223
  /**
235
- * Loads an external buffer from the cache.
224
+ * Gets an existing external buffer from loader the cache, or creates a new loader if one does not already exist.
236
225
  *
237
226
  * @param {object} options Object with the following properties:
238
227
  * @param {Resource} options.resource The {@link Resource} pointing to the external buffer.
239
228
  *
240
- * @returns {BufferLoader} The buffer loader.
229
+ * @returns {BufferLoader} The cached buffer loader.
241
230
  * @private
242
231
  */
243
- ResourceCache.loadExternalBuffer = function (options) {
232
+ ResourceCache.getExternalBufferLoader = function (options) {
244
233
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
245
234
  const resource = options.resource;
246
235
 
@@ -262,15 +251,11 @@ ResourceCache.loadExternalBuffer = function (options) {
262
251
  cacheKey: cacheKey,
263
252
  });
264
253
 
265
- ResourceCache.load({
266
- resourceLoader: bufferLoader,
267
- });
268
-
269
- return bufferLoader;
254
+ return ResourceCache.add(bufferLoader);
270
255
  };
271
256
 
272
257
  /**
273
- * Loads a glTF JSON from the cache.
258
+ * Gets an existing glTF JSON loader from the cache, or creates a new loader if one does not already exist.
274
259
  *
275
260
  * @param {object} options Object with the following properties:
276
261
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
@@ -278,10 +263,10 @@ ResourceCache.loadExternalBuffer = function (options) {
278
263
  * @param {Uint8Array} [options.typedArray] The typed array containing the glTF contents.
279
264
  * @param {object} [options.gltfJson] The parsed glTF JSON contents.
280
265
  *
281
- * @returns {GltfJsonLoader} The glTF JSON.
266
+ * @returns {GltfJsonLoader} The cached glTF JSON loader.
282
267
  * @private
283
268
  */
284
- ResourceCache.loadGltfJson = function (options) {
269
+ ResourceCache.getGltfJsonLoader = function (options) {
285
270
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
286
271
  const gltfResource = options.gltfResource;
287
272
  const baseResource = options.baseResource;
@@ -311,15 +296,11 @@ ResourceCache.loadGltfJson = function (options) {
311
296
  cacheKey: cacheKey,
312
297
  });
313
298
 
314
- ResourceCache.load({
315
- resourceLoader: gltfJsonLoader,
316
- });
317
-
318
- return gltfJsonLoader;
299
+ return ResourceCache.add(gltfJsonLoader);
319
300
  };
320
301
 
321
302
  /**
322
- * Loads a glTF buffer view from the cache.
303
+ * Gets an existing glTF buffer view from the cache, or creates a new loader if one does not already exist.
323
304
  *
324
305
  * @param {object} options Object with the following properties:
325
306
  * @param {object} options.gltf The glTF JSON.
@@ -327,10 +308,10 @@ ResourceCache.loadGltfJson = function (options) {
327
308
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
328
309
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
329
310
  *
330
- * @returns {GltfBufferViewLoader} The buffer view loader.
311
+ * @returns {GltfBufferViewLoader} The cached buffer view loader.
331
312
  * @private
332
313
  */
333
- ResourceCache.loadBufferView = function (options) {
314
+ ResourceCache.getBufferViewLoader = function (options) {
334
315
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
335
316
  const gltf = options.gltf;
336
317
  const bufferViewId = options.bufferViewId;
@@ -365,15 +346,11 @@ ResourceCache.loadBufferView = function (options) {
365
346
  cacheKey: cacheKey,
366
347
  });
367
348
 
368
- ResourceCache.load({
369
- resourceLoader: bufferViewLoader,
370
- });
371
-
372
- return bufferViewLoader;
349
+ return ResourceCache.add(bufferViewLoader);
373
350
  };
374
351
 
375
352
  /**
376
- * Loads Draco data from the cache.
353
+ * Gets an existing Draco data from the cache, or creates a new loader if one does not already exist.
377
354
  *
378
355
  * @param {object} options Object with the following properties:
379
356
  * @param {object} options.gltf The glTF JSON.
@@ -381,10 +358,10 @@ ResourceCache.loadBufferView = function (options) {
381
358
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
382
359
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
383
360
  *
384
- * @returns {GltfDracoLoader} The Draco loader.
361
+ * @returns {GltfDracoLoader} The cached Draco loader.
385
362
  * @private
386
363
  */
387
- ResourceCache.loadDraco = function (options) {
364
+ ResourceCache.getDracoLoader = function (options) {
388
365
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
389
366
  const gltf = options.gltf;
390
367
  const draco = options.draco;
@@ -419,15 +396,11 @@ ResourceCache.loadDraco = function (options) {
419
396
  cacheKey: cacheKey,
420
397
  });
421
398
 
422
- ResourceCache.load({
423
- resourceLoader: dracoLoader,
424
- });
425
-
426
- return dracoLoader;
399
+ return ResourceCache.add(dracoLoader);
427
400
  };
428
401
 
429
402
  /**
430
- * Loads a glTF vertex buffer from the cache.
403
+ * Gets an existing glTF vertex buffer from the cache, or creates a new loader if one does not already exist.
431
404
  *
432
405
  * @param {object} options Object with the following properties:
433
406
  * @param {object} options.gltf The glTF JSON.
@@ -446,10 +419,10 @@ ResourceCache.loadDraco = function (options) {
446
419
  * @exception {DeveloperError} When options.draco is defined options.attributeSemantic must also be defined.
447
420
  * @exception {DeveloperError} When options.draco is defined options.accessorId must also be defined.
448
421
  *
449
- * @returns {GltfVertexBufferLoader} The vertex buffer loader.
422
+ * @returns {GltfVertexBufferLoader} The cached vertex buffer loader.
450
423
  * @private
451
424
  */
452
- ResourceCache.loadVertexBuffer = function (options) {
425
+ ResourceCache.getVertexBufferLoader = function (options) {
453
426
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
454
427
  const gltf = options.gltf;
455
428
  const gltfResource = options.gltfResource;
@@ -539,18 +512,7 @@ ResourceCache.loadVertexBuffer = function (options) {
539
512
  loadTypedArray: loadTypedArray,
540
513
  });
541
514
 
542
- ResourceCache.load({
543
- resourceLoader: vertexBufferLoader,
544
- });
545
-
546
- const promise = ResourceCache.statistics.addGeometryLoader(
547
- vertexBufferLoader
548
- );
549
-
550
- // Needed for unit testing
551
- ResourceCache.cacheEntries[cacheKey]._statisticsPromise = promise;
552
-
553
- return vertexBufferLoader;
515
+ return ResourceCache.add(vertexBufferLoader);
554
516
  };
555
517
 
556
518
  function hasDracoCompression(draco, semantic) {
@@ -562,7 +524,7 @@ function hasDracoCompression(draco, semantic) {
562
524
  }
563
525
 
564
526
  /**
565
- * Loads a glTF index buffer from the cache.
527
+ * Gets an existing glTF index buffer from the cache, or creates a new loader if one does not already exist.
566
528
  *
567
529
  * @param {object} options Object with the following properties:
568
530
  * @param {object} options.gltf The glTF JSON.
@@ -574,10 +536,10 @@ function hasDracoCompression(draco, semantic) {
574
536
  * @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
575
537
  * @param {boolean} [options.loadBuffer=false] Load index buffer as a GPU index buffer.
576
538
  * @param {boolean} [options.loadTypedArray=false] Load index buffer as a typed array.
577
- * @returns {GltfIndexBufferLoader} The index buffer loader.
539
+ * @returns {GltfIndexBufferLoader} The cached index buffer loader.
578
540
  * @private
579
541
  */
580
- ResourceCache.loadIndexBuffer = function (options) {
542
+ ResourceCache.getIndexBufferLoader = function (options) {
581
543
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
582
544
  const gltf = options.gltf;
583
545
  const accessorId = options.accessorId;
@@ -631,19 +593,11 @@ ResourceCache.loadIndexBuffer = function (options) {
631
593
  loadTypedArray: loadTypedArray,
632
594
  });
633
595
 
634
- ResourceCache.load({
635
- resourceLoader: indexBufferLoader,
636
- });
637
- const promise = ResourceCache.statistics.addGeometryLoader(indexBufferLoader);
638
-
639
- // Needed for unit testing
640
- ResourceCache.cacheEntries[cacheKey]._statisticsPromise = promise;
641
-
642
- return indexBufferLoader;
596
+ return ResourceCache.add(indexBufferLoader);
643
597
  };
644
598
 
645
599
  /**
646
- * Loads a glTF image from the cache.
600
+ * Gets an existing glTF image from the cache, or creates a new loader if one does not already exist.
647
601
  *
648
602
  * @param {object} options Object with the following properties:
649
603
  * @param {object} options.gltf The glTF JSON.
@@ -651,10 +605,10 @@ ResourceCache.loadIndexBuffer = function (options) {
651
605
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
652
606
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
653
607
  *
654
- * @returns {GltfImageLoader} The image loader.
608
+ * @returns {GltfImageLoader} The cached image loader.
655
609
  * @private
656
610
  */
657
- ResourceCache.loadImage = function (options) {
611
+ ResourceCache.getImageLoader = function (options) {
658
612
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
659
613
  const gltf = options.gltf;
660
614
  const imageId = options.imageId;
@@ -689,15 +643,11 @@ ResourceCache.loadImage = function (options) {
689
643
  cacheKey: cacheKey,
690
644
  });
691
645
 
692
- ResourceCache.load({
693
- resourceLoader: imageLoader,
694
- });
695
-
696
- return imageLoader;
646
+ return ResourceCache.add(imageLoader);
697
647
  };
698
648
 
699
649
  /**
700
- * Loads a glTF texture from the cache.
650
+ * Gets an existing glTF texture from the cache, or creates a new loader if one does not already exist.
701
651
  *
702
652
  * @param {object} options Object with the following properties:
703
653
  * @param {object} options.gltf The glTF JSON.
@@ -708,10 +658,10 @@ ResourceCache.loadImage = function (options) {
708
658
  * @param {FrameState} options.frameState The frame state.
709
659
  * @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
710
660
  *
711
- * @returns {GltfTextureLoader} The texture loader.
661
+ * @returns {GltfTextureLoader} The cached texture loader.
712
662
  * @private
713
663
  */
714
- ResourceCache.loadTexture = function (options) {
664
+ ResourceCache.getTextureLoader = function (options) {
715
665
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
716
666
  const gltf = options.gltf;
717
667
  const textureInfo = options.textureInfo;
@@ -755,15 +705,7 @@ ResourceCache.loadTexture = function (options) {
755
705
  asynchronous: asynchronous,
756
706
  });
757
707
 
758
- ResourceCache.load({
759
- resourceLoader: textureLoader,
760
- });
761
- const promise = ResourceCache.statistics.addTextureLoader(textureLoader);
762
-
763
- // Needed for unit testing
764
- ResourceCache.cacheEntries[cacheKey]._statisticsPromise = promise;
765
-
766
- return textureLoader;
708
+ return ResourceCache.add(textureLoader);
767
709
  };
768
710
 
769
711
  /**
@@ -47,17 +47,14 @@ ResourceCacheStatistics.prototype.clear = function () {
47
47
  };
48
48
 
49
49
  /**
50
- * Track the resources for a vertex or index buffer loader. This is implemented
51
- * asynchronously since resources may not be immediately available to count.
50
+ * Track the resources for a vertex or index buffer loader. This should be called after a loader is ready; that
51
+ * is it has been loaded and processed.
52
52
  * This method handles the following cases gracefully:
53
53
  * <ul>
54
54
  * <li>If the loader is added twice, its resources will not be double-counted</li>
55
55
  * <li>If the geometry has a CPU copy of the GPU buffer, it will be added to the count</li>
56
- * <li>If the resource loading failed, its resources will not be counted</li>
57
- * <li>If removeLoader() was called before the loader promise resolves, its resources will not be counted</li>
58
56
  * </ul>
59
57
  * @param {GltfVertexBufferLoader|GltfIndexBufferLoader} loader The geometry buffer with resources to track
60
- * @returns {Promise} A promise that resolves once the count is updated.
61
58
  *
62
59
  * @private
63
60
  */
@@ -75,47 +72,29 @@ ResourceCacheStatistics.prototype.addGeometryLoader = function (loader) {
75
72
 
76
73
  this._geometrySizes[cacheKey] = 0;
77
74
 
78
- const that = this;
79
- return loader.promise
80
- .then(function (loader) {
81
- // loader was unloaded before its promise resolved
82
- if (!that._geometrySizes.hasOwnProperty(cacheKey)) {
83
- return;
84
- }
85
-
86
- const buffer = loader.buffer;
87
- const typedArray = loader.typedArray;
88
-
89
- let totalSize = 0;
90
-
91
- if (defined(buffer)) {
92
- totalSize += buffer.sizeInBytes;
93
- }
94
-
95
- if (defined(typedArray)) {
96
- totalSize += typedArray.byteLength;
97
- }
98
-
99
- that.geometryByteLength += totalSize;
100
- that._geometrySizes[cacheKey] = totalSize;
101
- })
102
- .catch(function () {
103
- // If the resource failed to load, remove it from the cache
104
- delete that._geometrySizes[cacheKey];
105
- });
75
+ const buffer = loader.buffer;
76
+ const typedArray = loader.typedArray;
77
+
78
+ let totalSize = 0;
79
+
80
+ if (defined(buffer)) {
81
+ totalSize += buffer.sizeInBytes;
82
+ }
83
+
84
+ if (defined(typedArray)) {
85
+ totalSize += typedArray.byteLength;
86
+ }
87
+
88
+ this.geometryByteLength += totalSize;
89
+ this._geometrySizes[cacheKey] = totalSize;
106
90
  };
107
91
 
108
92
  /**
109
- * Track the resources for a texture loader. This is implemented
110
- * asynchronously since resources may not be immediately available to count.
111
- * This method handles the following cases gracefully:
112
- * <ul>
113
- * <li>If the loader is added twice, its resources will not be double-counted</li>
114
- * <li>If the resource loading failed, its resources will not be counted</li>
115
- * <li>If removeLoader() was called before the loader promise resolves, its resources will not be counted</li>
116
- * </ul>
93
+ * Track the resources for a texture loader. This should be called after a loader is ready; that
94
+ * is it has been loaded and processed.
95
+ * If the loader is added twice, its resources will not be double-counted.
96
+ *
117
97
  * @param {GltfTextureLoader} loader The texture loader with resources to track
118
- * @returns {Promise} A promise that resolves once the count is updated.
119
98
  *
120
99
  * @private
121
100
  */
@@ -132,22 +111,9 @@ ResourceCacheStatistics.prototype.addTextureLoader = function (loader) {
132
111
  }
133
112
 
134
113
  this._textureSizes[cacheKey] = 0;
135
-
136
- const that = this;
137
- return loader.promise
138
- .then(function (loader) {
139
- // loader was unloaded before its promise resolved
140
- if (!that._textureSizes.hasOwnProperty(cacheKey)) {
141
- return;
142
- }
143
-
144
- const totalSize = loader.texture.sizeInBytes;
145
- that.texturesByteLength += loader.texture.sizeInBytes;
146
- that._textureSizes[cacheKey] = totalSize;
147
- })
148
- .catch(function () {
149
- delete that._textureSizes[cacheKey];
150
- });
114
+ const totalSize = loader.texture.sizeInBytes;
115
+ this.texturesByteLength += loader.texture.sizeInBytes;
116
+ this._textureSizes[cacheKey] = totalSize;
151
117
  };
152
118
 
153
119
  /**
@@ -20,21 +20,6 @@ import RuntimeError from "../Core/RuntimeError.js";
20
20
  function ResourceLoader() {}
21
21
 
22
22
  Object.defineProperties(ResourceLoader.prototype, {
23
- /**
24
- * A promise that resolves to the resource when the resource is ready, or undefined if the resource hasn't started loading.
25
- *
26
- * @memberof ResourceLoader.prototype
27
- *
28
- * @type {Promise<ResourceLoader>|undefined}
29
- * @readonly
30
- * @private
31
- */
32
- promise: {
33
- // eslint-disable-next-line getter-return
34
- get: function () {
35
- DeveloperError.throwInstantiationError();
36
- },
37
- },
38
23
  /**
39
24
  * The cache key of the resource.
40
25
  *
@@ -71,9 +56,12 @@ ResourceLoader.prototype.unload = function () {};
71
56
  * Processes the resource until it becomes ready.
72
57
  *
73
58
  * @param {FrameState} frameState The frame state.
59
+ * @returns {boolean} true once all resourced are ready.
74
60
  * @private
75
61
  */
76
- ResourceLoader.prototype.process = function (frameState) {};
62
+ ResourceLoader.prototype.process = function (frameState) {
63
+ return false;
64
+ };
77
65
 
78
66
  /**
79
67
  * Constructs a {@link RuntimeError} from an errorMessage and an error.
@@ -89,7 +77,7 @@ ResourceLoader.prototype.getError = function (errorMessage, error) {
89
77
  Check.typeOf.string("errorMessage", errorMessage);
90
78
  //>>includeEnd('debug');
91
79
 
92
- if (defined(error)) {
80
+ if (defined(error) && defined(error.message)) {
93
81
  errorMessage += `\n${error.message}`;
94
82
  }
95
83
 
@@ -21,13 +21,21 @@ const ResourceLoaderState = {
21
21
  */
22
22
  LOADING: 1,
23
23
  /**
24
- * The resource has finished loading, but requires further processing. GPU resources are allocated in this state as needed.
24
+ * The resource has finished loading, but requires further processing.
25
25
  *
26
26
  * @type {number}
27
27
  * @constant
28
28
  * @private
29
29
  */
30
- PROCESSING: 2,
30
+ LOADED: 2,
31
+ /**
32
+ * The resource is processing. GPU resources are allocated in this state as needed.
33
+ *
34
+ * @type {Number}
35
+ * @constant
36
+ * @private
37
+ */
38
+ PROCESSING: 3,
31
39
  /**
32
40
  * The resource has finished loading and processing; the results are ready to be used.
33
41
  *
@@ -35,7 +43,7 @@ const ResourceLoaderState = {
35
43
  * @constant
36
44
  * @private
37
45
  */
38
- READY: 3,
46
+ READY: 4,
39
47
  /**
40
48
  * The resource loading or processing has failed due to an error.
41
49
  *
@@ -43,6 +51,6 @@ const ResourceLoaderState = {
43
51
  * @constant
44
52
  * @private
45
53
  */
46
- FAILED: 4,
54
+ FAILED: 5,
47
55
  };
48
56
  export default Object.freeze(ResourceLoaderState);
@@ -3,6 +3,7 @@ import BoundingSphere from "../Core/BoundingSphere.js";
3
3
  import BoxGeometry from "../Core/BoxGeometry.js";
4
4
  import Cartesian3 from "../Core/Cartesian3.js";
5
5
  import Cartographic from "../Core/Cartographic.js";
6
+ import Check from "../Core/Check.js";
6
7
  import clone from "../Core/clone.js";
7
8
  import Color from "../Core/Color.js";
8
9
  import ColorGeometryInstanceAttribute from "../Core/ColorGeometryInstanceAttribute.js";
@@ -638,6 +639,7 @@ function Scene(options) {
638
639
  requestRenderAfterFrame(this)
639
640
  );
640
641
  this._removeGlobeCallbacks = [];
642
+ this._removeTerrainProviderReadyListener = undefined;
641
643
 
642
644
  const viewport = new BoundingRectangle(
643
645
  0,
@@ -1104,6 +1106,11 @@ Object.defineProperties(Scene.prototype, {
1104
1106
  return this.globe.terrainProvider;
1105
1107
  },
1106
1108
  set: function (terrainProvider) {
1109
+ // Cancel any in-progress terrain update
1110
+ this._removeTerrainProviderReadyListener =
1111
+ this._removeTerrainProviderReadyListener &&
1112
+ this._removeTerrainProviderReadyListener();
1113
+
1107
1114
  if (defined(this.globe)) {
1108
1115
  this.globe.terrainProvider = terrainProvider;
1109
1116
  }
@@ -4377,6 +4384,61 @@ Scene.prototype.morphTo3D = function (duration) {
4377
4384
  this._transitioner.morphTo3D(duration, ellipsoid);
4378
4385
  };
4379
4386
 
4387
+ function setTerrain(scene, terrain) {
4388
+ // Cancel any in-progress terrain update
4389
+ scene._removeTerrainProviderReadyListener =
4390
+ scene._removeTerrainProviderReadyListener &&
4391
+ scene._removeTerrainProviderReadyListener();
4392
+
4393
+ // If the terrain is already loaded, set it immediately
4394
+ if (terrain.ready) {
4395
+ if (defined(scene.globe)) {
4396
+ scene.globe.terrainProvider = terrain.provider;
4397
+ }
4398
+ return;
4399
+ }
4400
+ // Otherwise, set a placeholder
4401
+ scene.globe.terrainProvider = undefined;
4402
+ scene._removeTerrainProviderReadyListener = terrain.readyEvent.addEventListener(
4403
+ (provider) => {
4404
+ if (defined(scene) && defined(scene.globe)) {
4405
+ scene.globe.terrainProvider = provider;
4406
+ }
4407
+
4408
+ scene._removeTerrainProviderReadyListener();
4409
+ }
4410
+ );
4411
+ }
4412
+
4413
+ /**
4414
+ * Update the terrain providing surface geometry for the globe.
4415
+ *
4416
+ * @param {Terrain} terrain The terrain provider async helper
4417
+ * @returns {Terrain} terrain The terrain provider async helper
4418
+ *
4419
+ * @example
4420
+ * // Use Cesium World Terrain
4421
+ * scene.setTerrain(Cesium.Terrain.fromWorldTerrain());
4422
+ *
4423
+ * @example
4424
+ * // Use a custom terrain provider
4425
+ * const terrain = new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl("https://myTestTerrain.com"));
4426
+ * scene.setTerrain(terrain);
4427
+ *
4428
+ * terrain.errorEvent.addEventListener(error => {
4429
+ * alert(`Encountered an error while creating terrain! ${error}`);
4430
+ * });
4431
+ */
4432
+ Scene.prototype.setTerrain = function (terrain) {
4433
+ //>>includeStart('debug', pragmas.debug);
4434
+ Check.typeOf.object("terrain", terrain);
4435
+ //>>includeEnd('debug');
4436
+
4437
+ setTerrain(this, terrain);
4438
+
4439
+ return terrain;
4440
+ };
4441
+
4380
4442
  /**
4381
4443
  * Returns true if this object was destroyed; otherwise, false.
4382
4444
  * <br /><br />
@@ -4421,6 +4483,9 @@ Scene.prototype.destroy = function () {
4421
4483
  this._groundPrimitives =
4422
4484
  this._groundPrimitives && this._groundPrimitives.destroy();
4423
4485
  this._globe = this._globe && this._globe.destroy();
4486
+ this._removeTerrainProviderReadyListener =
4487
+ this._removeTerrainProviderReadyListener &&
4488
+ this._removeTerrainProviderReadyListener();
4424
4489
  this.skyBox = this.skyBox && this.skyBox.destroy();
4425
4490
  this.skyAtmosphere = this.skyAtmosphere && this.skyAtmosphere.destroy();
4426
4491
  this._debugSphere = this._debugSphere && this._debugSphere.destroy();
@@ -432,8 +432,9 @@ SceneTransforms.drawingBufferToWgs84Coordinates = function (
432
432
  let worldCoords;
433
433
  let frustum = scene.camera.frustum;
434
434
  if (!defined(frustum.fovy)) {
435
- if (defined(frustum._offCenterFrustum)) {
436
- frustum = frustum._offCenterFrustum;
435
+ const offCenterFrustum = frustum.offCenterFrustum;
436
+ if (defined(offCenterFrustum)) {
437
+ frustum = offCenterFrustum;
437
438
  }
438
439
  worldCoords = scratchWorldCoords;
439
440
  worldCoords.x =