@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,301 @@
1
- import{Vector3 as n,Color as o,Vector2 as t,Matrix3 as e,ColorManagement as f,SRGBColorSpace as i}from"three";class l{parse(l){let r="",s=0,c=0,v=0;const u=new n,p=new o,d=new n,m=new t,w=[];return l.traverse(function(n){!0===n.isMesh&&function(n){let o=0,t=0,f=0;const i=n.geometry,l=new e,p=i.getAttribute("position"),a=i.getAttribute("normal"),L=i.getAttribute("uv"),g=i.getIndex();if(r+="o "+n.name+"\n",n.material&&n.material.name&&(r+="usemtl "+n.material.name+"\n"),void 0!==p)for(let t=0,e=p.count;t<e;t++,o++)u.fromBufferAttribute(p,t),u.applyMatrix4(n.matrixWorld),r+="v "+u.x+" "+u.y+" "+u.z+"\n";if(void 0!==L)for(let n=0,o=L.count;n<o;n++,f++)m.fromBufferAttribute(L,n),r+="vt "+m.x+" "+m.y+"\n";if(void 0!==a){l.getNormalMatrix(n.matrixWorld);for(let n=0,o=a.count;n<o;n++,t++)d.fromBufferAttribute(a,n),d.applyMatrix3(l).normalize(),r+="vn "+d.x+" "+d.y+" "+d.z+"\n"}if(null!==g)for(let n=0,o=g.count;n<o;n+=3){for(let o=0;o<3;o++){const t=g.getX(n+o)+1;w[o]=s+t+(a||L?"/"+(L?c+t:"")+(a?"/"+(v+t):""):"")}r+="f "+w.join(" ")+"\n"}else for(let n=0,o=p.count;n<o;n+=3){for(let o=0;o<3;o++){const t=n+o+1;w[o]=s+t+(a||L?"/"+(L?c+t:"")+(a?"/"+(v+t):""):"")}r+="f "+w.join(" ")+"\n"}s+=o,c+=f,v+=t}(n),!0===n.isLine&&function(n){let o=0;const t=n.geometry,e=n.type,f=t.getAttribute("position");if(r+="o "+n.name+"\n",void 0!==f)for(let t=0,e=f.count;t<e;t++,o++)u.fromBufferAttribute(f,t),u.applyMatrix4(n.matrixWorld),r+="v "+u.x+" "+u.y+" "+u.z+"\n";if("Line"===e){r+="l ";for(let n=1,o=f.count;n<=o;n++)r+=s+n+" ";r+="\n"}if("LineSegments"===e)for(let n=1,o=n+1,t=f.count;n<t;n+=2,o=n+1)r+="l "+(s+n)+" "+(s+o)+"\n";s+=o}(n),!0===n.isPoints&&function(n){let o=0;const t=n.geometry,e=t.getAttribute("position"),l=t.getAttribute("color");if(r+="o "+n.name+"\n",void 0!==e){for(let t=0,s=e.count;t<s;t++,o++)u.fromBufferAttribute(e,t),u.applyMatrix4(n.matrixWorld),r+="v "+u.x+" "+u.y+" "+u.z,void 0!==l&&(p.fromBufferAttribute(l,t),f.workingToColorSpace(p,i),r+=" "+p.r+" "+p.g+" "+p.b),r+="\n";r+="p ";for(let n=1,o=e.count;n<=o;n++)r+=s+n+" ";r+="\n"}s+=o}(n)}),r}}export{l as OBJExporter};
1
+ import { Vector3, Color, Vector2, Matrix3, ColorManagement, SRGBColorSpace } from 'three';
2
+
3
+ /**
4
+ * An exporter for OBJ.
5
+ *
6
+ * `OBJExporter` is not able to export material data into MTL files so only geometry data are supported.
7
+ *
8
+ * ```js
9
+ * const exporter = new OBJExporter();
10
+ * const data = exporter.parse( scene );
11
+ * ```
12
+ *
13
+ * @three_import import { OBJExporter } from 'three/addons/exporters/OBJExporter.js';
14
+ */
15
+ class OBJExporter {
16
+
17
+ /**
18
+ * Parses the given 3D object and generates the OBJ output.
19
+ *
20
+ * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file.
21
+ *
22
+ * @param {Object3D} object - The 3D object to export.
23
+ * @return {string} The exported OBJ.
24
+ */
25
+ parse( object ) {
26
+
27
+ let output = '';
28
+
29
+ let indexVertex = 0;
30
+ let indexVertexUvs = 0;
31
+ let indexNormals = 0;
32
+
33
+ const vertex = new Vector3();
34
+ const color = new Color();
35
+ const normal = new Vector3();
36
+ const uv = new Vector2();
37
+
38
+ const face = [];
39
+
40
+ function parseMesh( mesh ) {
41
+
42
+ let nbVertex = 0;
43
+ let nbNormals = 0;
44
+ let nbVertexUvs = 0;
45
+
46
+ const geometry = mesh.geometry;
47
+
48
+ const normalMatrixWorld = new Matrix3();
49
+
50
+ // shortcuts
51
+ const vertices = geometry.getAttribute( 'position' );
52
+ const normals = geometry.getAttribute( 'normal' );
53
+ const uvs = geometry.getAttribute( 'uv' );
54
+ const indices = geometry.getIndex();
55
+
56
+ // name of the mesh object
57
+ output += 'o ' + mesh.name + '\n';
58
+
59
+ // name of the mesh material
60
+ if ( mesh.material && mesh.material.name ) {
61
+
62
+ output += 'usemtl ' + mesh.material.name + '\n';
63
+
64
+ }
65
+
66
+ // vertices
67
+
68
+ if ( vertices !== undefined ) {
69
+
70
+ for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) {
71
+
72
+ vertex.fromBufferAttribute( vertices, i );
73
+
74
+ // transform the vertex to world space
75
+ vertex.applyMatrix4( mesh.matrixWorld );
76
+
77
+ // transform the vertex to export format
78
+ output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n';
79
+
80
+ }
81
+
82
+ }
83
+
84
+ // uvs
85
+
86
+ if ( uvs !== undefined ) {
87
+
88
+ for ( let i = 0, l = uvs.count; i < l; i ++, nbVertexUvs ++ ) {
89
+
90
+ uv.fromBufferAttribute( uvs, i );
91
+
92
+ // transform the uv to export format
93
+ output += 'vt ' + uv.x + ' ' + uv.y + '\n';
94
+
95
+ }
96
+
97
+ }
98
+
99
+ // normals
100
+
101
+ if ( normals !== undefined ) {
102
+
103
+ normalMatrixWorld.getNormalMatrix( mesh.matrixWorld );
104
+
105
+ for ( let i = 0, l = normals.count; i < l; i ++, nbNormals ++ ) {
106
+
107
+ normal.fromBufferAttribute( normals, i );
108
+
109
+ // transform the normal to world space
110
+ normal.applyMatrix3( normalMatrixWorld ).normalize();
111
+
112
+ // transform the normal to export format
113
+ output += 'vn ' + normal.x + ' ' + normal.y + ' ' + normal.z + '\n';
114
+
115
+ }
116
+
117
+ }
118
+
119
+ // faces
120
+
121
+ if ( indices !== null ) {
122
+
123
+ for ( let i = 0, l = indices.count; i < l; i += 3 ) {
124
+
125
+ for ( let m = 0; m < 3; m ++ ) {
126
+
127
+ const j = indices.getX( i + m ) + 1;
128
+
129
+ face[ m ] = ( indexVertex + j ) + ( normals || uvs ? '/' + ( uvs ? ( indexVertexUvs + j ) : '' ) + ( normals ? '/' + ( indexNormals + j ) : '' ) : '' );
130
+
131
+ }
132
+
133
+ // transform the face to export format
134
+ output += 'f ' + face.join( ' ' ) + '\n';
135
+
136
+ }
137
+
138
+ } else {
139
+
140
+ for ( let i = 0, l = vertices.count; i < l; i += 3 ) {
141
+
142
+ for ( let m = 0; m < 3; m ++ ) {
143
+
144
+ const j = i + m + 1;
145
+
146
+ face[ m ] = ( indexVertex + j ) + ( normals || uvs ? '/' + ( uvs ? ( indexVertexUvs + j ) : '' ) + ( normals ? '/' + ( indexNormals + j ) : '' ) : '' );
147
+
148
+ }
149
+
150
+ // transform the face to export format
151
+ output += 'f ' + face.join( ' ' ) + '\n';
152
+
153
+ }
154
+
155
+ }
156
+
157
+ // update index
158
+ indexVertex += nbVertex;
159
+ indexVertexUvs += nbVertexUvs;
160
+ indexNormals += nbNormals;
161
+
162
+ }
163
+
164
+ function parseLine( line ) {
165
+
166
+ let nbVertex = 0;
167
+
168
+ const geometry = line.geometry;
169
+ const type = line.type;
170
+
171
+ // shortcuts
172
+ const vertices = geometry.getAttribute( 'position' );
173
+
174
+ // name of the line object
175
+ output += 'o ' + line.name + '\n';
176
+
177
+ if ( vertices !== undefined ) {
178
+
179
+ for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) {
180
+
181
+ vertex.fromBufferAttribute( vertices, i );
182
+
183
+ // transform the vertex to world space
184
+ vertex.applyMatrix4( line.matrixWorld );
185
+
186
+ // transform the vertex to export format
187
+ output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n';
188
+
189
+ }
190
+
191
+ }
192
+
193
+ if ( type === 'Line' ) {
194
+
195
+ output += 'l ';
196
+
197
+ for ( let j = 1, l = vertices.count; j <= l; j ++ ) {
198
+
199
+ output += ( indexVertex + j ) + ' ';
200
+
201
+ }
202
+
203
+ output += '\n';
204
+
205
+ }
206
+
207
+ if ( type === 'LineSegments' ) {
208
+
209
+ for ( let j = 1, k = j + 1, l = vertices.count; j < l; j += 2, k = j + 1 ) {
210
+
211
+ output += 'l ' + ( indexVertex + j ) + ' ' + ( indexVertex + k ) + '\n';
212
+
213
+ }
214
+
215
+ }
216
+
217
+ // update index
218
+ indexVertex += nbVertex;
219
+
220
+ }
221
+
222
+ function parsePoints( points ) {
223
+
224
+ let nbVertex = 0;
225
+
226
+ const geometry = points.geometry;
227
+
228
+ const vertices = geometry.getAttribute( 'position' );
229
+ const colors = geometry.getAttribute( 'color' );
230
+
231
+ output += 'o ' + points.name + '\n';
232
+
233
+ if ( vertices !== undefined ) {
234
+
235
+ for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) {
236
+
237
+ vertex.fromBufferAttribute( vertices, i );
238
+ vertex.applyMatrix4( points.matrixWorld );
239
+
240
+ output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z;
241
+
242
+ if ( colors !== undefined ) {
243
+
244
+ color.fromBufferAttribute( colors, i );
245
+
246
+ ColorManagement.workingToColorSpace( color, SRGBColorSpace );
247
+
248
+ output += ' ' + color.r + ' ' + color.g + ' ' + color.b;
249
+
250
+ }
251
+
252
+ output += '\n';
253
+
254
+ }
255
+
256
+ output += 'p ';
257
+
258
+ for ( let j = 1, l = vertices.count; j <= l; j ++ ) {
259
+
260
+ output += ( indexVertex + j ) + ' ';
261
+
262
+ }
263
+
264
+ output += '\n';
265
+
266
+ }
267
+
268
+ // update index
269
+ indexVertex += nbVertex;
270
+
271
+ }
272
+
273
+ object.traverse( function ( child ) {
274
+
275
+ if ( child.isMesh === true ) {
276
+
277
+ parseMesh( child );
278
+
279
+ }
280
+
281
+ if ( child.isLine === true ) {
282
+
283
+ parseLine( child );
284
+
285
+ }
286
+
287
+ if ( child.isPoints === true ) {
288
+
289
+ parsePoints( child );
290
+
291
+ }
292
+
293
+ } );
294
+
295
+ return output;
296
+
297
+ }
298
+
299
+ }
300
+
301
+ export { OBJExporter };