@cesium/engine 22.3.0 → 23.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-EAAH543Q.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-EUDHHS7K.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-LWZHJWYK.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-7U5YNLF3.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-D63Z7KKL.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-D6OKR3BQ.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-BO22JHBX.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-XLIJV3YZ.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-AWELU5C6.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-T5MJDW43.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-NVL7JXAQ.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-YHPBT4I5.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-WHLGBMBC.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-VIQIKMTZ.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-TCOUGKXF.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-S2KVL7OJ.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-5PJB7ASO.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-IXL46IYV.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-KIJR26N3.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-4R6FGUFP.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-FUDC3KOT.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-K2PLKJJG.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-4BBANFU6.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-K4PGSAR5.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-OOYICVOK.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-FDOLXORR.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-7SLNBIZS.js → chunk-IFA7VHHP.js} +560 -277
- package/Build/Workers/{chunk-N66PIK46.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-ZWWN2CQH.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-4O2ARYS7.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-TY5JXMVO.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-L4OFWHNI.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-N6XBJBI7.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-FS42VX2H.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-7ATKQRBM.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-EOSX23OS.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-NO3LMU7T.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-HWGP4GVC.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-6GBGEUWR.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-E4YDCSQK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-ZGGVEGTA.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-6WDMPXQ7.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-LK7GEFGB.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-M5DVYXJJ.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-WUWPKBOZ.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-W5NV72VR.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-PJLRXIMS.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-D2PEV362.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-MASEF4OV.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-2MLJ46ZZ.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-EY5HOJFQ.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-AFGP5BXS.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-IHFAFGR2.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-TMGLPEZW.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-VRAAQ3FS.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-Y5MRBKQN.js → chunk-ZIW5FCIW.js} +18 -18
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -4
- package/Source/Scene/BillboardCollection.js +64 -25
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +906 -167
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +313 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/Label.js +6 -4
- package/Source/Scene/LabelCollection.js +59 -1
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +1 -1
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +2 -2
- package/Source/Shaders/Model/ModelFS.js +2 -2
- package/Source/Shaders/Model/ModelVS.glsl +2 -2
- package/Source/Shaders/Model/ModelVS.js +2 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/index.d.ts +564 -189
- package/index.js +127 -119
- package/package.json +1 -1
- package/Build/Workers/chunk-LYBNPUEI.js +0 -1443
|
@@ -10,16 +10,10 @@ import RuntimeError from "../Core/RuntimeError.js";
|
|
|
10
10
|
* This type describes an interface and is not intended to be instantiated directly.
|
|
11
11
|
* </p>
|
|
12
12
|
*
|
|
13
|
-
* @alias ResourceLoader
|
|
14
|
-
* @constructor
|
|
15
|
-
*
|
|
16
13
|
* @see ResourceCache
|
|
17
|
-
*
|
|
18
14
|
* @private
|
|
19
15
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.defineProperties(ResourceLoader.prototype, {
|
|
16
|
+
class ResourceLoader {
|
|
23
17
|
/**
|
|
24
18
|
* The cache key of the resource.
|
|
25
19
|
*
|
|
@@ -29,99 +23,97 @@ Object.defineProperties(ResourceLoader.prototype, {
|
|
|
29
23
|
* @readonly
|
|
30
24
|
* @private
|
|
31
25
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
});
|
|
26
|
+
// eslint-disable-next-line getter-return
|
|
27
|
+
get cacheKey() {
|
|
28
|
+
DeveloperError.throwInstantiationError();
|
|
29
|
+
}
|
|
39
30
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
31
|
+
/**
|
|
32
|
+
* Loads the resource.
|
|
33
|
+
* @returns {Promise<ResourceLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
load() {
|
|
37
|
+
DeveloperError.throwInstantiationError();
|
|
38
|
+
}
|
|
48
39
|
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Unloads the resource.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
unload() {}
|
|
54
45
|
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
46
|
+
/**
|
|
47
|
+
* Processes the resource until it becomes ready.
|
|
48
|
+
*
|
|
49
|
+
* @param {FrameState} frameState The frame state.
|
|
50
|
+
* @returns {boolean} true once all resourced are ready.
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
process(frameState) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
65
56
|
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Constructs a {@link RuntimeError} from an errorMessage and an error.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} errorMessage The error message.
|
|
61
|
+
* @param {Error} [error] The error.
|
|
62
|
+
*
|
|
63
|
+
* @returns {RuntimeError} The runtime error.
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
getError(errorMessage, error) {
|
|
67
|
+
//>>includeStart('debug', pragmas.debug);
|
|
68
|
+
Check.typeOf.string("errorMessage", errorMessage);
|
|
69
|
+
//>>includeEnd('debug');
|
|
79
70
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
if (defined(error) && defined(error.message)) {
|
|
72
|
+
errorMessage += `\n${error.message}`;
|
|
73
|
+
}
|
|
83
74
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
const runtimeError = new RuntimeError(errorMessage);
|
|
76
|
+
if (defined(error)) {
|
|
77
|
+
runtimeError.stack = `Original stack:\n${error.stack}\nHandler stack:\n${runtimeError.stack}`;
|
|
78
|
+
}
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
}
|
|
80
|
+
return runtimeError;
|
|
81
|
+
}
|
|
91
82
|
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
85
|
+
* <br /><br />
|
|
86
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
87
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
88
|
+
*
|
|
89
|
+
* @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
90
|
+
*
|
|
91
|
+
* @see ResourceLoader#destroy
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
isDestroyed() {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
106
97
|
|
|
107
|
-
/**
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
98
|
+
/**
|
|
99
|
+
* Destroys the loaded resource.
|
|
100
|
+
* <br /><br />
|
|
101
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
102
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
103
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
104
|
+
*
|
|
105
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* resourceLoader = resourceLoader && resourceLoader.destroy();
|
|
109
|
+
*
|
|
110
|
+
* @see ResourceLoader#isDestroyed
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
destroy() {
|
|
114
|
+
this.unload();
|
|
115
|
+
return destroyObject(this);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
126
118
|
|
|
127
119
|
export default ResourceLoader;
|
package/Source/Scene/Scene.js
CHANGED
|
@@ -3022,6 +3022,18 @@ function renderEnvironment(scene, passState) {
|
|
|
3022
3022
|
if (environmentState.isMoonVisible) {
|
|
3023
3023
|
environmentState.moonCommand.execute(context, passState);
|
|
3024
3024
|
}
|
|
3025
|
+
|
|
3026
|
+
// execute panorama commands, drop removed primitives
|
|
3027
|
+
const panoramaCommandList = scene.frameState.panoramaCommandList;
|
|
3028
|
+
for (let i = panoramaCommandList.length - 1; i >= 0; i--) {
|
|
3029
|
+
const panoramaCommand = panoramaCommandList[i];
|
|
3030
|
+
if (defined(panoramaCommand.shaderProgram)) {
|
|
3031
|
+
executeCommand(panoramaCommandList[i], scene, passState);
|
|
3032
|
+
} else {
|
|
3033
|
+
//primitive was removed
|
|
3034
|
+
panoramaCommandList.splice(i, 1);
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3025
3037
|
}
|
|
3026
3038
|
|
|
3027
3039
|
/**
|
package/Source/Scene/SkyBox.js
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import buildModuleUrl from "../Core/buildModuleUrl.js";
|
|
2
|
-
import
|
|
3
|
-
import Cartesian3 from "../Core/Cartesian3.js";
|
|
4
|
-
import Check from "../Core/Check.js";
|
|
5
|
-
import defined from "../Core/defined.js";
|
|
6
|
-
import destroyObject from "../Core/destroyObject.js";
|
|
7
|
-
import DeveloperError from "../Core/DeveloperError.js";
|
|
8
|
-
import GeometryPipeline from "../Core/GeometryPipeline.js";
|
|
9
|
-
import Matrix4 from "../Core/Matrix4.js";
|
|
10
|
-
import VertexFormat from "../Core/VertexFormat.js";
|
|
11
|
-
import BufferUsage from "../Renderer/BufferUsage.js";
|
|
12
|
-
import CubeMap from "../Renderer/CubeMap.js";
|
|
13
|
-
import DrawCommand from "../Renderer/DrawCommand.js";
|
|
14
|
-
import loadCubeMap from "../Renderer/loadCubeMap.js";
|
|
15
|
-
import RenderState from "../Renderer/RenderState.js";
|
|
16
|
-
import ShaderProgram from "../Renderer/ShaderProgram.js";
|
|
17
|
-
import ShaderSource from "../Renderer/ShaderSource.js";
|
|
18
|
-
import VertexArray from "../Renderer/VertexArray.js";
|
|
19
|
-
import SkyBoxFS from "../Shaders/SkyBoxFS.js";
|
|
20
|
-
import SkyBoxVS from "../Shaders/SkyBoxVS.js";
|
|
21
|
-
import BlendingState from "./BlendingState.js";
|
|
2
|
+
import CubeMapPanorama from "./CubeMapPanorama.js";
|
|
22
3
|
import SceneMode from "./SceneMode.js";
|
|
4
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
23
5
|
|
|
24
6
|
/**
|
|
25
7
|
* A sky box around the scene to draw stars. The sky box is defined using the True Equator Mean Equinox (TEME) axes.
|
|
@@ -52,17 +34,7 @@ import SceneMode from "./SceneMode.js";
|
|
|
52
34
|
* @see Transforms.computeTemeToPseudoFixedMatrix
|
|
53
35
|
*/
|
|
54
36
|
function SkyBox(options) {
|
|
55
|
-
|
|
56
|
-
* The sources used to create the cube map faces: an object
|
|
57
|
-
* with <code>positiveX</code>, <code>negativeX</code>, <code>positiveY</code>,
|
|
58
|
-
* <code>negativeY</code>, <code>positiveZ</code>, and <code>negativeZ</code> properties.
|
|
59
|
-
* These can be either URLs or <code>Image</code> objects.
|
|
60
|
-
*
|
|
61
|
-
* @type {object}
|
|
62
|
-
* @default undefined
|
|
63
|
-
*/
|
|
64
|
-
this.sources = options.sources;
|
|
65
|
-
this._sources = undefined;
|
|
37
|
+
this._sources = options.sources;
|
|
66
38
|
|
|
67
39
|
/**
|
|
68
40
|
* Determines if the sky box will be shown.
|
|
@@ -71,19 +43,29 @@ function SkyBox(options) {
|
|
|
71
43
|
* @default true
|
|
72
44
|
*/
|
|
73
45
|
this.show = options.show ?? true;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
46
|
+
this._panorama = new CubeMapPanorama({
|
|
47
|
+
sources: this._sources,
|
|
48
|
+
show: this._show,
|
|
49
|
+
returnCommand: true,
|
|
78
50
|
});
|
|
79
|
-
this._cubeMap = undefined;
|
|
80
|
-
|
|
81
|
-
this._attributeLocations = undefined;
|
|
82
|
-
this._useHdr = undefined;
|
|
83
|
-
this._hasError = false;
|
|
84
|
-
this._error = undefined;
|
|
85
51
|
}
|
|
86
52
|
|
|
53
|
+
Object.defineProperties(SkyBox.prototype, {
|
|
54
|
+
/**
|
|
55
|
+
* Gets or sets the the primitive object.
|
|
56
|
+
* @memberof SkyBox.prototype
|
|
57
|
+
* @type {object}
|
|
58
|
+
*/
|
|
59
|
+
sources: {
|
|
60
|
+
get: function () {
|
|
61
|
+
return this._panorama.sources;
|
|
62
|
+
},
|
|
63
|
+
set: function (value) {
|
|
64
|
+
this._panorama.sources = value;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
87
69
|
/**
|
|
88
70
|
* Called when {@link Viewer} or {@link CesiumWidget} render the scene to
|
|
89
71
|
* get the draw commands needed to render this primitive.
|
|
@@ -96,131 +78,18 @@ function SkyBox(options) {
|
|
|
96
78
|
* @exception {DeveloperError} this.sources properties must all be the same type.
|
|
97
79
|
*/
|
|
98
80
|
SkyBox.prototype.update = function (frameState, useHdr) {
|
|
99
|
-
const
|
|
100
|
-
const { mode, passes, context } = frameState;
|
|
101
|
-
|
|
102
|
-
if (!this.show) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
81
|
+
const { mode, passes } = frameState;
|
|
105
82
|
|
|
106
83
|
if (mode !== SceneMode.SCENE3D && mode !== SceneMode.MORPHING) {
|
|
107
|
-
return
|
|
84
|
+
return;
|
|
108
85
|
}
|
|
109
86
|
|
|
110
|
-
// The sky box is only rendered during the render pass; it is not pickable, it doesn't cast shadows, etc.
|
|
111
87
|
if (!passes.render) {
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Throw any errors that had previously occurred asynchronously so they aren't
|
|
116
|
-
// ignored when running. See https://github.com/CesiumGS/cesium/pull/12307
|
|
117
|
-
if (this._hasError) {
|
|
118
|
-
const error = this._error;
|
|
119
|
-
this._hasError = false;
|
|
120
|
-
this._error = undefined;
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (this._sources !== this.sources) {
|
|
125
|
-
this._sources = this.sources;
|
|
126
|
-
const sources = this.sources;
|
|
127
|
-
|
|
128
|
-
//>>includeStart('debug', pragmas.debug);
|
|
129
|
-
Check.defined("this.sources", sources);
|
|
130
|
-
if (
|
|
131
|
-
Object.values(CubeMap.FaceName).some(
|
|
132
|
-
(faceName) => !defined(sources[faceName]),
|
|
133
|
-
)
|
|
134
|
-
) {
|
|
135
|
-
throw new DeveloperError(
|
|
136
|
-
"this.sources must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.",
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const sourceType = typeof sources.positiveX;
|
|
141
|
-
if (
|
|
142
|
-
Object.values(CubeMap.FaceName).some(
|
|
143
|
-
(faceName) => typeof sources[faceName] !== sourceType,
|
|
144
|
-
)
|
|
145
|
-
) {
|
|
146
|
-
throw new DeveloperError(
|
|
147
|
-
"this.sources properties must all be the same type.",
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
//>>includeEnd('debug');
|
|
151
|
-
|
|
152
|
-
if (typeof sources.positiveX === "string") {
|
|
153
|
-
// Given urls for cube-map images. Load them.
|
|
154
|
-
loadCubeMap(context, this._sources)
|
|
155
|
-
.then(function (cubeMap) {
|
|
156
|
-
that._cubeMap = that._cubeMap && that._cubeMap.destroy();
|
|
157
|
-
that._cubeMap = cubeMap;
|
|
158
|
-
})
|
|
159
|
-
.catch((error) => {
|
|
160
|
-
// Defer throwing the error until the next call to update to prevent
|
|
161
|
-
// test from failing in `afterAll` if this is rejected after the test
|
|
162
|
-
// using the Skybox ends. See https://github.com/CesiumGS/cesium/pull/12307
|
|
163
|
-
this._hasError = true;
|
|
164
|
-
this._error = error;
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
this._cubeMap = this._cubeMap && this._cubeMap.destroy();
|
|
168
|
-
this._cubeMap = new CubeMap({
|
|
169
|
-
context: context,
|
|
170
|
-
source: sources,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const command = this._command;
|
|
176
|
-
|
|
177
|
-
if (!defined(command.vertexArray)) {
|
|
178
|
-
command.uniformMap = {
|
|
179
|
-
u_cubeMap: function () {
|
|
180
|
-
return that._cubeMap;
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
const geometry = BoxGeometry.createGeometry(
|
|
185
|
-
BoxGeometry.fromDimensions({
|
|
186
|
-
dimensions: new Cartesian3(2.0, 2.0, 2.0),
|
|
187
|
-
vertexFormat: VertexFormat.POSITION_ONLY,
|
|
188
|
-
}),
|
|
189
|
-
);
|
|
190
|
-
const attributeLocations = (this._attributeLocations =
|
|
191
|
-
GeometryPipeline.createAttributeLocations(geometry));
|
|
192
|
-
|
|
193
|
-
command.vertexArray = VertexArray.fromGeometry({
|
|
194
|
-
context: context,
|
|
195
|
-
geometry: geometry,
|
|
196
|
-
attributeLocations: attributeLocations,
|
|
197
|
-
bufferUsage: BufferUsage.STATIC_DRAW,
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
command.renderState = RenderState.fromCache({
|
|
201
|
-
blending: BlendingState.ALPHA_BLEND,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (!defined(command.shaderProgram) || this._useHdr !== useHdr) {
|
|
206
|
-
const fs = new ShaderSource({
|
|
207
|
-
defines: [useHdr ? "HDR" : ""],
|
|
208
|
-
sources: [SkyBoxFS],
|
|
209
|
-
});
|
|
210
|
-
command.shaderProgram = ShaderProgram.fromCache({
|
|
211
|
-
context: context,
|
|
212
|
-
vertexShaderSource: SkyBoxVS,
|
|
213
|
-
fragmentShaderSource: fs,
|
|
214
|
-
attributeLocations: this._attributeLocations,
|
|
215
|
-
});
|
|
216
|
-
this._useHdr = useHdr;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (!defined(this._cubeMap)) {
|
|
220
|
-
return undefined;
|
|
88
|
+
return;
|
|
221
89
|
}
|
|
222
90
|
|
|
223
|
-
|
|
91
|
+
// Delegate completely
|
|
92
|
+
return this._panorama.update(frameState, useHdr);
|
|
224
93
|
};
|
|
225
94
|
|
|
226
95
|
/**
|
|
@@ -254,11 +123,7 @@ SkyBox.prototype.isDestroyed = function () {
|
|
|
254
123
|
* @see SkyBox#isDestroyed
|
|
255
124
|
*/
|
|
256
125
|
SkyBox.prototype.destroy = function () {
|
|
257
|
-
|
|
258
|
-
command.vertexArray = command.vertexArray && command.vertexArray.destroy();
|
|
259
|
-
command.shaderProgram =
|
|
260
|
-
command.shaderProgram && command.shaderProgram.destroy();
|
|
261
|
-
this._cubeMap = this._cubeMap && this._cubeMap.destroy();
|
|
126
|
+
this._panorama = this._panorama && this._panorama.destroy();
|
|
262
127
|
return destroyObject(this);
|
|
263
128
|
};
|
|
264
129
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { destroyObject } from "@cesium/engine";
|
|
1
2
|
import Check from "../Core/Check.js";
|
|
2
3
|
import Frozen from "../Core/Frozen.js";
|
|
3
4
|
import defined from "../Core/defined.js";
|
|
@@ -35,9 +36,9 @@ function StructuralMetadata(options) {
|
|
|
35
36
|
this._propertyTableCount = defined(propertyTables)
|
|
36
37
|
? propertyTables.length
|
|
37
38
|
: 0;
|
|
38
|
-
this._propertyTables = propertyTables;
|
|
39
|
-
this._propertyTextures = options.propertyTextures;
|
|
40
|
-
this._propertyAttributes = options.propertyAttributes;
|
|
39
|
+
this._propertyTables = propertyTables ?? [];
|
|
40
|
+
this._propertyTextures = options.propertyTextures ?? [];
|
|
41
|
+
this._propertyAttributes = options.propertyAttributes ?? [];
|
|
41
42
|
this._statistics = options.statistics;
|
|
42
43
|
this._extras = options.extras;
|
|
43
44
|
this._extensions = options.extensions;
|
|
@@ -240,4 +241,18 @@ StructuralMetadata.prototype.getPropertyAttribute = function (
|
|
|
240
241
|
return this._propertyAttributes[propertyAttributeId];
|
|
241
242
|
};
|
|
242
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Destroys any resources that need cleaning up in the structural metadata.
|
|
246
|
+
*
|
|
247
|
+
* @private
|
|
248
|
+
*/
|
|
249
|
+
StructuralMetadata.prototype.destroy = function () {
|
|
250
|
+
const propertyTables = this._propertyTables;
|
|
251
|
+
for (let i = 0; i < propertyTables.length; i++) {
|
|
252
|
+
propertyTables[i] = propertyTables[i] && propertyTables[i].destroy();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return destroyObject(this);
|
|
256
|
+
};
|
|
257
|
+
|
|
243
258
|
export default StructuralMetadata;
|