@playdrop/playdrop-cli 0.16.12 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/client-meta.json +4 -4
- package/dist/apiClient.d.ts +1 -2
- package/dist/apiClient.js +1 -16
- package/dist/appUrls.js +4 -0
- package/dist/apps/build.d.ts +12 -4
- package/dist/apps/build.js +55 -22
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.js +4 -1
- package/dist/apps/loadCheck.d.ts +5 -1
- package/dist/apps/loadCheck.js +52 -18
- package/dist/apps/serverBuild.d.ts +17 -0
- package/dist/apps/serverBuild.js +155 -0
- package/dist/apps/staticHtml.d.ts +1 -0
- package/dist/apps/staticHtml.js +19 -10
- package/dist/apps/upload.d.ts +12 -2
- package/dist/apps/upload.js +127 -46
- package/dist/catalogue.d.ts +23 -1
- package/dist/catalogue.js +126 -100
- package/dist/commandContext.d.ts +6 -3
- package/dist/commandContext.js +108 -18
- package/dist/commands/build.js +0 -7
- package/dist/commands/captureListing.d.ts +3 -0
- package/dist/commands/captureListing.js +48 -4
- package/dist/commands/chat.d.ts +4 -7
- package/dist/commands/chat.js +165 -77
- package/dist/commands/check.js +34 -1
- package/dist/commands/create.js +30 -263
- package/dist/commands/dev.js +37 -3
- package/dist/commands/devBrowser.js +2 -2
- package/dist/commands/devGameServer.d.ts +16 -0
- package/dist/commands/devGameServer.js +237 -0
- package/dist/commands/devRuntimeAssets.d.ts +1 -0
- package/dist/commands/devRuntimeAssets.js +2 -0
- package/dist/commands/devServer.d.ts +3 -0
- package/dist/commands/devServer.js +111 -5
- package/dist/commands/generation.d.ts +33 -4
- package/dist/commands/generation.js +304 -115
- package/dist/commands/login.js +23 -7
- package/dist/commands/review.d.ts +1 -1
- package/dist/commands/review.js +68 -95
- package/dist/commands/source.d.ts +19 -0
- package/dist/commands/source.js +142 -0
- package/dist/commands/tweaks.js +5 -11
- package/dist/commands/upload-content.d.ts +1 -1
- package/dist/commands/upload-content.js +16 -12
- package/dist/commands/upload.d.ts +17 -1
- package/dist/commands/upload.js +47 -10
- package/dist/commands/worker/archive-staging.d.ts +1 -0
- package/dist/commands/worker/archive-staging.js +13 -2
- package/dist/commands/worker/e2e-fixtures.d.ts +32 -0
- package/dist/commands/worker/e2e-fixtures.js +466 -0
- package/dist/commands/worker/game-server-infra.d.ts +80 -0
- package/dist/commands/worker/game-server-infra.js +595 -0
- package/dist/commands/worker/game-source-git.d.ts +126 -0
- package/dist/commands/worker/game-source-git.js +780 -0
- package/dist/commands/worker/generation.d.ts +94 -0
- package/dist/commands/worker/generation.js +1458 -0
- package/dist/commands/worker/provider-telemetry.js +1 -1
- package/dist/commands/worker/runtime.d.ts +8 -10
- package/dist/commands/worker/runtime.js +53 -48
- package/dist/commands/worker.d.ts +79 -19
- package/dist/commands/worker.js +1796 -419
- package/dist/config.d.ts +2 -0
- package/dist/config.js +16 -3
- package/dist/environment.d.ts +0 -1
- package/dist/environment.js +0 -8
- package/dist/index.js +92 -22
- package/dist/workerAppProject.d.ts +1 -1
- package/dist/workerAppProject.js +15 -2
- package/node_modules/@playdrop/api-client/dist/client.d.ts +143 -39
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +33 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.js +17 -11
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +51 -6
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +338 -41
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +24 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +20 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +13 -8
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +158 -90
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +152 -21
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/chat.js +477 -100
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +9 -0
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +1 -2
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +0 -11
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.js +79 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +81 -30
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +217 -56
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts +18 -0
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/runtime.js +54 -0
- package/node_modules/@playdrop/api-client/package.json +7 -0
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +11 -0
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.js +13 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +2 -2
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.js +31 -2
- package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +10 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +0 -4
- package/node_modules/@playdrop/config/dist/test/runtime-service-origins.test.js +2 -0
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts +9 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.js +107 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts +29 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.js +64 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts +8 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.js +25 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts +39 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.js +195 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.js +51 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-core/dist/src/humanoid/r15 → game-source-git/dist/src}/index.js +9 -4
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts +17 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.js +72 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.js +99 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts +24 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.js +207 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts +66 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.js +213 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts +2 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.js +441 -0
- package/node_modules/@playdrop/game-source-git/dist/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@playdrop/game-source-git/package.json +28 -0
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/agent-task-terminal.js +15 -9
- package/node_modules/@playdrop/types/dist/api.d.ts +730 -166
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +65 -18
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +2 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +22 -8
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +26 -26
- package/node_modules/@playdrop/types/dist/chat.d.ts +273 -31
- package/node_modules/@playdrop/types/dist/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/chat.js +38 -4
- package/node_modules/@playdrop/types/dist/index.d.ts +3 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +7 -1
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts +11 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.js +78 -0
- package/node_modules/@playdrop/types/dist/realtime.d.ts +3 -15
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/social.d.ts +64 -0
- package/node_modules/@playdrop/types/dist/social.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-three/dist/src/types.js → types/dist/social.js} +14 -2
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts +51 -0
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/spritesheet.js +73 -0
- package/node_modules/@playdrop/types/dist/version.d.ts +86 -58
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +111 -0
- package/node_modules/@playdrop/types/package.json +14 -0
- package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +0 -3
- package/node_modules/@playdrop/vox-three/dist/src/vox.js +0 -110
- package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +0 -18
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
- package/node_modules/@playdrop/vox-three/package.json +8 -4
- package/package.json +9 -11
- package/dist/assets/model-artifacts.d.ts +0 -8
- package/dist/assets/model-artifacts.js +0 -382
- package/dist/assets/model-worker.d.ts +0 -22
- package/dist/assets/model-worker.js +0 -123
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +0 -441
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +0 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +0 -499
- package/node_modules/@playdrop/ai-client/package.json +0 -22
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +0 -13
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +0 -141
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +0 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +0 -313
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js +0 -21
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +0 -387
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +0 -6
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +0 -373
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +0 -215
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js +0 -18
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +0 -42
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +0 -145
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +0 -65
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +0 -33
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +0 -175
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r15.json +0 -1517
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r6.json +0 -61
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +0 -10
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +0 -19
- package/node_modules/@playdrop/boxel-core/dist/src/index.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js +0 -184
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +0 -68
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +0 -488
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +0 -380
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +0 -29
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js +0 -208
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +0 -312
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +0 -154
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +0 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +0 -121
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +0 -20
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +0 -389
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +0 -206
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +0 -81
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +0 -318
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +0 -168
- package/node_modules/@playdrop/boxel-core/dist/src/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js +0 -620
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +0 -135
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +0 -52
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/package.json +0 -19
- package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +0 -92
- package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +0 -363
- package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +0 -58
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +0 -100
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +0 -927
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +0 -18
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +0 -294
- package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +0 -64
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +0 -40
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +0 -96
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +0 -7
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +0 -123
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +0 -48
- package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +0 -3
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +0 -168
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +0 -29
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +0 -623
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +0 -13
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +0 -133
- package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +0 -216
- package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +0 -112
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +0 -28
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +0 -344
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +0 -113
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +0 -137
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +0 -20
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +0 -104
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +0 -30
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +0 -136
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/package.json +0 -28
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var faces_exports = {};
|
|
19
|
-
__export(faces_exports, {
|
|
20
|
-
FACE_ORDER: () => FACE_ORDER,
|
|
21
|
-
generateVoxelFaceSurfaces: () => generateVoxelFaceSurfaces
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(faces_exports);
|
|
24
|
-
const FACE_ORDER = ["east", "west", "top", "bottom", "north", "south"];
|
|
25
|
-
const FACE_CONFIGS = {
|
|
26
|
-
east: { axis: 0, direction: 1, uAxis: 2, vAxis: 1 },
|
|
27
|
-
west: { axis: 0, direction: -1, uAxis: 2, vAxis: 1 },
|
|
28
|
-
top: { axis: 1, direction: 1, uAxis: 0, vAxis: 2 },
|
|
29
|
-
bottom: { axis: 1, direction: -1, uAxis: 0, vAxis: 2 },
|
|
30
|
-
north: { axis: 2, direction: 1, uAxis: 0, vAxis: 1 },
|
|
31
|
-
south: { axis: 2, direction: -1, uAxis: 0, vAxis: 1 }
|
|
32
|
-
};
|
|
33
|
-
function clamp(value, min, max) {
|
|
34
|
-
return Math.min(max, Math.max(min, value));
|
|
35
|
-
}
|
|
36
|
-
function getVoxelAt(voxels, dims, x, y, z) {
|
|
37
|
-
if (x < 0 || y < 0 || z < 0)
|
|
38
|
-
return 0;
|
|
39
|
-
if (x >= dims[0] || y >= dims[1] || z >= dims[2])
|
|
40
|
-
return 0;
|
|
41
|
-
const index = x + dims[0] * (y + dims[1] * z);
|
|
42
|
-
return voxels[index] ?? 0;
|
|
43
|
-
}
|
|
44
|
-
function generateVoxelFaceSurfaces(options) {
|
|
45
|
-
const { primitive, materialsById, defaultColor } = options;
|
|
46
|
-
if (!Array.isArray(primitive.voxels) || primitive.voxels.length === 0) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
const size = primitive.size ?? [1, 1, 1];
|
|
50
|
-
const dims = [
|
|
51
|
-
Math.max(1, Math.round(size[0])),
|
|
52
|
-
Math.max(1, Math.round(size[1])),
|
|
53
|
-
Math.max(1, Math.round(size[2]))
|
|
54
|
-
];
|
|
55
|
-
if (primitive.voxels.length !== dims[0] * dims[1] * dims[2]) {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
const voxelSize = [1, 1, 1];
|
|
59
|
-
const primitiveSize = [
|
|
60
|
-
dims[0] * voxelSize[0],
|
|
61
|
-
dims[1] * voxelSize[1],
|
|
62
|
-
dims[2] * voxelSize[2]
|
|
63
|
-
];
|
|
64
|
-
const palette = primitive.palette ?? [];
|
|
65
|
-
const patches = [];
|
|
66
|
-
const createEmptyCell = () => ({
|
|
67
|
-
color: [0, 0, 0, 0],
|
|
68
|
-
emissive: [0, 0, 0, 0],
|
|
69
|
-
occupied: false
|
|
70
|
-
});
|
|
71
|
-
const ensurePlane = (planes, planeIndex, surfaceCoord, width, height) => {
|
|
72
|
-
let plane = planes.get(planeIndex);
|
|
73
|
-
if (!plane) {
|
|
74
|
-
const cells = Array.from({ length: height }, () => Array.from({ length: width }, () => createEmptyCell()));
|
|
75
|
-
plane = { surfaceCoord, cells };
|
|
76
|
-
planes.set(planeIndex, plane);
|
|
77
|
-
}
|
|
78
|
-
return plane;
|
|
79
|
-
};
|
|
80
|
-
const halfSize = [primitiveSize[0] / 2, primitiveSize[1] / 2, primitiveSize[2] / 2];
|
|
81
|
-
FACE_ORDER.forEach((face) => {
|
|
82
|
-
const config = FACE_CONFIGS[face];
|
|
83
|
-
const width = dims[config.uAxis];
|
|
84
|
-
const height = dims[config.vAxis];
|
|
85
|
-
const planes = /* @__PURE__ */ new Map();
|
|
86
|
-
for (let x = 0; x < dims[0]; x += 1) {
|
|
87
|
-
for (let y = 0; y < dims[1]; y += 1) {
|
|
88
|
-
for (let z = 0; z < dims[2]; z += 1) {
|
|
89
|
-
const paletteIndex = getVoxelAt(primitive.voxels, dims, x, y, z);
|
|
90
|
-
if (paletteIndex === 0) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
const neighborCoord = [x, y, z];
|
|
94
|
-
neighborCoord[config.axis] += config.direction;
|
|
95
|
-
const neighbor = getVoxelAt(primitive.voxels, dims, neighborCoord[0], neighborCoord[1], neighborCoord[2]);
|
|
96
|
-
if (neighbor !== 0) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
const uCoord = [x, y, z][config.uAxis];
|
|
100
|
-
const vCoord = [x, y, z][config.vAxis];
|
|
101
|
-
const voxelAxis = [x, y, z][config.axis];
|
|
102
|
-
const surfaceCoord = config.direction > 0 ? voxelAxis + 1 : voxelAxis;
|
|
103
|
-
const plane = ensurePlane(planes, surfaceCoord, surfaceCoord, width, height);
|
|
104
|
-
const cell = plane.cells[vCoord][uCoord];
|
|
105
|
-
const materialId = palette[paletteIndex - 1];
|
|
106
|
-
const material = materialId ? materialsById.get(materialId) : void 0;
|
|
107
|
-
const baseColor = material?.baseColor ?? defaultColor;
|
|
108
|
-
const opacity = material?.opacity !== void 0 ? clamp(material.opacity, 0, 1) : 1;
|
|
109
|
-
const alpha = Math.round(opacity * 255);
|
|
110
|
-
cell.color = [baseColor[0], baseColor[1], baseColor[2], alpha];
|
|
111
|
-
cell.occupied = alpha > 0;
|
|
112
|
-
if (material?.emissiveColor) {
|
|
113
|
-
cell.emissive = [material.emissiveColor[0], material.emissiveColor[1], material.emissiveColor[2], 255];
|
|
114
|
-
} else {
|
|
115
|
-
cell.emissive = [0, 0, 0, 0];
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const cellSizeU = voxelSize[config.uAxis];
|
|
121
|
-
const cellSizeV = voxelSize[config.vAxis];
|
|
122
|
-
planes.forEach((plane) => {
|
|
123
|
-
const visited = Array.from({ length: height }, () => new Array(width).fill(false));
|
|
124
|
-
for (let v = 0; v < height; v += 1) {
|
|
125
|
-
for (let u = 0; u < width; u += 1) {
|
|
126
|
-
if (visited[v][u])
|
|
127
|
-
continue;
|
|
128
|
-
const cell = plane.cells[v][u];
|
|
129
|
-
if (!cell.occupied) {
|
|
130
|
-
visited[v][u] = true;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
let patchWidth = 1;
|
|
134
|
-
while (u + patchWidth < width) {
|
|
135
|
-
const nextCell = plane.cells[v][u + patchWidth];
|
|
136
|
-
if (!nextCell.occupied || visited[v][u + patchWidth])
|
|
137
|
-
break;
|
|
138
|
-
patchWidth += 1;
|
|
139
|
-
}
|
|
140
|
-
let patchHeight = 1;
|
|
141
|
-
outer: while (v + patchHeight < height) {
|
|
142
|
-
for (let offset = 0; offset < patchWidth; offset += 1) {
|
|
143
|
-
const nextCell = plane.cells[v + patchHeight][u + offset];
|
|
144
|
-
if (!nextCell.occupied || visited[v + patchHeight][u + offset]) {
|
|
145
|
-
break outer;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
patchHeight += 1;
|
|
149
|
-
}
|
|
150
|
-
for (let dv = 0; dv < patchHeight; dv += 1) {
|
|
151
|
-
for (let du = 0; du < patchWidth; du += 1) {
|
|
152
|
-
visited[v + dv][u + du] = true;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
const textureWidth = patchWidth;
|
|
156
|
-
const textureHeight = patchHeight;
|
|
157
|
-
const colorBuffer = new Uint8Array(textureWidth * textureHeight * 4);
|
|
158
|
-
const emissiveBuffer = new Uint8Array(textureWidth * textureHeight * 4);
|
|
159
|
-
let patchHasEmissive = false;
|
|
160
|
-
let patchHasTransparency = false;
|
|
161
|
-
for (let pv = 0; pv < patchHeight; pv += 1) {
|
|
162
|
-
for (let pu = 0; pu < patchWidth; pu += 1) {
|
|
163
|
-
const sourceCell = plane.cells[v + pv][u + pu];
|
|
164
|
-
const targetY = textureHeight - 1 - pv;
|
|
165
|
-
const targetIndex = (targetY * textureWidth + pu) * 4;
|
|
166
|
-
colorBuffer[targetIndex] = sourceCell.color[0];
|
|
167
|
-
colorBuffer[targetIndex + 1] = sourceCell.color[1];
|
|
168
|
-
colorBuffer[targetIndex + 2] = sourceCell.color[2];
|
|
169
|
-
colorBuffer[targetIndex + 3] = sourceCell.color[3];
|
|
170
|
-
if (sourceCell.color[3] < 255) {
|
|
171
|
-
patchHasTransparency = true;
|
|
172
|
-
}
|
|
173
|
-
emissiveBuffer[targetIndex] = sourceCell.emissive[0];
|
|
174
|
-
emissiveBuffer[targetIndex + 1] = sourceCell.emissive[1];
|
|
175
|
-
emissiveBuffer[targetIndex + 2] = sourceCell.emissive[2];
|
|
176
|
-
emissiveBuffer[targetIndex + 3] = sourceCell.emissive[3];
|
|
177
|
-
if (sourceCell.emissive[3] > 0) {
|
|
178
|
-
patchHasEmissive = true;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const geometry = buildPatchGeometry({
|
|
183
|
-
face,
|
|
184
|
-
config,
|
|
185
|
-
primitiveSize,
|
|
186
|
-
voxelSize,
|
|
187
|
-
halfSize,
|
|
188
|
-
uStart: u,
|
|
189
|
-
vStart: v,
|
|
190
|
-
patchWidth,
|
|
191
|
-
patchHeight,
|
|
192
|
-
surfaceCoord: plane.surfaceCoord
|
|
193
|
-
});
|
|
194
|
-
patches.push({
|
|
195
|
-
face,
|
|
196
|
-
width: patchWidth * cellSizeU,
|
|
197
|
-
height: patchHeight * cellSizeV,
|
|
198
|
-
textureWidth,
|
|
199
|
-
textureHeight,
|
|
200
|
-
color: colorBuffer,
|
|
201
|
-
emissive: patchHasEmissive ? emissiveBuffer : void 0,
|
|
202
|
-
hasEmissive: patchHasEmissive,
|
|
203
|
-
hasTransparency: patchHasTransparency,
|
|
204
|
-
geometry
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
return patches;
|
|
211
|
-
}
|
|
212
|
-
function buildPatchGeometry(options) {
|
|
213
|
-
const { face, config, voxelSize, halfSize, uStart, vStart, patchWidth, patchHeight, surfaceCoord } = options;
|
|
214
|
-
const positions = new Float32Array(12);
|
|
215
|
-
const normals = new Float32Array(12);
|
|
216
|
-
const uvs = new Float32Array(8);
|
|
217
|
-
const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
|
|
218
|
-
const cellSizeAxis = voxelSize[config.axis];
|
|
219
|
-
const axisCoord = -halfSize[config.axis] + surfaceCoord * cellSizeAxis;
|
|
220
|
-
const cellSizeU = voxelSize[config.uAxis];
|
|
221
|
-
const cellSizeV = voxelSize[config.vAxis];
|
|
222
|
-
const uMin = -halfSize[config.uAxis] + uStart * cellSizeU;
|
|
223
|
-
const uMax = uMin + patchWidth * cellSizeU;
|
|
224
|
-
const vMin = -halfSize[config.vAxis] + vStart * cellSizeV;
|
|
225
|
-
const vMax = vMin + patchHeight * cellSizeV;
|
|
226
|
-
const pick = (sign, minValue, maxValue) => sign < 0 ? minValue : maxValue;
|
|
227
|
-
const vertexOrder = (() => {
|
|
228
|
-
switch (face) {
|
|
229
|
-
case "east":
|
|
230
|
-
return [
|
|
231
|
-
[-1, -1],
|
|
232
|
-
[-1, 1],
|
|
233
|
-
[1, 1],
|
|
234
|
-
[1, -1]
|
|
235
|
-
];
|
|
236
|
-
case "west":
|
|
237
|
-
return [
|
|
238
|
-
[1, -1],
|
|
239
|
-
[1, 1],
|
|
240
|
-
[-1, 1],
|
|
241
|
-
[-1, -1]
|
|
242
|
-
];
|
|
243
|
-
case "top":
|
|
244
|
-
return [
|
|
245
|
-
[-1, -1],
|
|
246
|
-
[-1, 1],
|
|
247
|
-
[1, 1],
|
|
248
|
-
[1, -1]
|
|
249
|
-
];
|
|
250
|
-
case "bottom":
|
|
251
|
-
return [
|
|
252
|
-
[-1, -1],
|
|
253
|
-
[1, -1],
|
|
254
|
-
[1, 1],
|
|
255
|
-
[-1, 1]
|
|
256
|
-
];
|
|
257
|
-
case "north":
|
|
258
|
-
return [
|
|
259
|
-
[-1, -1],
|
|
260
|
-
[1, -1],
|
|
261
|
-
[1, 1],
|
|
262
|
-
[-1, 1]
|
|
263
|
-
];
|
|
264
|
-
case "south":
|
|
265
|
-
default:
|
|
266
|
-
return [
|
|
267
|
-
[1, -1],
|
|
268
|
-
[-1, -1],
|
|
269
|
-
[-1, 1],
|
|
270
|
-
[1, 1]
|
|
271
|
-
];
|
|
272
|
-
}
|
|
273
|
-
})();
|
|
274
|
-
const uvOrder = (() => {
|
|
275
|
-
switch (face) {
|
|
276
|
-
case "east":
|
|
277
|
-
return [
|
|
278
|
-
[0, 1],
|
|
279
|
-
[0, 0],
|
|
280
|
-
[1, 0],
|
|
281
|
-
[1, 1]
|
|
282
|
-
];
|
|
283
|
-
case "west":
|
|
284
|
-
return [
|
|
285
|
-
[1, 1],
|
|
286
|
-
[1, 0],
|
|
287
|
-
[0, 0],
|
|
288
|
-
[0, 1]
|
|
289
|
-
];
|
|
290
|
-
case "top":
|
|
291
|
-
return [
|
|
292
|
-
[0, 1],
|
|
293
|
-
[0, 0],
|
|
294
|
-
[1, 0],
|
|
295
|
-
[1, 1]
|
|
296
|
-
];
|
|
297
|
-
case "bottom":
|
|
298
|
-
return [
|
|
299
|
-
[0, 0],
|
|
300
|
-
[1, 0],
|
|
301
|
-
[1, 1],
|
|
302
|
-
[0, 1]
|
|
303
|
-
];
|
|
304
|
-
case "north":
|
|
305
|
-
return [
|
|
306
|
-
[0, 1],
|
|
307
|
-
[1, 1],
|
|
308
|
-
[1, 0],
|
|
309
|
-
[0, 0]
|
|
310
|
-
];
|
|
311
|
-
case "south":
|
|
312
|
-
default:
|
|
313
|
-
return [
|
|
314
|
-
[1, 1],
|
|
315
|
-
[0, 1],
|
|
316
|
-
[0, 0],
|
|
317
|
-
[1, 0]
|
|
318
|
-
];
|
|
319
|
-
}
|
|
320
|
-
})();
|
|
321
|
-
for (let i = 0; i < vertexOrder.length; i += 1) {
|
|
322
|
-
const [uSign, vSign] = vertexOrder[i];
|
|
323
|
-
const pos = [0, 0, 0];
|
|
324
|
-
pos[config.axis] = axisCoord;
|
|
325
|
-
pos[config.uAxis] = pick(uSign, uMin, uMax);
|
|
326
|
-
pos[config.vAxis] = pick(vSign, vMin, vMax);
|
|
327
|
-
positions[i * 3] = pos[0];
|
|
328
|
-
positions[i * 3 + 1] = pos[1];
|
|
329
|
-
positions[i * 3 + 2] = pos[2];
|
|
330
|
-
const normal = [0, 0, 0];
|
|
331
|
-
normal[config.axis] = config.direction;
|
|
332
|
-
normals[i * 3] = normal[0];
|
|
333
|
-
normals[i * 3 + 1] = normal[1];
|
|
334
|
-
normals[i * 3 + 2] = normal[2];
|
|
335
|
-
uvs[i * 2] = uvOrder[i][0];
|
|
336
|
-
uvs[i * 2 + 1] = uvOrder[i][1];
|
|
337
|
-
}
|
|
338
|
-
return { positions, normals, uvs, indices };
|
|
339
|
-
}
|
|
340
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
341
|
-
0 && (module.exports = {
|
|
342
|
-
FACE_ORDER,
|
|
343
|
-
generateVoxelFaceSurfaces
|
|
344
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type VoxelBox } from "@playdrop/boxel-core";
|
|
2
|
-
export interface BuildVoxelMeshOptions {
|
|
3
|
-
voxels: number[];
|
|
4
|
-
dimensions: [number, number, number];
|
|
5
|
-
size: [number, number, number];
|
|
6
|
-
}
|
|
7
|
-
export interface VoxelMaterialGroup {
|
|
8
|
-
material: number;
|
|
9
|
-
start: number;
|
|
10
|
-
count: number;
|
|
11
|
-
}
|
|
12
|
-
export interface VoxelMeshResult {
|
|
13
|
-
positions: Float32Array;
|
|
14
|
-
normals: Float32Array;
|
|
15
|
-
uvs: Float32Array;
|
|
16
|
-
indices: Uint32Array;
|
|
17
|
-
groups: VoxelMaterialGroup[];
|
|
18
|
-
stats: {
|
|
19
|
-
voxels: number;
|
|
20
|
-
faces: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export declare function buildVoxelMesh(options: BuildVoxelMeshOptions): VoxelMeshResult;
|
|
24
|
-
export declare function hasVoxelData(primitive: VoxelBox): boolean;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var mesher_exports = {};
|
|
19
|
-
__export(mesher_exports, {
|
|
20
|
-
buildVoxelMesh: () => buildVoxelMesh,
|
|
21
|
-
hasVoxelData: () => hasVoxelData
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(mesher_exports);
|
|
24
|
-
var import_boxel_core = require("@playdrop/boxel-core");
|
|
25
|
-
function buildVoxelMesh(options) {
|
|
26
|
-
const { voxels, dimensions, size } = options;
|
|
27
|
-
const quads = (0, import_boxel_core.generateGreedyQuads)(voxels, dimensions);
|
|
28
|
-
const halfSize = [size[0] / 2, size[1] / 2, size[2] / 2];
|
|
29
|
-
const cellSizes = [
|
|
30
|
-
dimensions[0] > 0 ? size[0] / dimensions[0] : 1,
|
|
31
|
-
dimensions[1] > 0 ? size[1] / dimensions[1] : 1,
|
|
32
|
-
dimensions[2] > 0 ? size[2] / dimensions[2] : 1
|
|
33
|
-
];
|
|
34
|
-
if (quads.length === 0) {
|
|
35
|
-
return {
|
|
36
|
-
positions: new Float32Array(0),
|
|
37
|
-
normals: new Float32Array(0),
|
|
38
|
-
uvs: new Float32Array(0),
|
|
39
|
-
indices: new Uint32Array(0),
|
|
40
|
-
groups: [],
|
|
41
|
-
stats: {
|
|
42
|
-
voxels: voxels.filter((value) => value !== 0).length,
|
|
43
|
-
faces: 0
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const positions = [];
|
|
48
|
-
const normals = [];
|
|
49
|
-
const uvs = [];
|
|
50
|
-
const indices = [];
|
|
51
|
-
const groups = [];
|
|
52
|
-
const pushQuad = (quad) => {
|
|
53
|
-
const baseIndex = positions.length / 3;
|
|
54
|
-
const axis = quad.axis;
|
|
55
|
-
const uAxis = (axis + 1) % 3;
|
|
56
|
-
const vAxis = (axis + 2) % 3;
|
|
57
|
-
const width = quad.size[0];
|
|
58
|
-
const height = quad.size[1];
|
|
59
|
-
const base = [quad.origin[0], quad.origin[1], quad.origin[2]];
|
|
60
|
-
base[axis] = quad.plane;
|
|
61
|
-
const corners = quad.normal === 1 ? [
|
|
62
|
-
[0, 0],
|
|
63
|
-
[width, 0],
|
|
64
|
-
[width, height],
|
|
65
|
-
[0, height]
|
|
66
|
-
] : [
|
|
67
|
-
[0, 0],
|
|
68
|
-
[0, height],
|
|
69
|
-
[width, height],
|
|
70
|
-
[width, 0]
|
|
71
|
-
];
|
|
72
|
-
const normalVector = [0, 0, 0];
|
|
73
|
-
normalVector[axis] = quad.normal;
|
|
74
|
-
corners.forEach(([uOffset, vOffset]) => {
|
|
75
|
-
const vertex = [base[0], base[1], base[2]];
|
|
76
|
-
vertex[uAxis] = base[uAxis] + uOffset;
|
|
77
|
-
vertex[vAxis] = base[vAxis] + vOffset;
|
|
78
|
-
positions.push(vertex[0] * cellSizes[0] - halfSize[0], vertex[1] * cellSizes[1] - halfSize[1], vertex[2] * cellSizes[2] - halfSize[2]);
|
|
79
|
-
normals.push(normalVector[0], normalVector[1], normalVector[2]);
|
|
80
|
-
const u = width > 0 ? uOffset / width : 0;
|
|
81
|
-
const v = height > 0 ? vOffset / height : 0;
|
|
82
|
-
uvs.push(u, v);
|
|
83
|
-
});
|
|
84
|
-
const startIndex = indices.length;
|
|
85
|
-
indices.push(baseIndex, baseIndex + 1, baseIndex + 2, baseIndex, baseIndex + 2, baseIndex + 3);
|
|
86
|
-
const lastGroup = groups[groups.length - 1];
|
|
87
|
-
if (lastGroup && lastGroup.material === quad.material && lastGroup.start + lastGroup.count === startIndex) {
|
|
88
|
-
lastGroup.count += 6;
|
|
89
|
-
} else {
|
|
90
|
-
groups.push({ material: quad.material, start: startIndex, count: 6 });
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
quads.forEach(pushQuad);
|
|
94
|
-
return {
|
|
95
|
-
positions: Float32Array.from(positions),
|
|
96
|
-
normals: Float32Array.from(normals),
|
|
97
|
-
uvs: Float32Array.from(uvs),
|
|
98
|
-
indices: Uint32Array.from(indices),
|
|
99
|
-
groups,
|
|
100
|
-
stats: {
|
|
101
|
-
voxels: voxels.filter((value) => value !== 0).length,
|
|
102
|
-
faces: quads.length
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function hasVoxelData(primitive) {
|
|
107
|
-
return Array.isArray(primitive.voxels) && primitive.voxels.length > 0;
|
|
108
|
-
}
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
buildVoxelMesh,
|
|
112
|
-
hasVoxelData
|
|
113
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from))
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
}
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
var import_node_test = __toESM(require("node:test"));
|
|
24
|
-
var import_strict = __toESM(require("node:assert/strict"));
|
|
25
|
-
var import_node_path = __toESM(require("node:path"));
|
|
26
|
-
var import_node_url = require("node:url");
|
|
27
|
-
const import_meta = {};
|
|
28
|
-
const HERE = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
29
|
-
const WORKER_ENTRY = import_node_path.default.resolve(HERE, "fixtures/render-worker.js");
|
|
30
|
-
async function bundleEntityWorker() {
|
|
31
|
-
const { build } = await import("esbuild");
|
|
32
|
-
const result = await build({
|
|
33
|
-
entryPoints: [WORKER_ENTRY],
|
|
34
|
-
bundle: true,
|
|
35
|
-
platform: "browser",
|
|
36
|
-
format: "esm",
|
|
37
|
-
target: "es2022",
|
|
38
|
-
write: false,
|
|
39
|
-
sourcemap: false,
|
|
40
|
-
logLevel: "silent"
|
|
41
|
-
});
|
|
42
|
-
const output = result.outputFiles?.[0]?.text;
|
|
43
|
-
if (!output) {
|
|
44
|
-
throw new Error("failed_to_bundle_entity_worker");
|
|
45
|
-
}
|
|
46
|
-
return output;
|
|
47
|
-
}
|
|
48
|
-
function createPlaywrightLaunchError(tool, error) {
|
|
49
|
-
const message = error && typeof error === "object" && "message" in error ? String(error.message) : String(error);
|
|
50
|
-
if (/browserType\.launch/i.test(message) || /MachPortRendezvousServer/i.test(message)) {
|
|
51
|
-
return new Error([
|
|
52
|
-
`[${tool}] Failed to launch Playwright Chromium.`,
|
|
53
|
-
"",
|
|
54
|
-
"Required setup:",
|
|
55
|
-
" 1. npx playwright install chromium",
|
|
56
|
-
' 2. On macOS: xattr -dr com.apple.quarantine "$HOME/Library/Caches/ms-playwright"',
|
|
57
|
-
"",
|
|
58
|
-
`Original error: ${message}`
|
|
59
|
-
].join("\n"));
|
|
60
|
-
}
|
|
61
|
-
return error instanceof Error ? error : new Error(message);
|
|
62
|
-
}
|
|
63
|
-
(0, import_node_test.default)("renderBoxelToDataURL produces a PNG data URL", async (t) => {
|
|
64
|
-
const { chromium } = await import("playwright-core");
|
|
65
|
-
const bundle = await bundleEntityWorker();
|
|
66
|
-
let browser = null;
|
|
67
|
-
try {
|
|
68
|
-
browser = await chromium.launch({ headless: true, args: ["--no-sandbox"], chromiumSandbox: false });
|
|
69
|
-
} catch (error) {
|
|
70
|
-
const launchError = createPlaywrightLaunchError("boxel-three-test", error);
|
|
71
|
-
t.skip(launchError.message);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const page = await browser.newPage({ viewport: { width: 512, height: 512 } });
|
|
75
|
-
const consoleErrors = [];
|
|
76
|
-
page.on("console", (message) => {
|
|
77
|
-
if (message.type() === "error") {
|
|
78
|
-
consoleErrors.push(message.text());
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
page.on("pageerror", (error) => {
|
|
82
|
-
consoleErrors.push(error?.message ?? String(error));
|
|
83
|
-
});
|
|
84
|
-
try {
|
|
85
|
-
await page.setContent('<canvas id="viewport"></canvas>', { waitUntil: "domcontentloaded" });
|
|
86
|
-
await page.addScriptTag({ type: "module", content: bundle });
|
|
87
|
-
await page.waitForFunction(() => typeof window.boxelExport !== "undefined");
|
|
88
|
-
const minimalEntity = {
|
|
89
|
-
id: "render-test",
|
|
90
|
-
geometry: {
|
|
91
|
-
id: "geom",
|
|
92
|
-
root: {
|
|
93
|
-
id: "Root",
|
|
94
|
-
position: [0, 0, 0],
|
|
95
|
-
children: [
|
|
96
|
-
{
|
|
97
|
-
id: "Node",
|
|
98
|
-
position: [0, 0.5, 0],
|
|
99
|
-
mesh: "box",
|
|
100
|
-
children: []
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
primitives: [
|
|
106
|
-
{
|
|
107
|
-
id: "box",
|
|
108
|
-
kind: "plain_box",
|
|
109
|
-
size: [1, 1, 1],
|
|
110
|
-
material: "mat"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
materials: [{ id: "mat", baseColor: [200, 120, 60] }],
|
|
114
|
-
textures: [],
|
|
115
|
-
patterns: [],
|
|
116
|
-
animations: []
|
|
117
|
-
};
|
|
118
|
-
const dataUrl = await page.evaluate((model) => window.boxelExport.renderBoxel(model, {
|
|
119
|
-
mode: "hierarchical",
|
|
120
|
-
width: 512,
|
|
121
|
-
height: 512,
|
|
122
|
-
direction: "preview",
|
|
123
|
-
animationIds: null
|
|
124
|
-
}), minimalEntity);
|
|
125
|
-
import_strict.default.strictEqual(typeof dataUrl, "string");
|
|
126
|
-
import_strict.default.ok(dataUrl.startsWith("data:image/png;base64,"), "Render output is not a PNG data URL");
|
|
127
|
-
import_strict.default.ok(dataUrl.length > "data:image/png;base64,".length, "Render output is empty");
|
|
128
|
-
if (consoleErrors.length > 0) {
|
|
129
|
-
throw new Error(consoleErrors.join("\n"));
|
|
130
|
-
}
|
|
131
|
-
} finally {
|
|
132
|
-
await page.close();
|
|
133
|
-
if (browser) {
|
|
134
|
-
await browser.close();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ExportMode } from "../../src/index.js";
|
|
2
|
-
interface ExportEntityOptions {
|
|
3
|
-
mode?: ExportMode;
|
|
4
|
-
animationIds?: string[] | null;
|
|
5
|
-
}
|
|
6
|
-
interface RenderEntityOptions extends ExportEntityOptions {
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
direction?: string;
|
|
10
|
-
background?: number | string | null;
|
|
11
|
-
}
|
|
12
|
-
declare global {
|
|
13
|
-
interface Window {
|
|
14
|
-
boxelExport?: {
|
|
15
|
-
exportBoxel(modelJson: unknown, options?: ExportEntityOptions): Promise<string>;
|
|
16
|
-
renderBoxel(modelJson: unknown, options?: RenderEntityOptions): Promise<string>;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export {};
|