@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.
Files changed (54) hide show
  1. package/README.md +0 -0
  2. package/dist/bundle/index.js +14259 -0
  3. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +353 -0
  4. package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1292 -0
  5. package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +1543 -0
  6. package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4374 -0
  7. package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +465 -0
  8. package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +117 -0
  9. package/dist/cjs/src/ConnectionManager.js +114 -0
  10. package/dist/cjs/src/Pathfinder.js +88 -0
  11. package/dist/cjs/src/animationManager.js +121 -0
  12. package/dist/cjs/src/componentManager.js +151 -0
  13. package/dist/cjs/src/debugLogger.js +176 -0
  14. package/dist/cjs/src/disposalManager.js +185 -0
  15. package/dist/cjs/src/environmentManager.js +1015 -0
  16. package/dist/cjs/src/hotReloadManager.js +252 -0
  17. package/dist/cjs/src/index.js +126 -0
  18. package/dist/cjs/src/keyboardControlsManager.js +206 -0
  19. package/dist/cjs/src/modelPreloader.js +360 -0
  20. package/dist/cjs/src/nameUtils.js +106 -0
  21. package/dist/cjs/src/pathfindingManager.js +321 -0
  22. package/dist/cjs/src/performanceMonitor.js +718 -0
  23. package/dist/cjs/src/sceneExportManager.js +292 -0
  24. package/dist/cjs/src/sceneInitializationManager.js +540 -0
  25. package/dist/cjs/src/sceneOperationsManager.js +560 -0
  26. package/dist/cjs/src/textureConfig.js +195 -0
  27. package/dist/cjs/src/transformControlsManager.js +851 -0
  28. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +328 -0
  29. package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1287 -0
  30. package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +1537 -0
  31. package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4370 -0
  32. package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +461 -0
  33. package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +113 -0
  34. package/dist/esm/src/ConnectionManager.js +110 -0
  35. package/dist/esm/src/Pathfinder.js +84 -0
  36. package/dist/esm/src/animationManager.js +112 -0
  37. package/dist/esm/src/componentManager.js +123 -0
  38. package/dist/esm/src/debugLogger.js +167 -0
  39. package/dist/esm/src/disposalManager.js +155 -0
  40. package/dist/esm/src/environmentManager.js +989 -0
  41. package/dist/esm/src/hotReloadManager.js +244 -0
  42. package/dist/esm/src/index.js +117 -0
  43. package/dist/esm/src/keyboardControlsManager.js +196 -0
  44. package/dist/esm/src/modelPreloader.js +337 -0
  45. package/dist/esm/src/nameUtils.js +99 -0
  46. package/dist/esm/src/pathfindingManager.js +295 -0
  47. package/dist/esm/src/performanceMonitor.js +712 -0
  48. package/dist/esm/src/sceneExportManager.js +286 -0
  49. package/dist/esm/src/sceneInitializationManager.js +513 -0
  50. package/dist/esm/src/sceneOperationsManager.js +536 -0
  51. package/dist/esm/src/textureConfig.js +168 -0
  52. package/dist/esm/src/transformControlsManager.js +827 -0
  53. package/dist/index.d.ts +259 -0
  54. package/package.json +53 -0
@@ -0,0 +1,195 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
6
+ var THREE = require('three');
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n["default"] = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
27
+
28
+ var TEXTURE_SETS = {
29
+ // Light metallic texture using the gravel_embedded_concrete with metallic properties
30
+ light_metal: {
31
+ path: 'https://central-plant-assets.s3.us-east-1.amazonaws.com/textures/gravel_embedded_concrete_1k',
32
+ files: {
33
+ diffuse: 'diffuse.jpg',
34
+ normal: 'normal.jpg',
35
+ roughness: 'rough.jpg'
36
+ },
37
+ repeat: {
38
+ x: 2,
39
+ y: 2
40
+ },
41
+ // Moderate tiling for surface detail
42
+ materialProps: {
43
+ color: 0xb8b8b8,
44
+ // Light metallic base color
45
+ metalness: 0.3,
46
+ roughness: 0.3,
47
+ normalScale: [0.4, 0.4],
48
+ // Subtle surface detail
49
+ clearcoat: 0.3,
50
+ clearcoatRoughness: 0.2,
51
+ envMapIntensity: 1.6,
52
+ reflectivity: 0.5
53
+ }
54
+ },
55
+ brick: {
56
+ path: 'https://central-plant-assets.s3.us-east-1.amazonaws.com/textures/pavement_03_1k',
57
+ files: {
58
+ diffuse: 'diffuse.jpg',
59
+ normal: 'normal.jpg',
60
+ roughness: 'rough.jpg'
61
+ },
62
+ repeat: {
63
+ x: 7.5,
64
+ y: 0.75
65
+ },
66
+ // Adjust for proper brick scale
67
+ materialProps: {
68
+ color: 0x998888,
69
+ roughness: 0.9,
70
+ metalness: 0.1,
71
+ normalScale: [1.5, 1.5],
72
+ bumpScale: 0.05,
73
+ clearcoat: 0.05,
74
+ clearcoatRoughness: 0.4
75
+ }
76
+ },
77
+ gravel_embedded_concrete: {
78
+ path: 'https://central-plant-assets.s3.us-east-1.amazonaws.com/textures/gravel_embedded_concrete_1k',
79
+ files: {
80
+ diffuse: 'diffuse.jpg',
81
+ normal: 'normal.jpg',
82
+ roughness: 'rough.jpg'
83
+ },
84
+ repeat: {
85
+ x: 3,
86
+ y: 3
87
+ },
88
+ materialProps: {
89
+ color: 0xffffff,
90
+ roughness: 0.9,
91
+ metalness: 0.1,
92
+ normalScale: [1.0, 1.0],
93
+ bumpScale: 0.1
94
+ }
95
+ }
96
+ };
97
+
98
+ /**
99
+ * Create a Three.js texture with appropriate settings
100
+ */
101
+ function createTexture(textureLoader, url) {
102
+ var repeat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
103
+ x: 1,
104
+ y: 1
105
+ };
106
+ if (!textureLoader) {
107
+ textureLoader = new THREE__namespace.TextureLoader();
108
+ }
109
+ try {
110
+ var texture = textureLoader.load(url);
111
+ texture.wrapS = THREE__namespace.RepeatWrapping;
112
+ texture.wrapT = THREE__namespace.RepeatWrapping;
113
+ texture.repeat.set(repeat.x, repeat.y);
114
+ texture.colorSpace = THREE__namespace.SRGBColorSpace;
115
+ return texture;
116
+ } catch (error) {
117
+ console.error("Failed to load texture: ".concat(url), error);
118
+ return null;
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Load a texture set and create a material
124
+ */
125
+ function loadTextureSetAndCreateMaterial(_x, _x2) {
126
+ return _loadTextureSetAndCreateMaterial.apply(this, arguments);
127
+ }
128
+ function _loadTextureSetAndCreateMaterial() {
129
+ _loadTextureSetAndCreateMaterial = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee(component, textureSetName) {
130
+ var textureSet, textureLoader, repeat, loadedTextures, loadTexture, material;
131
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
132
+ while (1) switch (_context.n) {
133
+ case 0:
134
+ if (component) {
135
+ _context.n = 1;
136
+ break;
137
+ }
138
+ console.warn('Component is required for texture loading');
139
+ return _context.a(2, new THREE__namespace.MeshStandardMaterial({
140
+ color: 0xaaaaaa
141
+ }));
142
+ case 1:
143
+ textureSet = TEXTURE_SETS[textureSetName];
144
+ if (textureSet) {
145
+ _context.n = 2;
146
+ break;
147
+ }
148
+ console.warn("Texture set not found: ".concat(textureSetName));
149
+ return _context.a(2, new THREE__namespace.MeshStandardMaterial({
150
+ color: 0xaaaaaa
151
+ }));
152
+ case 2:
153
+ textureLoader = component.textureLoader || new THREE__namespace.TextureLoader();
154
+ repeat = textureSet.repeat || {
155
+ x: 1,
156
+ y: 1
157
+ };
158
+ loadedTextures = {}; // Function to load a specific texture from the set
159
+ loadTexture = function loadTexture(type) {
160
+ if (!textureSet.files[type]) return null;
161
+ var url = "".concat(textureSet.path, "/").concat(textureSet.files[type]);
162
+ return createTexture(textureLoader, url, repeat);
163
+ }; // Load all textures in the set
164
+ Object.keys(textureSet.files).forEach(function (type) {
165
+ loadedTextures[type] = loadTexture(type);
166
+ });
167
+
168
+ // Create material with textures and properties
169
+ material = new THREE__namespace.MeshStandardMaterial(_rollupPluginBabelHelpers.objectSpread2({
170
+ map: loadedTextures.diffuse,
171
+ normalMap: loadedTextures.normal,
172
+ roughnessMap: loadedTextures.roughness,
173
+ metalnessMap: loadedTextures.metalness,
174
+ aoMap: loadedTextures.ao,
175
+ displacementMap: loadedTextures.displacement
176
+ }, textureSet.materialProps)); // Add the environment map if available from the component
177
+ if (component.scene && component.scene.environment) {
178
+ material.envMap = component.scene.environment;
179
+ }
180
+ return _context.a(2, material);
181
+ }
182
+ }, _callee);
183
+ }));
184
+ return _loadTextureSetAndCreateMaterial.apply(this, arguments);
185
+ }
186
+ var textureConfig = {
187
+ TEXTURE_SETS: TEXTURE_SETS,
188
+ createTexture: createTexture,
189
+ loadTextureSetAndCreateMaterial: loadTextureSetAndCreateMaterial
190
+ };
191
+
192
+ exports.TEXTURE_SETS = TEXTURE_SETS;
193
+ exports.createTexture = createTexture;
194
+ exports["default"] = textureConfig;
195
+ exports.loadTextureSetAndCreateMaterial = loadTextureSetAndCreateMaterial;