@loaders.gl/terrain 4.0.0-alpha.4 → 4.0.0-alpha.6
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/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +1175 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/index.js +87 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/decode-quantized-mesh.js +250 -0
- package/dist/es5/lib/decode-quantized-mesh.js.map +1 -0
- package/dist/es5/lib/delatin/index.js +408 -0
- package/dist/es5/lib/delatin/index.js.map +1 -0
- package/dist/es5/lib/helpers/skirt.js +105 -0
- package/dist/es5/lib/helpers/skirt.js.map +1 -0
- package/dist/es5/lib/parse-quantized-mesh.js +95 -0
- package/dist/es5/lib/parse-quantized-mesh.js.map +1 -0
- package/dist/es5/lib/parse-terrain.js +152 -0
- package/dist/es5/lib/parse-terrain.js.map +1 -0
- package/dist/es5/lib/utils/version.js +9 -0
- package/dist/es5/lib/utils/version.js.map +1 -0
- package/dist/es5/quantized-mesh-loader.js +24 -0
- package/dist/es5/quantized-mesh-loader.js.map +1 -0
- package/dist/es5/terrain-loader.js +32 -0
- package/dist/es5/terrain-loader.js.map +1 -0
- package/dist/es5/workers/quantized-mesh-worker.js +6 -0
- package/dist/es5/workers/quantized-mesh-worker.js.map +1 -0
- package/dist/es5/workers/terrain-worker.js +6 -0
- package/dist/es5/workers/terrain-worker.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/index.js +32 -0
- package/dist/esm/index.js.map +1 -0
- package/{src → dist/esm}/lib/decode-quantized-mesh.js +76 -165
- package/dist/esm/lib/decode-quantized-mesh.js.map +1 -0
- package/dist/esm/lib/delatin/index.js +355 -0
- package/dist/esm/lib/delatin/index.js.map +1 -0
- package/dist/esm/lib/helpers/skirt.js +89 -0
- package/dist/esm/lib/helpers/skirt.js.map +1 -0
- package/dist/esm/lib/parse-quantized-mesh.js +85 -0
- package/dist/esm/lib/parse-quantized-mesh.js.map +1 -0
- package/{src → dist/esm}/lib/parse-terrain.js +101 -129
- package/dist/esm/lib/parse-terrain.js.map +1 -0
- package/dist/esm/lib/utils/version.js +2 -0
- package/dist/esm/lib/utils/version.js.map +1 -0
- package/dist/esm/quantized-mesh-loader.js +17 -0
- package/dist/esm/quantized-mesh-loader.js.map +1 -0
- package/dist/esm/terrain-loader.js +25 -0
- package/dist/esm/terrain-loader.js.map +1 -0
- package/dist/esm/workers/quantized-mesh-worker.js +4 -0
- package/dist/esm/workers/quantized-mesh-worker.js.map +1 -0
- package/dist/esm/workers/terrain-worker.js +4 -0
- package/dist/esm/workers/terrain-worker.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -14
- package/dist/lib/decode-quantized-mesh.d.ts +59 -0
- package/dist/lib/decode-quantized-mesh.d.ts.map +1 -0
- package/dist/lib/decode-quantized-mesh.js +200 -241
- package/dist/lib/delatin/index.d.ts +24 -0
- package/dist/lib/delatin/index.d.ts.map +1 -0
- package/dist/lib/delatin/index.js +397 -443
- package/dist/lib/helpers/skirt.d.ts +19 -0
- package/dist/lib/helpers/skirt.d.ts.map +1 -0
- package/dist/lib/helpers/skirt.js +119 -91
- package/dist/lib/parse-quantized-mesh.d.ts +7 -0
- package/dist/lib/parse-quantized-mesh.d.ts.map +1 -0
- package/dist/lib/parse-quantized-mesh.js +94 -93
- package/dist/lib/parse-terrain.d.ts +51 -0
- package/dist/lib/parse-terrain.d.ts.map +1 -0
- package/dist/lib/parse-terrain.js +146 -172
- package/dist/lib/utils/version.d.ts +2 -0
- package/dist/lib/utils/version.d.ts.map +1 -0
- package/dist/lib/utils/version.js +7 -2
- package/dist/quantized-mesh-loader.d.ts +12 -0
- package/dist/quantized-mesh-loader.d.ts.map +1 -0
- package/dist/quantized-mesh-loader.js +20 -16
- package/dist/quantized-mesh-worker.js +148 -119
- package/dist/terrain-loader.d.ts +12 -0
- package/dist/terrain-loader.d.ts.map +1 -0
- package/dist/terrain-loader.js +28 -24
- package/dist/terrain-worker.js +148 -119
- package/dist/workers/quantized-mesh-worker.d.ts +2 -0
- package/dist/workers/quantized-mesh-worker.d.ts.map +1 -0
- package/dist/workers/quantized-mesh-worker.js +5 -4
- package/dist/workers/terrain-worker.d.ts +2 -0
- package/dist/workers/terrain-worker.d.ts.map +1 -0
- package/dist/workers/terrain-worker.js +5 -4
- package/package.json +11 -10
- package/src/index.ts +29 -13
- package/src/lib/helpers/skirt.ts +7 -7
- package/src/lib/parse-quantized-mesh.ts +47 -43
- package/src/lib/parse-terrain.ts +84 -89
- package/src/quantized-mesh-loader.ts +9 -4
- package/src/terrain-loader.ts +14 -11
- package/dist/bundle.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/decode-quantized-mesh.js.map +0 -1
- package/dist/lib/delatin/index.js.map +0 -1
- package/dist/lib/helpers/skirt.js.map +0 -1
- package/dist/lib/parse-quantized-mesh.js.map +0 -1
- package/dist/lib/parse-terrain.js.map +0 -1
- package/dist/lib/utils/version.js.map +0 -1
- package/dist/quantized-mesh-loader.js.map +0 -1
- package/dist/terrain-loader.js.map +0 -1
- package/dist/workers/quantized-mesh-worker.js.map +0 -1
- package/dist/workers/terrain-worker.js.map +0 -1
- package/src/lib/helpers/skirt.js +0 -161
- package/src/lib/parse-quantized-mesh.js +0 -98
- package/src/workers/quantized-mesh-worker.js +0 -4
- package/src/workers/terrain-worker.js +0 -4
- /package/src/lib/delatin/{index.js → index.ts} +0 -0
- /package/src/lib/utils/{version.js → version.ts} +0 -0
|
@@ -1,194 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
// SOFTWARE.
|
|
20
|
-
|
|
21
|
-
const QUANTIZED_MESH_HEADER = new Map([
|
|
22
|
-
['centerX', Float64Array.BYTES_PER_ELEMENT],
|
|
23
|
-
['centerY', Float64Array.BYTES_PER_ELEMENT],
|
|
24
|
-
['centerZ', Float64Array.BYTES_PER_ELEMENT],
|
|
25
|
-
|
|
26
|
-
['minHeight', Float32Array.BYTES_PER_ELEMENT],
|
|
27
|
-
['maxHeight', Float32Array.BYTES_PER_ELEMENT],
|
|
28
|
-
|
|
29
|
-
['boundingSphereCenterX', Float64Array.BYTES_PER_ELEMENT],
|
|
30
|
-
['boundingSphereCenterY', Float64Array.BYTES_PER_ELEMENT],
|
|
31
|
-
['boundingSphereCenterZ', Float64Array.BYTES_PER_ELEMENT],
|
|
32
|
-
['boundingSphereRadius', Float64Array.BYTES_PER_ELEMENT],
|
|
33
|
-
|
|
34
|
-
['horizonOcclusionPointX', Float64Array.BYTES_PER_ELEMENT],
|
|
35
|
-
['horizonOcclusionPointY', Float64Array.BYTES_PER_ELEMENT],
|
|
36
|
-
['horizonOcclusionPointZ', Float64Array.BYTES_PER_ELEMENT]
|
|
37
|
-
]);
|
|
38
|
-
|
|
1
|
+
const QUANTIZED_MESH_HEADER = new Map([['centerX', Float64Array.BYTES_PER_ELEMENT], ['centerY', Float64Array.BYTES_PER_ELEMENT], ['centerZ', Float64Array.BYTES_PER_ELEMENT], ['minHeight', Float32Array.BYTES_PER_ELEMENT], ['maxHeight', Float32Array.BYTES_PER_ELEMENT], ['boundingSphereCenterX', Float64Array.BYTES_PER_ELEMENT], ['boundingSphereCenterY', Float64Array.BYTES_PER_ELEMENT], ['boundingSphereCenterZ', Float64Array.BYTES_PER_ELEMENT], ['boundingSphereRadius', Float64Array.BYTES_PER_ELEMENT], ['horizonOcclusionPointX', Float64Array.BYTES_PER_ELEMENT], ['horizonOcclusionPointY', Float64Array.BYTES_PER_ELEMENT], ['horizonOcclusionPointZ', Float64Array.BYTES_PER_ELEMENT]]);
|
|
39
2
|
function decodeZigZag(value) {
|
|
40
|
-
return
|
|
3
|
+
return value >> 1 ^ -(value & 1);
|
|
41
4
|
}
|
|
42
|
-
|
|
43
5
|
function decodeHeader(dataView) {
|
|
44
6
|
let position = 0;
|
|
45
7
|
const header = {};
|
|
46
|
-
|
|
47
8
|
for (const [key, bytesCount] of QUANTIZED_MESH_HEADER) {
|
|
48
9
|
const getter = bytesCount === 8 ? dataView.getFloat64 : dataView.getFloat32;
|
|
49
|
-
|
|
50
10
|
header[key] = getter.call(dataView, position, true);
|
|
51
11
|
position += bytesCount;
|
|
52
12
|
}
|
|
53
|
-
|
|
54
|
-
|
|
13
|
+
return {
|
|
14
|
+
header,
|
|
15
|
+
headerEndPosition: position
|
|
16
|
+
};
|
|
55
17
|
}
|
|
56
|
-
|
|
57
18
|
function decodeVertexData(dataView, headerEndPosition) {
|
|
58
19
|
let position = headerEndPosition;
|
|
59
20
|
const elementsPerVertex = 3;
|
|
60
21
|
const vertexCount = dataView.getUint32(position, true);
|
|
61
22
|
const vertexData = new Uint16Array(vertexCount * elementsPerVertex);
|
|
62
|
-
|
|
63
23
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
64
|
-
|
|
65
24
|
const bytesPerArrayElement = Uint16Array.BYTES_PER_ELEMENT;
|
|
66
25
|
const elementArrayLength = vertexCount * bytesPerArrayElement;
|
|
67
26
|
const uArrayStartPosition = position;
|
|
68
27
|
const vArrayStartPosition = uArrayStartPosition + elementArrayLength;
|
|
69
28
|
const heightArrayStartPosition = vArrayStartPosition + elementArrayLength;
|
|
70
|
-
|
|
71
29
|
let u = 0;
|
|
72
30
|
let v = 0;
|
|
73
31
|
let height = 0;
|
|
74
|
-
|
|
75
32
|
for (let i = 0; i < vertexCount; i++) {
|
|
76
33
|
u += decodeZigZag(dataView.getUint16(uArrayStartPosition + bytesPerArrayElement * i, true));
|
|
77
34
|
v += decodeZigZag(dataView.getUint16(vArrayStartPosition + bytesPerArrayElement * i, true));
|
|
78
|
-
height += decodeZigZag(
|
|
79
|
-
dataView.getUint16(heightArrayStartPosition + bytesPerArrayElement * i, true)
|
|
80
|
-
);
|
|
81
|
-
|
|
35
|
+
height += decodeZigZag(dataView.getUint16(heightArrayStartPosition + bytesPerArrayElement * i, true));
|
|
82
36
|
vertexData[i] = u;
|
|
83
37
|
vertexData[i + vertexCount] = v;
|
|
84
38
|
vertexData[i + vertexCount * 2] = height;
|
|
85
39
|
}
|
|
86
|
-
|
|
87
40
|
position += elementArrayLength * 3;
|
|
88
|
-
|
|
89
|
-
|
|
41
|
+
return {
|
|
42
|
+
vertexData,
|
|
43
|
+
vertexDataEndPosition: position
|
|
44
|
+
};
|
|
90
45
|
}
|
|
91
|
-
|
|
92
|
-
|
|
46
|
+
function decodeIndex(buffer, position, indicesCount, bytesPerIndex) {
|
|
47
|
+
let encoded = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
93
48
|
let indices;
|
|
94
|
-
|
|
95
49
|
if (bytesPerIndex === 2) {
|
|
96
50
|
indices = new Uint16Array(buffer, position, indicesCount);
|
|
97
51
|
} else {
|
|
98
52
|
indices = new Uint32Array(buffer, position, indicesCount);
|
|
99
53
|
}
|
|
100
|
-
|
|
101
54
|
if (!encoded) {
|
|
102
55
|
return indices;
|
|
103
56
|
}
|
|
104
|
-
|
|
105
57
|
let highest = 0;
|
|
106
|
-
|
|
107
58
|
for (let i = 0; i < indices.length; ++i) {
|
|
108
59
|
const code = indices[i];
|
|
109
|
-
|
|
110
60
|
indices[i] = highest - code;
|
|
111
|
-
|
|
112
61
|
if (code === 0) {
|
|
113
62
|
++highest;
|
|
114
63
|
}
|
|
115
64
|
}
|
|
116
|
-
|
|
117
65
|
return indices;
|
|
118
66
|
}
|
|
119
|
-
|
|
120
67
|
function decodeTriangleIndices(dataView, vertexData, vertexDataEndPosition) {
|
|
121
68
|
let position = vertexDataEndPosition;
|
|
122
69
|
const elementsPerVertex = 3;
|
|
123
70
|
const vertexCount = vertexData.length / elementsPerVertex;
|
|
124
|
-
const bytesPerIndex =
|
|
125
|
-
vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;
|
|
126
|
-
|
|
71
|
+
const bytesPerIndex = vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;
|
|
127
72
|
if (position % bytesPerIndex !== 0) {
|
|
128
|
-
position += bytesPerIndex -
|
|
73
|
+
position += bytesPerIndex - position % bytesPerIndex;
|
|
129
74
|
}
|
|
130
|
-
|
|
131
75
|
const triangleCount = dataView.getUint32(position, true);
|
|
132
76
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
133
|
-
|
|
134
77
|
const triangleIndicesCount = triangleCount * 3;
|
|
135
|
-
const triangleIndices = decodeIndex(
|
|
136
|
-
dataView.buffer,
|
|
137
|
-
position,
|
|
138
|
-
triangleIndicesCount,
|
|
139
|
-
bytesPerIndex
|
|
140
|
-
);
|
|
78
|
+
const triangleIndices = decodeIndex(dataView.buffer, position, triangleIndicesCount, bytesPerIndex);
|
|
141
79
|
position += triangleIndicesCount * bytesPerIndex;
|
|
142
|
-
|
|
143
80
|
return {
|
|
144
81
|
triangleIndicesEndPosition: position,
|
|
145
82
|
triangleIndices
|
|
146
83
|
};
|
|
147
84
|
}
|
|
148
|
-
|
|
149
85
|
function decodeEdgeIndices(dataView, vertexData, triangleIndicesEndPosition) {
|
|
150
86
|
let position = triangleIndicesEndPosition;
|
|
151
87
|
const elementsPerVertex = 3;
|
|
152
88
|
const vertexCount = vertexData.length / elementsPerVertex;
|
|
153
|
-
const bytesPerIndex =
|
|
154
|
-
vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;
|
|
155
|
-
|
|
89
|
+
const bytesPerIndex = vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;
|
|
156
90
|
const westVertexCount = dataView.getUint32(position, true);
|
|
157
91
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
158
|
-
|
|
159
92
|
const westIndices = decodeIndex(dataView.buffer, position, westVertexCount, bytesPerIndex, false);
|
|
160
93
|
position += westVertexCount * bytesPerIndex;
|
|
161
|
-
|
|
162
94
|
const southVertexCount = dataView.getUint32(position, true);
|
|
163
95
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
164
|
-
|
|
165
|
-
const southIndices = decodeIndex(
|
|
166
|
-
dataView.buffer,
|
|
167
|
-
position,
|
|
168
|
-
southVertexCount,
|
|
169
|
-
bytesPerIndex,
|
|
170
|
-
false
|
|
171
|
-
);
|
|
96
|
+
const southIndices = decodeIndex(dataView.buffer, position, southVertexCount, bytesPerIndex, false);
|
|
172
97
|
position += southVertexCount * bytesPerIndex;
|
|
173
|
-
|
|
174
98
|
const eastVertexCount = dataView.getUint32(position, true);
|
|
175
99
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
176
|
-
|
|
177
100
|
const eastIndices = decodeIndex(dataView.buffer, position, eastVertexCount, bytesPerIndex, false);
|
|
178
101
|
position += eastVertexCount * bytesPerIndex;
|
|
179
|
-
|
|
180
102
|
const northVertexCount = dataView.getUint32(position, true);
|
|
181
103
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
182
|
-
|
|
183
|
-
const northIndices = decodeIndex(
|
|
184
|
-
dataView.buffer,
|
|
185
|
-
position,
|
|
186
|
-
northVertexCount,
|
|
187
|
-
bytesPerIndex,
|
|
188
|
-
false
|
|
189
|
-
);
|
|
104
|
+
const northIndices = decodeIndex(dataView.buffer, position, northVertexCount, bytesPerIndex, false);
|
|
190
105
|
position += northVertexCount * bytesPerIndex;
|
|
191
|
-
|
|
192
106
|
return {
|
|
193
107
|
edgeIndicesEndPosition: position,
|
|
194
108
|
westIndices,
|
|
@@ -197,62 +111,48 @@ function decodeEdgeIndices(dataView, vertexData, triangleIndicesEndPosition) {
|
|
|
197
111
|
northIndices
|
|
198
112
|
};
|
|
199
113
|
}
|
|
200
|
-
|
|
201
114
|
function decodeVertexNormalsExtension(extensionDataView) {
|
|
202
|
-
return new Uint8Array(
|
|
203
|
-
extensionDataView.buffer,
|
|
204
|
-
extensionDataView.byteOffset,
|
|
205
|
-
extensionDataView.byteLength
|
|
206
|
-
);
|
|
115
|
+
return new Uint8Array(extensionDataView.buffer, extensionDataView.byteOffset, extensionDataView.byteLength);
|
|
207
116
|
}
|
|
208
|
-
|
|
209
117
|
function decodeWaterMaskExtension(extensionDataView) {
|
|
210
|
-
return extensionDataView.buffer.slice(
|
|
211
|
-
extensionDataView.byteOffset,
|
|
212
|
-
extensionDataView.byteOffset + extensionDataView.byteLength
|
|
213
|
-
);
|
|
118
|
+
return extensionDataView.buffer.slice(extensionDataView.byteOffset, extensionDataView.byteOffset + extensionDataView.byteLength);
|
|
214
119
|
}
|
|
215
|
-
|
|
216
120
|
function decodeExtensions(dataView, indicesEndPosition) {
|
|
217
121
|
const extensions = {};
|
|
218
|
-
|
|
219
122
|
if (dataView.byteLength <= indicesEndPosition) {
|
|
220
|
-
return {
|
|
123
|
+
return {
|
|
124
|
+
extensions,
|
|
125
|
+
extensionsEndPosition: indicesEndPosition
|
|
126
|
+
};
|
|
221
127
|
}
|
|
222
|
-
|
|
223
128
|
let position = indicesEndPosition;
|
|
224
|
-
|
|
225
129
|
while (position < dataView.byteLength) {
|
|
226
130
|
const extensionId = dataView.getUint8(position, true);
|
|
227
131
|
position += Uint8Array.BYTES_PER_ELEMENT;
|
|
228
|
-
|
|
229
132
|
const extensionLength = dataView.getUint32(position, true);
|
|
230
133
|
position += Uint32Array.BYTES_PER_ELEMENT;
|
|
231
|
-
|
|
232
134
|
const extensionView = new DataView(dataView.buffer, position, extensionLength);
|
|
233
|
-
|
|
234
135
|
switch (extensionId) {
|
|
235
|
-
case 1:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
case 2:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
default:
|
|
246
|
-
|
|
247
|
-
}
|
|
136
|
+
case 1:
|
|
137
|
+
{
|
|
138
|
+
extensions.vertexNormals = decodeVertexNormalsExtension(extensionView);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case 2:
|
|
142
|
+
{
|
|
143
|
+
extensions.waterMask = decodeWaterMaskExtension(extensionView);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
default:
|
|
147
|
+
{}
|
|
248
148
|
}
|
|
249
|
-
|
|
250
149
|
position += extensionLength;
|
|
251
150
|
}
|
|
252
|
-
|
|
253
|
-
|
|
151
|
+
return {
|
|
152
|
+
extensions,
|
|
153
|
+
extensionsEndPosition: position
|
|
154
|
+
};
|
|
254
155
|
}
|
|
255
|
-
|
|
256
156
|
export const DECODING_STEPS = {
|
|
257
157
|
header: 0,
|
|
258
158
|
vertices: 1,
|
|
@@ -260,39 +160,49 @@ export const DECODING_STEPS = {
|
|
|
260
160
|
edgeIndices: 3,
|
|
261
161
|
extensions: 4
|
|
262
162
|
};
|
|
263
|
-
|
|
264
163
|
const DEFAULT_OPTIONS = {
|
|
265
164
|
maxDecodingStep: DECODING_STEPS.extensions
|
|
266
165
|
};
|
|
267
|
-
|
|
268
166
|
export default function decode(data, userOptions) {
|
|
269
167
|
const options = Object.assign({}, DEFAULT_OPTIONS, userOptions);
|
|
270
168
|
const view = new DataView(data);
|
|
271
|
-
const {
|
|
272
|
-
|
|
169
|
+
const {
|
|
170
|
+
header,
|
|
171
|
+
headerEndPosition
|
|
172
|
+
} = decodeHeader(view);
|
|
273
173
|
if (options.maxDecodingStep < DECODING_STEPS.vertices) {
|
|
274
|
-
return {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const {vertexData, vertexDataEndPosition} = decodeVertexData(view, headerEndPosition);
|
|
278
|
-
|
|
279
|
-
if (options.maxDecodingStep < DECODING_STEPS.triangleIndices) {
|
|
280
|
-
return {header, vertexData};
|
|
174
|
+
return {
|
|
175
|
+
header
|
|
176
|
+
};
|
|
281
177
|
}
|
|
282
|
-
|
|
283
|
-
const {triangleIndices, triangleIndicesEndPosition} = decodeTriangleIndices(
|
|
284
|
-
view,
|
|
178
|
+
const {
|
|
285
179
|
vertexData,
|
|
286
180
|
vertexDataEndPosition
|
|
287
|
-
);
|
|
288
|
-
|
|
181
|
+
} = decodeVertexData(view, headerEndPosition);
|
|
182
|
+
if (options.maxDecodingStep < DECODING_STEPS.triangleIndices) {
|
|
183
|
+
return {
|
|
184
|
+
header,
|
|
185
|
+
vertexData
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const {
|
|
189
|
+
triangleIndices,
|
|
190
|
+
triangleIndicesEndPosition
|
|
191
|
+
} = decodeTriangleIndices(view, vertexData, vertexDataEndPosition);
|
|
289
192
|
if (options.maxDecodingStep < DECODING_STEPS.edgeIndices) {
|
|
290
|
-
return {
|
|
193
|
+
return {
|
|
194
|
+
header,
|
|
195
|
+
vertexData,
|
|
196
|
+
triangleIndices
|
|
197
|
+
};
|
|
291
198
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
199
|
+
const {
|
|
200
|
+
westIndices,
|
|
201
|
+
southIndices,
|
|
202
|
+
eastIndices,
|
|
203
|
+
northIndices,
|
|
204
|
+
edgeIndicesEndPosition
|
|
205
|
+
} = decodeEdgeIndices(view, vertexData, triangleIndicesEndPosition);
|
|
296
206
|
if (options.maxDecodingStep < DECODING_STEPS.extensions) {
|
|
297
207
|
return {
|
|
298
208
|
header,
|
|
@@ -304,9 +214,9 @@ export default function decode(data, userOptions) {
|
|
|
304
214
|
southIndices
|
|
305
215
|
};
|
|
306
216
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
217
|
+
const {
|
|
218
|
+
extensions
|
|
219
|
+
} = decodeExtensions(view, edgeIndicesEndPosition);
|
|
310
220
|
return {
|
|
311
221
|
header,
|
|
312
222
|
vertexData,
|
|
@@ -318,3 +228,4 @@ export default function decode(data, userOptions) {
|
|
|
318
228
|
extensions
|
|
319
229
|
};
|
|
320
230
|
}
|
|
231
|
+
//# sourceMappingURL=decode-quantized-mesh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-quantized-mesh.js","names":["QUANTIZED_MESH_HEADER","Map","Float64Array","BYTES_PER_ELEMENT","Float32Array","decodeZigZag","value","decodeHeader","dataView","position","header","key","bytesCount","getter","getFloat64","getFloat32","call","headerEndPosition","decodeVertexData","elementsPerVertex","vertexCount","getUint32","vertexData","Uint16Array","Uint32Array","bytesPerArrayElement","elementArrayLength","uArrayStartPosition","vArrayStartPosition","heightArrayStartPosition","u","v","height","i","getUint16","vertexDataEndPosition","decodeIndex","buffer","indicesCount","bytesPerIndex","encoded","arguments","length","undefined","indices","highest","code","decodeTriangleIndices","triangleCount","triangleIndicesCount","triangleIndices","triangleIndicesEndPosition","decodeEdgeIndices","westVertexCount","westIndices","southVertexCount","southIndices","eastVertexCount","eastIndices","northVertexCount","northIndices","edgeIndicesEndPosition","decodeVertexNormalsExtension","extensionDataView","Uint8Array","byteOffset","byteLength","decodeWaterMaskExtension","slice","decodeExtensions","indicesEndPosition","extensions","extensionsEndPosition","extensionId","getUint8","extensionLength","extensionView","DataView","vertexNormals","waterMask","DECODING_STEPS","vertices","edgeIndices","DEFAULT_OPTIONS","maxDecodingStep","decode","data","userOptions","options","Object","assign","view"],"sources":["../../../src/lib/decode-quantized-mesh.ts"],"sourcesContent":["// Copyright (C) 2018-2019 HERE Europe B.V.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nconst QUANTIZED_MESH_HEADER = new Map([\n ['centerX', Float64Array.BYTES_PER_ELEMENT],\n ['centerY', Float64Array.BYTES_PER_ELEMENT],\n ['centerZ', Float64Array.BYTES_PER_ELEMENT],\n\n ['minHeight', Float32Array.BYTES_PER_ELEMENT],\n ['maxHeight', Float32Array.BYTES_PER_ELEMENT],\n\n ['boundingSphereCenterX', Float64Array.BYTES_PER_ELEMENT],\n ['boundingSphereCenterY', Float64Array.BYTES_PER_ELEMENT],\n ['boundingSphereCenterZ', Float64Array.BYTES_PER_ELEMENT],\n ['boundingSphereRadius', Float64Array.BYTES_PER_ELEMENT],\n\n ['horizonOcclusionPointX', Float64Array.BYTES_PER_ELEMENT],\n ['horizonOcclusionPointY', Float64Array.BYTES_PER_ELEMENT],\n ['horizonOcclusionPointZ', Float64Array.BYTES_PER_ELEMENT]\n]);\n\nfunction decodeZigZag(value) {\n return (value >> 1) ^ -(value & 1);\n}\n\nfunction decodeHeader(dataView) {\n let position = 0;\n const header = {};\n\n for (const [key, bytesCount] of QUANTIZED_MESH_HEADER) {\n const getter = bytesCount === 8 ? dataView.getFloat64 : dataView.getFloat32;\n\n header[key] = getter.call(dataView, position, true);\n position += bytesCount;\n }\n\n return {header, headerEndPosition: position};\n}\n\nfunction decodeVertexData(dataView, headerEndPosition) {\n let position = headerEndPosition;\n const elementsPerVertex = 3;\n const vertexCount = dataView.getUint32(position, true);\n const vertexData = new Uint16Array(vertexCount * elementsPerVertex);\n\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const bytesPerArrayElement = Uint16Array.BYTES_PER_ELEMENT;\n const elementArrayLength = vertexCount * bytesPerArrayElement;\n const uArrayStartPosition = position;\n const vArrayStartPosition = uArrayStartPosition + elementArrayLength;\n const heightArrayStartPosition = vArrayStartPosition + elementArrayLength;\n\n let u = 0;\n let v = 0;\n let height = 0;\n\n for (let i = 0; i < vertexCount; i++) {\n u += decodeZigZag(dataView.getUint16(uArrayStartPosition + bytesPerArrayElement * i, true));\n v += decodeZigZag(dataView.getUint16(vArrayStartPosition + bytesPerArrayElement * i, true));\n height += decodeZigZag(\n dataView.getUint16(heightArrayStartPosition + bytesPerArrayElement * i, true)\n );\n\n vertexData[i] = u;\n vertexData[i + vertexCount] = v;\n vertexData[i + vertexCount * 2] = height;\n }\n\n position += elementArrayLength * 3;\n\n return {vertexData, vertexDataEndPosition: position};\n}\n\nfunction decodeIndex(buffer, position, indicesCount, bytesPerIndex, encoded = true) {\n let indices;\n\n if (bytesPerIndex === 2) {\n indices = new Uint16Array(buffer, position, indicesCount);\n } else {\n indices = new Uint32Array(buffer, position, indicesCount);\n }\n\n if (!encoded) {\n return indices;\n }\n\n let highest = 0;\n\n for (let i = 0; i < indices.length; ++i) {\n const code = indices[i];\n\n indices[i] = highest - code;\n\n if (code === 0) {\n ++highest;\n }\n }\n\n return indices;\n}\n\nfunction decodeTriangleIndices(dataView, vertexData, vertexDataEndPosition) {\n let position = vertexDataEndPosition;\n const elementsPerVertex = 3;\n const vertexCount = vertexData.length / elementsPerVertex;\n const bytesPerIndex =\n vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;\n\n if (position % bytesPerIndex !== 0) {\n position += bytesPerIndex - (position % bytesPerIndex);\n }\n\n const triangleCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const triangleIndicesCount = triangleCount * 3;\n const triangleIndices = decodeIndex(\n dataView.buffer,\n position,\n triangleIndicesCount,\n bytesPerIndex\n );\n position += triangleIndicesCount * bytesPerIndex;\n\n return {\n triangleIndicesEndPosition: position,\n triangleIndices\n };\n}\n\nfunction decodeEdgeIndices(dataView, vertexData, triangleIndicesEndPosition) {\n let position = triangleIndicesEndPosition;\n const elementsPerVertex = 3;\n const vertexCount = vertexData.length / elementsPerVertex;\n const bytesPerIndex =\n vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;\n\n const westVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const westIndices = decodeIndex(dataView.buffer, position, westVertexCount, bytesPerIndex, false);\n position += westVertexCount * bytesPerIndex;\n\n const southVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const southIndices = decodeIndex(\n dataView.buffer,\n position,\n southVertexCount,\n bytesPerIndex,\n false\n );\n position += southVertexCount * bytesPerIndex;\n\n const eastVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const eastIndices = decodeIndex(dataView.buffer, position, eastVertexCount, bytesPerIndex, false);\n position += eastVertexCount * bytesPerIndex;\n\n const northVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const northIndices = decodeIndex(\n dataView.buffer,\n position,\n northVertexCount,\n bytesPerIndex,\n false\n );\n position += northVertexCount * bytesPerIndex;\n\n return {\n edgeIndicesEndPosition: position,\n westIndices,\n southIndices,\n eastIndices,\n northIndices\n };\n}\n\nfunction decodeVertexNormalsExtension(extensionDataView) {\n return new Uint8Array(\n extensionDataView.buffer,\n extensionDataView.byteOffset,\n extensionDataView.byteLength\n );\n}\n\nfunction decodeWaterMaskExtension(extensionDataView) {\n return extensionDataView.buffer.slice(\n extensionDataView.byteOffset,\n extensionDataView.byteOffset + extensionDataView.byteLength\n );\n}\n\ntype Extensions = {\n vertexNormals?: any;\n waterMask?: any;\n};\n\nfunction decodeExtensions(dataView, indicesEndPosition) {\n const extensions: Extensions = {};\n\n if (dataView.byteLength <= indicesEndPosition) {\n return {extensions, extensionsEndPosition: indicesEndPosition};\n }\n\n let position = indicesEndPosition;\n\n while (position < dataView.byteLength) {\n const extensionId = dataView.getUint8(position, true);\n position += Uint8Array.BYTES_PER_ELEMENT;\n\n const extensionLength = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n\n const extensionView = new DataView(dataView.buffer, position, extensionLength);\n\n switch (extensionId) {\n case 1: {\n extensions.vertexNormals = decodeVertexNormalsExtension(extensionView);\n\n break;\n }\n case 2: {\n extensions.waterMask = decodeWaterMaskExtension(extensionView);\n\n break;\n }\n default: {\n // console.warn(`Unknown extension with id ${extensionId}`)\n }\n }\n\n position += extensionLength;\n }\n\n return {extensions, extensionsEndPosition: position};\n}\n\nexport const DECODING_STEPS = {\n header: 0,\n vertices: 1,\n triangleIndices: 2,\n edgeIndices: 3,\n extensions: 4\n};\n\nconst DEFAULT_OPTIONS = {\n maxDecodingStep: DECODING_STEPS.extensions\n};\n\nexport default function decode(data, userOptions) {\n const options = Object.assign({}, DEFAULT_OPTIONS, userOptions);\n const view = new DataView(data);\n const {header, headerEndPosition} = decodeHeader(view);\n\n if (options.maxDecodingStep < DECODING_STEPS.vertices) {\n return {header};\n }\n\n const {vertexData, vertexDataEndPosition} = decodeVertexData(view, headerEndPosition);\n\n if (options.maxDecodingStep < DECODING_STEPS.triangleIndices) {\n return {header, vertexData};\n }\n\n const {triangleIndices, triangleIndicesEndPosition} = decodeTriangleIndices(\n view,\n vertexData,\n vertexDataEndPosition\n );\n\n if (options.maxDecodingStep < DECODING_STEPS.edgeIndices) {\n return {header, vertexData, triangleIndices};\n }\n\n const {westIndices, southIndices, eastIndices, northIndices, edgeIndicesEndPosition} =\n decodeEdgeIndices(view, vertexData, triangleIndicesEndPosition);\n\n if (options.maxDecodingStep < DECODING_STEPS.extensions) {\n return {\n header,\n vertexData,\n triangleIndices,\n westIndices,\n northIndices,\n eastIndices,\n southIndices\n };\n }\n\n const {extensions} = decodeExtensions(view, edgeIndicesEndPosition);\n\n return {\n header,\n vertexData,\n triangleIndices,\n westIndices,\n northIndices,\n eastIndices,\n southIndices,\n extensions\n };\n}\n"],"mappings":"AAoBA,MAAMA,qBAAqB,GAAG,IAAIC,GAAG,CAAC,CACpC,CAAC,SAAS,EAAEC,YAAY,CAACC,iBAAiB,CAAC,EAC3C,CAAC,SAAS,EAAED,YAAY,CAACC,iBAAiB,CAAC,EAC3C,CAAC,SAAS,EAAED,YAAY,CAACC,iBAAiB,CAAC,EAE3C,CAAC,WAAW,EAAEC,YAAY,CAACD,iBAAiB,CAAC,EAC7C,CAAC,WAAW,EAAEC,YAAY,CAACD,iBAAiB,CAAC,EAE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