mesheditor 0.0.0-stage → 1.0.2
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.
- package/LICENSE +201 -0
- package/README.md +853 -2
- package/dist-lib/esm/AIAgentService.d.ts +107 -0
- package/dist-lib/esm/AIAgentService.d.ts.map +1 -0
- package/dist-lib/esm/AIAgentService.js +1471 -0
- package/dist-lib/esm/AIAgentService.js.map +1 -0
- package/dist-lib/esm/MeshEditorApp.d.ts +413 -0
- package/dist-lib/esm/MeshEditorApp.d.ts.map +1 -0
- package/dist-lib/esm/MeshEditorApp.js +9093 -0
- package/dist-lib/esm/MeshEditorApp.js.map +1 -0
- package/dist-lib/esm/MeshEditorService.d.ts +460 -0
- package/dist-lib/esm/MeshEditorService.d.ts.map +1 -0
- package/dist-lib/esm/MeshEditorService.js +7084 -0
- package/dist-lib/esm/MeshEditorService.js.map +1 -0
- package/dist-lib/esm/Neural3DGeneratorService.d.ts +89 -0
- package/dist-lib/esm/Neural3DGeneratorService.d.ts.map +1 -0
- package/dist-lib/esm/Neural3DGeneratorService.js +1398 -0
- package/dist-lib/esm/Neural3DGeneratorService.js.map +1 -0
- package/dist-lib/esm/adapters/BrowserPlatformAdapter.d.ts +17 -0
- package/dist-lib/esm/adapters/BrowserPlatformAdapter.d.ts.map +1 -0
- package/dist-lib/esm/adapters/BrowserPlatformAdapter.js +26 -0
- package/dist-lib/esm/adapters/BrowserPlatformAdapter.js.map +1 -0
- package/dist-lib/esm/adapters/ElectronPlatformAdapter.d.ts +33 -0
- package/dist-lib/esm/adapters/ElectronPlatformAdapter.d.ts.map +1 -0
- package/dist-lib/esm/adapters/ElectronPlatformAdapter.js +337 -0
- package/dist-lib/esm/adapters/ElectronPlatformAdapter.js.map +1 -0
- package/dist-lib/esm/adapters/HostAppAdapter.d.ts +55 -0
- package/dist-lib/esm/adapters/HostAppAdapter.d.ts.map +1 -0
- package/dist-lib/esm/adapters/HostAppAdapter.js +76 -0
- package/dist-lib/esm/adapters/HostAppAdapter.js.map +1 -0
- package/dist-lib/esm/adapters/PlatformAdapter.d.ts +99 -0
- package/dist-lib/esm/adapters/PlatformAdapter.d.ts.map +1 -0
- package/dist-lib/esm/adapters/PlatformAdapter.js +2 -0
- package/dist-lib/esm/adapters/PlatformAdapter.js.map +1 -0
- package/dist-lib/esm/adapters/index.d.ts +14 -0
- package/dist-lib/esm/adapters/index.d.ts.map +1 -0
- package/dist-lib/esm/adapters/index.js +16 -0
- package/dist-lib/esm/adapters/index.js.map +1 -0
- package/dist-lib/esm/assets/fonts/Droid_Sans_Bold.json +1 -0
- package/dist-lib/esm/assets/fonts/Droid_Sans_Regular.json +1 -0
- package/dist-lib/esm/assets/fonts/Kenney_Future_Regular.json +1 -0
- package/dist-lib/esm/baking/TextureBaker.d.ts +85 -0
- package/dist-lib/esm/baking/TextureBaker.d.ts.map +1 -0
- package/dist-lib/esm/baking/TextureBaker.js +710 -0
- package/dist-lib/esm/baking/TextureBaker.js.map +1 -0
- package/dist-lib/esm/builtInSkills.d.ts +20 -0
- package/dist-lib/esm/builtInSkills.d.ts.map +1 -0
- package/dist-lib/esm/builtInSkills.js +187 -0
- package/dist-lib/esm/builtInSkills.js.map +1 -0
- package/dist-lib/esm/compression/ModelCompressor.d.ts +88 -0
- package/dist-lib/esm/compression/ModelCompressor.d.ts.map +1 -0
- package/dist-lib/esm/compression/ModelCompressor.js +554 -0
- package/dist-lib/esm/compression/ModelCompressor.js.map +1 -0
- package/dist-lib/esm/decals/DecalController.d.ts +148 -0
- package/dist-lib/esm/decals/DecalController.d.ts.map +1 -0
- package/dist-lib/esm/decals/DecalController.js +1032 -0
- package/dist-lib/esm/decals/DecalController.js.map +1 -0
- package/dist-lib/esm/decals/decalAssetUrls.d.ts +2 -0
- package/dist-lib/esm/decals/decalAssetUrls.d.ts.map +1 -0
- package/dist-lib/esm/decals/decalAssetUrls.js +17 -0
- package/dist-lib/esm/decals/decalAssetUrls.js.map +1 -0
- package/dist-lib/esm/geometry/architecture.d.ts +115 -0
- package/dist-lib/esm/geometry/architecture.d.ts.map +1 -0
- package/dist-lib/esm/geometry/architecture.js +832 -0
- package/dist-lib/esm/geometry/architecture.js.map +1 -0
- package/dist-lib/esm/geometry/bevelModifier.d.ts +60 -0
- package/dist-lib/esm/geometry/bevelModifier.d.ts.map +1 -0
- package/dist-lib/esm/geometry/bevelModifier.js +346 -0
- package/dist-lib/esm/geometry/bevelModifier.js.map +1 -0
- package/dist-lib/esm/geometry/facetSurfaceUtils.d.ts +128 -0
- package/dist-lib/esm/geometry/facetSurfaceUtils.d.ts.map +1 -0
- package/dist-lib/esm/geometry/facetSurfaceUtils.js +677 -0
- package/dist-lib/esm/geometry/facetSurfaceUtils.js.map +1 -0
- package/dist-lib/esm/geometry/roundedBox.d.ts +16 -0
- package/dist-lib/esm/geometry/roundedBox.d.ts.map +1 -0
- package/dist-lib/esm/geometry/roundedBox.js +134 -0
- package/dist-lib/esm/geometry/roundedBox.js.map +1 -0
- package/dist-lib/esm/index.d.ts +22 -0
- package/dist-lib/esm/index.d.ts.map +1 -0
- package/dist-lib/esm/index.js +51 -0
- package/dist-lib/esm/index.js.map +1 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionController.d.ts +60 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionController.d.ts.map +1 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionController.js +484 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionController.js.map +1 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.d.ts +77 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.d.ts.map +1 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.js +1793 -0
- package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.js.map +1 -0
- package/dist-lib/esm/pathExtrusion/PathFactory.d.ts +96 -0
- package/dist-lib/esm/pathExtrusion/PathFactory.d.ts.map +1 -0
- package/dist-lib/esm/pathExtrusion/PathFactory.js +628 -0
- package/dist-lib/esm/pathExtrusion/PathFactory.js.map +1 -0
- package/dist-lib/esm/pathExtrusion/index.d.ts +5 -0
- package/dist-lib/esm/pathExtrusion/index.d.ts.map +1 -0
- package/dist-lib/esm/pathExtrusion/index.js +5 -0
- package/dist-lib/esm/pathExtrusion/index.js.map +1 -0
- package/dist-lib/esm/pathExtrusion/types.d.ts +51 -0
- package/dist-lib/esm/pathExtrusion/types.d.ts.map +1 -0
- package/dist-lib/esm/pathExtrusion/types.js +2 -0
- package/dist-lib/esm/pathExtrusion/types.js.map +1 -0
- package/dist-lib/esm/plugin.d.ts +251 -0
- package/dist-lib/esm/plugin.d.ts.map +1 -0
- package/dist-lib/esm/plugin.js +145 -0
- package/dist-lib/esm/plugin.js.map +1 -0
- package/dist-lib/esm/rigging/WeightPaintController.d.ts +163 -0
- package/dist-lib/esm/rigging/WeightPaintController.d.ts.map +1 -0
- package/dist-lib/esm/rigging/WeightPaintController.js +1422 -0
- package/dist-lib/esm/rigging/WeightPaintController.js.map +1 -0
- package/dist-lib/esm/sculpting/SculptController.d.ts +147 -0
- package/dist-lib/esm/sculpting/SculptController.d.ts.map +1 -0
- package/dist-lib/esm/sculpting/SculptController.js +2039 -0
- package/dist-lib/esm/sculpting/SculptController.js.map +1 -0
- package/dist-lib/esm/sdf/index.d.ts +3 -0
- package/dist-lib/esm/sdf/index.d.ts.map +1 -0
- package/dist-lib/esm/sdf/index.js +3 -0
- package/dist-lib/esm/sdf/index.js.map +1 -0
- package/dist-lib/esm/sdf/sdfPrimitives.d.ts +98 -0
- package/dist-lib/esm/sdf/sdfPrimitives.d.ts.map +1 -0
- package/dist-lib/esm/sdf/sdfPrimitives.js +403 -0
- package/dist-lib/esm/sdf/sdfPrimitives.js.map +1 -0
- package/dist-lib/esm/sdf/surfaceNets.d.ts +30 -0
- package/dist-lib/esm/sdf/surfaceNets.d.ts.map +1 -0
- package/dist-lib/esm/sdf/surfaceNets.js +400 -0
- package/dist-lib/esm/sdf/surfaceNets.js.map +1 -0
- package/dist-lib/esm/styles.d.ts +12 -0
- package/dist-lib/esm/styles.d.ts.map +1 -0
- package/dist-lib/esm/styles.js +33 -0
- package/dist-lib/esm/styles.js.map +1 -0
- package/dist-lib/esm/template.d.ts +13 -0
- package/dist-lib/esm/template.d.ts.map +1 -0
- package/dist-lib/esm/template.js +20 -0
- package/dist-lib/esm/template.js.map +1 -0
- package/dist-lib/esm/textMesh/TextMeshController.d.ts +62 -0
- package/dist-lib/esm/textMesh/TextMeshController.d.ts.map +1 -0
- package/dist-lib/esm/textMesh/TextMeshController.js +405 -0
- package/dist-lib/esm/textMesh/TextMeshController.js.map +1 -0
- package/dist-lib/esm/textures/AITextureGenerator.d.ts +120 -0
- package/dist-lib/esm/textures/AITextureGenerator.d.ts.map +1 -0
- package/dist-lib/esm/textures/AITextureGenerator.js +946 -0
- package/dist-lib/esm/textures/AITextureGenerator.js.map +1 -0
- package/dist-lib/esm/textures/ExternalImageGeneratorService.d.ts +63 -0
- package/dist-lib/esm/textures/ExternalImageGeneratorService.d.ts.map +1 -0
- package/dist-lib/esm/textures/ExternalImageGeneratorService.js +880 -0
- package/dist-lib/esm/textures/ExternalImageGeneratorService.js.map +1 -0
- package/dist-lib/esm/tools/AbstractTool.d.ts +69 -0
- package/dist-lib/esm/tools/AbstractTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/AbstractTool.js +129 -0
- package/dist-lib/esm/tools/AbstractTool.js.map +1 -0
- package/dist-lib/esm/tools/ToolExecutionContext.d.ts +41 -0
- package/dist-lib/esm/tools/ToolExecutionContext.d.ts.map +1 -0
- package/dist-lib/esm/tools/ToolExecutionContext.js +2 -0
- package/dist-lib/esm/tools/ToolExecutionContext.js.map +1 -0
- package/dist-lib/esm/tools/ToolInterface.d.ts +105 -0
- package/dist-lib/esm/tools/ToolInterface.d.ts.map +1 -0
- package/dist-lib/esm/tools/ToolInterface.js +2 -0
- package/dist-lib/esm/tools/ToolInterface.js.map +1 -0
- package/dist-lib/esm/tools/ToolRegistry.d.ts +44 -0
- package/dist-lib/esm/tools/ToolRegistry.d.ts.map +1 -0
- package/dist-lib/esm/tools/ToolRegistry.js +116 -0
- package/dist-lib/esm/tools/ToolRegistry.js.map +1 -0
- package/dist-lib/esm/tools/builtin/ApplyMaterialTool.d.ts +35 -0
- package/dist-lib/esm/tools/builtin/ApplyMaterialTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/ApplyMaterialTool.js +49 -0
- package/dist-lib/esm/tools/builtin/ApplyMaterialTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/AutoUVMappingTool.d.ts +35 -0
- package/dist-lib/esm/tools/builtin/AutoUVMappingTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/AutoUVMappingTool.js +55 -0
- package/dist-lib/esm/tools/builtin/AutoUVMappingTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/BakeTexturesTool.d.ts +43 -0
- package/dist-lib/esm/tools/builtin/BakeTexturesTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/BakeTexturesTool.js +82 -0
- package/dist-lib/esm/tools/builtin/BakeTexturesTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/BooleanOperationTool.d.ts +52 -0
- package/dist-lib/esm/tools/builtin/BooleanOperationTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/BooleanOperationTool.js +87 -0
- package/dist-lib/esm/tools/builtin/BooleanOperationTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.d.ts +79 -0
- package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.js +171 -0
- package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CloneArrayTool.d.ts +76 -0
- package/dist-lib/esm/tools/builtin/CloneArrayTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CloneArrayTool.js +116 -0
- package/dist-lib/esm/tools/builtin/CloneArrayTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateArchTool.d.ts +119 -0
- package/dist-lib/esm/tools/builtin/CreateArchTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateArchTool.js +90 -0
- package/dist-lib/esm/tools/builtin/CreateArchTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateColumnTool.d.ts +115 -0
- package/dist-lib/esm/tools/builtin/CreateColumnTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateColumnTool.js +106 -0
- package/dist-lib/esm/tools/builtin/CreateColumnTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateLatheTool.d.ts +88 -0
- package/dist-lib/esm/tools/builtin/CreateLatheTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateLatheTool.js +61 -0
- package/dist-lib/esm/tools/builtin/CreateLatheTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateMaterialTool.d.ts +115 -0
- package/dist-lib/esm/tools/builtin/CreateMaterialTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateMaterialTool.js +213 -0
- package/dist-lib/esm/tools/builtin/CreateMaterialTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateMoldingTool.d.ts +121 -0
- package/dist-lib/esm/tools/builtin/CreateMoldingTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateMoldingTool.js +96 -0
- package/dist-lib/esm/tools/builtin/CreateMoldingTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.d.ts +163 -0
- package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.js +303 -0
- package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateRoofTool.d.ts +121 -0
- package/dist-lib/esm/tools/builtin/CreateRoofTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateRoofTool.js +109 -0
- package/dist-lib/esm/tools/builtin/CreateRoofTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.d.ts +102 -0
- package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.js +80 -0
- package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.d.ts +225 -0
- package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.js +239 -0
- package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateStairsTool.d.ts +136 -0
- package/dist-lib/esm/tools/builtin/CreateStairsTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateStairsTool.js +120 -0
- package/dist-lib/esm/tools/builtin/CreateStairsTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateTextMeshTool.d.ts +95 -0
- package/dist-lib/esm/tools/builtin/CreateTextMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateTextMeshTool.js +132 -0
- package/dist-lib/esm/tools/builtin/CreateTextMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateTubeTool.d.ts +88 -0
- package/dist-lib/esm/tools/builtin/CreateTubeTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateTubeTool.js +60 -0
- package/dist-lib/esm/tools/builtin/CreateTubeTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateWallTool.d.ts +146 -0
- package/dist-lib/esm/tools/builtin/CreateWallTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/CreateWallTool.js +125 -0
- package/dist-lib/esm/tools/builtin/CreateWallTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/DecalTool.d.ts +77 -0
- package/dist-lib/esm/tools/builtin/DecalTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/DecalTool.js +144 -0
- package/dist-lib/esm/tools/builtin/DecalTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/DeleteMeshTool.d.ts +21 -0
- package/dist-lib/esm/tools/builtin/DeleteMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/DeleteMeshTool.js +43 -0
- package/dist-lib/esm/tools/builtin/DeleteMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.d.ts +22 -0
- package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.js +96 -0
- package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.d.ts +115 -0
- package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.js +77 -0
- package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.d.ts +105 -0
- package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.js +69 -0
- package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetArcTool.d.ts +37 -0
- package/dist-lib/esm/tools/builtin/FacetArcTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetArcTool.js +58 -0
- package/dist-lib/esm/tools/builtin/FacetArcTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetCutThroughTool.d.ts +31 -0
- package/dist-lib/esm/tools/builtin/FacetCutThroughTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetCutThroughTool.js +50 -0
- package/dist-lib/esm/tools/builtin/FacetCutThroughTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetExtrudeTool.d.ts +31 -0
- package/dist-lib/esm/tools/builtin/FacetExtrudeTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetExtrudeTool.js +50 -0
- package/dist-lib/esm/tools/builtin/FacetExtrudeTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetInsetTool.d.ts +35 -0
- package/dist-lib/esm/tools/builtin/FacetInsetTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/FacetInsetTool.js +56 -0
- package/dist-lib/esm/tools/builtin/FacetInsetTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.d.ts +132 -0
- package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.js +456 -0
- package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/GenerateTextureTool.d.ts +88 -0
- package/dist-lib/esm/tools/builtin/GenerateTextureTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/GenerateTextureTool.js +217 -0
- package/dist-lib/esm/tools/builtin/GenerateTextureTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/GetSceneInfoTool.d.ts +12 -0
- package/dist-lib/esm/tools/builtin/GetSceneInfoTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/GetSceneInfoTool.js +13 -0
- package/dist-lib/esm/tools/builtin/GetSceneInfoTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/MergeMeshesTool.d.ts +29 -0
- package/dist-lib/esm/tools/builtin/MergeMeshesTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/MergeMeshesTool.js +57 -0
- package/dist-lib/esm/tools/builtin/MergeMeshesTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/PlanModelTool.d.ts +88 -0
- package/dist-lib/esm/tools/builtin/PlanModelTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/PlanModelTool.js +156 -0
- package/dist-lib/esm/tools/builtin/PlanModelTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.d.ts +51 -0
- package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.js +117 -0
- package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/RigWeightTool.d.ts +56 -0
- package/dist-lib/esm/tools/builtin/RigWeightTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/RigWeightTool.js +140 -0
- package/dist-lib/esm/tools/builtin/RigWeightTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/SculptMeshTool.d.ts +139 -0
- package/dist-lib/esm/tools/builtin/SculptMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/SculptMeshTool.js +256 -0
- package/dist-lib/esm/tools/builtin/SculptMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/SeparateMeshTool.d.ts +22 -0
- package/dist-lib/esm/tools/builtin/SeparateMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/SeparateMeshTool.js +32 -0
- package/dist-lib/esm/tools/builtin/SeparateMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/SolidifyMeshTool.d.ts +31 -0
- package/dist-lib/esm/tools/builtin/SolidifyMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/SolidifyMeshTool.js +58 -0
- package/dist-lib/esm/tools/builtin/SolidifyMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.d.ts +67 -0
- package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.js +106 -0
- package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/SubDSmoothTool.d.ts +24 -0
- package/dist-lib/esm/tools/builtin/SubDSmoothTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/SubDSmoothTool.js +38 -0
- package/dist-lib/esm/tools/builtin/SubDSmoothTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/SubdivideMeshTool.d.ts +24 -0
- package/dist-lib/esm/tools/builtin/SubdivideMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/SubdivideMeshTool.js +40 -0
- package/dist-lib/esm/tools/builtin/SubdivideMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/TransformMeshTool.d.ts +79 -0
- package/dist-lib/esm/tools/builtin/TransformMeshTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/TransformMeshTool.js +70 -0
- package/dist-lib/esm/tools/builtin/TransformMeshTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/UVUnwrapTool.d.ts +49 -0
- package/dist-lib/esm/tools/builtin/UVUnwrapTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/UVUnwrapTool.js +108 -0
- package/dist-lib/esm/tools/builtin/UVUnwrapTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/VoxelPainterTool.d.ts +61 -0
- package/dist-lib/esm/tools/builtin/VoxelPainterTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/VoxelPainterTool.js +154 -0
- package/dist-lib/esm/tools/builtin/VoxelPainterTool.js.map +1 -0
- package/dist-lib/esm/tools/builtin/index.d.ts +45 -0
- package/dist-lib/esm/tools/builtin/index.d.ts.map +1 -0
- package/dist-lib/esm/tools/builtin/index.js +45 -0
- package/dist-lib/esm/tools/builtin/index.js.map +1 -0
- package/dist-lib/esm/tools/editor/AIAgentEditorTool.d.ts +19 -0
- package/dist-lib/esm/tools/editor/AIAgentEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/AIAgentEditorTool.js +44 -0
- package/dist-lib/esm/tools/editor/AIAgentEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/AITextureEditorTool.d.ts +16 -0
- package/dist-lib/esm/tools/editor/AITextureEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/AITextureEditorTool.js +29 -0
- package/dist-lib/esm/tools/editor/AITextureEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/AbstractEditorTool.d.ts +30 -0
- package/dist-lib/esm/tools/editor/AbstractEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/AbstractEditorTool.js +57 -0
- package/dist-lib/esm/tools/editor/AbstractEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.js +30 -0
- package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/BakingEditorTool.d.ts +22 -0
- package/dist-lib/esm/tools/editor/BakingEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/BakingEditorTool.js +45 -0
- package/dist-lib/esm/tools/editor/BakingEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/CSGEditorTool.d.ts +21 -0
- package/dist-lib/esm/tools/editor/CSGEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/CSGEditorTool.js +43 -0
- package/dist-lib/esm/tools/editor/CSGEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/CompressModelEditorTool.d.ts +21 -0
- package/dist-lib/esm/tools/editor/CompressModelEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/CompressModelEditorTool.js +49 -0
- package/dist-lib/esm/tools/editor/CompressModelEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.js +37 -0
- package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/DecalEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/DecalEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/DecalEditorTool.js +37 -0
- package/dist-lib/esm/tools/editor/DecalEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/FacetEditorTool.d.ts +24 -0
- package/dist-lib/esm/tools/editor/FacetEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/FacetEditorTool.js +81 -0
- package/dist-lib/esm/tools/editor/FacetEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/MaterialEditorTool.d.ts +19 -0
- package/dist-lib/esm/tools/editor/MaterialEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/MaterialEditorTool.js +44 -0
- package/dist-lib/esm/tools/editor/MaterialEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.js +38 -0
- package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/OutlinerEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/OutlinerEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/OutlinerEditorTool.js +35 -0
- package/dist-lib/esm/tools/editor/OutlinerEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.d.ts +27 -0
- package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.js +73 -0
- package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/RiggingEditorTool.d.ts +28 -0
- package/dist-lib/esm/tools/editor/RiggingEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/RiggingEditorTool.js +67 -0
- package/dist-lib/esm/tools/editor/RiggingEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.js +36 -0
- package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/SculptEditorTool.d.ts +29 -0
- package/dist-lib/esm/tools/editor/SculptEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/SculptEditorTool.js +71 -0
- package/dist-lib/esm/tools/editor/SculptEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/TextMeshEditorTool.d.ts +17 -0
- package/dist-lib/esm/tools/editor/TextMeshEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/TextMeshEditorTool.js +31 -0
- package/dist-lib/esm/tools/editor/TextMeshEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.d.ts +18 -0
- package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.js +29 -0
- package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.d.ts +28 -0
- package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.js +71 -0
- package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.d.ts +27 -0
- package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.js +69 -0
- package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.js.map +1 -0
- package/dist-lib/esm/tools/editor/aiQuickPrompts.d.ts +31 -0
- package/dist-lib/esm/tools/editor/aiQuickPrompts.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/aiQuickPrompts.js +229 -0
- package/dist-lib/esm/tools/editor/aiQuickPrompts.js.map +1 -0
- package/dist-lib/esm/tools/editor/index.d.ts +33 -0
- package/dist-lib/esm/tools/editor/index.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/index.js +55 -0
- package/dist-lib/esm/tools/editor/index.js.map +1 -0
- package/dist-lib/esm/tools/editor/toolViews.d.ts +11 -0
- package/dist-lib/esm/tools/editor/toolViews.d.ts.map +1 -0
- package/dist-lib/esm/tools/editor/toolViews.js +54 -0
- package/dist-lib/esm/tools/editor/toolViews.js.map +1 -0
- package/dist-lib/esm/tools/editorTools.d.ts +6 -0
- package/dist-lib/esm/tools/editorTools.d.ts.map +1 -0
- package/dist-lib/esm/tools/editorTools.js +6 -0
- package/dist-lib/esm/tools/editorTools.js.map +1 -0
- package/dist-lib/esm/tools/index.d.ts +9 -0
- package/dist-lib/esm/tools/index.d.ts.map +1 -0
- package/dist-lib/esm/tools/index.js +9 -0
- package/dist-lib/esm/tools/index.js.map +1 -0
- package/dist-lib/esm/tools/textureUtils.d.ts +19 -0
- package/dist-lib/esm/tools/textureUtils.d.ts.map +1 -0
- package/dist-lib/esm/tools/textureUtils.js +289 -0
- package/dist-lib/esm/tools/textureUtils.js.map +1 -0
- package/dist-lib/esm/types.d.ts +165 -0
- package/dist-lib/esm/types.d.ts.map +1 -0
- package/dist-lib/esm/types.js +2 -0
- package/dist-lib/esm/types.js.map +1 -0
- package/dist-lib/esm/uv/UVUnwrapController.d.ts +109 -0
- package/dist-lib/esm/uv/UVUnwrapController.d.ts.map +1 -0
- package/dist-lib/esm/uv/UVUnwrapController.js +1023 -0
- package/dist-lib/esm/uv/UVUnwrapController.js.map +1 -0
- package/dist-lib/esm/voxel/CustomVoxelMesher.d.ts +16 -0
- package/dist-lib/esm/voxel/CustomVoxelMesher.d.ts.map +1 -0
- package/dist-lib/esm/voxel/CustomVoxelMesher.js +170 -0
- package/dist-lib/esm/voxel/CustomVoxelMesher.js.map +1 -0
- package/dist-lib/esm/voxel/TextureAtlasManager.d.ts +55 -0
- package/dist-lib/esm/voxel/TextureAtlasManager.d.ts.map +1 -0
- package/dist-lib/esm/voxel/TextureAtlasManager.js +631 -0
- package/dist-lib/esm/voxel/TextureAtlasManager.js.map +1 -0
- package/dist-lib/esm/voxel/VoxelPainterController.d.ts +101 -0
- package/dist-lib/esm/voxel/VoxelPainterController.d.ts.map +1 -0
- package/dist-lib/esm/voxel/VoxelPainterController.js +672 -0
- package/dist-lib/esm/voxel/VoxelPainterController.js.map +1 -0
- package/dist-lib/esm/voxel/index.d.ts +5 -0
- package/dist-lib/esm/voxel/index.d.ts.map +1 -0
- package/dist-lib/esm/voxel/index.js +5 -0
- package/dist-lib/esm/voxel/index.js.map +1 -0
- package/dist-lib/esm/voxel/types.d.ts +79 -0
- package/dist-lib/esm/voxel/types.d.ts.map +1 -0
- package/dist-lib/esm/voxel/types.js +2 -0
- package/dist-lib/esm/voxel/types.js.map +1 -0
- package/dist-lib/esm/web-component/MeshEditorElement.d.ts +104 -0
- package/dist-lib/esm/web-component/MeshEditorElement.d.ts.map +1 -0
- package/dist-lib/esm/web-component/MeshEditorElement.js +247 -0
- package/dist-lib/esm/web-component/MeshEditorElement.js.map +1 -0
- package/dist-lib/esm/web-component/index.d.ts +2 -0
- package/dist-lib/esm/web-component/index.d.ts.map +1 -0
- package/dist-lib/esm/web-component/index.js +2 -0
- package/dist-lib/esm/web-component/index.js.map +1 -0
- package/dist-lib/index.umd.js +3 -0
- package/dist-lib/mesheditor.css +2 -0
- package/dist-lib/standalone/mesheditor-element.bundle.js +3 -0
- package/package.json +113 -4
- package/skills/README.md +48 -0
- package/skills/figure-sculptor.md +297 -0
- package/skills/image-to-mesh.md +18 -0
- package/skills/mesh-updater.md +27 -0
- package/skills/neural-3d-generator.md +53 -0
- package/skills/procedural-modeler.md +267 -0
- package/skills/voxel-painter.md +21 -0
- package/src/mesheditor.css +6477 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { Curve3, Mesh, Vector3, VertexData } from '@babylonjs/core';
|
|
2
|
+
export class PathFactory {
|
|
3
|
+
/**
|
|
4
|
+
* Generates a 2D cross-section shape in the XY plane (z = 0) based on configuration.
|
|
5
|
+
*/
|
|
6
|
+
static getShapePoints(config) {
|
|
7
|
+
const shapeType = (config.shapeType || 'pipe');
|
|
8
|
+
const width = config.width ?? 1.5;
|
|
9
|
+
const height = config.height ?? 0.5;
|
|
10
|
+
const depth = config.depth ?? 0.5;
|
|
11
|
+
const radius = config.radius ?? 1.0;
|
|
12
|
+
const thickness = config.thickness ?? 0;
|
|
13
|
+
const segments = config.segments ?? 16;
|
|
14
|
+
const excludeBottom = config.excludeBottom ?? 0;
|
|
15
|
+
const starPoints = config.starPoints ?? 5;
|
|
16
|
+
const outerRadius = config.outerRadius ?? (config.radius ?? 1.5);
|
|
17
|
+
const innerRadius = config.innerRadius ?? outerRadius * 0.45;
|
|
18
|
+
switch (shapeType) {
|
|
19
|
+
case 'pipe':
|
|
20
|
+
return this.shapePipe(segments, radius, thickness, excludeBottom);
|
|
21
|
+
case 'flatPipe':
|
|
22
|
+
return this.shapeFlatPipe(segments, width, height, thickness);
|
|
23
|
+
case 'circle':
|
|
24
|
+
return this.shapeCircle(segments, radius, thickness);
|
|
25
|
+
case 'rectangle':
|
|
26
|
+
return this.shapeRectangle(width, height, thickness);
|
|
27
|
+
case 'uProfile':
|
|
28
|
+
case 'uprofile':
|
|
29
|
+
return this.shapeUProfile(width, height, thickness > 0 ? thickness : 0.25);
|
|
30
|
+
case 'halfpipe':
|
|
31
|
+
return this.shapeHalfpipe(width, height, depth, thickness > 0 ? thickness : 0.1);
|
|
32
|
+
case 'triangle':
|
|
33
|
+
return this.shapeTriangle(width, height, thickness);
|
|
34
|
+
case 'ellipse':
|
|
35
|
+
return this.shapeEllipse(segments, width, height, thickness);
|
|
36
|
+
case 'star':
|
|
37
|
+
return this.shapeStar(starPoints, outerRadius, innerRadius);
|
|
38
|
+
case 'horizontalLine':
|
|
39
|
+
return this.shapeHorizontalLine(width, segments);
|
|
40
|
+
case 'verticalLine':
|
|
41
|
+
return this.shapeVerticalLine(height, segments);
|
|
42
|
+
case 'halfCircle':
|
|
43
|
+
return this.shapeHalfCircle(segments, radius);
|
|
44
|
+
case 'halfCircleDepth':
|
|
45
|
+
return this.shapeHalfCircleDepth(segments, radius);
|
|
46
|
+
case 'depthLine':
|
|
47
|
+
return this.shapeDepthLine(segments, depth);
|
|
48
|
+
case 'diagonalUp':
|
|
49
|
+
return this.shapeDiagonalUp(segments, width, height);
|
|
50
|
+
case 'diagonalDown':
|
|
51
|
+
return this.shapeDiagonalDown(segments, width, height);
|
|
52
|
+
case 'plane':
|
|
53
|
+
return this.shapePlane(segments, width, height);
|
|
54
|
+
case 'flat':
|
|
55
|
+
default:
|
|
56
|
+
return this.shapeFlat(width, thickness > 0 ? thickness : 0.08);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Rectangle box profile.
|
|
61
|
+
*/
|
|
62
|
+
static shapeRectangle(width = 1, height = 0.25, thickness = 0) {
|
|
63
|
+
const points = [
|
|
64
|
+
new Vector3(-width, 0, 0),
|
|
65
|
+
new Vector3(width, 0, 0),
|
|
66
|
+
new Vector3(width, -height, 0),
|
|
67
|
+
new Vector3(-width, -height, 0),
|
|
68
|
+
];
|
|
69
|
+
if (thickness > 0) {
|
|
70
|
+
const iw = width - thickness;
|
|
71
|
+
const ih = height - thickness;
|
|
72
|
+
// Inner rectangle (reversed winding)
|
|
73
|
+
points.push(new Vector3(-iw, -thickness, 0), new Vector3(iw, -thickness, 0), new Vector3(iw, -(thickness + ih), 0), new Vector3(-iw, -(thickness + ih), 0));
|
|
74
|
+
// Reverse inner ring for correct winding
|
|
75
|
+
const inner = points.splice(4, 4).reverse();
|
|
76
|
+
points.push(...inner);
|
|
77
|
+
points.solidHalfCount = 4;
|
|
78
|
+
points.closedShape = true;
|
|
79
|
+
}
|
|
80
|
+
return points;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Creates a U-Profile shape (channel/gutter)
|
|
84
|
+
*/
|
|
85
|
+
static shapeUProfile(width = 1, height = 0.5, thickness = 0.25) {
|
|
86
|
+
const innerWidth = width - thickness;
|
|
87
|
+
const points = [
|
|
88
|
+
// outer side (clockwise)
|
|
89
|
+
new Vector3(-width, height, 0),
|
|
90
|
+
new Vector3(-width, 0, 0),
|
|
91
|
+
new Vector3(width, 0, 0),
|
|
92
|
+
new Vector3(width, height, 0),
|
|
93
|
+
// inner side (counter-clockwise)
|
|
94
|
+
new Vector3(innerWidth, height, 0),
|
|
95
|
+
new Vector3(innerWidth, thickness, 0),
|
|
96
|
+
new Vector3(-innerWidth, thickness, 0),
|
|
97
|
+
new Vector3(-innerWidth, height, 0),
|
|
98
|
+
];
|
|
99
|
+
points.solidHalfCount = 4;
|
|
100
|
+
points.closedShape = false;
|
|
101
|
+
return points;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Creates a triangle shape
|
|
105
|
+
*/
|
|
106
|
+
static shapeTriangle(width = 1, height = 1, thickness = 0) {
|
|
107
|
+
const points = [
|
|
108
|
+
new Vector3(0, height, 0),
|
|
109
|
+
new Vector3(width, 0, 0),
|
|
110
|
+
new Vector3(-width, 0, 0),
|
|
111
|
+
];
|
|
112
|
+
if (thickness > 0) {
|
|
113
|
+
const scale = Math.max(0.01, 1 - thickness / Math.min(width, height));
|
|
114
|
+
points.push(new Vector3(0, height * scale + thickness * 0.5, 0), new Vector3(width * scale, thickness, 0), new Vector3(-width * scale, thickness, 0));
|
|
115
|
+
const inner = points.splice(3, 3).reverse();
|
|
116
|
+
points.push(...inner);
|
|
117
|
+
points.solidHalfCount = 3;
|
|
118
|
+
points.closedShape = true;
|
|
119
|
+
}
|
|
120
|
+
return points;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Creates a round pipe. When thickness is specified, creates a solid annular cross-section.
|
|
124
|
+
*/
|
|
125
|
+
static shapePipe(segments = 16, radius = 1, thickness = 0, excludeBottomPoints = 0) {
|
|
126
|
+
const points = [];
|
|
127
|
+
const bottomCenter = Math.round((segments * 3) / 4);
|
|
128
|
+
const excludeStart = bottomCenter - Math.floor(excludeBottomPoints / 2);
|
|
129
|
+
const excludeSet = new Set();
|
|
130
|
+
for (let e = 0; e < excludeBottomPoints; e++) {
|
|
131
|
+
excludeSet.add((((excludeStart + e) % segments) + segments) % segments);
|
|
132
|
+
}
|
|
133
|
+
// Outer ring
|
|
134
|
+
let flatBottomY = null;
|
|
135
|
+
let insertedFlat = false;
|
|
136
|
+
for (let i = 0; i < segments; i++) {
|
|
137
|
+
if (excludeSet.has(i)) {
|
|
138
|
+
if (!insertedFlat && points.length > 0) {
|
|
139
|
+
flatBottomY = points[points.length - 1].y;
|
|
140
|
+
insertedFlat = true;
|
|
141
|
+
}
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (insertedFlat && flatBottomY !== null) {
|
|
145
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
146
|
+
const x = Math.cos(angle) * radius;
|
|
147
|
+
points.push(new Vector3(x, flatBottomY, 0));
|
|
148
|
+
insertedFlat = false;
|
|
149
|
+
}
|
|
150
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
151
|
+
points.push(new Vector3(Math.cos(angle) * radius, Math.sin(angle) * radius, 0));
|
|
152
|
+
}
|
|
153
|
+
// Inner ring (if thickness specified)
|
|
154
|
+
if (thickness > 0) {
|
|
155
|
+
const innerRadius = Math.max(0.01, radius - thickness);
|
|
156
|
+
const innerPoints = [];
|
|
157
|
+
let innerFlatBottomY = null;
|
|
158
|
+
let innerInsertedFlat = false;
|
|
159
|
+
for (let i = segments - 1; i >= 0; i--) {
|
|
160
|
+
if (excludeSet.has(i)) {
|
|
161
|
+
if (!innerInsertedFlat && innerPoints.length > 0) {
|
|
162
|
+
innerFlatBottomY = innerPoints[innerPoints.length - 1].y;
|
|
163
|
+
innerInsertedFlat = true;
|
|
164
|
+
}
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (innerInsertedFlat && innerFlatBottomY !== null) {
|
|
168
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
169
|
+
const x = Math.cos(angle) * innerRadius;
|
|
170
|
+
innerPoints.push(new Vector3(x, innerFlatBottomY, 0));
|
|
171
|
+
innerInsertedFlat = false;
|
|
172
|
+
}
|
|
173
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
174
|
+
innerPoints.push(new Vector3(Math.cos(angle) * innerRadius, Math.sin(angle) * innerRadius, 0));
|
|
175
|
+
}
|
|
176
|
+
points.push(...innerPoints);
|
|
177
|
+
points.solidHalfCount = points.length - innerPoints.length;
|
|
178
|
+
points.closedShape = true;
|
|
179
|
+
}
|
|
180
|
+
return points;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Creates a flat oval pipe.
|
|
184
|
+
*/
|
|
185
|
+
static shapeFlatPipe(segments = 16, width = 1, height = 0.25, thickness = 0) {
|
|
186
|
+
const points = [];
|
|
187
|
+
for (let i = 0; i < segments; i++) {
|
|
188
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
189
|
+
points.push(new Vector3(Math.cos(angle) * width, Math.sin(angle) * height, 0));
|
|
190
|
+
}
|
|
191
|
+
if (thickness > 0) {
|
|
192
|
+
const iw = Math.max(0.01, width - thickness);
|
|
193
|
+
const ih = Math.max(0.01, height - thickness);
|
|
194
|
+
for (let i = segments - 1; i >= 0; i--) {
|
|
195
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
196
|
+
points.push(new Vector3(Math.cos(angle) * iw, Math.sin(angle) * ih, 0));
|
|
197
|
+
}
|
|
198
|
+
points.solidHalfCount = segments;
|
|
199
|
+
points.closedShape = true;
|
|
200
|
+
}
|
|
201
|
+
return points;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Creates a circle disc shape.
|
|
205
|
+
*/
|
|
206
|
+
static shapeCircle(segments = 16, radius = 1, thickness = 0) {
|
|
207
|
+
const points = [];
|
|
208
|
+
for (let i = 0; i < segments; i++) {
|
|
209
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
210
|
+
points.push(new Vector3(Math.cos(angle) * radius, Math.sin(angle) * radius, 0));
|
|
211
|
+
}
|
|
212
|
+
if (thickness > 0) {
|
|
213
|
+
const ir = Math.max(0.01, radius - thickness);
|
|
214
|
+
for (let i = segments - 1; i >= 0; i--) {
|
|
215
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
216
|
+
points.push(new Vector3(Math.cos(angle) * ir, Math.sin(angle) * ir, 0));
|
|
217
|
+
}
|
|
218
|
+
points.solidHalfCount = segments;
|
|
219
|
+
points.closedShape = true;
|
|
220
|
+
}
|
|
221
|
+
return points;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Creates an ellipse shape.
|
|
225
|
+
*/
|
|
226
|
+
static shapeEllipse(segments = 16, width = 1, height = 0.5, thickness = 0) {
|
|
227
|
+
const points = [];
|
|
228
|
+
for (let i = 0; i < segments; i++) {
|
|
229
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
230
|
+
points.push(new Vector3(Math.cos(angle) * width, Math.sin(angle) * height, 0));
|
|
231
|
+
}
|
|
232
|
+
if (thickness > 0) {
|
|
233
|
+
const iw = Math.max(0.01, width - thickness);
|
|
234
|
+
const ih = Math.max(0.01, height - thickness);
|
|
235
|
+
for (let i = segments - 1; i >= 0; i--) {
|
|
236
|
+
const angle = (i / segments) * Math.PI * 2;
|
|
237
|
+
points.push(new Vector3(Math.cos(angle) * iw, Math.sin(angle) * ih, 0));
|
|
238
|
+
}
|
|
239
|
+
points.solidHalfCount = segments;
|
|
240
|
+
points.closedShape = true;
|
|
241
|
+
}
|
|
242
|
+
return points;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Creates a horizontal line shape.
|
|
246
|
+
*/
|
|
247
|
+
static shapeHorizontalLine(width = 2, segments = 5) {
|
|
248
|
+
const points = [];
|
|
249
|
+
const halfWidth = width / 2;
|
|
250
|
+
for (let i = 0; i < segments; i++) {
|
|
251
|
+
const t = segments > 1 ? i / (segments - 1) : 0.5;
|
|
252
|
+
const x = -halfWidth + t * width;
|
|
253
|
+
points.push(new Vector3(x, 0, 0));
|
|
254
|
+
}
|
|
255
|
+
points.closedShape = false;
|
|
256
|
+
return points;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Creates a vertical line shape.
|
|
260
|
+
*/
|
|
261
|
+
static shapeVerticalLine(height = 2, segments = 5) {
|
|
262
|
+
const points = [];
|
|
263
|
+
for (let i = 0; i < segments; i++) {
|
|
264
|
+
const t = segments > 1 ? i / (segments - 1) : 0;
|
|
265
|
+
const y = t * height;
|
|
266
|
+
points.push(new Vector3(0, y, 0));
|
|
267
|
+
}
|
|
268
|
+
points.closedShape = false;
|
|
269
|
+
return points;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Creates a half circle (upper arc).
|
|
273
|
+
*/
|
|
274
|
+
static shapeHalfCircle(segments = 8, radius = 1) {
|
|
275
|
+
const points = [];
|
|
276
|
+
for (let i = 0; i <= segments; i++) {
|
|
277
|
+
const angle = (i / segments) * Math.PI;
|
|
278
|
+
points.push(new Vector3(Math.cos(angle) * radius, Math.sin(angle) * radius, 0));
|
|
279
|
+
}
|
|
280
|
+
points.closedShape = false;
|
|
281
|
+
return points;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Creates a half circle along depth.
|
|
285
|
+
*/
|
|
286
|
+
static shapeHalfCircleDepth(segments = 8, radius = 1) {
|
|
287
|
+
const points = [];
|
|
288
|
+
for (let i = 0; i <= segments; i++) {
|
|
289
|
+
const angle = (i / segments) * Math.PI;
|
|
290
|
+
const y = Math.sin(angle) * radius;
|
|
291
|
+
const z = (1 - Math.cos(angle)) * radius;
|
|
292
|
+
points.push(new Vector3(0, y, z));
|
|
293
|
+
}
|
|
294
|
+
points.closedShape = false;
|
|
295
|
+
return points;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Creates a star shape.
|
|
299
|
+
*/
|
|
300
|
+
static shapeStar(points = 5, outerRadius = 1, innerRadius) {
|
|
301
|
+
const result = [];
|
|
302
|
+
const inner = innerRadius ?? outerRadius * 0.45;
|
|
303
|
+
const totalPoints = points * 2;
|
|
304
|
+
for (let i = 0; i < totalPoints; i++) {
|
|
305
|
+
const angle = (i / totalPoints) * Math.PI * 2 - Math.PI / 2;
|
|
306
|
+
const radius = i % 2 === 0 ? outerRadius : inner;
|
|
307
|
+
result.push(new Vector3(Math.cos(angle) * radius, Math.sin(angle) * radius, 0));
|
|
308
|
+
}
|
|
309
|
+
result.closedShape = true;
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Creates a depth line shape along the Z-axis.
|
|
314
|
+
*/
|
|
315
|
+
static shapeDepthLine(segments = 5, depth = 2) {
|
|
316
|
+
const points = [];
|
|
317
|
+
const halfDepth = depth / 2;
|
|
318
|
+
for (let i = 0; i < segments; i++) {
|
|
319
|
+
const t = segments > 1 ? i / (segments - 1) : 0.5;
|
|
320
|
+
const z = -halfDepth + t * depth;
|
|
321
|
+
points.push(new Vector3(0, 0, z));
|
|
322
|
+
}
|
|
323
|
+
points.closedShape = false;
|
|
324
|
+
return points;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Creates a diagonal line going right and up.
|
|
328
|
+
*/
|
|
329
|
+
static shapeDiagonalUp(segments = 5, width = 2, height = 2) {
|
|
330
|
+
const points = [];
|
|
331
|
+
for (let i = 0; i < segments; i++) {
|
|
332
|
+
const t = segments > 1 ? i / (segments - 1) : 0;
|
|
333
|
+
points.push(new Vector3(t * width, t * height, 0));
|
|
334
|
+
}
|
|
335
|
+
points.closedShape = false;
|
|
336
|
+
return points;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Creates a diagonal line going right and down.
|
|
340
|
+
*/
|
|
341
|
+
static shapeDiagonalDown(segments = 5, width = 2, height = 2) {
|
|
342
|
+
const points = [];
|
|
343
|
+
for (let i = 0; i < segments; i++) {
|
|
344
|
+
const t = segments > 1 ? i / (segments - 1) : 0;
|
|
345
|
+
points.push(new Vector3(t * width, -t * height, 0));
|
|
346
|
+
}
|
|
347
|
+
points.closedShape = false;
|
|
348
|
+
return points;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Creates a plane grid of positions.
|
|
352
|
+
*/
|
|
353
|
+
static shapePlane(segments = 3, width = 2, height = 2) {
|
|
354
|
+
const points = [];
|
|
355
|
+
const halfWidth = width / 2;
|
|
356
|
+
const halfHeight = height / 2;
|
|
357
|
+
for (let row = 0; row < segments; row++) {
|
|
358
|
+
const ty = segments > 1 ? row / (segments - 1) : 0.5;
|
|
359
|
+
const y = -halfHeight + ty * height;
|
|
360
|
+
for (let col = 0; col < segments; col++) {
|
|
361
|
+
const tx = segments > 1 ? col / (segments - 1) : 0.5;
|
|
362
|
+
const x = -halfWidth + tx * width;
|
|
363
|
+
points.push(new Vector3(x, y, 0));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
points.closedShape = false;
|
|
367
|
+
return points;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Creates a halfpipe with thickness.
|
|
371
|
+
*/
|
|
372
|
+
static shapeHalfpipe(width = 1, height = 1 / 6, depth = 1 / 6, thickness = 0.5 / 6) {
|
|
373
|
+
const points = [
|
|
374
|
+
new Vector3(-width, height, 0),
|
|
375
|
+
new Vector3(-width, 0, 0),
|
|
376
|
+
new Vector3(0, -depth, 0),
|
|
377
|
+
new Vector3(width, 0, 0),
|
|
378
|
+
new Vector3(width, height, 0),
|
|
379
|
+
new Vector3(width - thickness, height, 0),
|
|
380
|
+
new Vector3(width - thickness, thickness, 0),
|
|
381
|
+
new Vector3(0, -depth + thickness, 0),
|
|
382
|
+
new Vector3(-width + thickness, thickness, 0),
|
|
383
|
+
new Vector3(-width + thickness, height, 0),
|
|
384
|
+
];
|
|
385
|
+
points.solidHalfCount = 5;
|
|
386
|
+
points.closedShape = false;
|
|
387
|
+
return points;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Flat road/track profile.
|
|
391
|
+
*/
|
|
392
|
+
static shapeFlat(width = 1.0, thickness = 0.08) {
|
|
393
|
+
const halfWidth = width / 2;
|
|
394
|
+
const halfThick = thickness / 2;
|
|
395
|
+
const points = [
|
|
396
|
+
new Vector3(-halfWidth, halfThick, 0),
|
|
397
|
+
new Vector3(halfWidth, halfThick, 0),
|
|
398
|
+
new Vector3(halfWidth, -halfThick, 0),
|
|
399
|
+
new Vector3(-halfWidth, -halfThick, 0),
|
|
400
|
+
];
|
|
401
|
+
points.closedShape = true;
|
|
402
|
+
return points;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Scales a path uniformly.
|
|
406
|
+
*/
|
|
407
|
+
static scalePath(path, scale) {
|
|
408
|
+
return path.map((p) => p.scale(scale));
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Computes a smooth 3D Catmull-Rom spline through control points.
|
|
412
|
+
*/
|
|
413
|
+
static computeSpline(points, smoothSteps = 10) {
|
|
414
|
+
if (points.length < 2) {
|
|
415
|
+
return points.map((p) => p.clone());
|
|
416
|
+
}
|
|
417
|
+
if (points.length === 2 || smoothSteps <= 1) {
|
|
418
|
+
const p0 = points[0];
|
|
419
|
+
const p1 = points[1];
|
|
420
|
+
const result = [];
|
|
421
|
+
const steps = Math.max(2, smoothSteps);
|
|
422
|
+
for (let i = 0; i <= steps; i++) {
|
|
423
|
+
const t = i / steps;
|
|
424
|
+
result.push(Vector3.Lerp(p0, p1, t));
|
|
425
|
+
}
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
const curve = Curve3.CreateCatmullRomSpline(points, smoothSteps, false);
|
|
429
|
+
return curve.getPoints();
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Creates a smooth, zero-twist 3D path extrusion mesh with stable local coordinate frames,
|
|
433
|
+
* manifold solid walls, UV seam duplication, rims, and end caps.
|
|
434
|
+
*
|
|
435
|
+
* Ported directly from platformia3d PathFactory.
|
|
436
|
+
*/
|
|
437
|
+
static createPathMeshWithShape(name, path, shape, scene, yOffset = 0, solidHalfCount = 0, capEnds = false, closedShapeParam = false) {
|
|
438
|
+
// 1. Deduplicate consecutive duplicate path points to prevent zero-tangent issues
|
|
439
|
+
const cleanPath = [];
|
|
440
|
+
if (path.length > 0) {
|
|
441
|
+
cleanPath.push(path[0].clone());
|
|
442
|
+
for (let i = 1; i < path.length; i++) {
|
|
443
|
+
if (Vector3.Distance(path[i], cleanPath[cleanPath.length - 1]) > 0.001) {
|
|
444
|
+
cleanPath.push(path[i].clone());
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
path = cleanPath;
|
|
449
|
+
if (path.length < 2 || shape.length < 2) {
|
|
450
|
+
return new Mesh(name, scene);
|
|
451
|
+
}
|
|
452
|
+
const closedShape = shape.closedShape ?? closedShapeParam;
|
|
453
|
+
if (solidHalfCount === 0 && shape.solidHalfCount) {
|
|
454
|
+
solidHalfCount = shape.solidHalfCount;
|
|
455
|
+
}
|
|
456
|
+
const positions = [];
|
|
457
|
+
const indices = [];
|
|
458
|
+
const uvs = [];
|
|
459
|
+
const numShapePoints = shape.length;
|
|
460
|
+
// Calculate total path length for UV mapping
|
|
461
|
+
let totalLength = 0;
|
|
462
|
+
const segmentLengths = [0];
|
|
463
|
+
for (let i = 1; i < path.length; i++) {
|
|
464
|
+
totalLength += Vector3.Distance(path[i - 1], path[i]);
|
|
465
|
+
segmentLengths.push(totalLength);
|
|
466
|
+
}
|
|
467
|
+
// Calculate UV offsets for each shape point along the perimeter
|
|
468
|
+
const shapeUVs = [];
|
|
469
|
+
let perimeterLength = 0;
|
|
470
|
+
for (let j = 0; j < numShapePoints; j++) {
|
|
471
|
+
shapeUVs.push(perimeterLength);
|
|
472
|
+
const nextJ = (j + 1) % numShapePoints;
|
|
473
|
+
perimeterLength += Vector3.Distance(shape[j], shape[nextJ]);
|
|
474
|
+
}
|
|
475
|
+
const safePerimeter = perimeterLength > 0.0001 ? perimeterLength : 1;
|
|
476
|
+
for (let j = 0; j < numShapePoints; j++) {
|
|
477
|
+
shapeUVs[j] /= safePerimeter;
|
|
478
|
+
}
|
|
479
|
+
// Generate vertices along the path
|
|
480
|
+
for (let i = 0; i < path.length; i++) {
|
|
481
|
+
const curr = path[i];
|
|
482
|
+
const prev = path[i - 1] ?? path[i];
|
|
483
|
+
const next = path[i + 1] ?? path[i];
|
|
484
|
+
// Calculate forward tangent
|
|
485
|
+
let tangent = next.subtract(prev);
|
|
486
|
+
if (tangent.lengthSquared() < 0.00001) {
|
|
487
|
+
tangent = new Vector3(0, 0, 1);
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
tangent.normalize();
|
|
491
|
+
}
|
|
492
|
+
// Calculate stable local coordinate system (prevents Frenet-Serret twisting)
|
|
493
|
+
let up = Vector3.Up();
|
|
494
|
+
if (Math.abs(Vector3.Dot(tangent, up)) > 0.99) {
|
|
495
|
+
up = new Vector3(1, 0, 0);
|
|
496
|
+
}
|
|
497
|
+
const right = Vector3.Cross(up, tangent).normalize();
|
|
498
|
+
const localUp = Vector3.Cross(tangent, right).normalize();
|
|
499
|
+
const center = curr.add(Vector3.Up().scale(yOffset));
|
|
500
|
+
for (let j = 0; j < numShapePoints; j++) {
|
|
501
|
+
const shapePoint = shape[j];
|
|
502
|
+
const worldPos = center.add(right.scale(shapePoint.x)).add(localUp.scale(shapePoint.y));
|
|
503
|
+
positions.push(worldPos.x, worldPos.y, worldPos.z);
|
|
504
|
+
const u = shapeUVs[j];
|
|
505
|
+
const v = segmentLengths[i] * 0.2;
|
|
506
|
+
uvs.push(u, v);
|
|
507
|
+
}
|
|
508
|
+
// Add UV seam vertices for closed solid rings
|
|
509
|
+
if (solidHalfCount > 0) {
|
|
510
|
+
const v = segmentLengths[i] * 0.2;
|
|
511
|
+
const outerFirst = shape[0];
|
|
512
|
+
const outerPos = center.add(right.scale(outerFirst.x)).add(localUp.scale(outerFirst.y));
|
|
513
|
+
positions.push(outerPos.x, outerPos.y, outerPos.z);
|
|
514
|
+
uvs.push(1.0, v);
|
|
515
|
+
const innerFirst = shape[solidHalfCount];
|
|
516
|
+
const innerPos = center.add(right.scale(innerFirst.x)).add(localUp.scale(innerFirst.y));
|
|
517
|
+
positions.push(innerPos.x, innerPos.y, innerPos.z);
|
|
518
|
+
uvs.push(1.0, v);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
// Build indices
|
|
522
|
+
if (solidHalfCount > 0) {
|
|
523
|
+
const N = solidHalfCount;
|
|
524
|
+
const stride = numShapePoints + 2;
|
|
525
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
526
|
+
const baseIdx = i * stride;
|
|
527
|
+
const nextBaseIdx = (i + 1) * stride;
|
|
528
|
+
const loopCount = closedShape ? N : N - 1;
|
|
529
|
+
// Outer ring
|
|
530
|
+
for (let j = 0; j < loopCount; j++) {
|
|
531
|
+
const nextJ = j + 1 < N ? j + 1 : numShapePoints;
|
|
532
|
+
indices.push(baseIdx + j, baseIdx + nextJ, nextBaseIdx + j);
|
|
533
|
+
indices.push(baseIdx + nextJ, nextBaseIdx + nextJ, nextBaseIdx + j);
|
|
534
|
+
}
|
|
535
|
+
// Inner ring
|
|
536
|
+
for (let j = 0; j < loopCount; j++) {
|
|
537
|
+
const currJ = N + j;
|
|
538
|
+
const nextJ = j + 1 < N ? N + j + 1 : numShapePoints + 1;
|
|
539
|
+
indices.push(baseIdx + currJ, baseIdx + nextJ, nextBaseIdx + currJ);
|
|
540
|
+
indices.push(baseIdx + nextJ, nextBaseIdx + nextJ, nextBaseIdx + currJ);
|
|
541
|
+
}
|
|
542
|
+
// Side rims for open shapes (U-profile, halfpipe)
|
|
543
|
+
if (!closedShape) {
|
|
544
|
+
// Left rim
|
|
545
|
+
const lO = baseIdx + 0;
|
|
546
|
+
const lI = baseIdx + 2 * N - 1;
|
|
547
|
+
const nlO = nextBaseIdx + 0;
|
|
548
|
+
const nlI = nextBaseIdx + 2 * N - 1;
|
|
549
|
+
indices.push(lO, nlO, lI);
|
|
550
|
+
indices.push(nlO, nlI, lI);
|
|
551
|
+
// Right rim
|
|
552
|
+
const rO = baseIdx + N - 1;
|
|
553
|
+
const rI = baseIdx + N;
|
|
554
|
+
const nrO = nextBaseIdx + N - 1;
|
|
555
|
+
const nrI = nextBaseIdx + N;
|
|
556
|
+
indices.push(rO, rI, nrO);
|
|
557
|
+
indices.push(nrO, rI, nrI);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
const edgeCount = closedShape ? numShapePoints : numShapePoints - 1;
|
|
563
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
564
|
+
const baseIdx = i * numShapePoints;
|
|
565
|
+
const nextBaseIdx = (i + 1) * numShapePoints;
|
|
566
|
+
for (let j = 0; j < edgeCount; j++) {
|
|
567
|
+
const nextJ = (j + 1) % numShapePoints;
|
|
568
|
+
const idx0 = baseIdx + j;
|
|
569
|
+
const idx1 = baseIdx + nextJ;
|
|
570
|
+
const idx2 = nextBaseIdx + j;
|
|
571
|
+
const idx3 = nextBaseIdx + nextJ;
|
|
572
|
+
indices.push(idx0, idx2, idx1);
|
|
573
|
+
indices.push(idx1, idx2, idx3);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
// End caps
|
|
578
|
+
if (solidHalfCount > 0 && path.length >= 2 && capEnds) {
|
|
579
|
+
const N = solidHalfCount;
|
|
580
|
+
const capStride = numShapePoints + 2;
|
|
581
|
+
const startBase = 0;
|
|
582
|
+
const loopCount = closedShape ? N : N - 1;
|
|
583
|
+
for (let j = 0; j < loopCount; j++) {
|
|
584
|
+
const outerCurr = startBase + j;
|
|
585
|
+
const outerNext = startBase + ((j + 1) % N);
|
|
586
|
+
const innerCurr = startBase + N + (N - 1 - j);
|
|
587
|
+
const innerNext = startBase + N + (N - 1 - ((j + 1) % N));
|
|
588
|
+
indices.push(outerCurr, innerCurr, outerNext);
|
|
589
|
+
indices.push(outerNext, innerCurr, innerNext);
|
|
590
|
+
}
|
|
591
|
+
const endBase = (path.length - 1) * capStride;
|
|
592
|
+
for (let j = 0; j < loopCount; j++) {
|
|
593
|
+
const outerCurr = endBase + j;
|
|
594
|
+
const outerNext = endBase + ((j + 1) % N);
|
|
595
|
+
const innerCurr = endBase + N + (N - 1 - j);
|
|
596
|
+
const innerNext = endBase + N + (N - 1 - ((j + 1) % N));
|
|
597
|
+
indices.push(outerCurr, outerNext, innerCurr);
|
|
598
|
+
indices.push(outerNext, innerNext, innerCurr);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
else if (capEnds && solidHalfCount === 0 && path.length >= 2 && closedShape && numShapePoints >= 3) {
|
|
602
|
+
const startBase = 0;
|
|
603
|
+
for (let j = 1; j < numShapePoints - 1; j++) {
|
|
604
|
+
indices.push(startBase, startBase + j + 1, startBase + j);
|
|
605
|
+
}
|
|
606
|
+
const endBase = (path.length - 1) * numShapePoints;
|
|
607
|
+
for (let j = 1; j < numShapePoints - 1; j++) {
|
|
608
|
+
indices.push(endBase, endBase + j, endBase + j + 1);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
const mesh = new Mesh(name, scene);
|
|
612
|
+
const vData = new VertexData();
|
|
613
|
+
vData.positions = positions;
|
|
614
|
+
vData.indices = indices;
|
|
615
|
+
vData.uvs = uvs;
|
|
616
|
+
vData.applyToMesh(mesh);
|
|
617
|
+
if (solidHalfCount > 0 || capEnds) {
|
|
618
|
+
const normals = [];
|
|
619
|
+
VertexData.ComputeNormals(positions, indices, normals);
|
|
620
|
+
mesh.setVerticesData('normal', normals);
|
|
621
|
+
}
|
|
622
|
+
else {
|
|
623
|
+
mesh.convertToFlatShadedMesh();
|
|
624
|
+
}
|
|
625
|
+
return mesh;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
//# sourceMappingURL=PathFactory.js.map
|