@playdrop/playdrop-cli 0.16.16 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/config/client-meta.json +4 -4
  2. package/dist/apiClient.d.ts +1 -2
  3. package/dist/apiClient.js +1 -16
  4. package/dist/appUrls.js +4 -0
  5. package/dist/apps/build.d.ts +12 -4
  6. package/dist/apps/build.js +55 -22
  7. package/dist/apps/index.d.ts +2 -1
  8. package/dist/apps/index.js +4 -1
  9. package/dist/apps/loadCheck.d.ts +5 -1
  10. package/dist/apps/loadCheck.js +52 -18
  11. package/dist/apps/serverBuild.d.ts +17 -0
  12. package/dist/apps/serverBuild.js +155 -0
  13. package/dist/apps/staticHtml.d.ts +1 -0
  14. package/dist/apps/staticHtml.js +19 -10
  15. package/dist/apps/upload.d.ts +12 -2
  16. package/dist/apps/upload.js +127 -46
  17. package/dist/catalogue.d.ts +23 -1
  18. package/dist/catalogue.js +126 -100
  19. package/dist/commandContext.d.ts +6 -3
  20. package/dist/commandContext.js +108 -18
  21. package/dist/commands/build.js +0 -7
  22. package/dist/commands/captureListing.d.ts +3 -0
  23. package/dist/commands/captureListing.js +48 -4
  24. package/dist/commands/chat.d.ts +4 -0
  25. package/dist/commands/chat.js +133 -8
  26. package/dist/commands/check.js +34 -1
  27. package/dist/commands/create.js +30 -263
  28. package/dist/commands/dev.js +37 -3
  29. package/dist/commands/devBrowser.js +2 -2
  30. package/dist/commands/devGameServer.d.ts +16 -0
  31. package/dist/commands/devGameServer.js +237 -0
  32. package/dist/commands/devRuntimeAssets.d.ts +1 -0
  33. package/dist/commands/devRuntimeAssets.js +2 -0
  34. package/dist/commands/devServer.d.ts +3 -0
  35. package/dist/commands/devServer.js +111 -5
  36. package/dist/commands/generation.d.ts +33 -4
  37. package/dist/commands/generation.js +304 -115
  38. package/dist/commands/login.js +23 -7
  39. package/dist/commands/review.d.ts +1 -1
  40. package/dist/commands/review.js +68 -95
  41. package/dist/commands/source.d.ts +19 -0
  42. package/dist/commands/source.js +142 -0
  43. package/dist/commands/tweaks.js +5 -11
  44. package/dist/commands/upload-content.d.ts +1 -1
  45. package/dist/commands/upload-content.js +16 -12
  46. package/dist/commands/upload.d.ts +17 -1
  47. package/dist/commands/upload.js +47 -10
  48. package/dist/commands/worker/archive-staging.d.ts +1 -0
  49. package/dist/commands/worker/archive-staging.js +13 -2
  50. package/dist/commands/worker/e2e-fixtures.d.ts +32 -0
  51. package/dist/commands/worker/e2e-fixtures.js +466 -0
  52. package/dist/commands/worker/game-server-infra.d.ts +80 -0
  53. package/dist/commands/worker/game-server-infra.js +595 -0
  54. package/dist/commands/worker/game-source-git.d.ts +126 -0
  55. package/dist/commands/worker/game-source-git.js +782 -0
  56. package/dist/commands/worker/generation.d.ts +94 -0
  57. package/dist/commands/worker/generation.js +1458 -0
  58. package/dist/commands/worker/runtime.d.ts +8 -10
  59. package/dist/commands/worker/runtime.js +51 -45
  60. package/dist/commands/worker.d.ts +79 -19
  61. package/dist/commands/worker.js +1796 -419
  62. package/dist/config.d.ts +2 -0
  63. package/dist/config.js +16 -3
  64. package/dist/environment.d.ts +0 -1
  65. package/dist/environment.js +0 -8
  66. package/dist/index.js +92 -13
  67. package/dist/workerAppProject.d.ts +1 -1
  68. package/dist/workerAppProject.js +15 -2
  69. package/node_modules/@playdrop/api-client/dist/client.d.ts +72 -25
  70. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
  71. package/node_modules/@playdrop/api-client/dist/client.js +33 -0
  72. package/node_modules/@playdrop/api-client/dist/core/request.d.ts +1 -0
  73. package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
  74. package/node_modules/@playdrop/api-client/dist/core/request.js +17 -11
  75. package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +51 -6
  76. package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
  77. package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +338 -41
  78. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +24 -1
  79. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
  80. package/node_modules/@playdrop/api-client/dist/domains/ai.js +20 -0
  81. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +13 -8
  82. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
  83. package/node_modules/@playdrop/api-client/dist/domains/apps.js +158 -90
  84. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -0
  85. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
  86. package/node_modules/@playdrop/api-client/dist/domains/assets.js +27 -0
  87. package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +35 -3
  88. package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
  89. package/node_modules/@playdrop/api-client/dist/domains/chat.js +89 -7
  90. package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -1
  91. package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
  92. package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +9 -0
  93. package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +1 -2
  94. package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
  95. package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +0 -11
  96. package/node_modules/@playdrop/api-client/dist/domains/social.d.ts +29 -0
  97. package/node_modules/@playdrop/api-client/dist/domains/social.d.ts.map +1 -0
  98. package/node_modules/@playdrop/api-client/dist/domains/social.js +79 -0
  99. package/node_modules/@playdrop/api-client/dist/index.d.ts +80 -29
  100. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
  101. package/node_modules/@playdrop/api-client/dist/index.js +217 -56
  102. package/node_modules/@playdrop/api-client/dist/runtime.d.ts +18 -0
  103. package/node_modules/@playdrop/api-client/dist/runtime.d.ts.map +1 -0
  104. package/node_modules/@playdrop/api-client/dist/runtime.js +54 -0
  105. package/node_modules/@playdrop/api-client/package.json +7 -0
  106. package/node_modules/@playdrop/config/client-meta.json +4 -4
  107. package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +11 -0
  108. package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
  109. package/node_modules/@playdrop/config/dist/src/creator-plans.js +13 -1
  110. package/node_modules/@playdrop/config/dist/src/deployment.d.ts +0 -1
  111. package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
  112. package/node_modules/@playdrop/config/dist/src/deployment.js +0 -8
  113. package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +0 -1
  114. package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
  115. package/node_modules/@playdrop/config/dist/src/public-deployment.js +0 -8
  116. package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts +1 -1
  117. package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +2 -2
  118. package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
  119. package/node_modules/@playdrop/config/dist/src/server/logging.js +31 -2
  120. package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +10 -0
  121. package/node_modules/@playdrop/config/dist/test/deployment.test.js +0 -4
  122. package/node_modules/@playdrop/config/dist/test/runtime-service-origins.test.js +2 -0
  123. package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
  124. package/node_modules/@playdrop/config/package.json +6 -0
  125. package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts +9 -0
  126. package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts.map +1 -0
  127. package/node_modules/@playdrop/game-source-git/dist/src/archive.js +107 -0
  128. package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts +29 -0
  129. package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts.map +1 -0
  130. package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.js +64 -0
  131. package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts +8 -0
  132. package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts.map +1 -0
  133. package/node_modules/@playdrop/game-source-git/dist/src/export.js +25 -0
  134. package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts +39 -0
  135. package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts.map +1 -0
  136. package/node_modules/@playdrop/game-source-git/dist/src/git.js +195 -0
  137. package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts +6 -0
  138. package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts.map +1 -0
  139. package/node_modules/@playdrop/game-source-git/dist/src/ignore.js +51 -0
  140. package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts +10 -0
  141. package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts.map +1 -0
  142. package/node_modules/@playdrop/{boxel-core/dist/src/humanoid/r15 → game-source-git/dist/src}/index.js +9 -4
  143. package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts +17 -0
  144. package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts.map +1 -0
  145. package/node_modules/@playdrop/game-source-git/dist/src/lock.js +72 -0
  146. package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts +10 -0
  147. package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts.map +1 -0
  148. package/node_modules/@playdrop/game-source-git/dist/src/materialize.js +99 -0
  149. package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts +24 -0
  150. package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts.map +1 -0
  151. package/node_modules/@playdrop/game-source-git/dist/src/paths.js +207 -0
  152. package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts +66 -0
  153. package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts.map +1 -0
  154. package/node_modules/@playdrop/game-source-git/dist/src/repository.js +213 -0
  155. package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts +2 -0
  156. package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts.map +1 -0
  157. package/node_modules/@playdrop/game-source-git/dist/test/core.test.js +441 -0
  158. package/node_modules/@playdrop/game-source-git/dist/tsconfig.tsbuildinfo +1 -0
  159. package/node_modules/@playdrop/game-source-git/package.json +28 -0
  160. package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +2 -2
  161. package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -1
  162. package/node_modules/@playdrop/types/dist/agent-task-terminal.js +15 -9
  163. package/node_modules/@playdrop/types/dist/api.d.ts +728 -164
  164. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
  165. package/node_modules/@playdrop/types/dist/api.js +60 -11
  166. package/node_modules/@playdrop/types/dist/asset-pack.d.ts +2 -0
  167. package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
  168. package/node_modules/@playdrop/types/dist/asset.d.ts +22 -8
  169. package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
  170. package/node_modules/@playdrop/types/dist/asset.js +26 -26
  171. package/node_modules/@playdrop/types/dist/chat.d.ts +107 -3
  172. package/node_modules/@playdrop/types/dist/chat.d.ts.map +1 -1
  173. package/node_modules/@playdrop/types/dist/chat.js +33 -4
  174. package/node_modules/@playdrop/types/dist/index.d.ts +3 -0
  175. package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
  176. package/node_modules/@playdrop/types/dist/index.js +7 -1
  177. package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts +11 -0
  178. package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts.map +1 -0
  179. package/node_modules/@playdrop/types/dist/public-cache-tags.js +78 -0
  180. package/node_modules/@playdrop/types/dist/realtime.d.ts +3 -15
  181. package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
  182. package/node_modules/@playdrop/types/dist/social.d.ts +64 -0
  183. package/node_modules/@playdrop/types/dist/social.d.ts.map +1 -0
  184. package/node_modules/@playdrop/{boxel-three/dist/src/types.js → types/dist/social.js} +14 -2
  185. package/node_modules/@playdrop/types/dist/spritesheet.d.ts +51 -0
  186. package/node_modules/@playdrop/types/dist/spritesheet.d.ts.map +1 -0
  187. package/node_modules/@playdrop/types/dist/spritesheet.js +73 -0
  188. package/node_modules/@playdrop/types/dist/version.d.ts +86 -58
  189. package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
  190. package/node_modules/@playdrop/types/dist/version.js +111 -0
  191. package/node_modules/@playdrop/types/package.json +14 -0
  192. package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
  193. package/node_modules/@playdrop/vox-three/dist/src/index.js +1 -1
  194. package/node_modules/@playdrop/vox-three/dist/src/index.js.map +1 -1
  195. package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +0 -3
  196. package/node_modules/@playdrop/vox-three/dist/src/vox.js +0 -110
  197. package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
  198. package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +0 -18
  199. package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
  200. package/node_modules/@playdrop/vox-three/package.json +8 -4
  201. package/node_modules/@playwright/mcp/node_modules/fsevents/LICENSE +22 -0
  202. package/node_modules/@playwright/mcp/node_modules/fsevents/README.md +83 -0
  203. package/node_modules/@playwright/mcp/node_modules/fsevents/fsevents.d.ts +46 -0
  204. package/node_modules/@playwright/mcp/node_modules/fsevents/fsevents.js +82 -0
  205. package/node_modules/@playwright/mcp/node_modules/fsevents/fsevents.node +0 -0
  206. package/node_modules/@playwright/mcp/node_modules/fsevents/package.json +62 -0
  207. package/package.json +9 -11
  208. package/dist/assets/model-artifacts.d.ts +0 -8
  209. package/dist/assets/model-artifacts.js +0 -382
  210. package/dist/assets/model-worker.d.ts +0 -22
  211. package/dist/assets/model-worker.js +0 -123
  212. package/node_modules/@playdrop/ai-client/dist/index.d.ts +0 -441
  213. package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +0 -1
  214. package/node_modules/@playdrop/ai-client/dist/index.js +0 -499
  215. package/node_modules/@playdrop/ai-client/package.json +0 -22
  216. package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +0 -13
  217. package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +0 -141
  218. package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +0 -1
  219. package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +0 -47
  220. package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +0 -313
  221. package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +0 -1
  222. package/node_modules/@playdrop/boxel-core/dist/src/format-utils.d.ts +0 -3
  223. package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +0 -36
  224. package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +0 -1
  225. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +0 -23
  226. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js +0 -11
  227. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js.map +0 -1
  228. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +0 -4
  229. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js +0 -21
  230. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js.map +0 -1
  231. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +0 -4
  232. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js +0 -24
  233. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js.map +0 -1
  234. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +0 -3
  235. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.js.map +0 -1
  236. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +0 -3
  237. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +0 -387
  238. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +0 -1
  239. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +0 -6
  240. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js +0 -3
  241. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js.map +0 -1
  242. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +0 -3
  243. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +0 -373
  244. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +0 -1
  245. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +0 -12
  246. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +0 -215
  247. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +0 -1
  248. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +0 -4
  249. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js +0 -18
  250. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +0 -1
  251. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +0 -42
  252. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +0 -145
  253. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +0 -1
  254. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +0 -26
  255. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +0 -65
  256. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js.map +0 -1
  257. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +0 -33
  258. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +0 -175
  259. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +0 -1
  260. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r15.json +0 -1517
  261. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r6.json +0 -61
  262. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +0 -10
  263. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +0 -23
  264. package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js.map +0 -1
  265. package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +0 -19
  266. package/node_modules/@playdrop/boxel-core/dist/src/index.js +0 -36
  267. package/node_modules/@playdrop/boxel-core/dist/src/index.js.map +0 -1
  268. package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +0 -26
  269. package/node_modules/@playdrop/boxel-core/dist/src/materials.js +0 -184
  270. package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +0 -1
  271. package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +0 -68
  272. package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +0 -488
  273. package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +0 -1
  274. package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +0 -4
  275. package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +0 -380
  276. package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +0 -1
  277. package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +0 -29
  278. package/node_modules/@playdrop/boxel-core/dist/src/textures.js +0 -208
  279. package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +0 -1
  280. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +0 -9
  281. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +0 -312
  282. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +0 -1
  283. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +0 -9
  284. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +0 -154
  285. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +0 -1
  286. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +0 -2
  287. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +0 -121
  288. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +0 -1
  289. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +0 -20
  290. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +0 -389
  291. package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +0 -1
  292. package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +0 -3
  293. package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +0 -206
  294. package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +0 -1
  295. package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +0 -12
  296. package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +0 -81
  297. package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +0 -1
  298. package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +0 -12
  299. package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +0 -318
  300. package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +0 -1
  301. package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +0 -168
  302. package/node_modules/@playdrop/boxel-core/dist/src/types.js +0 -3
  303. package/node_modules/@playdrop/boxel-core/dist/src/types.js.map +0 -1
  304. package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +0 -24
  305. package/node_modules/@playdrop/boxel-core/dist/src/validation.js +0 -620
  306. package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +0 -1
  307. package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +0 -11
  308. package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +0 -135
  309. package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +0 -1
  310. package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +0 -23
  311. package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +0 -52
  312. package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +0 -1
  313. package/node_modules/@playdrop/boxel-core/package.json +0 -19
  314. package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +0 -4
  315. package/node_modules/@playdrop/boxel-three/dist/src/animations.js +0 -92
  316. package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +0 -8
  317. package/node_modules/@playdrop/boxel-three/dist/src/builders.js +0 -363
  318. package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +0 -24
  319. package/node_modules/@playdrop/boxel-three/dist/src/context.js +0 -58
  320. package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +0 -100
  321. package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +0 -927
  322. package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +0 -18
  323. package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +0 -294
  324. package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +0 -17
  325. package/node_modules/@playdrop/boxel-three/dist/src/index.js +0 -64
  326. package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +0 -40
  327. package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +0 -96
  328. package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +0 -8
  329. package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +0 -88
  330. package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +0 -7
  331. package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +0 -123
  332. package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +0 -4
  333. package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +0 -48
  334. package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +0 -3
  335. package/node_modules/@playdrop/boxel-three/dist/src/scene.js +0 -168
  336. package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +0 -29
  337. package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +0 -623
  338. package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +0 -13
  339. package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +0 -133
  340. package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +0 -17
  341. package/node_modules/@playdrop/boxel-three/dist/src/textures.js +0 -216
  342. package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +0 -112
  343. package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +0 -28
  344. package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +0 -344
  345. package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +0 -24
  346. package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +0 -113
  347. package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.d.ts +0 -1
  348. package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +0 -137
  349. package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +0 -20
  350. package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +0 -85
  351. package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.d.ts +0 -1
  352. package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +0 -104
  353. package/node_modules/@playdrop/boxel-three/dist/test/index.test.d.ts +0 -1
  354. package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +0 -30
  355. package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.d.ts +0 -1
  356. package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +0 -88
  357. package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.d.ts +0 -1
  358. package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +0 -42
  359. package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.d.ts +0 -1
  360. package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +0 -73
  361. package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.d.ts +0 -1
  362. package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +0 -85
  363. package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.d.ts +0 -1
  364. package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +0 -73
  365. package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.d.ts +0 -1
  366. package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +0 -136
  367. package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.d.ts +0 -1
  368. package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +0 -42
  369. package/node_modules/@playdrop/boxel-three/package.json +0 -28
@@ -1,623 +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 skinned_mesh_exports = {};
19
- __export(skinned_mesh_exports, {
20
- buildEntitySkinnedMesh: () => buildEntitySkinnedMesh
21
- });
22
- module.exports = __toCommonJS(skinned_mesh_exports);
23
- var import_context = require("./context.js");
24
- var import_builders = require("./builders.js");
25
- var import_texture_atlas = require("./texture-atlas.js");
26
- function applyNodeTransforms(THREE, object, node) {
27
- object.position.set(node.position[0], node.position[1], node.position[2]);
28
- if (node.rotation) {
29
- object.rotation.set(THREE.MathUtils.degToRad(node.rotation[0]), THREE.MathUtils.degToRad(node.rotation[1]), THREE.MathUtils.degToRad(node.rotation[2]));
30
- }
31
- if (node.scale) {
32
- object.scale.set(node.scale[0], node.scale[1], node.scale[2]);
33
- }
34
- }
35
- function assignPrimitiveOwner(object, ownerId) {
36
- const stack = [object];
37
- while (stack.length > 0) {
38
- const current = stack.pop();
39
- current.userData = { ...current.userData ?? {}, primitiveOwnerId: ownerId };
40
- current.children.forEach((child) => stack.push(child));
41
- }
42
- }
43
- function buildNodeGraph(context, node, visitedPrimitives = /* @__PURE__ */ new Set()) {
44
- const object = new context.THREE.Object3D();
45
- object.name = node.id;
46
- object.userData = {
47
- ...object.userData ?? {},
48
- nodeId: node.id
49
- };
50
- applyNodeTransforms(context.THREE, 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 primitiveObject = (0, import_builders.createPrimitiveObject)(context, primitive, "centered", visitedPrimitives);
57
- if (primitiveObject) {
58
- if (node.center) {
59
- primitiveObject.position.set(node.center[0], node.center[1], node.center[2]);
60
- }
61
- assignPrimitiveOwner(primitiveObject, node.id);
62
- object.add(primitiveObject);
63
- }
64
- }
65
- } else if (node.size) {
66
- const placeholder = (0, import_builders.createBoundingBoxMesh)(context, node.size);
67
- placeholder.userData = {
68
- ...placeholder.userData ?? {},
69
- primitiveOwnerId: node.id,
70
- size: [...node.size]
71
- };
72
- if (node.center) {
73
- placeholder.position.set(node.center[0], node.center[1], node.center[2]);
74
- }
75
- object.add(placeholder);
76
- }
77
- node.children.forEach((child) => {
78
- const childGraph = buildNodeGraph(context, child, new Set(visitedPrimitives));
79
- object.add(childGraph.object);
80
- childGraph.nodes.forEach((childObject, childId) => nodes.set(childId, childObject));
81
- });
82
- return { object, nodes };
83
- }
84
- function buildBoneHierarchy(THREE, node, parentBone, bones, boneMap, boneIndexMap) {
85
- const bone = new THREE.Bone();
86
- bone.name = node.id;
87
- bone.position.set(node.position[0], node.position[1], node.position[2]);
88
- if (node.rotation) {
89
- bone.rotation.set(THREE.MathUtils.degToRad(node.rotation[0]), THREE.MathUtils.degToRad(node.rotation[1]), THREE.MathUtils.degToRad(node.rotation[2]));
90
- }
91
- if (node.scale) {
92
- bone.scale.set(node.scale[0], node.scale[1], node.scale[2]);
93
- }
94
- if (parentBone) {
95
- parentBone.add(bone);
96
- }
97
- bones.push(bone);
98
- boneMap.set(node.id, bone);
99
- boneIndexMap.set(node.id, bones.length - 1);
100
- node.children.forEach((child) => {
101
- buildBoneHierarchy(THREE, child, bone, bones, boneMap, boneIndexMap);
102
- });
103
- }
104
- function materialToColor(THREE, material) {
105
- if ("color" in material && material.color instanceof THREE.Color) {
106
- return material.color.clone();
107
- }
108
- return new THREE.Color(0.5, 0.5, 0.5);
109
- }
110
- const CONNECT_FALLOFF_RATIO = 0.35;
111
- const CONNECT_MIN_RADIUS = 0.25;
112
- const CONNECT_SIGMA_MULTIPLIER = 0.55;
113
- const CONNECT_WEIGHT_EPSILON = 1e-4;
114
- function buildEntitySkinnedMesh(options) {
115
- const { THREE, entity } = options;
116
- const warnings = [];
117
- const builderContext = (0, import_context.createBuilderContext)({
118
- THREE,
119
- settings: { enableShadows: false }
120
- });
121
- (0, import_context.updateBuilderContext)(builderContext, { entity });
122
- const { object: nodeRootObject, nodes: nodeObjects } = buildNodeGraph(builderContext, entity.geometry.root);
123
- nodeRootObject.updateMatrixWorld(true);
124
- const nodeDefs = /* @__PURE__ */ new Map();
125
- const parentMap = /* @__PURE__ */ new Map();
126
- (function collect(node, parentId) {
127
- nodeDefs.set(node.id, node);
128
- parentMap.set(node.id, parentId);
129
- node.children.forEach((child) => collect(child, node.id));
130
- })(entity.geometry.root, null);
131
- const bones = [];
132
- const boneMap = /* @__PURE__ */ new Map();
133
- const boneIndexMap = /* @__PURE__ */ new Map();
134
- buildBoneHierarchy(THREE, entity.geometry.root, null, bones, boneMap, boneIndexMap);
135
- if (bones.length === 0) {
136
- throw new Error("entity_skinned_mesh_no_bones");
137
- }
138
- bones[0].updateMatrixWorld(true);
139
- const boneInverses = bones.map((bone) => bone.matrixWorld.clone().invert());
140
- const positions = [];
141
- const normals = [];
142
- const colors = [];
143
- const uvs = [];
144
- const skinIndices = [];
145
- const skinWeights = [];
146
- const blendStrengths = [];
147
- const tempColor = new THREE.Color(0.5, 0.5, 0.5);
148
- const tempWorldPos = new THREE.Vector3();
149
- const tempLocalPos = new THREE.Vector3();
150
- const computeSignedDistanceToBounds = (point, halfExtents) => {
151
- const dx = Math.abs(point.x) - halfExtents.x;
152
- const dy = Math.abs(point.y) - halfExtents.y;
153
- const dz = Math.abs(point.z) - halfExtents.z;
154
- const outsideX = Math.max(dx, 0);
155
- const outsideY = Math.max(dy, 0);
156
- const outsideZ = Math.max(dz, 0);
157
- const outsideDist = Math.sqrt(outsideX * outsideX + outsideY * outsideY + outsideZ * outsideZ);
158
- if (dx <= 0 && dy <= 0 && dz <= 0) {
159
- const insideX = halfExtents.x - Math.abs(point.x);
160
- const insideY = halfExtents.y - Math.abs(point.y);
161
- const insideZ = halfExtents.z - Math.abs(point.z);
162
- const minInside = Math.min(insideX, insideY, insideZ);
163
- return -minInside;
164
- }
165
- return outsideDist;
166
- };
167
- const evaluateInfluence = (bounds, worldPosition, scratch) => {
168
- scratch.copy(worldPosition).applyMatrix4(bounds.inverseMatrix).sub(bounds.center);
169
- const distance = computeSignedDistanceToBounds(scratch, bounds.halfExtents);
170
- if (distance <= 0) {
171
- return { inside: true, falloff: 1 };
172
- }
173
- const largestAxis = Math.max(bounds.halfExtents.x, bounds.halfExtents.y, bounds.halfExtents.z);
174
- const radius = Math.max(CONNECT_MIN_RADIUS, largestAxis * CONNECT_FALLOFF_RATIO);
175
- if (distance >= radius) {
176
- return { inside: false, falloff: 0 };
177
- }
178
- const sigma = radius * CONNECT_SIGMA_MULTIPLIER;
179
- const ratio = distance / sigma;
180
- return { inside: false, falloff: Math.exp(-(ratio * ratio)) };
181
- };
182
- const connectConfigs = /* @__PURE__ */ new Map();
183
- const parentBlendLookup = /* @__PURE__ */ new Map();
184
- const deriveBoundsFromObject = (object) => {
185
- const cache = object.userData?.__connectBounds;
186
- if (cache) {
187
- return cache;
188
- }
189
- const bounds = new THREE.Box3().setFromObject(object);
190
- if (!bounds || !Number.isFinite(bounds.min.x) || bounds.isEmpty()) {
191
- return null;
192
- }
193
- const inverse = object.matrixWorld.clone().invert();
194
- bounds.applyMatrix4(inverse);
195
- const sizeVec = new THREE.Vector3();
196
- const centerVec = new THREE.Vector3();
197
- bounds.getSize(sizeVec);
198
- bounds.getCenter(centerVec);
199
- const size = [sizeVec.x, sizeVec.y, sizeVec.z];
200
- const center = [centerVec.x, centerVec.y, centerVec.z];
201
- object.userData = {
202
- ...object.userData ?? {},
203
- __connectBounds: { size, center }
204
- };
205
- return { size, center };
206
- };
207
- const createBounds = (nodeDef, object) => {
208
- if (!object) {
209
- return null;
210
- }
211
- const sizeSource = nodeDef?.size ?? object.userData?.size ?? deriveBoundsFromObject(object)?.size;
212
- if (!sizeSource) {
213
- return null;
214
- }
215
- const derived = !nodeDef?.center ? deriveBoundsFromObject(object) : null;
216
- const centerSource = nodeDef?.center ?? object.userData?.center ?? derived?.center ?? [0, 0, 0];
217
- return {
218
- inverseMatrix: object.matrixWorld.clone().invert(),
219
- center: new THREE.Vector3(centerSource[0], centerSource[1], centerSource[2]),
220
- halfExtents: new THREE.Vector3(sizeSource[0] / 2, sizeSource[1] / 2, sizeSource[2] / 2)
221
- };
222
- };
223
- nodeDefs.forEach((node, nodeId) => {
224
- const mode = node.connect ?? "none";
225
- if (mode === "none") {
226
- return;
227
- }
228
- const parentId = parentMap.get(nodeId);
229
- if (!parentId) {
230
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (no parent)`);
231
- return;
232
- }
233
- const parentBoneIndex = boneIndexMap.get(parentId);
234
- if (parentBoneIndex === void 0) {
235
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (missing parent bone)`);
236
- return;
237
- }
238
- const childBoneIndex = boneIndexMap.get(nodeId);
239
- if (childBoneIndex === void 0) {
240
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (missing child bone)`);
241
- return;
242
- }
243
- const parentObject = nodeObjects.get(parentId);
244
- if (!parentObject) {
245
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (missing parent object)`);
246
- return;
247
- }
248
- const childObject = nodeObjects.get(nodeId);
249
- if (!childObject) {
250
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (missing child object)`);
251
- return;
252
- }
253
- const parentDef = nodeDefs.get(parentId);
254
- let childBlend;
255
- if (mode === "child" || mode === "both") {
256
- childBlend = createBounds(parentDef, parentObject) ?? void 0;
257
- if (!childBlend) {
258
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (parent ${parentId} missing size)`);
259
- }
260
- }
261
- let parentBlend;
262
- if (mode === "parent" || mode === "both") {
263
- parentBlend = createBounds(node, childObject) ?? void 0;
264
- if (!parentBlend) {
265
- warnings.push(`[skinned] node ${nodeId} connect ${mode} ignored (child ${nodeId} missing size)`);
266
- }
267
- }
268
- if (!childBlend && !parentBlend) {
269
- return;
270
- }
271
- const config = {
272
- mode,
273
- childId: nodeId,
274
- parentId,
275
- parentBoneIndex,
276
- childBoneIndex,
277
- childBlend,
278
- parentBlend,
279
- stats: { childVertices: 0, parentVertices: 0 }
280
- };
281
- connectConfigs.set(nodeId, config);
282
- if (config.parentBlend) {
283
- const existing = parentBlendLookup.get(parentId);
284
- if (existing) {
285
- existing.push(config);
286
- } else {
287
- parentBlendLookup.set(parentId, [config]);
288
- }
289
- }
290
- });
291
- const colorTextures = [];
292
- const textureSet = /* @__PURE__ */ new Set();
293
- const emissivePairs = /* @__PURE__ */ new Map();
294
- let needsAlphaTest = false;
295
- let needsDoubleSide = false;
296
- nodeObjects.forEach((nodeObject) => {
297
- nodeObject.traverse((child) => {
298
- if (!child.isMesh) {
299
- return;
300
- }
301
- const mesh2 = child;
302
- if (!mesh2.geometry) {
303
- return;
304
- }
305
- const material2 = mesh2.material;
306
- const materials = Array.isArray(material2) ? material2 : [material2];
307
- materials.forEach((entry) => {
308
- const std = entry;
309
- if (std.map instanceof THREE.DataTexture && std.map.image?.width && std.map.image?.height) {
310
- if (!textureSet.has(std.map.uuid)) {
311
- textureSet.add(std.map.uuid);
312
- colorTextures.push(std.map);
313
- }
314
- }
315
- if (std.map instanceof THREE.DataTexture && std.emissiveMap instanceof THREE.DataTexture) {
316
- emissivePairs.set(std.map, std.emissiveMap);
317
- }
318
- if (std.alphaTest > 0) {
319
- needsAlphaTest = true;
320
- }
321
- if (std.side === THREE.DoubleSide) {
322
- needsDoubleSide = true;
323
- }
324
- });
325
- });
326
- });
327
- const colorAtlas = (0, import_texture_atlas.buildTextureAtlas)(THREE, colorTextures);
328
- const transformLookup = colorAtlas?.transforms ?? null;
329
- const emissiveAtlas = colorAtlas ? (0, import_texture_atlas.buildEmissiveAtlas)(THREE, colorAtlas.width, colorAtlas.height, colorAtlas.transforms, emissivePairs) : null;
330
- const processPrimitiveObject = (object, ownerId) => {
331
- object.traverse((child) => {
332
- if (!child.isMesh) {
333
- return;
334
- }
335
- const mesh2 = child;
336
- if (!mesh2.geometry) {
337
- return;
338
- }
339
- const material2 = mesh2.material;
340
- const boneIndex = boneIndexMap.get(ownerId);
341
- if (boneIndex === void 0) {
342
- warnings.push(`No bone mapping found for node "${ownerId}".`);
343
- return;
344
- }
345
- const geometry2 = mesh2.geometry.clone();
346
- geometry2.applyMatrix4(mesh2.matrixWorld);
347
- const nonIndexed = geometry2.toNonIndexed();
348
- if (!nonIndexed.getAttribute("normal")) {
349
- nonIndexed.computeVertexNormals();
350
- }
351
- const positionAttr = nonIndexed.getAttribute("position");
352
- const normalAttr = nonIndexed.getAttribute("normal");
353
- const uvAttr = nonIndexed.getAttribute("uv");
354
- if (!positionAttr) {
355
- warnings.push(`Primitive "${ownerId}" produced geometry without positions.`);
356
- geometry2.dispose();
357
- nonIndexed.dispose();
358
- return;
359
- }
360
- const vertexCount = positionAttr.count;
361
- const materialArray = Array.isArray(material2) ? material2 : [material2];
362
- const materialIndexPerVertex = new Array(vertexCount).fill(0);
363
- const groups = nonIndexed.groups && nonIndexed.groups.length > 0 ? nonIndexed.groups : [{ start: 0, count: vertexCount, materialIndex: 0 }];
364
- groups.forEach((group) => {
365
- const start = Math.max(0, group.start);
366
- const end = Math.min(vertexCount, start + group.count);
367
- const materialIndex = group.materialIndex ?? 0;
368
- for (let i = start; i < end; i += 1) {
369
- materialIndexPerVertex[i] = Math.min(materialArray.length - 1, Math.max(0, materialIndex));
370
- }
371
- });
372
- const worldPos = tempWorldPos;
373
- const localPos = tempLocalPos;
374
- const hasUv = Boolean(uvAttr);
375
- const ownerConnect = connectConfigs.get(ownerId);
376
- const parentBlendEntries = parentBlendLookup.get(ownerId)?.filter((entry) => entry.parentBlend) ?? [];
377
- for (let i = 0; i < vertexCount; i += 1) {
378
- const px = positionAttr.getX(i);
379
- const py = positionAttr.getY(i);
380
- const pz = positionAttr.getZ(i);
381
- positions.push(px, py, pz);
382
- if (normalAttr) {
383
- normals.push(normalAttr.getX(i), normalAttr.getY(i), normalAttr.getZ(i));
384
- } else {
385
- normals.push(0, 1, 0);
386
- }
387
- worldPos.set(px, py, pz);
388
- const weights = /* @__PURE__ */ new Map();
389
- const setWeight = (index, weight) => {
390
- if (weight <= CONNECT_WEIGHT_EPSILON) {
391
- weights.delete(index);
392
- } else {
393
- weights.set(index, weight);
394
- }
395
- };
396
- setWeight(boneIndex, 1);
397
- if (ownerConnect?.childBlend) {
398
- const evaluation = evaluateInfluence(ownerConnect.childBlend, worldPos, localPos);
399
- if (ownerConnect.mode === "child") {
400
- if (evaluation.inside) {
401
- setWeight(boneIndex, 0);
402
- setWeight(ownerConnect.parentBoneIndex, 1);
403
- ownerConnect.stats.childVertices += 1;
404
- } else if (evaluation.falloff > CONNECT_WEIGHT_EPSILON) {
405
- const parentWeight = evaluation.falloff;
406
- setWeight(ownerConnect.parentBoneIndex, parentWeight);
407
- setWeight(boneIndex, Math.max(0, 1 - parentWeight));
408
- ownerConnect.stats.childVertices += 1;
409
- }
410
- } else if (ownerConnect.mode === "both") {
411
- if (evaluation.inside) {
412
- setWeight(boneIndex, 0.5);
413
- setWeight(ownerConnect.parentBoneIndex, 0.5);
414
- ownerConnect.stats.childVertices += 1;
415
- } else if (evaluation.falloff > CONNECT_WEIGHT_EPSILON) {
416
- const parentWeight = Math.min(0.5, evaluation.falloff * 0.5);
417
- if (parentWeight > CONNECT_WEIGHT_EPSILON) {
418
- setWeight(ownerConnect.parentBoneIndex, parentWeight);
419
- setWeight(boneIndex, Math.max(0, 1 - parentWeight));
420
- ownerConnect.stats.childVertices += 1;
421
- }
422
- }
423
- }
424
- }
425
- if (parentBlendEntries.length > 0) {
426
- parentBlendEntries.forEach((config) => {
427
- const bounds = config.parentBlend;
428
- if (!bounds)
429
- return;
430
- const evaluation = evaluateInfluence(bounds, worldPos, localPos);
431
- if (config.mode === "parent") {
432
- if (evaluation.inside) {
433
- setWeight(boneIndex, 0);
434
- setWeight(config.childBoneIndex, 1);
435
- config.stats.parentVertices += 1;
436
- } else if (evaluation.falloff > CONNECT_WEIGHT_EPSILON) {
437
- const childWeight = evaluation.falloff;
438
- setWeight(config.childBoneIndex, childWeight);
439
- setWeight(boneIndex, Math.max(0, 1 - childWeight));
440
- config.stats.parentVertices += 1;
441
- }
442
- } else if (config.mode === "both") {
443
- if (evaluation.inside) {
444
- setWeight(boneIndex, 0.5);
445
- setWeight(config.childBoneIndex, 0.5);
446
- config.stats.parentVertices += 1;
447
- } else if (evaluation.falloff > CONNECT_WEIGHT_EPSILON) {
448
- const childWeight = Math.min(0.5, evaluation.falloff * 0.5);
449
- if (childWeight > CONNECT_WEIGHT_EPSILON) {
450
- setWeight(config.childBoneIndex, childWeight);
451
- setWeight(boneIndex, Math.max(0, 1 - childWeight));
452
- config.stats.parentVertices += 1;
453
- }
454
- }
455
- }
456
- });
457
- }
458
- let filtered = Array.from(weights.entries()).filter(([, value]) => value > CONNECT_WEIGHT_EPSILON);
459
- if (filtered.length === 0) {
460
- filtered = [[boneIndex, 1]];
461
- }
462
- const totalWeight = filtered.reduce((sum, [, value]) => sum + value, 0);
463
- if (totalWeight > 0) {
464
- const invTotal = 1 / totalWeight;
465
- filtered = filtered.map(([index, value]) => [index, value * invTotal]);
466
- } else {
467
- filtered = [[boneIndex, 1]];
468
- }
469
- filtered.sort((a, b) => b[1] - a[1]);
470
- const maxBlend = filtered.reduce((acc, [index, value]) => {
471
- if (index === boneIndex) {
472
- return acc;
473
- }
474
- return Math.max(acc, value);
475
- }, 0);
476
- blendStrengths.push(maxBlend);
477
- for (let slot = 0; slot < 4; slot += 1) {
478
- const influence = filtered[slot];
479
- if (influence) {
480
- skinIndices.push(influence[0]);
481
- skinWeights.push(influence[1]);
482
- } else {
483
- skinIndices.push(0);
484
- skinWeights.push(0);
485
- }
486
- }
487
- const materialIndex = materialIndexPerVertex[i];
488
- const mat = materialArray[materialIndex];
489
- const mapTexture = mat?.map;
490
- const transform = mapTexture && transformLookup ? transformLookup.get(mapTexture) : void 0;
491
- if (hasUv) {
492
- if (transform) {
493
- const u = uvAttr.getX(i) * transform.scale[0] + transform.offset[0];
494
- const v = uvAttr.getY(i) * transform.scale[1] + transform.offset[1];
495
- uvs.push(u, v);
496
- } else {
497
- uvs.push(uvAttr.getX(i), uvAttr.getY(i));
498
- }
499
- }
500
- if (transform) {
501
- colors.push(1, 1, 1);
502
- } else if (mat) {
503
- tempColor.copy(materialToColor(THREE, mat));
504
- colors.push(tempColor.r, tempColor.g, tempColor.b);
505
- } else {
506
- colors.push(0.5, 0.5, 0.5);
507
- }
508
- }
509
- geometry2.dispose();
510
- nonIndexed.dispose();
511
- });
512
- };
513
- const traverseNode = (node) => {
514
- const object = nodeObjects.get(node.id);
515
- if (object) {
516
- object.children.forEach((child) => {
517
- if (child.userData?.primitiveOwnerId === node.id) {
518
- processPrimitiveObject(child, node.id);
519
- }
520
- });
521
- }
522
- node.children.forEach(traverseNode);
523
- };
524
- traverseNode(entity.geometry.root);
525
- if (positions.length === 0) {
526
- throw new Error("entity_skinned_mesh_empty_geometry");
527
- }
528
- const geometry = new THREE.BufferGeometry();
529
- geometry.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3));
530
- geometry.setAttribute("normal", new THREE.Float32BufferAttribute(normals, 3));
531
- geometry.setAttribute("color", new THREE.Float32BufferAttribute(colors, 3));
532
- if (uvs.length > 0) {
533
- geometry.setAttribute("uv", new THREE.Float32BufferAttribute(uvs, 2));
534
- }
535
- geometry.setAttribute("skinIndex", new THREE.Uint16BufferAttribute(skinIndices, 4));
536
- geometry.setAttribute("skinWeight", new THREE.Float32BufferAttribute(skinWeights, 4));
537
- geometry.setAttribute("connectStrength", new THREE.Float32BufferAttribute(blendStrengths, 1));
538
- geometry.computeBoundingBox();
539
- geometry.computeBoundingSphere();
540
- const material = new THREE.MeshStandardMaterial({
541
- vertexColors: !colorAtlas,
542
- metalness: 0,
543
- roughness: 1
544
- });
545
- material.skinning = true;
546
- if (colorAtlas) {
547
- material.map = colorAtlas.texture;
548
- }
549
- if (emissiveAtlas) {
550
- material.emissiveMap = emissiveAtlas;
551
- material.emissive.setRGB(1, 1, 1);
552
- material.emissiveIntensity = 1;
553
- }
554
- if (needsAlphaTest) {
555
- material.alphaTest = 0.5;
556
- material.transparent = false;
557
- material.side = THREE.DoubleSide;
558
- } else if (needsDoubleSide) {
559
- material.side = THREE.DoubleSide;
560
- }
561
- const connectOverlayUniform = { value: 0 };
562
- material.onBeforeCompile = (shader) => {
563
- shader.uniforms.uConnectOverlay = connectOverlayUniform;
564
- shader.vertexShader = shader.vertexShader.replace("#include <common>", "#include <common>\nattribute float connectStrength;\nvarying float vConnectStrength;").replace("#include <begin_vertex>", "#include <begin_vertex>\n vConnectStrength = connectStrength;");
565
- shader.fragmentShader = shader.fragmentShader.replace("#include <common>", "#include <common>\nuniform float uConnectOverlay;\nvarying float vConnectStrength;").replace("#include <output_fragment>", `#include <output_fragment>
566
- if (uConnectOverlay > 0.0) {
567
- float overlayStrength = clamp(vConnectStrength, 0.0, 1.0);
568
- vec3 overlayColor = mix(vec3(0.0, 0.2, 1.0), vec3(1.0, 0.0, 0.0), overlayStrength);
569
- gl_FragColor.rgb = overlayColor;
570
- }`);
571
- };
572
- material.userData.connectOverlayUniform = connectOverlayUniform;
573
- material.needsUpdate = true;
574
- const mesh = new THREE.SkinnedMesh(geometry, material);
575
- mesh.name = `${entity.id ?? "entity"}__skinned`;
576
- const skeleton = new THREE.Skeleton(bones, boneInverses);
577
- mesh.add(bones[0]);
578
- mesh.bind(skeleton);
579
- mesh.normalizeSkinWeights();
580
- let weldedVertices = 0;
581
- const weldedByNode = {};
582
- const connectBreakdown = {};
583
- connectConfigs.forEach((config, nodeId) => {
584
- const total = config.stats.childVertices + config.stats.parentVertices;
585
- if (total > 0) {
586
- weldedVertices += total;
587
- weldedByNode[nodeId] = total;
588
- connectBreakdown[nodeId] = {
589
- childVertices: config.stats.childVertices,
590
- parentVertices: config.stats.parentVertices
591
- };
592
- }
593
- });
594
- const dispose = () => {
595
- mesh.geometry.dispose();
596
- const mat = mesh.material;
597
- if (Array.isArray(mat)) {
598
- mat.forEach((entry) => entry.dispose?.());
599
- } else {
600
- mat.dispose?.();
601
- }
602
- };
603
- return {
604
- mesh,
605
- bones,
606
- skeleton,
607
- boneMap,
608
- stats: {
609
- vertices: positions.length / 3,
610
- triangles: positions.length / 9,
611
- weldedVertices,
612
- weldedByNode,
613
- connectBreakdown,
614
- atlas: colorAtlas ? { width: colorAtlas.width, height: colorAtlas.height } : null
615
- },
616
- warnings,
617
- dispose
618
- };
619
- }
620
- // Annotate the CommonJS export names for ESM import in node:
621
- 0 && (module.exports = {
622
- buildEntitySkinnedMesh
623
- });
@@ -1,13 +0,0 @@
1
- import type * as THREEType from "three";
2
- export type AtlasTransform = {
3
- offset: [number, number];
4
- scale: [number, number];
5
- };
6
- export interface TextureAtlasResult {
7
- texture: THREEType.DataTexture;
8
- transforms: Map<THREEType.DataTexture, AtlasTransform>;
9
- width: number;
10
- height: number;
11
- }
12
- export declare function buildTextureAtlas(THREE: typeof THREEType, textures: readonly THREEType.DataTexture[]): TextureAtlasResult | null;
13
- export declare function buildEmissiveAtlas(THREE: typeof THREEType, width: number, height: number, transforms: Map<THREEType.DataTexture, AtlasTransform>, pairs: Map<THREEType.DataTexture, THREEType.DataTexture>): THREEType.DataTexture | null;