@vcmap/ui 6.0.0-rc.1 → 6.0.0-rc.2
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/config/base.config.json +4 -4
- package/dist/assets/cesium/Assets/approximateTerrainHeights.json +1 -1
- package/dist/assets/cesium/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/dist/assets/cesium/Workers/{chunk-ZA25DG4Y.js → chunk-3DRPXHZ4.js} +11 -11
- package/dist/assets/cesium/Workers/{chunk-OAVNIRB4.js → chunk-3GI7DWF7.js} +5 -7
- package/dist/assets/cesium/Workers/{chunk-TFC6TZ3S.js → chunk-4EW3HFFI.js} +33 -22
- package/dist/assets/cesium/Workers/{chunk-LLUNNUJV.js → chunk-4OX4RYLB.js} +5 -5
- package/dist/assets/cesium/Workers/{chunk-66QLLS45.js → chunk-4RJH3H6D.js} +11 -9
- package/dist/assets/cesium/Workers/{chunk-MPAZH4BF.js → chunk-5OUTANXX.js} +1 -1
- package/dist/assets/cesium/Workers/{chunk-WXTV4ATB.js → chunk-6DH5PLFD.js} +1 -1
- package/dist/assets/cesium/Workers/{chunk-A4JVFBQ3.js → chunk-6DXIYFX3.js} +2 -2
- package/dist/assets/cesium/Workers/chunk-A5C2A5O5.js +963 -0
- package/dist/assets/cesium/Workers/{chunk-HQF437NJ.js → chunk-AGTH5JMJ.js} +6 -6
- package/dist/assets/cesium/Workers/{chunk-RP2A7BR5.js → chunk-AVFIYUKX.js} +12 -14
- package/dist/assets/cesium/Workers/{chunk-227AJNOA.js → chunk-BAJAVGUF.js} +5 -5
- package/dist/assets/cesium/Workers/{chunk-N3JIFFX2.js → chunk-BPY4HDAK.js} +5 -6
- package/dist/assets/cesium/Workers/{chunk-ABADGKYE.js → chunk-D6PDWQXW.js} +2 -2
- package/dist/assets/cesium/Workers/{chunk-34YUDLRP.js → chunk-DR7LK6PG.js} +13 -13
- package/dist/assets/cesium/Workers/{chunk-OYFCF4PL.js → chunk-DTACCQDR.js} +6 -6
- package/dist/assets/cesium/Workers/{chunk-C3SXRKRW.js → chunk-EVU2UNBD.js} +7 -7
- package/dist/assets/cesium/Workers/{chunk-6BTKZDRG.js → chunk-F7IEM66T.js} +3 -5
- package/dist/assets/cesium/Workers/{chunk-QT3MPEMI.js → chunk-FSXNF76Y.js} +4 -4
- package/dist/assets/cesium/Workers/{chunk-PCJWUS4M.js → chunk-FYYT5EVH.js} +830 -14
- package/dist/assets/cesium/Workers/{chunk-QMEMZIJI.js → chunk-FZDKIUDT.js} +4 -4
- package/dist/assets/cesium/Workers/{chunk-XTY7B2N6.js → chunk-G6346EDR.js} +16 -16
- package/dist/assets/cesium/Workers/{chunk-CHHNOC2C.js → chunk-H7PSTL64.js} +95 -155
- package/dist/assets/cesium/Workers/{chunk-2R5O53JW.js → chunk-I67V66MN.js} +6 -6
- package/dist/assets/cesium/Workers/{chunk-JS3AW5BK.js → chunk-IALQGTA2.js} +6 -6
- package/dist/assets/cesium/Workers/{chunk-K36FEYS7.js → chunk-KNMGSIIN.js} +16 -12
- package/dist/assets/cesium/Workers/{chunk-J3JY6I2C.js → chunk-L4XQPD6P.js} +49 -88
- package/dist/assets/cesium/Workers/{chunk-X4SU25DT.js → chunk-LMTN7R7M.js} +10 -12
- package/dist/assets/cesium/Workers/{chunk-JB2LWGH4.js → chunk-LUYI3XCB.js} +14 -14
- package/dist/assets/cesium/Workers/{chunk-AFFLIKOH.js → chunk-N5MIFVXJ.js} +7 -7
- package/dist/assets/cesium/Workers/{chunk-MYZB7C4T.js → chunk-O7OUBDMZ.js} +10 -10
- package/dist/assets/cesium/Workers/{chunk-VLGOATD6.js → chunk-P24I5VUS.js} +22 -22
- package/dist/assets/cesium/Workers/{chunk-KD4Y7CZL.js → chunk-PIOKSAZH.js} +15 -17
- package/dist/assets/cesium/Workers/{chunk-3W63OHNJ.js → chunk-PRKEY4QK.js} +5 -5
- package/dist/assets/cesium/Workers/{chunk-O5AMBQ36.js → chunk-Q7PM4W34.js} +8 -8
- package/dist/assets/cesium/Workers/{chunk-GLZBE3ML.js → chunk-QLC66ZRL.js} +13 -13
- package/dist/assets/cesium/Workers/{chunk-OZJDGN5F.js → chunk-RRLGJV3Q.js} +16 -16
- package/dist/assets/cesium/Workers/{chunk-CCFQRR6D.js → chunk-S2UEXF6T.js} +1 -1
- package/dist/assets/cesium/Workers/{chunk-QIKODV5G.js → chunk-S4VTLNAJ.js} +4 -4
- package/dist/assets/cesium/Workers/{chunk-EW2GWJYB.js → chunk-SJC5PRDX.js} +2 -2
- package/dist/assets/cesium/Workers/{chunk-KTJSNCK4.js → chunk-T6TZXGG5.js} +230 -20
- package/dist/assets/cesium/Workers/{chunk-RW6LU2CJ.js → chunk-TLGODPEV.js} +5 -5
- package/dist/assets/cesium/Workers/{chunk-CTELOFLA.js → chunk-UC566ISB.js} +6 -6
- package/dist/assets/cesium/Workers/{chunk-ZFOBYDGF.js → chunk-UMX265HW.js} +2 -2
- package/dist/assets/cesium/Workers/{chunk-Z24VKNDO.js → chunk-V7WJDCPA.js} +12 -12
- package/dist/assets/cesium/Workers/{chunk-4MFFIWUA.js → chunk-VD6G7UPU.js} +2 -2
- package/dist/assets/cesium/Workers/{chunk-XY7MGBKC.js → chunk-WMVCLETM.js} +14 -16
- package/dist/assets/cesium/Workers/{chunk-IPA4EACJ.js → chunk-WOA6WSHH.js} +12 -12
- package/dist/assets/cesium/Workers/{chunk-PFQBCKBM.js → chunk-X67EJ6X6.js} +4398 -2722
- package/dist/assets/cesium/Workers/{chunk-V3NGATMV.js → chunk-XGI4FRXF.js} +11 -13
- package/dist/assets/cesium/Workers/{chunk-AHKEZ2OE.js → chunk-YFVI4SQI.js} +1 -1
- package/dist/assets/cesium/Workers/{chunk-HARLBUOL.js → chunk-YFYPR4MW.js} +11 -8
- package/dist/assets/cesium/Workers/combineGeometry.js +22 -23
- package/dist/assets/cesium/Workers/createBoxGeometry.js +16 -17
- package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +14 -15
- package/dist/assets/cesium/Workers/createCircleGeometry.js +29 -26
- package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +17 -18
- package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +35 -36
- package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +29 -30
- package/dist/assets/cesium/Workers/createCorridorGeometry.js +29 -30
- package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +27 -28
- package/dist/assets/cesium/Workers/createCylinderGeometry.js +18 -19
- package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +17 -19
- package/dist/assets/cesium/Workers/createEllipseGeometry.js +24 -25
- package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +17 -18
- package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +17 -18
- package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +16 -17
- package/dist/assets/cesium/Workers/createFrustumGeometry.js +16 -17
- package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +18 -18
- package/dist/assets/cesium/Workers/createGeometry.js +52 -33
- package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +28 -29
- package/dist/assets/cesium/Workers/createPlaneGeometry.js +14 -15
- package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +13 -14
- package/dist/assets/cesium/Workers/createPolygonGeometry.js +451 -176
- package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +29 -30
- package/dist/assets/cesium/Workers/createPolylineGeometry.js +24 -25
- package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +31 -33
- package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +27 -29
- package/dist/assets/cesium/Workers/createRectangleGeometry.js +30 -31
- package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +21 -24
- package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +22 -23
- package/dist/assets/cesium/Workers/createSphereGeometry.js +17 -18
- package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +16 -17
- package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +3 -3
- package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +14 -16
- package/dist/assets/cesium/Workers/createVectorTileGeometries.js +22 -23
- package/dist/assets/cesium/Workers/createVectorTilePoints.js +12 -12
- package/dist/assets/cesium/Workers/createVectorTilePolygons.js +20 -21
- package/dist/assets/cesium/Workers/createVectorTilePolylines.js +14 -16
- package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +24 -25
- package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +25 -26
- package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -21
- package/dist/assets/cesium/Workers/createWallGeometry.js +23 -24
- package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +22 -23
- package/dist/assets/cesium/Workers/decodeDraco.js +11 -11
- package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
- package/dist/assets/cesium/Workers/decodeI3S.js +600 -92
- package/dist/assets/cesium/Workers/transcodeKTX2.js +46 -82
- package/dist/assets/cesium/Workers/transferTypedArrayTest.js +1 -1
- package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +21 -22
- package/dist/assets/{cesium.6b12b4.js → cesium.0b750d.js} +151166 -145641
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/{core.074b78.js → core.cbf44a.js} +1944 -1902
- package/dist/assets/core.js +1 -1
- package/dist/assets/index-8eGauqjA.js +1 -0
- package/dist/assets/ol.js +1 -1
- package/dist/assets/ui.7c276c.css +1 -0
- package/dist/assets/{ui.715986.js → ui.7c276c.js} +13826 -12887
- package/dist/assets/ui.js +1 -1
- package/dist/assets/vue.js +1 -1
- package/dist/assets/{vuetify.28d881.js → vuetify.4d18fe.js} +1 -1
- package/dist/assets/vuetify.js +1 -1
- package/dist/index.html +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/package.json +7 -6
- package/plugins/@vcmap-show-case/list-example/src/ListExample.vue +24 -86
- package/plugins/@vcmap-show-case/vector-properties-example/src/VectorPropertiesExample.vue +35 -10
- package/plugins/@vcmap-show-case/wizard-example/src/WizardExample.vue +40 -54
- package/src/application/VcsApp.vue +1 -2
- package/src/application/VcsCustomScreen.vue +4 -4
- package/src/application/VcsCustomScreen.vue.d.ts +1 -1
- package/src/application/VcsNavbar.vue.d.ts +1 -1
- package/src/application/VcsSplashScreen.vue +18 -21
- package/src/application/VcsSplashScreen.vue.d.ts +5 -5
- package/src/application/VcsTextPage.vue +4 -4
- package/src/application/VcsTextPage.vue.d.ts +1 -1
- package/src/application/markdownHelper.js +2 -17
- package/src/components/buttons/VcsButton.vue +1 -1
- package/src/components/buttons/VcsButton.vue.d.ts +3 -3
- package/src/components/buttons/VcsFormButton.vue +1 -1
- package/src/components/buttons/VcsFormButton.vue.d.ts +2 -2
- package/src/components/buttons/VcsToolButton.vue +1 -1
- package/src/components/buttons/VcsToolButton.vue.d.ts +4 -4
- package/src/components/composables.d.ts +7 -0
- package/src/components/composables.js +35 -1
- package/src/components/form-inputs-controls/VcsCheckbox.vue +12 -8
- package/src/components/form-inputs-controls/VcsCheckbox.vue.d.ts +1 -0
- package/src/components/form-inputs-controls/VcsChipArrayInput.vue +1 -1
- package/src/components/form-inputs-controls/VcsDatePicker.vue.d.ts +1 -1
- package/src/components/form-inputs-controls/VcsFileInput.vue +2 -2
- package/src/components/form-inputs-controls/VcsFormSection.vue.d.ts +1 -1
- package/src/components/form-inputs-controls/VcsLabel.vue +31 -1
- package/src/components/form-inputs-controls/VcsLabel.vue.d.ts +21 -1
- package/src/components/form-inputs-controls/VcsRadio.vue +2 -2
- package/src/components/form-inputs-controls/VcsSelect.vue +7 -16
- package/src/components/form-inputs-controls/VcsSelect.vue.d.ts +2 -2
- package/src/components/form-inputs-controls/VcsSlider.vue +36 -10
- package/src/components/form-inputs-controls/VcsSlider.vue.d.ts +25 -2
- package/src/components/form-inputs-controls/VcsTextArea.vue +35 -20
- package/src/components/form-inputs-controls/VcsTextField.vue +17 -12
- package/src/components/form-inputs-controls/VcsTextField.vue.d.ts +1 -0
- package/src/components/form-inputs-controls/VcsWizard.vue +89 -112
- package/src/components/form-inputs-controls/VcsWizard.vue.d.ts +3 -13
- package/src/components/form-inputs-controls/VcsWizardStep.vue +75 -57
- package/src/components/form-inputs-controls/VcsWizardStep.vue.d.ts +24 -11
- package/src/components/form-inputs-controls/vcsTextField.scss +5 -0
- package/src/components/form-output/VcsFormattedNumber.vue +25 -9
- package/src/components/form-output/VcsFormattedNumber.vue.d.ts +18 -0
- package/src/components/form-output/VcsMarkdown.vue +53 -0
- package/src/components/form-output/VcsMarkdown.vue.d.ts +16 -0
- package/src/components/lists/VcsActionList.vue +43 -27
- package/src/components/lists/VcsActionList.vue.d.ts +3 -1
- package/src/components/lists/VcsList.vue +82 -151
- package/src/components/lists/VcsList.vue.d.ts +5 -8
- package/src/components/lists/VcsListItem.vue +154 -0
- package/src/components/lists/VcsListItem.vue.d.ts +21 -0
- package/src/components/lists/VcsTreeviewLeaf.vue +1 -1
- package/src/components/modelHelper.d.ts +11 -0
- package/src/components/modelHelper.js +42 -2
- package/src/components/vector-properties/VcsFeatureEditingWindow.vue +14 -6
- package/src/components/vector-properties/VcsFeatureEditingWindow.vue.d.ts +3 -3
- package/src/components/vector-properties/VcsVectorPropertiesComponent.vue +474 -585
- package/src/components/vector-properties/VcsVectorPropertiesComponent.vue.d.ts +193 -22
- package/src/manager/window/windowManager.d.ts +4 -4
- package/src/manager/window/windowManager.js +2 -2
- package/src/navigation/MapNavigation.vue +6 -3
- package/src/navigation/OrientationToolsButton.vue +39 -26
- package/src/navigation/OrientationToolsButton.vue.d.ts +5 -1
- package/src/navigation/TiltSlider.vue +83 -88
- package/src/navigation/TiltSlider.vue.d.ts +10 -7
- package/src/navigation/VcsCompass.vue +17 -11
- package/src/navigation/VcsCompass.vue.d.ts +2 -0
- package/src/styles/_typography.scss +1 -0
- package/src/vcsUiApp.d.ts +11 -17
- package/src/vcsUiApp.js +10 -3
- package/src/vuePlugins/i18n.js +7 -0
- package/src/vuePlugins/vuetify.js +4 -0
- package/dist/assets/cesium/Workers/chunk-DUHWWBQQ.js +0 -3273
- package/dist/assets/cesium/Workers/chunk-QJ3DFBH3.js +0 -73
- package/dist/assets/index-ca7EmZ3d.js +0 -1
- package/dist/assets/ui.715986.css +0 -1
- package/src/components/vector-properties/composables.d.ts +0 -33
- package/src/components/vector-properties/composables.js +0 -100
- /package/dist/assets/{ol.8b2e3a.js → ol.86e93c.js} +0 -0
- /package/dist/assets/{vue.0f2c53.js → vue.a3cd64.js} +0 -0
- /package/dist/assets/{vuetify.28d881.css → vuetify.4d18fe.css} +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
4
|
-
* Version 1.
|
4
|
+
* Version 1.119.1
|
5
5
|
*
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
7
7
|
*
|
@@ -25,31 +25,54 @@
|
|
25
25
|
|
26
26
|
import {
|
27
27
|
require_draco_decoder_nodejs
|
28
|
-
} from "./chunk-
|
28
|
+
} from "./chunk-H7PSTL64.js";
|
29
|
+
import {
|
30
|
+
Color_default
|
31
|
+
} from "./chunk-IALQGTA2.js";
|
29
32
|
import {
|
30
33
|
createTaskProcessorWorker_default
|
31
|
-
} from "./chunk-
|
34
|
+
} from "./chunk-6DXIYFX3.js";
|
32
35
|
import {
|
33
36
|
WebMercatorProjection_default
|
34
|
-
} from "./chunk-
|
37
|
+
} from "./chunk-AGTH5JMJ.js";
|
35
38
|
import {
|
36
39
|
Cartesian3_default,
|
37
40
|
Cartographic_default,
|
38
41
|
Ellipsoid_default,
|
39
42
|
Matrix3_default
|
40
|
-
} from "./chunk-
|
43
|
+
} from "./chunk-FYYT5EVH.js";
|
41
44
|
import {
|
42
45
|
Math_default
|
43
|
-
} from "./chunk-
|
44
|
-
import
|
45
|
-
|
46
|
+
} from "./chunk-BPY4HDAK.js";
|
47
|
+
import {
|
48
|
+
defaultValue_default
|
49
|
+
} from "./chunk-6DH5PLFD.js";
|
50
|
+
import {
|
51
|
+
Check_default
|
52
|
+
} from "./chunk-VD6G7UPU.js";
|
46
53
|
import {
|
47
54
|
__toESM,
|
48
55
|
defined_default
|
49
|
-
} from "./chunk-
|
56
|
+
} from "./chunk-F7IEM66T.js";
|
50
57
|
|
51
58
|
// packages/engine/Source/Workers/decodeI3S.js
|
52
59
|
var import_draco_decoder_nodejs = __toESM(require_draco_decoder_nodejs(), 1);
|
60
|
+
|
61
|
+
// packages/engine/Source/Core/srgbToLinear.js
|
62
|
+
function srgbToLinear(value) {
|
63
|
+
Check_default.defined("value", value);
|
64
|
+
if (value <= 0.04045) {
|
65
|
+
return value * 0.07739938080495357;
|
66
|
+
}
|
67
|
+
return Math.pow(
|
68
|
+
// eslint-disable-next-line no-loss-of-precision
|
69
|
+
(value + 0.055) * 0.9478672985781991,
|
70
|
+
2.4
|
71
|
+
);
|
72
|
+
}
|
73
|
+
var srgbToLinear_default = srgbToLinear;
|
74
|
+
|
75
|
+
// packages/engine/Source/Workers/decodeI3S.js
|
53
76
|
var draco;
|
54
77
|
function bilinearInterpolate(tx, ty, h00, h10, h01, h11) {
|
55
78
|
const a = h00 * (1 - tx) + h10 * tx;
|
@@ -171,7 +194,317 @@ function cropUVs(vertexCount, uv0s, uvRegions) {
|
|
171
194
|
uv0s[vertexIndex * 2 + 1] += minV;
|
172
195
|
}
|
173
196
|
}
|
174
|
-
function
|
197
|
+
function generateIndexArray(vertexCount, indices, colors, splitGeometryByColorTransparency) {
|
198
|
+
const indexArray = new Uint32Array(vertexCount);
|
199
|
+
const vertexIndexFn = defined_default(indices) ? (vertexIndex) => indices[vertexIndex] : (vertexIndex) => vertexIndex;
|
200
|
+
let transparentVertexOffset = 0;
|
201
|
+
if (splitGeometryByColorTransparency && defined_default(colors)) {
|
202
|
+
const isVertexTransparentFn = (vertexIndex) => colors[vertexIndexFn(vertexIndex) * 4 + 3] < 255;
|
203
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex += 3) {
|
204
|
+
if (!isVertexTransparentFn(vertexIndex) && !isVertexTransparentFn(vertexIndex + 1) && !isVertexTransparentFn(vertexIndex + 2)) {
|
205
|
+
indexArray[transparentVertexOffset++] = vertexIndexFn(vertexIndex);
|
206
|
+
indexArray[transparentVertexOffset++] = vertexIndexFn(vertexIndex + 1);
|
207
|
+
indexArray[transparentVertexOffset++] = vertexIndexFn(vertexIndex + 2);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
if (transparentVertexOffset > 0) {
|
211
|
+
let offset = transparentVertexOffset;
|
212
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex += 3) {
|
213
|
+
if (isVertexTransparentFn(vertexIndex) || isVertexTransparentFn(vertexIndex + 1) || isVertexTransparentFn(vertexIndex + 2)) {
|
214
|
+
indexArray[offset++] = vertexIndexFn(vertexIndex);
|
215
|
+
indexArray[offset++] = vertexIndexFn(vertexIndex + 1);
|
216
|
+
indexArray[offset++] = vertexIndexFn(vertexIndex + 2);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
} else {
|
220
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) {
|
221
|
+
indexArray[vertexIndex] = vertexIndexFn(vertexIndex);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
} else {
|
225
|
+
transparentVertexOffset = vertexCount;
|
226
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) {
|
227
|
+
indexArray[vertexIndex] = vertexIndexFn(vertexIndex);
|
228
|
+
}
|
229
|
+
}
|
230
|
+
return {
|
231
|
+
indexArray,
|
232
|
+
transparentVertexOffset
|
233
|
+
};
|
234
|
+
}
|
235
|
+
function getFeatureHash(symbologyData, outlinesHash, featureIndex) {
|
236
|
+
const featureHash = outlinesHash[featureIndex];
|
237
|
+
if (defined_default(featureHash)) {
|
238
|
+
return featureHash;
|
239
|
+
}
|
240
|
+
const newFeatureHash = outlinesHash[featureIndex] = {
|
241
|
+
positions: {},
|
242
|
+
indices: {},
|
243
|
+
edges: {}
|
244
|
+
};
|
245
|
+
const featureSymbology = defaultValue_default(
|
246
|
+
symbologyData[featureIndex],
|
247
|
+
symbologyData.default
|
248
|
+
);
|
249
|
+
newFeatureHash.hasOutline = defined_default(featureSymbology?.edges);
|
250
|
+
return newFeatureHash;
|
251
|
+
}
|
252
|
+
function addVertexToHash(indexHash, positionHash, vertexIndex, positions) {
|
253
|
+
if (!defined_default(indexHash[vertexIndex])) {
|
254
|
+
const startPositionIndex = vertexIndex * 3;
|
255
|
+
let coordinateHash = positionHash;
|
256
|
+
for (let index = 0; index < 3; index++) {
|
257
|
+
const coordinate = positions[startPositionIndex + index];
|
258
|
+
if (!defined_default(coordinateHash[coordinate])) {
|
259
|
+
coordinateHash[coordinate] = {};
|
260
|
+
}
|
261
|
+
coordinateHash = coordinateHash[coordinate];
|
262
|
+
}
|
263
|
+
if (!defined_default(coordinateHash.index)) {
|
264
|
+
coordinateHash.index = vertexIndex;
|
265
|
+
}
|
266
|
+
indexHash[vertexIndex] = coordinateHash.index;
|
267
|
+
}
|
268
|
+
}
|
269
|
+
function addEdgeToHash(edgeHash, vertexAIndex, vertexBIndex, vertexAIndexUnique, vertexBIndexUnique, normalIndex) {
|
270
|
+
let startVertexIndex;
|
271
|
+
let endVertexIndex;
|
272
|
+
if (vertexAIndexUnique < vertexBIndexUnique) {
|
273
|
+
startVertexIndex = vertexAIndexUnique;
|
274
|
+
endVertexIndex = vertexBIndexUnique;
|
275
|
+
} else {
|
276
|
+
startVertexIndex = vertexBIndexUnique;
|
277
|
+
endVertexIndex = vertexAIndexUnique;
|
278
|
+
}
|
279
|
+
let edgeStart = edgeHash[startVertexIndex];
|
280
|
+
if (!defined_default(edgeStart)) {
|
281
|
+
edgeStart = edgeHash[startVertexIndex] = {};
|
282
|
+
}
|
283
|
+
let edgeEnd = edgeStart[endVertexIndex];
|
284
|
+
if (!defined_default(edgeEnd)) {
|
285
|
+
edgeEnd = edgeStart[endVertexIndex] = {
|
286
|
+
normalsIndex: [],
|
287
|
+
outlines: []
|
288
|
+
};
|
289
|
+
}
|
290
|
+
edgeEnd.normalsIndex.push(normalIndex);
|
291
|
+
if (edgeEnd.outlines.length === 0 || vertexAIndex !== vertexAIndexUnique || vertexBIndex !== vertexBIndexUnique) {
|
292
|
+
edgeEnd.outlines.push(vertexAIndex, vertexBIndex);
|
293
|
+
}
|
294
|
+
}
|
295
|
+
function generateOutlinesHash(symbologyData, featureIndexArray, indexArray, positions) {
|
296
|
+
const outlinesHash = [];
|
297
|
+
for (let i = 0; i < indexArray.length; i += 3) {
|
298
|
+
const featureIndex = defined_default(featureIndexArray) ? featureIndexArray[indexArray[i]] : "default";
|
299
|
+
const featureHash = getFeatureHash(
|
300
|
+
symbologyData,
|
301
|
+
outlinesHash,
|
302
|
+
featureIndex
|
303
|
+
);
|
304
|
+
if (!featureHash.hasOutline) {
|
305
|
+
continue;
|
306
|
+
}
|
307
|
+
const indexHash = featureHash.indices;
|
308
|
+
const positionHash = featureHash.positions;
|
309
|
+
for (let vertex = 0; vertex < 3; vertex++) {
|
310
|
+
const vertexIndex = indexArray[i + vertex];
|
311
|
+
addVertexToHash(indexHash, positionHash, vertexIndex, positions);
|
312
|
+
}
|
313
|
+
const edgeHash = featureHash.edges;
|
314
|
+
for (let vertex = 0; vertex < 3; vertex++) {
|
315
|
+
const vertexIndex = indexArray[i + vertex];
|
316
|
+
const nextVertexIndex = indexArray[i + (vertex + 1) % 3];
|
317
|
+
const uniqueVertexIndex = indexHash[vertexIndex];
|
318
|
+
const uniqueNextVertexIndex = indexHash[nextVertexIndex];
|
319
|
+
addEdgeToHash(
|
320
|
+
edgeHash,
|
321
|
+
vertexIndex,
|
322
|
+
nextVertexIndex,
|
323
|
+
uniqueVertexIndex,
|
324
|
+
uniqueNextVertexIndex,
|
325
|
+
i
|
326
|
+
);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
return outlinesHash;
|
330
|
+
}
|
331
|
+
var calculateFaceNormalA = new Cartesian3_default();
|
332
|
+
var calculateFaceNormalB = new Cartesian3_default();
|
333
|
+
var calculateFaceNormalC = new Cartesian3_default();
|
334
|
+
function calculateFaceNormal(normals, vertexAIndex, indexArray, positions) {
|
335
|
+
const positionAIndex = indexArray[vertexAIndex] * 3;
|
336
|
+
const positionBIndex = indexArray[vertexAIndex + 1] * 3;
|
337
|
+
const positionCIndex = indexArray[vertexAIndex + 2] * 3;
|
338
|
+
Cartesian3_default.fromArray(positions, positionAIndex, calculateFaceNormalA);
|
339
|
+
Cartesian3_default.fromArray(positions, positionBIndex, calculateFaceNormalB);
|
340
|
+
Cartesian3_default.fromArray(positions, positionCIndex, calculateFaceNormalC);
|
341
|
+
Cartesian3_default.subtract(
|
342
|
+
calculateFaceNormalB,
|
343
|
+
calculateFaceNormalA,
|
344
|
+
calculateFaceNormalB
|
345
|
+
);
|
346
|
+
Cartesian3_default.subtract(
|
347
|
+
calculateFaceNormalC,
|
348
|
+
calculateFaceNormalA,
|
349
|
+
calculateFaceNormalC
|
350
|
+
);
|
351
|
+
Cartesian3_default.cross(
|
352
|
+
calculateFaceNormalB,
|
353
|
+
calculateFaceNormalC,
|
354
|
+
calculateFaceNormalA
|
355
|
+
);
|
356
|
+
const magnitude = Cartesian3_default.magnitude(calculateFaceNormalA);
|
357
|
+
if (magnitude !== 0) {
|
358
|
+
Cartesian3_default.divideByScalar(
|
359
|
+
calculateFaceNormalA,
|
360
|
+
magnitude,
|
361
|
+
calculateFaceNormalA
|
362
|
+
);
|
363
|
+
}
|
364
|
+
const normalAIndex = vertexAIndex * 3;
|
365
|
+
const normalBIndex = (vertexAIndex + 1) * 3;
|
366
|
+
const normalCIndex = (vertexAIndex + 2) * 3;
|
367
|
+
Cartesian3_default.pack(calculateFaceNormalA, normals, normalAIndex);
|
368
|
+
Cartesian3_default.pack(calculateFaceNormalA, normals, normalBIndex);
|
369
|
+
Cartesian3_default.pack(calculateFaceNormalA, normals, normalCIndex);
|
370
|
+
}
|
371
|
+
var isEdgeSmoothA = new Cartesian3_default();
|
372
|
+
var isEdgeSmoothB = new Cartesian3_default();
|
373
|
+
function isEdgeSmooth(normals, normalAIndex, normalBIndex) {
|
374
|
+
Cartesian3_default.fromArray(normals, normalAIndex, isEdgeSmoothA);
|
375
|
+
Cartesian3_default.fromArray(normals, normalBIndex, isEdgeSmoothB);
|
376
|
+
const cosine = Cartesian3_default.dot(isEdgeSmoothA, isEdgeSmoothB);
|
377
|
+
const sine = Cartesian3_default.magnitude(
|
378
|
+
Cartesian3_default.cross(isEdgeSmoothA, isEdgeSmoothB, isEdgeSmoothA)
|
379
|
+
);
|
380
|
+
return Math.atan2(sine, cosine) < 0.25;
|
381
|
+
}
|
382
|
+
function addOutlinesForEdge(outlines, edgeData, indexArray, positions, normals) {
|
383
|
+
if (edgeData.normalsIndex.length > 1) {
|
384
|
+
const normalsByIndex = positions.length === normals.length;
|
385
|
+
for (let indexA = 0; indexA < edgeData.normalsIndex.length; indexA++) {
|
386
|
+
const vertexAIndex = edgeData.normalsIndex[indexA];
|
387
|
+
if (!defined_default(normals[vertexAIndex * 3])) {
|
388
|
+
calculateFaceNormal(normals, vertexAIndex, indexArray, positions);
|
389
|
+
}
|
390
|
+
if (indexA === 0) {
|
391
|
+
continue;
|
392
|
+
}
|
393
|
+
for (let indexB = 0; indexB < indexA; indexB++) {
|
394
|
+
const vertexBIndex = edgeData.normalsIndex[indexB];
|
395
|
+
const normalAIndex = normalsByIndex ? indexArray[vertexAIndex] * 3 : vertexAIndex * 3;
|
396
|
+
const normalBIndex = normalsByIndex ? indexArray[vertexBIndex] * 3 : vertexBIndex * 3;
|
397
|
+
if (isEdgeSmooth(normals, normalAIndex, normalBIndex)) {
|
398
|
+
return;
|
399
|
+
}
|
400
|
+
}
|
401
|
+
}
|
402
|
+
}
|
403
|
+
outlines.push(...edgeData.outlines);
|
404
|
+
}
|
405
|
+
function addOutlinesForFeature(outlines, edgeHash, indexArray, positions, normals) {
|
406
|
+
const edgeStartKeys = Object.keys(edgeHash);
|
407
|
+
for (let startIndex = 0; startIndex < edgeStartKeys.length; startIndex++) {
|
408
|
+
const edgeEnds = edgeHash[edgeStartKeys[startIndex]];
|
409
|
+
const edgeEndKeys = Object.keys(edgeEnds);
|
410
|
+
for (let endIndex = 0; endIndex < edgeEndKeys.length; endIndex++) {
|
411
|
+
const edgeData = edgeEnds[edgeEndKeys[endIndex]];
|
412
|
+
addOutlinesForEdge(outlines, edgeData, indexArray, positions, normals);
|
413
|
+
}
|
414
|
+
}
|
415
|
+
}
|
416
|
+
function generateOutlinesFromHash(outlinesHash, indexArray, positions, normals) {
|
417
|
+
const outlines = [];
|
418
|
+
const features = Object.keys(outlinesHash);
|
419
|
+
for (let featureIndex = 0; featureIndex < features.length; featureIndex++) {
|
420
|
+
const edgeHash = outlinesHash[features[featureIndex]].edges;
|
421
|
+
addOutlinesForFeature(outlines, edgeHash, indexArray, positions, normals);
|
422
|
+
}
|
423
|
+
return outlines;
|
424
|
+
}
|
425
|
+
function generateOutlinesIndexArray(symbologyData, featureIndexArray, indexArray, positions, normals) {
|
426
|
+
if (!defined_default(symbologyData) || Object.keys(symbologyData).length === 0) {
|
427
|
+
return void 0;
|
428
|
+
}
|
429
|
+
const outlinesHash = generateOutlinesHash(
|
430
|
+
symbologyData,
|
431
|
+
featureIndexArray,
|
432
|
+
indexArray,
|
433
|
+
positions
|
434
|
+
);
|
435
|
+
if (!defined_default(normals) || indexArray.length * 3 !== normals.length) {
|
436
|
+
normals = [];
|
437
|
+
}
|
438
|
+
const outlines = generateOutlinesFromHash(
|
439
|
+
outlinesHash,
|
440
|
+
indexArray,
|
441
|
+
positions,
|
442
|
+
normals
|
443
|
+
);
|
444
|
+
const outlinesIndexArray = outlines.length > 0 ? new Uint32Array(outlines) : void 0;
|
445
|
+
return outlinesIndexArray;
|
446
|
+
}
|
447
|
+
function convertColorsArray(colors) {
|
448
|
+
const colorsArray = new Float32Array(colors.length);
|
449
|
+
for (let index = 0; index < colors.length; index += 4) {
|
450
|
+
colorsArray[index] = srgbToLinear_default(Color_default.byteToFloat(colors[index]));
|
451
|
+
colorsArray[index + 1] = srgbToLinear_default(Color_default.byteToFloat(colors[index + 1]));
|
452
|
+
colorsArray[index + 2] = srgbToLinear_default(Color_default.byteToFloat(colors[index + 2]));
|
453
|
+
colorsArray[index + 3] = Color_default.byteToFloat(colors[index + 3]);
|
454
|
+
}
|
455
|
+
return colorsArray;
|
456
|
+
}
|
457
|
+
function generateNormals(vertexCount, indices, positions, normals, uv0s, colors, featureIndex) {
|
458
|
+
const result = {
|
459
|
+
normals: void 0,
|
460
|
+
positions: void 0,
|
461
|
+
uv0s: void 0,
|
462
|
+
colors: void 0,
|
463
|
+
featureIndex: void 0,
|
464
|
+
vertexCount: void 0
|
465
|
+
};
|
466
|
+
if (vertexCount === 0 || !defined_default(positions) || positions.length === 0 || defined_default(normals)) {
|
467
|
+
return result;
|
468
|
+
}
|
469
|
+
if (defined_default(indices)) {
|
470
|
+
result.vertexCount = indices.length;
|
471
|
+
result.positions = new Float32Array(indices.length * 3);
|
472
|
+
result.uv0s = defined_default(uv0s) ? new Float32Array(indices.length * 2) : void 0;
|
473
|
+
result.colors = defined_default(colors) ? new Uint8Array(indices.length * 4) : void 0;
|
474
|
+
result.featureIndex = defined_default(featureIndex) ? new Array(indices.length) : void 0;
|
475
|
+
for (let i = 0; i < indices.length; i++) {
|
476
|
+
const index = indices[i];
|
477
|
+
result.positions[i * 3] = positions[index * 3];
|
478
|
+
result.positions[i * 3 + 1] = positions[index * 3 + 1];
|
479
|
+
result.positions[i * 3 + 2] = positions[index * 3 + 2];
|
480
|
+
if (defined_default(result.uv0s)) {
|
481
|
+
result.uv0s[i * 2] = uv0s[index * 2];
|
482
|
+
result.uv0s[i * 2 + 1] = uv0s[index * 2 + 1];
|
483
|
+
}
|
484
|
+
if (defined_default(result.colors)) {
|
485
|
+
result.colors[i * 4] = colors[index * 4];
|
486
|
+
result.colors[i * 4 + 1] = colors[index * 4 + 1];
|
487
|
+
result.colors[i * 4 + 2] = colors[index * 4 + 2];
|
488
|
+
result.colors[i * 4 + 3] = colors[index * 4 + 3];
|
489
|
+
}
|
490
|
+
if (defined_default(result.featureIndex)) {
|
491
|
+
result.featureIndex[i] = featureIndex[index];
|
492
|
+
}
|
493
|
+
}
|
494
|
+
vertexCount = indices.length;
|
495
|
+
positions = result.positions;
|
496
|
+
}
|
497
|
+
indices = new Array(vertexCount);
|
498
|
+
for (let i = 0; i < vertexCount; i++) {
|
499
|
+
indices[i] = i;
|
500
|
+
}
|
501
|
+
result.normals = new Float32Array(indices.length * 3);
|
502
|
+
for (let i = 0; i < indices.length; i += 3) {
|
503
|
+
calculateFaceNormal(result.normals, i, indices, positions);
|
504
|
+
}
|
505
|
+
return result;
|
506
|
+
}
|
507
|
+
function generateGltfBuffer(vertexCount, indices, positions, normals, uv0s, colors, featureIndex, parameters) {
|
175
508
|
if (vertexCount === 0 || !defined_default(positions) || positions.length === 0) {
|
176
509
|
return {
|
177
510
|
buffers: [],
|
@@ -188,22 +521,45 @@ function generateGltfBuffer(vertexCount, indices, positions, normals, uv0s, colo
|
|
188
521
|
const meshes = [];
|
189
522
|
const nodes = [];
|
190
523
|
const nodesInScene = [];
|
524
|
+
const rootExtensions = {};
|
525
|
+
const extensionsUsed = [];
|
191
526
|
if (defined_default(indices)) {
|
192
527
|
vertexCount = indices.length;
|
193
528
|
}
|
194
|
-
const indexArray =
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
for (let newVertexIndex = 0; newVertexIndex < vertexCount; ++newVertexIndex) {
|
201
|
-
indexArray[newVertexIndex] = newVertexIndex;
|
202
|
-
}
|
203
|
-
}
|
529
|
+
const { indexArray, transparentVertexOffset } = generateIndexArray(
|
530
|
+
vertexCount,
|
531
|
+
indices,
|
532
|
+
colors,
|
533
|
+
parameters.splitGeometryByColorTransparency
|
534
|
+
);
|
204
535
|
const indicesBlob = new Blob([indexArray], { type: "application/binary" });
|
205
536
|
const indicesURL = URL.createObjectURL(indicesBlob);
|
206
537
|
const endIndex = vertexCount;
|
538
|
+
const featureIndexArray = parameters.enableFeatures && defined_default(featureIndex) ? new Float32Array(featureIndex.length) : void 0;
|
539
|
+
let featureCount = 0;
|
540
|
+
if (defined_default(featureIndexArray)) {
|
541
|
+
for (let index = 0; index < featureIndex.length; ++index) {
|
542
|
+
featureIndexArray[index] = featureIndex[index];
|
543
|
+
const countByIndex = featureIndex[index] + 1;
|
544
|
+
if (featureCount < countByIndex) {
|
545
|
+
featureCount = countByIndex;
|
546
|
+
}
|
547
|
+
}
|
548
|
+
}
|
549
|
+
let outlinesIndicesURL;
|
550
|
+
const outlinesIndexArray = generateOutlinesIndexArray(
|
551
|
+
parameters.symbologyData,
|
552
|
+
featureIndex,
|
553
|
+
indexArray,
|
554
|
+
positions,
|
555
|
+
normals
|
556
|
+
);
|
557
|
+
if (defined_default(outlinesIndexArray)) {
|
558
|
+
const outlinesIndicesBlob = new Blob([outlinesIndexArray], {
|
559
|
+
type: "application/binary"
|
560
|
+
});
|
561
|
+
outlinesIndicesURL = URL.createObjectURL(outlinesIndicesBlob);
|
562
|
+
}
|
207
563
|
const meshPositions = positions.subarray(0, endIndex * 3);
|
208
564
|
const positionsBlob = new Blob([meshPositions], {
|
209
565
|
type: "application/binary"
|
@@ -237,7 +593,7 @@ function generateGltfBuffer(vertexCount, indices, positions, normals, uv0s, colo
|
|
237
593
|
const uv0Blob = new Blob([meshUv0s], { type: "application/binary" });
|
238
594
|
uv0URL = URL.createObjectURL(uv0Blob);
|
239
595
|
}
|
240
|
-
const meshColorsInBytes = defined_default(colors) ? colors.subarray(0, endIndex * 4) : void 0;
|
596
|
+
const meshColorsInBytes = defined_default(colors) ? convertColorsArray(colors.subarray(0, endIndex * 4)) : void 0;
|
241
597
|
let colorsURL;
|
242
598
|
if (defined_default(meshColorsInBytes)) {
|
243
599
|
const colorsBlob = new Blob([meshColorsInBytes], {
|
@@ -245,127 +601,254 @@ function generateGltfBuffer(vertexCount, indices, positions, normals, uv0s, colo
|
|
245
601
|
});
|
246
602
|
colorsURL = URL.createObjectURL(colorsBlob);
|
247
603
|
}
|
248
|
-
const
|
249
|
-
let
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
604
|
+
const meshFeatureId0 = defined_default(featureIndexArray) ? featureIndexArray.subarray(0, endIndex) : void 0;
|
605
|
+
let featureId0URL;
|
606
|
+
if (defined_default(meshFeatureId0)) {
|
607
|
+
const featureId0Blob = new Blob([meshFeatureId0], {
|
608
|
+
type: "application/binary"
|
609
|
+
});
|
610
|
+
featureId0URL = URL.createObjectURL(featureId0Blob);
|
611
|
+
}
|
612
|
+
const meshPropertyTable0 = defined_default(featureIndexArray) ? new Float32Array(featureCount) : void 0;
|
613
|
+
let propertyTable0URL;
|
614
|
+
if (defined_default(meshPropertyTable0)) {
|
615
|
+
for (let index = 0; index < meshPropertyTable0.length; ++index) {
|
616
|
+
meshPropertyTable0[index] = index;
|
617
|
+
}
|
618
|
+
const propertyTable0Blob = new Blob([meshPropertyTable0], {
|
619
|
+
type: "application/binary"
|
620
|
+
});
|
621
|
+
propertyTable0URL = URL.createObjectURL(propertyTable0Blob);
|
622
|
+
}
|
254
623
|
const attributes = {};
|
255
|
-
|
624
|
+
const extensions = {};
|
625
|
+
attributes.POSITION = accessors.length;
|
256
626
|
buffers.push({
|
257
627
|
uri: positionsURL,
|
258
628
|
byteLength: meshPositions.byteLength
|
259
629
|
});
|
260
630
|
bufferViews.push({
|
261
|
-
buffer:
|
631
|
+
buffer: buffers.length - 1,
|
262
632
|
byteOffset: 0,
|
263
633
|
byteLength: meshPositions.byteLength,
|
264
634
|
target: 34962
|
265
635
|
});
|
266
636
|
accessors.push({
|
267
|
-
bufferView:
|
637
|
+
bufferView: bufferViews.length - 1,
|
268
638
|
byteOffset: 0,
|
269
639
|
componentType: 5126,
|
270
|
-
count:
|
640
|
+
count: meshPositions.length / 3,
|
271
641
|
type: "VEC3",
|
272
642
|
max: [minX, minY, minZ],
|
273
643
|
min: [maxX, maxY, maxZ]
|
274
644
|
});
|
275
645
|
if (defined_default(normalsURL)) {
|
276
|
-
|
277
|
-
normalIndex = currentIndex;
|
278
|
-
attributes.NORMAL = normalIndex;
|
646
|
+
attributes.NORMAL = accessors.length;
|
279
647
|
buffers.push({
|
280
648
|
uri: normalsURL,
|
281
649
|
byteLength: meshNormals.byteLength
|
282
650
|
});
|
283
651
|
bufferViews.push({
|
284
|
-
buffer:
|
652
|
+
buffer: buffers.length - 1,
|
285
653
|
byteOffset: 0,
|
286
654
|
byteLength: meshNormals.byteLength,
|
287
655
|
target: 34962
|
288
656
|
});
|
289
657
|
accessors.push({
|
290
|
-
bufferView:
|
658
|
+
bufferView: bufferViews.length - 1,
|
291
659
|
byteOffset: 0,
|
292
660
|
componentType: 5126,
|
293
|
-
count:
|
661
|
+
count: meshNormals.length / 3,
|
294
662
|
type: "VEC3"
|
295
663
|
});
|
296
664
|
}
|
297
665
|
if (defined_default(uv0URL)) {
|
298
|
-
|
299
|
-
uv0Index = currentIndex;
|
300
|
-
attributes.TEXCOORD_0 = uv0Index;
|
666
|
+
attributes.TEXCOORD_0 = accessors.length;
|
301
667
|
buffers.push({
|
302
668
|
uri: uv0URL,
|
303
669
|
byteLength: meshUv0s.byteLength
|
304
670
|
});
|
305
671
|
bufferViews.push({
|
306
|
-
buffer:
|
672
|
+
buffer: buffers.length - 1,
|
307
673
|
byteOffset: 0,
|
308
674
|
byteLength: meshUv0s.byteLength,
|
309
675
|
target: 34962
|
310
676
|
});
|
311
677
|
accessors.push({
|
312
|
-
bufferView:
|
678
|
+
bufferView: bufferViews.length - 1,
|
313
679
|
byteOffset: 0,
|
314
680
|
componentType: 5126,
|
315
|
-
count:
|
681
|
+
count: meshUv0s.length / 2,
|
316
682
|
type: "VEC2"
|
317
683
|
});
|
318
684
|
}
|
319
685
|
if (defined_default(colorsURL)) {
|
320
|
-
|
321
|
-
colorIndex = currentIndex;
|
322
|
-
attributes.COLOR_0 = colorIndex;
|
686
|
+
attributes.COLOR_0 = accessors.length;
|
323
687
|
buffers.push({
|
324
688
|
uri: colorsURL,
|
325
689
|
byteLength: meshColorsInBytes.byteLength
|
326
690
|
});
|
327
691
|
bufferViews.push({
|
328
|
-
buffer:
|
692
|
+
buffer: buffers.length - 1,
|
329
693
|
byteOffset: 0,
|
330
694
|
byteLength: meshColorsInBytes.byteLength,
|
331
695
|
target: 34962
|
332
696
|
});
|
333
697
|
accessors.push({
|
334
|
-
bufferView:
|
698
|
+
bufferView: bufferViews.length - 1,
|
335
699
|
byteOffset: 0,
|
336
|
-
componentType:
|
337
|
-
|
338
|
-
count: vertexCount,
|
700
|
+
componentType: 5126,
|
701
|
+
count: meshColorsInBytes.length / 4,
|
339
702
|
type: "VEC4"
|
340
703
|
});
|
341
704
|
}
|
342
|
-
|
343
|
-
|
705
|
+
if (defined_default(featureId0URL)) {
|
706
|
+
attributes._FEATURE_ID_0 = accessors.length;
|
707
|
+
buffers.push({
|
708
|
+
uri: featureId0URL,
|
709
|
+
byteLength: meshFeatureId0.byteLength
|
710
|
+
});
|
711
|
+
bufferViews.push({
|
712
|
+
buffer: buffers.length - 1,
|
713
|
+
byteOffset: 0,
|
714
|
+
byteLength: meshFeatureId0.byteLength,
|
715
|
+
target: 34963
|
716
|
+
});
|
717
|
+
accessors.push({
|
718
|
+
bufferView: bufferViews.length - 1,
|
719
|
+
byteOffset: 0,
|
720
|
+
componentType: 5126,
|
721
|
+
count: meshFeatureId0.length,
|
722
|
+
type: "SCALAR"
|
723
|
+
});
|
724
|
+
extensions.EXT_mesh_features = {
|
725
|
+
featureIds: [
|
726
|
+
{
|
727
|
+
attribute: 0,
|
728
|
+
propertyTable: 0,
|
729
|
+
featureCount
|
730
|
+
}
|
731
|
+
]
|
732
|
+
};
|
733
|
+
extensionsUsed.push("EXT_mesh_features");
|
734
|
+
}
|
735
|
+
if (defined_default(propertyTable0URL)) {
|
736
|
+
buffers.push({
|
737
|
+
uri: propertyTable0URL,
|
738
|
+
byteLength: meshPropertyTable0.byteLength
|
739
|
+
});
|
740
|
+
bufferViews.push({
|
741
|
+
buffer: buffers.length - 1,
|
742
|
+
byteOffset: 0,
|
743
|
+
byteLength: meshPropertyTable0.byteLength,
|
744
|
+
target: 34963
|
745
|
+
});
|
746
|
+
rootExtensions.EXT_structural_metadata = {
|
747
|
+
schema: {
|
748
|
+
id: "i3s-metadata-schema-001",
|
749
|
+
name: "I3S metadata schema 001",
|
750
|
+
description: "The schema for I3S metadata",
|
751
|
+
version: "1.0",
|
752
|
+
classes: {
|
753
|
+
feature: {
|
754
|
+
name: "feature",
|
755
|
+
description: "Feature metadata",
|
756
|
+
properties: {
|
757
|
+
index: {
|
758
|
+
description: "The feature index",
|
759
|
+
type: "SCALAR",
|
760
|
+
componentType: "FLOAT32",
|
761
|
+
required: true
|
762
|
+
}
|
763
|
+
}
|
764
|
+
}
|
765
|
+
}
|
766
|
+
},
|
767
|
+
propertyTables: [
|
768
|
+
{
|
769
|
+
name: "feature-indices-mapping",
|
770
|
+
class: "feature",
|
771
|
+
count: featureCount,
|
772
|
+
properties: {
|
773
|
+
index: {
|
774
|
+
values: bufferViews.length - 1
|
775
|
+
}
|
776
|
+
}
|
777
|
+
}
|
778
|
+
]
|
779
|
+
};
|
780
|
+
extensionsUsed.push("EXT_structural_metadata");
|
781
|
+
}
|
782
|
+
if (defined_default(outlinesIndicesURL)) {
|
783
|
+
buffers.push({
|
784
|
+
uri: outlinesIndicesURL,
|
785
|
+
byteLength: outlinesIndexArray.byteLength
|
786
|
+
});
|
787
|
+
bufferViews.push({
|
788
|
+
buffer: buffers.length - 1,
|
789
|
+
byteOffset: 0,
|
790
|
+
byteLength: outlinesIndexArray.byteLength,
|
791
|
+
target: 34963
|
792
|
+
});
|
793
|
+
accessors.push({
|
794
|
+
bufferView: bufferViews.length - 1,
|
795
|
+
byteOffset: 0,
|
796
|
+
componentType: 5125,
|
797
|
+
count: outlinesIndexArray.length,
|
798
|
+
type: "SCALAR"
|
799
|
+
});
|
800
|
+
extensions.CESIUM_primitive_outline = {
|
801
|
+
indices: accessors.length - 1
|
802
|
+
};
|
803
|
+
extensionsUsed.push("CESIUM_primitive_outline");
|
804
|
+
}
|
344
805
|
buffers.push({
|
345
806
|
uri: indicesURL,
|
346
807
|
byteLength: indexArray.byteLength
|
347
808
|
});
|
348
809
|
bufferViews.push({
|
349
|
-
buffer:
|
810
|
+
buffer: buffers.length - 1,
|
350
811
|
byteOffset: 0,
|
351
812
|
byteLength: indexArray.byteLength,
|
352
813
|
target: 34963
|
353
814
|
});
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
815
|
+
const meshPrimitives = [];
|
816
|
+
if (transparentVertexOffset > 0) {
|
817
|
+
accessors.push({
|
818
|
+
bufferView: bufferViews.length - 1,
|
819
|
+
byteOffset: 0,
|
820
|
+
componentType: 5125,
|
821
|
+
count: transparentVertexOffset,
|
822
|
+
type: "SCALAR"
|
823
|
+
});
|
824
|
+
meshPrimitives.push({
|
825
|
+
attributes,
|
826
|
+
indices: accessors.length - 1,
|
827
|
+
material: meshPrimitives.length,
|
828
|
+
extensions
|
829
|
+
});
|
830
|
+
}
|
831
|
+
if (transparentVertexOffset < vertexCount) {
|
832
|
+
accessors.push({
|
833
|
+
bufferView: bufferViews.length - 1,
|
834
|
+
byteOffset: 4 * transparentVertexOffset,
|
835
|
+
// skip 4 bytes for each opaque vertex
|
836
|
+
componentType: 5125,
|
837
|
+
count: vertexCount - transparentVertexOffset,
|
838
|
+
type: "SCALAR"
|
839
|
+
});
|
840
|
+
meshPrimitives.push({
|
841
|
+
attributes,
|
842
|
+
indices: accessors.length - 1,
|
843
|
+
material: meshPrimitives.length,
|
844
|
+
extensions,
|
845
|
+
extra: {
|
846
|
+
isTransparent: true
|
367
847
|
}
|
368
|
-
|
848
|
+
});
|
849
|
+
}
|
850
|
+
meshes.push({
|
851
|
+
primitives: meshPrimitives
|
369
852
|
});
|
370
853
|
nodesInScene.push(0);
|
371
854
|
nodes.push({ mesh: 0 });
|
@@ -375,7 +858,9 @@ function generateGltfBuffer(vertexCount, indices, positions, normals, uv0s, colo
|
|
375
858
|
accessors,
|
376
859
|
meshes,
|
377
860
|
nodes,
|
378
|
-
nodesInScene
|
861
|
+
nodesInScene,
|
862
|
+
rootExtensions,
|
863
|
+
extensionsUsed
|
379
864
|
};
|
380
865
|
}
|
381
866
|
function decode(data, schema, bufferInfo, featureData) {
|
@@ -774,39 +1259,62 @@ function decodeAndCreateGltf(parameters) {
|
|
774
1259
|
geometryData["uv-region"]
|
775
1260
|
);
|
776
1261
|
}
|
777
|
-
|
778
|
-
geometryData.vertexCount,
|
779
|
-
geometryData.indices,
|
780
|
-
geometryData.positions,
|
781
|
-
geometryData.normals,
|
782
|
-
geometryData.uv0s,
|
783
|
-
geometryData.colors
|
784
|
-
);
|
785
|
-
const customAttributes = {};
|
1262
|
+
let featureIndex;
|
786
1263
|
if (defined_default(geometryData["feature-index"])) {
|
787
|
-
|
788
|
-
customAttributes.indices = geometryData.indices;
|
789
|
-
customAttributes.featureIndex = geometryData["feature-index"];
|
790
|
-
customAttributes.cartesianCenter = parameters.cartesianCenter;
|
791
|
-
customAttributes.parentRotation = parameters.parentRotation;
|
1264
|
+
featureIndex = geometryData["feature-index"];
|
792
1265
|
} else if (defined_default(geometryData["faceRange"])) {
|
793
|
-
|
794
|
-
customAttributes.indices = geometryData.indices;
|
795
|
-
customAttributes.sourceURL = parameters.url;
|
796
|
-
customAttributes.cartesianCenter = parameters.cartesianCenter;
|
797
|
-
customAttributes.parentRotation = parameters.parentRotation;
|
798
|
-
customAttributes.featureIndex = new Array(geometryData.positions.length);
|
1266
|
+
featureIndex = new Array(geometryData.vertexCount);
|
799
1267
|
for (let range = 0; range < geometryData["faceRange"].length - 1; range += 2) {
|
800
1268
|
const curIndex = range / 2;
|
801
1269
|
const rangeStart = geometryData["faceRange"][range];
|
802
1270
|
const rangeEnd = geometryData["faceRange"][range + 1];
|
803
1271
|
for (let i = rangeStart; i <= rangeEnd; i++) {
|
804
|
-
|
805
|
-
|
806
|
-
|
1272
|
+
featureIndex[i * 3] = curIndex;
|
1273
|
+
featureIndex[i * 3 + 1] = curIndex;
|
1274
|
+
featureIndex[i * 3 + 2] = curIndex;
|
1275
|
+
}
|
1276
|
+
}
|
1277
|
+
}
|
1278
|
+
if (parameters.calculateNormals) {
|
1279
|
+
const data = generateNormals(
|
1280
|
+
geometryData.vertexCount,
|
1281
|
+
geometryData.indices,
|
1282
|
+
geometryData.positions,
|
1283
|
+
geometryData.normals,
|
1284
|
+
geometryData.uv0s,
|
1285
|
+
geometryData.colors,
|
1286
|
+
featureIndex
|
1287
|
+
);
|
1288
|
+
if (defined_default(data.normals)) {
|
1289
|
+
geometryData.normals = data.normals;
|
1290
|
+
if (defined_default(data.vertexCount)) {
|
1291
|
+
geometryData.vertexCount = data.vertexCount;
|
1292
|
+
geometryData.indices = data.indices;
|
1293
|
+
geometryData.positions = data.positions;
|
1294
|
+
geometryData.uv0s = data.uv0s;
|
1295
|
+
geometryData.colors = data.colors;
|
1296
|
+
featureIndex = data.featureIndex;
|
807
1297
|
}
|
808
1298
|
}
|
809
1299
|
}
|
1300
|
+
const meshData = generateGltfBuffer(
|
1301
|
+
geometryData.vertexCount,
|
1302
|
+
geometryData.indices,
|
1303
|
+
geometryData.positions,
|
1304
|
+
geometryData.normals,
|
1305
|
+
geometryData.uv0s,
|
1306
|
+
geometryData.colors,
|
1307
|
+
featureIndex,
|
1308
|
+
parameters
|
1309
|
+
);
|
1310
|
+
const customAttributes = {
|
1311
|
+
positions: geometryData.positions,
|
1312
|
+
indices: geometryData.indices,
|
1313
|
+
featureIndex,
|
1314
|
+
sourceURL: parameters.url,
|
1315
|
+
cartesianCenter: parameters.cartesianCenter,
|
1316
|
+
parentRotation: parameters.parentRotation
|
1317
|
+
};
|
810
1318
|
meshData._customAttributes = customAttributes;
|
811
1319
|
const results = {
|
812
1320
|
meshData
|