deeptwins-cesium-engine 0.1.2 → 0.1.4
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-2HWLF3FT.js +837 -0
- package/Build/Workers/chunk-2KXMJ5XS.js +3792 -0
- package/Build/Workers/chunk-2NPCLB3H.js +56 -0
- package/Build/Workers/chunk-2ZHQTIBH.js +1483 -0
- package/Build/Workers/chunk-3GLYOW63.js +352 -0
- package/Build/Workers/chunk-3L22KMPU.js +219 -0
- package/Build/Workers/chunk-3Q6V2B2I.js +73 -0
- package/Build/Workers/chunk-3QOKKRIG.js +387 -0
- package/Build/Workers/chunk-44YZFGRH.js +1800 -0
- package/Build/Workers/chunk-45VV4SBO.js +2342 -0
- package/Build/Workers/chunk-4EJ4AA2S.js +368 -0
- package/Build/Workers/chunk-4IJFHUL6.js +414 -0
- package/Build/Workers/chunk-4K3V5CGW.js +454 -0
- package/Build/Workers/chunk-4M4QL6KJ.js +305 -0
- package/Build/Workers/chunk-4YNRIEQ6.js +288 -0
- package/Build/Workers/chunk-56CVDPH5.js +352 -0
- package/Build/Workers/chunk-5CTAAPXH.js +1483 -0
- package/Build/Workers/chunk-5ISZ6NJD.js +102 -0
- package/Build/Workers/chunk-5SDHYIOS.js +56 -0
- package/Build/Workers/chunk-66TGUMCU.js +2719 -0
- package/Build/Workers/chunk-6EJMTDQJ.js +163 -0
- package/Build/Workers/chunk-6VWXYSMH.js +959 -0
- package/Build/Workers/chunk-6VZ7VB2Q.js +241 -0
- package/Build/Workers/chunk-7AMRE57Q.js +301 -0
- package/Build/Workers/chunk-7DH6C33H.js +398 -0
- package/Build/Workers/chunk-7VUS3FVE.js +38 -0
- package/Build/Workers/chunk-7Y3ZA6H3.js +198 -0
- package/Build/Workers/chunk-A6BMHZNA.js +38 -0
- package/Build/Workers/chunk-A7XY2MN7.js +171 -0
- package/Build/Workers/chunk-AC7ND63S.js +57 -0
- package/Build/Workers/chunk-AHCZ757M.js +9230 -0
- package/Build/Workers/chunk-ANOA7E7F.js +56 -0
- package/Build/Workers/chunk-AYO5HHV6.js +789 -0
- package/Build/Workers/chunk-BE2N56VZ.js +1344 -0
- package/Build/Workers/chunk-BR3BPM64.js +9230 -0
- package/Build/Workers/chunk-BVMRWGOK.js +455 -0
- package/Build/Workers/chunk-BXEL2NX7.js +455 -0
- package/Build/Workers/chunk-C5BO2JCG.js +278 -0
- package/Build/Workers/chunk-CIRQNZVR.js +301 -0
- package/Build/Workers/chunk-CM67CQME.js +305 -0
- package/Build/Workers/chunk-D3QIW4DH.js +630 -0
- package/Build/Workers/chunk-E5W7QIGZ.js +511 -0
- package/Build/Workers/chunk-E6CYGUJI.js +1054 -0
- package/Build/Workers/chunk-EIZ23IOX.js +414 -0
- package/Build/Workers/chunk-EIZJUMQY.js +101 -0
- package/Build/Workers/chunk-EXTMZJXB.js +82 -0
- package/Build/Workers/chunk-EYOOSIBW.js +682 -0
- package/Build/Workers/chunk-F37WADVC.js +1054 -0
- package/Build/Workers/chunk-FIWPJFHX.js +101 -0
- package/Build/Workers/chunk-FM32TNGT.js +198 -0
- package/Build/Workers/chunk-FOMYIEIB.js +476 -0
- package/Build/Workers/chunk-FWYDLSVQ.js +97 -0
- package/Build/Workers/chunk-HGZR6CZF.js +1067 -0
- package/Build/Workers/chunk-HIXHDABG.js +288 -0
- package/Build/Workers/chunk-HMCCZZWE.js +97 -0
- package/Build/Workers/chunk-HW54WHGM.js +2719 -0
- package/Build/Workers/chunk-IHYAI7GF.js +973 -0
- package/Build/Workers/chunk-INLQ7LVK.js +837 -0
- package/Build/Workers/chunk-IQMESTCB.js +124 -0
- package/Build/Workers/chunk-J4PISUNT.js +2342 -0
- package/Build/Workers/chunk-JSWU557I.js +693 -0
- package/Build/Workers/chunk-KHONDSQ7.js +693 -0
- package/Build/Workers/chunk-KLUL2SOE.js +352 -0
- package/Build/Workers/chunk-KMBLKQCC.js +1992 -0
- package/Build/Workers/chunk-KOTWWQN7.js +171 -0
- package/Build/Workers/chunk-KWV6ZTF4.js +163 -0
- package/Build/Workers/chunk-LSEFPQHG.js +476 -0
- package/Build/Workers/chunk-M66X4O24.js +44 -0
- package/Build/Workers/chunk-M6IXKBC7.js +1992 -0
- package/Build/Workers/chunk-MFUC3D5C.js +162 -0
- package/Build/Workers/chunk-MRMNELAH.js +82 -0
- package/Build/Workers/chunk-N3NUA5H2.js +3792 -0
- package/Build/Workers/chunk-NFB2NXJN.js +138 -0
- package/Build/Workers/chunk-NQAXBK4K.js +789 -0
- package/Build/Workers/chunk-NUGQWV6S.js +352 -0
- package/Build/Workers/chunk-O7S7WL7K.js +278 -0
- package/Build/Workers/chunk-ODZYB26X.js +1287 -0
- package/Build/Workers/chunk-OEHJY463.js +3201 -0
- package/Build/Workers/chunk-OMMRNMXF.js +44 -0
- package/Build/Workers/chunk-OZ3CQDO3.js +138 -0
- package/Build/Workers/chunk-PNXBG64I.js +219 -0
- package/Build/Workers/chunk-PYR35GK4.js +973 -0
- package/Build/Workers/chunk-Q4CXGW74.js +57 -0
- package/Build/Workers/chunk-QGISLKCW.js +147 -0
- package/Build/Workers/chunk-QQHVOJW6.js +497 -0
- package/Build/Workers/chunk-QWCMMRJW.js +58 -0
- package/Build/Workers/chunk-RDEZCHF4.js +398 -0
- package/Build/Workers/chunk-SJTE7FVN.js +778 -0
- package/Build/Workers/chunk-SM5T67LR.js +162 -0
- package/Build/Workers/chunk-T27NNXEU.js +58 -0
- package/Build/Workers/chunk-T4J5BWUO.js +511 -0
- package/Build/Workers/chunk-T6JS4BRN.js +140 -0
- package/Build/Workers/chunk-UH6DUQBW.js +140 -0
- package/Build/Workers/chunk-UJAH6XKF.js +73 -0
- package/Build/Workers/chunk-UKSTJ2PH.js +454 -0
- package/Build/Workers/chunk-UQCDCCZ7.js +368 -0
- package/Build/Workers/chunk-UXIFNEA3.js +1287 -0
- package/Build/Workers/chunk-UXJ6J5L7.js +56 -0
- package/Build/Workers/chunk-V4VUAZXI.js +1800 -0
- package/Build/Workers/chunk-VQH2YXO2.js +497 -0
- package/Build/Workers/chunk-VXKCLSE4.js +241 -0
- package/Build/Workers/chunk-W3U6YBEI.js +280 -0
- package/Build/Workers/chunk-W75ZVFKP.js +778 -0
- package/Build/Workers/chunk-WCDFJYFB.js +1344 -0
- package/Build/Workers/chunk-WME5M6W3.js +630 -0
- package/Build/Workers/chunk-XDQBQB64.js +1067 -0
- package/Build/Workers/chunk-Y6HOIWE5.js +959 -0
- package/Build/Workers/chunk-YEMC2ZOR.js +147 -0
- package/Build/Workers/chunk-YWNF3TPE.js +682 -0
- package/Build/Workers/chunk-Z55VGWJP.js +280 -0
- package/Build/Workers/chunk-Z5YWP24C.js +124 -0
- package/Build/Workers/chunk-ZHXCWUJB.js +387 -0
- package/Build/Workers/chunk-ZIMPUF2I.js +102 -0
- package/Build/Workers/chunk-ZKDWYQKC.js +3201 -0
- package/Build/Workers/combineGeometry.js +24 -22
- package/Build/Workers/createBoxGeometry.js +18 -16
- package/Build/Workers/createBoxOutlineGeometry.js +23 -25
- package/Build/Workers/createCircleGeometry.js +29 -27
- package/Build/Workers/createCircleOutlineGeometry.js +22 -20
- package/Build/Workers/createCoplanarPolygonGeometry.js +43 -43
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +37 -35
- package/Build/Workers/createCorridorGeometry.js +46 -49
- package/Build/Workers/createCorridorOutlineGeometry.js +40 -43
- package/Build/Workers/createCylinderGeometry.js +20 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +27 -25
- package/Build/Workers/createEllipseGeometry.js +28 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +21 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -16
- package/Build/Workers/createFrustumGeometry.js +18 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +21 -21
- package/Build/Workers/createGeometry.js +31 -26
- package/Build/Workers/createGroundPolylineGeometry.js +188 -135
- package/Build/Workers/createPlaneGeometry.js +22 -21
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -13
- package/Build/Workers/createPolygonGeometry.js +51 -52
- package/Build/Workers/createPolygonOutlineGeometry.js +43 -44
- package/Build/Workers/createPolylineGeometry.js +37 -40
- package/Build/Workers/createPolylineVolumeGeometry.js +41 -44
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +36 -39
- package/Build/Workers/createRectangleGeometry.js +47 -53
- package/Build/Workers/createRectangleOutlineGeometry.js +32 -33
- package/Build/Workers/createSimplePolylineGeometry.js +33 -34
- package/Build/Workers/createSphereGeometry.js +20 -20
- package/Build/Workers/createSphereOutlineGeometry.js +19 -19
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +16 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -22
- package/Build/Workers/createVectorTilePoints.js +15 -13
- package/Build/Workers/createVectorTilePolygons.js +24 -21
- package/Build/Workers/createVectorTilePolylines.js +16 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +29 -27
- package/Build/Workers/createVerticesFromHeightmap.js +42 -63
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +26 -280
- package/Build/Workers/createWallGeometry.js +35 -36
- package/Build/Workers/createWallOutlineGeometry.js +33 -34
- package/Build/Workers/decodeDraco.js +10 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +16 -20
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
- package/Build/Workers/transcodeKTX2.js +42 -14
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +24 -21
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Shaders/BillboardCollectionFS.js +85 -81
- package/Source/Shaders/BillboardCollectionVS.js +60 -118
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.js +12 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
- package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +2 -1
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +0 -1
- package/Source/Shaders/EllipsoidVS.js +4 -4
- package/Source/Shaders/FXAA3_11.js +2 -0
- package/Source/Shaders/GlobeFS.js +22 -0
- package/Source/Shaders/GlobeVS.js +3 -2
- package/Source/Shaders/Model/MaterialStageFS.js +50 -20
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.js +32 -2
- package/Source/Shaders/Model/ModelVS.js +15 -1
- package/Source/Shaders/Model/PointCloudStylingStageVS.js +2 -1
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +0 -1
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
- package/Source/Shaders/PolylineCommon.js +1 -1
- package/Source/Shaders/ShadowVolumeAppearanceFS.js +7 -15
- package/Source/Shaders/SkyAtmosphereVS.js +2 -1
- package/Source/Shaders/Voxels/IntersectBox.js +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.js +10 -6
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
- package/Source/Shaders/Voxels/Intersection.js +3 -5
- package/Source/Shaders/Voxels/IntersectionUtils.js +2 -1
- package/Source/Shaders/Voxels/Megatexture.js +15 -83
- package/Source/Shaders/Voxels/Octree.js +53 -61
- package/Source/Shaders/Voxels/VoxelFS.js +67 -52
- package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
- package/index.js +346 -261
- package/package.json +1 -1
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +0 -80
- package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
- package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.1.3
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2011-2022 Cesium Contributors
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*
|
|
20
|
+
* Columbus View (Pat. Pend.)
|
|
21
|
+
*
|
|
22
|
+
* Portions licensed separately.
|
|
23
|
+
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
IndexDatatype_default
|
|
28
|
+
} from "./chunk-UH6DUQBW.js";
|
|
29
|
+
import {
|
|
30
|
+
Math_default
|
|
31
|
+
} from "./chunk-QQHVOJW6.js";
|
|
32
|
+
import {
|
|
33
|
+
DeveloperError_default
|
|
34
|
+
} from "./chunk-6EJMTDQJ.js";
|
|
35
|
+
import {
|
|
36
|
+
defined_default
|
|
37
|
+
} from "./chunk-EXTMZJXB.js";
|
|
38
|
+
|
|
39
|
+
// packages/engine/Source/Core/TerrainProvider.js
|
|
40
|
+
function TerrainProvider() {
|
|
41
|
+
DeveloperError_default.throwInstantiationError();
|
|
42
|
+
}
|
|
43
|
+
Object.defineProperties(TerrainProvider.prototype, {
|
|
44
|
+
/**
|
|
45
|
+
* Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing
|
|
46
|
+
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
47
|
+
* are passed an instance of {@link TileProviderError}.
|
|
48
|
+
* @memberof TerrainProvider.prototype
|
|
49
|
+
* @type {Event<TerrainProvider.ErrorEvent>}
|
|
50
|
+
* @readonly
|
|
51
|
+
*/
|
|
52
|
+
errorEvent: {
|
|
53
|
+
get: DeveloperError_default.throwInstantiationError
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Gets the credit to display when this terrain provider is active. Typically this is used to credit
|
|
57
|
+
* the source of the terrain.
|
|
58
|
+
* @memberof TerrainProvider.prototype
|
|
59
|
+
* @type {Credit}
|
|
60
|
+
* @readonly
|
|
61
|
+
*/
|
|
62
|
+
credit: {
|
|
63
|
+
get: DeveloperError_default.throwInstantiationError
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Gets the tiling scheme used by the provider.
|
|
67
|
+
* @memberof TerrainProvider.prototype
|
|
68
|
+
* @type {TilingScheme}
|
|
69
|
+
* @readonly
|
|
70
|
+
*/
|
|
71
|
+
tilingScheme: {
|
|
72
|
+
get: DeveloperError_default.throwInstantiationError
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Gets a value indicating whether or not the provider includes a water mask. The water mask
|
|
76
|
+
* indicates which areas of the globe are water rather than land, so they can be rendered
|
|
77
|
+
* as a reflective surface with animated waves.
|
|
78
|
+
* @memberof TerrainProvider.prototype
|
|
79
|
+
* @type {boolean}
|
|
80
|
+
* @readonly
|
|
81
|
+
*/
|
|
82
|
+
hasWaterMask: {
|
|
83
|
+
get: DeveloperError_default.throwInstantiationError
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Gets a value indicating whether or not the requested tiles include vertex normals.
|
|
87
|
+
* @memberof TerrainProvider.prototype
|
|
88
|
+
* @type {boolean}
|
|
89
|
+
* @readonly
|
|
90
|
+
*/
|
|
91
|
+
hasVertexNormals: {
|
|
92
|
+
get: DeveloperError_default.throwInstantiationError
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* Gets an object that can be used to determine availability of terrain from this provider, such as
|
|
96
|
+
* at points and in rectangles. This property may be undefined if availability
|
|
97
|
+
* information is not available.
|
|
98
|
+
* @memberof TerrainProvider.prototype
|
|
99
|
+
* @type {TileAvailability|undefined}
|
|
100
|
+
* @readonly
|
|
101
|
+
*/
|
|
102
|
+
availability: {
|
|
103
|
+
get: DeveloperError_default.throwInstantiationError
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
var regularGridIndicesCache = [];
|
|
107
|
+
TerrainProvider.getRegularGridIndices = function(width, height) {
|
|
108
|
+
if (width * height >= Math_default.FOUR_GIGABYTES) {
|
|
109
|
+
throw new DeveloperError_default(
|
|
110
|
+
"The total number of vertices (width * height) must be less than 4,294,967,296."
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
let byWidth = regularGridIndicesCache[width];
|
|
114
|
+
if (!defined_default(byWidth)) {
|
|
115
|
+
regularGridIndicesCache[width] = byWidth = [];
|
|
116
|
+
}
|
|
117
|
+
let indices = byWidth[height];
|
|
118
|
+
if (!defined_default(indices)) {
|
|
119
|
+
if (width * height < Math_default.SIXTY_FOUR_KILOBYTES) {
|
|
120
|
+
indices = byWidth[height] = new Uint16Array(
|
|
121
|
+
(width - 1) * (height - 1) * 6
|
|
122
|
+
);
|
|
123
|
+
} else {
|
|
124
|
+
indices = byWidth[height] = new Uint32Array(
|
|
125
|
+
(width - 1) * (height - 1) * 6
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
addRegularGridIndices(width, height, indices, 0);
|
|
129
|
+
}
|
|
130
|
+
return indices;
|
|
131
|
+
};
|
|
132
|
+
var regularGridAndEdgeIndicesCache = [];
|
|
133
|
+
TerrainProvider.getRegularGridIndicesAndEdgeIndices = function(width, height) {
|
|
134
|
+
if (width * height >= Math_default.FOUR_GIGABYTES) {
|
|
135
|
+
throw new DeveloperError_default(
|
|
136
|
+
"The total number of vertices (width * height) must be less than 4,294,967,296."
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
let byWidth = regularGridAndEdgeIndicesCache[width];
|
|
140
|
+
if (!defined_default(byWidth)) {
|
|
141
|
+
regularGridAndEdgeIndicesCache[width] = byWidth = [];
|
|
142
|
+
}
|
|
143
|
+
let indicesAndEdges = byWidth[height];
|
|
144
|
+
if (!defined_default(indicesAndEdges)) {
|
|
145
|
+
const indices = TerrainProvider.getRegularGridIndices(width, height);
|
|
146
|
+
const edgeIndices = getEdgeIndices(width, height);
|
|
147
|
+
const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
|
|
148
|
+
const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
|
|
149
|
+
const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
|
|
150
|
+
const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
|
|
151
|
+
indicesAndEdges = byWidth[height] = {
|
|
152
|
+
indices,
|
|
153
|
+
westIndicesSouthToNorth,
|
|
154
|
+
southIndicesEastToWest,
|
|
155
|
+
eastIndicesNorthToSouth,
|
|
156
|
+
northIndicesWestToEast
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return indicesAndEdges;
|
|
160
|
+
};
|
|
161
|
+
var regularGridAndSkirtAndEdgeIndicesCache = [];
|
|
162
|
+
TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function(width, height) {
|
|
163
|
+
if (width * height >= Math_default.FOUR_GIGABYTES) {
|
|
164
|
+
throw new DeveloperError_default(
|
|
165
|
+
"The total number of vertices (width * height) must be less than 4,294,967,296."
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
let byWidth = regularGridAndSkirtAndEdgeIndicesCache[width];
|
|
169
|
+
if (!defined_default(byWidth)) {
|
|
170
|
+
regularGridAndSkirtAndEdgeIndicesCache[width] = byWidth = [];
|
|
171
|
+
}
|
|
172
|
+
let indicesAndEdges = byWidth[height];
|
|
173
|
+
if (!defined_default(indicesAndEdges)) {
|
|
174
|
+
const gridVertexCount = width * height;
|
|
175
|
+
const gridIndexCount = (width - 1) * (height - 1) * 6;
|
|
176
|
+
const edgeVertexCount = width * 2 + height * 2;
|
|
177
|
+
const edgeIndexCount = Math.max(0, edgeVertexCount - 4) * 6;
|
|
178
|
+
const vertexCount = gridVertexCount + edgeVertexCount;
|
|
179
|
+
const indexCount = gridIndexCount + edgeIndexCount;
|
|
180
|
+
const edgeIndices = getEdgeIndices(width, height);
|
|
181
|
+
const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
|
|
182
|
+
const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
|
|
183
|
+
const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
|
|
184
|
+
const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
|
|
185
|
+
const indices = IndexDatatype_default.createTypedArray(vertexCount, indexCount);
|
|
186
|
+
addRegularGridIndices(width, height, indices, 0);
|
|
187
|
+
TerrainProvider.addSkirtIndices(
|
|
188
|
+
westIndicesSouthToNorth,
|
|
189
|
+
southIndicesEastToWest,
|
|
190
|
+
eastIndicesNorthToSouth,
|
|
191
|
+
northIndicesWestToEast,
|
|
192
|
+
gridVertexCount,
|
|
193
|
+
indices,
|
|
194
|
+
gridIndexCount
|
|
195
|
+
);
|
|
196
|
+
indicesAndEdges = byWidth[height] = {
|
|
197
|
+
indices,
|
|
198
|
+
westIndicesSouthToNorth,
|
|
199
|
+
southIndicesEastToWest,
|
|
200
|
+
eastIndicesNorthToSouth,
|
|
201
|
+
northIndicesWestToEast,
|
|
202
|
+
indexCountWithoutSkirts: gridIndexCount
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return indicesAndEdges;
|
|
206
|
+
};
|
|
207
|
+
TerrainProvider.getSkirtVertexCount = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast) {
|
|
208
|
+
return westIndicesSouthToNorth.length + southIndicesEastToWest.length + eastIndicesNorthToSouth.length + northIndicesWestToEast.length;
|
|
209
|
+
};
|
|
210
|
+
TerrainProvider.getSkirtIndexCount = function(skirtVertexCount) {
|
|
211
|
+
return (skirtVertexCount - 4) * 2 * 3;
|
|
212
|
+
};
|
|
213
|
+
TerrainProvider.getSkirtIndexCountWithFilledCorners = function(skirtVertexCount) {
|
|
214
|
+
return ((skirtVertexCount - 4) * 2 + 4) * 3;
|
|
215
|
+
};
|
|
216
|
+
TerrainProvider.addSkirtIndices = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices, offset) {
|
|
217
|
+
let vertexIndex = vertexCount;
|
|
218
|
+
offset = addSkirtIndices(
|
|
219
|
+
westIndicesSouthToNorth,
|
|
220
|
+
vertexIndex,
|
|
221
|
+
indices,
|
|
222
|
+
offset
|
|
223
|
+
);
|
|
224
|
+
vertexIndex += westIndicesSouthToNorth.length;
|
|
225
|
+
offset = addSkirtIndices(
|
|
226
|
+
southIndicesEastToWest,
|
|
227
|
+
vertexIndex,
|
|
228
|
+
indices,
|
|
229
|
+
offset
|
|
230
|
+
);
|
|
231
|
+
vertexIndex += southIndicesEastToWest.length;
|
|
232
|
+
offset = addSkirtIndices(
|
|
233
|
+
eastIndicesNorthToSouth,
|
|
234
|
+
vertexIndex,
|
|
235
|
+
indices,
|
|
236
|
+
offset
|
|
237
|
+
);
|
|
238
|
+
vertexIndex += eastIndicesNorthToSouth.length;
|
|
239
|
+
addSkirtIndices(northIndicesWestToEast, vertexIndex, indices, offset);
|
|
240
|
+
};
|
|
241
|
+
TerrainProvider.addSkirtIndicesWithFilledCorners = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices, offset) {
|
|
242
|
+
TerrainProvider.addSkirtIndices(
|
|
243
|
+
westIndicesSouthToNorth,
|
|
244
|
+
southIndicesEastToWest,
|
|
245
|
+
eastIndicesNorthToSouth,
|
|
246
|
+
northIndicesWestToEast,
|
|
247
|
+
vertexCount,
|
|
248
|
+
indices,
|
|
249
|
+
offset
|
|
250
|
+
);
|
|
251
|
+
const skirtVertexCount = TerrainProvider.getSkirtVertexCount(
|
|
252
|
+
westIndicesSouthToNorth,
|
|
253
|
+
southIndicesEastToWest,
|
|
254
|
+
eastIndicesNorthToSouth,
|
|
255
|
+
northIndicesWestToEast
|
|
256
|
+
);
|
|
257
|
+
const skirtIndexCountWithoutCaps = TerrainProvider.getSkirtIndexCount(skirtVertexCount);
|
|
258
|
+
const cornerStartIdx = offset + skirtIndexCountWithoutCaps;
|
|
259
|
+
const cornerSWIndex = westIndicesSouthToNorth[0];
|
|
260
|
+
const cornerNWIndex = northIndicesWestToEast[0];
|
|
261
|
+
const cornerNEIndex = eastIndicesNorthToSouth[0];
|
|
262
|
+
const cornerSEIndex = southIndicesEastToWest[0];
|
|
263
|
+
const westSouthIndex = vertexCount;
|
|
264
|
+
const westNorthIndex = westSouthIndex + westIndicesSouthToNorth.length - 1;
|
|
265
|
+
const southEastIndex = westNorthIndex + 1;
|
|
266
|
+
const southWestIndex = southEastIndex + southIndicesEastToWest.length - 1;
|
|
267
|
+
const eastNorthIndex = southWestIndex + 1;
|
|
268
|
+
const eastSouthIndex = eastNorthIndex + eastIndicesNorthToSouth.length - 1;
|
|
269
|
+
const northWestIndex = eastSouthIndex + 1;
|
|
270
|
+
const northEastIndex = northWestIndex + northIndicesWestToEast.length - 1;
|
|
271
|
+
indices[cornerStartIdx + 0] = cornerSWIndex;
|
|
272
|
+
indices[cornerStartIdx + 1] = westSouthIndex;
|
|
273
|
+
indices[cornerStartIdx + 2] = southWestIndex;
|
|
274
|
+
indices[cornerStartIdx + 3] = cornerSEIndex;
|
|
275
|
+
indices[cornerStartIdx + 4] = southEastIndex;
|
|
276
|
+
indices[cornerStartIdx + 5] = eastSouthIndex;
|
|
277
|
+
indices[cornerStartIdx + 6] = cornerNEIndex;
|
|
278
|
+
indices[cornerStartIdx + 7] = eastNorthIndex;
|
|
279
|
+
indices[cornerStartIdx + 8] = northEastIndex;
|
|
280
|
+
indices[cornerStartIdx + 9] = cornerNWIndex;
|
|
281
|
+
indices[cornerStartIdx + 10] = northWestIndex;
|
|
282
|
+
indices[cornerStartIdx + 11] = westNorthIndex;
|
|
283
|
+
};
|
|
284
|
+
function getEdgeIndices(width, height) {
|
|
285
|
+
const westIndicesSouthToNorth = new Array(height);
|
|
286
|
+
const southIndicesEastToWest = new Array(width);
|
|
287
|
+
const eastIndicesNorthToSouth = new Array(height);
|
|
288
|
+
const northIndicesWestToEast = new Array(width);
|
|
289
|
+
let i;
|
|
290
|
+
for (i = 0; i < width; ++i) {
|
|
291
|
+
northIndicesWestToEast[i] = i;
|
|
292
|
+
southIndicesEastToWest[i] = width * height - 1 - i;
|
|
293
|
+
}
|
|
294
|
+
for (i = 0; i < height; ++i) {
|
|
295
|
+
eastIndicesNorthToSouth[i] = (i + 1) * width - 1;
|
|
296
|
+
westIndicesSouthToNorth[i] = (height - i - 1) * width;
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
westIndicesSouthToNorth,
|
|
300
|
+
southIndicesEastToWest,
|
|
301
|
+
eastIndicesNorthToSouth,
|
|
302
|
+
northIndicesWestToEast
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function addRegularGridIndices(width, height, indices, offset) {
|
|
306
|
+
let index = 0;
|
|
307
|
+
for (let j = 0; j < height - 1; ++j) {
|
|
308
|
+
for (let i = 0; i < width - 1; ++i) {
|
|
309
|
+
const upperLeft = index;
|
|
310
|
+
const lowerLeft = upperLeft + width;
|
|
311
|
+
const lowerRight = lowerLeft + 1;
|
|
312
|
+
const upperRight = upperLeft + 1;
|
|
313
|
+
indices[offset++] = upperLeft;
|
|
314
|
+
indices[offset++] = lowerLeft;
|
|
315
|
+
indices[offset++] = upperRight;
|
|
316
|
+
indices[offset++] = upperRight;
|
|
317
|
+
indices[offset++] = lowerLeft;
|
|
318
|
+
indices[offset++] = lowerRight;
|
|
319
|
+
++index;
|
|
320
|
+
}
|
|
321
|
+
++index;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function addSkirtIndices(edgeIndices, vertexIndex, indices, offset) {
|
|
325
|
+
let previousIndex = edgeIndices[0];
|
|
326
|
+
const length = edgeIndices.length;
|
|
327
|
+
for (let i = 1; i < length; ++i) {
|
|
328
|
+
const index = edgeIndices[i];
|
|
329
|
+
indices[offset++] = previousIndex;
|
|
330
|
+
indices[offset++] = index;
|
|
331
|
+
indices[offset++] = vertexIndex;
|
|
332
|
+
indices[offset++] = vertexIndex;
|
|
333
|
+
indices[offset++] = index;
|
|
334
|
+
indices[offset++] = vertexIndex + 1;
|
|
335
|
+
previousIndex = index;
|
|
336
|
+
++vertexIndex;
|
|
337
|
+
}
|
|
338
|
+
return offset;
|
|
339
|
+
}
|
|
340
|
+
TerrainProvider.heightmapTerrainQuality = 0.25;
|
|
341
|
+
TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap = function(ellipsoid, tileImageWidth, numberOfTilesAtLevelZero) {
|
|
342
|
+
return ellipsoid.maximumRadius * 2 * Math.PI * TerrainProvider.heightmapTerrainQuality / (tileImageWidth * numberOfTilesAtLevelZero);
|
|
343
|
+
};
|
|
344
|
+
TerrainProvider.prototype.requestTileGeometry = DeveloperError_default.throwInstantiationError;
|
|
345
|
+
TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError_default.throwInstantiationError;
|
|
346
|
+
TerrainProvider.prototype.getTileDataAvailable = DeveloperError_default.throwInstantiationError;
|
|
347
|
+
TerrainProvider.prototype.loadTileDataAvailability = DeveloperError_default.throwInstantiationError;
|
|
348
|
+
var TerrainProvider_default = TerrainProvider;
|
|
349
|
+
|
|
350
|
+
export {
|
|
351
|
+
TerrainProvider_default
|
|
352
|
+
};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.1.3
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2011-2022 Cesium Contributors
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*
|
|
20
|
+
* Columbus View (Pat. Pend.)
|
|
21
|
+
*
|
|
22
|
+
* Portions licensed separately.
|
|
23
|
+
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
WebGLConstants_default
|
|
28
|
+
} from "./chunk-WME5M6W3.js";
|
|
29
|
+
import {
|
|
30
|
+
DeveloperError_default
|
|
31
|
+
} from "./chunk-6EJMTDQJ.js";
|
|
32
|
+
import {
|
|
33
|
+
defined_default
|
|
34
|
+
} from "./chunk-EXTMZJXB.js";
|
|
35
|
+
|
|
36
|
+
// packages/engine/Source/Core/ComponentDatatype.js
|
|
37
|
+
var ComponentDatatype = {
|
|
38
|
+
/**
|
|
39
|
+
* 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type
|
|
40
|
+
* of an element in <code>Int8Array</code>.
|
|
41
|
+
*
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @constant
|
|
44
|
+
*/
|
|
45
|
+
BYTE: WebGLConstants_default.BYTE,
|
|
46
|
+
/**
|
|
47
|
+
* 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
|
|
48
|
+
* of an element in <code>Uint8Array</code>.
|
|
49
|
+
*
|
|
50
|
+
* @type {number}
|
|
51
|
+
* @constant
|
|
52
|
+
*/
|
|
53
|
+
UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
|
|
54
|
+
/**
|
|
55
|
+
* 16-bit signed short corresponding to <code>SHORT</code> and the type
|
|
56
|
+
* of an element in <code>Int16Array</code>.
|
|
57
|
+
*
|
|
58
|
+
* @type {number}
|
|
59
|
+
* @constant
|
|
60
|
+
*/
|
|
61
|
+
SHORT: WebGLConstants_default.SHORT,
|
|
62
|
+
/**
|
|
63
|
+
* 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
|
|
64
|
+
* of an element in <code>Uint16Array</code>.
|
|
65
|
+
*
|
|
66
|
+
* @type {number}
|
|
67
|
+
* @constant
|
|
68
|
+
*/
|
|
69
|
+
UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
|
|
70
|
+
/**
|
|
71
|
+
* 32-bit signed int corresponding to <code>INT</code> and the type
|
|
72
|
+
* of an element in <code>Int32Array</code>.
|
|
73
|
+
*
|
|
74
|
+
* @memberOf ComponentDatatype
|
|
75
|
+
*
|
|
76
|
+
* @type {number}
|
|
77
|
+
* @constant
|
|
78
|
+
*/
|
|
79
|
+
INT: WebGLConstants_default.INT,
|
|
80
|
+
/**
|
|
81
|
+
* 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
|
|
82
|
+
* of an element in <code>Uint32Array</code>.
|
|
83
|
+
*
|
|
84
|
+
* @memberOf ComponentDatatype
|
|
85
|
+
*
|
|
86
|
+
* @type {number}
|
|
87
|
+
* @constant
|
|
88
|
+
*/
|
|
89
|
+
UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT,
|
|
90
|
+
/**
|
|
91
|
+
* 32-bit floating-point corresponding to <code>FLOAT</code> and the type
|
|
92
|
+
* of an element in <code>Float32Array</code>.
|
|
93
|
+
*
|
|
94
|
+
* @type {number}
|
|
95
|
+
* @constant
|
|
96
|
+
*/
|
|
97
|
+
FLOAT: WebGLConstants_default.FLOAT,
|
|
98
|
+
/**
|
|
99
|
+
* 64-bit floating-point corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL;
|
|
100
|
+
* this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute})
|
|
101
|
+
* and the type of an element in <code>Float64Array</code>.
|
|
102
|
+
*
|
|
103
|
+
* @memberOf ComponentDatatype
|
|
104
|
+
*
|
|
105
|
+
* @type {number}
|
|
106
|
+
* @constant
|
|
107
|
+
* @default 0x140A
|
|
108
|
+
*/
|
|
109
|
+
DOUBLE: WebGLConstants_default.DOUBLE
|
|
110
|
+
};
|
|
111
|
+
ComponentDatatype.getSizeInBytes = function(componentDatatype) {
|
|
112
|
+
if (!defined_default(componentDatatype)) {
|
|
113
|
+
throw new DeveloperError_default("value is required.");
|
|
114
|
+
}
|
|
115
|
+
switch (componentDatatype) {
|
|
116
|
+
case ComponentDatatype.BYTE:
|
|
117
|
+
return Int8Array.BYTES_PER_ELEMENT;
|
|
118
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
119
|
+
return Uint8Array.BYTES_PER_ELEMENT;
|
|
120
|
+
case ComponentDatatype.SHORT:
|
|
121
|
+
return Int16Array.BYTES_PER_ELEMENT;
|
|
122
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
123
|
+
return Uint16Array.BYTES_PER_ELEMENT;
|
|
124
|
+
case ComponentDatatype.INT:
|
|
125
|
+
return Int32Array.BYTES_PER_ELEMENT;
|
|
126
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
127
|
+
return Uint32Array.BYTES_PER_ELEMENT;
|
|
128
|
+
case ComponentDatatype.FLOAT:
|
|
129
|
+
return Float32Array.BYTES_PER_ELEMENT;
|
|
130
|
+
case ComponentDatatype.DOUBLE:
|
|
131
|
+
return Float64Array.BYTES_PER_ELEMENT;
|
|
132
|
+
//>>includeStart('debug', pragmas.debug);
|
|
133
|
+
default:
|
|
134
|
+
throw new DeveloperError_default("componentDatatype is not a valid value.");
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
ComponentDatatype.fromTypedArray = function(array) {
|
|
138
|
+
if (array instanceof Int8Array) {
|
|
139
|
+
return ComponentDatatype.BYTE;
|
|
140
|
+
}
|
|
141
|
+
if (array instanceof Uint8Array) {
|
|
142
|
+
return ComponentDatatype.UNSIGNED_BYTE;
|
|
143
|
+
}
|
|
144
|
+
if (array instanceof Int16Array) {
|
|
145
|
+
return ComponentDatatype.SHORT;
|
|
146
|
+
}
|
|
147
|
+
if (array instanceof Uint16Array) {
|
|
148
|
+
return ComponentDatatype.UNSIGNED_SHORT;
|
|
149
|
+
}
|
|
150
|
+
if (array instanceof Int32Array) {
|
|
151
|
+
return ComponentDatatype.INT;
|
|
152
|
+
}
|
|
153
|
+
if (array instanceof Uint32Array) {
|
|
154
|
+
return ComponentDatatype.UNSIGNED_INT;
|
|
155
|
+
}
|
|
156
|
+
if (array instanceof Float32Array) {
|
|
157
|
+
return ComponentDatatype.FLOAT;
|
|
158
|
+
}
|
|
159
|
+
if (array instanceof Float64Array) {
|
|
160
|
+
return ComponentDatatype.DOUBLE;
|
|
161
|
+
}
|
|
162
|
+
throw new DeveloperError_default(
|
|
163
|
+
"array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array."
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
ComponentDatatype.validate = function(componentDatatype) {
|
|
167
|
+
return defined_default(componentDatatype) && (componentDatatype === ComponentDatatype.BYTE || componentDatatype === ComponentDatatype.UNSIGNED_BYTE || componentDatatype === ComponentDatatype.SHORT || componentDatatype === ComponentDatatype.UNSIGNED_SHORT || componentDatatype === ComponentDatatype.INT || componentDatatype === ComponentDatatype.UNSIGNED_INT || componentDatatype === ComponentDatatype.FLOAT || componentDatatype === ComponentDatatype.DOUBLE);
|
|
168
|
+
};
|
|
169
|
+
ComponentDatatype.createTypedArray = function(componentDatatype, valuesOrLength) {
|
|
170
|
+
if (!defined_default(componentDatatype)) {
|
|
171
|
+
throw new DeveloperError_default("componentDatatype is required.");
|
|
172
|
+
}
|
|
173
|
+
if (!defined_default(valuesOrLength)) {
|
|
174
|
+
throw new DeveloperError_default("valuesOrLength is required.");
|
|
175
|
+
}
|
|
176
|
+
switch (componentDatatype) {
|
|
177
|
+
case ComponentDatatype.BYTE:
|
|
178
|
+
return new Int8Array(valuesOrLength);
|
|
179
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
180
|
+
return new Uint8Array(valuesOrLength);
|
|
181
|
+
case ComponentDatatype.SHORT:
|
|
182
|
+
return new Int16Array(valuesOrLength);
|
|
183
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
184
|
+
return new Uint16Array(valuesOrLength);
|
|
185
|
+
case ComponentDatatype.INT:
|
|
186
|
+
return new Int32Array(valuesOrLength);
|
|
187
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
188
|
+
return new Uint32Array(valuesOrLength);
|
|
189
|
+
case ComponentDatatype.FLOAT:
|
|
190
|
+
return new Float32Array(valuesOrLength);
|
|
191
|
+
case ComponentDatatype.DOUBLE:
|
|
192
|
+
return new Float64Array(valuesOrLength);
|
|
193
|
+
//>>includeStart('debug', pragmas.debug);
|
|
194
|
+
default:
|
|
195
|
+
throw new DeveloperError_default("componentDatatype is not a valid value.");
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
ComponentDatatype.createArrayBufferView = function(componentDatatype, buffer, byteOffset, length) {
|
|
199
|
+
if (!defined_default(componentDatatype)) {
|
|
200
|
+
throw new DeveloperError_default("componentDatatype is required.");
|
|
201
|
+
}
|
|
202
|
+
if (!defined_default(buffer)) {
|
|
203
|
+
throw new DeveloperError_default("buffer is required.");
|
|
204
|
+
}
|
|
205
|
+
byteOffset = byteOffset ?? 0;
|
|
206
|
+
length = length ?? (buffer.byteLength - byteOffset) / ComponentDatatype.getSizeInBytes(componentDatatype);
|
|
207
|
+
switch (componentDatatype) {
|
|
208
|
+
case ComponentDatatype.BYTE:
|
|
209
|
+
return new Int8Array(buffer, byteOffset, length);
|
|
210
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
211
|
+
return new Uint8Array(buffer, byteOffset, length);
|
|
212
|
+
case ComponentDatatype.SHORT:
|
|
213
|
+
return new Int16Array(buffer, byteOffset, length);
|
|
214
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
215
|
+
return new Uint16Array(buffer, byteOffset, length);
|
|
216
|
+
case ComponentDatatype.INT:
|
|
217
|
+
return new Int32Array(buffer, byteOffset, length);
|
|
218
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
219
|
+
return new Uint32Array(buffer, byteOffset, length);
|
|
220
|
+
case ComponentDatatype.FLOAT:
|
|
221
|
+
return new Float32Array(buffer, byteOffset, length);
|
|
222
|
+
case ComponentDatatype.DOUBLE:
|
|
223
|
+
return new Float64Array(buffer, byteOffset, length);
|
|
224
|
+
//>>includeStart('debug', pragmas.debug);
|
|
225
|
+
default:
|
|
226
|
+
throw new DeveloperError_default("componentDatatype is not a valid value.");
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
ComponentDatatype.fromName = function(name) {
|
|
230
|
+
switch (name) {
|
|
231
|
+
case "BYTE":
|
|
232
|
+
return ComponentDatatype.BYTE;
|
|
233
|
+
case "UNSIGNED_BYTE":
|
|
234
|
+
return ComponentDatatype.UNSIGNED_BYTE;
|
|
235
|
+
case "SHORT":
|
|
236
|
+
return ComponentDatatype.SHORT;
|
|
237
|
+
case "UNSIGNED_SHORT":
|
|
238
|
+
return ComponentDatatype.UNSIGNED_SHORT;
|
|
239
|
+
case "INT":
|
|
240
|
+
return ComponentDatatype.INT;
|
|
241
|
+
case "UNSIGNED_INT":
|
|
242
|
+
return ComponentDatatype.UNSIGNED_INT;
|
|
243
|
+
case "FLOAT":
|
|
244
|
+
return ComponentDatatype.FLOAT;
|
|
245
|
+
case "DOUBLE":
|
|
246
|
+
return ComponentDatatype.DOUBLE;
|
|
247
|
+
//>>includeStart('debug', pragmas.debug);
|
|
248
|
+
default:
|
|
249
|
+
throw new DeveloperError_default("name is not a valid value.");
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
ComponentDatatype.dequantize = function(value, componentDatatype) {
|
|
253
|
+
switch (componentDatatype) {
|
|
254
|
+
case ComponentDatatype.BYTE:
|
|
255
|
+
return Math.max(value / 127, -1);
|
|
256
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
257
|
+
return value / 255;
|
|
258
|
+
case ComponentDatatype.SHORT:
|
|
259
|
+
return Math.max(value / 32767, -1);
|
|
260
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
261
|
+
return value / 65535;
|
|
262
|
+
case ComponentDatatype.INT:
|
|
263
|
+
return Math.max(value / 2147483647, -1);
|
|
264
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
265
|
+
return value / 4294967295;
|
|
266
|
+
//>>includeStart('debug', pragmas.debug);
|
|
267
|
+
default:
|
|
268
|
+
throw new DeveloperError_default(
|
|
269
|
+
"componentDatatype is not a valid integer type for dequantization."
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
Object.freeze(ComponentDatatype);
|
|
274
|
+
var ComponentDatatype_default = ComponentDatatype;
|
|
275
|
+
|
|
276
|
+
export {
|
|
277
|
+
ComponentDatatype_default
|
|
278
|
+
};
|