@loaders.gl/obj 4.0.0-alpha.5 → 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.js +2 -2
- package/dist/dist.min.js +97 -549
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/index.js +74 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/get-obj-schema.js +54 -0
- package/dist/es5/lib/get-obj-schema.js.map +1 -0
- package/dist/es5/lib/obj-types.js +2 -0
- package/dist/es5/lib/obj-types.js.map +1 -0
- package/dist/es5/lib/parse-mtl.js +86 -0
- package/dist/es5/lib/parse-mtl.js.map +1 -0
- package/dist/es5/lib/parse-obj-meshes.js +486 -0
- package/dist/es5/lib/parse-obj-meshes.js.map +1 -0
- package/dist/es5/lib/parse-obj.js +100 -0
- package/dist/es5/lib/parse-obj.js.map +1 -0
- package/dist/es5/mtl-loader.js +26 -0
- package/dist/es5/mtl-loader.js.map +1 -0
- package/dist/es5/obj-loader.js +27 -0
- package/dist/es5/obj-loader.js.map +1 -0
- package/dist/es5/workers/obj-worker.js +6 -0
- package/dist/es5/workers/obj-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 +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/get-obj-schema.js +49 -0
- package/dist/esm/lib/get-obj-schema.js.map +1 -0
- package/dist/esm/lib/obj-types.js +2 -0
- package/dist/esm/lib/obj-types.js.map +1 -0
- package/dist/esm/lib/parse-mtl.js +68 -0
- package/dist/esm/lib/parse-mtl.js.map +1 -0
- package/dist/esm/lib/parse-obj-meshes.js +385 -0
- package/dist/esm/lib/parse-obj-meshes.js.map +1 -0
- package/dist/esm/lib/parse-obj.js +82 -0
- package/dist/esm/lib/parse-obj.js.map +1 -0
- package/dist/esm/mtl-loader.js +16 -0
- package/dist/esm/mtl-loader.js.map +1 -0
- package/dist/esm/obj-loader.js +19 -0
- package/dist/esm/obj-loader.js.map +1 -0
- package/dist/esm/workers/obj-worker.js +4 -0
- package/dist/esm/workers/obj-worker.js.map +1 -0
- package/dist/index.d.ts +4 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -14
- package/dist/lib/get-obj-schema.d.ts +3 -2
- package/dist/lib/get-obj-schema.d.ts.map +1 -1
- package/dist/lib/get-obj-schema.js +33 -33
- package/dist/lib/obj-types.js +1 -2
- package/dist/lib/parse-mtl.d.ts +2 -2
- package/dist/lib/parse-mtl.d.ts.map +1 -1
- package/dist/lib/parse-mtl.js +185 -70
- package/dist/lib/parse-obj-meshes.js +408 -426
- package/dist/lib/parse-obj.d.ts +2 -13
- package/dist/lib/parse-obj.d.ts.map +1 -1
- package/dist/lib/parse-obj.js +66 -86
- package/dist/mtl-loader.d.ts +3 -15
- package/dist/mtl-loader.d.ts.map +1 -1
- package/dist/mtl-loader.js +23 -15
- package/dist/obj-loader.d.ts +3 -16
- package/dist/obj-loader.d.ts.map +1 -1
- package/dist/obj-loader.js +24 -18
- package/dist/obj-worker.js +133 -517
- package/dist/workers/obj-worker.js +5 -4
- package/package.json +6 -6
- package/src/index.ts +6 -3
- package/src/lib/get-obj-schema.ts +24 -20
- package/src/lib/parse-obj.ts +4 -3
- package/src/mtl-loader.ts +2 -2
- package/src/obj-loader.ts +2 -1
- package/dist/bundle.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/get-obj-schema.js.map +0 -1
- package/dist/lib/obj-types.js.map +0 -1
- package/dist/lib/parse-mtl.js.map +0 -1
- package/dist/lib/parse-obj-meshes.js.map +0 -1
- package/dist/lib/parse-obj.js.map +0 -1
- package/dist/mtl-loader.js.map +0 -1
- package/dist/obj-loader.js.map +0 -1
- package/dist/workers/obj-worker.js.map +0 -1
package/dist/dist.min.js
CHANGED
|
@@ -13,7 +13,62 @@
|
|
|
13
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
// ../schema/src/
|
|
16
|
+
// ../schema/src/lib/table/simple-table/data-type.ts
|
|
17
|
+
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
18
|
+
if (value instanceof Date) {
|
|
19
|
+
return "date-millisecond";
|
|
20
|
+
}
|
|
21
|
+
if (value instanceof Number) {
|
|
22
|
+
return defaultNumberType;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === "string") {
|
|
25
|
+
return "utf8";
|
|
26
|
+
}
|
|
27
|
+
if (value === null || value === "undefined") {
|
|
28
|
+
return "null";
|
|
29
|
+
}
|
|
30
|
+
return "null";
|
|
31
|
+
}
|
|
32
|
+
function getDataTypeFromArray(array) {
|
|
33
|
+
let type = getDataTypeFromTypedArray(array);
|
|
34
|
+
if (type !== "null") {
|
|
35
|
+
return { type, nullable: false };
|
|
36
|
+
}
|
|
37
|
+
if (array.length > 0) {
|
|
38
|
+
type = getDataTypeFromValue(array[0]);
|
|
39
|
+
return { type, nullable: true };
|
|
40
|
+
}
|
|
41
|
+
return { type: "null", nullable: true };
|
|
42
|
+
}
|
|
43
|
+
function getDataTypeFromTypedArray(array) {
|
|
44
|
+
switch (array.constructor) {
|
|
45
|
+
case Int8Array:
|
|
46
|
+
return "int8";
|
|
47
|
+
case Uint8Array:
|
|
48
|
+
case Uint8ClampedArray:
|
|
49
|
+
return "uint8";
|
|
50
|
+
case Int16Array:
|
|
51
|
+
return "int16";
|
|
52
|
+
case Uint16Array:
|
|
53
|
+
return "uint16";
|
|
54
|
+
case Int32Array:
|
|
55
|
+
return "int32";
|
|
56
|
+
case Uint32Array:
|
|
57
|
+
return "uint32";
|
|
58
|
+
case Float32Array:
|
|
59
|
+
return "float32";
|
|
60
|
+
case Float64Array:
|
|
61
|
+
return "float64";
|
|
62
|
+
default:
|
|
63
|
+
return "null";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var init_data_type = __esm({
|
|
67
|
+
"../schema/src/lib/table/simple-table/data-type.ts"() {
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// ../schema/src/lib/mesh/mesh-utils.ts
|
|
17
72
|
function getMeshBoundingBox(attributes) {
|
|
18
73
|
let minX = Infinity;
|
|
19
74
|
let minY = Infinity;
|
|
@@ -40,525 +95,15 @@
|
|
|
40
95
|
];
|
|
41
96
|
}
|
|
42
97
|
var init_mesh_utils = __esm({
|
|
43
|
-
"../schema/src/
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// ../schema/src/lib/utils/assert.ts
|
|
48
|
-
function assert(condition, message) {
|
|
49
|
-
if (!condition) {
|
|
50
|
-
throw new Error(message || "loader assertion failed.");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
var init_assert = __esm({
|
|
54
|
-
"../schema/src/lib/utils/assert.ts"() {
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// ../schema/src/lib/schema/impl/schema.ts
|
|
59
|
-
function checkNames(fields) {
|
|
60
|
-
const usedNames = {};
|
|
61
|
-
for (const field of fields) {
|
|
62
|
-
if (usedNames[field.name]) {
|
|
63
|
-
console.warn("Schema: duplicated field name", field.name, field);
|
|
64
|
-
}
|
|
65
|
-
usedNames[field.name] = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function mergeMaps(m1, m2) {
|
|
69
|
-
return new Map([...m1 || new Map(), ...m2 || new Map()]);
|
|
70
|
-
}
|
|
71
|
-
var Schema;
|
|
72
|
-
var init_schema = __esm({
|
|
73
|
-
"../schema/src/lib/schema/impl/schema.ts"() {
|
|
74
|
-
init_assert();
|
|
75
|
-
Schema = class {
|
|
76
|
-
constructor(fields, metadata) {
|
|
77
|
-
assert(Array.isArray(fields));
|
|
78
|
-
checkNames(fields);
|
|
79
|
-
this.fields = fields;
|
|
80
|
-
this.metadata = metadata || new Map();
|
|
81
|
-
}
|
|
82
|
-
compareTo(other) {
|
|
83
|
-
if (this.metadata !== other.metadata) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
if (this.fields.length !== other.fields.length) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
for (let i = 0; i < this.fields.length; ++i) {
|
|
90
|
-
if (!this.fields[i].compareTo(other.fields[i])) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
select(...columnNames) {
|
|
97
|
-
const nameMap = Object.create(null);
|
|
98
|
-
for (const name of columnNames) {
|
|
99
|
-
nameMap[name] = true;
|
|
100
|
-
}
|
|
101
|
-
const selectedFields = this.fields.filter((field) => nameMap[field.name]);
|
|
102
|
-
return new Schema(selectedFields, this.metadata);
|
|
103
|
-
}
|
|
104
|
-
selectAt(...columnIndices) {
|
|
105
|
-
const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
|
|
106
|
-
return new Schema(selectedFields, this.metadata);
|
|
107
|
-
}
|
|
108
|
-
assign(schemaOrFields) {
|
|
109
|
-
let fields;
|
|
110
|
-
let metadata = this.metadata;
|
|
111
|
-
if (schemaOrFields instanceof Schema) {
|
|
112
|
-
const otherSchema = schemaOrFields;
|
|
113
|
-
fields = otherSchema.fields;
|
|
114
|
-
metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);
|
|
115
|
-
} else {
|
|
116
|
-
fields = schemaOrFields;
|
|
117
|
-
}
|
|
118
|
-
const fieldMap = Object.create(null);
|
|
119
|
-
for (const field of this.fields) {
|
|
120
|
-
fieldMap[field.name] = field;
|
|
121
|
-
}
|
|
122
|
-
for (const field of fields) {
|
|
123
|
-
fieldMap[field.name] = field;
|
|
124
|
-
}
|
|
125
|
-
const mergedFields = Object.values(fieldMap);
|
|
126
|
-
return new Schema(mergedFields, metadata);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// ../schema/src/lib/schema/impl/field.ts
|
|
133
|
-
var Field;
|
|
134
|
-
var init_field = __esm({
|
|
135
|
-
"../schema/src/lib/schema/impl/field.ts"() {
|
|
136
|
-
Field = class {
|
|
137
|
-
constructor(name, type, nullable = false, metadata = new Map()) {
|
|
138
|
-
this.name = name;
|
|
139
|
-
this.type = type;
|
|
140
|
-
this.nullable = nullable;
|
|
141
|
-
this.metadata = metadata;
|
|
142
|
-
}
|
|
143
|
-
get typeId() {
|
|
144
|
-
return this.type && this.type.typeId;
|
|
145
|
-
}
|
|
146
|
-
clone() {
|
|
147
|
-
return new Field(this.name, this.type, this.nullable, this.metadata);
|
|
148
|
-
}
|
|
149
|
-
compareTo(other) {
|
|
150
|
-
return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
|
|
151
|
-
}
|
|
152
|
-
toString() {
|
|
153
|
-
return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// ../schema/src/lib/schema/impl/enum.ts
|
|
160
|
-
var Type;
|
|
161
|
-
var init_enum = __esm({
|
|
162
|
-
"../schema/src/lib/schema/impl/enum.ts"() {
|
|
163
|
-
(function(Type2) {
|
|
164
|
-
Type2[Type2["NONE"] = 0] = "NONE";
|
|
165
|
-
Type2[Type2["Null"] = 1] = "Null";
|
|
166
|
-
Type2[Type2["Int"] = 2] = "Int";
|
|
167
|
-
Type2[Type2["Float"] = 3] = "Float";
|
|
168
|
-
Type2[Type2["Binary"] = 4] = "Binary";
|
|
169
|
-
Type2[Type2["Utf8"] = 5] = "Utf8";
|
|
170
|
-
Type2[Type2["Bool"] = 6] = "Bool";
|
|
171
|
-
Type2[Type2["Decimal"] = 7] = "Decimal";
|
|
172
|
-
Type2[Type2["Date"] = 8] = "Date";
|
|
173
|
-
Type2[Type2["Time"] = 9] = "Time";
|
|
174
|
-
Type2[Type2["Timestamp"] = 10] = "Timestamp";
|
|
175
|
-
Type2[Type2["Interval"] = 11] = "Interval";
|
|
176
|
-
Type2[Type2["List"] = 12] = "List";
|
|
177
|
-
Type2[Type2["Struct"] = 13] = "Struct";
|
|
178
|
-
Type2[Type2["Union"] = 14] = "Union";
|
|
179
|
-
Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
|
|
180
|
-
Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
|
|
181
|
-
Type2[Type2["Map"] = 17] = "Map";
|
|
182
|
-
Type2[Type2["Dictionary"] = -1] = "Dictionary";
|
|
183
|
-
Type2[Type2["Int8"] = -2] = "Int8";
|
|
184
|
-
Type2[Type2["Int16"] = -3] = "Int16";
|
|
185
|
-
Type2[Type2["Int32"] = -4] = "Int32";
|
|
186
|
-
Type2[Type2["Int64"] = -5] = "Int64";
|
|
187
|
-
Type2[Type2["Uint8"] = -6] = "Uint8";
|
|
188
|
-
Type2[Type2["Uint16"] = -7] = "Uint16";
|
|
189
|
-
Type2[Type2["Uint32"] = -8] = "Uint32";
|
|
190
|
-
Type2[Type2["Uint64"] = -9] = "Uint64";
|
|
191
|
-
Type2[Type2["Float16"] = -10] = "Float16";
|
|
192
|
-
Type2[Type2["Float32"] = -11] = "Float32";
|
|
193
|
-
Type2[Type2["Float64"] = -12] = "Float64";
|
|
194
|
-
Type2[Type2["DateDay"] = -13] = "DateDay";
|
|
195
|
-
Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
|
|
196
|
-
Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
|
|
197
|
-
Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
|
|
198
|
-
Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
|
|
199
|
-
Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
|
|
200
|
-
Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
|
|
201
|
-
Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
|
|
202
|
-
Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
|
|
203
|
-
Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
|
|
204
|
-
Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
|
|
205
|
-
Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
|
|
206
|
-
Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
|
|
207
|
-
Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
|
|
208
|
-
})(Type || (Type = {}));
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
// ../schema/src/lib/schema/impl/type.ts
|
|
213
|
-
var DataType, Null, Bool, Int, Int8, Int16, Int32, Uint8, Uint16, Uint32, Precision, Float, Float32, Float64, Binary, Utf8, DateUnit, Date, TimeUnit, Time, Timestamp, IntervalUnit, Interval, FixedSizeList, Struct;
|
|
214
|
-
var init_type = __esm({
|
|
215
|
-
"../schema/src/lib/schema/impl/type.ts"() {
|
|
216
|
-
init_enum();
|
|
217
|
-
DataType = class {
|
|
218
|
-
static isNull(x) {
|
|
219
|
-
return x && x.typeId === Type.Null;
|
|
220
|
-
}
|
|
221
|
-
static isInt(x) {
|
|
222
|
-
return x && x.typeId === Type.Int;
|
|
223
|
-
}
|
|
224
|
-
static isFloat(x) {
|
|
225
|
-
return x && x.typeId === Type.Float;
|
|
226
|
-
}
|
|
227
|
-
static isBinary(x) {
|
|
228
|
-
return x && x.typeId === Type.Binary;
|
|
229
|
-
}
|
|
230
|
-
static isUtf8(x) {
|
|
231
|
-
return x && x.typeId === Type.Utf8;
|
|
232
|
-
}
|
|
233
|
-
static isBool(x) {
|
|
234
|
-
return x && x.typeId === Type.Bool;
|
|
235
|
-
}
|
|
236
|
-
static isDecimal(x) {
|
|
237
|
-
return x && x.typeId === Type.Decimal;
|
|
238
|
-
}
|
|
239
|
-
static isDate(x) {
|
|
240
|
-
return x && x.typeId === Type.Date;
|
|
241
|
-
}
|
|
242
|
-
static isTime(x) {
|
|
243
|
-
return x && x.typeId === Type.Time;
|
|
244
|
-
}
|
|
245
|
-
static isTimestamp(x) {
|
|
246
|
-
return x && x.typeId === Type.Timestamp;
|
|
247
|
-
}
|
|
248
|
-
static isInterval(x) {
|
|
249
|
-
return x && x.typeId === Type.Interval;
|
|
250
|
-
}
|
|
251
|
-
static isList(x) {
|
|
252
|
-
return x && x.typeId === Type.List;
|
|
253
|
-
}
|
|
254
|
-
static isStruct(x) {
|
|
255
|
-
return x && x.typeId === Type.Struct;
|
|
256
|
-
}
|
|
257
|
-
static isUnion(x) {
|
|
258
|
-
return x && x.typeId === Type.Union;
|
|
259
|
-
}
|
|
260
|
-
static isFixedSizeBinary(x) {
|
|
261
|
-
return x && x.typeId === Type.FixedSizeBinary;
|
|
262
|
-
}
|
|
263
|
-
static isFixedSizeList(x) {
|
|
264
|
-
return x && x.typeId === Type.FixedSizeList;
|
|
265
|
-
}
|
|
266
|
-
static isMap(x) {
|
|
267
|
-
return x && x.typeId === Type.Map;
|
|
268
|
-
}
|
|
269
|
-
static isDictionary(x) {
|
|
270
|
-
return x && x.typeId === Type.Dictionary;
|
|
271
|
-
}
|
|
272
|
-
get typeId() {
|
|
273
|
-
return Type.NONE;
|
|
274
|
-
}
|
|
275
|
-
compareTo(other) {
|
|
276
|
-
return this === other;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
Null = class extends DataType {
|
|
280
|
-
get typeId() {
|
|
281
|
-
return Type.Null;
|
|
282
|
-
}
|
|
283
|
-
get [Symbol.toStringTag]() {
|
|
284
|
-
return "Null";
|
|
285
|
-
}
|
|
286
|
-
toString() {
|
|
287
|
-
return "Null";
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
Bool = class extends DataType {
|
|
291
|
-
get typeId() {
|
|
292
|
-
return Type.Bool;
|
|
293
|
-
}
|
|
294
|
-
get [Symbol.toStringTag]() {
|
|
295
|
-
return "Bool";
|
|
296
|
-
}
|
|
297
|
-
toString() {
|
|
298
|
-
return "Bool";
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
Int = class extends DataType {
|
|
302
|
-
constructor(isSigned, bitWidth) {
|
|
303
|
-
super();
|
|
304
|
-
this.isSigned = isSigned;
|
|
305
|
-
this.bitWidth = bitWidth;
|
|
306
|
-
}
|
|
307
|
-
get typeId() {
|
|
308
|
-
return Type.Int;
|
|
309
|
-
}
|
|
310
|
-
get [Symbol.toStringTag]() {
|
|
311
|
-
return "Int";
|
|
312
|
-
}
|
|
313
|
-
toString() {
|
|
314
|
-
return `${this.isSigned ? "I" : "Ui"}nt${this.bitWidth}`;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
Int8 = class extends Int {
|
|
318
|
-
constructor() {
|
|
319
|
-
super(true, 8);
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
Int16 = class extends Int {
|
|
323
|
-
constructor() {
|
|
324
|
-
super(true, 16);
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
Int32 = class extends Int {
|
|
328
|
-
constructor() {
|
|
329
|
-
super(true, 32);
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
Uint8 = class extends Int {
|
|
333
|
-
constructor() {
|
|
334
|
-
super(false, 8);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
Uint16 = class extends Int {
|
|
338
|
-
constructor() {
|
|
339
|
-
super(false, 16);
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
Uint32 = class extends Int {
|
|
343
|
-
constructor() {
|
|
344
|
-
super(false, 32);
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
Precision = {
|
|
348
|
-
HALF: 16,
|
|
349
|
-
SINGLE: 32,
|
|
350
|
-
DOUBLE: 64
|
|
351
|
-
};
|
|
352
|
-
Float = class extends DataType {
|
|
353
|
-
constructor(precision) {
|
|
354
|
-
super();
|
|
355
|
-
this.precision = precision;
|
|
356
|
-
}
|
|
357
|
-
get typeId() {
|
|
358
|
-
return Type.Float;
|
|
359
|
-
}
|
|
360
|
-
get [Symbol.toStringTag]() {
|
|
361
|
-
return "Float";
|
|
362
|
-
}
|
|
363
|
-
toString() {
|
|
364
|
-
return `Float${this.precision}`;
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
Float32 = class extends Float {
|
|
368
|
-
constructor() {
|
|
369
|
-
super(Precision.SINGLE);
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
Float64 = class extends Float {
|
|
373
|
-
constructor() {
|
|
374
|
-
super(Precision.DOUBLE);
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
Binary = class extends DataType {
|
|
378
|
-
constructor() {
|
|
379
|
-
super();
|
|
380
|
-
}
|
|
381
|
-
get typeId() {
|
|
382
|
-
return Type.Binary;
|
|
383
|
-
}
|
|
384
|
-
toString() {
|
|
385
|
-
return "Binary";
|
|
386
|
-
}
|
|
387
|
-
get [Symbol.toStringTag]() {
|
|
388
|
-
return "Binary";
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
Utf8 = class extends DataType {
|
|
392
|
-
get typeId() {
|
|
393
|
-
return Type.Utf8;
|
|
394
|
-
}
|
|
395
|
-
get [Symbol.toStringTag]() {
|
|
396
|
-
return "Utf8";
|
|
397
|
-
}
|
|
398
|
-
toString() {
|
|
399
|
-
return "Utf8";
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
DateUnit = {
|
|
403
|
-
DAY: 0,
|
|
404
|
-
MILLISECOND: 1
|
|
405
|
-
};
|
|
406
|
-
Date = class extends DataType {
|
|
407
|
-
constructor(unit) {
|
|
408
|
-
super();
|
|
409
|
-
this.unit = unit;
|
|
410
|
-
}
|
|
411
|
-
get typeId() {
|
|
412
|
-
return Type.Date;
|
|
413
|
-
}
|
|
414
|
-
get [Symbol.toStringTag]() {
|
|
415
|
-
return "Date";
|
|
416
|
-
}
|
|
417
|
-
toString() {
|
|
418
|
-
return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
TimeUnit = {
|
|
422
|
-
SECOND: 1,
|
|
423
|
-
MILLISECOND: 1e3,
|
|
424
|
-
MICROSECOND: 1e6,
|
|
425
|
-
NANOSECOND: 1e9
|
|
426
|
-
};
|
|
427
|
-
Time = class extends DataType {
|
|
428
|
-
constructor(unit, bitWidth) {
|
|
429
|
-
super();
|
|
430
|
-
this.unit = unit;
|
|
431
|
-
this.bitWidth = bitWidth;
|
|
432
|
-
}
|
|
433
|
-
get typeId() {
|
|
434
|
-
return Type.Time;
|
|
435
|
-
}
|
|
436
|
-
toString() {
|
|
437
|
-
return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
|
|
438
|
-
}
|
|
439
|
-
get [Symbol.toStringTag]() {
|
|
440
|
-
return "Time";
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
Timestamp = class extends DataType {
|
|
444
|
-
constructor(unit, timezone = null) {
|
|
445
|
-
super();
|
|
446
|
-
this.unit = unit;
|
|
447
|
-
this.timezone = timezone;
|
|
448
|
-
}
|
|
449
|
-
get typeId() {
|
|
450
|
-
return Type.Timestamp;
|
|
451
|
-
}
|
|
452
|
-
get [Symbol.toStringTag]() {
|
|
453
|
-
return "Timestamp";
|
|
454
|
-
}
|
|
455
|
-
toString() {
|
|
456
|
-
return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ""}>`;
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
IntervalUnit = {
|
|
460
|
-
DAY_TIME: 0,
|
|
461
|
-
YEAR_MONTH: 1
|
|
462
|
-
};
|
|
463
|
-
Interval = class extends DataType {
|
|
464
|
-
constructor(unit) {
|
|
465
|
-
super();
|
|
466
|
-
this.unit = unit;
|
|
467
|
-
}
|
|
468
|
-
get typeId() {
|
|
469
|
-
return Type.Interval;
|
|
470
|
-
}
|
|
471
|
-
get [Symbol.toStringTag]() {
|
|
472
|
-
return "Interval";
|
|
473
|
-
}
|
|
474
|
-
toString() {
|
|
475
|
-
return `Interval<${IntervalUnit[this.unit]}>`;
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
FixedSizeList = class extends DataType {
|
|
479
|
-
constructor(listSize, child) {
|
|
480
|
-
super();
|
|
481
|
-
this.listSize = listSize;
|
|
482
|
-
this.children = [child];
|
|
483
|
-
}
|
|
484
|
-
get typeId() {
|
|
485
|
-
return Type.FixedSizeList;
|
|
486
|
-
}
|
|
487
|
-
get valueType() {
|
|
488
|
-
return this.children[0].type;
|
|
489
|
-
}
|
|
490
|
-
get valueField() {
|
|
491
|
-
return this.children[0];
|
|
492
|
-
}
|
|
493
|
-
get [Symbol.toStringTag]() {
|
|
494
|
-
return "FixedSizeList";
|
|
495
|
-
}
|
|
496
|
-
toString() {
|
|
497
|
-
return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
Struct = class extends DataType {
|
|
501
|
-
constructor(children) {
|
|
502
|
-
super();
|
|
503
|
-
this.children = children;
|
|
504
|
-
}
|
|
505
|
-
get typeId() {
|
|
506
|
-
return Type.Struct;
|
|
507
|
-
}
|
|
508
|
-
toString() {
|
|
509
|
-
return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(", ")}}>`;
|
|
510
|
-
}
|
|
511
|
-
get [Symbol.toStringTag]() {
|
|
512
|
-
return "Struct";
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
// ../schema/src/lib/schema/schema.ts
|
|
519
|
-
var init_schema2 = __esm({
|
|
520
|
-
"../schema/src/lib/schema/schema.ts"() {
|
|
521
|
-
init_schema();
|
|
522
|
-
init_field();
|
|
523
|
-
init_type();
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
// ../schema/src/lib/arrow/arrow-like-type-utils.ts
|
|
528
|
-
function getArrowTypeFromTypedArray(array) {
|
|
529
|
-
switch (array.constructor) {
|
|
530
|
-
case Int8Array:
|
|
531
|
-
return new Int8();
|
|
532
|
-
case Uint8Array:
|
|
533
|
-
return new Uint8();
|
|
534
|
-
case Int16Array:
|
|
535
|
-
return new Int16();
|
|
536
|
-
case Uint16Array:
|
|
537
|
-
return new Uint16();
|
|
538
|
-
case Int32Array:
|
|
539
|
-
return new Int32();
|
|
540
|
-
case Uint32Array:
|
|
541
|
-
return new Uint32();
|
|
542
|
-
case Float32Array:
|
|
543
|
-
return new Float32();
|
|
544
|
-
case Float64Array:
|
|
545
|
-
return new Float64();
|
|
546
|
-
default:
|
|
547
|
-
throw new Error("array type not supported");
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
var init_arrow_like_type_utils = __esm({
|
|
551
|
-
"../schema/src/lib/arrow/arrow-like-type-utils.ts"() {
|
|
552
|
-
init_schema2();
|
|
98
|
+
"../schema/src/lib/mesh/mesh-utils.ts"() {
|
|
553
99
|
}
|
|
554
100
|
});
|
|
555
101
|
|
|
556
102
|
// ../schema/src/index.ts
|
|
557
103
|
var init_src = __esm({
|
|
558
104
|
"../schema/src/index.ts"() {
|
|
105
|
+
init_data_type();
|
|
559
106
|
init_mesh_utils();
|
|
560
|
-
init_schema2();
|
|
561
|
-
init_arrow_like_type_utils();
|
|
562
107
|
}
|
|
563
108
|
});
|
|
564
109
|
|
|
@@ -935,31 +480,33 @@
|
|
|
935
480
|
|
|
936
481
|
// src/lib/get-obj-schema.ts
|
|
937
482
|
function getOBJSchema(attributes, metadata = {}) {
|
|
938
|
-
|
|
483
|
+
const stringMetadata = {};
|
|
939
484
|
for (const key in metadata) {
|
|
940
|
-
metadataMap = metadataMap || new Map();
|
|
941
485
|
if (key !== "value") {
|
|
942
|
-
|
|
486
|
+
stringMetadata[key] = JSON.stringify(metadata[key]);
|
|
943
487
|
}
|
|
944
488
|
}
|
|
945
489
|
const fields = [];
|
|
946
490
|
for (const attributeName in attributes) {
|
|
947
491
|
const attribute = attributes[attributeName];
|
|
948
|
-
const field =
|
|
492
|
+
const field = getFieldFromAttribute(attributeName, attribute);
|
|
949
493
|
fields.push(field);
|
|
950
494
|
}
|
|
951
|
-
return
|
|
495
|
+
return { fields, metadata: stringMetadata };
|
|
952
496
|
}
|
|
953
|
-
function
|
|
954
|
-
const
|
|
497
|
+
function getFieldFromAttribute(name, attribute) {
|
|
498
|
+
const metadata = {};
|
|
955
499
|
for (const key in attribute) {
|
|
956
500
|
if (key !== "value") {
|
|
957
|
-
|
|
501
|
+
metadata[key] = JSON.stringify(attribute[key]);
|
|
958
502
|
}
|
|
959
503
|
}
|
|
960
|
-
|
|
961
|
-
const isSingleValue =
|
|
962
|
-
|
|
504
|
+
let { type } = getDataTypeFromArray(attribute.value);
|
|
505
|
+
const isSingleValue = attribute.size === 1 || attribute.size === void 0;
|
|
506
|
+
if (!isSingleValue) {
|
|
507
|
+
type = { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "values", type }] };
|
|
508
|
+
}
|
|
509
|
+
return { name, type, nullable: false, metadata };
|
|
963
510
|
}
|
|
964
511
|
var init_get_obj_schema = __esm({
|
|
965
512
|
"src/lib/get-obj-schema.ts"() {
|
|
@@ -987,6 +534,7 @@
|
|
|
987
534
|
schema,
|
|
988
535
|
header,
|
|
989
536
|
mode: 4,
|
|
537
|
+
topology: "point-list",
|
|
990
538
|
attributes
|
|
991
539
|
};
|
|
992
540
|
}
|
|
@@ -1034,6 +582,30 @@
|
|
|
1034
582
|
}
|
|
1035
583
|
});
|
|
1036
584
|
|
|
585
|
+
// src/obj-loader.ts
|
|
586
|
+
function testOBJFile(text) {
|
|
587
|
+
return text[0] === "v";
|
|
588
|
+
}
|
|
589
|
+
var VERSION, OBJLoader;
|
|
590
|
+
var init_obj_loader = __esm({
|
|
591
|
+
"src/obj-loader.ts"() {
|
|
592
|
+
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
593
|
+
OBJLoader = {
|
|
594
|
+
name: "OBJ",
|
|
595
|
+
id: "obj",
|
|
596
|
+
module: "obj",
|
|
597
|
+
version: VERSION,
|
|
598
|
+
worker: true,
|
|
599
|
+
extensions: ["obj"],
|
|
600
|
+
mimeTypes: ["text/plain"],
|
|
601
|
+
testText: testOBJFile,
|
|
602
|
+
options: {
|
|
603
|
+
obj: {}
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
|
|
1037
609
|
// src/lib/parse-mtl.ts
|
|
1038
610
|
function parseMTL(text, options) {
|
|
1039
611
|
const materials = [];
|
|
@@ -1108,30 +680,6 @@
|
|
|
1108
680
|
}
|
|
1109
681
|
});
|
|
1110
682
|
|
|
1111
|
-
// src/obj-loader.ts
|
|
1112
|
-
function testOBJFile(text) {
|
|
1113
|
-
return text[0] === "v";
|
|
1114
|
-
}
|
|
1115
|
-
var VERSION, OBJLoader;
|
|
1116
|
-
var init_obj_loader = __esm({
|
|
1117
|
-
"src/obj-loader.ts"() {
|
|
1118
|
-
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1119
|
-
OBJLoader = {
|
|
1120
|
-
name: "OBJ",
|
|
1121
|
-
id: "obj",
|
|
1122
|
-
module: "obj",
|
|
1123
|
-
version: VERSION,
|
|
1124
|
-
worker: true,
|
|
1125
|
-
extensions: ["obj"],
|
|
1126
|
-
mimeTypes: ["text/plain"],
|
|
1127
|
-
testText: testOBJFile,
|
|
1128
|
-
options: {
|
|
1129
|
-
obj: {}
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
|
|
1135
683
|
// src/mtl-loader.ts
|
|
1136
684
|
var VERSION2, MTLLoader;
|
|
1137
685
|
var init_mtl_loader = __esm({
|
|
@@ -1166,8 +714,8 @@
|
|
|
1166
714
|
var init_src2 = __esm({
|
|
1167
715
|
"src/index.ts"() {
|
|
1168
716
|
init_parse_obj();
|
|
1169
|
-
init_parse_mtl();
|
|
1170
717
|
init_obj_loader();
|
|
718
|
+
init_parse_mtl();
|
|
1171
719
|
init_mtl_loader();
|
|
1172
720
|
OBJLoader2 = {
|
|
1173
721
|
...OBJLoader,
|