@cesium/engine 18.3.1-ion.1 → 20.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/ThirdParty/Workers/pako_deflate.min.js +3 -3
- package/Build/ThirdParty/Workers/pako_inflate.min.js +3 -3
- package/Build/ThirdParty/Workers/z-worker-pako.js +80 -89
- package/Build/Workers/{chunk-G7F2CKBW.js → chunk-22LUVCO3.js} +2 -2
- package/Build/Workers/{chunk-AIBIEA2N.js → chunk-3BO4XBWM.js} +12 -12
- package/Build/Workers/{chunk-LPLMZKZS.js → chunk-3SQPZVG4.js} +1 -1
- package/Build/Workers/{chunk-KQ7OYXT6.js → chunk-4O5SZ2RE.js} +3 -3
- package/Build/Workers/{chunk-EF747DYS.js → chunk-4UIKSIEZ.js} +9 -9
- package/Build/Workers/{chunk-LDFRBRJO.js → chunk-5FZEM66Y.js} +12 -12
- package/Build/Workers/{chunk-Z7UO3S7L.js → chunk-5G56VVL3.js} +10 -10
- package/Build/Workers/{chunk-KUVAFSVU.js → chunk-5GKRDXYJ.js} +12 -12
- package/Build/Workers/{chunk-GIRJEZHU.js → chunk-5W4EBNO3.js} +14 -14
- package/Build/Workers/{chunk-XMFKOU5X.js → chunk-67RLCIDP.js} +7 -7
- package/Build/Workers/{chunk-ACOAKTBU.js → chunk-74VODBWB.js} +4 -4
- package/Build/Workers/{chunk-QTFE5TBC.js → chunk-7HOD2LGH.js} +10 -10
- package/Build/Workers/{chunk-GOSJZP7N.js → chunk-D25QOWHR.js} +1 -1
- package/Build/Workers/{chunk-5UWLMG6V.js → chunk-D63DK275.js} +7 -7
- package/Build/Workers/{chunk-4JMMKZ4N.js → chunk-EHOOC4HJ.js} +5 -5
- package/Build/Workers/{chunk-PFTYXAVG.js → chunk-ELI5ZYDR.js} +5 -5
- package/Build/Workers/{chunk-RQRKALHB.js → chunk-FGF4ETPY.js} +9 -9
- package/Build/Workers/{chunk-YPMSP4IH.js → chunk-FKWL63D4.js} +5 -5
- package/Build/Workers/{chunk-IC5M3JRR.js → chunk-FLH3ZH2X.js} +4 -4
- package/Build/Workers/{chunk-5DF22LFV.js → chunk-HDOFAYEE.js} +16 -16
- package/Build/Workers/{chunk-37V6UO2J.js → chunk-HHUHFFYN.js} +5 -5
- package/Build/Workers/{chunk-GSLSXQGX.js → chunk-IHUXLSNT.js} +5 -4
- package/Build/Workers/{chunk-K4HUWRWA.js → chunk-IJM2HVTV.js} +1 -1
- package/Build/Workers/{chunk-AKLRSDAY.js → chunk-IPXMWP5Z.js} +6 -6
- package/Build/Workers/{chunk-G6I5XO4E.js → chunk-IWKYS6RV.js} +6 -6
- package/Build/Workers/{chunk-RVQ7LHW3.js → chunk-JMX3P7DE.js} +8 -8
- package/Build/Workers/{chunk-OQNQNBEM.js → chunk-JQSMAZAT.js} +9 -9
- package/Build/Workers/{chunk-GGNZKIG3.js → chunk-JRLT2FQV.js} +8 -8
- package/Build/Workers/{chunk-GK5WVMVN.js → chunk-KRXL3KZL.js} +13 -13
- package/Build/Workers/{chunk-OVXYMPQ7.js → chunk-KWB7PPVO.js} +2 -2
- package/Build/Workers/{chunk-DG4CHTQN.js → chunk-M62PWLGC.js} +16 -16
- package/Build/Workers/{chunk-T3UE5LOS.js → chunk-MSLO3MQF.js} +5 -5
- package/Build/Workers/{chunk-ZGH3R3CO.js → chunk-MZZK44UI.js} +6 -6
- package/Build/Workers/{chunk-3T2QV5NN.js → chunk-NB2NKFJL.js} +6 -6
- package/Build/Workers/{chunk-W2EMENZQ.js → chunk-NJYFQE5B.js} +1 -1
- package/Build/Workers/{chunk-GG2NLIC6.js → chunk-O2O4FYNI.js} +2 -2
- package/Build/Workers/{chunk-6HT3OW6S.js → chunk-PZEPLREA.js} +2 -2
- package/Build/Workers/{chunk-MYMBUYST.js → chunk-S2RSJJQI.js} +4 -4
- package/Build/Workers/{chunk-QBRCP474.js → chunk-S3UYLP3X.js} +8 -8
- package/Build/Workers/{chunk-JVSY3BGV.js → chunk-TH3P77KJ.js} +5 -5
- package/Build/Workers/{chunk-4HDG7AFU.js → chunk-UGSQJYGE.js} +6 -6
- package/Build/Workers/{chunk-SMVRX64E.js → chunk-UUXOFY6G.js} +12 -12
- package/Build/Workers/{chunk-DPG3EG2U.js → chunk-V36BVRDX.js} +11 -11
- package/Build/Workers/{chunk-3HRMP3V7.js → chunk-VJ2DNCFT.js} +4 -4
- package/Build/Workers/{chunk-DH3XQXDD.js → chunk-VQUVJWBK.js} +4 -4
- package/Build/Workers/{chunk-AJANTRVW.js → chunk-VWQWZ7OL.js} +5 -5
- package/Build/Workers/{chunk-XPXBRZXF.js → chunk-VXBNLAG4.js} +7 -7
- package/Build/Workers/{chunk-GXEQK7P4.js → chunk-W3KNMQT2.js} +6 -6
- package/Build/Workers/{chunk-5RUDB5R4.js → chunk-WIGH3CPD.js} +2 -2
- package/Build/Workers/{chunk-GMNXNBM4.js → chunk-XVHLXVN3.js} +1 -1
- package/Build/Workers/{chunk-KSNUH6WJ.js → chunk-YHB3RNF2.js} +4 -4
- package/Build/Workers/{chunk-BTXGNWFF.js → chunk-ZSHDRKLT.js} +4 -4
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +25 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +17 -16
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/LICENSE.md +32 -25
- package/Source/Core/Ellipsoid.js +9 -0
- package/Source/Core/ITwinPlatform.js +8 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +14 -8
- package/Source/Core/ScreenSpaceEventHandler.js +3 -3
- package/Source/Core/addAllToArray.js +40 -0
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +54 -26
- package/Source/Renderer/Context.js +8 -4
- package/Source/Renderer/Renderbuffer.js +4 -2
- package/Source/Renderer/Sampler.js +13 -0
- package/Source/Renderer/ShaderBuilder.js +7 -6
- package/Source/Renderer/SharedContext.js +186 -0
- package/Source/Renderer/Texture.js +4 -5
- package/Source/Renderer/Texture3D.js +17 -7
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/Cesium3DTileBatchTable.js +6 -4
- package/Source/Scene/Cesium3DTileContentFactory.js +7 -16
- package/Source/Scene/Cesium3DTileStyle.js +4 -3
- package/Source/Scene/Cesium3DTileset.js +2 -2
- package/Source/Scene/ConditionsExpression.js +3 -2
- package/Source/Scene/GaussianSplat3DTileContent.js +253 -9
- package/Source/Scene/GaussianSplatPrimitive.js +167 -15
- package/Source/Scene/GltfLoader.js +23 -4
- package/Source/Scene/GltfPipeline/ForEach.js +7 -7
- package/Source/Scene/GltfPipeline/addDefaults.js +1 -2
- package/Source/Scene/GltfPipeline/addToArray.js +2 -0
- package/Source/Scene/GltfPipeline/findAccessorMinMax.js +1 -1
- package/Source/Scene/GltfPipeline/getComponentReader.js +16 -16
- package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +1 -1
- package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +3 -3
- package/Source/Scene/GltfPipeline/parseGlb.js +1 -1
- package/Source/Scene/GltfPipeline/readAccessorPacked.js +2 -2
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +5 -6
- package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +13 -13
- package/Source/Scene/GltfSpzLoader.js +3 -1
- package/Source/Scene/GltfVertexBufferLoader.js +56 -2
- package/Source/Scene/HeightReference.js +1 -1
- package/Source/Scene/ITwinData.js +49 -25
- package/Source/Scene/ImageBasedLighting.js +6 -2
- package/Source/Scene/ImageryLayer.js +10 -10
- package/Source/Scene/MetadataTableProperty.js +2 -1
- package/Source/Scene/Model/ClassificationModelDrawCommand.js +7 -6
- package/Source/Scene/Model/GeoJsonLoader.js +3 -1
- package/Source/Scene/Model/ImageryConfiguration.js +1 -0
- package/Source/Scene/Model/ImageryPipelineStage.js +8 -2
- package/Source/Scene/Model/InstancingPipelineStage.js +3 -8
- package/Source/Scene/Model/MaterialPipelineStage.js +10 -1
- package/Source/Scene/Model/Model.js +3 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +8 -2
- package/Source/Scene/Model/ModelImagery.js +3 -0
- package/Source/Scene/Model/ModelSceneGraph.js +2 -1
- package/Source/Scene/Model/ModelUtility.js +1 -0
- package/Source/Scene/Model/PntsLoader.js +7 -3
- package/Source/Scene/Picking.js +41 -1
- package/Source/Scene/PntsParser.js +6 -3
- package/Source/Scene/Primitive.js +0 -1
- package/Source/Scene/PrimitiveCollection.js +32 -6
- package/Source/Scene/PrimitiveLoadPlan.js +1 -37
- package/Source/Scene/PropertyTable.js +7 -12
- package/Source/Scene/Scene.js +41 -32
- package/Source/Scene/ScreenSpaceCameraController.js +2 -0
- package/Source/Scene/VertexAttributeSemantic.js +4 -2
- package/Source/Scene/WebMapServiceImageryProvider.js +3 -2
- package/Source/Scene/WebMapTileServiceImageryProvider.js +0 -22
- package/Source/Scene/getMeshPrimitives.js +72 -0
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +2 -1
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +2 -1
- package/Source/Shaders/EllipsoidVS.glsl +4 -4
- package/Source/Shaders/EllipsoidVS.js +4 -4
- package/Source/Shaders/FXAA3_11.glsl +2 -0
- package/Source/Shaders/FXAA3_11.js +2 -0
- package/Source/Shaders/GlobeVS.glsl +2 -1
- package/Source/Shaders/GlobeVS.js +2 -1
- package/Source/Shaders/PrimitiveGaussianSplatFS.glsl +5 -5
- package/Source/Shaders/PrimitiveGaussianSplatFS.js +5 -5
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +102 -5
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +102 -5
- package/Source/Shaders/SkyAtmosphereVS.glsl +2 -1
- package/Source/Shaders/SkyAtmosphereVS.js +2 -1
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/index.d.ts +191 -54
- package/index.js +93 -90
- package/package.json +4 -4
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import clone from "../Core/clone.js";
|
|
2
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
3
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
4
|
+
import Context from "./Context.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Enables a single WebGL context to be used by any number of {@link Scene}s.
|
|
8
|
+
* You can pass a SharedContext in place of a {@link ContextOptions} to the constructors of {@link Scene}, {@link CesiumWidget}, and {@link Viewer}.
|
|
9
|
+
* {@link Primitive}s associated with the shared WebGL context can be displayed in any Scene that uses the same context.
|
|
10
|
+
* The context renders each Scene to an off-screen canvas, then blits the result to that Scene's on-screen canvas.
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
* @alias SharedContext
|
|
14
|
+
* @constructor
|
|
15
|
+
*
|
|
16
|
+
* @param {object} [options] Object with the following properties:
|
|
17
|
+
* @param {ContextOptions} [options.contextOptions] Context and WebGL creation properties.
|
|
18
|
+
* @param {boolean} [options.autoDestroy=true] Destroys this context and all of its WebGL resources after all Scenes using the context are destroyed.
|
|
19
|
+
|
|
20
|
+
* @see {@link http://www.khronos.org/registry/webgl/specs/latest/#5.2|WebGLContextAttributes}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Create two Scenes sharing a single WebGL context
|
|
24
|
+
* const context = new Cesium.SharedContext();
|
|
25
|
+
* const scene1 = new Cesium.Scene({
|
|
26
|
+
* canvas: canvas1,
|
|
27
|
+
* contextOptions: context,
|
|
28
|
+
* });
|
|
29
|
+
* const scene2 = new Cesium.Scene({
|
|
30
|
+
* canvas: canvas2,
|
|
31
|
+
* contextOptions: context,
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
function SharedContext(options) {
|
|
35
|
+
this._autoDestroy = options?.autoDestroy ?? true;
|
|
36
|
+
this._canvas = document.createElement("canvas");
|
|
37
|
+
this._context = new Context(this._canvas, clone(options?.contextOptions));
|
|
38
|
+
this._canvases = [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of {@link Context} that manages the shared WebGL context for a specific canvas.
|
|
43
|
+
* @param {HTMLCanvasElement} canvas The canvas element to which the context will be associated
|
|
44
|
+
* @returns {Context} The created context instance
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
SharedContext.prototype.createSceneContext = function (canvas) {
|
|
48
|
+
const context2d = canvas.getContext("2d", { alpha: true });
|
|
49
|
+
|
|
50
|
+
//>>includeStart('debug', pragmas.debug);
|
|
51
|
+
if (!context2d) {
|
|
52
|
+
throw new DeveloperError(
|
|
53
|
+
"canvas used with SharedContext must provide a 2d context",
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this._canvases.includes(canvas)) {
|
|
58
|
+
throw new DeveloperError("canvas is already associated with a scene");
|
|
59
|
+
}
|
|
60
|
+
//>>includeEnd('debug');
|
|
61
|
+
|
|
62
|
+
const sharedContext = this;
|
|
63
|
+
sharedContext._canvases.push(canvas);
|
|
64
|
+
|
|
65
|
+
let isDestroyed = false;
|
|
66
|
+
const destroy = function () {
|
|
67
|
+
isDestroyed = true;
|
|
68
|
+
const index = sharedContext._canvases.indexOf(canvas);
|
|
69
|
+
if (-1 !== index) {
|
|
70
|
+
sharedContext._canvases.splice(index, 1);
|
|
71
|
+
if (sharedContext._autoDestroy && sharedContext._canvases.length === 0) {
|
|
72
|
+
sharedContext.destroy();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const beginFrame = function () {
|
|
78
|
+
// Ensure the off-screen canvas is at least as large as the on-screen canvas.
|
|
79
|
+
const sharedCanvas = sharedContext._context.canvas;
|
|
80
|
+
|
|
81
|
+
const width = this.drawingBufferWidth;
|
|
82
|
+
if (sharedCanvas.width < width) {
|
|
83
|
+
sharedCanvas.width = width;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const height = this.drawingBufferHeight;
|
|
87
|
+
if (sharedCanvas.height < height) {
|
|
88
|
+
sharedCanvas.height = height;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const endFrame = function () {
|
|
93
|
+
// Blit the image from the off-screen canvas to the on-screen canvas.
|
|
94
|
+
const w = this.drawingBufferWidth;
|
|
95
|
+
const h = this.drawingBufferHeight;
|
|
96
|
+
const yOffset = sharedContext._context.canvas.height - h; // drawImage has top as Y=0, GL has bottom as Y=0
|
|
97
|
+
context2d.drawImage(
|
|
98
|
+
sharedContext._context.canvas,
|
|
99
|
+
0,
|
|
100
|
+
yOffset,
|
|
101
|
+
w,
|
|
102
|
+
h,
|
|
103
|
+
0,
|
|
104
|
+
0,
|
|
105
|
+
w,
|
|
106
|
+
h,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Do normal post-frame cleanup.
|
|
110
|
+
sharedContext._context.endFrame();
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const proxy = new Proxy(this._context, {
|
|
114
|
+
get(target, prop, receiver) {
|
|
115
|
+
if (prop === "isDestroyed") {
|
|
116
|
+
return function () {
|
|
117
|
+
return isDestroyed;
|
|
118
|
+
};
|
|
119
|
+
} else if (isDestroyed) {
|
|
120
|
+
//>>includeStart('debug', pragmas.debug);
|
|
121
|
+
throw new DeveloperError(
|
|
122
|
+
"This object was destroyed, i.e., destroy() was called.",
|
|
123
|
+
);
|
|
124
|
+
//>>includeEnd('debug');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
switch (prop) {
|
|
128
|
+
case "_canvas":
|
|
129
|
+
return canvas;
|
|
130
|
+
case "destroy":
|
|
131
|
+
return destroy;
|
|
132
|
+
case "drawingBufferWidth":
|
|
133
|
+
return canvas.width;
|
|
134
|
+
case "drawingBufferHeight":
|
|
135
|
+
return canvas.height;
|
|
136
|
+
case "beginFrame":
|
|
137
|
+
return beginFrame;
|
|
138
|
+
case "endFrame":
|
|
139
|
+
return endFrame;
|
|
140
|
+
default:
|
|
141
|
+
return Reflect.get(target, prop, receiver);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
return proxy;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
151
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
152
|
+
* <br /><br />
|
|
153
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
154
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
155
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
156
|
+
* <br /><br />
|
|
157
|
+
* By default, a SharedContext is destroyed automatically once the last Scene using it is destroyed, in which case it
|
|
158
|
+
* is not necessary to call this method directly.
|
|
159
|
+
*
|
|
160
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* context = context && context.destroy();
|
|
164
|
+
*
|
|
165
|
+
* @see SharedContext#isDestroyed
|
|
166
|
+
*/
|
|
167
|
+
SharedContext.prototype.destroy = function () {
|
|
168
|
+
this._context.destroy();
|
|
169
|
+
destroyObject(this);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
174
|
+
* <br /><br />
|
|
175
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
176
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
177
|
+
*
|
|
178
|
+
* @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
179
|
+
*
|
|
180
|
+
* @see SharedContext#destroy
|
|
181
|
+
*/
|
|
182
|
+
SharedContext.prototype.isDestroyed = function () {
|
|
183
|
+
return false;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export default SharedContext;
|
|
@@ -623,13 +623,12 @@ Texture.fromFramebuffer = function (options) {
|
|
|
623
623
|
//>>includeEnd('debug');
|
|
624
624
|
|
|
625
625
|
const context = options.context;
|
|
626
|
-
const gl = context._gl;
|
|
627
626
|
const {
|
|
628
627
|
pixelFormat = PixelFormat.RGB,
|
|
629
628
|
framebufferXOffset = 0,
|
|
630
629
|
framebufferYOffset = 0,
|
|
631
|
-
width =
|
|
632
|
-
height =
|
|
630
|
+
width = context.drawingBufferWidth,
|
|
631
|
+
height = context.drawingBufferHeight,
|
|
633
632
|
framebuffer,
|
|
634
633
|
} = options;
|
|
635
634
|
|
|
@@ -656,12 +655,12 @@ Texture.fromFramebuffer = function (options) {
|
|
|
656
655
|
framebufferYOffset,
|
|
657
656
|
0,
|
|
658
657
|
);
|
|
659
|
-
if (framebufferXOffset + width >
|
|
658
|
+
if (framebufferXOffset + width > context.drawingBufferWidth) {
|
|
660
659
|
throw new DeveloperError(
|
|
661
660
|
"framebufferXOffset + width must be less than or equal to drawingBufferWidth",
|
|
662
661
|
);
|
|
663
662
|
}
|
|
664
|
-
if (framebufferYOffset + height >
|
|
663
|
+
if (framebufferYOffset + height > context.drawingBufferHeight) {
|
|
665
664
|
throw new DeveloperError(
|
|
666
665
|
"framebufferYOffset + height must be less than or equal to drawingBufferHeight.",
|
|
667
666
|
);
|
|
@@ -13,21 +13,30 @@ import Sampler from "./Sampler.js";
|
|
|
13
13
|
import TextureMagnificationFilter from "./TextureMagnificationFilter.js";
|
|
14
14
|
import TextureMinificationFilter from "./TextureMinificationFilter.js";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} Texture3D.Source
|
|
18
|
+
* @property {number} width The width (in pixels) of the 3D texture source data.
|
|
19
|
+
* @property {number} height The height (in pixels) of the 3D texture source data.
|
|
20
|
+
* @property {number} depth The depth (in pixels) of the 3D texture source data.
|
|
21
|
+
* @property {TypedArray|DataView} arrayBufferView The source data for a 3D texture. The type of each element needs to match the pixelDatatype.
|
|
22
|
+
* @property {TypedArray|DataView} [mipLevels] An array of mip level data. Each element in the array should be a TypedArray or DataView that matches the pixelDatatype.
|
|
23
|
+
*/
|
|
24
|
+
|
|
16
25
|
/**
|
|
17
26
|
* @typedef {object} Texture3D.ConstructorOptions
|
|
18
27
|
*
|
|
19
28
|
* @property {Context} context
|
|
20
|
-
* @property {
|
|
29
|
+
* @property {Texture3D.Source} [source] The source for texel values to be loaded into the 3D texture.
|
|
21
30
|
* @property {PixelFormat} [pixelFormat=PixelFormat.RGBA] The format of each pixel, i.e., the number of components it has and what they represent.
|
|
22
31
|
* @property {PixelDatatype} [pixelDatatype=PixelDatatype.UNSIGNED_BYTE] The data type of each pixel.
|
|
23
32
|
* @property {boolean} [flipY=true] If true, the source values will be read as if the y-axis is inverted (y=0 at the top).
|
|
24
33
|
* @property {boolean} [skipColorSpaceConversion=false] If true, color space conversions will be skipped when reading the texel values.
|
|
25
|
-
* @property {Sampler} [sampler] Information about how to sample the
|
|
26
|
-
* @property {number} [width] The
|
|
27
|
-
* @property {number} [height] The
|
|
28
|
-
* @property {number} [depth] The
|
|
34
|
+
* @property {Sampler} [sampler] Information about how to sample the 3D texture.
|
|
35
|
+
* @property {number} [width] The width (in pixels) of the 3D texture. If not supplied, must be available from the source.
|
|
36
|
+
* @property {number} [height] The height (in pixels) of the 3D texture. If not supplied, must be available from the source.
|
|
37
|
+
* @property {number} [depth] The depth (in pixels) of the 3D texture. If not supplied, must be available from the source.
|
|
29
38
|
* @property {boolean} [preMultiplyAlpha] If true, the alpha channel will be multiplied into the other channels.
|
|
30
|
-
* @property {string} [id] A unique identifier for the
|
|
39
|
+
* @property {string} [id] A unique identifier for the 3D texture. If this is not given, then a GUID will be created.
|
|
31
40
|
*
|
|
32
41
|
* @private
|
|
33
42
|
*/
|
|
@@ -253,7 +262,7 @@ function Texture3D(options) {
|
|
|
253
262
|
* Load texel data from a buffer into a texture3D.
|
|
254
263
|
*
|
|
255
264
|
* @param {Texture3D} texture3D The texture3D to which texel values will be loaded.
|
|
256
|
-
* @param {
|
|
265
|
+
* @param {Texture3D.Source} source The source for texel values to be loaded into the texture3D.
|
|
257
266
|
*
|
|
258
267
|
* @private
|
|
259
268
|
*/
|
|
@@ -503,6 +512,7 @@ function setupSampler(texture3D, sampler) {
|
|
|
503
512
|
gl.bindTexture(target, texture3D._texture);
|
|
504
513
|
gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minificationFilter);
|
|
505
514
|
gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magnificationFilter);
|
|
515
|
+
gl.texParameteri(target, gl.TEXTURE_WRAP_R, sampler.wrapR);
|
|
506
516
|
gl.texParameteri(target, gl.TEXTURE_WRAP_S, sampler.wrapS);
|
|
507
517
|
gl.texParameteri(target, gl.TEXTURE_WRAP_T, sampler.wrapT);
|
|
508
518
|
if (defined(texture3D._textureFilterAnisotropic)) {
|
|
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"
|
|
7
|
+
"AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmRXcPUeuOd6ZTh-Z86vRv6teqZdBYLUWIxB6HTYajPhFtAlXhMdqTg07UwlBQ59KbiReC5wCeOF4LzLTW4oaSPp-t4pEcJHnFePlnFcIPXM7R565gTy6f6fMuZAXPvUEuZSMf8dvTqHyV9-Zd9eZGWokDzKC4uEtHME7OeAk3oyZ7vzkjEo8fpuIfFw0sH8vQU.AT1_PLgWE6Lc";
|
|
8
8
|
/**
|
|
9
9
|
* Default options for accessing the ArcGIS image tile service.
|
|
10
10
|
*
|
|
@@ -1118,7 +1118,7 @@ function writeCompressedAttrib1(
|
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
-
const imageWidth = billboard.width ?? 0;
|
|
1121
|
+
const imageWidth = Math.round(billboard.width ?? 0);
|
|
1122
1122
|
billboardCollection._maxSize = Math.max(
|
|
1123
1123
|
billboardCollection._maxSize,
|
|
1124
1124
|
imageWidth,
|
|
@@ -160,7 +160,7 @@ async function requestMetadata(
|
|
|
160
160
|
const cacheKey = metadataResource.url;
|
|
161
161
|
let promise = BingMapsImageryProvider._metadataCache[cacheKey];
|
|
162
162
|
if (!defined(promise)) {
|
|
163
|
-
promise = metadataResource.
|
|
163
|
+
promise = metadataResource.fetchJson();
|
|
164
164
|
BingMapsImageryProvider._metadataCache[cacheKey] = promise;
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -23,6 +23,7 @@ import getBinaryAccessor from "./getBinaryAccessor.js";
|
|
|
23
23
|
import StencilConstants from "./StencilConstants.js";
|
|
24
24
|
import StencilFunction from "./StencilFunction.js";
|
|
25
25
|
import StencilOperation from "./StencilOperation.js";
|
|
26
|
+
import addAllToArray from "../Core/addAllToArray.js";
|
|
26
27
|
|
|
27
28
|
const DEFAULT_COLOR_VALUE = BatchTexture.DEFAULT_COLOR_VALUE;
|
|
28
29
|
const DEFAULT_SHOW_VALUE = BatchTexture.DEFAULT_SHOW_VALUE;
|
|
@@ -369,13 +370,14 @@ Cesium3DTileBatchTable.prototype.getPropertyIds = function (batchId, results) {
|
|
|
369
370
|
results.length = 0;
|
|
370
371
|
|
|
371
372
|
const scratchPropertyIds = Object.keys(this._properties);
|
|
372
|
-
|
|
373
|
+
addAllToArray(results, scratchPropertyIds);
|
|
373
374
|
|
|
374
375
|
if (defined(this._batchTableHierarchy)) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
const propertyIds = this._batchTableHierarchy.getPropertyIds(
|
|
377
|
+
batchId,
|
|
378
|
+
scratchPropertyIds,
|
|
378
379
|
);
|
|
380
|
+
addAllToArray(results, propertyIds);
|
|
379
381
|
}
|
|
380
382
|
|
|
381
383
|
return results;
|
|
@@ -93,28 +93,19 @@ const Cesium3DTileContentFactory = {
|
|
|
93
93
|
const dataView = new DataView(arrayBuffer, byteOffset);
|
|
94
94
|
const byteLength = dataView.getUint32(8, true);
|
|
95
95
|
const glb = new Uint8Array(arrayBuffer, byteOffset, byteLength);
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
if (hasGaussianSplatExtension) {
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
GaussianSplat3DTileContent.tilesetRequiresGaussianSplattingExt(tileset)
|
|
99
|
+
) {
|
|
103
100
|
return GaussianSplat3DTileContent.fromGltf(tileset, tile, resource, glb);
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
return Model3DTileContent.fromGltf(tileset, tile, resource, glb);
|
|
107
104
|
},
|
|
108
105
|
gltf: function (tileset, tile, resource, json) {
|
|
109
|
-
|
|
110
|
-
tileset
|
|
111
|
-
|
|
112
|
-
if (tileset.isGltfExtensionRequired instanceof Function) {
|
|
113
|
-
hasGaussianSplatExtension = tileset.isGltfExtensionRequired(
|
|
114
|
-
"KHR_spz_gaussian_splats_compression",
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
if (forceGaussianSplats || hasGaussianSplatExtension) {
|
|
106
|
+
if (
|
|
107
|
+
GaussianSplat3DTileContent.tilesetRequiresGaussianSplattingExt(tileset)
|
|
108
|
+
) {
|
|
118
109
|
return GaussianSplat3DTileContent.fromGltf(tileset, tile, resource, json);
|
|
119
110
|
}
|
|
120
111
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import addAllToArray from "../Core/addAllToArray.js";
|
|
1
2
|
import clone from "../Core/clone.js";
|
|
2
3
|
import Frozen from "../Core/Frozen.js";
|
|
3
4
|
import defined from "../Core/defined.js";
|
|
@@ -1452,15 +1453,15 @@ Cesium3DTileStyle.prototype.getVariables = function () {
|
|
|
1452
1453
|
let variables = [];
|
|
1453
1454
|
|
|
1454
1455
|
if (defined(this.color) && defined(this.color.getVariables)) {
|
|
1455
|
-
|
|
1456
|
+
addAllToArray(variables, this.color.getVariables());
|
|
1456
1457
|
}
|
|
1457
1458
|
|
|
1458
1459
|
if (defined(this.show) && defined(this.show.getVariables)) {
|
|
1459
|
-
|
|
1460
|
+
addAllToArray(variables, this.show.getVariables());
|
|
1460
1461
|
}
|
|
1461
1462
|
|
|
1462
1463
|
if (defined(this.pointSize) && defined(this.pointSize.getVariables)) {
|
|
1463
|
-
|
|
1464
|
+
addAllToArray(variables, this.pointSize.getVariables());
|
|
1464
1465
|
}
|
|
1465
1466
|
|
|
1466
1467
|
// Remove duplicates
|
|
@@ -119,7 +119,7 @@ import ImageryLayerCollection from "./ImageryLayerCollection.js";
|
|
|
119
119
|
* @property {string|number} [instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
120
120
|
* @property {boolean} [showCreditsOnScreen=false] Whether to display the credits of this tileset on screen.
|
|
121
121
|
* @property {SplitDirection} [splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this tileset.
|
|
122
|
-
* @property {boolean} [enableCollision=false] When <code>true</code>, enables collisions for camera or CPU picking. While this is <code>true</code> the camera will be prevented from going below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
|
|
122
|
+
* @property {boolean} [enableCollision=false] When <code>true</code>, enables collisions for camera or CPU picking. While this is <code>true</code> the camera will be prevented from going below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true. This also affects the behavior of {@link HeightReference.CLAMP_TO_GROUND} when clamping to 3D Tiles surfaces. If <code>enableCollision</code> is <code>false</code>, entities may not be correctly clamped to the tileset geometry.
|
|
123
123
|
* @property {boolean} [projectTo2D=false] Whether to accurately project the tileset to 2D. If this is true, the tileset will be projected accurately to 2D, but it will use more memory to do so. If this is false, the tileset will use less memory and will still render in 2D / CV mode, but its projected positions may be inaccurate. This cannot be set after the tileset has been created.
|
|
124
124
|
* @property {boolean} [enablePick=false] Whether to allow collision and CPU picking with <code>pick</code> when using WebGL 1. If using WebGL 2 or above, this option will be ignored. If using WebGL 1 and this is true, the <code>pick</code> operation will work correctly, but it will use more memory to do so. If running with WebGL 1 and this is false, the model will use less memory, but <code>pick</code> will always return <code>undefined</code>. This cannot be set after the tileset has loaded.
|
|
125
125
|
* @property {boolean} [asynchronouslyLoadImagery=false] Whether loading imagery that is draped over the tileset should be done asynchronously. If this is <code>true</code>, then tile content will be displayed with its original texture until the imagery texture is loaded. If this is <code>false</code>, then the tile content will not be displayed until the imagery is ready.
|
|
@@ -147,7 +147,7 @@ import ImageryLayerCollection from "./ImageryLayerCollection.js";
|
|
|
147
147
|
*
|
|
148
148
|
* @alias Cesium3DTileset
|
|
149
149
|
* @constructor
|
|
150
|
-
* @experimental Support for loading Gaussian splats content encoded with SPZ compression using the draft glTF
|
|
150
|
+
* @experimental Support for loading Gaussian splats content encoded with SPZ compression using the draft glTF extensions {@link https://github.com/CesiumGS/glTF/tree/draft-splat-spz/extensions/2.0/Khronos/KHR_gaussian_splatting | KHR_gaussian_splatting} and {@link https://github.com/CesiumGS/glTF/tree/draft-splat-spz/extensions/2.0/Khronos/KHR_gaussian_splatting_compression_spz_2 | KHR_gaussian_splatting_compression_spz_2} is experimental and is subject change without Cesium's standard deprecation policy.
|
|
151
151
|
* @param {Cesium3DTileset.ConstructorOptions} options An object describing initialization options
|
|
152
152
|
*
|
|
153
153
|
* @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import addAllToArray from "../Core/addAllToArray.js";
|
|
1
2
|
import clone from "../Core/clone.js";
|
|
2
3
|
import defined from "../Core/defined.js";
|
|
3
4
|
import Expression from "./Expression.js";
|
|
@@ -203,8 +204,8 @@ ConditionsExpression.prototype.getVariables = function () {
|
|
|
203
204
|
const length = conditions.length;
|
|
204
205
|
for (let i = 0; i < length; ++i) {
|
|
205
206
|
const statement = conditions[i];
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
addAllToArray(variables, statement.condition.getVariables());
|
|
208
|
+
addAllToArray(variables, statement.expression.getVariables());
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
// Remove duplicates
|