@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,18 +0,0 @@
|
|
|
1
|
-
import type * as THREEType from "three";
|
|
2
|
-
import type { BoxelDefinition } from "@playdrop/boxel-core";
|
|
3
|
-
import { type ExportMode } from "./glb.js";
|
|
4
|
-
declare const DIRECTION_VECTORS: Record<string, [number, number, number]>;
|
|
5
|
-
export interface RenderBoxelImageOptions {
|
|
6
|
-
THREE: typeof THREEType;
|
|
7
|
-
renderer: THREEType.WebGLRenderer;
|
|
8
|
-
entity: BoxelDefinition;
|
|
9
|
-
mode?: ExportMode;
|
|
10
|
-
animationIds?: string[] | null;
|
|
11
|
-
animationId?: string | null;
|
|
12
|
-
width?: number;
|
|
13
|
-
height?: number;
|
|
14
|
-
direction?: keyof typeof DIRECTION_VECTORS;
|
|
15
|
-
background?: THREEType.ColorRepresentation | null;
|
|
16
|
-
}
|
|
17
|
-
export declare function renderBoxelToDataURL(options: RenderBoxelImageOptions): Promise<string>;
|
|
18
|
-
export {};
|
|
@@ -1,294 +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 image_exports = {};
|
|
19
|
-
__export(image_exports, {
|
|
20
|
-
renderBoxelToDataURL: () => renderBoxelToDataURL
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(image_exports);
|
|
23
|
-
var import_scene = require("../scene.js");
|
|
24
|
-
var import_glb = require("./glb.js");
|
|
25
|
-
var import_skinned_mesh = require("../skinned-mesh.js");
|
|
26
|
-
var import_animations = require("../animations.js");
|
|
27
|
-
function findNodeById(root, id) {
|
|
28
|
-
if (root.id === id)
|
|
29
|
-
return root;
|
|
30
|
-
for (const child of root.children) {
|
|
31
|
-
const found = findNodeById(child, id);
|
|
32
|
-
if (found)
|
|
33
|
-
return found;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const DIRECTION_VECTORS = {
|
|
38
|
-
preview: [1.2, 1.4, 1.3],
|
|
39
|
-
headshot: [-0.35, 0.05, 1],
|
|
40
|
-
top: [0, 1, 0],
|
|
41
|
-
bottom: [0, -1, 0],
|
|
42
|
-
front: [0, 0, 1],
|
|
43
|
-
back: [0, 0, -1],
|
|
44
|
-
left: [-1, 0, 0],
|
|
45
|
-
right: [1, 0, 0]
|
|
46
|
-
};
|
|
47
|
-
const UP_VECTORS = {
|
|
48
|
-
top: [0, 0, -1],
|
|
49
|
-
bottom: [0, 0, 1]
|
|
50
|
-
};
|
|
51
|
-
const CAMERA_DISTANCE_FACTOR = 1.25;
|
|
52
|
-
const DEFAULT_MIN_DISTANCE = 2.5;
|
|
53
|
-
const HEADSHOT_MIN_DISTANCE = 2;
|
|
54
|
-
const HEADSHOT_RADIUS_PADDING = 1.3;
|
|
55
|
-
const HEAD_NODE_IDS = ["head", "Head"];
|
|
56
|
-
const HEADSHOT_VERTICAL_OFFSET_RATIO = 2 / 3;
|
|
57
|
-
const AMBIENT_LIGHT_COLOR = 11847420;
|
|
58
|
-
const AMBIENT_LIGHT_INTENSITY = 2.2;
|
|
59
|
-
const DIRECTIONAL_LIGHT_COLOR = 16317180;
|
|
60
|
-
const DIRECTIONAL_LIGHT_INTENSITY = 1.3;
|
|
61
|
-
const DIRECTIONAL_LIGHT_MIN_HEIGHT_OFFSET = 2;
|
|
62
|
-
const SHADOW_MAP_SIZE = 2048;
|
|
63
|
-
const SHADOW_BIAS = -12e-5;
|
|
64
|
-
const SHADOW_NORMAL_BIAS = 6e-3;
|
|
65
|
-
const SUPER_SAMPLE_RATIO = 2;
|
|
66
|
-
async function renderBoxelToDataURL(options) {
|
|
67
|
-
const { THREE: three, renderer, entity, mode = "hierarchical", animationId, width, height, direction = "preview", background = null } = options;
|
|
68
|
-
const sizeTarget = new three.Vector2();
|
|
69
|
-
renderer.getSize(sizeTarget);
|
|
70
|
-
const previousWidth = sizeTarget.x;
|
|
71
|
-
const previousHeight = sizeTarget.y;
|
|
72
|
-
const previousPixelRatio = renderer.getPixelRatio();
|
|
73
|
-
const previousShadowEnabled = renderer.shadowMap.enabled;
|
|
74
|
-
const previousShadowType = renderer.shadowMap.type;
|
|
75
|
-
const previousShadowAutoUpdate = renderer.shadowMap.autoUpdate;
|
|
76
|
-
const clearColor = renderer.getClearColor(new three.Color());
|
|
77
|
-
const clearAlpha = renderer.getClearAlpha();
|
|
78
|
-
const targetWidth = width ?? (previousWidth || 1024);
|
|
79
|
-
const targetHeight = height ?? (previousHeight || 1024);
|
|
80
|
-
renderer.setPixelRatio(SUPER_SAMPLE_RATIO);
|
|
81
|
-
renderer.setSize(targetWidth, targetHeight, false);
|
|
82
|
-
renderer.shadowMap.enabled = true;
|
|
83
|
-
renderer.shadowMap.autoUpdate = true;
|
|
84
|
-
renderer.shadowMap.type = three.PCFSoftShadowMap;
|
|
85
|
-
if (background === null) {
|
|
86
|
-
renderer.setClearColor(0, 0);
|
|
87
|
-
} else if (background !== void 0) {
|
|
88
|
-
const color = new three.Color(background);
|
|
89
|
-
renderer.setClearColor(color, 1);
|
|
90
|
-
}
|
|
91
|
-
let disposeScene;
|
|
92
|
-
let root;
|
|
93
|
-
let animations = [];
|
|
94
|
-
let nodeLookup = null;
|
|
95
|
-
if (mode === "hierarchical") {
|
|
96
|
-
const scene2 = (0, import_scene.createBoxelScene)({ THREE: three, entity });
|
|
97
|
-
disposeScene = scene2.dispose;
|
|
98
|
-
root = scene2.root;
|
|
99
|
-
animations = scene2.animations;
|
|
100
|
-
nodeLookup = /* @__PURE__ */ new Map();
|
|
101
|
-
scene2.nodes.forEach((meta) => {
|
|
102
|
-
nodeLookup.set(meta.id, meta.object);
|
|
103
|
-
});
|
|
104
|
-
} else if (mode === "skinned") {
|
|
105
|
-
const skinned = (0, import_skinned_mesh.buildEntitySkinnedMesh)({ THREE: three, entity });
|
|
106
|
-
const group = new three.Group();
|
|
107
|
-
group.add(skinned.mesh);
|
|
108
|
-
disposeScene = () => {
|
|
109
|
-
skinned.dispose();
|
|
110
|
-
};
|
|
111
|
-
root = group;
|
|
112
|
-
nodeLookup = /* @__PURE__ */ new Map();
|
|
113
|
-
skinned.boneMap.forEach((bone, nodeId) => nodeLookup.set(nodeId, bone));
|
|
114
|
-
animations = (0, import_animations.buildAnimations)(three, entity, nodeLookup);
|
|
115
|
-
} else {
|
|
116
|
-
const sceneGraph = (0, import_glb.createBoxelSceneGraph)({ THREE: three, model: entity, mode });
|
|
117
|
-
disposeScene = sceneGraph.dispose;
|
|
118
|
-
root = sceneGraph.root;
|
|
119
|
-
animations = sceneGraph.animations;
|
|
120
|
-
nodeLookup = sceneGraph.nodeLookup;
|
|
121
|
-
}
|
|
122
|
-
const scene = new three.Scene();
|
|
123
|
-
scene.background = background === null ? null : background === void 0 ? null : new three.Color(background);
|
|
124
|
-
scene.add(root);
|
|
125
|
-
root.traverse((obj) => {
|
|
126
|
-
const mesh = obj;
|
|
127
|
-
if (mesh.isMesh) {
|
|
128
|
-
mesh.castShadow = true;
|
|
129
|
-
mesh.receiveShadow = true;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
const ambient = new three.AmbientLight(AMBIENT_LIGHT_COLOR, AMBIENT_LIGHT_INTENSITY);
|
|
133
|
-
const directional = new three.DirectionalLight(DIRECTIONAL_LIGHT_COLOR, DIRECTIONAL_LIGHT_INTENSITY);
|
|
134
|
-
directional.castShadow = true;
|
|
135
|
-
directional.shadow.mapSize.set(SHADOW_MAP_SIZE, SHADOW_MAP_SIZE);
|
|
136
|
-
directional.shadow.bias = SHADOW_BIAS;
|
|
137
|
-
directional.shadow.normalBias = SHADOW_NORMAL_BIAS;
|
|
138
|
-
scene.add(ambient);
|
|
139
|
-
scene.add(directional);
|
|
140
|
-
let dataUrl = "";
|
|
141
|
-
const requestedAnimationId = typeof animationId === "string" && animationId.trim().length > 0 ? animationId.trim() : null;
|
|
142
|
-
const normalizedRequestedAnimationId = requestedAnimationId?.toLowerCase();
|
|
143
|
-
let sampleClip = null;
|
|
144
|
-
if (requestedAnimationId) {
|
|
145
|
-
sampleClip = animations.find((entry) => entry.id === requestedAnimationId || entry.id.toLowerCase() === normalizedRequestedAnimationId) ?? null;
|
|
146
|
-
if (!sampleClip) {
|
|
147
|
-
throw new Error(`Animation "${requestedAnimationId}" was not found for this entity.`);
|
|
148
|
-
}
|
|
149
|
-
} else if ((direction === "preview" || direction === "headshot") && animations.length > 0) {
|
|
150
|
-
const idleAnimation = animations.find((entry) => entry.id.toLowerCase().includes("idle"));
|
|
151
|
-
if (idleAnimation) {
|
|
152
|
-
sampleClip = idleAnimation;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
let mixer = null;
|
|
156
|
-
if (sampleClip) {
|
|
157
|
-
mixer = new three.AnimationMixer(root);
|
|
158
|
-
const action = mixer.clipAction(sampleClip.clip);
|
|
159
|
-
action.play();
|
|
160
|
-
action.paused = true;
|
|
161
|
-
const firstKeyframe = sampleClip.channels.reduce((min, channel) => {
|
|
162
|
-
const times = channel.track.times;
|
|
163
|
-
if (!times || times.length === 0) {
|
|
164
|
-
return min;
|
|
165
|
-
}
|
|
166
|
-
const firstTime = times[0];
|
|
167
|
-
return Number.isFinite(firstTime) && firstTime < min ? firstTime : min;
|
|
168
|
-
}, Number.POSITIVE_INFINITY);
|
|
169
|
-
const sampleTime = Number.isFinite(firstKeyframe) ? firstKeyframe : 0;
|
|
170
|
-
mixer.setTime(sampleTime);
|
|
171
|
-
mixer.update(0);
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
root.updateMatrixWorld(true);
|
|
175
|
-
const bounds = new three.Box3().setFromObject(root);
|
|
176
|
-
const sphere = bounds.getBoundingSphere(new three.Sphere());
|
|
177
|
-
const center = sphere.center.clone();
|
|
178
|
-
let radius = sphere.radius || 1;
|
|
179
|
-
let headCenter = null;
|
|
180
|
-
if (direction === "headshot" && nodeLookup) {
|
|
181
|
-
const headObject = HEAD_NODE_IDS.map((id) => nodeLookup.get(id)).find(Boolean);
|
|
182
|
-
if (headObject) {
|
|
183
|
-
let headBounds;
|
|
184
|
-
if (mode === "skinned" && headObject.type === "Bone") {
|
|
185
|
-
const headNode = findNodeById(entity.geometry.root, headObject.name);
|
|
186
|
-
if (headNode?.size) {
|
|
187
|
-
headObject.updateMatrixWorld(true);
|
|
188
|
-
const nodeCenter = headNode.center ?? [0, 0, 0];
|
|
189
|
-
const halfSize = headNode.size.map((s) => s / 2);
|
|
190
|
-
const localMin = new three.Vector3(nodeCenter[0] - halfSize[0], nodeCenter[1] - halfSize[1], nodeCenter[2] - halfSize[2]);
|
|
191
|
-
const localMax = new three.Vector3(nodeCenter[0] + halfSize[0], nodeCenter[1] + halfSize[1], nodeCenter[2] + halfSize[2]);
|
|
192
|
-
localMin.applyMatrix4(headObject.matrixWorld);
|
|
193
|
-
localMax.applyMatrix4(headObject.matrixWorld);
|
|
194
|
-
headBounds = new three.Box3(localMin, localMax);
|
|
195
|
-
} else {
|
|
196
|
-
headBounds = new three.Box3().setFromObject(headObject);
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
199
|
-
headBounds = new three.Box3().setFromObject(headObject);
|
|
200
|
-
}
|
|
201
|
-
if (!headBounds.isEmpty()) {
|
|
202
|
-
headCenter = headBounds.getCenter(new three.Vector3());
|
|
203
|
-
center.copy(headCenter);
|
|
204
|
-
const headSphere = headBounds.getBoundingSphere(new three.Sphere());
|
|
205
|
-
const headRadius = headSphere.radius || radius;
|
|
206
|
-
radius = Math.max(headRadius * HEADSHOT_RADIUS_PADDING, headRadius);
|
|
207
|
-
center.y -= radius * HEADSHOT_VERTICAL_OFFSET_RATIO;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const camera = new three.PerspectiveCamera(50, targetWidth / targetHeight, 0.1, Math.max(1e3, radius * 10));
|
|
212
|
-
const dir = DIRECTION_VECTORS[direction] ?? DIRECTION_VECTORS.preview;
|
|
213
|
-
const target = new three.Vector3().fromArray(dir).normalize();
|
|
214
|
-
const minDistance = direction === "headshot" ? HEADSHOT_MIN_DISTANCE : DEFAULT_MIN_DISTANCE;
|
|
215
|
-
let distance = Math.max(radius * CAMERA_DISTANCE_FACTOR, minDistance);
|
|
216
|
-
const basePosition = center.clone().add(target.clone().multiplyScalar(distance));
|
|
217
|
-
if (direction === "headshot" && headCenter) {
|
|
218
|
-
const deltaY = headCenter.y - center.y;
|
|
219
|
-
if (Math.abs(deltaY) >= distance) {
|
|
220
|
-
distance = Math.abs(deltaY) + 0.1;
|
|
221
|
-
}
|
|
222
|
-
const horizontalMagnitude = Math.sqrt(Math.max(0, distance * distance - deltaY * deltaY));
|
|
223
|
-
const horizontalDir = new three.Vector3(target.x, 0, target.z);
|
|
224
|
-
if (horizontalDir.lengthSq() > 0) {
|
|
225
|
-
horizontalDir.normalize().multiplyScalar(horizontalMagnitude);
|
|
226
|
-
camera.position.set(center.x + horizontalDir.x, headCenter.y, center.z + horizontalDir.z);
|
|
227
|
-
} else {
|
|
228
|
-
camera.position.set(center.x, headCenter.y, center.z);
|
|
229
|
-
}
|
|
230
|
-
} else {
|
|
231
|
-
camera.position.copy(basePosition);
|
|
232
|
-
}
|
|
233
|
-
camera.aspect = targetWidth / targetHeight;
|
|
234
|
-
camera.updateProjectionMatrix();
|
|
235
|
-
camera.lookAt(center);
|
|
236
|
-
const up = UP_VECTORS[direction];
|
|
237
|
-
if (up) {
|
|
238
|
-
camera.up.set(up[0], up[1], up[2]);
|
|
239
|
-
} else {
|
|
240
|
-
camera.up.set(0, 1, 0);
|
|
241
|
-
}
|
|
242
|
-
const lightPosition = camera.position.clone();
|
|
243
|
-
lightPosition.y = Math.max(lightPosition.y, center.y + DIRECTIONAL_LIGHT_MIN_HEIGHT_OFFSET);
|
|
244
|
-
directional.position.copy(lightPosition);
|
|
245
|
-
directional.target.position.copy(center);
|
|
246
|
-
directional.target.updateMatrixWorld();
|
|
247
|
-
const shadowCamera = directional.shadow.camera;
|
|
248
|
-
const cameraRange = Math.max(10, radius * 4);
|
|
249
|
-
shadowCamera.left = -cameraRange;
|
|
250
|
-
shadowCamera.right = cameraRange;
|
|
251
|
-
shadowCamera.top = cameraRange;
|
|
252
|
-
shadowCamera.bottom = -cameraRange;
|
|
253
|
-
shadowCamera.near = 0.1;
|
|
254
|
-
shadowCamera.far = Math.max(50, radius * 8);
|
|
255
|
-
shadowCamera.updateProjectionMatrix();
|
|
256
|
-
scene.add(directional.target);
|
|
257
|
-
renderer.render(scene, camera);
|
|
258
|
-
if (typeof document !== "undefined") {
|
|
259
|
-
const captureCanvas = document.createElement("canvas");
|
|
260
|
-
captureCanvas.width = targetWidth;
|
|
261
|
-
captureCanvas.height = targetHeight;
|
|
262
|
-
const ctx = captureCanvas.getContext("2d");
|
|
263
|
-
if (!ctx) {
|
|
264
|
-
dataUrl = renderer.domElement.toDataURL("image/png");
|
|
265
|
-
} else {
|
|
266
|
-
ctx.clearRect(0, 0, targetWidth, targetHeight);
|
|
267
|
-
ctx.drawImage(renderer.domElement, 0, 0, targetWidth, targetHeight);
|
|
268
|
-
dataUrl = captureCanvas.toDataURL("image/png");
|
|
269
|
-
}
|
|
270
|
-
} else {
|
|
271
|
-
dataUrl = renderer.domElement.toDataURL("image/png");
|
|
272
|
-
}
|
|
273
|
-
scene.remove(directional.target);
|
|
274
|
-
} finally {
|
|
275
|
-
if (mixer) {
|
|
276
|
-
mixer.stopAllAction();
|
|
277
|
-
}
|
|
278
|
-
scene.remove(root);
|
|
279
|
-
scene.remove(ambient);
|
|
280
|
-
scene.remove(directional);
|
|
281
|
-
disposeScene();
|
|
282
|
-
renderer.setSize(previousWidth || targetWidth, previousHeight || targetHeight, false);
|
|
283
|
-
renderer.setPixelRatio(previousPixelRatio || 1);
|
|
284
|
-
renderer.shadowMap.enabled = previousShadowEnabled;
|
|
285
|
-
renderer.shadowMap.type = previousShadowType;
|
|
286
|
-
renderer.shadowMap.autoUpdate = previousShadowAutoUpdate;
|
|
287
|
-
renderer.setClearColor(clearColor, clearAlpha);
|
|
288
|
-
}
|
|
289
|
-
return dataUrl;
|
|
290
|
-
}
|
|
291
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
292
|
-
0 && (module.exports = {
|
|
293
|
-
renderBoxelToDataURL
|
|
294
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from "./types.js";
|
|
2
|
-
export { createBoxelScene, createBoxelNodeScene } from "./scene.js";
|
|
3
|
-
export { attachBoxelOverlays } from "./overlays.js";
|
|
4
|
-
export * from "./primitives.js";
|
|
5
|
-
export * from "./context.js";
|
|
6
|
-
export * from "./textures.js";
|
|
7
|
-
export * from "./builders.js";
|
|
8
|
-
export * from "./voxels/mesher.js";
|
|
9
|
-
export * from "./voxels/faces.js";
|
|
10
|
-
export { exportModelToGLB, createBoxelSceneGraph } from "./exporters/glb.js";
|
|
11
|
-
export type { ExportMode } from "./exporters/glb.js";
|
|
12
|
-
export { renderBoxelToDataURL } from "./exporters/image.js";
|
|
13
|
-
export type { RenderBoxelImageOptions } from "./exporters/image.js";
|
|
14
|
-
export { __testing as __boxelThreeTesting } from "./exporters/glb.js";
|
|
15
|
-
export * from "./texture-atlas.js";
|
|
16
|
-
export * from "./skinned-mesh.js";
|
|
17
|
-
export * from "./instantiate.js";
|
|
@@ -1,64 +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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var src_exports = {};
|
|
20
|
-
__export(src_exports, {
|
|
21
|
-
__boxelThreeTesting: () => import_glb2.__testing,
|
|
22
|
-
attachBoxelOverlays: () => import_overlays.attachBoxelOverlays,
|
|
23
|
-
createBoxelNodeScene: () => import_scene.createBoxelNodeScene,
|
|
24
|
-
createBoxelScene: () => import_scene.createBoxelScene,
|
|
25
|
-
createBoxelSceneGraph: () => import_glb.createBoxelSceneGraph,
|
|
26
|
-
exportModelToGLB: () => import_glb.exportModelToGLB,
|
|
27
|
-
renderBoxelToDataURL: () => import_image.renderBoxelToDataURL
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(src_exports);
|
|
30
|
-
__reExport(src_exports, require("./types.js"), module.exports);
|
|
31
|
-
var import_scene = require("./scene.js");
|
|
32
|
-
var import_overlays = require("./overlays.js");
|
|
33
|
-
__reExport(src_exports, require("./primitives.js"), module.exports);
|
|
34
|
-
__reExport(src_exports, require("./context.js"), module.exports);
|
|
35
|
-
__reExport(src_exports, require("./textures.js"), module.exports);
|
|
36
|
-
__reExport(src_exports, require("./builders.js"), module.exports);
|
|
37
|
-
__reExport(src_exports, require("./voxels/mesher.js"), module.exports);
|
|
38
|
-
__reExport(src_exports, require("./voxels/faces.js"), module.exports);
|
|
39
|
-
var import_glb = require("./exporters/glb.js");
|
|
40
|
-
var import_image = require("./exporters/image.js");
|
|
41
|
-
var import_glb2 = require("./exporters/glb.js");
|
|
42
|
-
__reExport(src_exports, require("./texture-atlas.js"), module.exports);
|
|
43
|
-
__reExport(src_exports, require("./skinned-mesh.js"), module.exports);
|
|
44
|
-
__reExport(src_exports, require("./instantiate.js"), module.exports);
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
__boxelThreeTesting,
|
|
48
|
-
attachBoxelOverlays,
|
|
49
|
-
createBoxelNodeScene,
|
|
50
|
-
createBoxelScene,
|
|
51
|
-
createBoxelSceneGraph,
|
|
52
|
-
exportModelToGLB,
|
|
53
|
-
renderBoxelToDataURL,
|
|
54
|
-
...require("./types.js"),
|
|
55
|
-
...require("./primitives.js"),
|
|
56
|
-
...require("./context.js"),
|
|
57
|
-
...require("./textures.js"),
|
|
58
|
-
...require("./builders.js"),
|
|
59
|
-
...require("./voxels/mesher.js"),
|
|
60
|
-
...require("./voxels/faces.js"),
|
|
61
|
-
...require("./texture-atlas.js"),
|
|
62
|
-
...require("./skinned-mesh.js"),
|
|
63
|
-
...require("./instantiate.js")
|
|
64
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type * as THREEType from "three";
|
|
2
|
-
import type { BoxelDefinition } from "@playdrop/boxel-core";
|
|
3
|
-
import type { BoxelSceneResult } from "./types.js";
|
|
4
|
-
import type { BuildSkinnedMeshResult } from "./skinned-mesh.js";
|
|
5
|
-
export type InstantiateEntityObject3DMode = "hierarchy" | "merged" | "skinned";
|
|
6
|
-
interface InstantiateBaseResult {
|
|
7
|
-
mode: InstantiateEntityObject3DMode;
|
|
8
|
-
dispose(): void;
|
|
9
|
-
}
|
|
10
|
-
export interface InstantiateHierarchyResult extends InstantiateBaseResult {
|
|
11
|
-
mode: "hierarchy";
|
|
12
|
-
object: THREEType.Group;
|
|
13
|
-
scene: BoxelSceneResult;
|
|
14
|
-
clips: THREEType.AnimationClip[];
|
|
15
|
-
findNode(nodeId: string): THREEType.Object3D | undefined;
|
|
16
|
-
forEachNode(visitor: (node: THREEType.Object3D, nodeId: string) => void): void;
|
|
17
|
-
}
|
|
18
|
-
export interface InstantiateMergedResult extends InstantiateBaseResult {
|
|
19
|
-
mode: "merged";
|
|
20
|
-
object: THREEType.Group;
|
|
21
|
-
}
|
|
22
|
-
export interface InstantiateSkinnedResult extends InstantiateBaseResult {
|
|
23
|
-
mode: "skinned";
|
|
24
|
-
object: THREEType.SkinnedMesh;
|
|
25
|
-
skeleton: THREEType.Skeleton;
|
|
26
|
-
boneMap: Map<string, THREEType.Bone>;
|
|
27
|
-
clips: THREEType.AnimationClip[];
|
|
28
|
-
stats: BuildSkinnedMeshResult["stats"];
|
|
29
|
-
warnings: string[];
|
|
30
|
-
findBone(nodeId: string): THREEType.Bone | undefined;
|
|
31
|
-
forEachBone(visitor: (bone: THREEType.Bone, nodeId: string) => void): void;
|
|
32
|
-
}
|
|
33
|
-
export type InstantiateEntityObject3DResult = InstantiateHierarchyResult | InstantiateMergedResult | InstantiateSkinnedResult;
|
|
34
|
-
export interface InstantiateEntityObject3DOptions {
|
|
35
|
-
THREE: typeof THREEType;
|
|
36
|
-
entity: BoxelDefinition;
|
|
37
|
-
mode?: InstantiateEntityObject3DMode;
|
|
38
|
-
}
|
|
39
|
-
export declare function instantiateEntityObject3D(options: InstantiateEntityObject3DOptions): InstantiateEntityObject3DResult;
|
|
40
|
-
export {};
|
|
@@ -1,96 +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 instantiate_exports = {};
|
|
19
|
-
__export(instantiate_exports, {
|
|
20
|
-
instantiateEntityObject3D: () => instantiateEntityObject3D
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(instantiate_exports);
|
|
23
|
-
var import_scene = require("./scene.js");
|
|
24
|
-
var import_glb = require("./exporters/glb.js");
|
|
25
|
-
var import_skinned_mesh = require("./skinned-mesh.js");
|
|
26
|
-
var import_animations = require("./animations.js");
|
|
27
|
-
function instantiateHierarchy(options) {
|
|
28
|
-
const { THREE, entity } = options;
|
|
29
|
-
const scene = (0, import_scene.createBoxelScene)({ THREE, entity });
|
|
30
|
-
const clips = scene.animations.map((animation) => animation.clip);
|
|
31
|
-
return {
|
|
32
|
-
mode: "hierarchy",
|
|
33
|
-
object: scene.root,
|
|
34
|
-
scene,
|
|
35
|
-
clips,
|
|
36
|
-
findNode: (nodeId) => scene.nodes.get(nodeId)?.object,
|
|
37
|
-
forEachNode: (visitor) => {
|
|
38
|
-
scene.nodes.forEach((meta) => visitor(meta.object, meta.id));
|
|
39
|
-
},
|
|
40
|
-
dispose: () => {
|
|
41
|
-
scene.dispose();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function instantiateMerged(options) {
|
|
46
|
-
const { THREE, entity } = options;
|
|
47
|
-
const graph = (0, import_glb.createBoxelSceneGraph)({ THREE, model: entity, mode: "merged" });
|
|
48
|
-
const { root } = graph;
|
|
49
|
-
return {
|
|
50
|
-
mode: "merged",
|
|
51
|
-
object: root,
|
|
52
|
-
dispose: () => {
|
|
53
|
-
graph.dispose();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function instantiateSkinned(options) {
|
|
58
|
-
const { THREE, entity } = options;
|
|
59
|
-
const result = (0, import_skinned_mesh.buildEntitySkinnedMesh)({ THREE, entity });
|
|
60
|
-
const boneMap = result.boneMap;
|
|
61
|
-
const animations = (0, import_animations.buildAnimations)(THREE, entity, boneMap);
|
|
62
|
-
const clips = animations.map((animation) => animation.clip);
|
|
63
|
-
return {
|
|
64
|
-
mode: "skinned",
|
|
65
|
-
object: result.mesh,
|
|
66
|
-
skeleton: result.skeleton,
|
|
67
|
-
boneMap,
|
|
68
|
-
clips,
|
|
69
|
-
stats: result.stats,
|
|
70
|
-
warnings: result.warnings,
|
|
71
|
-
findBone: (nodeId) => boneMap.get(nodeId),
|
|
72
|
-
forEachBone: (visitor) => {
|
|
73
|
-
boneMap.forEach((bone, nodeId) => visitor(bone, nodeId));
|
|
74
|
-
},
|
|
75
|
-
dispose: () => {
|
|
76
|
-
result.dispose();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function instantiateEntityObject3D(options) {
|
|
81
|
-
const mode = options.mode ?? "hierarchy";
|
|
82
|
-
switch (mode) {
|
|
83
|
-
case "hierarchy":
|
|
84
|
-
return instantiateHierarchy(options);
|
|
85
|
-
case "merged":
|
|
86
|
-
return instantiateMerged(options);
|
|
87
|
-
case "skinned":
|
|
88
|
-
return instantiateSkinned(options);
|
|
89
|
-
default:
|
|
90
|
-
throw new Error(`Unknown entity instantiation mode: ${String(mode)}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
-
0 && (module.exports = {
|
|
95
|
-
instantiateEntityObject3D
|
|
96
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type * as THREEType from "three";
|
|
2
|
-
import type { Node } from "@playdrop/boxel-core";
|
|
3
|
-
import type { PrimitiveBuilderContext } from "./context.js";
|
|
4
|
-
export interface NodeBuildResult {
|
|
5
|
-
object: THREEType.Object3D;
|
|
6
|
-
nodes: Map<string, THREEType.Object3D>;
|
|
7
|
-
}
|
|
8
|
-
export declare function buildNodeObject(context: PrimitiveBuilderContext, node: Node, visitedPrimitives?: Set<string>): NodeBuildResult;
|
|
@@ -1,88 +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 nodes_exports = {};
|
|
19
|
-
__export(nodes_exports, {
|
|
20
|
-
buildNodeObject: () => buildNodeObject
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(nodes_exports);
|
|
23
|
-
var import_builders = require("./builders.js");
|
|
24
|
-
function applyNodeTransforms(context, object, node) {
|
|
25
|
-
object.position.set(node.position[0], node.position[1], node.position[2]);
|
|
26
|
-
if (node.rotation) {
|
|
27
|
-
object.rotation.set(context.THREE.MathUtils.degToRad(node.rotation[0]), context.THREE.MathUtils.degToRad(node.rotation[1]), context.THREE.MathUtils.degToRad(node.rotation[2]));
|
|
28
|
-
}
|
|
29
|
-
if (node.scale) {
|
|
30
|
-
object.scale.set(node.scale[0], node.scale[1], node.scale[2]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function buildNodeObject(context, node, visitedPrimitives = /* @__PURE__ */ new Set()) {
|
|
34
|
-
const connectMode = node.connect ?? "none";
|
|
35
|
-
const object = new context.THREE.Object3D();
|
|
36
|
-
object.name = node.id;
|
|
37
|
-
object.userData = {
|
|
38
|
-
...object.userData ?? {},
|
|
39
|
-
kind: "entity-node",
|
|
40
|
-
nodeId: node.id,
|
|
41
|
-
primitiveId: node.mesh ?? object.userData?.primitiveId ?? void 0,
|
|
42
|
-
connectMode
|
|
43
|
-
};
|
|
44
|
-
if (node.size) {
|
|
45
|
-
object.userData.size = [...node.size];
|
|
46
|
-
}
|
|
47
|
-
if (node.center) {
|
|
48
|
-
object.userData.center = [...node.center];
|
|
49
|
-
}
|
|
50
|
-
applyNodeTransforms(context, object, node);
|
|
51
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
52
|
-
nodes.set(node.id, object);
|
|
53
|
-
if (node.mesh) {
|
|
54
|
-
const primitive = context.primitivesById.get(node.mesh);
|
|
55
|
-
if (primitive) {
|
|
56
|
-
const mesh = (0, import_builders.createPrimitiveObject)(context, primitive, "centered", visitedPrimitives);
|
|
57
|
-
if (mesh) {
|
|
58
|
-
if (node.center) {
|
|
59
|
-
mesh.position.set(node.center[0], node.center[1], node.center[2]);
|
|
60
|
-
}
|
|
61
|
-
object.add(mesh);
|
|
62
|
-
if (mesh.userData?.size && !object.userData.size) {
|
|
63
|
-
object.userData.size = mesh.userData.size;
|
|
64
|
-
}
|
|
65
|
-
if (mesh.userData?.sockets) {
|
|
66
|
-
object.userData.sockets = mesh.userData.sockets;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} else if (node.size) {
|
|
71
|
-
const mesh = (0, import_builders.createBoundingBoxMesh)(context, node.size);
|
|
72
|
-
mesh.name = `${node.id}__placeholder`;
|
|
73
|
-
if (node.center) {
|
|
74
|
-
mesh.position.set(node.center[0], node.center[1], node.center[2]);
|
|
75
|
-
}
|
|
76
|
-
object.add(mesh);
|
|
77
|
-
}
|
|
78
|
-
node.children.forEach((child) => {
|
|
79
|
-
const childResult = buildNodeObject(context, child, new Set(visitedPrimitives));
|
|
80
|
-
object.add(childResult.object);
|
|
81
|
-
childResult.nodes.forEach((value, key) => nodes.set(key, value));
|
|
82
|
-
});
|
|
83
|
-
return { object, nodes };
|
|
84
|
-
}
|
|
85
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
-
0 && (module.exports = {
|
|
87
|
-
buildNodeObject
|
|
88
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type * as THREEType from "three";
|
|
2
|
-
import type { BoxelOverlayOptions, BoxelOverlayHandles } from "./types.js";
|
|
3
|
-
export interface CreateOverlayContext {
|
|
4
|
-
THREE: typeof THREEType;
|
|
5
|
-
target: THREEType.Object3D;
|
|
6
|
-
}
|
|
7
|
-
export declare function attachBoxelOverlays(context: CreateOverlayContext, options?: BoxelOverlayOptions): BoxelOverlayHandles;
|