@cesium/engine 18.3.1-ion.0 → 19.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/z-worker-pako.js +75 -91
- package/Build/Workers/{chunk-VOGSSU24.js → chunk-23FRF5ZP.js} +9 -9
- package/Build/Workers/{chunk-AZK5KSZ4.js → chunk-25USKS4R.js} +6 -6
- package/Build/Workers/{chunk-4B4HLHFO.js → chunk-34DFERFC.js} +12 -12
- package/Build/Workers/{chunk-HTB5PIYZ.js → chunk-37IYBZDZ.js} +9 -9
- package/Build/Workers/{chunk-NZVPOOOT.js → chunk-4NRFVAG2.js} +5 -5
- package/Build/Workers/{chunk-QXOWDZYZ.js → chunk-4QWLEG4L.js} +14 -14
- package/Build/Workers/{chunk-XW6DEZZE.js → chunk-5VPO47LB.js} +8 -8
- package/Build/Workers/{chunk-FKO2XRXZ.js → chunk-5YCDPN3O.js} +1 -1
- package/Build/Workers/{chunk-HRF2GFMF.js → chunk-6T2PQKYP.js} +4 -4
- package/Build/Workers/{chunk-IDHHSZTD.js → chunk-AABNX23Q.js} +5 -5
- package/Build/Workers/{chunk-6FY4D6KD.js → chunk-AZPKFL5X.js} +5 -5
- package/Build/Workers/{chunk-HQCLIHYE.js → chunk-C36VNKTH.js} +4 -4
- package/Build/Workers/{chunk-AX3B4SGH.js → chunk-DAHXCIOX.js} +8 -8
- package/Build/Workers/{chunk-QKYGO6XL.js → chunk-DNCRKMCI.js} +6 -6
- package/Build/Workers/{chunk-S2BFGC4W.js → chunk-DPFAUGBE.js} +2 -2
- package/Build/Workers/{chunk-ADA7OX2I.js → chunk-DXYAD4ED.js} +1 -1
- package/Build/Workers/{chunk-Z2GDV3MT.js → chunk-E6NMEKSS.js} +4 -4
- package/Build/Workers/{chunk-52DTHTKR.js → chunk-ECWQXDZY.js} +16 -16
- package/Build/Workers/{chunk-NGFYQUAX.js → chunk-ESDVZ4QL.js} +10 -10
- package/Build/Workers/{chunk-BF2HFWMG.js → chunk-ETCPCGKC.js} +2 -2
- package/Build/Workers/{chunk-SKVVOFGK.js → chunk-EV4PBU7O.js} +1 -1
- package/Build/Workers/{chunk-XLDLCV2F.js → chunk-FQNSMOZT.js} +4 -4
- package/Build/Workers/{chunk-76WKZOUK.js → chunk-GO3IRH6U.js} +6 -6
- package/Build/Workers/{chunk-UXCG22U4.js → chunk-GVO3YIU2.js} +4 -4
- package/Build/Workers/{chunk-SMLHKQNB.js → chunk-HHHBRTSW.js} +9 -9
- package/Build/Workers/{chunk-UHLWUS37.js → chunk-HJ6KFRM7.js} +16 -16
- package/Build/Workers/{chunk-JUYK3CDA.js → chunk-IE2BEHLE.js} +12 -12
- package/Build/Workers/{chunk-IYXAFSJX.js → chunk-JZVUMRYA.js} +13 -13
- package/Build/Workers/{chunk-E7KSST7M.js → chunk-K5VGMGFM.js} +7 -7
- package/Build/Workers/{chunk-DILVD7VK.js → chunk-KTDHOEXR.js} +1 -1
- package/Build/Workers/{chunk-TLR6NX6R.js → chunk-MBDKO456.js} +5 -5
- package/Build/Workers/{chunk-WMSBRWGI.js → chunk-MUL374P3.js} +2 -2
- package/Build/Workers/{chunk-QREBKKN5.js → chunk-NKM2EV46.js} +1 -1
- package/Build/Workers/{chunk-2XJLU3UN.js → chunk-NMAT4IJ6.js} +7 -7
- package/Build/Workers/{chunk-7G2O6QH3.js → chunk-PAH73ETP.js} +5 -5
- package/Build/Workers/{chunk-G2VBRELF.js → chunk-Q2QXUN33.js} +2 -2
- package/Build/Workers/{chunk-B3LHDD7Q.js → chunk-RIQM3XY5.js} +4 -4
- package/Build/Workers/{chunk-ILTPHRDS.js → chunk-RZJA77TX.js} +6 -6
- package/Build/Workers/{chunk-MIUZNGES.js → chunk-SO2Z6H6F.js} +2 -2
- package/Build/Workers/{chunk-UX2S2KIQ.js → chunk-SOYVF5RC.js} +2 -2
- package/Build/Workers/{chunk-VFEUHPSM.js → chunk-SVGHDIZG.js} +5 -5
- package/Build/Workers/{chunk-NL2YZDVI.js → chunk-SXMHGVZ7.js} +12 -12
- package/Build/Workers/{chunk-S2JHBHWB.js → chunk-T7C73J6H.js} +4 -4
- package/Build/Workers/{chunk-KGB6H3RI.js → chunk-UPU755HO.js} +12 -12
- package/Build/Workers/{chunk-IHRAESIS.js → chunk-VCCR35R6.js} +11 -11
- package/Build/Workers/{chunk-QMKOMHVM.js → chunk-W32QSECR.js} +6 -6
- package/Build/Workers/{chunk-3UEVA4NO.js → chunk-WUMTX3FI.js} +6 -6
- package/Build/Workers/{chunk-2Y2IF6ZP.js → chunk-XUYCCEG6.js} +5 -5
- package/Build/Workers/{chunk-Q6SJKTTQ.js → chunk-Y3PM6G2V.js} +3 -3
- package/Build/Workers/{chunk-FBPIDRZN.js → chunk-Y6LLFNXN.js} +10 -10
- package/Build/Workers/{chunk-ERTHACXD.js → chunk-YPNIIVIF.js} +6 -6
- package/Build/Workers/{chunk-EZUKH7KU.js → chunk-ZNEIUXBK.js} +7 -7
- 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 +19 -19
- 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 +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/LICENSE.md +32 -25
- package/Source/Core/ITwinPlatform.js +8 -1
- package/Source/Core/Ion.js +1 -1
- 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/Cesium3DTileBatchTable.js +6 -4
- package/Source/Scene/Cesium3DTileStyle.js +4 -3
- package/Source/Scene/Cesium3DTileset.js +1 -1
- package/Source/Scene/ConditionsExpression.js +3 -2
- package/Source/Scene/GaussianSplatPrimitive.js +1 -1
- package/Source/Scene/GltfLoader.js +3 -2
- 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/HeightReference.js +1 -1
- package/Source/Scene/ITwinData.js +97 -34
- 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/ModelImagery.js +3 -0
- package/Source/Scene/Model/ModelSceneGraph.js +2 -1
- package/Source/Scene/Picking.js +41 -1
- package/Source/Scene/Primitive.js +0 -1
- package/Source/Scene/PrimitiveCollection.js +32 -6
- package/Source/Scene/PrimitiveLoadPlan.js +0 -36
- package/Source/Scene/PropertyTable.js +7 -12
- package/Source/Scene/Scene.js +41 -32
- package/Source/Scene/ScreenSpaceCameraController.js +2 -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/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 +82 -53
- package/index.js +244 -242
- package/package.json +3 -3
|
@@ -7,6 +7,7 @@ import Check from "../Core/Check.js";
|
|
|
7
7
|
import KmlDataSource from "../DataSources/KmlDataSource.js";
|
|
8
8
|
import GeoJsonDataSource from "../DataSources/GeoJsonDataSource.js";
|
|
9
9
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
10
|
+
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Methods for loading iTwin platform data into CesiumJS
|
|
@@ -25,23 +26,40 @@ const ITwinData = {};
|
|
|
25
26
|
* We recommend waiting 10-20 seconds and trying to load the tileset again.
|
|
26
27
|
* If all exports are Invalid this will throw an error.
|
|
27
28
|
*
|
|
29
|
+
* See the {@link https://developer.bentley.com/apis/mesh-export/overview/|iTwin Platform Mesh Export API documentation} for more information on request parameters
|
|
30
|
+
*
|
|
28
31
|
* @example
|
|
29
|
-
* const tileset = await Cesium.ITwinData.createTilesetFromIModelId(iModelId);
|
|
32
|
+
* const tileset = await Cesium.ITwinData.createTilesetFromIModelId({ iModelId });
|
|
30
33
|
* if (Cesium.defined(tileset)) {
|
|
31
34
|
* viewer.scene.primitives.add(tileset);
|
|
32
35
|
* }
|
|
33
36
|
*
|
|
34
37
|
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
35
38
|
*
|
|
36
|
-
* @param {
|
|
37
|
-
* @param {
|
|
39
|
+
* @param {Object} options
|
|
40
|
+
* @param {string} options.iModelId The id of the iModel to load
|
|
41
|
+
* @param {Cesium3DTileset.ConstructorOptions} [options.tilesetOptions] Object containing options to pass to the internally created {@link Cesium3DTileset}.
|
|
42
|
+
* @param {string} [options.changesetId] The id of the changeset to load, if not provided the latest changesets will be used
|
|
38
43
|
* @returns {Promise<Cesium3DTileset | undefined>} A promise that will resolve to the created 3D tileset or <code>undefined</code> if there is no completed export for the given iModel id
|
|
39
44
|
*
|
|
40
45
|
* @throws {RuntimeError} If all exports for the given iModel are Invalid
|
|
41
46
|
* @throws {RuntimeError} If the iTwin API request is not successful
|
|
42
47
|
*/
|
|
43
|
-
ITwinData.createTilesetFromIModelId = async function (
|
|
44
|
-
|
|
48
|
+
ITwinData.createTilesetFromIModelId = async function (options) {
|
|
49
|
+
let internalOptions = options;
|
|
50
|
+
|
|
51
|
+
if (typeof options === "string") {
|
|
52
|
+
// the old signature was (iModelId: string, options?: Cesium3DTileset.ConstructorOptions)
|
|
53
|
+
// grab the later arguments directly instead of in the params only for this special case
|
|
54
|
+
internalOptions = { iModelId: options, tilesetOptions: arguments[1] };
|
|
55
|
+
deprecationWarning(
|
|
56
|
+
"ITwinData.createTilesetFromIModelId",
|
|
57
|
+
"The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const { iModelId, changesetId, tilesetOptions } = internalOptions;
|
|
62
|
+
const { exports } = await ITwinPlatform.getExports(iModelId, changesetId);
|
|
45
63
|
|
|
46
64
|
if (
|
|
47
65
|
exports.length > 0 &&
|
|
@@ -72,7 +90,7 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
|
|
|
72
90
|
url: tilesetUrl,
|
|
73
91
|
});
|
|
74
92
|
|
|
75
|
-
return Cesium3DTileset.fromUrl(resource,
|
|
93
|
+
return Cesium3DTileset.fromUrl(resource, tilesetOptions);
|
|
76
94
|
};
|
|
77
95
|
|
|
78
96
|
/**
|
|
@@ -84,20 +102,35 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
|
|
|
84
102
|
*
|
|
85
103
|
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
86
104
|
*
|
|
87
|
-
* @param {
|
|
88
|
-
* @param {string}
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {
|
|
105
|
+
* @param {Object} options
|
|
106
|
+
* @param {string} options.iTwinId The id of the iTwin to load data from
|
|
107
|
+
* @param {string} options.realityDataId The id of the reality data to load
|
|
108
|
+
* @param {ITwinPlatform.RealityDataType} [options.type] The type of this reality data
|
|
109
|
+
* @param {string} [options.rootDocument] The path of the root document for this reality data
|
|
91
110
|
* @returns {Promise<Cesium3DTileset>}
|
|
92
111
|
*
|
|
93
112
|
* @throws {RuntimeError} if the type of reality data is not supported by this function
|
|
94
113
|
*/
|
|
95
|
-
ITwinData.createTilesetForRealityDataId = async function (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
ITwinData.createTilesetForRealityDataId = async function (options) {
|
|
115
|
+
let internalOptions = options;
|
|
116
|
+
|
|
117
|
+
if (typeof options === "string") {
|
|
118
|
+
// the old signature was (iTwinId: string, realityDataId: string, type: RealityDataType, rootDocument: string)
|
|
119
|
+
// grab the later arguments directly instead of in the params only for this special case
|
|
120
|
+
internalOptions = {
|
|
121
|
+
iTwinId: options,
|
|
122
|
+
realityDataId: arguments[1],
|
|
123
|
+
type: arguments[2],
|
|
124
|
+
rootDocument: arguments[3],
|
|
125
|
+
};
|
|
126
|
+
deprecationWarning(
|
|
127
|
+
"ITwinData.createTilesetFromIModelId",
|
|
128
|
+
"The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
const { iTwinId, realityDataId } = internalOptions;
|
|
132
|
+
let { type, rootDocument } = internalOptions;
|
|
133
|
+
|
|
101
134
|
//>>includeStart('debug', pragmas.debug);
|
|
102
135
|
Check.typeOf.string("iTwinId", iTwinId);
|
|
103
136
|
Check.typeOf.string("realityDataId", realityDataId);
|
|
@@ -147,20 +180,35 @@ ITwinData.createTilesetForRealityDataId = async function (
|
|
|
147
180
|
* If the <code>type</code> or <code>rootDocument</code> are not provided this function
|
|
148
181
|
* will first request the full metadata for the specified reality data to fill these values.
|
|
149
182
|
*
|
|
150
|
-
* @param {
|
|
151
|
-
* @param {string}
|
|
152
|
-
* @param {
|
|
153
|
-
* @param {
|
|
183
|
+
* @param {Object} options
|
|
184
|
+
* @param {string} options.iTwinId The id of the iTwin to load data from
|
|
185
|
+
* @param {string} options.realityDataId The id of the reality data to load
|
|
186
|
+
* @param {ITwinPlatform.RealityDataType} [options.type] The type of this reality data
|
|
187
|
+
* @param {string} [options.rootDocument] The path of the root document for this reality data
|
|
154
188
|
* @returns {Promise<GeoJsonDataSource | KmlDataSource>}
|
|
155
189
|
*
|
|
156
190
|
* @throws {RuntimeError} if the type of reality data is not supported by this function
|
|
157
191
|
*/
|
|
158
|
-
ITwinData.createDataSourceForRealityDataId = async function (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
192
|
+
ITwinData.createDataSourceForRealityDataId = async function (options) {
|
|
193
|
+
let internalOptions = options;
|
|
194
|
+
|
|
195
|
+
if (typeof options === "string") {
|
|
196
|
+
// the old signature was (iTwinId: string, realityDataId: string, type: RealityDataType, rootDocument: string)
|
|
197
|
+
// grab the later arguments directly instead of in the params only for this special case
|
|
198
|
+
internalOptions = {
|
|
199
|
+
iTwinId: options,
|
|
200
|
+
realityDataId: arguments[1],
|
|
201
|
+
type: arguments[2],
|
|
202
|
+
rootDocument: arguments[3],
|
|
203
|
+
};
|
|
204
|
+
deprecationWarning(
|
|
205
|
+
"ITwinData.createTilesetFromIModelId",
|
|
206
|
+
"The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
const { iTwinId, realityDataId } = internalOptions;
|
|
210
|
+
let { type, rootDocument } = internalOptions;
|
|
211
|
+
|
|
164
212
|
//>>includeStart('debug', pragmas.debug);
|
|
165
213
|
Check.typeOf.string("iTwinId", iTwinId);
|
|
166
214
|
Check.typeOf.string("realityDataId", realityDataId);
|
|
@@ -209,16 +257,31 @@ ITwinData.createDataSourceForRealityDataId = async function (
|
|
|
209
257
|
/**
|
|
210
258
|
* Load data from the Geospatial Features API as GeoJSON.
|
|
211
259
|
*
|
|
212
|
-
* @param {
|
|
213
|
-
* @param {string}
|
|
214
|
-
* @param {
|
|
260
|
+
* @param {Object} options
|
|
261
|
+
* @param {string} options.iTwinId The id of the iTwin to load data from
|
|
262
|
+
* @param {string} options.collectionId The id of the data collection to load
|
|
263
|
+
* @param {number} [options.limit=10000] number of items per page, must be between 1 and 10,000 inclusive
|
|
215
264
|
* @returns {Promise<GeoJsonDataSource>}
|
|
216
265
|
*/
|
|
217
|
-
ITwinData.loadGeospatialFeatures = async function (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
)
|
|
266
|
+
ITwinData.loadGeospatialFeatures = async function (options) {
|
|
267
|
+
let internalOptions = options;
|
|
268
|
+
|
|
269
|
+
if (typeof options === "string") {
|
|
270
|
+
// the old signature was (iTwinId: string, collectionId: string, limit: number)
|
|
271
|
+
// grab the later arguments directly instead of in the params only for this special case
|
|
272
|
+
internalOptions = {
|
|
273
|
+
iTwinId: options,
|
|
274
|
+
collectionId: arguments[1],
|
|
275
|
+
limit: arguments[2],
|
|
276
|
+
};
|
|
277
|
+
deprecationWarning(
|
|
278
|
+
"ITwinData.createTilesetFromIModelId",
|
|
279
|
+
"The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const { iTwinId, collectionId, limit } = internalOptions;
|
|
284
|
+
|
|
222
285
|
//>>includeStart('debug', pragmas.debug);
|
|
223
286
|
Check.typeOf.string("iTwinId", iTwinId);
|
|
224
287
|
Check.typeOf.string("collectionId", collectionId);
|
|
@@ -86,6 +86,7 @@ function ImageBasedLighting(options) {
|
|
|
86
86
|
|
|
87
87
|
// Store the previous frame number to prevent redundant update calls
|
|
88
88
|
this._previousFrameNumber = undefined;
|
|
89
|
+
this._previousFrameContext = undefined;
|
|
89
90
|
|
|
90
91
|
// Keeps track of the last values for use during update logic
|
|
91
92
|
this._previousImageBasedLightingFactor = Cartesian2.clone(
|
|
@@ -325,12 +326,15 @@ function createSpecularEnvironmentCubeMap(imageBasedLighting, context) {
|
|
|
325
326
|
}
|
|
326
327
|
|
|
327
328
|
ImageBasedLighting.prototype.update = function (frameState) {
|
|
328
|
-
if (
|
|
329
|
+
if (
|
|
330
|
+
frameState.frameNumber === this._previousFrameNumber &&
|
|
331
|
+
frameState.context === this._previousFrameContext
|
|
332
|
+
) {
|
|
329
333
|
return;
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
this._previousFrameNumber = frameState.frameNumber;
|
|
333
|
-
const context = frameState.context;
|
|
337
|
+
const context = (this._previousFrameContext = frameState.context);
|
|
334
338
|
|
|
335
339
|
frameState.brdfLutGenerator.update(frameState);
|
|
336
340
|
this._shouldRegenerateShaders = false;
|
|
@@ -388,8 +388,8 @@ Object.defineProperties(ImageryLayer.prototype, {
|
|
|
388
388
|
* Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing
|
|
389
389
|
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
390
390
|
* are passed an instance of the thrown error.
|
|
391
|
-
* @memberof
|
|
392
|
-
* @type {Event<
|
|
391
|
+
* @memberof ImageryLayer.prototype
|
|
392
|
+
* @type {Event<ImageryLayer.ErrorEventCallback>}
|
|
393
393
|
* @readonly
|
|
394
394
|
*/
|
|
395
395
|
errorEvent: {
|
|
@@ -518,7 +518,7 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
|
|
|
518
518
|
* viewer.imageryLayers.add(imageryLayer);
|
|
519
519
|
*
|
|
520
520
|
* imageryLayer.readyEvent.addEventListener(provider => {
|
|
521
|
-
* imageryLayer.
|
|
521
|
+
* imageryLayer.imageryProvider.errorEvent.addEventListener(error => {
|
|
522
522
|
* alert(`Encountered an error while loading imagery tiles! ${error}`);
|
|
523
523
|
* });
|
|
524
524
|
* });
|
|
@@ -527,9 +527,9 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
|
|
|
527
527
|
* alert(`Encountered an error while creating an imagery layer! ${error}`);
|
|
528
528
|
* });
|
|
529
529
|
*
|
|
530
|
-
* @see ImageryLayer
|
|
531
|
-
* @see ImageryLayer
|
|
532
|
-
* @see ImageryLayer
|
|
530
|
+
* @see ImageryLayer#errorEvent
|
|
531
|
+
* @see ImageryLayer#readyEvent
|
|
532
|
+
* @see ImageryLayer#imageryProvider
|
|
533
533
|
* @see ImageryLayer.fromWorldImagery
|
|
534
534
|
*/
|
|
535
535
|
ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
|
|
@@ -576,7 +576,7 @@ ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
|
|
|
576
576
|
* viewer.imageryLayers.add(imageryLayer);
|
|
577
577
|
*
|
|
578
578
|
* imageryLayer.readyEvent.addEventListener(provider => {
|
|
579
|
-
* imageryLayer.
|
|
579
|
+
* imageryLayer.imageryProvider.errorEvent.addEventListener(error => {
|
|
580
580
|
* alert(`Encountered an error while loading imagery tiles! ${error}`);
|
|
581
581
|
* });
|
|
582
582
|
* });
|
|
@@ -585,9 +585,9 @@ ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
|
|
|
585
585
|
* alert(`Encountered an error while creating an imagery layer! ${error}`);
|
|
586
586
|
* });
|
|
587
587
|
*
|
|
588
|
-
* @see ImageryLayer
|
|
589
|
-
* @see ImageryLayer
|
|
590
|
-
* @see ImageryLayer
|
|
588
|
+
* @see ImageryLayer#errorEvent
|
|
589
|
+
* @see ImageryLayer#readyEvent
|
|
590
|
+
* @see ImageryLayer#imageryProvider
|
|
591
591
|
*/
|
|
592
592
|
ImageryLayer.fromWorldImagery = function (options) {
|
|
593
593
|
options = options ?? Frozen.EMPTY_OBJECT;
|
|
@@ -10,6 +10,7 @@ import oneTimeWarning from "../Core/oneTimeWarning.js";
|
|
|
10
10
|
import MetadataComponentType from "./MetadataComponentType.js";
|
|
11
11
|
import MetadataClassProperty from "./MetadataClassProperty.js";
|
|
12
12
|
import MetadataType from "./MetadataType.js";
|
|
13
|
+
import addAllToArray from "../Core/addAllToArray.js";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* A binary property in a {@MetadataTable}
|
|
@@ -374,7 +375,7 @@ function flatten(values) {
|
|
|
374
375
|
for (let i = 0; i < values.length; i++) {
|
|
375
376
|
const value = values[i];
|
|
376
377
|
if (Array.isArray(value)) {
|
|
377
|
-
|
|
378
|
+
addAllToArray(result, value);
|
|
378
379
|
} else {
|
|
379
380
|
result.push(value);
|
|
380
381
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import addAllToArray from "../../Core/addAllToArray.js";
|
|
1
2
|
import BoundingSphere from "../../Core/BoundingSphere.js";
|
|
2
3
|
import Check from "../../Core/Check.js";
|
|
3
4
|
import Frozen from "../../Core/Frozen.js";
|
|
@@ -482,16 +483,16 @@ ClassificationModelDrawCommand.prototype.pushCommands = function (
|
|
|
482
483
|
const passes = frameState.passes;
|
|
483
484
|
if (passes.render) {
|
|
484
485
|
if (this._useDebugWireframe) {
|
|
485
|
-
|
|
486
|
+
addAllToArray(result, this._commandListDebugWireframe);
|
|
486
487
|
return;
|
|
487
488
|
}
|
|
488
489
|
|
|
489
490
|
if (this._classifiesTerrain) {
|
|
490
|
-
|
|
491
|
+
addAllToArray(result, this._commandListTerrain);
|
|
491
492
|
}
|
|
492
493
|
|
|
493
494
|
if (this._classifies3DTiles) {
|
|
494
|
-
|
|
495
|
+
addAllToArray(result, this._commandList3DTiles);
|
|
495
496
|
}
|
|
496
497
|
|
|
497
498
|
const useIgnoreShowCommands =
|
|
@@ -513,17 +514,17 @@ ClassificationModelDrawCommand.prototype.pushCommands = function (
|
|
|
513
514
|
);
|
|
514
515
|
}
|
|
515
516
|
|
|
516
|
-
|
|
517
|
+
addAllToArray(result, this._commandListIgnoreShow);
|
|
517
518
|
}
|
|
518
519
|
}
|
|
519
520
|
|
|
520
521
|
if (passes.pick) {
|
|
521
522
|
if (this._classifiesTerrain) {
|
|
522
|
-
|
|
523
|
+
addAllToArray(result, this._commandListTerrainPicking);
|
|
523
524
|
}
|
|
524
525
|
|
|
525
526
|
if (this._classifies3DTiles) {
|
|
526
|
-
|
|
527
|
+
addAllToArray(result, this._commandList3DTilesPicking);
|
|
527
528
|
}
|
|
528
529
|
}
|
|
529
530
|
|
|
@@ -19,6 +19,7 @@ import StructuralMetadata from "../StructuralMetadata.js";
|
|
|
19
19
|
import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
|
|
20
20
|
import Buffer from "../../Renderer/Buffer.js";
|
|
21
21
|
import BufferUsage from "../../Renderer/BufferUsage.js";
|
|
22
|
+
import addAllToArray from "../../Core/addAllToArray.js";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Loads a GeoJson model as part of the <code>MAXAR_content_geojson</code> extension with the following constraints:
|
|
@@ -166,7 +167,8 @@ function parseMultiPolygon(coordinates) {
|
|
|
166
167
|
const polygonsLength = coordinates.length;
|
|
167
168
|
const lines = [];
|
|
168
169
|
for (let i = 0; i < polygonsLength; i++) {
|
|
169
|
-
|
|
170
|
+
const polygon = parsePolygon(coordinates[i]);
|
|
171
|
+
addAllToArray(lines, polygon);
|
|
170
172
|
}
|
|
171
173
|
return lines;
|
|
172
174
|
}
|
|
@@ -109,7 +109,9 @@ class ImageryPipelineStage {
|
|
|
109
109
|
);
|
|
110
110
|
|
|
111
111
|
// This can happen when none of the imagery textures could
|
|
112
|
-
// be obtained, because they had all been INVALID/FAILED
|
|
112
|
+
// be obtained, because they had all been INVALID/FAILED,
|
|
113
|
+
// or when none of the imagery layers is actually visible
|
|
114
|
+
// according to `show==true`
|
|
113
115
|
// Bail out in this case
|
|
114
116
|
if (imageryInputs.length === 0) {
|
|
115
117
|
return;
|
|
@@ -758,7 +760,8 @@ class ImageryPipelineStage {
|
|
|
758
760
|
* pipeline stage for draping the given imagery layers over the primitive
|
|
759
761
|
* that is described by the given model primitive imagery.
|
|
760
762
|
*
|
|
761
|
-
*
|
|
763
|
+
* For each imagery layer that is currently visible (as of `show==true`), this
|
|
764
|
+
* will obtain the <code>ImageryCoverage</code> objects that are provided by
|
|
762
765
|
* the given model primitive imagery (and that describe the imagery tiles
|
|
763
766
|
* that are covered by the primitive), and create one <code>ImageryInput</code> for
|
|
764
767
|
* each of them.
|
|
@@ -791,6 +794,9 @@ class ImageryPipelineStage {
|
|
|
791
794
|
|
|
792
795
|
for (let i = 0; i < imageryLayers.length; i++) {
|
|
793
796
|
const imageryLayer = imageryLayers.get(i);
|
|
797
|
+
if (!imageryLayer.show) {
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
794
800
|
const imageryTexCoordAttributeSetIndex =
|
|
795
801
|
imageryTexCoordAttributeSetIndices[i];
|
|
796
802
|
const mappedPositions =
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import addAllToArray from "../../Core/addAllToArray.js";
|
|
1
2
|
import AttributeCompression from "../../Core/AttributeCompression.js";
|
|
2
3
|
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
3
4
|
import clone from "../../Core/clone.js";
|
|
@@ -210,10 +211,7 @@ InstancingPipelineStage.process = function (renderResources, node, frameState) {
|
|
|
210
211
|
renderResources.uniformMap = combine(uniformMap, renderResources.uniformMap);
|
|
211
212
|
|
|
212
213
|
renderResources.instanceCount = count;
|
|
213
|
-
renderResources.attributes
|
|
214
|
-
renderResources.attributes,
|
|
215
|
-
instancingVertexAttributes,
|
|
216
|
-
);
|
|
214
|
+
addAllToArray(renderResources.attributes, instancingVertexAttributes);
|
|
217
215
|
};
|
|
218
216
|
|
|
219
217
|
const projectedTransformScratch = new Matrix4();
|
|
@@ -988,10 +986,7 @@ function processMatrixAttributes(
|
|
|
988
986
|
shaderBuilder.addAttribute("vec4", `a_instancing${attributeString}Row1`);
|
|
989
987
|
shaderBuilder.addAttribute("vec4", `a_instancing${attributeString}Row2`);
|
|
990
988
|
|
|
991
|
-
instancingVertexAttributes
|
|
992
|
-
instancingVertexAttributes,
|
|
993
|
-
matrixAttributes,
|
|
994
|
-
);
|
|
989
|
+
addAllToArray(instancingVertexAttributes, matrixAttributes);
|
|
995
990
|
}
|
|
996
991
|
|
|
997
992
|
function processVec3Attribute(
|
|
@@ -139,9 +139,18 @@ MaterialPipelineStage.process = function (
|
|
|
139
139
|
VertexAttributeSemantic.NORMAL,
|
|
140
140
|
);
|
|
141
141
|
|
|
142
|
+
// Disable PointCloud normals if the user explicitly turned them off.
|
|
143
|
+
const disablePointCloudNormals =
|
|
144
|
+
defined(model.pointCloudShading) && !model.pointCloudShading.normalShading;
|
|
145
|
+
|
|
142
146
|
// Classification models will be rendered as unlit.
|
|
143
147
|
const lightingOptions = renderResources.lightingOptions;
|
|
144
|
-
if (
|
|
148
|
+
if (
|
|
149
|
+
material.unlit ||
|
|
150
|
+
!hasNormals ||
|
|
151
|
+
hasClassification ||
|
|
152
|
+
disablePointCloudNormals
|
|
153
|
+
) {
|
|
145
154
|
lightingOptions.lightingModel = LightingModel.UNLIT;
|
|
146
155
|
} else {
|
|
147
156
|
lightingOptions.lightingModel = LightingModel.PBR;
|
|
@@ -335,6 +335,9 @@ class ModelImagery {
|
|
|
335
335
|
const imageryLayer = imageryLayers.get(i);
|
|
336
336
|
const imageryConfiguration = imageryConfigurations[i];
|
|
337
337
|
|
|
338
|
+
if (imageryLayer.show !== imageryConfiguration.show) {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
338
341
|
if (imageryLayer.alpha !== imageryConfiguration.alpha) {
|
|
339
342
|
return true;
|
|
340
343
|
}
|
|
@@ -26,6 +26,7 @@ import ModelType from "./ModelType.js";
|
|
|
26
26
|
import NodeRenderResources from "./NodeRenderResources.js";
|
|
27
27
|
import PrimitiveRenderResources from "./PrimitiveRenderResources.js";
|
|
28
28
|
import ModelDrawCommands from "./ModelDrawCommands.js";
|
|
29
|
+
import addAllToArray from "../../Core/addAllToArray.js";
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* An in memory representation of the scene graph for a {@link Model}
|
|
@@ -1018,7 +1019,7 @@ ModelSceneGraph.prototype.pushDrawCommands = function (frameState) {
|
|
|
1018
1019
|
pushDrawCommandOptions,
|
|
1019
1020
|
);
|
|
1020
1021
|
|
|
1021
|
-
|
|
1022
|
+
addAllToArray(frameState.commandList, silhouetteCommands);
|
|
1022
1023
|
};
|
|
1023
1024
|
|
|
1024
1025
|
// Callback is defined here to avoid allocating a closure in the render loop
|
package/Source/Scene/Picking.js
CHANGED
|
@@ -272,7 +272,7 @@ function computePickingDrawingBufferRectangle(
|
|
|
272
272
|
* @param {Cartesian2} windowPosition Window coordinates to perform picking on.
|
|
273
273
|
* @param {number} [width=3] Width of the pick rectangle.
|
|
274
274
|
* @param {number} [height=3] Height of the pick rectangle.
|
|
275
|
-
* @returns {object} Object containing the picked primitive.
|
|
275
|
+
* @returns {object | undefined} Object containing the picked primitive.
|
|
276
276
|
*/
|
|
277
277
|
Picking.prototype.pick = function (scene, windowPosition, width, height) {
|
|
278
278
|
//>>includeStart('debug', pragmas.debug);
|
|
@@ -923,6 +923,16 @@ function getTilesets(primitives, objectsToExclude, tilesets) {
|
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
|
|
926
|
+
/**
|
|
927
|
+
* @private
|
|
928
|
+
* @param {Picking} picking
|
|
929
|
+
* @param {Scene} scene
|
|
930
|
+
* @param {Ray} ray
|
|
931
|
+
* @param {Object[] | undefined} objectsToExclude
|
|
932
|
+
* @param {number | undefined} width
|
|
933
|
+
* @param {Function} callback
|
|
934
|
+
* @returns {Promise<Cartesian3 | undefined>}
|
|
935
|
+
*/
|
|
926
936
|
function launchMostDetailedRayPick(
|
|
927
937
|
picking,
|
|
928
938
|
scene,
|
|
@@ -1266,6 +1276,12 @@ const scratchSurfaceNormal = new Cartesian3();
|
|
|
1266
1276
|
const scratchSurfaceRay = new Ray();
|
|
1267
1277
|
const scratchCartographic = new Cartographic();
|
|
1268
1278
|
|
|
1279
|
+
/**
|
|
1280
|
+
* @private
|
|
1281
|
+
* @param {Scene} scene
|
|
1282
|
+
* @param {Cartographic} cartographic
|
|
1283
|
+
* @returns {Ray}
|
|
1284
|
+
*/
|
|
1269
1285
|
function getRayForSampleHeight(scene, cartographic) {
|
|
1270
1286
|
const ellipsoid = scene.ellipsoid;
|
|
1271
1287
|
const height = ApproximateTerrainHeights._defaultMaxTerrainHeight;
|
|
@@ -1287,6 +1303,12 @@ function getRayForSampleHeight(scene, cartographic) {
|
|
|
1287
1303
|
return ray;
|
|
1288
1304
|
}
|
|
1289
1305
|
|
|
1306
|
+
/**
|
|
1307
|
+
* @private
|
|
1308
|
+
* @param {Scene} scene
|
|
1309
|
+
* @param {Cartesian3} cartesian
|
|
1310
|
+
* @returns {Ray}
|
|
1311
|
+
*/
|
|
1290
1312
|
function getRayForClampToHeight(scene, cartesian) {
|
|
1291
1313
|
const ellipsoid = scene.ellipsoid;
|
|
1292
1314
|
const cartographic = Cartographic.fromCartesian(
|
|
@@ -1338,6 +1360,16 @@ function sampleHeightMostDetailed(
|
|
|
1338
1360
|
);
|
|
1339
1361
|
}
|
|
1340
1362
|
|
|
1363
|
+
/**
|
|
1364
|
+
* @private
|
|
1365
|
+
* @param {Picking} picking
|
|
1366
|
+
* @param {Scene} scene
|
|
1367
|
+
* @param {Cartesian3} cartesian
|
|
1368
|
+
* @param {Object[]} [objectsToExclude]
|
|
1369
|
+
* @param {number} [width]
|
|
1370
|
+
* @param {Cartesian3} [result]
|
|
1371
|
+
* @returns {Promise<Cartesian3 | undefined>}
|
|
1372
|
+
*/
|
|
1341
1373
|
function clampToHeightMostDetailed(
|
|
1342
1374
|
picking,
|
|
1343
1375
|
scene,
|
|
@@ -1483,6 +1515,14 @@ Picking.prototype.sampleHeightMostDetailed = function (
|
|
|
1483
1515
|
);
|
|
1484
1516
|
};
|
|
1485
1517
|
|
|
1518
|
+
/**
|
|
1519
|
+
* @private
|
|
1520
|
+
* @param {Scene} scene
|
|
1521
|
+
* @param {Cartesian3[]} cartesians
|
|
1522
|
+
* @param {Object[]} [objectsToExclude]
|
|
1523
|
+
* @param {number} [width]
|
|
1524
|
+
* @returns {Promise<Array<Cartesian3 | undefined>>}
|
|
1525
|
+
*/
|
|
1486
1526
|
Picking.prototype.clampToHeightMostDetailed = function (
|
|
1487
1527
|
scene,
|
|
1488
1528
|
cartesians,
|
|
@@ -1966,7 +1966,6 @@ Primitive._updateBoundingVolumes = function (
|
|
|
1966
1966
|
primitive._boundingSphereCV[i],
|
|
1967
1967
|
primitive._boundingSphere2D[i],
|
|
1968
1968
|
);
|
|
1969
|
-
primitive._boundingSphere2D[i].center.x = 0.0;
|
|
1970
1969
|
primitive._boundingSphereMorph[i] = BoundingSphere.union(
|
|
1971
1970
|
primitive._boundingSphereWC[i],
|
|
1972
1971
|
primitive._boundingSphereCV[i],
|
|
@@ -16,6 +16,9 @@ import Event from "../Core/Event.js";
|
|
|
16
16
|
* @param {object} [options] Object with the following properties:
|
|
17
17
|
* @param {boolean} [options.show=true] Determines if the primitives in the collection will be shown.
|
|
18
18
|
* @param {boolean} [options.destroyPrimitives=true] Determines if primitives in the collection are destroyed when they are removed.
|
|
19
|
+
* @privateParam {boolean} [options.countReferences=false] Specifies whether adding and removing primitives from this collection alters their reference counts. If so, adding a
|
|
20
|
+
* primitive to this collection increments its reference count. Removing the primitive decrements its reference count and - if the count reaches zero **and** destroyPrimitives is true - destroys the primitive.
|
|
21
|
+
* This permits primitives to be shared between multiple collections.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* const billboards = new Cesium.BillboardCollection();
|
|
@@ -71,6 +74,8 @@ function PrimitiveCollection(options) {
|
|
|
71
74
|
* labels = labels.destroy(); // explicitly destroy
|
|
72
75
|
*/
|
|
73
76
|
this.destroyPrimitives = options.destroyPrimitives ?? true;
|
|
77
|
+
|
|
78
|
+
this._countReferences = options.countReferences ?? false;
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
Object.defineProperties(PrimitiveCollection.prototype, {
|
|
@@ -160,6 +165,14 @@ PrimitiveCollection.prototype.add = function (primitive, index) {
|
|
|
160
165
|
this._primitives.splice(index, 0, primitive);
|
|
161
166
|
}
|
|
162
167
|
|
|
168
|
+
if (this._countReferences) {
|
|
169
|
+
if (!defined(external._referenceCount)) {
|
|
170
|
+
external._referenceCount = 1;
|
|
171
|
+
} else {
|
|
172
|
+
++external._referenceCount;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
163
176
|
this._primitiveAdded.raiseEvent(primitive);
|
|
164
177
|
|
|
165
178
|
return primitive;
|
|
@@ -188,8 +201,14 @@ PrimitiveCollection.prototype.remove = function (primitive) {
|
|
|
188
201
|
this._primitives.splice(index, 1);
|
|
189
202
|
|
|
190
203
|
delete primitive._external._composites[this._guid];
|
|
204
|
+
if (this._countReferences) {
|
|
205
|
+
primitive._external._referenceCount--;
|
|
206
|
+
}
|
|
191
207
|
|
|
192
|
-
if (
|
|
208
|
+
if (
|
|
209
|
+
this.destroyPrimitives &&
|
|
210
|
+
(!this._countReferences || primitive._external._referenceCount <= 0)
|
|
211
|
+
) {
|
|
193
212
|
primitive.destroy();
|
|
194
213
|
}
|
|
195
214
|
|
|
@@ -204,7 +223,7 @@ PrimitiveCollection.prototype.remove = function (primitive) {
|
|
|
204
223
|
};
|
|
205
224
|
|
|
206
225
|
/**
|
|
207
|
-
* Removes and destroys a primitive, regardless of destroyPrimitives setting.
|
|
226
|
+
* Removes and destroys a primitive, regardless of destroyPrimitives or countReferences setting.
|
|
208
227
|
* @private
|
|
209
228
|
*/
|
|
210
229
|
PrimitiveCollection.prototype.removeAndDestroy = function (primitive) {
|
|
@@ -226,13 +245,20 @@ PrimitiveCollection.prototype.removeAll = function () {
|
|
|
226
245
|
const primitives = this._primitives;
|
|
227
246
|
const length = primitives.length;
|
|
228
247
|
for (let i = 0; i < length; ++i) {
|
|
229
|
-
|
|
248
|
+
const primitive = primitives[i];
|
|
249
|
+
delete primitive._external._composites[this._guid];
|
|
250
|
+
if (this._countReferences) {
|
|
251
|
+
primitive._external._referenceCount--;
|
|
252
|
+
}
|
|
230
253
|
|
|
231
|
-
if (
|
|
232
|
-
|
|
254
|
+
if (
|
|
255
|
+
this.destroyPrimitives &&
|
|
256
|
+
(!this._countReferences || primitive._external._referenceCount <= 0)
|
|
257
|
+
) {
|
|
258
|
+
primitive.destroy();
|
|
233
259
|
}
|
|
234
260
|
|
|
235
|
-
this._primitiveRemoved.raiseEvent(
|
|
261
|
+
this._primitiveRemoved.raiseEvent(primitive);
|
|
236
262
|
}
|
|
237
263
|
this._primitives = [];
|
|
238
264
|
};
|