@2112-lab/central-plant 0.1.4 → 0.1.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.
Files changed (88) hide show
  1. package/dist/bundle/index.js +33146 -1
  2. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +432 -1
  3. package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1448 -1
  4. package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1853 -1
  5. package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3537 -1
  6. package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +305 -1
  7. package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +542 -1
  8. package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +218 -1
  9. package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +683 -1
  10. package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4811 -1
  11. package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +480 -1
  12. package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +309 -1
  13. package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +120 -1
  14. package/dist/cjs/src/analysis/analysis.js +560 -1
  15. package/dist/cjs/src/analysis/testing.js +958 -1
  16. package/dist/cjs/src/core/centralPlant.js +1149 -1
  17. package/dist/cjs/src/core/debugLogger.js +175 -1
  18. package/dist/cjs/src/core/mathUtils.js +574 -1
  19. package/dist/cjs/src/core/nameUtils.js +93 -1
  20. package/dist/cjs/src/data/export.js +716 -1
  21. package/dist/cjs/src/data/import.js +380 -1
  22. package/dist/cjs/src/data/numerics.js +522 -1
  23. package/dist/cjs/src/helpers/sceneHelper.js +572 -1
  24. package/dist/cjs/src/index.js +69 -1
  25. package/dist/cjs/src/managers/components/animationManager.js +123 -1
  26. package/dist/cjs/src/managers/components/componentManager.js +332 -1
  27. package/dist/cjs/src/managers/components/pathfindingManager.js +1441 -1
  28. package/dist/cjs/src/managers/controls/TransformControls.js +1063 -1
  29. package/dist/cjs/src/managers/controls/cameraControlsManager.js +79 -1
  30. package/dist/cjs/src/managers/controls/dragDropManager.js +1026 -1
  31. package/dist/cjs/src/managers/controls/keyboardControlsManager.js +395 -1
  32. package/dist/cjs/src/managers/controls/transformControlsManager.js +1807 -1
  33. package/dist/cjs/src/managers/environment/environmentManager.js +714 -1
  34. package/dist/cjs/src/managers/environment/textureConfig.js +229 -1
  35. package/dist/cjs/src/managers/scene/sceneExportManager.js +264 -1
  36. package/dist/cjs/src/managers/scene/sceneInitializationManager.js +346 -1
  37. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1509 -1
  38. package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +661 -1
  39. package/dist/cjs/src/managers/system/disposalManager.js +444 -1
  40. package/dist/cjs/src/managers/system/hotReloadManager.js +291 -1
  41. package/dist/cjs/src/managers/system/performanceMonitor.js +863 -1
  42. package/dist/cjs/src/rendering/modelPreloader.js +369 -1
  43. package/dist/cjs/src/rendering/rendering2D.js +631 -1
  44. package/dist/cjs/src/rendering/rendering3D.js +685 -1
  45. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +396 -1
  46. package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1444 -1
  47. package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1849 -1
  48. package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3533 -1
  49. package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +301 -1
  50. package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +538 -1
  51. package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +214 -1
  52. package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +679 -1
  53. package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4807 -1
  54. package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +476 -1
  55. package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +304 -1
  56. package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +116 -1
  57. package/dist/esm/src/analysis/analysis.js +536 -1
  58. package/dist/esm/src/analysis/testing.js +954 -1
  59. package/dist/esm/src/core/centralPlant.js +1144 -1
  60. package/dist/esm/src/core/debugLogger.js +167 -1
  61. package/dist/esm/src/core/mathUtils.js +570 -1
  62. package/dist/esm/src/core/nameUtils.js +87 -1
  63. package/dist/esm/src/data/export.js +712 -1
  64. package/dist/esm/src/data/import.js +356 -1
  65. package/dist/esm/src/data/numerics.js +518 -1
  66. package/dist/esm/src/helpers/sceneHelper.js +547 -1
  67. package/dist/esm/src/index.js +35 -1
  68. package/dist/esm/src/managers/components/animationManager.js +119 -1
  69. package/dist/esm/src/managers/components/componentManager.js +328 -1
  70. package/dist/esm/src/managers/components/pathfindingManager.js +1417 -1
  71. package/dist/esm/src/managers/controls/TransformControls.js +1057 -1
  72. package/dist/esm/src/managers/controls/cameraControlsManager.js +75 -1
  73. package/dist/esm/src/managers/controls/dragDropManager.js +1002 -1
  74. package/dist/esm/src/managers/controls/keyboardControlsManager.js +371 -1
  75. package/dist/esm/src/managers/controls/transformControlsManager.js +1782 -1
  76. package/dist/esm/src/managers/environment/environmentManager.js +690 -1
  77. package/dist/esm/src/managers/environment/textureConfig.js +202 -1
  78. package/dist/esm/src/managers/scene/sceneExportManager.js +260 -1
  79. package/dist/esm/src/managers/scene/sceneInitializationManager.js +322 -1
  80. package/dist/esm/src/managers/scene/sceneOperationsManager.js +1485 -1
  81. package/dist/esm/src/managers/scene/sceneTooltipsManager.js +637 -1
  82. package/dist/esm/src/managers/system/disposalManager.js +440 -1
  83. package/dist/esm/src/managers/system/hotReloadManager.js +287 -1
  84. package/dist/esm/src/managers/system/performanceMonitor.js +858 -1
  85. package/dist/esm/src/rendering/modelPreloader.js +364 -1
  86. package/dist/esm/src/rendering/rendering2D.js +627 -1
  87. package/dist/esm/src/rendering/rendering3D.js +661 -1
  88. package/package.json +1 -1
@@ -1 +1,305 @@
1
- "use strict";Object.defineProperty(exports,"o",{value:!0});var n=require("three");exports.OBJExporter=class{parse(o){let e="",t=0,i=0,l=0;const f=new n.Vector3,r=new n.Color,s=new n.Vector3,c=new n.Vector2,v=[];return o.traverse(function(o){!0===o.isMesh&&function(o){let r=0,u=0,d=0;const p=o.geometry,a=new n.Matrix3,w=p.getAttribute("position"),m=p.getAttribute("normal"),x=p.getAttribute("uv"),L=p.getIndex();if(e+="o "+o.name+"\n",o.material&&o.material.name&&(e+="usemtl "+o.material.name+"\n"),void 0!==w)for(let n=0,t=w.count;n<t;n++,r++)f.fromBufferAttribute(w,n),f.applyMatrix4(o.matrixWorld),e+="v "+f.x+" "+f.y+" "+f.z+"\n";if(void 0!==x)for(let n=0,o=x.count;n<o;n++,d++)c.fromBufferAttribute(x,n),e+="vt "+c.x+" "+c.y+"\n";if(void 0!==m){a.getNormalMatrix(o.matrixWorld);for(let n=0,o=m.count;n<o;n++,u++)s.fromBufferAttribute(m,n),s.applyMatrix3(a).normalize(),e+="vn "+s.x+" "+s.y+" "+s.z+"\n"}if(null!==L)for(let n=0,o=L.count;n<o;n+=3){for(let o=0;o<3;o++){const e=L.getX(n+o)+1;v[o]=t+e+(m||x?"/"+(x?i+e:"")+(m?"/"+(l+e):""):"")}e+="f "+v.join(" ")+"\n"}else for(let n=0,o=w.count;n<o;n+=3){for(let o=0;o<3;o++){const e=n+o+1;v[o]=t+e+(m||x?"/"+(x?i+e:"")+(m?"/"+(l+e):""):"")}e+="f "+v.join(" ")+"\n"}t+=r,i+=d,l+=u}(o),!0===o.isLine&&function(n){let o=0;const i=n.geometry,l=n.type,r=i.getAttribute("position");if(e+="o "+n.name+"\n",void 0!==r)for(let t=0,i=r.count;t<i;t++,o++)f.fromBufferAttribute(r,t),f.applyMatrix4(n.matrixWorld),e+="v "+f.x+" "+f.y+" "+f.z+"\n";if("Line"===l){e+="l ";for(let n=1,o=r.count;n<=o;n++)e+=t+n+" ";e+="\n"}if("LineSegments"===l)for(let n=1,o=n+1,i=r.count;n<i;n+=2,o=n+1)e+="l "+(t+n)+" "+(t+o)+"\n";t+=o}(o),!0===o.isPoints&&function(o){let i=0;const l=o.geometry,s=l.getAttribute("position"),c=l.getAttribute("color");if(e+="o "+o.name+"\n",void 0!==s){for(let t=0,l=s.count;t<l;t++,i++)f.fromBufferAttribute(s,t),f.applyMatrix4(o.matrixWorld),e+="v "+f.x+" "+f.y+" "+f.z,void 0!==c&&(r.fromBufferAttribute(c,t),n.ColorManagement.workingToColorSpace(r,n.SRGBColorSpace),e+=" "+r.r+" "+r.g+" "+r.b),e+="\n";e+="p ";for(let n=1,o=s.count;n<=o;n++)e+=t+n+" ";e+="\n"}t+=i}(o)}),e}};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var THREE = require('three');
6
+
7
+ /**
8
+ * An exporter for OBJ.
9
+ *
10
+ * `OBJExporter` is not able to export material data into MTL files so only geometry data are supported.
11
+ *
12
+ * ```js
13
+ * const exporter = new OBJExporter();
14
+ * const data = exporter.parse( scene );
15
+ * ```
16
+ *
17
+ * @three_import import { OBJExporter } from 'three/addons/exporters/OBJExporter.js';
18
+ */
19
+ class OBJExporter {
20
+
21
+ /**
22
+ * Parses the given 3D object and generates the OBJ output.
23
+ *
24
+ * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file.
25
+ *
26
+ * @param {Object3D} object - The 3D object to export.
27
+ * @return {string} The exported OBJ.
28
+ */
29
+ parse( object ) {
30
+
31
+ let output = '';
32
+
33
+ let indexVertex = 0;
34
+ let indexVertexUvs = 0;
35
+ let indexNormals = 0;
36
+
37
+ const vertex = new THREE.Vector3();
38
+ const color = new THREE.Color();
39
+ const normal = new THREE.Vector3();
40
+ const uv = new THREE.Vector2();
41
+
42
+ const face = [];
43
+
44
+ function parseMesh( mesh ) {
45
+
46
+ let nbVertex = 0;
47
+ let nbNormals = 0;
48
+ let nbVertexUvs = 0;
49
+
50
+ const geometry = mesh.geometry;
51
+
52
+ const normalMatrixWorld = new THREE.Matrix3();
53
+
54
+ // shortcuts
55
+ const vertices = geometry.getAttribute( 'position' );
56
+ const normals = geometry.getAttribute( 'normal' );
57
+ const uvs = geometry.getAttribute( 'uv' );
58
+ const indices = geometry.getIndex();
59
+
60
+ // name of the mesh object
61
+ output += 'o ' + mesh.name + '\n';
62
+
63
+ // name of the mesh material
64
+ if ( mesh.material && mesh.material.name ) {
65
+
66
+ output += 'usemtl ' + mesh.material.name + '\n';
67
+
68
+ }
69
+
70
+ // vertices
71
+
72
+ if ( vertices !== undefined ) {
73
+
74
+ for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) {
75
+
76
+ vertex.fromBufferAttribute( vertices, i );
77
+
78
+ // transform the vertex to world space
79
+ vertex.applyMatrix4( mesh.matrixWorld );
80
+
81
+ // transform the vertex to export format
82
+ output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n';
83
+
84
+ }
85
+
86
+ }
87
+
88
+ // uvs
89
+
90
+ if ( uvs !== undefined ) {
91
+
92
+ for ( let i = 0, l = uvs.count; i < l; i ++, nbVertexUvs ++ ) {
93
+
94
+ uv.fromBufferAttribute( uvs, i );
95
+
96
+ // transform the uv to export format
97
+ output += 'vt ' + uv.x + ' ' + uv.y + '\n';
98
+
99
+ }
100
+
101
+ }
102
+
103
+ // normals
104
+
105
+ if ( normals !== undefined ) {
106
+
107
+ normalMatrixWorld.getNormalMatrix( mesh.matrixWorld );
108
+
109
+ for ( let i = 0, l = normals.count; i < l; i ++, nbNormals ++ ) {
110
+
111
+ normal.fromBufferAttribute( normals, i );
112
+
113
+ // transform the normal to world space
114
+ normal.applyMatrix3( normalMatrixWorld ).normalize();
115
+
116
+ // transform the normal to export format
117
+ output += 'vn ' + normal.x + ' ' + normal.y + ' ' + normal.z + '\n';
118
+
119
+ }
120
+
121
+ }
122
+
123
+ // faces
124
+
125
+ if ( indices !== null ) {
126
+
127
+ for ( let i = 0, l = indices.count; i < l; i += 3 ) {
128
+
129
+ for ( let m = 0; m < 3; m ++ ) {
130
+
131
+ const j = indices.getX( i + m ) + 1;
132
+
133
+ face[ m ] = ( indexVertex + j ) + ( normals || uvs ? '/' + ( uvs ? ( indexVertexUvs + j ) : '' ) + ( normals ? '/' + ( indexNormals + j ) : '' ) : '' );
134
+
135
+ }
136
+
137
+ // transform the face to export format
138
+ output += 'f ' + face.join( ' ' ) + '\n';
139
+
140
+ }
141
+
142
+ } else {
143
+
144
+ for ( let i = 0, l = vertices.count; i < l; i += 3 ) {
145
+
146
+ for ( let m = 0; m < 3; m ++ ) {
147
+
148
+ const j = i + m + 1;
149
+
150
+ face[ m ] = ( indexVertex + j ) + ( normals || uvs ? '/' + ( uvs ? ( indexVertexUvs + j ) : '' ) + ( normals ? '/' + ( indexNormals + j ) : '' ) : '' );
151
+
152
+ }
153
+
154
+ // transform the face to export format
155
+ output += 'f ' + face.join( ' ' ) + '\n';
156
+
157
+ }
158
+
159
+ }
160
+
161
+ // update index
162
+ indexVertex += nbVertex;
163
+ indexVertexUvs += nbVertexUvs;
164
+ indexNormals += nbNormals;
165
+
166
+ }
167
+
168
+ function parseLine( line ) {
169
+
170
+ let nbVertex = 0;
171
+
172
+ const geometry = line.geometry;
173
+ const type = line.type;
174
+
175
+ // shortcuts
176
+ const vertices = geometry.getAttribute( 'position' );
177
+
178
+ // name of the line object
179
+ output += 'o ' + line.name + '\n';
180
+
181
+ if ( vertices !== undefined ) {
182
+
183
+ for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) {
184
+
185
+ vertex.fromBufferAttribute( vertices, i );
186
+
187
+ // transform the vertex to world space
188
+ vertex.applyMatrix4( line.matrixWorld );
189
+
190
+ // transform the vertex to export format
191
+ output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n';
192
+
193
+ }
194
+
195
+ }
196
+
197
+ if ( type === 'Line' ) {
198
+
199
+ output += 'l ';
200
+
201
+ for ( let j = 1, l = vertices.count; j <= l; j ++ ) {
202
+
203
+ output += ( indexVertex + j ) + ' ';
204
+
205
+ }
206
+
207
+ output += '\n';
208
+
209
+ }
210
+
211
+ if ( type === 'LineSegments' ) {
212
+
213
+ for ( let j = 1, k = j + 1, l = vertices.count; j < l; j += 2, k = j + 1 ) {
214
+
215
+ output += 'l ' + ( indexVertex + j ) + ' ' + ( indexVertex + k ) + '\n';
216
+
217
+ }
218
+
219
+ }
220
+
221
+ // update index
222
+ indexVertex += nbVertex;
223
+
224
+ }
225
+
226
+ function parsePoints( points ) {
227
+
228
+ let nbVertex = 0;
229
+
230
+ const geometry = points.geometry;
231
+
232
+ const vertices = geometry.getAttribute( 'position' );
233
+ const colors = geometry.getAttribute( 'color' );
234
+
235
+ output += 'o ' + points.name + '\n';
236
+
237
+ if ( vertices !== undefined ) {
238
+
239
+ for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) {
240
+
241
+ vertex.fromBufferAttribute( vertices, i );
242
+ vertex.applyMatrix4( points.matrixWorld );
243
+
244
+ output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z;
245
+
246
+ if ( colors !== undefined ) {
247
+
248
+ color.fromBufferAttribute( colors, i );
249
+
250
+ THREE.ColorManagement.workingToColorSpace( color, THREE.SRGBColorSpace );
251
+
252
+ output += ' ' + color.r + ' ' + color.g + ' ' + color.b;
253
+
254
+ }
255
+
256
+ output += '\n';
257
+
258
+ }
259
+
260
+ output += 'p ';
261
+
262
+ for ( let j = 1, l = vertices.count; j <= l; j ++ ) {
263
+
264
+ output += ( indexVertex + j ) + ' ';
265
+
266
+ }
267
+
268
+ output += '\n';
269
+
270
+ }
271
+
272
+ // update index
273
+ indexVertex += nbVertex;
274
+
275
+ }
276
+
277
+ object.traverse( function ( child ) {
278
+
279
+ if ( child.isMesh === true ) {
280
+
281
+ parseMesh( child );
282
+
283
+ }
284
+
285
+ if ( child.isLine === true ) {
286
+
287
+ parseLine( child );
288
+
289
+ }
290
+
291
+ if ( child.isPoints === true ) {
292
+
293
+ parsePoints( child );
294
+
295
+ }
296
+
297
+ } );
298
+
299
+ return output;
300
+
301
+ }
302
+
303
+ }
304
+
305
+ exports.OBJExporter = OBJExporter;