@2112-lab/central-plant 0.1.4 → 0.1.5
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/cjs/_virtual/_rollupPluginBabelHelpers.js +432 -1
- package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1448 -1
- package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1853 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3537 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +305 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +542 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +218 -1
- package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +683 -1
- package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4811 -1
- package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +480 -1
- package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +309 -1
- package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +120 -1
- package/dist/cjs/src/analysis/analysis.js +560 -1
- package/dist/cjs/src/analysis/testing.js +958 -1
- package/dist/cjs/src/core/centralPlant.js +1149 -1
- package/dist/cjs/src/core/debugLogger.js +175 -1
- package/dist/cjs/src/core/mathUtils.js +574 -1
- package/dist/cjs/src/core/nameUtils.js +93 -1
- package/dist/cjs/src/data/export.js +716 -1
- package/dist/cjs/src/data/import.js +380 -1
- package/dist/cjs/src/data/numerics.js +522 -1
- package/dist/cjs/src/helpers/sceneHelper.js +572 -1
- package/dist/cjs/src/index.js +69 -1
- package/dist/cjs/src/managers/components/animationManager.js +123 -1
- package/dist/cjs/src/managers/components/componentManager.js +332 -1
- package/dist/cjs/src/managers/components/pathfindingManager.js +1441 -1
- package/dist/cjs/src/managers/controls/TransformControls.js +1063 -1
- package/dist/cjs/src/managers/controls/cameraControlsManager.js +79 -1
- package/dist/cjs/src/managers/controls/dragDropManager.js +1026 -1
- package/dist/cjs/src/managers/controls/keyboardControlsManager.js +395 -1
- package/dist/cjs/src/managers/controls/transformControlsManager.js +1807 -1
- package/dist/cjs/src/managers/environment/environmentManager.js +714 -1
- package/dist/cjs/src/managers/environment/textureConfig.js +229 -1
- package/dist/cjs/src/managers/scene/sceneExportManager.js +264 -1
- package/dist/cjs/src/managers/scene/sceneInitializationManager.js +346 -1
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1509 -1
- package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +661 -1
- package/dist/cjs/src/managers/system/disposalManager.js +444 -1
- package/dist/cjs/src/managers/system/hotReloadManager.js +291 -1
- package/dist/cjs/src/managers/system/performanceMonitor.js +863 -1
- package/dist/cjs/src/rendering/modelPreloader.js +369 -1
- package/dist/cjs/src/rendering/rendering2D.js +631 -1
- package/dist/cjs/src/rendering/rendering3D.js +685 -1
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +396 -1
- package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1444 -1
- package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1849 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3533 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +301 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +538 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +214 -1
- package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +679 -1
- package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4807 -1
- package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +476 -1
- package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +304 -1
- package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +116 -1
- package/dist/esm/src/analysis/analysis.js +536 -1
- package/dist/esm/src/analysis/testing.js +954 -1
- package/dist/esm/src/core/centralPlant.js +1144 -1
- package/dist/esm/src/core/debugLogger.js +167 -1
- package/dist/esm/src/core/mathUtils.js +570 -1
- package/dist/esm/src/core/nameUtils.js +87 -1
- package/dist/esm/src/data/export.js +712 -1
- package/dist/esm/src/data/import.js +356 -1
- package/dist/esm/src/data/numerics.js +518 -1
- package/dist/esm/src/helpers/sceneHelper.js +547 -1
- package/dist/esm/src/index.js +35 -1
- package/dist/esm/src/managers/components/animationManager.js +119 -1
- package/dist/esm/src/managers/components/componentManager.js +328 -1
- package/dist/esm/src/managers/components/pathfindingManager.js +1417 -1
- package/dist/esm/src/managers/controls/TransformControls.js +1057 -1
- package/dist/esm/src/managers/controls/cameraControlsManager.js +75 -1
- package/dist/esm/src/managers/controls/dragDropManager.js +1002 -1
- package/dist/esm/src/managers/controls/keyboardControlsManager.js +371 -1
- package/dist/esm/src/managers/controls/transformControlsManager.js +1782 -1
- package/dist/esm/src/managers/environment/environmentManager.js +690 -1
- package/dist/esm/src/managers/environment/textureConfig.js +202 -1
- package/dist/esm/src/managers/scene/sceneExportManager.js +260 -1
- package/dist/esm/src/managers/scene/sceneInitializationManager.js +322 -1
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +1485 -1
- package/dist/esm/src/managers/scene/sceneTooltipsManager.js +637 -1
- package/dist/esm/src/managers/system/disposalManager.js +440 -1
- package/dist/esm/src/managers/system/hotReloadManager.js +287 -1
- package/dist/esm/src/managers/system/performanceMonitor.js +858 -1
- package/dist/esm/src/rendering/modelPreloader.js +364 -1
- package/dist/esm/src/rendering/rendering2D.js +627 -1
- package/dist/esm/src/rendering/rendering3D.js +661 -1
- package/package.json +1 -1
|
@@ -1 +1,356 @@
|
|
|
1
|
-
import{createClass as
|
|
1
|
+
import { createClass as _createClass, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck, asyncToGenerator as _asyncToGenerator, regenerator as _regenerator, toConsumableArray as _toConsumableArray, createForOfIteratorHelper as _createForOfIteratorHelper } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { GLTFLoader } from '../../node_modules/three/examples/jsm/loaders/GLTFLoader.js';
|
|
4
|
+
import { DRACOLoader } from '../../node_modules/three/examples/jsm/loaders/DRACOLoader.js';
|
|
5
|
+
import { logger } from '../core/debugLogger.js';
|
|
6
|
+
|
|
7
|
+
var Import = /*#__PURE__*/function () {
|
|
8
|
+
function Import() {
|
|
9
|
+
_classCallCheck(this, Import);
|
|
10
|
+
this.gltfLoader = new GLTFLoader();
|
|
11
|
+
this.dracoLoader = new DRACOLoader();
|
|
12
|
+
this.textureLoader = new THREE.TextureLoader();
|
|
13
|
+
|
|
14
|
+
// Configure DRACO decoder
|
|
15
|
+
this.dracoLoader.setDecoderPath('/draco/');
|
|
16
|
+
this.gltfLoader.setDRACOLoader(this.dracoLoader);
|
|
17
|
+
this.supportedFormats = {
|
|
18
|
+
models: ['.glb', '.gltf'],
|
|
19
|
+
textures: ['.jpg', '.jpeg', '.png', '.hdr', '.exr'],
|
|
20
|
+
scenes: ['.json'],
|
|
21
|
+
configs: ['.json', '.yaml', '.yml']
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Import a 3D model file
|
|
27
|
+
* @param {string} url - Path to the model file
|
|
28
|
+
* @param {Object} options - Import options
|
|
29
|
+
* @returns {Promise<Object>} Imported model data
|
|
30
|
+
*/
|
|
31
|
+
return _createClass(Import, [{
|
|
32
|
+
key: "importModel",
|
|
33
|
+
value: (function () {
|
|
34
|
+
var _importModel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
var options,
|
|
37
|
+
_options$scale,
|
|
38
|
+
scale,
|
|
39
|
+
_options$position,
|
|
40
|
+
position,
|
|
41
|
+
_options$rotation,
|
|
42
|
+
rotation,
|
|
43
|
+
_options$castShadow,
|
|
44
|
+
castShadow,
|
|
45
|
+
_options$receiveShado,
|
|
46
|
+
receiveShadow,
|
|
47
|
+
_gltf$scene$position,
|
|
48
|
+
_gltf$scene$rotation,
|
|
49
|
+
gltf,
|
|
50
|
+
_args = arguments,
|
|
51
|
+
_t;
|
|
52
|
+
return _regenerator().w(function (_context) {
|
|
53
|
+
while (1) switch (_context.n) {
|
|
54
|
+
case 0:
|
|
55
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
56
|
+
_options$scale = options.scale, scale = _options$scale === void 0 ? 1 : _options$scale, _options$position = options.position, position = _options$position === void 0 ? [0, 0, 0] : _options$position, _options$rotation = options.rotation, rotation = _options$rotation === void 0 ? [0, 0, 0] : _options$rotation, _options$castShadow = options.castShadow, castShadow = _options$castShadow === void 0 ? true : _options$castShadow, _options$receiveShado = options.receiveShadow, receiveShadow = _options$receiveShado === void 0 ? true : _options$receiveShado;
|
|
57
|
+
_context.p = 1;
|
|
58
|
+
logger.info("\uD83D\uDD04 Importing model: ".concat(url));
|
|
59
|
+
_context.n = 2;
|
|
60
|
+
return new Promise(function (resolve, reject) {
|
|
61
|
+
_this.gltfLoader.load(url, resolve, function (progress) {
|
|
62
|
+
var percent = (progress.loaded / progress.total * 100).toFixed(1);
|
|
63
|
+
logger.debug("Loading progress: ".concat(percent, "%"));
|
|
64
|
+
}, reject);
|
|
65
|
+
});
|
|
66
|
+
case 2:
|
|
67
|
+
gltf = _context.v;
|
|
68
|
+
// Apply transformations
|
|
69
|
+
if (scale !== 1) {
|
|
70
|
+
gltf.scene.scale.setScalar(scale);
|
|
71
|
+
}
|
|
72
|
+
(_gltf$scene$position = gltf.scene.position).set.apply(_gltf$scene$position, _toConsumableArray(position));
|
|
73
|
+
(_gltf$scene$rotation = gltf.scene.rotation).set.apply(_gltf$scene$rotation, _toConsumableArray(rotation));
|
|
74
|
+
|
|
75
|
+
// Configure shadows
|
|
76
|
+
gltf.scene.traverse(function (child) {
|
|
77
|
+
if (child.isMesh) {
|
|
78
|
+
child.castShadow = castShadow;
|
|
79
|
+
child.receiveShadow = receiveShadow;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
logger.info("\u2705 Model imported successfully: ".concat(url));
|
|
83
|
+
return _context.a(2, {
|
|
84
|
+
scene: gltf.scene,
|
|
85
|
+
animations: gltf.animations,
|
|
86
|
+
cameras: gltf.cameras,
|
|
87
|
+
asset: gltf.asset
|
|
88
|
+
});
|
|
89
|
+
case 3:
|
|
90
|
+
_context.p = 3;
|
|
91
|
+
_t = _context.v;
|
|
92
|
+
logger.error("\u274C Failed to import model ".concat(url, ":"), _t);
|
|
93
|
+
throw _t;
|
|
94
|
+
case 4:
|
|
95
|
+
return _context.a(2);
|
|
96
|
+
}
|
|
97
|
+
}, _callee, null, [[1, 3]]);
|
|
98
|
+
}));
|
|
99
|
+
function importModel(_x) {
|
|
100
|
+
return _importModel.apply(this, arguments);
|
|
101
|
+
}
|
|
102
|
+
return importModel;
|
|
103
|
+
}()
|
|
104
|
+
/**
|
|
105
|
+
* Import texture files
|
|
106
|
+
* @param {string|Array} urls - Single URL or array of texture URLs
|
|
107
|
+
* @returns {Promise<THREE.Texture|Array>} Loaded texture(s)
|
|
108
|
+
*/
|
|
109
|
+
)
|
|
110
|
+
}, {
|
|
111
|
+
key: "importTextures",
|
|
112
|
+
value: (function () {
|
|
113
|
+
var _importTextures = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(urls) {
|
|
114
|
+
var _this2 = this;
|
|
115
|
+
var urlArray, texturePromises, textures, _t2;
|
|
116
|
+
return _regenerator().w(function (_context2) {
|
|
117
|
+
while (1) switch (_context2.n) {
|
|
118
|
+
case 0:
|
|
119
|
+
urlArray = Array.isArray(urls) ? urls : [urls];
|
|
120
|
+
_context2.p = 1;
|
|
121
|
+
texturePromises = urlArray.map(function (url) {
|
|
122
|
+
return new Promise(function (resolve, reject) {
|
|
123
|
+
_this2.textureLoader.load(url, resolve, undefined, reject);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
_context2.n = 2;
|
|
127
|
+
return Promise.all(texturePromises);
|
|
128
|
+
case 2:
|
|
129
|
+
textures = _context2.v;
|
|
130
|
+
logger.info("\u2705 Imported ".concat(textures.length, " texture(s)"));
|
|
131
|
+
return _context2.a(2, Array.isArray(urls) ? textures : textures[0]);
|
|
132
|
+
case 3:
|
|
133
|
+
_context2.p = 3;
|
|
134
|
+
_t2 = _context2.v;
|
|
135
|
+
logger.error('❌ Failed to import textures:', _t2);
|
|
136
|
+
throw _t2;
|
|
137
|
+
case 4:
|
|
138
|
+
return _context2.a(2);
|
|
139
|
+
}
|
|
140
|
+
}, _callee2, null, [[1, 3]]);
|
|
141
|
+
}));
|
|
142
|
+
function importTextures(_x2) {
|
|
143
|
+
return _importTextures.apply(this, arguments);
|
|
144
|
+
}
|
|
145
|
+
return importTextures;
|
|
146
|
+
}()
|
|
147
|
+
/**
|
|
148
|
+
* Import scene configuration from JSON
|
|
149
|
+
* @param {string} url - Path to the scene JSON file
|
|
150
|
+
* @returns {Promise<Object>} Scene configuration
|
|
151
|
+
*/
|
|
152
|
+
)
|
|
153
|
+
}, {
|
|
154
|
+
key: "importSceneConfig",
|
|
155
|
+
value: (function () {
|
|
156
|
+
var _importSceneConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(url) {
|
|
157
|
+
var response, sceneData, requiredProps, _i, _requiredProps, prop, _t3;
|
|
158
|
+
return _regenerator().w(function (_context3) {
|
|
159
|
+
while (1) switch (_context3.n) {
|
|
160
|
+
case 0:
|
|
161
|
+
_context3.p = 0;
|
|
162
|
+
logger.info("\uD83D\uDD04 Importing scene config: ".concat(url));
|
|
163
|
+
_context3.n = 1;
|
|
164
|
+
return fetch(url);
|
|
165
|
+
case 1:
|
|
166
|
+
response = _context3.v;
|
|
167
|
+
if (response.ok) {
|
|
168
|
+
_context3.n = 2;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
throw new Error("HTTP ".concat(response.status, ": ").concat(response.statusText));
|
|
172
|
+
case 2:
|
|
173
|
+
_context3.n = 3;
|
|
174
|
+
return response.json();
|
|
175
|
+
case 3:
|
|
176
|
+
sceneData = _context3.v;
|
|
177
|
+
// Validate required scene properties
|
|
178
|
+
requiredProps = ['scene', 'connections'];
|
|
179
|
+
for (_i = 0, _requiredProps = requiredProps; _i < _requiredProps.length; _i++) {
|
|
180
|
+
prop = _requiredProps[_i];
|
|
181
|
+
if (!sceneData[prop]) {
|
|
182
|
+
logger.warn("\u26A0\uFE0F Missing required property: ".concat(prop));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
logger.info("\u2705 Scene config imported: ".concat(url));
|
|
186
|
+
return _context3.a(2, sceneData);
|
|
187
|
+
case 4:
|
|
188
|
+
_context3.p = 4;
|
|
189
|
+
_t3 = _context3.v;
|
|
190
|
+
logger.error("\u274C Failed to import scene config ".concat(url, ":"), _t3);
|
|
191
|
+
throw _t3;
|
|
192
|
+
case 5:
|
|
193
|
+
return _context3.a(2);
|
|
194
|
+
}
|
|
195
|
+
}, _callee3, null, [[0, 4]]);
|
|
196
|
+
}));
|
|
197
|
+
function importSceneConfig(_x3) {
|
|
198
|
+
return _importSceneConfig.apply(this, arguments);
|
|
199
|
+
}
|
|
200
|
+
return importSceneConfig;
|
|
201
|
+
}()
|
|
202
|
+
/**
|
|
203
|
+
* Import multiple files in batch
|
|
204
|
+
* @param {Array} fileList - Array of file objects with {url, type, options}
|
|
205
|
+
* @returns {Promise<Array>} Array of imported data
|
|
206
|
+
*/
|
|
207
|
+
)
|
|
208
|
+
}, {
|
|
209
|
+
key: "importBatch",
|
|
210
|
+
value: (function () {
|
|
211
|
+
var _importBatch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(fileList) {
|
|
212
|
+
var results, errors, _iterator, _step, file, result, _t4, _t5, _t6;
|
|
213
|
+
return _regenerator().w(function (_context4) {
|
|
214
|
+
while (1) switch (_context4.n) {
|
|
215
|
+
case 0:
|
|
216
|
+
logger.info("\uD83D\uDD04 Starting batch import of ".concat(fileList.length, " files"));
|
|
217
|
+
results = [];
|
|
218
|
+
errors = [];
|
|
219
|
+
_iterator = _createForOfIteratorHelper(fileList);
|
|
220
|
+
_context4.p = 1;
|
|
221
|
+
_iterator.s();
|
|
222
|
+
case 2:
|
|
223
|
+
if ((_step = _iterator.n()).done) {
|
|
224
|
+
_context4.n = 14;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
file = _step.value;
|
|
228
|
+
_context4.p = 3;
|
|
229
|
+
result = void 0;
|
|
230
|
+
_t4 = file.type;
|
|
231
|
+
_context4.n = _t4 === 'model' ? 4 : _t4 === 'texture' ? 6 : _t4 === 'scene' ? 8 : 10;
|
|
232
|
+
break;
|
|
233
|
+
case 4:
|
|
234
|
+
_context4.n = 5;
|
|
235
|
+
return this.importModel(file.url, file.options);
|
|
236
|
+
case 5:
|
|
237
|
+
result = _context4.v;
|
|
238
|
+
return _context4.a(3, 11);
|
|
239
|
+
case 6:
|
|
240
|
+
_context4.n = 7;
|
|
241
|
+
return this.importTextures(file.url);
|
|
242
|
+
case 7:
|
|
243
|
+
result = _context4.v;
|
|
244
|
+
return _context4.a(3, 11);
|
|
245
|
+
case 8:
|
|
246
|
+
_context4.n = 9;
|
|
247
|
+
return this.importSceneConfig(file.url);
|
|
248
|
+
case 9:
|
|
249
|
+
result = _context4.v;
|
|
250
|
+
return _context4.a(3, 11);
|
|
251
|
+
case 10:
|
|
252
|
+
throw new Error("Unknown import type: ".concat(file.type));
|
|
253
|
+
case 11:
|
|
254
|
+
results.push({
|
|
255
|
+
url: file.url,
|
|
256
|
+
type: file.type,
|
|
257
|
+
data: result
|
|
258
|
+
});
|
|
259
|
+
_context4.n = 13;
|
|
260
|
+
break;
|
|
261
|
+
case 12:
|
|
262
|
+
_context4.p = 12;
|
|
263
|
+
_t5 = _context4.v;
|
|
264
|
+
errors.push({
|
|
265
|
+
url: file.url,
|
|
266
|
+
type: file.type,
|
|
267
|
+
error: _t5
|
|
268
|
+
});
|
|
269
|
+
logger.error("\u274C Failed to import ".concat(file.url, ":"), _t5);
|
|
270
|
+
case 13:
|
|
271
|
+
_context4.n = 2;
|
|
272
|
+
break;
|
|
273
|
+
case 14:
|
|
274
|
+
_context4.n = 16;
|
|
275
|
+
break;
|
|
276
|
+
case 15:
|
|
277
|
+
_context4.p = 15;
|
|
278
|
+
_t6 = _context4.v;
|
|
279
|
+
_iterator.e(_t6);
|
|
280
|
+
case 16:
|
|
281
|
+
_context4.p = 16;
|
|
282
|
+
_iterator.f();
|
|
283
|
+
return _context4.f(16);
|
|
284
|
+
case 17:
|
|
285
|
+
logger.info("\u2705 Batch import complete: ".concat(results.length, " successful, ").concat(errors.length, " failed"));
|
|
286
|
+
return _context4.a(2, {
|
|
287
|
+
results: results,
|
|
288
|
+
errors: errors
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}, _callee4, this, [[3, 12], [1, 15, 16, 17]]);
|
|
292
|
+
}));
|
|
293
|
+
function importBatch(_x4) {
|
|
294
|
+
return _importBatch.apply(this, arguments);
|
|
295
|
+
}
|
|
296
|
+
return importBatch;
|
|
297
|
+
}()
|
|
298
|
+
/**
|
|
299
|
+
* Check if file format is supported
|
|
300
|
+
* @param {string} filename - Name of the file
|
|
301
|
+
* @param {string} category - Category to check (models, textures, scenes, configs)
|
|
302
|
+
* @returns {boolean} Whether format is supported
|
|
303
|
+
*/
|
|
304
|
+
)
|
|
305
|
+
}, {
|
|
306
|
+
key: "isFormatSupported",
|
|
307
|
+
value: function isFormatSupported(filename, category) {
|
|
308
|
+
var _this$supportedFormat;
|
|
309
|
+
var extension = '.' + filename.split('.').pop().toLowerCase();
|
|
310
|
+
return ((_this$supportedFormat = this.supportedFormats[category]) === null || _this$supportedFormat === void 0 ? void 0 : _this$supportedFormat.includes(extension)) || false;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Get file format information
|
|
315
|
+
* @param {string} filename - Name of the file
|
|
316
|
+
* @returns {Object} Format information
|
|
317
|
+
*/
|
|
318
|
+
}, {
|
|
319
|
+
key: "getFormatInfo",
|
|
320
|
+
value: function getFormatInfo(filename) {
|
|
321
|
+
var extension = '.' + filename.split('.').pop().toLowerCase();
|
|
322
|
+
for (var _i2 = 0, _Object$entries = Object.entries(this.supportedFormats); _i2 < _Object$entries.length; _i2++) {
|
|
323
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
|
|
324
|
+
category = _Object$entries$_i[0],
|
|
325
|
+
formats = _Object$entries$_i[1];
|
|
326
|
+
if (formats.includes(extension)) {
|
|
327
|
+
return {
|
|
328
|
+
category: category,
|
|
329
|
+
extension: extension,
|
|
330
|
+
supported: true
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
category: 'unknown',
|
|
336
|
+
extension: extension,
|
|
337
|
+
supported: false
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Dispose of loaders and free memory
|
|
343
|
+
*/
|
|
344
|
+
}, {
|
|
345
|
+
key: "dispose",
|
|
346
|
+
value: function dispose() {
|
|
347
|
+
// Clean up loaders if they have dispose methods
|
|
348
|
+
if (this.dracoLoader.dispose) {
|
|
349
|
+
this.dracoLoader.dispose();
|
|
350
|
+
}
|
|
351
|
+
logger.info('Import disposed');
|
|
352
|
+
}
|
|
353
|
+
}]);
|
|
354
|
+
}();
|
|
355
|
+
|
|
356
|
+
export { Import };
|