@jdultra/threedtiles 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -20
- package/dist/threedtiles.min.js +2 -0
- package/package.json +17 -13
- package/.babelrc +0 -8
- package/.vscode/settings.json +0 -2
- package/index.html +0 -56
- package/src/decoder/B3DMDecoder.js +0 -125
- package/src/decoder/FeatureTable.js +0 -169
- package/src/decoder/LegacyGLTFLoader.js +0 -2216
- package/src/geometry/obb.js +0 -47
- package/src/images/skybox/back.png +0 -0
- package/src/images/skybox/bottom.png +0 -0
- package/src/images/skybox/front.png +0 -0
- package/src/images/skybox/left.png +0 -0
- package/src/images/skybox/right.png +0 -0
- package/src/images/skybox/top.png +0 -0
- package/src/index.js +0 -331
- package/src/tileset/OGC3DTile.js +0 -676
- package/src/tileset/OcclusionCullingService.js +0 -79
- package/src/tileset/TileLoader.js +0 -381
- package/src/tileset/instanced/InstancedOGC3DTile.js +0 -55
- package/src/tileset/instanced/InstancedTile.js +0 -588
- package/src/tileset/instanced/InstancedTileLoader.js +0 -396
- package/src/tileset/instanced/JsonTile.js +0 -41
- package/src/tileset/instanced/MeshTile.js +0 -81
- package/threedtiles.js +0 -82894
- package/threedtiles.js.map +0 -1
- package/webpack.config.js +0 -142
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This class is taken straight from NASA-AMMOS library.
|
|
3
|
-
* https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/src/utilities/FeatureTable.js
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const utf8decoder = new TextDecoder();
|
|
7
|
-
export class FeatureTable {
|
|
8
|
-
|
|
9
|
-
constructor(buffer, start, headerLength, binLength) {
|
|
10
|
-
|
|
11
|
-
this.buffer = buffer;
|
|
12
|
-
this.binOffset = start + headerLength;
|
|
13
|
-
this.binLength = binLength;
|
|
14
|
-
|
|
15
|
-
let header = null;
|
|
16
|
-
if (headerLength !== 0) {
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
const headerData = new Uint8Array(buffer, start, headerLength);
|
|
20
|
-
header = JSON.parse(utf8decoder.decode(headerData));
|
|
21
|
-
} catch (e) {
|
|
22
|
-
header = {};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
} else {
|
|
26
|
-
|
|
27
|
-
header = {};
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
this.header = header;
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getKeys() {
|
|
35
|
-
|
|
36
|
-
return Object.keys(this.header);
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getData(key, count, defaultComponentType = null, defaultType = null) {
|
|
41
|
-
|
|
42
|
-
const header = this.header;
|
|
43
|
-
|
|
44
|
-
if (!(key in header)) {
|
|
45
|
-
|
|
46
|
-
return null;
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const feature = header[key];
|
|
51
|
-
if (!(feature instanceof Object)) {
|
|
52
|
-
|
|
53
|
-
return feature;
|
|
54
|
-
|
|
55
|
-
} else if (Array.isArray(feature)) {
|
|
56
|
-
|
|
57
|
-
return feature;
|
|
58
|
-
|
|
59
|
-
} else {
|
|
60
|
-
|
|
61
|
-
const { buffer, binOffset, binLength } = this;
|
|
62
|
-
const byteOffset = feature.byteOffset || 0;
|
|
63
|
-
const featureType = feature.type || defaultType;
|
|
64
|
-
const featureComponentType = feature.componentType || defaultComponentType;
|
|
65
|
-
|
|
66
|
-
if ('type' in feature && defaultType && feature.type !== defaultType) {
|
|
67
|
-
|
|
68
|
-
throw new Error('FeatureTable: Specified type does not match expected type.');
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let stride;
|
|
73
|
-
switch (featureType) {
|
|
74
|
-
|
|
75
|
-
case 'SCALAR':
|
|
76
|
-
stride = 1;
|
|
77
|
-
break;
|
|
78
|
-
|
|
79
|
-
case 'VEC2':
|
|
80
|
-
stride = 2;
|
|
81
|
-
break;
|
|
82
|
-
|
|
83
|
-
case 'VEC3':
|
|
84
|
-
stride = 3;
|
|
85
|
-
break;
|
|
86
|
-
|
|
87
|
-
case 'VEC4':
|
|
88
|
-
stride = 4;
|
|
89
|
-
break;
|
|
90
|
-
|
|
91
|
-
default:
|
|
92
|
-
throw new Error(`FeatureTable : Feature type not provided for "${key}".`);
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
let data;
|
|
97
|
-
const arrayStart = binOffset + byteOffset;
|
|
98
|
-
const arrayLength = count * stride;
|
|
99
|
-
|
|
100
|
-
switch (featureComponentType) {
|
|
101
|
-
|
|
102
|
-
case 'BYTE':
|
|
103
|
-
data = new Int8Array(buffer, arrayStart, arrayLength);
|
|
104
|
-
break;
|
|
105
|
-
|
|
106
|
-
case 'UNSIGNED_BYTE':
|
|
107
|
-
data = new Uint8Array(buffer, arrayStart, arrayLength);
|
|
108
|
-
break;
|
|
109
|
-
|
|
110
|
-
case 'SHORT':
|
|
111
|
-
data = new Int16Array(buffer, arrayStart, arrayLength);
|
|
112
|
-
break;
|
|
113
|
-
|
|
114
|
-
case 'UNSIGNED_SHORT':
|
|
115
|
-
data = new Uint16Array(buffer, arrayStart, arrayLength);
|
|
116
|
-
break;
|
|
117
|
-
|
|
118
|
-
case 'INT':
|
|
119
|
-
data = new Int32Array(buffer, arrayStart, arrayLength);
|
|
120
|
-
break;
|
|
121
|
-
|
|
122
|
-
case 'UNSIGNED_INT':
|
|
123
|
-
data = new Uint32Array(buffer, arrayStart, arrayLength);
|
|
124
|
-
break;
|
|
125
|
-
|
|
126
|
-
case 'FLOAT':
|
|
127
|
-
data = new Float32Array(buffer, arrayStart, arrayLength);
|
|
128
|
-
break;
|
|
129
|
-
|
|
130
|
-
case 'DOUBLE':
|
|
131
|
-
data = new Float64Array(buffer, arrayStart, arrayLength);
|
|
132
|
-
break;
|
|
133
|
-
|
|
134
|
-
default:
|
|
135
|
-
throw new Error(`FeatureTable : Feature component type not provided for "${key}".`);
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const dataEnd = arrayStart + arrayLength * data.BYTES_PER_ELEMENT;
|
|
140
|
-
if (dataEnd > binOffset + binLength) {
|
|
141
|
-
|
|
142
|
-
throw new Error('FeatureTable: Feature data read outside binary body length.');
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return data;
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export class BatchTable extends FeatureTable {
|
|
155
|
-
|
|
156
|
-
constructor(buffer, batchSize, start, headerLength, binLength) {
|
|
157
|
-
|
|
158
|
-
super(buffer, start, headerLength, binLength);
|
|
159
|
-
this.batchSize = batchSize;
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getData(key, componentType = null, type = null) {
|
|
164
|
-
|
|
165
|
-
return super.getData(key, this.batchSize, componentType, type);
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
}
|