mesheditor 0.0.0-stage → 1.0.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 (258) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +853 -2
  3. package/dist-lib/esm/AIAgentService.d.ts +106 -0
  4. package/dist-lib/esm/AIAgentService.js +1471 -0
  5. package/dist-lib/esm/MeshEditorApp.d.ts +412 -0
  6. package/dist-lib/esm/MeshEditorApp.js +9092 -0
  7. package/dist-lib/esm/MeshEditorService.d.ts +459 -0
  8. package/dist-lib/esm/MeshEditorService.js +7083 -0
  9. package/dist-lib/esm/Neural3DGeneratorService.d.ts +88 -0
  10. package/dist-lib/esm/Neural3DGeneratorService.js +1397 -0
  11. package/dist-lib/esm/adapters/BrowserPlatformAdapter.d.ts +16 -0
  12. package/dist-lib/esm/adapters/BrowserPlatformAdapter.js +25 -0
  13. package/dist-lib/esm/adapters/ElectronPlatformAdapter.d.ts +32 -0
  14. package/dist-lib/esm/adapters/ElectronPlatformAdapter.js +336 -0
  15. package/dist-lib/esm/adapters/HostAppAdapter.d.ts +54 -0
  16. package/dist-lib/esm/adapters/HostAppAdapter.js +75 -0
  17. package/dist-lib/esm/adapters/PlatformAdapter.d.ts +98 -0
  18. package/dist-lib/esm/adapters/PlatformAdapter.js +1 -0
  19. package/dist-lib/esm/adapters/index.d.ts +13 -0
  20. package/dist-lib/esm/adapters/index.js +15 -0
  21. package/dist-lib/esm/assets/fonts/Droid_Sans_Bold.json +1 -0
  22. package/dist-lib/esm/assets/fonts/Droid_Sans_Regular.json +1 -0
  23. package/dist-lib/esm/assets/fonts/Kenney_Future_Regular.json +1 -0
  24. package/dist-lib/esm/baking/TextureBaker.d.ts +84 -0
  25. package/dist-lib/esm/baking/TextureBaker.js +709 -0
  26. package/dist-lib/esm/builtInSkills.d.ts +19 -0
  27. package/dist-lib/esm/builtInSkills.js +186 -0
  28. package/dist-lib/esm/compression/ModelCompressor.d.ts +87 -0
  29. package/dist-lib/esm/compression/ModelCompressor.js +553 -0
  30. package/dist-lib/esm/decals/DecalController.d.ts +147 -0
  31. package/dist-lib/esm/decals/DecalController.js +1031 -0
  32. package/dist-lib/esm/decals/decalAssetUrls.d.ts +1 -0
  33. package/dist-lib/esm/decals/decalAssetUrls.js +16 -0
  34. package/dist-lib/esm/geometry/architecture.d.ts +114 -0
  35. package/dist-lib/esm/geometry/architecture.js +832 -0
  36. package/dist-lib/esm/geometry/bevelModifier.d.ts +59 -0
  37. package/dist-lib/esm/geometry/bevelModifier.js +345 -0
  38. package/dist-lib/esm/geometry/facetSurfaceUtils.d.ts +127 -0
  39. package/dist-lib/esm/geometry/facetSurfaceUtils.js +676 -0
  40. package/dist-lib/esm/geometry/roundedBox.d.ts +15 -0
  41. package/dist-lib/esm/geometry/roundedBox.js +133 -0
  42. package/dist-lib/esm/index.d.ts +21 -0
  43. package/dist-lib/esm/index.js +50 -0
  44. package/dist-lib/esm/pathExtrusion/PathExtrusionController.d.ts +59 -0
  45. package/dist-lib/esm/pathExtrusion/PathExtrusionController.js +483 -0
  46. package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.d.ts +76 -0
  47. package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.js +1792 -0
  48. package/dist-lib/esm/pathExtrusion/PathFactory.d.ts +95 -0
  49. package/dist-lib/esm/pathExtrusion/PathFactory.js +627 -0
  50. package/dist-lib/esm/pathExtrusion/index.d.ts +4 -0
  51. package/dist-lib/esm/pathExtrusion/index.js +4 -0
  52. package/dist-lib/esm/pathExtrusion/types.d.ts +50 -0
  53. package/dist-lib/esm/pathExtrusion/types.js +1 -0
  54. package/dist-lib/esm/plugin.d.ts +250 -0
  55. package/dist-lib/esm/plugin.js +144 -0
  56. package/dist-lib/esm/rigging/WeightPaintController.d.ts +162 -0
  57. package/dist-lib/esm/rigging/WeightPaintController.js +1421 -0
  58. package/dist-lib/esm/sculpting/SculptController.d.ts +146 -0
  59. package/dist-lib/esm/sculpting/SculptController.js +2038 -0
  60. package/dist-lib/esm/sdf/index.d.ts +2 -0
  61. package/dist-lib/esm/sdf/index.js +2 -0
  62. package/dist-lib/esm/sdf/sdfPrimitives.d.ts +97 -0
  63. package/dist-lib/esm/sdf/sdfPrimitives.js +402 -0
  64. package/dist-lib/esm/sdf/surfaceNets.d.ts +29 -0
  65. package/dist-lib/esm/sdf/surfaceNets.js +399 -0
  66. package/dist-lib/esm/styles.d.ts +11 -0
  67. package/dist-lib/esm/styles.js +32 -0
  68. package/dist-lib/esm/template.d.ts +12 -0
  69. package/dist-lib/esm/template.js +19 -0
  70. package/dist-lib/esm/textMesh/TextMeshController.d.ts +61 -0
  71. package/dist-lib/esm/textMesh/TextMeshController.js +405 -0
  72. package/dist-lib/esm/textures/AITextureGenerator.d.ts +119 -0
  73. package/dist-lib/esm/textures/AITextureGenerator.js +945 -0
  74. package/dist-lib/esm/textures/ExternalImageGeneratorService.d.ts +62 -0
  75. package/dist-lib/esm/textures/ExternalImageGeneratorService.js +879 -0
  76. package/dist-lib/esm/tools/AbstractTool.d.ts +68 -0
  77. package/dist-lib/esm/tools/AbstractTool.js +128 -0
  78. package/dist-lib/esm/tools/ToolExecutionContext.d.ts +40 -0
  79. package/dist-lib/esm/tools/ToolExecutionContext.js +1 -0
  80. package/dist-lib/esm/tools/ToolInterface.d.ts +104 -0
  81. package/dist-lib/esm/tools/ToolInterface.js +1 -0
  82. package/dist-lib/esm/tools/ToolRegistry.d.ts +43 -0
  83. package/dist-lib/esm/tools/ToolRegistry.js +115 -0
  84. package/dist-lib/esm/tools/builtin/ApplyMaterialTool.d.ts +34 -0
  85. package/dist-lib/esm/tools/builtin/ApplyMaterialTool.js +48 -0
  86. package/dist-lib/esm/tools/builtin/AutoUVMappingTool.d.ts +34 -0
  87. package/dist-lib/esm/tools/builtin/AutoUVMappingTool.js +54 -0
  88. package/dist-lib/esm/tools/builtin/BakeTexturesTool.d.ts +42 -0
  89. package/dist-lib/esm/tools/builtin/BakeTexturesTool.js +81 -0
  90. package/dist-lib/esm/tools/builtin/BooleanOperationTool.d.ts +51 -0
  91. package/dist-lib/esm/tools/builtin/BooleanOperationTool.js +86 -0
  92. package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.d.ts +78 -0
  93. package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.js +170 -0
  94. package/dist-lib/esm/tools/builtin/CloneArrayTool.d.ts +75 -0
  95. package/dist-lib/esm/tools/builtin/CloneArrayTool.js +115 -0
  96. package/dist-lib/esm/tools/builtin/CreateArchTool.d.ts +118 -0
  97. package/dist-lib/esm/tools/builtin/CreateArchTool.js +89 -0
  98. package/dist-lib/esm/tools/builtin/CreateColumnTool.d.ts +114 -0
  99. package/dist-lib/esm/tools/builtin/CreateColumnTool.js +105 -0
  100. package/dist-lib/esm/tools/builtin/CreateLatheTool.d.ts +87 -0
  101. package/dist-lib/esm/tools/builtin/CreateLatheTool.js +60 -0
  102. package/dist-lib/esm/tools/builtin/CreateMaterialTool.d.ts +114 -0
  103. package/dist-lib/esm/tools/builtin/CreateMaterialTool.js +212 -0
  104. package/dist-lib/esm/tools/builtin/CreateMoldingTool.d.ts +120 -0
  105. package/dist-lib/esm/tools/builtin/CreateMoldingTool.js +95 -0
  106. package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.d.ts +162 -0
  107. package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.js +302 -0
  108. package/dist-lib/esm/tools/builtin/CreateRoofTool.d.ts +120 -0
  109. package/dist-lib/esm/tools/builtin/CreateRoofTool.js +108 -0
  110. package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.d.ts +101 -0
  111. package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.js +79 -0
  112. package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.d.ts +224 -0
  113. package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.js +238 -0
  114. package/dist-lib/esm/tools/builtin/CreateStairsTool.d.ts +135 -0
  115. package/dist-lib/esm/tools/builtin/CreateStairsTool.js +119 -0
  116. package/dist-lib/esm/tools/builtin/CreateTextMeshTool.d.ts +94 -0
  117. package/dist-lib/esm/tools/builtin/CreateTextMeshTool.js +131 -0
  118. package/dist-lib/esm/tools/builtin/CreateTubeTool.d.ts +87 -0
  119. package/dist-lib/esm/tools/builtin/CreateTubeTool.js +59 -0
  120. package/dist-lib/esm/tools/builtin/CreateWallTool.d.ts +145 -0
  121. package/dist-lib/esm/tools/builtin/CreateWallTool.js +124 -0
  122. package/dist-lib/esm/tools/builtin/DecalTool.d.ts +76 -0
  123. package/dist-lib/esm/tools/builtin/DecalTool.js +143 -0
  124. package/dist-lib/esm/tools/builtin/DeleteMeshTool.d.ts +20 -0
  125. package/dist-lib/esm/tools/builtin/DeleteMeshTool.js +42 -0
  126. package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.d.ts +21 -0
  127. package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.js +96 -0
  128. package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.d.ts +114 -0
  129. package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.js +77 -0
  130. package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.d.ts +104 -0
  131. package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.js +68 -0
  132. package/dist-lib/esm/tools/builtin/FacetArcTool.d.ts +36 -0
  133. package/dist-lib/esm/tools/builtin/FacetArcTool.js +57 -0
  134. package/dist-lib/esm/tools/builtin/FacetCutThroughTool.d.ts +30 -0
  135. package/dist-lib/esm/tools/builtin/FacetCutThroughTool.js +49 -0
  136. package/dist-lib/esm/tools/builtin/FacetExtrudeTool.d.ts +30 -0
  137. package/dist-lib/esm/tools/builtin/FacetExtrudeTool.js +49 -0
  138. package/dist-lib/esm/tools/builtin/FacetInsetTool.d.ts +34 -0
  139. package/dist-lib/esm/tools/builtin/FacetInsetTool.js +55 -0
  140. package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.d.ts +131 -0
  141. package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.js +455 -0
  142. package/dist-lib/esm/tools/builtin/GenerateTextureTool.d.ts +87 -0
  143. package/dist-lib/esm/tools/builtin/GenerateTextureTool.js +216 -0
  144. package/dist-lib/esm/tools/builtin/GetSceneInfoTool.d.ts +11 -0
  145. package/dist-lib/esm/tools/builtin/GetSceneInfoTool.js +12 -0
  146. package/dist-lib/esm/tools/builtin/MergeMeshesTool.d.ts +28 -0
  147. package/dist-lib/esm/tools/builtin/MergeMeshesTool.js +56 -0
  148. package/dist-lib/esm/tools/builtin/PlanModelTool.d.ts +87 -0
  149. package/dist-lib/esm/tools/builtin/PlanModelTool.js +155 -0
  150. package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.d.ts +50 -0
  151. package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.js +116 -0
  152. package/dist-lib/esm/tools/builtin/RigWeightTool.d.ts +55 -0
  153. package/dist-lib/esm/tools/builtin/RigWeightTool.js +139 -0
  154. package/dist-lib/esm/tools/builtin/SculptMeshTool.d.ts +138 -0
  155. package/dist-lib/esm/tools/builtin/SculptMeshTool.js +255 -0
  156. package/dist-lib/esm/tools/builtin/SeparateMeshTool.d.ts +21 -0
  157. package/dist-lib/esm/tools/builtin/SeparateMeshTool.js +31 -0
  158. package/dist-lib/esm/tools/builtin/SolidifyMeshTool.d.ts +30 -0
  159. package/dist-lib/esm/tools/builtin/SolidifyMeshTool.js +57 -0
  160. package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.d.ts +66 -0
  161. package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.js +105 -0
  162. package/dist-lib/esm/tools/builtin/SubDSmoothTool.d.ts +23 -0
  163. package/dist-lib/esm/tools/builtin/SubDSmoothTool.js +37 -0
  164. package/dist-lib/esm/tools/builtin/SubdivideMeshTool.d.ts +23 -0
  165. package/dist-lib/esm/tools/builtin/SubdivideMeshTool.js +39 -0
  166. package/dist-lib/esm/tools/builtin/TransformMeshTool.d.ts +78 -0
  167. package/dist-lib/esm/tools/builtin/TransformMeshTool.js +69 -0
  168. package/dist-lib/esm/tools/builtin/UVUnwrapTool.d.ts +48 -0
  169. package/dist-lib/esm/tools/builtin/UVUnwrapTool.js +107 -0
  170. package/dist-lib/esm/tools/builtin/VoxelPainterTool.d.ts +60 -0
  171. package/dist-lib/esm/tools/builtin/VoxelPainterTool.js +153 -0
  172. package/dist-lib/esm/tools/builtin/index.d.ts +44 -0
  173. package/dist-lib/esm/tools/builtin/index.js +44 -0
  174. package/dist-lib/esm/tools/editor/AIAgentEditorTool.d.ts +18 -0
  175. package/dist-lib/esm/tools/editor/AIAgentEditorTool.js +43 -0
  176. package/dist-lib/esm/tools/editor/AITextureEditorTool.d.ts +15 -0
  177. package/dist-lib/esm/tools/editor/AITextureEditorTool.js +28 -0
  178. package/dist-lib/esm/tools/editor/AbstractEditorTool.d.ts +29 -0
  179. package/dist-lib/esm/tools/editor/AbstractEditorTool.js +56 -0
  180. package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.d.ts +17 -0
  181. package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.js +29 -0
  182. package/dist-lib/esm/tools/editor/BakingEditorTool.d.ts +21 -0
  183. package/dist-lib/esm/tools/editor/BakingEditorTool.js +44 -0
  184. package/dist-lib/esm/tools/editor/CSGEditorTool.d.ts +20 -0
  185. package/dist-lib/esm/tools/editor/CSGEditorTool.js +42 -0
  186. package/dist-lib/esm/tools/editor/CompressModelEditorTool.d.ts +20 -0
  187. package/dist-lib/esm/tools/editor/CompressModelEditorTool.js +48 -0
  188. package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.d.ts +17 -0
  189. package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.js +36 -0
  190. package/dist-lib/esm/tools/editor/DecalEditorTool.d.ts +17 -0
  191. package/dist-lib/esm/tools/editor/DecalEditorTool.js +36 -0
  192. package/dist-lib/esm/tools/editor/FacetEditorTool.d.ts +23 -0
  193. package/dist-lib/esm/tools/editor/FacetEditorTool.js +80 -0
  194. package/dist-lib/esm/tools/editor/MaterialEditorTool.d.ts +18 -0
  195. package/dist-lib/esm/tools/editor/MaterialEditorTool.js +43 -0
  196. package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.d.ts +17 -0
  197. package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.js +37 -0
  198. package/dist-lib/esm/tools/editor/OutlinerEditorTool.d.ts +17 -0
  199. package/dist-lib/esm/tools/editor/OutlinerEditorTool.js +34 -0
  200. package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.d.ts +26 -0
  201. package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.js +72 -0
  202. package/dist-lib/esm/tools/editor/RiggingEditorTool.d.ts +27 -0
  203. package/dist-lib/esm/tools/editor/RiggingEditorTool.js +66 -0
  204. package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.d.ts +17 -0
  205. package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.js +35 -0
  206. package/dist-lib/esm/tools/editor/SculptEditorTool.d.ts +28 -0
  207. package/dist-lib/esm/tools/editor/SculptEditorTool.js +70 -0
  208. package/dist-lib/esm/tools/editor/TextMeshEditorTool.d.ts +16 -0
  209. package/dist-lib/esm/tools/editor/TextMeshEditorTool.js +30 -0
  210. package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.d.ts +17 -0
  211. package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.js +28 -0
  212. package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.d.ts +27 -0
  213. package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.js +70 -0
  214. package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.d.ts +26 -0
  215. package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.js +68 -0
  216. package/dist-lib/esm/tools/editor/aiQuickPrompts.d.ts +30 -0
  217. package/dist-lib/esm/tools/editor/aiQuickPrompts.js +228 -0
  218. package/dist-lib/esm/tools/editor/index.d.ts +32 -0
  219. package/dist-lib/esm/tools/editor/index.js +54 -0
  220. package/dist-lib/esm/tools/editor/toolViews.d.ts +10 -0
  221. package/dist-lib/esm/tools/editor/toolViews.js +53 -0
  222. package/dist-lib/esm/tools/editorTools.d.ts +5 -0
  223. package/dist-lib/esm/tools/editorTools.js +5 -0
  224. package/dist-lib/esm/tools/index.d.ts +8 -0
  225. package/dist-lib/esm/tools/index.js +8 -0
  226. package/dist-lib/esm/tools/textureUtils.d.ts +18 -0
  227. package/dist-lib/esm/tools/textureUtils.js +288 -0
  228. package/dist-lib/esm/types.d.ts +164 -0
  229. package/dist-lib/esm/types.js +1 -0
  230. package/dist-lib/esm/uv/UVUnwrapController.d.ts +108 -0
  231. package/dist-lib/esm/uv/UVUnwrapController.js +1022 -0
  232. package/dist-lib/esm/voxel/CustomVoxelMesher.d.ts +15 -0
  233. package/dist-lib/esm/voxel/CustomVoxelMesher.js +169 -0
  234. package/dist-lib/esm/voxel/TextureAtlasManager.d.ts +54 -0
  235. package/dist-lib/esm/voxel/TextureAtlasManager.js +630 -0
  236. package/dist-lib/esm/voxel/VoxelPainterController.d.ts +100 -0
  237. package/dist-lib/esm/voxel/VoxelPainterController.js +671 -0
  238. package/dist-lib/esm/voxel/index.d.ts +4 -0
  239. package/dist-lib/esm/voxel/index.js +4 -0
  240. package/dist-lib/esm/voxel/types.d.ts +78 -0
  241. package/dist-lib/esm/voxel/types.js +1 -0
  242. package/dist-lib/esm/web-component/MeshEditorElement.d.ts +103 -0
  243. package/dist-lib/esm/web-component/MeshEditorElement.js +246 -0
  244. package/dist-lib/esm/web-component/index.d.ts +1 -0
  245. package/dist-lib/esm/web-component/index.js +1 -0
  246. package/dist-lib/index.umd.js +3 -0
  247. package/dist-lib/mesheditor.css +2 -0
  248. package/dist-lib/mesheditor.css.map +1 -0
  249. package/dist-lib/standalone/mesheditor-element.bundle.js +3 -0
  250. package/package.json +114 -4
  251. package/skills/README.md +48 -0
  252. package/skills/figure-sculptor.md +297 -0
  253. package/skills/image-to-mesh.md +18 -0
  254. package/skills/mesh-updater.md +27 -0
  255. package/skills/neural-3d-generator.md +53 -0
  256. package/skills/procedural-modeler.md +267 -0
  257. package/skills/voxel-painter.md +21 -0
  258. package/src/mesheditor.css +6477 -0
@@ -0,0 +1,60 @@
1
+ import { Mesh, MeshBuilder } from '@babylonjs/core';
2
+ import { AbstractTool } from '../AbstractTool';
3
+ export class CreateLatheTool extends AbstractTool {
4
+ name = 'modeler_create_lathe';
5
+ description = 'Creates a rotationally symmetric 3D mesh (vase, goblet, pillar, bottle, chess piece, dome, wheel) by revolving a 2D profile in the XY plane (x >= 0 as radius, y as height) around the Y axis.';
6
+ parameters = {
7
+ type: 'object',
8
+ properties: {
9
+ name: { type: 'string' },
10
+ shape: {
11
+ type: 'array',
12
+ description: 'Profile points { x, y, z: 0 } where x is radius from center and y is height.',
13
+ items: {
14
+ type: 'object',
15
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
16
+ required: ['x', 'y'],
17
+ },
18
+ },
19
+ radius: { type: 'number', description: 'Overall radius multiplier (default 1).' },
20
+ tessellation: { type: 'number', description: 'Radial segments around Y axis (default 32).' },
21
+ arc: { type: 'number', description: 'Portion of circumference 0.0 to 1.0 (default 1.0).' },
22
+ position: {
23
+ type: 'object',
24
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
25
+ },
26
+ rotationDegrees: {
27
+ type: 'object',
28
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
29
+ },
30
+ color: { type: 'string' },
31
+ roughness: { type: 'number' },
32
+ metallic: { type: 'number' },
33
+ materialName: { type: 'string' },
34
+ },
35
+ required: ['shape'],
36
+ };
37
+ execute(args, context) {
38
+ const baseName = (args.name || 'lathe_mesh').replace(/\s+/g, '_');
39
+ const uniqueName = context.findMeshByNameOrId(baseName)
40
+ ? `${baseName}_${Date.now().toString().slice(-4)}`
41
+ : baseName;
42
+ const shape = (args.shape || []).map((p) => this.parseVec3(p, 0));
43
+ const mesh = MeshBuilder.CreateLathe(uniqueName, {
44
+ shape,
45
+ radius: args.radius !== undefined ? Number(args.radius) : 1,
46
+ tessellation: args.tessellation !== undefined ? Number(args.tessellation) : 32,
47
+ arc: args.arc !== undefined ? Number(args.arc) : 1,
48
+ cap: Mesh.CAP_ALL,
49
+ sideOrientation: Mesh.DOUBLESIDE,
50
+ }, context.scene);
51
+ mesh.material = context.getOrCreateMaterial(args.materialName, args.color, args.roughness, args.metallic, uniqueName);
52
+ context.applyTransformArgs(mesh, args);
53
+ context.registerCreatedMesh(mesh);
54
+ return JSON.stringify({
55
+ status: 'ok',
56
+ meshName: mesh.name,
57
+ vertices: mesh.getTotalVertices(),
58
+ });
59
+ }
60
+ }
@@ -0,0 +1,114 @@
1
+ import { AbstractTool } from '../AbstractTool';
2
+ import { ToolExecutionContext } from '../ToolExecutionContext';
3
+ export declare class CreateMaterialTool extends AbstractTool {
4
+ readonly name = "modeler_create_material";
5
+ readonly description = "Creates or updates a PBRMaterial with color, roughness, metallic, emissiveColor, alpha, normal maps, and optional procedural texture (wood, stone, marble, brick, metal, checker, grid, noise, gradient).";
6
+ readonly parameters: {
7
+ type: string;
8
+ properties: {
9
+ materialName: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ albedoColor: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ emissiveColor: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ roughness: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ metallic: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ alpha: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ wireframe: {
34
+ type: string;
35
+ };
36
+ bumpLevel: {
37
+ type: string;
38
+ description: string;
39
+ };
40
+ invertNormalMapX: {
41
+ type: string;
42
+ description: string;
43
+ };
44
+ invertNormalMapY: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ textureUrl: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ normalMapUrl: {
53
+ type: string;
54
+ description: string;
55
+ };
56
+ bumpTextureUrl: {
57
+ type: string;
58
+ description: string;
59
+ };
60
+ useParallax: {
61
+ type: string;
62
+ description: string;
63
+ };
64
+ useParallaxOcclusion: {
65
+ type: string;
66
+ description: string;
67
+ };
68
+ parallaxScaleBias: {
69
+ type: string;
70
+ description: string;
71
+ };
72
+ proceduralNormalMap: {
73
+ type: string;
74
+ description: string;
75
+ };
76
+ uScale: {
77
+ type: string;
78
+ description: string;
79
+ };
80
+ vScale: {
81
+ type: string;
82
+ description: string;
83
+ };
84
+ proceduralTexture: {
85
+ type: string;
86
+ description: string;
87
+ properties: {
88
+ type: {
89
+ type: string;
90
+ enum: string[];
91
+ };
92
+ primaryColor: {
93
+ type: string;
94
+ };
95
+ secondaryColor: {
96
+ type: string;
97
+ };
98
+ scale: {
99
+ type: string;
100
+ };
101
+ uScale: {
102
+ type: string;
103
+ };
104
+ vScale: {
105
+ type: string;
106
+ };
107
+ };
108
+ required: string[];
109
+ };
110
+ };
111
+ required: string[];
112
+ };
113
+ execute(args: any, context: ToolExecutionContext): string;
114
+ }
@@ -0,0 +1,212 @@
1
+ import { Color3, PBRMaterial, Texture } from '@babylonjs/core';
2
+ import { AbstractTool } from '../AbstractTool';
3
+ import { generateProceduralTextureDataUrl, generateProceduralNormalMapDataUrl } from '../textureUtils';
4
+ export class CreateMaterialTool extends AbstractTool {
5
+ name = 'modeler_create_material';
6
+ description = 'Creates or updates a PBRMaterial with color, roughness, metallic, emissiveColor, alpha, normal maps, and optional procedural texture (wood, stone, marble, brick, metal, checker, grid, noise, gradient).';
7
+ parameters = {
8
+ type: 'object',
9
+ properties: {
10
+ materialName: { type: 'string', description: 'Unique name of the material.' },
11
+ albedoColor: { type: 'string', description: 'Hex color string, e.g. "#d4af37".' },
12
+ emissiveColor: { type: 'string', description: 'Optional glowing emissive hex color, e.g. "#00ffcc".' },
13
+ roughness: { type: 'number', description: '0.0 (mirror smooth) to 1.0 (matte rough).' },
14
+ metallic: { type: 'number', description: '0.0 (dielectric/wood/stone) to 1.0 (pure metal).' },
15
+ alpha: { type: 'number', description: 'Opacity 0.0 to 1.0 (default 1.0).' },
16
+ wireframe: { type: 'boolean' },
17
+ bumpLevel: { type: 'number', description: 'Bump / normal map intensity (0.0 to 5.0, default 1.0).' },
18
+ invertNormalMapX: { type: 'boolean', description: 'Invert normal map X axis.' },
19
+ invertNormalMapY: { type: 'boolean', description: 'Invert normal map Y axis (DirectX standard).' },
20
+ textureUrl: {
21
+ type: 'string',
22
+ description: 'Optional URL or data:image base64 URI for diffuse/albedo texture (from image generator or web asset).',
23
+ },
24
+ normalMapUrl: {
25
+ type: 'string',
26
+ description: 'Optional URL or data:image base64 URI for normal map texture (alias for bumpTextureUrl).',
27
+ },
28
+ bumpTextureUrl: {
29
+ type: 'string',
30
+ description: 'Optional URL or data:image base64 URI for normal/bump map texture.',
31
+ },
32
+ useParallax: {
33
+ type: 'boolean',
34
+ description: 'Enable parallax mapping (uses height encoded in alpha channel of normal map).',
35
+ },
36
+ useParallaxOcclusion: {
37
+ type: 'boolean',
38
+ description: 'Enable deep parallax occlusion mapping.',
39
+ },
40
+ parallaxScaleBias: {
41
+ type: 'number',
42
+ description: 'Scale bias for parallax depth (default: 0.05).',
43
+ },
44
+ proceduralNormalMap: {
45
+ type: 'boolean',
46
+ description: 'Generate or disable automatic procedural normal map when proceduralTexture is used.',
47
+ },
48
+ uScale: { type: 'number', description: 'Horizontal texture tiling multiplier (default: 1.0).' },
49
+ vScale: { type: 'number', description: 'Vertical texture tiling multiplier (default: 1.0).' },
50
+ proceduralTexture: {
51
+ type: 'object',
52
+ description: 'Optional generated procedural surface texture.',
53
+ properties: {
54
+ type: {
55
+ type: 'string',
56
+ enum: [
57
+ 'wood',
58
+ 'stone',
59
+ 'sand',
60
+ 'tiles',
61
+ 'grass',
62
+ 'fabric',
63
+ 'marble',
64
+ 'brick',
65
+ 'metal',
66
+ 'checker',
67
+ 'grid',
68
+ 'noise',
69
+ 'gradient',
70
+ ],
71
+ },
72
+ primaryColor: { type: 'string' },
73
+ secondaryColor: { type: 'string' },
74
+ scale: { type: 'number' },
75
+ uScale: { type: 'number' },
76
+ vScale: { type: 'number' },
77
+ },
78
+ required: ['type'],
79
+ },
80
+ },
81
+ required: ['materialName'],
82
+ };
83
+ execute(args, context) {
84
+ const matName = (args.materialName || `Mat_${Date.now().toString().slice(-4)}`).trim();
85
+ let mat = context.materialRegistry.get(matName);
86
+ if (!mat || !context.scene.materials.includes(mat)) {
87
+ mat = new PBRMaterial(matName, context.scene);
88
+ context.materialRegistry.set(matName, mat);
89
+ }
90
+ if (args.albedoColor) {
91
+ mat.albedoColor = Color3.FromHexString(this.normalizeHex(args.albedoColor));
92
+ }
93
+ else if (!mat.albedoColor) {
94
+ mat.albedoColor = new Color3(0.85, 0.85, 0.85);
95
+ }
96
+ if (args.emissiveColor) {
97
+ mat.emissiveColor = Color3.FromHexString(this.normalizeHex(args.emissiveColor));
98
+ }
99
+ mat.roughness = args.roughness !== undefined ? Number(args.roughness) : 0.5;
100
+ mat.metallic = args.metallic !== undefined ? Number(args.metallic) : 0.1;
101
+ if (args.alpha !== undefined) {
102
+ mat.alpha = Number(args.alpha);
103
+ }
104
+ if (args.wireframe !== undefined) {
105
+ mat.wireframe = !!args.wireframe;
106
+ }
107
+ if (args.invertNormalMapX !== undefined) {
108
+ mat.invertNormalMapX = !!args.invertNormalMapX;
109
+ }
110
+ if (args.invertNormalMapY !== undefined) {
111
+ mat.invertNormalMapY = !!args.invertNormalMapY;
112
+ }
113
+ if (args.useParallax !== undefined) {
114
+ mat.useParallax = !!args.useParallax;
115
+ }
116
+ if (args.useParallaxOcclusion !== undefined) {
117
+ mat.useParallaxOcclusion = !!args.useParallaxOcclusion;
118
+ if (mat.useParallaxOcclusion)
119
+ mat.useParallax = true;
120
+ }
121
+ if (args.parallaxScaleBias !== undefined) {
122
+ mat.parallaxScaleBias = Number(args.parallaxScaleBias);
123
+ }
124
+ mat.backFaceCulling = false;
125
+ const createTexturesEnabled = context.aiAgent?.config?.createTextures !== false;
126
+ const createNormalMapsEnabled = context.aiAgent?.config?.createNormalMaps !== false && createTexturesEnabled;
127
+ if ((args.textureUrl || args.albedoTextureUrl) && createTexturesEnabled) {
128
+ const url = String(args.textureUrl || args.albedoTextureUrl);
129
+ const tex = new Texture(url, context.scene, false, false);
130
+ tex.hasAlpha = false;
131
+ mat.useAlphaFromAlbedoTexture = false;
132
+ mat.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;
133
+ tex.uScale = typeof args.uScale === 'number' ? args.uScale : 1;
134
+ tex.vScale = typeof args.vScale === 'number' ? args.vScale : 1;
135
+ mat.albedoTexture = tex;
136
+ if (!args.albedoColor) {
137
+ mat.albedoColor = new Color3(1, 1, 1);
138
+ }
139
+ }
140
+ const rawNormalUrl = args.normalMapUrl || args.bumpTextureUrl;
141
+ if (rawNormalUrl && createNormalMapsEnabled) {
142
+ const url = String(rawNormalUrl);
143
+ const tex = new Texture(url, context.scene, false, false);
144
+ tex.hasAlpha = false;
145
+ tex.uScale = typeof args.uScale === 'number' ? args.uScale : 1;
146
+ tex.vScale = typeof args.vScale === 'number' ? args.vScale : 1;
147
+ mat.bumpTexture = tex;
148
+ if (args.bumpLevel !== undefined) {
149
+ tex.level = Number(args.bumpLevel);
150
+ }
151
+ }
152
+ if (args.proceduralTexture && createTexturesEnabled) {
153
+ const proc = typeof args.proceduralTexture === 'string'
154
+ ? { type: args.proceduralTexture, uScale: args.uScale, vScale: args.vScale }
155
+ : args.proceduralTexture;
156
+ if (proc.type) {
157
+ const dataUrl = generateProceduralTextureDataUrl({
158
+ type: proc.type,
159
+ primaryColor: proc.primaryColor || args.albedoColor,
160
+ secondaryColor: proc.secondaryColor,
161
+ scale: proc.scale,
162
+ });
163
+ const tex = new Texture(dataUrl, context.scene, false, false);
164
+ tex.name = `${matName}_${proc.type}.png`;
165
+ tex.hasAlpha = false;
166
+ mat.useAlphaFromAlbedoTexture = false;
167
+ mat.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;
168
+ tex.uScale =
169
+ proc.uScale !== undefined
170
+ ? Number(proc.uScale)
171
+ : args.uScale !== undefined
172
+ ? Number(args.uScale)
173
+ : 1;
174
+ tex.vScale =
175
+ proc.vScale !== undefined
176
+ ? Number(proc.vScale)
177
+ : args.vScale !== undefined
178
+ ? Number(args.vScale)
179
+ : 1;
180
+ mat.albedoTexture = tex;
181
+ if (!args.albedoColor) {
182
+ mat.albedoColor = new Color3(1, 1, 1);
183
+ }
184
+ // Automatically generate matching procedural normal map if enabled and not already provided
185
+ if (createNormalMapsEnabled && !mat.bumpTexture && args.proceduralNormalMap !== false) {
186
+ const normalDataUrl = generateProceduralNormalMapDataUrl({
187
+ type: proc.type,
188
+ scale: proc.scale,
189
+ strength: typeof args.bumpLevel === 'number' ? args.bumpLevel * 2.0 : 2.0,
190
+ invertY: !!args.invertNormalMapY,
191
+ });
192
+ const normTex = new Texture(normalDataUrl, context.scene, false, false);
193
+ normTex.name = `${matName}_${proc.type}_normal.png`;
194
+ normTex.hasAlpha = false;
195
+ normTex.uScale = tex.uScale;
196
+ normTex.vScale = tex.vScale;
197
+ mat.bumpTexture = normTex;
198
+ if (args.bumpLevel !== undefined) {
199
+ normTex.level = Number(args.bumpLevel);
200
+ }
201
+ }
202
+ }
203
+ }
204
+ if (args.bumpLevel !== undefined && mat.bumpTexture) {
205
+ mat.bumpTexture.level = Number(args.bumpLevel);
206
+ }
207
+ return JSON.stringify({
208
+ status: 'ok',
209
+ materialName: mat.name,
210
+ });
211
+ }
212
+ }
@@ -0,0 +1,120 @@
1
+ import { AbstractTool } from '../AbstractTool';
2
+ import { ToolExecutionContext } from '../ToolExecutionContext';
3
+ export declare class CreateMoldingTool extends AbstractTool {
4
+ readonly name = "modeler_create_molding";
5
+ readonly description = "Sweeps a classical architectural molding profile (cornice, ogee, cove, torus, baseboard, cyma_recta, stepped, or custom 2D points) along a 3D polyline path with exact mitered corners so room perimeters, building rooflines, and decorative frames turn sharply without twisting.";
6
+ readonly parameters: {
7
+ type: string;
8
+ properties: {
9
+ name: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ path: {
14
+ type: string;
15
+ description: string;
16
+ items: {
17
+ type: string;
18
+ properties: {
19
+ x: {
20
+ type: string;
21
+ };
22
+ y: {
23
+ type: string;
24
+ };
25
+ z: {
26
+ type: string;
27
+ };
28
+ };
29
+ };
30
+ };
31
+ profile: {
32
+ type: string;
33
+ enum: string[];
34
+ description: string;
35
+ };
36
+ profilePoints: {
37
+ type: string;
38
+ description: string;
39
+ items: {
40
+ type: string;
41
+ items: {
42
+ type: string;
43
+ };
44
+ };
45
+ };
46
+ width: {
47
+ type: string;
48
+ description: string;
49
+ };
50
+ height: {
51
+ type: string;
52
+ description: string;
53
+ };
54
+ closed: {
55
+ type: string;
56
+ description: string;
57
+ };
58
+ position: {
59
+ type: string;
60
+ properties: {
61
+ x: {
62
+ type: string;
63
+ };
64
+ y: {
65
+ type: string;
66
+ };
67
+ z: {
68
+ type: string;
69
+ };
70
+ };
71
+ };
72
+ rotationDegrees: {
73
+ type: string;
74
+ properties: {
75
+ x: {
76
+ type: string;
77
+ };
78
+ y: {
79
+ type: string;
80
+ };
81
+ z: {
82
+ type: string;
83
+ };
84
+ };
85
+ };
86
+ scaling: {
87
+ type: string;
88
+ properties: {
89
+ x: {
90
+ type: string;
91
+ };
92
+ y: {
93
+ type: string;
94
+ };
95
+ z: {
96
+ type: string;
97
+ };
98
+ };
99
+ };
100
+ color: {
101
+ type: string;
102
+ description: string;
103
+ };
104
+ roughness: {
105
+ type: string;
106
+ description: string;
107
+ };
108
+ metallic: {
109
+ type: string;
110
+ description: string;
111
+ };
112
+ materialName: {
113
+ type: string;
114
+ description: string;
115
+ };
116
+ };
117
+ required: string[];
118
+ };
119
+ execute(args: any, context: ToolExecutionContext): string;
120
+ }
@@ -0,0 +1,95 @@
1
+ import { buildMoldingMesh } from '../../geometry/architecture';
2
+ import { AbstractTool } from '../AbstractTool';
3
+ export class CreateMoldingTool extends AbstractTool {
4
+ name = 'modeler_create_molding';
5
+ description = 'Sweeps a classical architectural molding profile (cornice, ogee, cove, torus, baseboard, cyma_recta, stepped, or custom 2D points) along a 3D polyline path with exact mitered corners so room perimeters, building rooflines, and decorative frames turn sharply without twisting.';
6
+ parameters = {
7
+ type: 'object',
8
+ properties: {
9
+ name: { type: 'string', description: 'Descriptive name for the molding mesh.' },
10
+ path: {
11
+ type: 'array',
12
+ description: 'Ordered 3D polyline points [{x,y,z}, ...] or [[x,y,z], ...] along which the profile is swept.',
13
+ items: {
14
+ type: 'object',
15
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
16
+ },
17
+ },
18
+ profile: {
19
+ type: 'string',
20
+ enum: ['cornice', 'ogee', 'cove', 'torus', 'baseboard', 'cyma_recta', 'stepped', 'custom'],
21
+ description: 'Molding cross-section preset (default: "cornice").',
22
+ },
23
+ profilePoints: {
24
+ type: 'array',
25
+ description: 'Optional custom 2D profile points [[projectionX, heightY], ...] when profile="custom".',
26
+ items: {
27
+ type: 'array',
28
+ items: { type: 'number' },
29
+ },
30
+ },
31
+ width: { type: 'number', description: 'Horizontal outward projection width in meters (default: 0.15).' },
32
+ height: { type: 'number', description: 'Vertical profile height in meters (default: 0.18).' },
33
+ closed: { type: 'boolean', description: 'Whether the path forms a closed perimeter loop (default: false).' },
34
+ position: {
35
+ type: 'object',
36
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
37
+ },
38
+ rotationDegrees: {
39
+ type: 'object',
40
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
41
+ },
42
+ scaling: {
43
+ type: 'object',
44
+ properties: { x: { type: 'number' }, y: { type: 'number' }, z: { type: 'number' } },
45
+ },
46
+ color: { type: 'string', description: 'Hex color string, e.g. "#e2ddd5".' },
47
+ roughness: { type: 'number', description: 'PBR roughness (default: 0.6).' },
48
+ metallic: { type: 'number', description: 'PBR metallic (default: 0.02).' },
49
+ materialName: { type: 'string', description: 'Optional existing material name.' },
50
+ },
51
+ required: ['path'],
52
+ };
53
+ execute(args, context) {
54
+ const baseName = String(args.name || 'arch_molding').replace(/\s+/g, '_');
55
+ const uniqueName = context.findMeshByNameOrId(baseName)
56
+ ? `${baseName}_${Date.now().toString().slice(-4)}`
57
+ : baseName;
58
+ const mesh = buildMoldingMesh(context.scene, uniqueName, {
59
+ path: args.path,
60
+ profile: args.profile,
61
+ profilePoints: args.profilePoints,
62
+ width: args.width,
63
+ height: args.height,
64
+ closed: args.closed,
65
+ });
66
+ mesh.material = context.getOrCreateMaterial(args.materialName, args.color || '#e2ddd5', args.roughness ?? 0.6, args.metallic ?? 0.02, uniqueName);
67
+ context.applyTransformArgs(mesh, args);
68
+ context.registerCreatedMesh(mesh);
69
+ const bb = mesh.getBoundingInfo().boundingBox;
70
+ return JSON.stringify({
71
+ status: 'ok',
72
+ meshName: mesh.name,
73
+ profile: args.profile || 'cornice',
74
+ vertices: mesh.getTotalVertices(),
75
+ triangles: Math.floor(mesh.getTotalIndices() / 3),
76
+ bounds: {
77
+ min: {
78
+ x: Number(bb.minimumWorld.x.toFixed(3)),
79
+ y: Number(bb.minimumWorld.y.toFixed(3)),
80
+ z: Number(bb.minimumWorld.z.toFixed(3)),
81
+ },
82
+ max: {
83
+ x: Number(bb.maximumWorld.x.toFixed(3)),
84
+ y: Number(bb.maximumWorld.y.toFixed(3)),
85
+ z: Number(bb.maximumWorld.z.toFixed(3)),
86
+ },
87
+ size: {
88
+ x: Number((bb.maximumWorld.x - bb.minimumWorld.x).toFixed(3)),
89
+ y: Number((bb.maximumWorld.y - bb.minimumWorld.y).toFixed(3)),
90
+ z: Number((bb.maximumWorld.z - bb.minimumWorld.z).toFixed(3)),
91
+ },
92
+ },
93
+ });
94
+ }
95
+ }