@cesium/engine 12.0.0 → 13.0.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.
- package/Build/Workers/{chunk-2RHMHHJH.js → chunk-22NU5WU5.js} +2 -2
- package/Build/Workers/{chunk-3OM5QZSI.js → chunk-2IIE2UZ3.js} +2 -2
- package/Build/Workers/{chunk-WQCX7U65.js → chunk-2OD54CUD.js} +7 -7
- package/Build/Workers/{chunk-IT6AWHFV.js → chunk-2TSF7N76.js} +2 -2
- package/Build/Workers/{chunk-AL7BHP36.js → chunk-3VHIUS7I.js} +6 -6
- package/Build/Workers/{chunk-MSY2AAW2.js → chunk-3ZMTG4X5.js} +4 -4
- package/Build/Workers/{chunk-GZG526CC.js → chunk-4HS475MU.js} +14 -14
- package/Build/Workers/{chunk-4IQPX22D.js → chunk-4IM6WQEI.js} +6 -6
- package/Build/Workers/{chunk-7DSVCRFD.js → chunk-6HWW6KNV.js} +6 -6
- package/Build/Workers/{chunk-GUW6BS72.js → chunk-6ZOS2ACR.js} +7 -7
- package/Build/Workers/{chunk-7OISMGQF.js → chunk-BFNZUP2C.js} +7 -41
- package/Build/Workers/{chunk-WW5RTJ72.js → chunk-BLTSMJIP.js} +1 -1
- package/Build/Workers/{chunk-ES6Q5HWK.js → chunk-BZMHXDKV.js} +13 -13
- package/Build/Workers/{chunk-5YKJKOFE.js → chunk-CQDSGG3R.js} +7 -7
- package/Build/Workers/{chunk-ZZNBFQL5.js → chunk-CUMDCSMT.js} +11 -11
- package/Build/Workers/{chunk-BQNTN4CC.js → chunk-D3VPMNUR.js} +13 -13
- package/Build/Workers/{chunk-4ESQ3DN2.js → chunk-DIAH2ZTB.js} +9 -9
- package/Build/Workers/{chunk-VQZNBD3T.js → chunk-EXDSJZ7J.js} +4 -4
- package/Build/Workers/{chunk-T6FZFMTF.js → chunk-FANORJU6.js} +2 -2
- package/Build/Workers/{chunk-US3L7FXC.js → chunk-FLPIQK2R.js} +6 -6
- package/Build/Workers/{chunk-J64XIF5C.js → chunk-GBXJIWAZ.js} +34 -8
- package/Build/Workers/{chunk-TQK4D4AR.js → chunk-GJZQSAES.js} +7 -7
- package/Build/Workers/{chunk-X67KKHI7.js → chunk-GNG3V432.js} +4 -4
- package/Build/Workers/{chunk-B4AZL6Q4.js → chunk-H4Y7ADFL.js} +5 -5
- package/Build/Workers/{chunk-SXJ37VUC.js → chunk-H7BML7HH.js} +6 -6
- package/Build/Workers/{chunk-5FSKL7US.js → chunk-HMMPNR4Z.js} +12 -12
- package/Build/Workers/{chunk-ARTM66DL.js → chunk-JISDBAYP.js} +5 -5
- package/Build/Workers/{chunk-6DYMJ57Z.js → chunk-KCCTLUKK.js} +10 -10
- package/Build/Workers/{chunk-X7VRF25X.js → chunk-KKVKSTWC.js} +5 -5
- package/Build/Workers/{chunk-JGGZ3H4W.js → chunk-KRCUHV7P.js} +1 -1
- package/Build/Workers/{chunk-AOCENJVH.js → chunk-MMILY4S7.js} +11 -11
- package/Build/Workers/{chunk-GYHHNFW5.js → chunk-MSKD73KW.js} +10 -10
- package/Build/Workers/{chunk-C4IAULHW.js → chunk-NVFEDMX4.js} +15 -15
- package/Build/Workers/{chunk-YANQEHO5.js → chunk-OUIF26MQ.js} +6 -6
- package/Build/Workers/{chunk-GKBICLGC.js → chunk-OZZD3VY4.js} +17 -17
- package/Build/Workers/{chunk-56LALJCU.js → chunk-PD2MCNV7.js} +2 -2
- package/Build/Workers/{chunk-62YGXNGC.js → chunk-PMNQULFU.js} +7 -7
- package/Build/Workers/{chunk-3OHDXGFC.js → chunk-Q4MTXEB7.js} +6 -6
- package/Build/Workers/{chunk-4XPGN5Y7.js → chunk-RC5N5SJL.js} +7 -7
- package/Build/Workers/{chunk-IL6SMMDD.js → chunk-RGZWZ4PP.js} +4 -4
- package/Build/Workers/{chunk-GMGUR5GM.js → chunk-RIQGQMS4.js} +4 -4
- package/Build/Workers/{chunk-VUCVRDLD.js → chunk-RR4M3ZGF.js} +7 -7
- package/Build/Workers/{chunk-3UJV3W4Y.js → chunk-S4SCKDK4.js} +1 -1
- package/Build/Workers/{chunk-VGT4ONMC.js → chunk-T5H7YWC7.js} +17 -17
- package/Build/Workers/{chunk-QXBRZZQS.js → chunk-W2DVQETH.js} +10 -10
- package/Build/Workers/{chunk-HYUTWUXN.js → chunk-W2E67GLE.js} +13 -13
- package/Build/Workers/{chunk-3X2LXRHU.js → chunk-WXJY6NDI.js} +13 -13
- package/Build/Workers/{chunk-W2Q2F7JS.js → chunk-XQP37R5E.js} +5 -5
- package/Build/Workers/{chunk-VJVTWBXB.js → chunk-YBDL7YPF.js} +1 -1
- package/Build/Workers/{chunk-HILBDZUP.js → chunk-YDEZMDB7.js} +2 -2
- package/Build/Workers/{chunk-JRULXFCC.js → chunk-Z7OYBX6P.js} +5 -5
- package/Build/Workers/{chunk-2B5H7KIN.js → chunk-ZIWULRRD.js} +1 -1
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -32
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +20 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/BingMapsGeocoderService.js +2 -0
- package/Source/Core/GoogleGeocoderService.js +110 -0
- package/Source/Core/ITwinPlatform.js +359 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonGeocodeProviderType.js +33 -0
- package/Source/Core/IonGeocoderService.js +72 -0
- package/Source/Core/Rectangle.js +0 -20
- package/Source/Core/TrackingReferenceFrame.js +45 -0
- package/Source/DataSources/Entity.js +15 -1
- package/Source/DataSources/EntityView.js +55 -4
- package/Source/DataSources/SampledProperty.js +24 -0
- package/Source/Renderer/ContextLimits.js +1 -1
- package/Source/Renderer/Texture.js +104 -92
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Cesium3DTilesetStatistics.js +109 -42
- package/Source/Scene/DerivedCommand.js +109 -16
- package/Source/Scene/DynamicEnvironmentMapManager.js +130 -8
- package/Source/Scene/GltfTextureLoader.js +16 -1
- package/Source/Scene/ITwinData.js +138 -0
- package/Source/Scene/Label.js +17 -3
- package/Source/Scene/MetadataClassProperty.js +26 -0
- package/Source/Scene/MetadataPicking.js +108 -17
- package/Source/Scene/MetadataType.js +20 -0
- package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +6 -11
- package/Source/Scene/Model/Model3DTileContent.js +23 -1
- package/Source/Scene/Model/ModelStatistics.js +33 -5
- package/Source/Scene/Model/PointCloudStylingPipelineStage.js +2 -1
- package/Source/Scene/PickedMetadataInfo.js +21 -3
- package/Source/Scene/Picking.js +7 -1
- package/Source/Scene/PostProcessStage.js +14 -17
- package/Source/Scene/PostProcessStageCollection.js +4 -16
- package/Source/Scene/PostProcessStageLibrary.js +13 -51
- package/Source/Scene/PropertyAttributeProperty.js +15 -3
- package/Source/Scene/PropertyTextureProperty.js +12 -0
- package/Source/Scene/Scene.js +17 -2
- package/Source/Scene/SkyBox.js +23 -4
- package/Source/Scene/UrlTemplateImageryProvider.js +5 -5
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +55 -16
- package/Source/Scene/getMetadataProperty.js +48 -0
- package/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/reverseLogDepth.js +1 -1
- package/Source/Shaders/ConvolveSpecularMapFS.glsl +1 -1
- package/Source/Shaders/ConvolveSpecularMapFS.js +1 -1
- package/Source/Shaders/Model/ModelFS.glsl +7 -0
- package/Source/Shaders/Model/ModelFS.js +7 -0
- package/Source/Shaders/Model/ModelVS.glsl +9 -1
- package/Source/Shaders/Model/ModelVS.js +9 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +66 -37
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +66 -37
- package/index.d.ts +286 -40
- package/index.js +59 -53
- package/package.json +1 -1
|
@@ -8,8 +8,11 @@ import JulianDate from "../Core/JulianDate.js";
|
|
|
8
8
|
import CesiumMath from "../Core/Math.js";
|
|
9
9
|
import Matrix3 from "../Core/Matrix3.js";
|
|
10
10
|
import Matrix4 from "../Core/Matrix4.js";
|
|
11
|
+
import Quaternion from "../Core/Quaternion.js";
|
|
12
|
+
import TrackingReferenceFrame from "../Core/TrackingReferenceFrame.js";
|
|
11
13
|
import Transforms from "../Core/Transforms.js";
|
|
12
14
|
import SceneMode from "../Scene/SceneMode.js";
|
|
15
|
+
import VelocityVectorProperty from "./VelocityVectorProperty.js";
|
|
13
16
|
|
|
14
17
|
const updateTransformMatrix3Scratch1 = new Matrix3();
|
|
15
18
|
const updateTransformMatrix3Scratch2 = new Matrix3();
|
|
@@ -21,6 +24,9 @@ const updateTransformCartesian3Scratch3 = new Cartesian3();
|
|
|
21
24
|
const updateTransformCartesian3Scratch4 = new Cartesian3();
|
|
22
25
|
const updateTransformCartesian3Scratch5 = new Cartesian3();
|
|
23
26
|
const updateTransformCartesian3Scratch6 = new Cartesian3();
|
|
27
|
+
const updateTransformOrientationScratch = new Quaternion();
|
|
28
|
+
const velocityScratch = new Cartesian3();
|
|
29
|
+
const rotationScratch = new Matrix3();
|
|
24
30
|
const deltaTime = new JulianDate();
|
|
25
31
|
const northUpAxisFactor = 1.25; // times ellipsoid's maximum radius
|
|
26
32
|
|
|
@@ -30,6 +36,9 @@ function updateTransform(
|
|
|
30
36
|
updateLookAt,
|
|
31
37
|
saveCamera,
|
|
32
38
|
positionProperty,
|
|
39
|
+
velocityProperty,
|
|
40
|
+
orientationProperty,
|
|
41
|
+
trackingReferenceFrame,
|
|
33
42
|
time,
|
|
34
43
|
ellipsoid,
|
|
35
44
|
) {
|
|
@@ -228,7 +237,44 @@ function updateTransform(
|
|
|
228
237
|
}
|
|
229
238
|
|
|
230
239
|
const transform = updateTransformMatrix4Scratch;
|
|
231
|
-
|
|
240
|
+
|
|
241
|
+
let orientation;
|
|
242
|
+
if (defined(orientationProperty)) {
|
|
243
|
+
orientation = orientationProperty.getValue(
|
|
244
|
+
time,
|
|
245
|
+
updateTransformOrientationScratch,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const velocity = velocityProperty.getValue(time, velocityScratch);
|
|
250
|
+
|
|
251
|
+
if (
|
|
252
|
+
trackingReferenceFrame === TrackingReferenceFrame.INERTIAL &&
|
|
253
|
+
defined(orientation)
|
|
254
|
+
) {
|
|
255
|
+
Matrix4.fromTranslationQuaternionRotationScale(
|
|
256
|
+
cartesian,
|
|
257
|
+
orientation,
|
|
258
|
+
Cartesian3.ONE,
|
|
259
|
+
transform,
|
|
260
|
+
);
|
|
261
|
+
} else if (
|
|
262
|
+
trackingReferenceFrame === TrackingReferenceFrame.VELOCITY &&
|
|
263
|
+
defined(velocity)
|
|
264
|
+
) {
|
|
265
|
+
const rotation = Transforms.rotationMatrixFromPositionVelocity(
|
|
266
|
+
cartesian,
|
|
267
|
+
velocity,
|
|
268
|
+
ellipsoid,
|
|
269
|
+
rotationScratch,
|
|
270
|
+
);
|
|
271
|
+
Matrix4.fromRotationTranslation(rotation, cartesian, transform);
|
|
272
|
+
} else if (
|
|
273
|
+
trackingReferenceFrame === TrackingReferenceFrame.ENU ||
|
|
274
|
+
!hasBasis
|
|
275
|
+
) {
|
|
276
|
+
Transforms.eastNorthUpToFixedFrame(cartesian, ellipsoid, transform);
|
|
277
|
+
} else {
|
|
232
278
|
transform[0] = xBasis.x;
|
|
233
279
|
transform[1] = xBasis.y;
|
|
234
280
|
transform[2] = xBasis.z;
|
|
@@ -245,9 +291,6 @@ function updateTransform(
|
|
|
245
291
|
transform[13] = cartesian.y;
|
|
246
292
|
transform[14] = cartesian.z;
|
|
247
293
|
transform[15] = 0.0;
|
|
248
|
-
} else {
|
|
249
|
-
// Stationary or slow-moving, low-altitude objects use East-North-Up.
|
|
250
|
-
Transforms.eastNorthUpToFixedFrame(cartesian, ellipsoid, transform);
|
|
251
294
|
}
|
|
252
295
|
|
|
253
296
|
camera._setTransform(transform);
|
|
@@ -316,6 +359,8 @@ function EntityView(entity, scene, ellipsoid) {
|
|
|
316
359
|
this._lastCartesian = new Cartesian3();
|
|
317
360
|
this._defaultOffset3D = undefined;
|
|
318
361
|
|
|
362
|
+
this._velocityProperty = new VelocityVectorProperty(entity.position, true);
|
|
363
|
+
|
|
319
364
|
this._offset3D = new Cartesian3();
|
|
320
365
|
}
|
|
321
366
|
|
|
@@ -362,10 +407,13 @@ EntityView.prototype.update = function (time, boundingSphere) {
|
|
|
362
407
|
}
|
|
363
408
|
|
|
364
409
|
const entity = this.entity;
|
|
410
|
+
const trackingReferenceFrame = entity.trackingReferenceFrame;
|
|
365
411
|
const positionProperty = entity.position;
|
|
366
412
|
if (!defined(positionProperty)) {
|
|
367
413
|
return;
|
|
368
414
|
}
|
|
415
|
+
const velocityProperty = this._velocityProperty;
|
|
416
|
+
const orientationProperty = entity.orientation;
|
|
369
417
|
const objectChanged = entity !== this._lastEntity;
|
|
370
418
|
const sceneModeChanged = sceneMode !== this._mode;
|
|
371
419
|
|
|
@@ -419,6 +467,9 @@ EntityView.prototype.update = function (time, boundingSphere) {
|
|
|
419
467
|
updateLookAt,
|
|
420
468
|
saveCamera,
|
|
421
469
|
positionProperty,
|
|
470
|
+
velocityProperty,
|
|
471
|
+
orientationProperty,
|
|
472
|
+
trackingReferenceFrame,
|
|
422
473
|
time,
|
|
423
474
|
ellipsoid,
|
|
424
475
|
);
|
|
@@ -674,6 +674,30 @@ SampledProperty.prototype.addSamples = function (
|
|
|
674
674
|
this._definitionChanged.raiseEvent(this);
|
|
675
675
|
};
|
|
676
676
|
|
|
677
|
+
/**
|
|
678
|
+
* Retrieves the time of the provided sample associated with the index. A negative index accesses the list of samples in reverse order.
|
|
679
|
+
*
|
|
680
|
+
* @param {number} index The index of samples list.
|
|
681
|
+
* @returns {JulianDate | undefined} The JulianDate time of the sample, or undefined if failed.
|
|
682
|
+
*/
|
|
683
|
+
SampledProperty.prototype.getSample = function (index) {
|
|
684
|
+
//>>includeStart('debug', pragmas.debug);
|
|
685
|
+
Check.typeOf.number("index", index);
|
|
686
|
+
//>>includeEnd('debug');
|
|
687
|
+
|
|
688
|
+
const times = this._times;
|
|
689
|
+
const len = times.length;
|
|
690
|
+
if (!defined(len)) {
|
|
691
|
+
return undefined;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
if (index < 0) {
|
|
695
|
+
index += len;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
return times[index];
|
|
699
|
+
};
|
|
700
|
+
|
|
677
701
|
/**
|
|
678
702
|
* Adds samples as a single packed array where each new sample is represented as a date,
|
|
679
703
|
* followed by the packed representation of the corresponding value and derivatives.
|
|
@@ -44,7 +44,7 @@ Object.defineProperties(ContextLimits, {
|
|
|
44
44
|
},
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* The approximate maximum cube
|
|
47
|
+
* The approximate maximum cube map width and height supported by this WebGL implementation.
|
|
48
48
|
* The minimum is 16, but most desktop and laptop implementations will support much larger sizes like 8,192.
|
|
49
49
|
* @memberof ContextLimits
|
|
50
50
|
* @type {number}
|
|
@@ -27,6 +27,7 @@ import TextureMinificationFilter from "./TextureMinificationFilter.js";
|
|
|
27
27
|
* @property {number} [width] The pixel width of the texture. If not supplied, must be available from the source.
|
|
28
28
|
* @property {number} [height] The pixel height of the texture. If not supplied, must be available from the source.
|
|
29
29
|
* @property {boolean} [preMultiplyAlpha] If true, the alpha channel will be multiplied into the other channels.
|
|
30
|
+
* @property {string} [id] A unique identifier for the texture. If this is not given, then a GUID will be created.
|
|
30
31
|
*
|
|
31
32
|
* @private
|
|
32
33
|
*/
|
|
@@ -216,7 +217,7 @@ function Texture(options) {
|
|
|
216
217
|
? PixelFormat.compressedTextureSizeInBytes(pixelFormat, width, height)
|
|
217
218
|
: PixelFormat.textureSizeInBytes(pixelFormat, pixelDatatype, width, height);
|
|
218
219
|
|
|
219
|
-
this._id = createGuid();
|
|
220
|
+
this._id = options.id ?? createGuid();
|
|
220
221
|
this._context = context;
|
|
221
222
|
this._textureFilterAnisotropic = context._textureFilterAnisotropic;
|
|
222
223
|
this._textureTarget = gl.TEXTURE_2D;
|
|
@@ -343,7 +344,7 @@ function loadBufferSource(texture, source) {
|
|
|
343
344
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
344
345
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
345
346
|
|
|
346
|
-
let arrayBufferView = source
|
|
347
|
+
let { arrayBufferView } = source;
|
|
347
348
|
if (flipY) {
|
|
348
349
|
arrayBufferView = PixelFormat.flipY(
|
|
349
350
|
arrayBufferView,
|
|
@@ -386,6 +387,62 @@ function loadBufferSource(texture, source) {
|
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Load texel data from a buffer into part of a texture
|
|
392
|
+
*
|
|
393
|
+
* @param {Texture} texture The texture to which texel values will be loaded.
|
|
394
|
+
* @param {TypedArray} arrayBufferView The texel values to be loaded into the texture.
|
|
395
|
+
* @param {number} xOffset The texel x coordinate of the lower left corner of the subregion of the texture to be updated.
|
|
396
|
+
* @param {number} yOffset The texel y coordinate of the lower left corner of the subregion of the texture to be updated.
|
|
397
|
+
* @param {number} width The width of the source data, in pixels.
|
|
398
|
+
* @param {number} width The height of the source data, in pixels.
|
|
399
|
+
*
|
|
400
|
+
* @private
|
|
401
|
+
*/
|
|
402
|
+
function loadPartialBufferSource(
|
|
403
|
+
texture,
|
|
404
|
+
arrayBufferView,
|
|
405
|
+
xOffset,
|
|
406
|
+
yOffset,
|
|
407
|
+
width,
|
|
408
|
+
height,
|
|
409
|
+
) {
|
|
410
|
+
const context = texture._context;
|
|
411
|
+
const gl = context._gl;
|
|
412
|
+
|
|
413
|
+
const { pixelFormat, pixelDatatype } = texture;
|
|
414
|
+
|
|
415
|
+
const unpackAlignment = PixelFormat.alignmentInBytes(
|
|
416
|
+
pixelFormat,
|
|
417
|
+
pixelDatatype,
|
|
418
|
+
width,
|
|
419
|
+
);
|
|
420
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
|
|
421
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
422
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
423
|
+
|
|
424
|
+
if (texture.flipY) {
|
|
425
|
+
arrayBufferView = PixelFormat.flipY(
|
|
426
|
+
arrayBufferView,
|
|
427
|
+
pixelFormat,
|
|
428
|
+
pixelDatatype,
|
|
429
|
+
width,
|
|
430
|
+
height,
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
gl.texSubImage2D(
|
|
434
|
+
texture._textureTarget,
|
|
435
|
+
0,
|
|
436
|
+
xOffset,
|
|
437
|
+
yOffset,
|
|
438
|
+
width,
|
|
439
|
+
height,
|
|
440
|
+
pixelFormat,
|
|
441
|
+
PixelDatatype.toWebGLConstant(pixelDatatype, context),
|
|
442
|
+
arrayBufferView,
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
389
446
|
/**
|
|
390
447
|
* Load texel data from a framebuffer into a texture.
|
|
391
448
|
*
|
|
@@ -448,6 +505,35 @@ function loadImageSource(texture, source) {
|
|
|
448
505
|
);
|
|
449
506
|
}
|
|
450
507
|
|
|
508
|
+
/**
|
|
509
|
+
* Load texel data from an Image into part of a texture
|
|
510
|
+
*
|
|
511
|
+
* @param {Texture} texture The texture to which texel values will be loaded.
|
|
512
|
+
* @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} source The source for texel values to be loaded into the texture.
|
|
513
|
+
* @param {number} xOffset The texel x coordinate of the lower left corner of the subregion of the texture to be updated.
|
|
514
|
+
* @param {number} yOffset The texel y coordinate of the lower left corner of the subregion of the texture to be updated.
|
|
515
|
+
*
|
|
516
|
+
* @private
|
|
517
|
+
*/
|
|
518
|
+
function loadPartialImageSource(texture, source, xOffset, yOffset) {
|
|
519
|
+
const context = texture._context;
|
|
520
|
+
const gl = context._gl;
|
|
521
|
+
|
|
522
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
523
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.preMultiplyAlpha);
|
|
524
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
525
|
+
|
|
526
|
+
gl.texSubImage2D(
|
|
527
|
+
texture._textureTarget,
|
|
528
|
+
0,
|
|
529
|
+
xOffset,
|
|
530
|
+
yOffset,
|
|
531
|
+
texture.pixelFormat,
|
|
532
|
+
PixelDatatype.toWebGLConstant(texture.pixelDatatype, context),
|
|
533
|
+
source,
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
451
537
|
/**
|
|
452
538
|
* Compute a dimension of the image for the next mip level.
|
|
453
539
|
*
|
|
@@ -812,7 +898,6 @@ Texture.prototype.copyFrom = function (options) {
|
|
|
812
898
|
gl.bindTexture(target, this._texture);
|
|
813
899
|
|
|
814
900
|
let { width, height } = source;
|
|
815
|
-
const arrayBufferView = source.arrayBufferView;
|
|
816
901
|
|
|
817
902
|
// Make sure we are using the element's intrinsic width and height where available
|
|
818
903
|
if (defined(source.videoWidth) && defined(source.videoHeight)) {
|
|
@@ -823,25 +908,6 @@ Texture.prototype.copyFrom = function (options) {
|
|
|
823
908
|
height = source.naturalHeight;
|
|
824
909
|
}
|
|
825
910
|
|
|
826
|
-
const textureWidth = this._width;
|
|
827
|
-
const textureHeight = this._height;
|
|
828
|
-
const internalFormat = this._internalFormat;
|
|
829
|
-
const pixelFormat = this._pixelFormat;
|
|
830
|
-
const pixelDatatype = this._pixelDatatype;
|
|
831
|
-
|
|
832
|
-
const preMultiplyAlpha = this._preMultiplyAlpha;
|
|
833
|
-
const flipY = this._flipY;
|
|
834
|
-
|
|
835
|
-
let unpackAlignment = 4;
|
|
836
|
-
if (defined(arrayBufferView)) {
|
|
837
|
-
unpackAlignment = PixelFormat.alignmentInBytes(
|
|
838
|
-
pixelFormat,
|
|
839
|
-
pixelDatatype,
|
|
840
|
-
width,
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
|
|
844
|
-
|
|
845
911
|
if (skipColorSpaceConversion) {
|
|
846
912
|
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
|
|
847
913
|
} else {
|
|
@@ -853,94 +919,40 @@ Texture.prototype.copyFrom = function (options) {
|
|
|
853
919
|
|
|
854
920
|
let uploaded = false;
|
|
855
921
|
if (!this._initialized) {
|
|
856
|
-
let pixels;
|
|
857
922
|
if (
|
|
858
923
|
xOffset === 0 &&
|
|
859
924
|
yOffset === 0 &&
|
|
860
|
-
width ===
|
|
861
|
-
height ===
|
|
925
|
+
width === this._width &&
|
|
926
|
+
height === this._height
|
|
862
927
|
) {
|
|
863
928
|
// initialize the entire texture
|
|
864
|
-
if (defined(arrayBufferView)) {
|
|
865
|
-
|
|
866
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
867
|
-
if (flipY) {
|
|
868
|
-
pixels = PixelFormat.flipY(
|
|
869
|
-
arrayBufferView,
|
|
870
|
-
pixelFormat,
|
|
871
|
-
pixelDatatype,
|
|
872
|
-
textureWidth,
|
|
873
|
-
textureHeight,
|
|
874
|
-
);
|
|
875
|
-
} else {
|
|
876
|
-
pixels = arrayBufferView;
|
|
877
|
-
}
|
|
929
|
+
if (defined(source.arrayBufferView)) {
|
|
930
|
+
loadBufferSource(this, source);
|
|
878
931
|
} else {
|
|
879
|
-
|
|
880
|
-
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
|
|
881
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
|
|
882
|
-
pixels = source;
|
|
932
|
+
loadImageSource(this, source);
|
|
883
933
|
}
|
|
884
934
|
uploaded = true;
|
|
885
935
|
} else {
|
|
886
936
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
887
937
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
888
|
-
|
|
889
|
-
pixels = PixelFormat.createTypedArray(
|
|
890
|
-
pixelFormat,
|
|
891
|
-
pixelDatatype,
|
|
892
|
-
textureWidth,
|
|
893
|
-
textureHeight,
|
|
894
|
-
);
|
|
938
|
+
loadNull(this);
|
|
895
939
|
}
|
|
896
|
-
gl.texImage2D(
|
|
897
|
-
target,
|
|
898
|
-
0,
|
|
899
|
-
internalFormat,
|
|
900
|
-
textureWidth,
|
|
901
|
-
textureHeight,
|
|
902
|
-
0,
|
|
903
|
-
pixelFormat,
|
|
904
|
-
PixelDatatype.toWebGLConstant(pixelDatatype, context),
|
|
905
|
-
pixels,
|
|
906
|
-
);
|
|
907
940
|
this._initialized = true;
|
|
908
941
|
}
|
|
909
942
|
|
|
910
943
|
if (!uploaded) {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
pixelDatatype,
|
|
921
|
-
width,
|
|
922
|
-
height,
|
|
923
|
-
);
|
|
924
|
-
} else {
|
|
925
|
-
pixels = arrayBufferView;
|
|
926
|
-
}
|
|
944
|
+
if (defined(source.arrayBufferView)) {
|
|
945
|
+
loadPartialBufferSource(
|
|
946
|
+
this,
|
|
947
|
+
source.arrayBufferView,
|
|
948
|
+
xOffset,
|
|
949
|
+
yOffset,
|
|
950
|
+
width,
|
|
951
|
+
height,
|
|
952
|
+
);
|
|
927
953
|
} else {
|
|
928
|
-
|
|
929
|
-
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
|
|
930
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
|
|
931
|
-
pixels = source;
|
|
954
|
+
loadPartialImageSource(this, source, xOffset, yOffset);
|
|
932
955
|
}
|
|
933
|
-
gl.texSubImage2D(
|
|
934
|
-
target,
|
|
935
|
-
0,
|
|
936
|
-
xOffset,
|
|
937
|
-
yOffset,
|
|
938
|
-
width,
|
|
939
|
-
height,
|
|
940
|
-
pixelFormat,
|
|
941
|
-
PixelDatatype.toWebGLConstant(pixelDatatype, context),
|
|
942
|
-
pixels,
|
|
943
|
-
);
|
|
944
956
|
}
|
|
945
957
|
|
|
946
958
|
gl.bindTexture(target, null);
|
|
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"
|
|
7
|
+
"AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmSrZYLHFXe7j_lQcsSJKc8-7rwh0IFSNWLGZErkzXRnYjMjURTz-hGiKMEeAJIZBG7uiYEn0Mt1rrwlJGIpirZQC4iO428519DlO3QC9DnRBqLXGTBhirgoU7-Z2209sy87s49kw6NOC8_Eew6nCLf-pZ883DRPRyAYH7LC8cvRLInud0EdndtUFa4y83TamrA.AT1_ahjrWDrq";
|
|
8
8
|
/**
|
|
9
9
|
* Default options for accessing the ArcGIS image tile service.
|
|
10
10
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import defined from "../Core/defined.js";
|
|
2
|
+
import Model3DTileContent from "./Model/Model3DTileContent.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @private
|
|
@@ -29,6 +30,7 @@ function Cesium3DTilesetStatistics() {
|
|
|
29
30
|
// Memory statistics
|
|
30
31
|
this.geometryByteLength = 0;
|
|
31
32
|
this.texturesByteLength = 0;
|
|
33
|
+
this.texturesReferenceCounterById = {};
|
|
32
34
|
this.batchTableByteLength = 0; // batch textures and any binary metadata properties not otherwise accounted for
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -45,61 +47,123 @@ Cesium3DTilesetStatistics.prototype.clear = function () {
|
|
|
45
47
|
this.numberOfTilesCulledWithChildrenUnion = 0;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Increment the counters for the points, triangles, and features
|
|
52
|
+
* that are currently selected for rendering.
|
|
53
|
+
*
|
|
54
|
+
* This will be called recursively for the given content and
|
|
55
|
+
* all its inner contents
|
|
56
|
+
*
|
|
57
|
+
* @param {Cesium3DTileContent} content
|
|
58
|
+
*/
|
|
59
|
+
Cesium3DTilesetStatistics.prototype.incrementSelectionCounts = function (
|
|
60
|
+
content,
|
|
61
|
+
) {
|
|
62
|
+
this.numberOfFeaturesSelected += content.featuresLength;
|
|
63
|
+
this.numberOfPointsSelected += content.pointsLength;
|
|
64
|
+
this.numberOfTrianglesSelected += content.trianglesLength;
|
|
65
|
+
|
|
66
|
+
// Recursive calls on all inner contents
|
|
49
67
|
const contents = content.innerContents;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
if (defined(contents)) {
|
|
69
|
+
const length = contents.length;
|
|
70
|
+
for (let i = 0; i < length; ++i) {
|
|
71
|
+
this.incrementSelectionCounts(contents[i]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
56
75
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Increment the counters for the number of features and points that
|
|
78
|
+
* are currently loaded, and the lengths (size in bytes) of the
|
|
79
|
+
* occupied memory.
|
|
80
|
+
*
|
|
81
|
+
* This will be called recursively for the given content and
|
|
82
|
+
* all its inner contents
|
|
83
|
+
*
|
|
84
|
+
* @param {Cesium3DTileContent} content
|
|
85
|
+
*/
|
|
86
|
+
Cesium3DTilesetStatistics.prototype.incrementLoadCounts = function (content) {
|
|
87
|
+
this.numberOfFeaturesLoaded += content.featuresLength;
|
|
88
|
+
this.numberOfPointsLoaded += content.pointsLength;
|
|
89
|
+
this.geometryByteLength += content.geometryByteLength;
|
|
90
|
+
this.batchTableByteLength += content.batchTableByteLength;
|
|
91
|
+
|
|
92
|
+
// When the content is not a `Model3DTileContent`, then its
|
|
93
|
+
// textures byte length is added directly
|
|
94
|
+
if (!(content instanceof Model3DTileContent)) {
|
|
95
|
+
this.texturesByteLength += content.texturesByteLength;
|
|
71
96
|
} else {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
97
|
+
// When the content is a `Model3DTileContent`, then increment the
|
|
98
|
+
// reference counter for all its textures. The byte length of any
|
|
99
|
+
// newly tracked texture to the total textures byte length
|
|
100
|
+
const textureIds = content.getTextureIds();
|
|
101
|
+
for (const textureId of textureIds) {
|
|
102
|
+
const referenceCounter =
|
|
103
|
+
this.texturesReferenceCounterById[textureId] ?? 0;
|
|
104
|
+
if (referenceCounter === 0) {
|
|
105
|
+
const textureByteLength = content.getTextureByteLengthById(textureId);
|
|
106
|
+
this.texturesByteLength += textureByteLength;
|
|
107
|
+
}
|
|
108
|
+
this.texturesReferenceCounterById[textureId] = referenceCounter + 1;
|
|
109
|
+
}
|
|
81
110
|
}
|
|
82
111
|
|
|
112
|
+
// Recursive calls on all inner contents
|
|
113
|
+
const contents = content.innerContents;
|
|
83
114
|
if (defined(contents)) {
|
|
84
115
|
const length = contents.length;
|
|
85
116
|
for (let i = 0; i < length; ++i) {
|
|
86
|
-
|
|
117
|
+
this.incrementLoadCounts(contents[i]);
|
|
87
118
|
}
|
|
88
119
|
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
Cesium3DTilesetStatistics.prototype.incrementSelectionCounts = function (
|
|
92
|
-
content,
|
|
93
|
-
) {
|
|
94
|
-
updatePointAndFeatureCounts(this, content, false, false);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
Cesium3DTilesetStatistics.prototype.incrementLoadCounts = function (content) {
|
|
98
|
-
updatePointAndFeatureCounts(this, content, false, true);
|
|
99
120
|
};
|
|
100
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Decrement the counters for the number of features and points that
|
|
124
|
+
* are currently loaded, and the lengths (size in bytes) of the
|
|
125
|
+
* occupied memory.
|
|
126
|
+
*
|
|
127
|
+
* This will be called recursively for the given content and
|
|
128
|
+
* all its inner contents
|
|
129
|
+
*
|
|
130
|
+
* @param {Cesium3DTileContent} content
|
|
131
|
+
*/
|
|
101
132
|
Cesium3DTilesetStatistics.prototype.decrementLoadCounts = function (content) {
|
|
102
|
-
|
|
133
|
+
this.numberOfFeaturesLoaded -= content.featuresLength;
|
|
134
|
+
this.numberOfPointsLoaded -= content.pointsLength;
|
|
135
|
+
this.geometryByteLength -= content.geometryByteLength;
|
|
136
|
+
this.batchTableByteLength -= content.batchTableByteLength;
|
|
137
|
+
|
|
138
|
+
// When the content is not a `Model3DTileContent`, then its
|
|
139
|
+
// textures byte length is subtracted directly
|
|
140
|
+
if (!(content instanceof Model3DTileContent)) {
|
|
141
|
+
this.texturesByteLength -= content.texturesByteLength;
|
|
142
|
+
} else {
|
|
143
|
+
// When the content is a `Model3DTileContent`, then decrement the
|
|
144
|
+
// reference counter for all its textures. The byte length of any
|
|
145
|
+
// texture that is no longer references is subtracted from the
|
|
146
|
+
// total textures byte length
|
|
147
|
+
const textureIds = content.getTextureIds();
|
|
148
|
+
for (const textureId of textureIds) {
|
|
149
|
+
const referenceCounter = this.texturesReferenceCounterById[textureId];
|
|
150
|
+
if (referenceCounter === 1) {
|
|
151
|
+
delete this.texturesReferenceCounterById[textureId];
|
|
152
|
+
const textureByteLength = content.getTextureByteLengthById(textureId);
|
|
153
|
+
this.texturesByteLength -= textureByteLength;
|
|
154
|
+
} else {
|
|
155
|
+
this.texturesReferenceCounterById[textureId] = referenceCounter - 1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Recursive calls on all inner contents
|
|
160
|
+
const contents = content.innerContents;
|
|
161
|
+
if (defined(contents)) {
|
|
162
|
+
const length = contents.length;
|
|
163
|
+
for (let i = 0; i < length; ++i) {
|
|
164
|
+
this.decrementLoadCounts(contents[i]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
103
167
|
};
|
|
104
168
|
|
|
105
169
|
Cesium3DTilesetStatistics.clone = function (statistics, result) {
|
|
@@ -124,6 +188,9 @@ Cesium3DTilesetStatistics.clone = function (statistics, result) {
|
|
|
124
188
|
statistics.numberOfTilesCulledWithChildrenUnion;
|
|
125
189
|
result.geometryByteLength = statistics.geometryByteLength;
|
|
126
190
|
result.texturesByteLength = statistics.texturesByteLength;
|
|
191
|
+
result.texturesReferenceCounterById = {
|
|
192
|
+
...statistics.texturesReferenceCounterById,
|
|
193
|
+
};
|
|
127
194
|
result.batchTableByteLength = statistics.batchTableByteLength;
|
|
128
195
|
};
|
|
129
196
|
export default Cesium3DTilesetStatistics;
|