@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
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import BoxGeometry from "../Core/BoxGeometry.js";
|
|
2
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
3
|
+
import Check from "../Core/Check.js";
|
|
4
|
+
import defined from "../Core/defined.js";
|
|
5
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
6
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
7
|
+
import GeometryPipeline from "../Core/GeometryPipeline.js";
|
|
8
|
+
import Matrix4 from "../Core/Matrix4.js";
|
|
9
|
+
import VertexFormat from "../Core/VertexFormat.js";
|
|
10
|
+
import BufferUsage from "../Renderer/BufferUsage.js";
|
|
11
|
+
import CubeMap from "../Renderer/CubeMap.js";
|
|
12
|
+
import DrawCommand from "../Renderer/DrawCommand.js";
|
|
13
|
+
import loadCubeMap from "../Renderer/loadCubeMap.js";
|
|
14
|
+
import RenderState from "../Renderer/RenderState.js";
|
|
15
|
+
import ShaderProgram from "../Renderer/ShaderProgram.js";
|
|
16
|
+
import ShaderSource from "../Renderer/ShaderSource.js";
|
|
17
|
+
import VertexArray from "../Renderer/VertexArray.js";
|
|
18
|
+
import SkyBoxFS from "../Shaders/SkyBoxFS.js";
|
|
19
|
+
import SkyBoxVS from "../Shaders/SkyBoxVS.js";
|
|
20
|
+
import CubeMapPanoramaVS from "../Shaders/CubeMapPanoramaVS.js";
|
|
21
|
+
import BlendingState from "./BlendingState.js";
|
|
22
|
+
import SceneMode from "./SceneMode.js";
|
|
23
|
+
import Pass from "../Renderer/Pass.js";
|
|
24
|
+
import Credit from "../Core/Credit.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {object} CubeMapPanorama.ConstructorOptions
|
|
28
|
+
*
|
|
29
|
+
* Initialization options for the CubeMapPanorama constructor
|
|
30
|
+
*
|
|
31
|
+
* @property {object} [options.sources] The source URL or <code>Image</code> object for each of the six cube map faces. See the example below.
|
|
32
|
+
* @property {Matrix4} [options.transform] A 4x4 transformation matrix that defines the panorama’s position and orientation
|
|
33
|
+
* @property {boolean} [options.show=true] Determines if this primitive will be shown.
|
|
34
|
+
* @property {Credit|string} [options.credit] A credit for the panorama, which is displayed on the canvas.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A {@link Panorama} that displays imagery in cube map format in a scene.
|
|
40
|
+
* <p>
|
|
41
|
+
* This is only supported in 3D. The cube map panorama is faded out when morphing to 2D or Columbus view. The size of
|
|
42
|
+
* the cube map panorama must not exceed {@link Scene#maximumSkyBoxSize}.
|
|
43
|
+
* </p>
|
|
44
|
+
*
|
|
45
|
+
* @alias CubeMapPanorama
|
|
46
|
+
* @constructor
|
|
47
|
+
*
|
|
48
|
+
* @param {CubeMapPanorama.ConstructorOptions} options Object describing initialization options
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const modelMatrix = Cesium.Matrix4.getMatrix3(
|
|
52
|
+
* Cesium.Transforms.localFrameToFixedFrameGenerator("north", "down")(
|
|
53
|
+
* Cesium.Cartesian3.fromDegrees(longitude, latitude, height),
|
|
54
|
+
* Cesium.Ellipsoid.default
|
|
55
|
+
* ),
|
|
56
|
+
* new Cesium.Matrix3()
|
|
57
|
+
* );
|
|
58
|
+
*
|
|
59
|
+
*
|
|
60
|
+
* scene.primitives.add(new Cesium.CubeMapPanorama({
|
|
61
|
+
* sources : {
|
|
62
|
+
* positiveX : 'cubemap_px.png',
|
|
63
|
+
* negativeX : 'cubemap_nx.png',
|
|
64
|
+
* positiveY : 'cubemap_py.png',
|
|
65
|
+
* negativeY : 'cubemap_ny.png',
|
|
66
|
+
* positiveZ : 'cubemap_pz.png',
|
|
67
|
+
* negativeZ : 'cubemap_nz.png'
|
|
68
|
+
* }
|
|
69
|
+
* transform: modelMatrix,
|
|
70
|
+
* }));
|
|
71
|
+
*
|
|
72
|
+
* @see SkyBox
|
|
73
|
+
*
|
|
74
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=panorama|Cesium Sandcastle Panorama}
|
|
75
|
+
*/
|
|
76
|
+
function CubeMapPanorama(options) {
|
|
77
|
+
/**
|
|
78
|
+
* The sources used to create the cube map faces: an object
|
|
79
|
+
* with <code>positiveX</code>, <code>negativeX</code>, <code>positiveY</code>,
|
|
80
|
+
* <code>negativeY</code>, <code>positiveZ</code>, and <code>negativeZ</code> properties.
|
|
81
|
+
* These can be either URLs or <code>Image</code> objects.
|
|
82
|
+
*
|
|
83
|
+
* @type {object}
|
|
84
|
+
* @default undefined
|
|
85
|
+
*/
|
|
86
|
+
this.sources = options.sources;
|
|
87
|
+
this._sources = undefined;
|
|
88
|
+
|
|
89
|
+
this._transform = options.transform ?? undefined;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Determines if the cube map panorama will be shown.
|
|
93
|
+
*
|
|
94
|
+
* @type {boolean}
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
this.show = options.show ?? true;
|
|
98
|
+
|
|
99
|
+
this._returnCommand = options.returnCommand ?? false;
|
|
100
|
+
this._addToPanoramaCommandList = !this._returnCommand;
|
|
101
|
+
|
|
102
|
+
this._command = new DrawCommand({
|
|
103
|
+
modelMatrix: Matrix4.clone(Matrix4.IDENTITY),
|
|
104
|
+
owner: this,
|
|
105
|
+
// render before everything else
|
|
106
|
+
pass: Pass.ENVIRONMENT,
|
|
107
|
+
});
|
|
108
|
+
this._cubeMap = undefined;
|
|
109
|
+
|
|
110
|
+
this._attributeLocations = undefined;
|
|
111
|
+
this._useHdr = undefined;
|
|
112
|
+
this._hasError = false;
|
|
113
|
+
this._error = undefined;
|
|
114
|
+
|
|
115
|
+
// Credit specified by the user.
|
|
116
|
+
let credit = options.credit;
|
|
117
|
+
if (typeof credit === "string") {
|
|
118
|
+
credit = new Credit(credit);
|
|
119
|
+
}
|
|
120
|
+
this._credit = credit;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Object.defineProperties(CubeMapPanorama.prototype, {
|
|
124
|
+
/**
|
|
125
|
+
* Gets the transform of the panorama.
|
|
126
|
+
* @memberof CubeMapPanorama.prototype
|
|
127
|
+
* @type {Matrix4}
|
|
128
|
+
* @readonly
|
|
129
|
+
*/
|
|
130
|
+
transform: {
|
|
131
|
+
get: function () {
|
|
132
|
+
return this._transform;
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Gets the credits of the panorama.
|
|
138
|
+
* @memberof CubeMapPanorama.prototype
|
|
139
|
+
* @type {Credit}
|
|
140
|
+
* @readonly
|
|
141
|
+
*/
|
|
142
|
+
credit: {
|
|
143
|
+
get: function () {
|
|
144
|
+
return defined(this._credit) ? this._credit : undefined;
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Called when {@link Viewer} or {@link CesiumWidget} render the scene to
|
|
151
|
+
* get the draw commands needed to render this primitive.
|
|
152
|
+
* <p>
|
|
153
|
+
* Do not call this function directly. This is documented just to
|
|
154
|
+
* list the exceptions that may be propagated when the scene is rendered:
|
|
155
|
+
* </p>
|
|
156
|
+
*
|
|
157
|
+
* @exception {DeveloperError} this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.
|
|
158
|
+
* @exception {DeveloperError} this.sources properties must all be the same type.
|
|
159
|
+
*/
|
|
160
|
+
CubeMapPanorama.prototype.update = function (frameState, useHdr) {
|
|
161
|
+
const that = this;
|
|
162
|
+
const { mode, passes, context, panoramaCommandList } = frameState;
|
|
163
|
+
|
|
164
|
+
if (!this.show) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (mode !== SceneMode.SCENE3D && mode !== SceneMode.MORPHING) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// The cube map panorama is only rendered during the render pass; it is not pickable, it doesn't cast shadows, etc.
|
|
173
|
+
if (!passes.render) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Throw any errors that had previously occurred asynchronously so they aren't
|
|
178
|
+
// ignored when running. See https://github.com/CesiumGS/cesium/pull/12307
|
|
179
|
+
if (this._hasError) {
|
|
180
|
+
const error = this._error;
|
|
181
|
+
this._hasError = false;
|
|
182
|
+
this._error = undefined;
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (this._sources !== this.sources) {
|
|
187
|
+
this._sources = this.sources;
|
|
188
|
+
const sources = this.sources;
|
|
189
|
+
|
|
190
|
+
//>>includeStart('debug', pragmas.debug);
|
|
191
|
+
Check.defined("this.sources", sources);
|
|
192
|
+
if (
|
|
193
|
+
Object.values(CubeMap.FaceName).some(
|
|
194
|
+
(faceName) => !defined(sources[faceName]),
|
|
195
|
+
)
|
|
196
|
+
) {
|
|
197
|
+
throw new DeveloperError(
|
|
198
|
+
"this.sources must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.",
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const sourceType = typeof sources.positiveX;
|
|
203
|
+
if (
|
|
204
|
+
Object.values(CubeMap.FaceName).some(
|
|
205
|
+
(faceName) => typeof sources[faceName] !== sourceType,
|
|
206
|
+
)
|
|
207
|
+
) {
|
|
208
|
+
throw new DeveloperError(
|
|
209
|
+
"this.sources properties must all be the same type.",
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
//>>includeEnd('debug');
|
|
213
|
+
|
|
214
|
+
if (typeof sources.positiveX === "string") {
|
|
215
|
+
// Given urls for cube-map images. Load them.
|
|
216
|
+
loadCubeMap(context, this._sources)
|
|
217
|
+
.then(function (cubeMap) {
|
|
218
|
+
that._cubeMap = that._cubeMap && that._cubeMap.destroy();
|
|
219
|
+
that._cubeMap = cubeMap;
|
|
220
|
+
})
|
|
221
|
+
.catch((error) => {
|
|
222
|
+
// Defer throwing the error until the next call to update to prevent
|
|
223
|
+
// test from failing in `afterAll` if this is rejected after the test
|
|
224
|
+
// using the Skybox ends. See https://github.com/CesiumGS/cesium/pull/12307
|
|
225
|
+
this._hasError = true;
|
|
226
|
+
this._error = error;
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
this._cubeMap = this._cubeMap && this._cubeMap.destroy();
|
|
230
|
+
this._cubeMap = new CubeMap({
|
|
231
|
+
context: context,
|
|
232
|
+
source: sources,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
this._addToPanoramaCommandList = true;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const command = this._command;
|
|
239
|
+
|
|
240
|
+
if (!defined(command.vertexArray)) {
|
|
241
|
+
command.uniformMap = {
|
|
242
|
+
u_cubeMap: function () {
|
|
243
|
+
return that._cubeMap;
|
|
244
|
+
},
|
|
245
|
+
u_cubeMapPanoramaTransform: function () {
|
|
246
|
+
return that._transform;
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const geometry = BoxGeometry.createGeometry(
|
|
251
|
+
BoxGeometry.fromDimensions({
|
|
252
|
+
dimensions: new Cartesian3(2.0, 2.0, 2.0),
|
|
253
|
+
vertexFormat: VertexFormat.POSITION_ONLY,
|
|
254
|
+
}),
|
|
255
|
+
);
|
|
256
|
+
const attributeLocations = (this._attributeLocations =
|
|
257
|
+
GeometryPipeline.createAttributeLocations(geometry));
|
|
258
|
+
|
|
259
|
+
command.vertexArray = VertexArray.fromGeometry({
|
|
260
|
+
context: context,
|
|
261
|
+
geometry: geometry,
|
|
262
|
+
attributeLocations: attributeLocations,
|
|
263
|
+
bufferUsage: BufferUsage.STATIC_DRAW,
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// no depth test/write
|
|
267
|
+
command.renderState = RenderState.fromCache({
|
|
268
|
+
depthTest: { enabled: false },
|
|
269
|
+
depthMask: false,
|
|
270
|
+
blending: BlendingState.ALPHA_BLEND,
|
|
271
|
+
});
|
|
272
|
+
this._addToPanoramaCommandList = true;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (!defined(command.shaderProgram) || this._useHdr !== useHdr) {
|
|
276
|
+
const fs = new ShaderSource({
|
|
277
|
+
defines: [useHdr ? "HDR" : ""],
|
|
278
|
+
sources: [SkyBoxFS],
|
|
279
|
+
});
|
|
280
|
+
command.shaderProgram = ShaderProgram.fromCache({
|
|
281
|
+
context: context,
|
|
282
|
+
//vertexShaderSource: SkyBoxVS,
|
|
283
|
+
vertexShaderSource: defined(this._transform)
|
|
284
|
+
? CubeMapPanoramaVS
|
|
285
|
+
: SkyBoxVS,
|
|
286
|
+
fragmentShaderSource: fs,
|
|
287
|
+
attributeLocations: this._attributeLocations,
|
|
288
|
+
});
|
|
289
|
+
this._useHdr = useHdr;
|
|
290
|
+
this._addToPanoramaCommandList = true;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (!defined(this._cubeMap)) {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (this.show && defined(this._credit) && !this._returnCommand) {
|
|
298
|
+
const creditDisplay = frameState.creditDisplay;
|
|
299
|
+
creditDisplay.addCreditToNextFrame(this._credit);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (this._returnCommand) {
|
|
303
|
+
return command;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (this._addToPanoramaCommandList) {
|
|
307
|
+
panoramaCommandList.push(command);
|
|
308
|
+
this._addToPanoramaCommandList = false;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
314
|
+
* <br /><br />
|
|
315
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
316
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
317
|
+
*
|
|
318
|
+
* @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
319
|
+
*
|
|
320
|
+
* @see CubeMapPanorama#destroy
|
|
321
|
+
*/
|
|
322
|
+
CubeMapPanorama.prototype.isDestroyed = function () {
|
|
323
|
+
return false;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
328
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
329
|
+
* <br /><br />
|
|
330
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
331
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
332
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
333
|
+
*
|
|
334
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
335
|
+
*
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* cubeMapPanorama = cubeMapPanorama && cubeMapPanorama.destroy();
|
|
339
|
+
*
|
|
340
|
+
* @see CubeMapPanorama#isDestroyed
|
|
341
|
+
*/
|
|
342
|
+
CubeMapPanorama.prototype.destroy = function () {
|
|
343
|
+
const command = this._command;
|
|
344
|
+
command.vertexArray = command.vertexArray && command.vertexArray.destroy();
|
|
345
|
+
command.shaderProgram =
|
|
346
|
+
command.shaderProgram && command.shaderProgram.destroy();
|
|
347
|
+
this._cubeMap = this._cubeMap && this._cubeMap.destroy();
|
|
348
|
+
return destroyObject(this);
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
export default CubeMapPanorama;
|
|
@@ -264,13 +264,13 @@ function getPickShaderProgram(context, shaderProgram, pickId) {
|
|
|
264
264
|
|
|
265
265
|
const hasFragData = sources.some((source) => source.includes("out_FragData"));
|
|
266
266
|
const outputColorVariable = hasFragData ? "out_FragData_0" : "out_FragColor";
|
|
267
|
-
const newMain = `void main ()
|
|
268
|
-
{
|
|
269
|
-
czm_non_pick_main();
|
|
270
|
-
if (${outputColorVariable}.a == 0.0) {
|
|
271
|
-
discard;
|
|
272
|
-
}
|
|
273
|
-
${outputColorVariable} = ${pickId};
|
|
267
|
+
const newMain = `void main ()
|
|
268
|
+
{
|
|
269
|
+
czm_non_pick_main();
|
|
270
|
+
if (${outputColorVariable}.a == 0.0) {
|
|
271
|
+
discard;
|
|
272
|
+
}
|
|
273
|
+
${outputColorVariable} = ${pickId};
|
|
274
274
|
} `;
|
|
275
275
|
|
|
276
276
|
const length = sources.length;
|
|
@@ -394,29 +394,6 @@ function getComponentCount(classProperty) {
|
|
|
394
394
|
return classProperty.arrayLength;
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
/**
|
|
398
|
-
* Returns the type that the given class property has in a GLSL shader.
|
|
399
|
-
*
|
|
400
|
-
* It returns the same string as `PropertyTextureProperty.prototype.getGlslType`
|
|
401
|
-
* for a property texture property with the given class property
|
|
402
|
-
*
|
|
403
|
-
* @param {MetadataClassProperty} classProperty The class property
|
|
404
|
-
* @returns {string} The GLSL shader type string for the property
|
|
405
|
-
*/
|
|
406
|
-
function getGlslType(classProperty) {
|
|
407
|
-
const componentCount = getComponentCount(classProperty);
|
|
408
|
-
if (classProperty.normalized) {
|
|
409
|
-
if (componentCount === 1) {
|
|
410
|
-
return "float";
|
|
411
|
-
}
|
|
412
|
-
return `vec${componentCount}`;
|
|
413
|
-
}
|
|
414
|
-
if (componentCount === 1) {
|
|
415
|
-
return "int";
|
|
416
|
-
}
|
|
417
|
-
return `ivec${componentCount}`;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
397
|
/**
|
|
421
398
|
* Returns a shader statement that applies the inverse of the
|
|
422
399
|
* value transform to the given value, based on the given offset
|
|
@@ -547,7 +524,7 @@ function getPickMetadataShaderProgram(
|
|
|
547
524
|
|
|
548
525
|
const metadataProperty = pickedMetadataInfo.metadataProperty;
|
|
549
526
|
const classProperty = pickedMetadataInfo.classProperty;
|
|
550
|
-
const glslType = getGlslType(
|
|
527
|
+
const glslType = classProperty.getGlslType();
|
|
551
528
|
|
|
552
529
|
// Define the components that will go into the output `metadataValues`.
|
|
553
530
|
// This will be the 'color' that is written into the frame buffer,
|
|
@@ -6,94 +6,95 @@ import TaskProcessor from "../Core/TaskProcessor.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
class DracoLoader {
|
|
10
|
+
static _getDecoderTaskProcessor() {
|
|
11
|
+
if (!defined(DracoLoader._decoderTaskProcessor)) {
|
|
12
|
+
const processor = new TaskProcessor(
|
|
13
|
+
"decodeDraco",
|
|
14
|
+
DracoLoader._maxDecodingConcurrency,
|
|
15
|
+
);
|
|
16
|
+
processor
|
|
17
|
+
.initWebAssemblyModule({
|
|
18
|
+
wasmBinaryFile: "ThirdParty/draco_decoder.wasm",
|
|
19
|
+
})
|
|
20
|
+
.then(function (result) {
|
|
21
|
+
if (result) {
|
|
22
|
+
DracoLoader._taskProcessorReady = true;
|
|
23
|
+
} else {
|
|
24
|
+
DracoLoader._error = new RuntimeError(
|
|
25
|
+
"Draco decoder could not be initialized.",
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
.catch((error) => {
|
|
30
|
+
DracoLoader._error = error;
|
|
31
|
+
});
|
|
32
|
+
DracoLoader._decoderTaskProcessor = processor;
|
|
33
|
+
}
|
|
10
34
|
|
|
11
|
-
|
|
12
|
-
DracoLoader._maxDecodingConcurrency = Math.max(
|
|
13
|
-
FeatureDetection.hardwareConcurrency - 1,
|
|
14
|
-
1,
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
// Exposed for testing purposes
|
|
18
|
-
DracoLoader._decoderTaskProcessor = undefined;
|
|
19
|
-
DracoLoader._taskProcessorReady = false;
|
|
20
|
-
DracoLoader._error = undefined;
|
|
21
|
-
DracoLoader._getDecoderTaskProcessor = function () {
|
|
22
|
-
if (!defined(DracoLoader._decoderTaskProcessor)) {
|
|
23
|
-
const processor = new TaskProcessor(
|
|
24
|
-
"decodeDraco",
|
|
25
|
-
DracoLoader._maxDecodingConcurrency,
|
|
26
|
-
);
|
|
27
|
-
processor
|
|
28
|
-
.initWebAssemblyModule({
|
|
29
|
-
wasmBinaryFile: "ThirdParty/draco_decoder.wasm",
|
|
30
|
-
})
|
|
31
|
-
.then(function (result) {
|
|
32
|
-
if (result) {
|
|
33
|
-
DracoLoader._taskProcessorReady = true;
|
|
34
|
-
} else {
|
|
35
|
-
DracoLoader._error = new RuntimeError(
|
|
36
|
-
"Draco decoder could not be initialized.",
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
.catch((error) => {
|
|
41
|
-
DracoLoader._error = error;
|
|
42
|
-
});
|
|
43
|
-
DracoLoader._decoderTaskProcessor = processor;
|
|
35
|
+
return DracoLoader._decoderTaskProcessor;
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Decodes a compressed point cloud. Returns undefined if the task cannot be scheduled.
|
|
40
|
+
* @private
|
|
41
|
+
*
|
|
42
|
+
* @exception {RuntimeError} Draco decoder could not be initialized.
|
|
43
|
+
*/
|
|
44
|
+
static decodePointCloud(parameters) {
|
|
45
|
+
const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
|
|
46
|
+
if (defined(DracoLoader._error)) {
|
|
47
|
+
throw DracoLoader._error;
|
|
48
|
+
}
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
|
|
57
|
-
if (defined(DracoLoader._error)) {
|
|
58
|
-
throw DracoLoader._error;
|
|
50
|
+
if (!DracoLoader._taskProcessorReady) {
|
|
51
|
+
// The task processor is not ready to schedule tasks
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return decoderTaskProcessor.scheduleTask(parameters, [
|
|
55
|
+
parameters.buffer.buffer,
|
|
56
|
+
]);
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
59
|
+
/**
|
|
60
|
+
* Decodes a buffer view. Returns undefined if the task cannot be scheduled.
|
|
61
|
+
*
|
|
62
|
+
* @param {object} options Object with the following properties:
|
|
63
|
+
* @param {Uint8Array} options.array The typed array containing the buffer view data.
|
|
64
|
+
* @param {object} options.bufferView The glTF buffer view object.
|
|
65
|
+
* @param {Object<string, number>} options.compressedAttributes The compressed attributes.
|
|
66
|
+
* @param {boolean} options.dequantizeInShader Whether POSITION and NORMAL attributes should be dequantized on the GPU.
|
|
67
|
+
*
|
|
68
|
+
* @returns {Promise} A promise that resolves to the decoded indices and attributes.
|
|
69
|
+
* @private
|
|
70
|
+
*
|
|
71
|
+
* @exception {RuntimeError} Draco decoder could not be initialized.
|
|
72
|
+
*/
|
|
73
|
+
static decodeBufferView(options) {
|
|
74
|
+
const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* @param {object} options Object with the following properties:
|
|
74
|
-
* @param {Uint8Array} options.array The typed array containing the buffer view data.
|
|
75
|
-
* @param {object} options.bufferView The glTF buffer view object.
|
|
76
|
-
* @param {Object<string, number>} options.compressedAttributes The compressed attributes.
|
|
77
|
-
* @param {boolean} options.dequantizeInShader Whether POSITION and NORMAL attributes should be dequantized on the GPU.
|
|
78
|
-
*
|
|
79
|
-
* @returns {Promise} A promise that resolves to the decoded indices and attributes.
|
|
80
|
-
* @private
|
|
81
|
-
*
|
|
82
|
-
* @exception {RuntimeError} Draco decoder could not be initialized.
|
|
83
|
-
*/
|
|
84
|
-
DracoLoader.decodeBufferView = function (options) {
|
|
85
|
-
const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
|
|
76
|
+
if (defined(DracoLoader._error)) {
|
|
77
|
+
throw DracoLoader._error;
|
|
78
|
+
}
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
if (!DracoLoader._taskProcessorReady) {
|
|
81
|
+
// The task processor is not ready to schedule tasks
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
// The task processor is not ready to schedule tasks
|
|
93
|
-
return;
|
|
85
|
+
return decoderTaskProcessor.scheduleTask(options, [options.array.buffer]);
|
|
94
86
|
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Maximum concurrency to use when decoding draco models
|
|
90
|
+
DracoLoader._maxDecodingConcurrency = Math.max(
|
|
91
|
+
FeatureDetection.hardwareConcurrency - 1,
|
|
92
|
+
1,
|
|
93
|
+
);
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
// Exposed for testing purposes
|
|
96
|
+
DracoLoader._decoderTaskProcessor = undefined;
|
|
97
|
+
DracoLoader._taskProcessorReady = false;
|
|
98
|
+
DracoLoader._error = undefined;
|
|
98
99
|
|
|
99
100
|
export default DracoLoader;
|