@2112-lab/central-plant 0.1.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 +0 -0
- package/dist/bundle/index.js +14259 -0
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +353 -0
- package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1292 -0
- package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +1543 -0
- package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4374 -0
- package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +465 -0
- package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +117 -0
- package/dist/cjs/src/ConnectionManager.js +114 -0
- package/dist/cjs/src/Pathfinder.js +88 -0
- package/dist/cjs/src/animationManager.js +121 -0
- package/dist/cjs/src/componentManager.js +151 -0
- package/dist/cjs/src/debugLogger.js +176 -0
- package/dist/cjs/src/disposalManager.js +185 -0
- package/dist/cjs/src/environmentManager.js +1015 -0
- package/dist/cjs/src/hotReloadManager.js +252 -0
- package/dist/cjs/src/index.js +126 -0
- package/dist/cjs/src/keyboardControlsManager.js +206 -0
- package/dist/cjs/src/modelPreloader.js +360 -0
- package/dist/cjs/src/nameUtils.js +106 -0
- package/dist/cjs/src/pathfindingManager.js +321 -0
- package/dist/cjs/src/performanceMonitor.js +718 -0
- package/dist/cjs/src/sceneExportManager.js +292 -0
- package/dist/cjs/src/sceneInitializationManager.js +540 -0
- package/dist/cjs/src/sceneOperationsManager.js +560 -0
- package/dist/cjs/src/textureConfig.js +195 -0
- package/dist/cjs/src/transformControlsManager.js +851 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +328 -0
- package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1287 -0
- package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +1537 -0
- package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4370 -0
- package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +461 -0
- package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +113 -0
- package/dist/esm/src/ConnectionManager.js +110 -0
- package/dist/esm/src/Pathfinder.js +84 -0
- package/dist/esm/src/animationManager.js +112 -0
- package/dist/esm/src/componentManager.js +123 -0
- package/dist/esm/src/debugLogger.js +167 -0
- package/dist/esm/src/disposalManager.js +155 -0
- package/dist/esm/src/environmentManager.js +989 -0
- package/dist/esm/src/hotReloadManager.js +244 -0
- package/dist/esm/src/index.js +117 -0
- package/dist/esm/src/keyboardControlsManager.js +196 -0
- package/dist/esm/src/modelPreloader.js +337 -0
- package/dist/esm/src/nameUtils.js +99 -0
- package/dist/esm/src/pathfindingManager.js +295 -0
- package/dist/esm/src/performanceMonitor.js +712 -0
- package/dist/esm/src/sceneExportManager.js +286 -0
- package/dist/esm/src/sceneInitializationManager.js +513 -0
- package/dist/esm/src/sceneOperationsManager.js +536 -0
- package/dist/esm/src/textureConfig.js +168 -0
- package/dist/esm/src/transformControlsManager.js +827 -0
- package/dist/index.d.ts +259 -0
- package/package.json +53 -0
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import { createClass as _createClass, asyncToGenerator as _asyncToGenerator, regenerator as _regenerator, classCallCheck as _classCallCheck } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { logger } from './debugLogger.js';
|
|
4
|
+
|
|
5
|
+
// These will be loaded dynamically in browser environments
|
|
6
|
+
var OrbitControls;
|
|
7
|
+
var GLTFLoader;
|
|
8
|
+
var PerformanceMonitor;
|
|
9
|
+
var PerformanceUI;
|
|
10
|
+
|
|
11
|
+
// Dynamic imports for browser compatibility
|
|
12
|
+
function importThreeJSDependencies() {
|
|
13
|
+
return _importThreeJSDependencies.apply(this, arguments);
|
|
14
|
+
}
|
|
15
|
+
function _importThreeJSDependencies() {
|
|
16
|
+
_importThreeJSDependencies = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
17
|
+
var orbitModule, customModule, gltfModule, perfModule, _t, _t3, _t4;
|
|
18
|
+
return _regenerator().w(function (_context4) {
|
|
19
|
+
while (1) switch (_context4.n) {
|
|
20
|
+
case 0:
|
|
21
|
+
if (!(typeof window !== 'undefined')) {
|
|
22
|
+
_context4.n = 15;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
_context4.p = 1;
|
|
26
|
+
_context4.p = 2;
|
|
27
|
+
_context4.n = 3;
|
|
28
|
+
return import('../node_modules/three/examples/jsm/controls/OrbitControls.js');
|
|
29
|
+
case 3:
|
|
30
|
+
orbitModule = _context4.v;
|
|
31
|
+
OrbitControls = orbitModule.OrbitControls;
|
|
32
|
+
_context4.n = 9;
|
|
33
|
+
break;
|
|
34
|
+
case 4:
|
|
35
|
+
_context4.p = 4;
|
|
36
|
+
_t = _context4.v;
|
|
37
|
+
console.warn('OrbitControls not loaded:', _t.message);
|
|
38
|
+
// Fallback for OrbitControls - may be needed in some bundlers
|
|
39
|
+
_context4.p = 5;
|
|
40
|
+
if (!(typeof window.__orbitControlsCustomPath === 'string')) {
|
|
41
|
+
_context4.n = 7;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
_context4.n = 6;
|
|
45
|
+
return import(window.__orbitControlsCustomPath);
|
|
46
|
+
case 6:
|
|
47
|
+
customModule = _context4.v;
|
|
48
|
+
OrbitControls = customModule.OrbitControls;
|
|
49
|
+
case 7:
|
|
50
|
+
_context4.n = 9;
|
|
51
|
+
break;
|
|
52
|
+
case 8:
|
|
53
|
+
_context4.p = 8;
|
|
54
|
+
_context4.v;
|
|
55
|
+
console.warn('Failed to load OrbitControls from custom path');
|
|
56
|
+
case 9:
|
|
57
|
+
_context4.p = 9;
|
|
58
|
+
_context4.n = 10;
|
|
59
|
+
return import('../node_modules/three/examples/jsm/loaders/GLTFLoader.js');
|
|
60
|
+
case 10:
|
|
61
|
+
gltfModule = _context4.v;
|
|
62
|
+
GLTFLoader = gltfModule.GLTFLoader;
|
|
63
|
+
_context4.n = 12;
|
|
64
|
+
break;
|
|
65
|
+
case 11:
|
|
66
|
+
_context4.p = 11;
|
|
67
|
+
_t3 = _context4.v;
|
|
68
|
+
console.warn('GLTFLoader not loaded:', _t3.message);
|
|
69
|
+
case 12:
|
|
70
|
+
_context4.n = 13;
|
|
71
|
+
return import('./performanceMonitor.js');
|
|
72
|
+
case 13:
|
|
73
|
+
perfModule = _context4.v;
|
|
74
|
+
PerformanceMonitor = perfModule.PerformanceMonitor;
|
|
75
|
+
PerformanceUI = perfModule.PerformanceUI;
|
|
76
|
+
_context4.n = 15;
|
|
77
|
+
break;
|
|
78
|
+
case 14:
|
|
79
|
+
_context4.p = 14;
|
|
80
|
+
_t4 = _context4.v;
|
|
81
|
+
console.error('Failed to load Three.js dependencies:', _t4);
|
|
82
|
+
case 15:
|
|
83
|
+
return _context4.a(2);
|
|
84
|
+
}
|
|
85
|
+
}, _callee4, null, [[9, 11], [5, 8], [2, 4], [1, 14]]);
|
|
86
|
+
}));
|
|
87
|
+
return _importThreeJSDependencies.apply(this, arguments);
|
|
88
|
+
}
|
|
89
|
+
var SceneInitializationManager = /*#__PURE__*/function () {
|
|
90
|
+
function SceneInitializationManager(component) {
|
|
91
|
+
_classCallCheck(this, SceneInitializationManager);
|
|
92
|
+
this.component = component;
|
|
93
|
+
this.textureLoader = null;
|
|
94
|
+
this.gltfLoader = null;
|
|
95
|
+
|
|
96
|
+
// Initialize dependencies
|
|
97
|
+
importThreeJSDependencies();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Initialize the Three.js scene, camera, and renderer
|
|
102
|
+
*/
|
|
103
|
+
return _createClass(SceneInitializationManager, [{
|
|
104
|
+
key: "initializeScene",
|
|
105
|
+
value: (function () {
|
|
106
|
+
var _initializeScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
107
|
+
var _component$$refs, _component$$refs2;
|
|
108
|
+
var component, containerRect, containerWidth, containerHeight;
|
|
109
|
+
return _regenerator().w(function (_context) {
|
|
110
|
+
while (1) switch (_context.n) {
|
|
111
|
+
case 0:
|
|
112
|
+
component = this.component;
|
|
113
|
+
if (component) {
|
|
114
|
+
_context.n = 1;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
logger.error('Cannot initialize scene: component not available');
|
|
118
|
+
return _context.a(2);
|
|
119
|
+
case 1:
|
|
120
|
+
// Create scene
|
|
121
|
+
component.scene = new THREE.Scene();
|
|
122
|
+
|
|
123
|
+
// Create camera (default values, can be updated later)
|
|
124
|
+
containerRect = ((_component$$refs = component.$refs) === null || _component$$refs === void 0 || (_component$$refs = _component$$refs.container) === null || _component$$refs === void 0 ? void 0 : _component$$refs.getBoundingClientRect()) || {
|
|
125
|
+
width: 800,
|
|
126
|
+
height: 600
|
|
127
|
+
};
|
|
128
|
+
containerWidth = containerRect.width;
|
|
129
|
+
containerHeight = containerRect.height;
|
|
130
|
+
component.camera = new THREE.PerspectiveCamera(50, containerWidth / containerHeight, 0.01, 1000);
|
|
131
|
+
component.camera.position.set(-8, 4, 9);
|
|
132
|
+
|
|
133
|
+
// Setup renderer if container exists
|
|
134
|
+
if (!((_component$$refs2 = component.$refs) !== null && _component$$refs2 !== void 0 && _component$$refs2.container)) {
|
|
135
|
+
_context.n = 2;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
_context.n = 2;
|
|
139
|
+
return this.setupRenderer(component.$refs.container, containerWidth, containerHeight);
|
|
140
|
+
case 2:
|
|
141
|
+
logger.info('Scene and camera initialized');
|
|
142
|
+
return _context.a(2, {
|
|
143
|
+
scene: component.scene,
|
|
144
|
+
camera: component.camera
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}, _callee, this);
|
|
148
|
+
}));
|
|
149
|
+
function initializeScene() {
|
|
150
|
+
return _initializeScene.apply(this, arguments);
|
|
151
|
+
}
|
|
152
|
+
return initializeScene;
|
|
153
|
+
}()
|
|
154
|
+
/**
|
|
155
|
+
* Setup the WebGL renderer
|
|
156
|
+
*/
|
|
157
|
+
)
|
|
158
|
+
}, {
|
|
159
|
+
key: "setupRenderer",
|
|
160
|
+
value: (function () {
|
|
161
|
+
var _setupRenderer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(container, width, height) {
|
|
162
|
+
var component, containerRect;
|
|
163
|
+
return _regenerator().w(function (_context2) {
|
|
164
|
+
while (1) switch (_context2.n) {
|
|
165
|
+
case 0:
|
|
166
|
+
component = this.component;
|
|
167
|
+
if (component) {
|
|
168
|
+
_context2.n = 1;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
logger.error('Cannot setup renderer: component not available');
|
|
172
|
+
return _context2.a(2, null);
|
|
173
|
+
case 1:
|
|
174
|
+
// Use provided dimensions or get from container
|
|
175
|
+
if (!width || !height) {
|
|
176
|
+
containerRect = container.getBoundingClientRect();
|
|
177
|
+
width = containerRect.width;
|
|
178
|
+
height = containerRect.height;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Create renderer
|
|
182
|
+
component.renderer = new THREE.WebGLRenderer({
|
|
183
|
+
antialias: true
|
|
184
|
+
});
|
|
185
|
+
component.renderer.setSize(width, height);
|
|
186
|
+
component.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
187
|
+
component.renderer.shadowMap.enabled = true;
|
|
188
|
+
component.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
189
|
+
component.renderer.physicallyCorrectLights = true;
|
|
190
|
+
component.renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
191
|
+
component.renderer.toneMapping = THREE.LinearToneMapping;
|
|
192
|
+
component.renderer.toneMappingExposure = 1.5;
|
|
193
|
+
|
|
194
|
+
// Add renderer to container
|
|
195
|
+
container.appendChild(component.renderer.domElement);
|
|
196
|
+
|
|
197
|
+
// Setup resize handler
|
|
198
|
+
this.setupResizeHandler();
|
|
199
|
+
|
|
200
|
+
// Create texture and model loaders
|
|
201
|
+
component.textureLoader = new THREE.TextureLoader();
|
|
202
|
+
this.textureLoader = component.textureLoader;
|
|
203
|
+
|
|
204
|
+
// Initialize GLTF loader if available
|
|
205
|
+
if (!GLTFLoader) {
|
|
206
|
+
_context2.n = 2;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
component.gltfLoader = new GLTFLoader();
|
|
210
|
+
this.gltfLoader = component.gltfLoader;
|
|
211
|
+
_context2.n = 4;
|
|
212
|
+
break;
|
|
213
|
+
case 2:
|
|
214
|
+
_context2.n = 3;
|
|
215
|
+
return importThreeJSDependencies();
|
|
216
|
+
case 3:
|
|
217
|
+
if (GLTFLoader) {
|
|
218
|
+
component.gltfLoader = new GLTFLoader();
|
|
219
|
+
this.gltfLoader = component.gltfLoader;
|
|
220
|
+
}
|
|
221
|
+
case 4:
|
|
222
|
+
logger.info('Renderer initialized');
|
|
223
|
+
return _context2.a(2, component.renderer);
|
|
224
|
+
}
|
|
225
|
+
}, _callee2, this);
|
|
226
|
+
}));
|
|
227
|
+
function setupRenderer(_x, _x2, _x3) {
|
|
228
|
+
return _setupRenderer.apply(this, arguments);
|
|
229
|
+
}
|
|
230
|
+
return setupRenderer;
|
|
231
|
+
}()
|
|
232
|
+
/**
|
|
233
|
+
* Setup orbit controls
|
|
234
|
+
*/
|
|
235
|
+
)
|
|
236
|
+
}, {
|
|
237
|
+
key: "setupControls",
|
|
238
|
+
value: function setupControls(container) {
|
|
239
|
+
var _this = this;
|
|
240
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
241
|
+
var component = this.component;
|
|
242
|
+
if (!component || !component.camera || !component.renderer) {
|
|
243
|
+
logger.error('Cannot setup controls: camera or renderer not available');
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Initialize OrbitControls if available
|
|
248
|
+
if (!OrbitControls) {
|
|
249
|
+
logger.info('OrbitControls not available, will try to import');
|
|
250
|
+
importThreeJSDependencies().then(function () {
|
|
251
|
+
if (OrbitControls) {
|
|
252
|
+
_this.setupControlsInternal(container, options);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
return this.setupControlsInternal(container, options);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Internal method to setup controls after dependencies are loaded
|
|
262
|
+
*/
|
|
263
|
+
}, {
|
|
264
|
+
key: "setupControlsInternal",
|
|
265
|
+
value: function setupControlsInternal(container) {
|
|
266
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
267
|
+
var component = this.component;
|
|
268
|
+
var domElement = container || component.renderer.domElement;
|
|
269
|
+
|
|
270
|
+
// Create controls
|
|
271
|
+
component.controls = new OrbitControls(component.camera, domElement);
|
|
272
|
+
|
|
273
|
+
// Apply options
|
|
274
|
+
component.controls.enableDamping = options.enableDamping !== false;
|
|
275
|
+
component.controls.dampingFactor = options.dampingFactor || 0.05;
|
|
276
|
+
component.controls.screenSpacePanning = options.screenSpacePanning !== false;
|
|
277
|
+
component.controls.maxPolarAngle = options.maxPolarAngle || Math.PI / 1.5;
|
|
278
|
+
component.controls.minDistance = options.minDistance || 2;
|
|
279
|
+
component.controls.maxDistance = options.maxDistance || 50;
|
|
280
|
+
|
|
281
|
+
// Additional options if provided
|
|
282
|
+
if (options.target) {
|
|
283
|
+
component.controls.target.copy(options.target);
|
|
284
|
+
}
|
|
285
|
+
if (options.autoRotate) {
|
|
286
|
+
component.controls.autoRotate = true;
|
|
287
|
+
component.controls.autoRotateSpeed = options.autoRotateSpeed || 1.0;
|
|
288
|
+
}
|
|
289
|
+
logger.info('Orbit controls initialized');
|
|
290
|
+
return component.controls;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Initialize performance monitoring
|
|
295
|
+
*/
|
|
296
|
+
}, {
|
|
297
|
+
key: "initializePerformanceMonitoring",
|
|
298
|
+
value: (function () {
|
|
299
|
+
var _initializePerformanceMonitoring = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
300
|
+
var _component$$refs3;
|
|
301
|
+
var component;
|
|
302
|
+
return _regenerator().w(function (_context3) {
|
|
303
|
+
while (1) switch (_context3.n) {
|
|
304
|
+
case 0:
|
|
305
|
+
component = this.component;
|
|
306
|
+
if (!(!component || !component.renderer)) {
|
|
307
|
+
_context3.n = 1;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
logger.error('Cannot initialize performance monitoring: renderer not available');
|
|
311
|
+
return _context3.a(2);
|
|
312
|
+
case 1:
|
|
313
|
+
if (PerformanceMonitor) {
|
|
314
|
+
_context3.n = 3;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
_context3.n = 2;
|
|
318
|
+
return importThreeJSDependencies();
|
|
319
|
+
case 2:
|
|
320
|
+
if (PerformanceMonitor) {
|
|
321
|
+
_context3.n = 3;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
logger.error('Performance monitoring not available');
|
|
325
|
+
return _context3.a(2);
|
|
326
|
+
case 3:
|
|
327
|
+
// Initialize performance monitoring
|
|
328
|
+
component.performanceMonitor = new PerformanceMonitor(component.renderer);
|
|
329
|
+
if ((_component$$refs3 = component.$refs) !== null && _component$$refs3 !== void 0 && _component$$refs3.container) {
|
|
330
|
+
component.performanceUI = new PerformanceUI(component.performanceMonitor, component.$refs.container, 'light');
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Setup performance monitoring callbacks
|
|
334
|
+
component.performanceMonitor.on('warning', function (warnings) {
|
|
335
|
+
// logger.warn('Performance warnings:', warnings);
|
|
336
|
+
});
|
|
337
|
+
component.performanceMonitor.start();
|
|
338
|
+
if (component.performanceUI) {
|
|
339
|
+
component.performanceUI.show();
|
|
340
|
+
}
|
|
341
|
+
this.exposePerformanceMonitoringGlobally();
|
|
342
|
+
logger.info('Performance monitoring initialized');
|
|
343
|
+
return _context3.a(2, {
|
|
344
|
+
monitor: component.performanceMonitor,
|
|
345
|
+
ui: component.performanceUI
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}, _callee3, this);
|
|
349
|
+
}));
|
|
350
|
+
function initializePerformanceMonitoring() {
|
|
351
|
+
return _initializePerformanceMonitoring.apply(this, arguments);
|
|
352
|
+
}
|
|
353
|
+
return initializePerformanceMonitoring;
|
|
354
|
+
}()
|
|
355
|
+
/**
|
|
356
|
+
* Expose performance monitoring to global scope for debugging
|
|
357
|
+
*/
|
|
358
|
+
)
|
|
359
|
+
}, {
|
|
360
|
+
key: "exposePerformanceMonitoringGlobally",
|
|
361
|
+
value: function exposePerformanceMonitoringGlobally() {
|
|
362
|
+
var component = this.component;
|
|
363
|
+
if (!component || !component.performanceMonitor) return;
|
|
364
|
+
if (typeof window !== 'undefined') {
|
|
365
|
+
window._performanceMonitor = component.performanceMonitor;
|
|
366
|
+
window._performanceUI = component.performanceUI;
|
|
367
|
+
window.performance3D = {
|
|
368
|
+
show: function show() {
|
|
369
|
+
var _component$performanc;
|
|
370
|
+
return (_component$performanc = component.performanceUI) === null || _component$performanc === void 0 ? void 0 : _component$performanc.show();
|
|
371
|
+
},
|
|
372
|
+
hide: function hide() {
|
|
373
|
+
var _component$performanc2;
|
|
374
|
+
return (_component$performanc2 = component.performanceUI) === null || _component$performanc2 === void 0 ? void 0 : _component$performanc2.hide();
|
|
375
|
+
},
|
|
376
|
+
toggle: function toggle() {
|
|
377
|
+
var _component$performanc3, _component$performanc4, _component$performanc5;
|
|
378
|
+
return (_component$performanc3 = component.performanceUI) !== null && _component$performanc3 !== void 0 && _component$performanc3.isVisible ? (_component$performanc4 = component.performanceUI) === null || _component$performanc4 === void 0 ? void 0 : _component$performanc4.hide() : (_component$performanc5 = component.performanceUI) === null || _component$performanc5 === void 0 ? void 0 : _component$performanc5.show();
|
|
379
|
+
},
|
|
380
|
+
setTheme: function setTheme(theme) {
|
|
381
|
+
var _component$performanc6;
|
|
382
|
+
return (_component$performanc6 = component.performanceUI) === null || _component$performanc6 === void 0 ? void 0 : _component$performanc6.setTheme(theme);
|
|
383
|
+
},
|
|
384
|
+
log: function log() {
|
|
385
|
+
var _component$performanc7;
|
|
386
|
+
return (_component$performanc7 = component.performanceMonitor) === null || _component$performanc7 === void 0 ? void 0 : _component$performanc7.logSummary();
|
|
387
|
+
},
|
|
388
|
+
reset: function reset() {
|
|
389
|
+
var _component$performanc8;
|
|
390
|
+
return (_component$performanc8 = component.performanceMonitor) === null || _component$performanc8 === void 0 ? void 0 : _component$performanc8.reset();
|
|
391
|
+
},
|
|
392
|
+
export: function _export() {
|
|
393
|
+
var _component$performanc9;
|
|
394
|
+
return (_component$performanc9 = component.performanceMonitor) === null || _component$performanc9 === void 0 ? void 0 : _component$performanc9.exportData();
|
|
395
|
+
},
|
|
396
|
+
help: function help() {
|
|
397
|
+
console.group('🔧 Performance Monitor Controls');
|
|
398
|
+
console.log('📊 performance3D.show() - Show performance UI');
|
|
399
|
+
console.log('🙈 performance3D.hide() - Hide performance UI');
|
|
400
|
+
console.log('🔄 performance3D.toggle() - Toggle performance UI');
|
|
401
|
+
console.log('🎨 performance3D.setTheme("light"|"dark") - Set UI theme');
|
|
402
|
+
console.log('📋 performance3D.log() - Log performance summary');
|
|
403
|
+
console.log('🔄 performance3D.reset() - Reset statistics');
|
|
404
|
+
console.log('💾 performance3D.export() - Export performance data');
|
|
405
|
+
console.log('❓ performance3D.help() - Show this help');
|
|
406
|
+
console.groupEnd();
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
logger.info('Performance monitoring exposed to global scope');
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Setup resize handler for responsive rendering
|
|
415
|
+
*/
|
|
416
|
+
}, {
|
|
417
|
+
key: "setupResizeHandler",
|
|
418
|
+
value: function setupResizeHandler() {
|
|
419
|
+
var _component$$refs4;
|
|
420
|
+
var component = this.component;
|
|
421
|
+
if (!component || !((_component$$refs4 = component.$refs) !== null && _component$$refs4 !== void 0 && _component$$refs4.container)) return;
|
|
422
|
+
var handleResize = function handleResize() {
|
|
423
|
+
if (!component.renderer || !component.camera) return;
|
|
424
|
+
|
|
425
|
+
// Get container dimensions
|
|
426
|
+
var container = component.$refs.container;
|
|
427
|
+
var width = container.clientWidth;
|
|
428
|
+
var height = container.clientHeight;
|
|
429
|
+
|
|
430
|
+
// Update camera
|
|
431
|
+
component.camera.aspect = width / height;
|
|
432
|
+
component.camera.updateProjectionMatrix();
|
|
433
|
+
|
|
434
|
+
// Update renderer
|
|
435
|
+
component.renderer.setSize(width, height);
|
|
436
|
+
component.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
// Initial setup
|
|
440
|
+
handleResize();
|
|
441
|
+
|
|
442
|
+
// Add event listener
|
|
443
|
+
window.addEventListener('resize', handleResize);
|
|
444
|
+
|
|
445
|
+
// Store resize handler for cleanup
|
|
446
|
+
this._resizeHandler = handleResize;
|
|
447
|
+
logger.info('Resize handler initialized');
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Cleanup resize handler
|
|
452
|
+
*/
|
|
453
|
+
}, {
|
|
454
|
+
key: "cleanupResizeHandler",
|
|
455
|
+
value: function cleanupResizeHandler() {
|
|
456
|
+
if (this._resizeHandler) {
|
|
457
|
+
window.removeEventListener('resize', this._resizeHandler);
|
|
458
|
+
this._resizeHandler = null;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}]);
|
|
462
|
+
}();
|
|
463
|
+
|
|
464
|
+
// Create a singleton instance
|
|
465
|
+
var sceneInitializationManager = null;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Get the global scene initialization manager instance
|
|
469
|
+
*/
|
|
470
|
+
function getSceneInitializationManager() {
|
|
471
|
+
var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
472
|
+
if (!sceneInitializationManager || component && sceneInitializationManager.component !== component) {
|
|
473
|
+
sceneInitializationManager = new SceneInitializationManager(component);
|
|
474
|
+
}
|
|
475
|
+
return sceneInitializationManager;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Common initialization function
|
|
479
|
+
function setupScene(_x4, _x5) {
|
|
480
|
+
return _setupScene.apply(this, arguments);
|
|
481
|
+
}
|
|
482
|
+
function _setupScene() {
|
|
483
|
+
_setupScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(component, container) {
|
|
484
|
+
var manager;
|
|
485
|
+
return _regenerator().w(function (_context5) {
|
|
486
|
+
while (1) switch (_context5.n) {
|
|
487
|
+
case 0:
|
|
488
|
+
manager = getSceneInitializationManager(component);
|
|
489
|
+
_context5.n = 1;
|
|
490
|
+
return manager.initializeScene();
|
|
491
|
+
case 1:
|
|
492
|
+
if (!container) {
|
|
493
|
+
_context5.n = 3;
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
_context5.n = 2;
|
|
497
|
+
return manager.setupRenderer(container);
|
|
498
|
+
case 2:
|
|
499
|
+
manager.setupControls(container);
|
|
500
|
+
case 3:
|
|
501
|
+
return _context5.a(2, manager);
|
|
502
|
+
}
|
|
503
|
+
}, _callee5);
|
|
504
|
+
}));
|
|
505
|
+
return _setupScene.apply(this, arguments);
|
|
506
|
+
}
|
|
507
|
+
var sceneInitializationManager$1 = {
|
|
508
|
+
SceneInitializationManager: SceneInitializationManager,
|
|
509
|
+
getSceneInitializationManager: getSceneInitializationManager,
|
|
510
|
+
setupScene: setupScene
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
export { SceneInitializationManager, sceneInitializationManager$1 as default, getSceneInitializationManager, setupScene };
|