@2112-lab/central-plant 0.1.1 → 0.1.3

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.
Files changed (55) hide show
  1. package/dist/bundle/index.js +1 -15140
  2. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -353
  3. package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -0
  4. package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1292
  5. package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +1 -1543
  6. package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4374
  7. package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -465
  8. package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -117
  9. package/dist/cjs/src/animationManager.js +1 -121
  10. package/dist/cjs/src/componentManager.js +1 -151
  11. package/dist/cjs/src/debugLogger.js +1 -176
  12. package/dist/cjs/src/disposalManager.js +1 -185
  13. package/dist/cjs/src/environmentManager.js +1 -1308
  14. package/dist/cjs/src/hotReloadManager.js +1 -252
  15. package/dist/cjs/src/index.js +1 -128
  16. package/dist/cjs/src/keyboardControlsManager.js +1 -206
  17. package/dist/cjs/src/nameUtils.js +1 -106
  18. package/dist/cjs/src/pathfindingManager.js +1 -321
  19. package/dist/cjs/src/performanceMonitor.js +1 -718
  20. package/dist/cjs/src/sceneExportManager.js +1 -292
  21. package/dist/cjs/src/sceneInitializationManager.js +1 -540
  22. package/dist/cjs/src/textureConfig.js +1 -624
  23. package/dist/cjs/src/transformControlsManager.js +1 -851
  24. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -328
  25. package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -0
  26. package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1287
  27. package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +1 -1537
  28. package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4370
  29. package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -461
  30. package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -113
  31. package/dist/esm/src/animationManager.js +1 -112
  32. package/dist/esm/src/componentManager.js +1 -123
  33. package/dist/esm/src/debugLogger.js +1 -167
  34. package/dist/esm/src/disposalManager.js +1 -155
  35. package/dist/esm/src/environmentManager.js +1 -1282
  36. package/dist/esm/src/hotReloadManager.js +1 -244
  37. package/dist/esm/src/index.js +1 -118
  38. package/dist/esm/src/keyboardControlsManager.js +1 -196
  39. package/dist/esm/src/nameUtils.js +1 -99
  40. package/dist/esm/src/pathfindingManager.js +1 -295
  41. package/dist/esm/src/performanceMonitor.js +1 -712
  42. package/dist/esm/src/sceneExportManager.js +1 -286
  43. package/dist/esm/src/sceneInitializationManager.js +1 -513
  44. package/dist/esm/src/textureConfig.js +1 -595
  45. package/dist/esm/src/transformControlsManager.js +1 -827
  46. package/dist/index.d.ts +0 -4
  47. package/package.json +1 -1
  48. package/dist/cjs/src/ConnectionManager.js +0 -114
  49. package/dist/cjs/src/Pathfinder.js +0 -88
  50. package/dist/cjs/src/modelPreloader.js +0 -488
  51. package/dist/cjs/src/sceneOperationsManager.js +0 -596
  52. package/dist/esm/src/ConnectionManager.js +0 -110
  53. package/dist/esm/src/Pathfinder.js +0 -84
  54. package/dist/esm/src/modelPreloader.js +0 -464
  55. package/dist/esm/src/sceneOperationsManager.js +0 -572
@@ -1,465 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var THREE = require('three');
6
-
7
- // https://github.com/mrdoob/three.js/issues/5552
8
- // http://en.wikipedia.org/wiki/RGBE_image_format
9
-
10
- class RGBELoader extends THREE.DataTextureLoader {
11
-
12
- constructor( manager ) {
13
-
14
- super( manager );
15
-
16
- this.type = THREE.HalfFloatType;
17
-
18
- }
19
-
20
- // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
21
-
22
- parse( buffer ) {
23
-
24
- const
25
- /* return codes for rgbe routines */
26
- //RGBE_RETURN_SUCCESS = 0,
27
- RGBE_RETURN_FAILURE = - 1,
28
-
29
- /* default error routine. change this to change error handling */
30
- rgbe_read_error = 1,
31
- rgbe_write_error = 2,
32
- rgbe_format_error = 3,
33
- rgbe_memory_error = 4,
34
- rgbe_error = function ( rgbe_error_code, msg ) {
35
-
36
- switch ( rgbe_error_code ) {
37
-
38
- case rgbe_read_error: console.error( 'THREE.RGBELoader Read Error: ' + ( msg || '' ) );
39
- break;
40
- case rgbe_write_error: console.error( 'THREE.RGBELoader Write Error: ' + ( msg || '' ) );
41
- break;
42
- case rgbe_format_error: console.error( 'THREE.RGBELoader Bad File Format: ' + ( msg || '' ) );
43
- break;
44
- default:
45
- case rgbe_memory_error: console.error( 'THREE.RGBELoader: Error: ' + ( msg || '' ) );
46
-
47
- }
48
-
49
- return RGBE_RETURN_FAILURE;
50
-
51
- },
52
-
53
- /* offsets to red, green, and blue components in a data (float) pixel */
54
- //RGBE_DATA_RED = 0,
55
- //RGBE_DATA_GREEN = 1,
56
- //RGBE_DATA_BLUE = 2,
57
-
58
- /* number of floats per pixel, use 4 since stored in rgba image format */
59
- //RGBE_DATA_SIZE = 4,
60
-
61
- /* flags indicating which fields in an rgbe_header_info are valid */
62
- RGBE_VALID_PROGRAMTYPE = 1,
63
- RGBE_VALID_FORMAT = 2,
64
- RGBE_VALID_DIMENSIONS = 4,
65
-
66
- NEWLINE = '\n',
67
-
68
- fgets = function ( buffer, lineLimit, consume ) {
69
-
70
- const chunkSize = 128;
71
-
72
- lineLimit = ! lineLimit ? 1024 : lineLimit;
73
- let p = buffer.pos,
74
- i = - 1, len = 0, s = '',
75
- chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
76
-
77
- while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) {
78
-
79
- s += chunk; len += chunk.length;
80
- p += chunkSize;
81
- chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
82
-
83
- }
84
-
85
- if ( - 1 < i ) {
86
-
87
- /*for (i=l-1; i>=0; i--) {
88
- byteCode = m.charCodeAt(i);
89
- if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++;
90
- else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2;
91
- if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate
92
- }*/
93
- if ( false !== consume ) buffer.pos += len + i + 1;
94
- return s + chunk.slice( 0, i );
95
-
96
- }
97
-
98
- return false;
99
-
100
- },
101
-
102
- /* minimal header reading. modify if you want to parse more information */
103
- RGBE_ReadHeader = function ( buffer ) {
104
-
105
-
106
- // regexes to parse header info fields
107
- const magic_token_re = /^#\?(\S+)/,
108
- gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,
109
- exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,
110
- format_re = /^\s*FORMAT=(\S+)\s*$/,
111
- dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,
112
-
113
- // RGBE format header struct
114
- header = {
115
-
116
- valid: 0, /* indicate which fields are valid */
117
-
118
- string: '', /* the actual header string */
119
-
120
- comments: '', /* comments found in header */
121
-
122
- programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */
123
-
124
- format: '', /* RGBE format, default 32-bit_rle_rgbe */
125
-
126
- gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */
127
-
128
- exposure: 1.0, /* a value of 1.0 in an image corresponds to <exposure> watts/steradian/m^2. defaults to 1.0 */
129
-
130
- width: 0, height: 0 /* image dimensions, width/height */
131
-
132
- };
133
-
134
- let line, match;
135
-
136
- if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) {
137
-
138
- return rgbe_error( rgbe_read_error, 'no header found' );
139
-
140
- }
141
-
142
- /* if you want to require the magic token then uncomment the next line */
143
- if ( ! ( match = line.match( magic_token_re ) ) ) {
144
-
145
- return rgbe_error( rgbe_format_error, 'bad initial token' );
146
-
147
- }
148
-
149
- header.valid |= RGBE_VALID_PROGRAMTYPE;
150
- header.programtype = match[ 1 ];
151
- header.string += line + '\n';
152
-
153
- while ( true ) {
154
-
155
- line = fgets( buffer );
156
- if ( false === line ) break;
157
- header.string += line + '\n';
158
-
159
- if ( '#' === line.charAt( 0 ) ) {
160
-
161
- header.comments += line + '\n';
162
- continue; // comment line
163
-
164
- }
165
-
166
- if ( match = line.match( gamma_re ) ) {
167
-
168
- header.gamma = parseFloat( match[ 1 ] );
169
-
170
- }
171
-
172
- if ( match = line.match( exposure_re ) ) {
173
-
174
- header.exposure = parseFloat( match[ 1 ] );
175
-
176
- }
177
-
178
- if ( match = line.match( format_re ) ) {
179
-
180
- header.valid |= RGBE_VALID_FORMAT;
181
- header.format = match[ 1 ];//'32-bit_rle_rgbe';
182
-
183
- }
184
-
185
- if ( match = line.match( dimensions_re ) ) {
186
-
187
- header.valid |= RGBE_VALID_DIMENSIONS;
188
- header.height = parseInt( match[ 1 ], 10 );
189
- header.width = parseInt( match[ 2 ], 10 );
190
-
191
- }
192
-
193
- if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break;
194
-
195
- }
196
-
197
- if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) {
198
-
199
- return rgbe_error( rgbe_format_error, 'missing format specifier' );
200
-
201
- }
202
-
203
- if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
204
-
205
- return rgbe_error( rgbe_format_error, 'missing image size specifier' );
206
-
207
- }
208
-
209
- return header;
210
-
211
- },
212
-
213
- RGBE_ReadPixels_RLE = function ( buffer, w, h ) {
214
-
215
- const scanline_width = w;
216
-
217
- if (
218
- // run length encoding is not allowed so read flat
219
- ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) ||
220
- // this file is not run length encoded
221
- ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) )
222
- ) {
223
-
224
- // return the flat buffer
225
- return new Uint8Array( buffer );
226
-
227
- }
228
-
229
- if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) {
230
-
231
- return rgbe_error( rgbe_format_error, 'wrong scanline width' );
232
-
233
- }
234
-
235
- const data_rgba = new Uint8Array( 4 * w * h );
236
-
237
- if ( ! data_rgba.length ) {
238
-
239
- return rgbe_error( rgbe_memory_error, 'unable to allocate buffer space' );
240
-
241
- }
242
-
243
- let offset = 0, pos = 0;
244
-
245
- const ptr_end = 4 * scanline_width;
246
- const rgbeStart = new Uint8Array( 4 );
247
- const scanline_buffer = new Uint8Array( ptr_end );
248
- let num_scanlines = h;
249
-
250
- // read in each successive scanline
251
- while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) {
252
-
253
- if ( pos + 4 > buffer.byteLength ) {
254
-
255
- return rgbe_error( rgbe_read_error );
256
-
257
- }
258
-
259
- rgbeStart[ 0 ] = buffer[ pos ++ ];
260
- rgbeStart[ 1 ] = buffer[ pos ++ ];
261
- rgbeStart[ 2 ] = buffer[ pos ++ ];
262
- rgbeStart[ 3 ] = buffer[ pos ++ ];
263
-
264
- if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) {
265
-
266
- return rgbe_error( rgbe_format_error, 'bad rgbe scanline format' );
267
-
268
- }
269
-
270
- // read each of the four channels for the scanline into the buffer
271
- // first red, then green, then blue, then exponent
272
- let ptr = 0, count;
273
-
274
- while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) {
275
-
276
- count = buffer[ pos ++ ];
277
- const isEncodedRun = count > 128;
278
- if ( isEncodedRun ) count -= 128;
279
-
280
- if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) {
281
-
282
- return rgbe_error( rgbe_format_error, 'bad scanline data' );
283
-
284
- }
285
-
286
- if ( isEncodedRun ) {
287
-
288
- // a (encoded) run of the same value
289
- const byteValue = buffer[ pos ++ ];
290
- for ( let i = 0; i < count; i ++ ) {
291
-
292
- scanline_buffer[ ptr ++ ] = byteValue;
293
-
294
- }
295
- //ptr += count;
296
-
297
- } else {
298
-
299
- // a literal-run
300
- scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr );
301
- ptr += count; pos += count;
302
-
303
- }
304
-
305
- }
306
-
307
-
308
- // now convert data from buffer into rgba
309
- // first red, then green, then blue, then exponent (alpha)
310
- const l = scanline_width; //scanline_buffer.byteLength;
311
- for ( let i = 0; i < l; i ++ ) {
312
-
313
- let off = 0;
314
- data_rgba[ offset ] = scanline_buffer[ i + off ];
315
- off += scanline_width; //1;
316
- data_rgba[ offset + 1 ] = scanline_buffer[ i + off ];
317
- off += scanline_width; //1;
318
- data_rgba[ offset + 2 ] = scanline_buffer[ i + off ];
319
- off += scanline_width; //1;
320
- data_rgba[ offset + 3 ] = scanline_buffer[ i + off ];
321
- offset += 4;
322
-
323
- }
324
-
325
- num_scanlines --;
326
-
327
- }
328
-
329
- return data_rgba;
330
-
331
- };
332
-
333
- const RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) {
334
-
335
- const e = sourceArray[ sourceOffset + 3 ];
336
- const scale = Math.pow( 2.0, e - 128.0 ) / 255.0;
337
-
338
- destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale;
339
- destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale;
340
- destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale;
341
- destArray[ destOffset + 3 ] = 1;
342
-
343
- };
344
-
345
- const RGBEByteToRGBHalf = function ( sourceArray, sourceOffset, destArray, destOffset ) {
346
-
347
- const e = sourceArray[ sourceOffset + 3 ];
348
- const scale = Math.pow( 2.0, e - 128.0 ) / 255.0;
349
-
350
- // clamping to 65504, the maximum representable value in float16
351
- destArray[ destOffset + 0 ] = THREE.DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 0 ] * scale, 65504 ) );
352
- destArray[ destOffset + 1 ] = THREE.DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 1 ] * scale, 65504 ) );
353
- destArray[ destOffset + 2 ] = THREE.DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 2 ] * scale, 65504 ) );
354
- destArray[ destOffset + 3 ] = THREE.DataUtils.toHalfFloat( 1 );
355
-
356
- };
357
-
358
- const byteArray = new Uint8Array( buffer );
359
- byteArray.pos = 0;
360
- const rgbe_header_info = RGBE_ReadHeader( byteArray );
361
-
362
- if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) {
363
-
364
- const w = rgbe_header_info.width,
365
- h = rgbe_header_info.height,
366
- image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h );
367
-
368
- if ( RGBE_RETURN_FAILURE !== image_rgba_data ) {
369
-
370
- let data, type;
371
- let numElements;
372
-
373
- switch ( this.type ) {
374
-
375
- case THREE.FloatType:
376
-
377
- numElements = image_rgba_data.length / 4;
378
- const floatArray = new Float32Array( numElements * 4 );
379
-
380
- for ( let j = 0; j < numElements; j ++ ) {
381
-
382
- RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 4 );
383
-
384
- }
385
-
386
- data = floatArray;
387
- type = THREE.FloatType;
388
- break;
389
-
390
- case THREE.HalfFloatType:
391
-
392
- numElements = image_rgba_data.length / 4;
393
- const halfArray = new Uint16Array( numElements * 4 );
394
-
395
- for ( let j = 0; j < numElements; j ++ ) {
396
-
397
- RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 4 );
398
-
399
- }
400
-
401
- data = halfArray;
402
- type = THREE.HalfFloatType;
403
- break;
404
-
405
- default:
406
-
407
- console.error( 'THREE.RGBELoader: unsupported type: ', this.type );
408
- break;
409
-
410
- }
411
-
412
- return {
413
- width: w, height: h,
414
- data: data,
415
- header: rgbe_header_info.string,
416
- gamma: rgbe_header_info.gamma,
417
- exposure: rgbe_header_info.exposure,
418
- type: type
419
- };
420
-
421
- }
422
-
423
- }
424
-
425
- return null;
426
-
427
- }
428
-
429
- setDataType( value ) {
430
-
431
- this.type = value;
432
- return this;
433
-
434
- }
435
-
436
- load( url, onLoad, onProgress, onError ) {
437
-
438
- function onLoadCallback( texture, texData ) {
439
-
440
- switch ( texture.type ) {
441
-
442
- case THREE.FloatType:
443
- case THREE.HalfFloatType:
444
-
445
- texture.encoding = THREE.LinearEncoding;
446
- texture.minFilter = THREE.LinearFilter;
447
- texture.magFilter = THREE.LinearFilter;
448
- texture.generateMipmaps = false;
449
- texture.flipY = true;
450
-
451
- break;
452
-
453
- }
454
-
455
- if ( onLoad ) onLoad( texture, texData );
456
-
457
- }
458
-
459
- return super.load( url, onLoadCallback, onProgress, onError );
460
-
461
- }
462
-
463
- }
464
-
465
- exports.RGBELoader = RGBELoader;
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three");class r extends t.DataTextureLoader{constructor(r){super(r),this.type=t.HalfFloatType}parse(r){const e=function(t,r){return-1},n=function(t,r,e){r=r||1024;let n=t.pos,s=-1,a=0,i="",o=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));for(;0>(s=o.indexOf("\n"))&&a<r&&n<t.byteLength;)i+=o,a+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));return-1<s&&(!1!==e&&(t.pos+=a+s+1),i+o.slice(0,s))},s=function(t,r,e,n){const s=t[r+3],a=Math.pow(2,s-128)/255;e[n+0]=t[r+0]*a,e[n+1]=t[r+1]*a,e[n+2]=t[r+2]*a,e[n+3]=1},a=function(r,e,n,s){const a=r[e+3],i=Math.pow(2,a-128)/255;n[s+0]=t.DataUtils.toHalfFloat(Math.min(r[e+0]*i,65504)),n[s+1]=t.DataUtils.toHalfFloat(Math.min(r[e+1]*i,65504)),n[s+2]=t.DataUtils.toHalfFloat(Math.min(r[e+2]*i,65504)),n[s+3]=t.DataUtils.toHalfFloat(1)},i=new Uint8Array(r);i.pos=0;const o=function(t){const r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,e=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let o,u;if(t.pos>=t.byteLength||!(o=n(t)))return-1;if(!(u=o.match(/^#\?(\S+)/)))return-1;for(i.valid|=1,i.programtype=u[1],i.string+=o+"\n";o=n(t),!1!==o;)if(i.string+=o+"\n","#"!==o.charAt(0)){if((u=o.match(r))&&(i.gamma=parseFloat(u[1])),(u=o.match(e))&&(i.exposure=parseFloat(u[1])),(u=o.match(s))&&(i.valid|=2,i.format=u[1]),(u=o.match(a))&&(i.valid|=4,i.height=parseInt(u[1],10),i.width=parseInt(u[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=o+"\n";return 2&i.valid&&4&i.valid?i:-1}(i);if(-1!==o){const r=o.width,n=o.height,u=function(t,r,n){const s=r;if(s<8||s>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);if(s!==(t[2]<<8|t[3]))return-1;const a=new Uint8Array(4*r*n);if(!a.length)return-1;let i=0,o=0;const u=4*s,c=new Uint8Array(4),f=new Uint8Array(u);let l=n;for(;l>0&&o<t.byteLength;){if(o+4>t.byteLength)return e();if(c[0]=t[o++],c[1]=t[o++],c[2]=t[o++],c[3]=t[o++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=s)return e();let r,n=0;for(;n<u&&o<t.byteLength;){r=t[o++];const s=r>128;if(s&&(r-=128),0===r||n+r>u)return e();if(s){const e=t[o++];for(let t=0;t<r;t++)f[n++]=e}else f.set(t.subarray(o,o+r),n),n+=r,o+=r}const h=s;for(let t=0;t<h;t++){let r=0;a[i]=f[t+r],r+=s,a[i+1]=f[t+r],r+=s,a[i+2]=f[t+r],r+=s,a[i+3]=f[t+r],i+=4}l--}return a}(i.subarray(i.pos),r,n);if(-1!==u){let e,i,c;switch(this.type){case t.FloatType:c=u.length/4;const r=new Float32Array(4*c);for(let t=0;t<c;t++)s(u,4*t,r,4*t);e=r,i=t.FloatType;break;case t.HalfFloatType:c=u.length/4;const n=new Uint16Array(4*c);for(let t=0;t<c;t++)a(u,4*t,n,4*t);e=n,i=t.HalfFloatType}return{width:r,height:n,data:e,header:o.string,gamma:o.gamma,exposure:o.exposure,type:i}}}return null}setDataType(t){return this.type=t,this}load(r,e,n,s){return super.load(r,function(r,n){switch(r.type){case t.FloatType:case t.HalfFloatType:r.encoding=t.LinearEncoding,r.minFilter=t.LinearFilter,r.magFilter=t.LinearFilter,r.generateMipmaps=!1,r.flipY=!0}e&&e(r,n)},n,s)}}exports.RGBELoader=r;
@@ -1,117 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var THREE = require('three');
6
-
7
- /**
8
- * @param {BufferGeometry} geometry
9
- * @param {number} drawMode
10
- * @return {BufferGeometry}
11
- */
12
- function toTrianglesDrawMode( geometry, drawMode ) {
13
-
14
- if ( drawMode === THREE.TrianglesDrawMode ) {
15
-
16
- console.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );
17
- return geometry;
18
-
19
- }
20
-
21
- if ( drawMode === THREE.TriangleFanDrawMode || drawMode === THREE.TriangleStripDrawMode ) {
22
-
23
- let index = geometry.getIndex();
24
-
25
- // generate index if not present
26
-
27
- if ( index === null ) {
28
-
29
- const indices = [];
30
-
31
- const position = geometry.getAttribute( 'position' );
32
-
33
- if ( position !== undefined ) {
34
-
35
- for ( let i = 0; i < position.count; i ++ ) {
36
-
37
- indices.push( i );
38
-
39
- }
40
-
41
- geometry.setIndex( indices );
42
- index = geometry.getIndex();
43
-
44
- } else {
45
-
46
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
47
- return geometry;
48
-
49
- }
50
-
51
- }
52
-
53
- //
54
-
55
- const numberOfTriangles = index.count - 2;
56
- const newIndices = [];
57
-
58
- if ( drawMode === THREE.TriangleFanDrawMode ) {
59
-
60
- // gl.TRIANGLE_FAN
61
-
62
- for ( let i = 1; i <= numberOfTriangles; i ++ ) {
63
-
64
- newIndices.push( index.getX( 0 ) );
65
- newIndices.push( index.getX( i ) );
66
- newIndices.push( index.getX( i + 1 ) );
67
-
68
- }
69
-
70
- } else {
71
-
72
- // gl.TRIANGLE_STRIP
73
-
74
- for ( let i = 0; i < numberOfTriangles; i ++ ) {
75
-
76
- if ( i % 2 === 0 ) {
77
-
78
- newIndices.push( index.getX( i ) );
79
- newIndices.push( index.getX( i + 1 ) );
80
- newIndices.push( index.getX( i + 2 ) );
81
-
82
- } else {
83
-
84
- newIndices.push( index.getX( i + 2 ) );
85
- newIndices.push( index.getX( i + 1 ) );
86
- newIndices.push( index.getX( i ) );
87
-
88
- }
89
-
90
- }
91
-
92
- }
93
-
94
- if ( ( newIndices.length / 3 ) !== numberOfTriangles ) {
95
-
96
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
97
-
98
- }
99
-
100
- // build final geometry
101
-
102
- const newGeometry = geometry.clone();
103
- newGeometry.setIndex( newIndices );
104
- newGeometry.clearGroups();
105
-
106
- return newGeometry;
107
-
108
- } else {
109
-
110
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );
111
- return geometry;
112
-
113
- }
114
-
115
- }
116
-
117
- exports.toTrianglesDrawMode = toTrianglesDrawMode;
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("three");exports.toTrianglesDrawMode=function(t,r){if(r===e.TrianglesDrawMode)return t;if(r===e.TriangleFanDrawMode||r===e.TriangleStripDrawMode){let o=t.getIndex();if(null===o){const e=[],r=t.getAttribute("position");if(void 0===r)return t;for(let t=0;t<r.count;t++)e.push(t);t.setIndex(e),o=t.getIndex()}const i=o.count-2,n=[];if(r===e.TriangleFanDrawMode)for(let e=1;e<=i;e++)n.push(o.getX(0)),n.push(o.getX(e)),n.push(o.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(n.push(o.getX(e)),n.push(o.getX(e+1)),n.push(o.getX(e+2))):(n.push(o.getX(e+2)),n.push(o.getX(e+1)),n.push(o.getX(e)));n.length;const s=t.clone();return s.setIndex(n),s.clearGroups(),s}return t};
@@ -1,121 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var debugLogger = require('./debugLogger.js');
6
-
7
- /**
8
- * Animation Manager
9
- * Handles animation loops and timing
10
- */
11
- var animationFrameId = null;
12
- var isAnimating = false;
13
- var lastTime = 0;
14
- var callbacks = [];
15
-
16
- /**
17
- * Start the animation loop
18
- */
19
- function startAnimation(component) {
20
- if (isAnimating) return;
21
- isAnimating = true;
22
- lastTime = performance.now();
23
- var _animate = function animate(time) {
24
- if (!isAnimating) return;
25
-
26
- // Calculate delta time
27
- var deltaTime = (time - lastTime) / 1000; // in seconds
28
- lastTime = time;
29
-
30
- // Execute animation callbacks
31
- executeCallbacks(time, deltaTime);
32
-
33
- // Render if component exists
34
- if (component && component.renderer && component.scene && component.camera) {
35
- component.renderer.render(component.scene, component.camera);
36
- }
37
-
38
- // Update orbit controls if they exist
39
- if (component && component.controls && component.controls.update) {
40
- component.controls.update();
41
- }
42
-
43
- // Continue animation loop
44
- animationFrameId = requestAnimationFrame(_animate);
45
- };
46
-
47
- // Start animation loop
48
- animationFrameId = requestAnimationFrame(_animate);
49
- debugLogger.logger.info('Animation loop started');
50
- }
51
-
52
- /**
53
- * Stop the animation loop
54
- */
55
- function stopAnimation() {
56
- if (!isAnimating) return;
57
- if (animationFrameId !== null) {
58
- cancelAnimationFrame(animationFrameId);
59
- animationFrameId = null;
60
- }
61
- isAnimating = false;
62
- debugLogger.logger.info('Animation loop stopped');
63
- }
64
-
65
- /**
66
- * Register an animation callback
67
- */
68
- function addAnimationCallback(callback) {
69
- if (typeof callback !== 'function') {
70
- debugLogger.logger.warn('Invalid animation callback');
71
- return;
72
- }
73
- callbacks.push(callback);
74
- return callback;
75
- }
76
-
77
- /**
78
- * Remove an animation callback
79
- */
80
- function removeAnimationCallback(callback) {
81
- var index = callbacks.indexOf(callback);
82
- if (index !== -1) {
83
- callbacks.splice(index, 1);
84
- return true;
85
- }
86
- return false;
87
- }
88
-
89
- /**
90
- * Execute all registered animation callbacks
91
- */
92
- function executeCallbacks(time, deltaTime) {
93
- callbacks.forEach(function (callback) {
94
- try {
95
- callback(time, deltaTime);
96
- } catch (error) {
97
- debugLogger.logger.error('Error in animation callback:', error);
98
- }
99
- });
100
- }
101
-
102
- /**
103
- * Check if animation is running
104
- */
105
- function isAnimationRunning() {
106
- return isAnimating;
107
- }
108
- var animationManager = {
109
- startAnimation: startAnimation,
110
- stopAnimation: stopAnimation,
111
- addAnimationCallback: addAnimationCallback,
112
- removeAnimationCallback: removeAnimationCallback,
113
- isAnimationRunning: isAnimationRunning
114
- };
115
-
116
- exports.addAnimationCallback = addAnimationCallback;
117
- exports["default"] = animationManager;
118
- exports.isAnimationRunning = isAnimationRunning;
119
- exports.removeAnimationCallback = removeAnimationCallback;
120
- exports.startAnimation = startAnimation;
121
- exports.stopAnimation = stopAnimation;
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var n=require("./debugLogger.js"),t=null,i=!1,o=0,a=[];function r(r){if(!i){i=!0,o=performance.now();var e=function(u){if(i){var c=(u-o)/1e3;o=u,function(t,i){a.forEach(function(o){try{o(t,i)}catch(t){n.logger.error("Error in animation callback:",t)}})}(u,c),r&&r.renderer&&r.scene&&r.camera&&r.renderer.render(r.scene,r.camera),r&&r.controls&&r.controls.update&&r.controls.update(),t=requestAnimationFrame(e)}};t=requestAnimationFrame(e),n.logger.info("Animation loop started")}}function e(){i&&(null!==t&&(cancelAnimationFrame(t),t=null),i=!1,n.logger.info("Animation loop stopped"))}function u(t){if("function"==typeof t)return a.push(t),t;n.logger.warn("Invalid animation callback")}function c(n){var t=a.indexOf(n);return-1!==t&&(a.splice(t,1),!0)}function l(){return i}var s={startAnimation:r,stopAnimation:e,addAnimationCallback:u,removeAnimationCallback:c,isAnimationRunning:l};exports.addAnimationCallback=u,exports.default=s,exports.isAnimationRunning=l,exports.removeAnimationCallback=c,exports.startAnimation=r,exports.stopAnimation=e;