@holoscript/core 7.0.0 → 8.0.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 (350) hide show
  1. package/README.md +4 -4
  2. package/bin/holoscript.cjs +3 -0
  3. package/dist/GLTFPipeline-N6B6PJ6G.cjs +38 -0
  4. package/dist/GLTFPipeline-P3WMNYCN.js +17 -0
  5. package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
  6. package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
  7. package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
  8. package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
  9. package/dist/HoloScriptRuntime-CBYJX3LZ.js +10 -0
  10. package/dist/HoloScriptRuntime-VJ374RER.cjs +19 -0
  11. package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
  12. package/dist/USDZExporter-D2HQLQYK.js +1035 -0
  13. package/dist/agents/index.cjs +19 -0
  14. package/dist/agents/index.d.ts +100 -0
  15. package/dist/agents/index.js +17 -0
  16. package/dist/chunk-2BSMSUCE.js +1941 -0
  17. package/dist/chunk-2IWC4FP7.cjs +1189 -0
  18. package/dist/chunk-2M2DPHKB.js +762 -0
  19. package/dist/chunk-2X7NGX3M.js +2426 -0
  20. package/dist/chunk-2YSNA2F2.cjs +1274 -0
  21. package/dist/chunk-3FOKASKO.cjs +348 -0
  22. package/dist/chunk-3WZEJHUQ.cjs +116 -0
  23. package/dist/chunk-4C57PR42.js +468 -0
  24. package/dist/chunk-4GU5GCIY.js +1384 -0
  25. package/dist/chunk-4N4SXXWF.js +769 -0
  26. package/dist/chunk-4PDEPEQW.cjs +41 -0
  27. package/dist/chunk-4R6SBXDB.js +45 -0
  28. package/dist/chunk-4SDKXQ4C.js +811 -0
  29. package/dist/chunk-4V2E7U7Q.cjs +2015 -0
  30. package/dist/chunk-5FSKKMR7.cjs +2092 -0
  31. package/dist/chunk-5GLCTO44.js +161 -0
  32. package/dist/chunk-5H2G27PK.cjs +627 -0
  33. package/dist/chunk-5JEU52DW.js +382 -0
  34. package/dist/chunk-5NWINHR5.cjs +689 -0
  35. package/dist/chunk-5S7RKFGR.cjs +446 -0
  36. package/dist/chunk-5WUNN6ZN.cjs +428 -0
  37. package/dist/chunk-6CTRH7HT.cjs +1985 -0
  38. package/dist/chunk-6EX3I5P4.cjs +130 -0
  39. package/dist/chunk-6Q7RC2MK.cjs +1418 -0
  40. package/dist/chunk-7H33U5SM.cjs +413 -0
  41. package/dist/chunk-7M3PNU2M.cjs +672 -0
  42. package/dist/chunk-7T25IEZ2.js +449 -0
  43. package/dist/chunk-7V4JI5TB.cjs +6947 -0
  44. package/dist/chunk-A6KINLZJ.js +236 -0
  45. package/dist/chunk-ADADVMXY.js +404 -0
  46. package/dist/chunk-AIA52I7T.cjs +543 -0
  47. package/dist/chunk-ALC6K7GL.cjs +4402 -0
  48. package/dist/chunk-ANXZFVY2.js +113 -0
  49. package/dist/chunk-AOVGZ25K.cjs +56583 -0
  50. package/dist/chunk-AVJHHUC5.cjs +718 -0
  51. package/dist/chunk-BGY3SDG3.js +4396 -0
  52. package/dist/chunk-BOVPWH4H.js +3857 -0
  53. package/dist/chunk-BRQJKJGT.cjs +20 -0
  54. package/dist/chunk-C37BHB7N.cjs +636 -0
  55. package/dist/chunk-CBJY23VL.js +126 -0
  56. package/dist/chunk-CCATWPXM.js +778 -0
  57. package/dist/chunk-CIWWXYHZ.cjs +50 -0
  58. package/dist/chunk-CMT5NMMS.js +669 -0
  59. package/dist/chunk-CR4FMIWL.cjs +1049 -0
  60. package/dist/chunk-CR7XRXRN.cjs +639 -0
  61. package/dist/chunk-CSD27UNQ.js +2176 -0
  62. package/dist/chunk-D3STJ56J.js +714 -0
  63. package/dist/chunk-DAJXW4KX.js +725 -0
  64. package/dist/chunk-DHO2YRIM.js +756 -0
  65. package/dist/chunk-DTGBOSEM.cjs +319 -0
  66. package/dist/chunk-E6XXE66V.js +2252 -0
  67. package/dist/chunk-E7JP3BS3.cjs +61 -0
  68. package/dist/chunk-EKBKLK7P.js +1169 -0
  69. package/dist/chunk-EKYL4PE3.cjs +404 -0
  70. package/dist/chunk-EXKSFGSX.cjs +274 -0
  71. package/dist/chunk-EXUP2BUM.cjs +1173 -0
  72. package/dist/chunk-FDSGHPAK.js +130 -0
  73. package/dist/chunk-FEWUHQNM.cjs +144 -0
  74. package/dist/chunk-FFAOS5HQ.js +70 -0
  75. package/dist/chunk-FGGJQRLZ.js +270 -0
  76. package/dist/chunk-FHP6LXJS.js +415 -0
  77. package/dist/chunk-FJPADH77.cjs +666 -0
  78. package/dist/chunk-FL33V6U7.js +421 -0
  79. package/dist/chunk-FYSPZT4V.cjs +169 -0
  80. package/dist/chunk-GIOYPNTH.js +5575 -0
  81. package/dist/chunk-GJNCFRJU.cjs +125 -0
  82. package/dist/chunk-GMP623FG.cjs +1508 -0
  83. package/dist/chunk-GQHQOPXZ.cjs +5580 -0
  84. package/dist/chunk-GTU2Z2WW.cjs +262 -0
  85. package/dist/chunk-GYZE55MO.js +2007 -0
  86. package/dist/chunk-GZG4KA4E.js +529 -0
  87. package/dist/chunk-H652NHX5.js +600 -0
  88. package/dist/chunk-HCCQLAA4.cjs +74 -0
  89. package/dist/chunk-HKEXJUWS.cjs +4007 -0
  90. package/dist/chunk-HNDK4IQU.cjs +5737 -0
  91. package/dist/chunk-HR2OSYVQ.js +56165 -0
  92. package/dist/chunk-HYNTS5CP.js +422 -0
  93. package/dist/chunk-I6XZ5DZF.cjs +488 -0
  94. package/dist/chunk-ILRBGFVD.cjs +72 -0
  95. package/dist/chunk-IUDGEUDO.cjs +1409 -0
  96. package/dist/chunk-IUTY5WQ2.cjs +424 -0
  97. package/dist/chunk-IVY74O6C.js +247 -0
  98. package/dist/chunk-IWC5DM2M.cjs +611 -0
  99. package/dist/chunk-J32ZJZJH.js +554 -0
  100. package/dist/chunk-J52VSAQ7.js +6884 -0
  101. package/dist/chunk-J6M4FPK5.js +421 -0
  102. package/dist/chunk-J7XZV333.js +844 -0
  103. package/dist/chunk-JBNDTXXV.cjs +2433 -0
  104. package/dist/chunk-JC5YBPSF.cjs +984 -0
  105. package/dist/chunk-JD7CIZ33.js +1949 -0
  106. package/dist/chunk-JIBL5LRK.js +4287 -0
  107. package/dist/chunk-JIYN45TV.cjs +2525 -0
  108. package/dist/chunk-K574J76X.cjs +457 -0
  109. package/dist/chunk-KHDZJE5D.cjs +2196 -0
  110. package/dist/chunk-KKFZ3B6J.cjs +557 -0
  111. package/dist/chunk-KKP7JKN4.cjs +6002 -0
  112. package/dist/chunk-KPJL34Y7.cjs +186 -0
  113. package/dist/chunk-KQCN6AKJ.cjs +3042 -0
  114. package/dist/chunk-L5LKKENW.cjs +424 -0
  115. package/dist/chunk-LHAXPADA.js +882 -0
  116. package/dist/chunk-LM2VU56C.cjs +37 -0
  117. package/dist/chunk-M56JSP4A.js +400 -0
  118. package/dist/chunk-MBOOR7X4.js +18 -0
  119. package/dist/chunk-MQWAT42R.cjs +4310 -0
  120. package/dist/chunk-MXFUTKCO.js +56 -0
  121. package/dist/chunk-MYY4PMWX.cjs +264 -0
  122. package/dist/chunk-N75IH2HY.js +258 -0
  123. package/dist/chunk-NCWCUZNS.cjs +72 -0
  124. package/dist/chunk-NG77ATEW.cjs +778 -0
  125. package/dist/chunk-NW5G5FBQ.js +215 -0
  126. package/dist/chunk-OBIYPYYS.cjs +1993 -0
  127. package/dist/chunk-OH2FAIVU.js +608 -0
  128. package/dist/chunk-OIQYIIO3.cjs +473 -0
  129. package/dist/chunk-OL46QLBJ.js +61 -0
  130. package/dist/chunk-OMXII44L.js +5386 -0
  131. package/dist/chunk-OSYNRVOV.cjs +243 -0
  132. package/dist/chunk-PGANYCAG.cjs +220 -0
  133. package/dist/chunk-PHENW4MQ.js +65 -0
  134. package/dist/chunk-PY37LNDP.js +686 -0
  135. package/dist/chunk-Q56TT7IL.js +483 -0
  136. package/dist/chunk-QD32ADK6.js +1046 -0
  137. package/dist/chunk-QPOQ7VPI.js +1491 -0
  138. package/dist/chunk-QPSKHBJP.js +5963 -0
  139. package/dist/chunk-QXH7QDSZ.js +1989 -0
  140. package/dist/chunk-R24NNAEG.js +1399 -0
  141. package/dist/chunk-R75BSDH7.cjs +50 -0
  142. package/dist/chunk-RARB3MBR.js +207 -0
  143. package/dist/chunk-ROHLEP2W.cjs +847 -0
  144. package/dist/chunk-S3MDHNKB.cjs +490 -0
  145. package/dist/chunk-S6YWHCKV.cjs +410 -0
  146. package/dist/chunk-SIEXCILW.js +229 -0
  147. package/dist/chunk-SLU6UPJI.cjs +410 -0
  148. package/dist/chunk-SMIWS6DE.cjs +212 -0
  149. package/dist/chunk-T5J7ZKP3.cjs +4885 -0
  150. package/dist/chunk-TDCNJHWO.js +341 -0
  151. package/dist/chunk-TG7O4WBC.js +406 -0
  152. package/dist/chunk-THCK6ECW.js +2085 -0
  153. package/dist/chunk-TJHVSBP2.js +439 -0
  154. package/dist/chunk-TVHSPJ4N.cjs +606 -0
  155. package/dist/chunk-TWUXUCEW.cjs +781 -0
  156. package/dist/chunk-U44IKGG7.cjs +5390 -0
  157. package/dist/chunk-UFZZ7TSN.cjs +886 -0
  158. package/dist/chunk-UJXISJBN.js +487 -0
  159. package/dist/chunk-UOIGFQXC.cjs +9750 -0
  160. package/dist/chunk-URG2SJLK.js +2521 -0
  161. package/dist/chunk-UWJHCOH2.js +623 -0
  162. package/dist/chunk-V6MKC2FZ.js +979 -0
  163. package/dist/chunk-VJ3L7CHT.cjs +169 -0
  164. package/dist/chunk-VMLKSV26.js +1216 -0
  165. package/dist/chunk-VVKVQZI6.js +55 -0
  166. package/dist/chunk-W6RW64BB.cjs +1219 -0
  167. package/dist/chunk-WKX5AMOY.js +309 -0
  168. package/dist/chunk-WNNE3PO3.js +34 -0
  169. package/dist/chunk-WRKUDAZJ.js +3038 -0
  170. package/dist/chunk-WRLUBRKS.cjs +1943 -0
  171. package/dist/chunk-WRNEH5MO.js +3169 -0
  172. package/dist/chunk-WRWEX5ZF.js +658 -0
  173. package/dist/chunk-X3GJPRVK.cjs +3246 -0
  174. package/dist/chunk-X3UVCWNL.cjs +2257 -0
  175. package/dist/chunk-XB274MW5.cjs +814 -0
  176. package/dist/chunk-XHIV6326.cjs +793 -0
  177. package/dist/chunk-XIVIE43A.cjs +729 -0
  178. package/dist/chunk-XJAN7CZG.cjs +432 -0
  179. package/dist/chunk-XKTPFXGA.js +164 -0
  180. package/dist/chunk-XL6INWKT.js +121 -0
  181. package/dist/chunk-XSFNHP2E.js +632 -0
  182. package/dist/chunk-XT6JY5W5.js +9684 -0
  183. package/dist/chunk-XUILI4KB.cjs +430 -0
  184. package/dist/chunk-YF2I3MV3.js +46 -0
  185. package/dist/chunk-YIMN575O.js +4847 -0
  186. package/dist/chunk-YIVFJNYV.js +176 -0
  187. package/dist/chunk-YKGPCZEE.cjs +237 -0
  188. package/dist/chunk-YN2YWTXW.js +5731 -0
  189. package/dist/chunk-YN6V7R3L.cjs +327 -0
  190. package/dist/chunk-YQELFNJV.js +39 -0
  191. package/dist/chunk-YVD3CSO3.js +1183 -0
  192. package/dist/chunk-YVOAF4ML.js +623 -0
  193. package/dist/chunk-YWOBW2PV.cjs +759 -0
  194. package/dist/chunk-YYXH45E2.js +426 -0
  195. package/dist/chunk-ZDSYWBIE.cjs +69 -0
  196. package/dist/chunk-ZU7NIRT6.js +325 -0
  197. package/dist/chunk-ZZ7RO2UQ.js +1243 -0
  198. package/dist/cli/holoscript-runner.cjs +2255 -0
  199. package/dist/cli/holoscript-runner.js +2230 -0
  200. package/dist/codebase/index.cjs +336 -0
  201. package/dist/codebase/index.js +331 -0
  202. package/dist/compiler/agent-inference.cjs +31 -0
  203. package/dist/compiler/agent-inference.js +8 -0
  204. package/dist/compiler/android-xr.cjs +24 -0
  205. package/dist/compiler/android-xr.js +14 -0
  206. package/dist/compiler/android.cjs +24 -0
  207. package/dist/compiler/android.js +14 -0
  208. package/dist/compiler/ar.cjs +23 -0
  209. package/dist/compiler/ar.js +11 -0
  210. package/dist/compiler/babylon.cjs +21 -0
  211. package/dist/compiler/babylon.js +15 -0
  212. package/dist/compiler/business-quest.cjs +43 -0
  213. package/dist/compiler/business-quest.js +4 -0
  214. package/dist/compiler/coco.cjs +27 -0
  215. package/dist/compiler/coco.js +4 -0
  216. package/dist/compiler/context.cjs +25 -0
  217. package/dist/compiler/context.d.ts +28 -0
  218. package/dist/compiler/context.js +8 -0
  219. package/dist/compiler/domain-block-utils.cjs +609 -0
  220. package/dist/compiler/domain-block-utils.js +11 -0
  221. package/dist/compiler/dtdl.cjs +27 -0
  222. package/dist/compiler/dtdl.js +11 -0
  223. package/dist/compiler/gltf-pipeline.cjs +39 -0
  224. package/dist/compiler/gltf-pipeline.js +4 -0
  225. package/dist/compiler/godot.cjs +18 -0
  226. package/dist/compiler/godot.js +12 -0
  227. package/dist/compiler/incremental.cjs +34 -0
  228. package/dist/compiler/incremental.js +9 -0
  229. package/dist/compiler/index.cjs +5408 -0
  230. package/dist/compiler/index.d.ts +334 -21
  231. package/dist/compiler/index.js +5069 -0
  232. package/dist/compiler/ios.cjs +23 -0
  233. package/dist/compiler/ios.js +13 -0
  234. package/dist/compiler/llm-provider-capabilities.cjs +25 -0
  235. package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
  236. package/dist/compiler/llm-provider-capabilities.js +8 -0
  237. package/dist/compiler/multi-layer.cjs +24 -0
  238. package/dist/compiler/multi-layer.js +15 -0
  239. package/dist/compiler/nodetoy.cjs +23 -0
  240. package/dist/compiler/nodetoy.d.ts +69 -0
  241. package/dist/compiler/nodetoy.js +4 -0
  242. package/dist/compiler/openxr.cjs +19 -0
  243. package/dist/compiler/openxr.js +13 -0
  244. package/dist/compiler/playcanvas.cjs +19 -0
  245. package/dist/compiler/playcanvas.js +13 -0
  246. package/dist/compiler/r3f.cjs +39 -0
  247. package/dist/compiler/r3f.d.ts +22 -0
  248. package/dist/compiler/r3f.js +17 -0
  249. package/dist/compiler/remotion.cjs +23 -0
  250. package/dist/compiler/remotion.js +4 -0
  251. package/dist/compiler/reproducibility.cjs +39 -0
  252. package/dist/compiler/reproducibility.js +4 -0
  253. package/dist/compiler/sdf.cjs +24 -0
  254. package/dist/compiler/sdf.js +12 -0
  255. package/dist/compiler/semantic-scene.cjs +31 -0
  256. package/dist/compiler/semantic-scene.js +4 -0
  257. package/dist/compiler/state.cjs +21 -0
  258. package/dist/compiler/state.js +11 -0
  259. package/dist/compiler/trait-composition.cjs +30 -0
  260. package/dist/compiler/trait-composition.js +9 -0
  261. package/dist/compiler/unity.cjs +19 -0
  262. package/dist/compiler/unity.js +13 -0
  263. package/dist/compiler/unreal.cjs +23 -0
  264. package/dist/compiler/unreal.js +13 -0
  265. package/dist/compiler/urdf.cjs +52 -0
  266. package/dist/compiler/urdf.js +12 -0
  267. package/dist/compiler/usd-physics.cjs +26 -0
  268. package/dist/compiler/usd-physics.js +9 -0
  269. package/dist/compiler/visionos.cjs +19 -0
  270. package/dist/compiler/visionos.js +13 -0
  271. package/dist/compiler/vrchat.cjs +22 -0
  272. package/dist/compiler/vrchat.js +12 -0
  273. package/dist/compiler/vrr.cjs +24 -0
  274. package/dist/compiler/vrr.js +12 -0
  275. package/dist/compiler/wasm.cjs +36 -0
  276. package/dist/compiler/wasm.js +12 -0
  277. package/dist/compiler/webgpu.cjs +18 -0
  278. package/dist/compiler/webgpu.js +12 -0
  279. package/dist/coordinators/index.cjs +1266 -0
  280. package/dist/coordinators/index.d.ts +72 -1
  281. package/dist/coordinators/index.js +1259 -0
  282. package/dist/debugger.cjs +24 -0
  283. package/dist/debugger.js +11 -0
  284. package/dist/dist-ACXG6IH5.cjs +3113 -0
  285. package/dist/dist-VD4L6V7Q.js +3076 -0
  286. package/dist/entries/interop.cjs +64 -0
  287. package/dist/entries/interop.js +7 -0
  288. package/dist/entries/scripting.cjs +55 -0
  289. package/dist/entries/scripting.js +10 -0
  290. package/dist/hololand/index.cjs +146 -0
  291. package/dist/hololand/index.d.ts +70 -0
  292. package/dist/hololand/index.js +5 -0
  293. package/dist/index.cjs +44660 -0
  294. package/dist/index.d.ts +978 -21
  295. package/dist/index.js +41422 -0
  296. package/dist/math/tropical-spmv.cjs +45 -0
  297. package/dist/math/tropical-spmv.js +4 -0
  298. package/dist/math/vec3.cjs +57 -0
  299. package/dist/math/vec3.js +4 -0
  300. package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
  301. package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
  302. package/dist/paper-0c-spike/index.cjs +150 -0
  303. package/dist/paper-0c-spike/index.js +141 -0
  304. package/dist/parser.cjs +61 -0
  305. package/dist/parser.d.ts +11 -0
  306. package/dist/parser.js +12 -0
  307. package/dist/playwright-3AT3AKTV.cjs +98673 -0
  308. package/dist/playwright-VZPDVUEQ.js +98660 -0
  309. package/dist/reconstruction/index.cjs +153 -0
  310. package/dist/reconstruction/index.d.ts +29 -2
  311. package/dist/reconstruction/index.js +8 -0
  312. package/dist/runtime.cjs +316 -0
  313. package/dist/runtime.d.ts +61 -0
  314. package/dist/runtime.js +31 -0
  315. package/dist/self-improvement/index.cjs +563 -0
  316. package/dist/self-improvement/index.js +545 -0
  317. package/dist/src-4ROC227P.cjs +2094 -0
  318. package/dist/src-HCCCSYP7.js +2073 -0
  319. package/dist/storage/index.cjs +38 -0
  320. package/dist/storage/index.js +5 -0
  321. package/dist/testing.cjs +25 -0
  322. package/dist/testing.d.ts +70 -0
  323. package/dist/testing.js +4 -0
  324. package/dist/traitDocs/traitDocs.cjs +33 -0
  325. package/dist/traitDocs/traitDocs.js +7 -0
  326. package/dist/traits/botanical-lotus.cjs +177 -0
  327. package/dist/traits/botanical-lotus.d.ts +502 -0
  328. package/dist/traits/botanical-lotus.js +7 -0
  329. package/dist/traits/engines/index.cjs +520 -0
  330. package/dist/traits/engines/index.js +380 -0
  331. package/dist/traits/index.cjs +24548 -0
  332. package/dist/traits/index.d.ts +171 -35
  333. package/dist/traits/index.js +21638 -0
  334. package/dist/traits/simulation-solver-factory.cjs +13 -0
  335. package/dist/traits/simulation-solver-factory.d.ts +23 -0
  336. package/dist/traits/simulation-solver-factory.js +4 -0
  337. package/dist/traits/webcam-gaze.cjs +35 -0
  338. package/dist/traits/webcam-gaze.d.ts +17 -0
  339. package/dist/traits/webcam-gaze.js +4 -0
  340. package/dist/type-checker.cjs +19 -0
  341. package/dist/type-checker.js +6 -0
  342. package/dist/world/index.cjs +947 -0
  343. package/dist/world/index.d.ts +147 -0
  344. package/dist/world/index.js +939 -0
  345. package/dist/world-model/index.cjs +1446 -0
  346. package/dist/world-model/index.d.ts +119 -0
  347. package/dist/world-model/index.js +1414 -0
  348. package/dist/wot/index.cjs +29 -0
  349. package/dist/wot/index.js +4 -0
  350. package/package.json +93 -49
@@ -0,0 +1,4396 @@
1
+ import { init_material_properties_visual, init_surface_texture_visual, init_lighting_visual, init_gems_minerals_visual, init_fabric_cloth_visual, init_visual_effects_visual, init_age_condition_visual, init_water_fluid_visual, init_weather_phenomena_visual, init_emotion_mood_visual, init_size_scale_visual, init_environmental_biome_visual, init_magic_fantasy_visual, init_scifi_technology_visual, init_creatures_mythical_visual, init_nature_life_visual, init_furniture_decor_visual, init_construction_building_visual, init_containers_storage_visual, init_shape_form_visual, init_animals_visual, init_maritime_naval_visual, init_time_period_visual, init_accessibility_visual, init_accessibility_extended_visual, init_architecture_realestate_visual, init_audio_visual, init_cooking_food_visual, init_core_vr_interaction_visual, init_data_visualization_visual, init_education_learning_visual, init_environment_input_visual, init_game_mechanics_visual, init_geospatial_web3_visual, init_healthcare_medical_visual, init_humanoid_avatar_visual, init_intelligence_behavior_visual, init_interop_copresence_visual, init_iot_autonomous_agents_visual, init_locomotion_movement_visual, init_measurement_sensing_visual, init_media_analytics_visual, init_multisensory_haptic_visual, init_musical_sound_visual, init_music_performance_visual, init_narrative_storytelling_visual, init_networking_ai_visual, init_npc_roles_visual, init_object_interaction_visual, init_parser_core_ui_visual, init_physical_affordances_visual, init_physics_expansion_visual, init_procedural_generation_visual, init_resource_gathering_visual, init_safety_boundaries_visual, init_signs_communication_visual, init_simple_modifiers_visual, init_social_commerce_visual, init_social_effects_visual, init_sports_fitness_visual, init_state_persistence_visual, init_transportation_vehicles_visual, init_volumetric_webgpu_visual, init_weather_particles_visual, init_xr_platform_visual, MATERIAL_PROPERTIES_VISUALS, SURFACE_TEXTURE_VISUALS, LIGHTING_VISUALS, GEMS_MINERALS_VISUALS, FABRIC_CLOTH_VISUALS, VISUAL_EFFECTS_VISUALS, AGE_CONDITION_VISUALS, WATER_FLUID_VISUALS, WEATHER_PHENOMENA_VISUALS, EMOTION_MOOD_VISUALS, SIZE_SCALE_VISUALS, ENVIRONMENTAL_BIOME_VISUALS, MAGIC_FANTASY_VISUALS, SCIFI_TECHNOLOGY_VISUALS, CREATURES_MYTHICAL_VISUALS, NATURE_LIFE_VISUALS, FURNITURE_DECOR_VISUALS, CONSTRUCTION_BUILDING_VISUALS, CONTAINERS_STORAGE_VISUALS, SHAPE_FORM_VISUALS, ANIMALS_VISUALS, MARITIME_NAVAL_VISUALS, TIME_PERIOD_VISUALS, ACCESSIBILITY_VISUALS, ACCESSIBILITY_EXTENDED_VISUALS, ARCHITECTURE_REALESTATE_VISUALS, AUDIO_VISUALS, COOKING_FOOD_VISUALS, CORE_VR_INTERACTION_VISUALS, DATA_VISUALIZATION_VISUALS, EDUCATION_LEARNING_VISUALS, ENVIRONMENT_INPUT_VISUALS, GAME_MECHANICS_VISUALS, GEOSPATIAL_WEB3_VISUALS, HEALTHCARE_MEDICAL_VISUALS, HUMANOID_AVATAR_VISUALS, INTELLIGENCE_BEHAVIOR_VISUALS, INTEROP_COPRESENCE_VISUALS, IOT_AUTONOMOUS_AGENTS_VISUALS, LOCOMOTION_MOVEMENT_VISUALS, MEASUREMENT_SENSING_VISUALS, MEDIA_ANALYTICS_VISUALS, MULTISENSORY_HAPTIC_VISUALS, MUSICAL_SOUND_VISUALS, MUSIC_PERFORMANCE_VISUALS, NARRATIVE_STORYTELLING_VISUALS, NETWORKING_AI_VISUALS, NPC_ROLES_VISUALS, OBJECT_INTERACTION_VISUALS, PARSER_CORE_UI_VISUALS, PHYSICAL_AFFORDANCES_VISUALS, PHYSICS_EXPANSION_VISUALS, PROCEDURAL_GENERATION_VISUALS, RESOURCE_GATHERING_VISUALS, SAFETY_BOUNDARIES_VISUALS, SIGNS_COMMUNICATION_VISUALS, SIMPLE_MODIFIERS_VISUALS, SOCIAL_COMMERCE_VISUALS, SOCIAL_EFFECTS_VISUALS, SPORTS_FITNESS_VISUALS, STATE_PERSISTENCE_VISUALS, TRANSPORTATION_VEHICLES_VISUALS, VOLUMETRIC_WEBGPU_VISUALS, WEATHER_PARTICLES_VISUALS, XR_PLATFORM_VISUALS } from './chunk-XT6JY5W5.js';
2
+ import { init_BotanicalLotusTrait, createBotanicalLotusRenderProfile, buildLotusPetalMaterialSpec, LOTUS_PETAL_UNIFORM_BINDINGS } from './chunk-4GU5GCIY.js';
3
+ import { init_ProvenanceSemiring, ProvenanceSemiring } from './chunk-TJHVSBP2.js';
4
+ import { init_TraitVisualRegistry, init_types, init_TraitCompositor, TraitCompositor, TraitVisualRegistry } from './chunk-4C57PR42.js';
5
+ import { init_PlatformConditionalCompilerMixin, createPlatformTarget, PlatformConditionalCompilerMixin } from './chunk-GZG4KA4E.js';
6
+ import { init_DomainBlockCompilerMixin, compileDomainBlocks, compileSimulationBlock, simulationToR3F, compileWeatherBlock, weatherToR3F, compileAudioSourceBlock, audioSourceToR3F, compilePostProcessingBlock, postProcessingToR3F, compileParticleBlock, particlesToR3F, compilePhysicsBlock, physicsToR3F, compileMaterialBlock, materialToR3F } from './chunk-BOVPWH4H.js';
7
+ import { init_AgentRBAC, init_CompilerBase, getRBAC, UnauthorizedCompilerAccessError, escapeStringValue } from './chunk-QPSKHBJP.js';
8
+ import { __esm, __export } from './chunk-OL46QLBJ.js';
9
+
10
+ // src/traits/visual/presets/hologram-media.visual.ts
11
+ var HOLOGRAM_MEDIA_VISUALS;
12
+ var init_hologram_media_visual = __esm({
13
+ "src/traits/visual/presets/hologram-media.visual.ts"() {
14
+ HOLOGRAM_MEDIA_VISUALS = {
15
+ depth_estimation: {
16
+ material: { roughness: 0.3 },
17
+ emissive: { color: "#6644FF", intensity: 0.2 },
18
+ tags: ["ai", "depth", "hologram"],
19
+ layer: "visual_effect"
20
+ },
21
+ displacement: {
22
+ material: { roughness: 0.4 },
23
+ emissive: { color: "#8866FF", intensity: 0.15 },
24
+ tags: ["3d", "depth", "mesh"],
25
+ layer: "visual_effect"
26
+ },
27
+ segment: {
28
+ material: { roughness: 0.3 },
29
+ emissive: { color: "#FF44AA", intensity: 0.15 },
30
+ tags: ["ai", "segmentation", "mask"],
31
+ layer: "visual_effect"
32
+ },
33
+ animated_texture: {
34
+ material: { roughness: 0.3 },
35
+ emissive: { color: "#44FFAA", intensity: 0.15 },
36
+ tags: ["animation", "texture", "gif"],
37
+ layer: "visual_effect"
38
+ },
39
+ holographic_sprite: {
40
+ material: { roughness: 0.2 },
41
+ emissive: { color: "#AA44FF", intensity: 0.3 },
42
+ tags: ["hologram", "sprite", "3d"],
43
+ layer: "visual_effect"
44
+ },
45
+ quilt: {
46
+ material: { roughness: 0.3 },
47
+ emissive: { color: "#44AAFF", intensity: 0.2 },
48
+ tags: ["hologram", "multiview", "looking-glass"],
49
+ layer: "visual_effect"
50
+ },
51
+ gaussian_splatting: {
52
+ material: { roughness: 0.2 },
53
+ emissive: { color: "#AACCFF", intensity: 0.15 },
54
+ tags: ["3d", "photorealistic", "splat"],
55
+ layer: "visual_effect"
56
+ },
57
+ spatial_video: {
58
+ material: { roughness: 0.3 },
59
+ emissive: { color: "#FF8844", intensity: 0.15 },
60
+ tags: ["video", "stereo", "spatial"],
61
+ layer: "visual_effect"
62
+ },
63
+ image: {
64
+ material: { roughness: 0.4 },
65
+ tags: ["media", "texture", "source"],
66
+ layer: "base_material"
67
+ },
68
+ depth_sequence: {
69
+ material: { roughness: 0.3 },
70
+ emissive: { color: "#6644FF", intensity: 0.1 },
71
+ tags: ["video", "depth", "temporal"],
72
+ layer: "visual_effect"
73
+ },
74
+ temporal_smoothing: {
75
+ material: { roughness: 0.3 },
76
+ tags: ["processing", "temporal"],
77
+ layer: "visual_effect"
78
+ },
79
+ depth_to_normal: {
80
+ material: { roughness: 0.3 },
81
+ emissive: { color: "#8888FF", intensity: 0.1 },
82
+ tags: ["processing", "normal-map"],
83
+ layer: "visual_effect"
84
+ }
85
+ };
86
+ }
87
+ });
88
+
89
+ // src/traits/visual/presets/gaps-physics.visual.ts
90
+ var GAPS_PHYSICS_VISUALS;
91
+ var init_gaps_physics_visual = __esm({
92
+ "src/traits/visual/presets/gaps-physics.visual.ts"() {
93
+ GAPS_PHYSICS_VISUALS = /* @__PURE__ */ new Map([
94
+ // --- Pillar A: Unified Physics ---
95
+ [
96
+ "fluid",
97
+ {
98
+ material: {
99
+ type: "physical",
100
+ color: "#1a6fc4",
101
+ metalness: 0,
102
+ roughness: 0.05,
103
+ transmission: 0.95,
104
+ ior: 1.33,
105
+ thickness: 0.5
106
+ },
107
+ layers: [
108
+ {
109
+ type: "effect",
110
+ name: "ssfr",
111
+ priority: 50,
112
+ config: {
113
+ resolutionScale: 0.5,
114
+ absorptionColor: [0.4, 0.04, 0],
115
+ absorptionStrength: 2,
116
+ fresnelPower: 0.02,
117
+ refractionStrength: 0.1
118
+ }
119
+ }
120
+ ]
121
+ }
122
+ ],
123
+ [
124
+ "soft_body_pro",
125
+ {
126
+ material: {
127
+ type: "physical",
128
+ color: "#e8a87c",
129
+ metalness: 0,
130
+ roughness: 0.6
131
+ },
132
+ layers: [
133
+ {
134
+ type: "deformation",
135
+ name: "pbd_tearing",
136
+ priority: 45,
137
+ config: { tearThreshold: 0.8, tearColor: "#8b0000" }
138
+ }
139
+ ]
140
+ }
141
+ ],
142
+ [
143
+ "crowd_sim",
144
+ {
145
+ material: {
146
+ type: "standard",
147
+ color: "#7b68ee"
148
+ },
149
+ layers: [
150
+ {
151
+ type: "instanced",
152
+ name: "crowd_instances",
153
+ priority: 30,
154
+ config: { maxInstances: 1e4, lodLevels: 3 }
155
+ }
156
+ ]
157
+ }
158
+ ],
159
+ [
160
+ "deformable_terrain",
161
+ {
162
+ material: {
163
+ type: "standard",
164
+ color: "#8b7355",
165
+ roughness: 0.9
166
+ },
167
+ layers: [
168
+ {
169
+ type: "displacement",
170
+ name: "heightmap_erosion",
171
+ priority: 40,
172
+ config: { displacementScale: 5 }
173
+ }
174
+ ]
175
+ }
176
+ ],
177
+ [
178
+ "volumetric_clouds",
179
+ {
180
+ material: {
181
+ type: "shader",
182
+ color: "#ffffff"
183
+ },
184
+ layers: [
185
+ {
186
+ type: "volumetric",
187
+ name: "cloud_raymarcher",
188
+ priority: 80,
189
+ config: {
190
+ absorptionCoeff: 0.04,
191
+ scatteringCoeff: 0.06,
192
+ phaseG: 0.3,
193
+ maxSteps: 64
194
+ }
195
+ }
196
+ ]
197
+ }
198
+ ],
199
+ [
200
+ "god_rays",
201
+ {
202
+ material: {
203
+ type: "shader",
204
+ color: "#fffde7"
205
+ },
206
+ layers: [
207
+ {
208
+ type: "post_process",
209
+ name: "volumetric_light",
210
+ priority: 85,
211
+ config: { decay: 0.96, weight: 0.5, exposure: 0.3, samples: 100 }
212
+ }
213
+ ]
214
+ }
215
+ ],
216
+ // --- Weather Hub ---
217
+ [
218
+ "weather",
219
+ {
220
+ material: {
221
+ type: "none",
222
+ color: "#87ceeb"
223
+ },
224
+ layers: [
225
+ {
226
+ type: "ambient",
227
+ name: "weather_atmosphere",
228
+ priority: 90,
229
+ config: { affectsLighting: true, affectsFog: true }
230
+ }
231
+ ]
232
+ }
233
+ ],
234
+ // --- Pillar B: Persistent World ---
235
+ [
236
+ "world_state",
237
+ {
238
+ material: {
239
+ type: "none",
240
+ color: "#4a90d9"
241
+ },
242
+ layers: []
243
+ }
244
+ ],
245
+ [
246
+ "spatial_voice",
247
+ {
248
+ material: {
249
+ type: "none",
250
+ color: "#90ee90"
251
+ },
252
+ layers: [
253
+ {
254
+ type: "indicator",
255
+ name: "voice_range",
256
+ priority: 10,
257
+ config: { showRadius: true, radiusColor: "#90ee9040" }
258
+ }
259
+ ]
260
+ }
261
+ ],
262
+ [
263
+ "lip_sync",
264
+ {
265
+ material: {
266
+ type: "none",
267
+ color: "#ffb6c1"
268
+ },
269
+ layers: [
270
+ {
271
+ type: "morph",
272
+ name: "viseme_blendshapes",
273
+ priority: 60,
274
+ config: { blendShapePrefix: "viseme_" }
275
+ }
276
+ ]
277
+ }
278
+ ],
279
+ // --- Pillar C: Living Economy ---
280
+ [
281
+ "ai_companion",
282
+ {
283
+ material: {
284
+ type: "standard",
285
+ color: "#dda0dd",
286
+ emissive: "#330033",
287
+ emissiveIntensity: 0.2
288
+ },
289
+ layers: [
290
+ {
291
+ type: "indicator",
292
+ name: "ai_thinking",
293
+ priority: 15,
294
+ config: { pulseColor: "#9b59b6", pulseSpeed: 1.5 }
295
+ }
296
+ ]
297
+ }
298
+ ],
299
+ [
300
+ "token_gated",
301
+ {
302
+ material: {
303
+ type: "standard",
304
+ color: "#ffd700",
305
+ metalness: 0.8,
306
+ roughness: 0.2
307
+ },
308
+ layers: [
309
+ {
310
+ type: "barrier",
311
+ name: "token_gate_barrier",
312
+ priority: 70,
313
+ config: { barrierColor: "#ffd70060", shimmer: true }
314
+ }
315
+ ]
316
+ }
317
+ ],
318
+ [
319
+ "moderation",
320
+ {
321
+ material: {
322
+ type: "none",
323
+ color: "#ff6347"
324
+ },
325
+ layers: []
326
+ }
327
+ ],
328
+ [
329
+ "anti_grief",
330
+ {
331
+ material: {
332
+ type: "none",
333
+ color: "#32cd32"
334
+ },
335
+ layers: [
336
+ {
337
+ type: "shield",
338
+ name: "grief_shield",
339
+ priority: 95,
340
+ config: { shieldColor: "#32cd3230" }
341
+ }
342
+ ]
343
+ }
344
+ ]
345
+ ]);
346
+ }
347
+ });
348
+
349
+ // src/traits/visual/presets/phone-sleeve-vr.visual.ts
350
+ var PHONE_SLEEVE_VR_VISUALS;
351
+ var init_phone_sleeve_vr_visual = __esm({
352
+ "src/traits/visual/presets/phone-sleeve-vr.visual.ts"() {
353
+ PHONE_SLEEVE_VR_VISUALS = {
354
+ // --- Hardware Form Factor ---
355
+ phone_sleeve: {
356
+ material: { roughness: 0.3, metalness: 0.6 },
357
+ emissive: { color: "#00CCFF", intensity: 0.2 },
358
+ tags: ["vr", "phone", "sleeve", "headset"],
359
+ layer: "visual_effect"
360
+ },
361
+ sleeve_nfc_trigger: {
362
+ material: { roughness: 0.4 },
363
+ emissive: { color: "#FFD700", intensity: 0.15 },
364
+ tags: ["nfc", "trigger", "hardware"],
365
+ layer: "visual_effect"
366
+ },
367
+ sleeve_lens_profile: {
368
+ material: { roughness: 0.1, metalness: 0 },
369
+ opacity: 0.6,
370
+ tags: ["lens", "optics"],
371
+ layer: "visual_effect"
372
+ },
373
+ phone_detection: {
374
+ material: { roughness: 0.4 },
375
+ emissive: { color: "#44FF88", intensity: 0.1 },
376
+ tags: ["detection", "calibration"],
377
+ layer: "visual_effect"
378
+ },
379
+ // --- Display ---
380
+ stereo_split: {
381
+ material: { roughness: 0.2 },
382
+ emissive: { color: "#FF44AA", intensity: 0.2 },
383
+ tags: ["stereoscopic", "display", "split"],
384
+ layer: "visual_effect"
385
+ },
386
+ barrel_distortion: {
387
+ material: { roughness: 0.3 },
388
+ emissive: { color: "#AA44FF", intensity: 0.15 },
389
+ tags: ["distortion", "shader", "lens"],
390
+ layer: "visual_effect"
391
+ },
392
+ chromatic_aberration_fix: {
393
+ material: { roughness: 0.3 },
394
+ emissive: { color: "#FF8800", intensity: 0.1 },
395
+ tags: ["color", "correction", "lens"],
396
+ layer: "visual_effect"
397
+ },
398
+ ipd_adjust: {
399
+ material: { roughness: 0.4 },
400
+ emissive: { color: "#44CCFF", intensity: 0.1 },
401
+ tags: ["calibration", "ipd", "comfort"],
402
+ layer: "visual_effect"
403
+ },
404
+ // --- Sensor / Tracking ---
405
+ gyro_head_tracking: {
406
+ material: { roughness: 0.4 },
407
+ emissive: { color: "#00FF88", intensity: 0.15 },
408
+ tags: ["tracking", "gyroscope", "3dof"],
409
+ layer: "visual_effect"
410
+ },
411
+ accel_sensor_fusion: {
412
+ material: { roughness: 0.4 },
413
+ emissive: { color: "#00CC66", intensity: 0.1 },
414
+ tags: ["sensor", "accelerometer", "fusion"],
415
+ layer: "visual_effect"
416
+ },
417
+ mag_drift_correction: {
418
+ material: { roughness: 0.4 },
419
+ emissive: { color: "#8844FF", intensity: 0.1 },
420
+ tags: ["magnetometer", "drift", "correction"],
421
+ layer: "visual_effect"
422
+ },
423
+ positional_estimation: {
424
+ material: { roughness: 0.4 },
425
+ emissive: { color: "#FFAA00", intensity: 0.15 },
426
+ tags: ["6dof", "vio", "tracking"],
427
+ layer: "visual_effect"
428
+ },
429
+ // --- Interaction ---
430
+ gaze_cursor: {
431
+ material: { roughness: 0.2 },
432
+ emissive: { color: "#FFFFFF", intensity: 0.3 },
433
+ tags: ["gaze", "cursor", "reticle"],
434
+ layer: "visual_effect"
435
+ },
436
+ gaze_dwell_select: {
437
+ material: { roughness: 0.3 },
438
+ emissive: { color: "#FFFF44", intensity: 0.2 },
439
+ tags: ["gaze", "dwell", "selection"],
440
+ layer: "visual_effect"
441
+ },
442
+ bt_controller: {
443
+ material: { roughness: 0.5, metalness: 0.3 },
444
+ tags: ["bluetooth", "controller", "input"],
445
+ layer: "visual_effect"
446
+ },
447
+ tap_select: {
448
+ material: { roughness: 0.4 },
449
+ emissive: { color: "#44FF44", intensity: 0.1 },
450
+ tags: ["tap", "capacitive", "input"],
451
+ layer: "visual_effect"
452
+ },
453
+ voice_command: {
454
+ material: { roughness: 0.4 },
455
+ emissive: { color: "#4488FF", intensity: 0.1 },
456
+ tags: ["voice", "speech", "command"],
457
+ layer: "visual_effect"
458
+ },
459
+ // --- Performance ---
460
+ thermal_throttle: {
461
+ material: { roughness: 0.6 },
462
+ emissive: { color: "#FF4400", intensity: 0.2 },
463
+ tags: ["thermal", "throttle", "performance"],
464
+ layer: "visual_effect"
465
+ },
466
+ battery_aware_lod: {
467
+ material: { roughness: 0.5 },
468
+ emissive: { color: "#44FF00", intensity: 0.1 },
469
+ tags: ["battery", "lod", "adaptive"],
470
+ layer: "visual_effect"
471
+ },
472
+ sleeve_foveated: {
473
+ material: { roughness: 0.3 },
474
+ emissive: { color: "#CC44FF", intensity: 0.15 },
475
+ tags: ["foveated", "rendering", "performance"],
476
+ layer: "visual_effect"
477
+ },
478
+ low_persistence: {
479
+ material: { roughness: 0.2 },
480
+ emissive: { color: "#88CCFF", intensity: 0.1 },
481
+ tags: ["display", "persistence", "blur"],
482
+ layer: "visual_effect"
483
+ },
484
+ // --- Comfort ---
485
+ vr_comfort_vignette: {
486
+ material: { roughness: 0.5 },
487
+ opacity: 0.7,
488
+ tags: ["comfort", "vignette", "motion"],
489
+ layer: "visual_effect"
490
+ },
491
+ reorient_snap: {
492
+ material: { roughness: 0.4 },
493
+ emissive: { color: "#44FFCC", intensity: 0.1 },
494
+ tags: ["snap", "recenter", "comfort"],
495
+ layer: "visual_effect"
496
+ },
497
+ static_horizon: {
498
+ material: { roughness: 0.4 },
499
+ emissive: { color: "#88FF88", intensity: 0.1 },
500
+ tags: ["horizon", "stability", "nausea"],
501
+ layer: "visual_effect"
502
+ },
503
+ session_timer: {
504
+ material: { roughness: 0.4 },
505
+ emissive: { color: "#FFCC00", intensity: 0.15 },
506
+ tags: ["timer", "health", "breaks"],
507
+ layer: "visual_effect"
508
+ }
509
+ };
510
+ }
511
+ });
512
+
513
+ // src/traits/visual/index.ts
514
+ function registerAllPresets() {
515
+ const registry = TraitVisualRegistry.getInstance();
516
+ for (const presetMap of ALL_PRESETS) {
517
+ registry.registerBatch(presetMap);
518
+ }
519
+ }
520
+ var ALL_PRESETS;
521
+ var init_visual = __esm({
522
+ "src/traits/visual/index.ts"() {
523
+ init_TraitVisualRegistry();
524
+ init_types();
525
+ init_TraitVisualRegistry();
526
+ init_material_properties_visual();
527
+ init_surface_texture_visual();
528
+ init_lighting_visual();
529
+ init_gems_minerals_visual();
530
+ init_fabric_cloth_visual();
531
+ init_visual_effects_visual();
532
+ init_age_condition_visual();
533
+ init_water_fluid_visual();
534
+ init_weather_phenomena_visual();
535
+ init_emotion_mood_visual();
536
+ init_size_scale_visual();
537
+ init_environmental_biome_visual();
538
+ init_magic_fantasy_visual();
539
+ init_scifi_technology_visual();
540
+ init_creatures_mythical_visual();
541
+ init_nature_life_visual();
542
+ init_furniture_decor_visual();
543
+ init_construction_building_visual();
544
+ init_containers_storage_visual();
545
+ init_shape_form_visual();
546
+ init_animals_visual();
547
+ init_maritime_naval_visual();
548
+ init_time_period_visual();
549
+ init_accessibility_visual();
550
+ init_accessibility_extended_visual();
551
+ init_architecture_realestate_visual();
552
+ init_audio_visual();
553
+ init_cooking_food_visual();
554
+ init_core_vr_interaction_visual();
555
+ init_data_visualization_visual();
556
+ init_education_learning_visual();
557
+ init_environment_input_visual();
558
+ init_game_mechanics_visual();
559
+ init_geospatial_web3_visual();
560
+ init_healthcare_medical_visual();
561
+ init_humanoid_avatar_visual();
562
+ init_intelligence_behavior_visual();
563
+ init_interop_copresence_visual();
564
+ init_iot_autonomous_agents_visual();
565
+ init_locomotion_movement_visual();
566
+ init_measurement_sensing_visual();
567
+ init_media_analytics_visual();
568
+ init_multisensory_haptic_visual();
569
+ init_musical_sound_visual();
570
+ init_music_performance_visual();
571
+ init_narrative_storytelling_visual();
572
+ init_networking_ai_visual();
573
+ init_npc_roles_visual();
574
+ init_object_interaction_visual();
575
+ init_parser_core_ui_visual();
576
+ init_physical_affordances_visual();
577
+ init_physics_expansion_visual();
578
+ init_procedural_generation_visual();
579
+ init_resource_gathering_visual();
580
+ init_safety_boundaries_visual();
581
+ init_signs_communication_visual();
582
+ init_simple_modifiers_visual();
583
+ init_social_commerce_visual();
584
+ init_social_effects_visual();
585
+ init_sports_fitness_visual();
586
+ init_state_persistence_visual();
587
+ init_transportation_vehicles_visual();
588
+ init_volumetric_webgpu_visual();
589
+ init_weather_particles_visual();
590
+ init_xr_platform_visual();
591
+ init_hologram_media_visual();
592
+ init_gaps_physics_visual();
593
+ init_phone_sleeve_vr_visual();
594
+ ALL_PRESETS = [
595
+ // Original 12
596
+ MATERIAL_PROPERTIES_VISUALS,
597
+ SURFACE_TEXTURE_VISUALS,
598
+ LIGHTING_VISUALS,
599
+ GEMS_MINERALS_VISUALS,
600
+ FABRIC_CLOTH_VISUALS,
601
+ VISUAL_EFFECTS_VISUALS,
602
+ AGE_CONDITION_VISUALS,
603
+ WATER_FLUID_VISUALS,
604
+ WEATHER_PHENOMENA_VISUALS,
605
+ EMOTION_MOOD_VISUALS,
606
+ SIZE_SCALE_VISUALS,
607
+ ENVIRONMENTAL_BIOME_VISUALS,
608
+ // Expansion wave 1
609
+ MAGIC_FANTASY_VISUALS,
610
+ SCIFI_TECHNOLOGY_VISUALS,
611
+ CREATURES_MYTHICAL_VISUALS,
612
+ NATURE_LIFE_VISUALS,
613
+ FURNITURE_DECOR_VISUALS,
614
+ CONSTRUCTION_BUILDING_VISUALS,
615
+ CONTAINERS_STORAGE_VISUALS,
616
+ SHAPE_FORM_VISUALS,
617
+ ANIMALS_VISUALS,
618
+ MARITIME_NAVAL_VISUALS,
619
+ TIME_PERIOD_VISUALS,
620
+ // Expansion wave 2 — full coverage
621
+ ACCESSIBILITY_VISUALS,
622
+ ACCESSIBILITY_EXTENDED_VISUALS,
623
+ ARCHITECTURE_REALESTATE_VISUALS,
624
+ AUDIO_VISUALS,
625
+ COOKING_FOOD_VISUALS,
626
+ CORE_VR_INTERACTION_VISUALS,
627
+ DATA_VISUALIZATION_VISUALS,
628
+ EDUCATION_LEARNING_VISUALS,
629
+ ENVIRONMENT_INPUT_VISUALS,
630
+ GAME_MECHANICS_VISUALS,
631
+ GEOSPATIAL_WEB3_VISUALS,
632
+ HEALTHCARE_MEDICAL_VISUALS,
633
+ HUMANOID_AVATAR_VISUALS,
634
+ INTELLIGENCE_BEHAVIOR_VISUALS,
635
+ INTEROP_COPRESENCE_VISUALS,
636
+ IOT_AUTONOMOUS_AGENTS_VISUALS,
637
+ LOCOMOTION_MOVEMENT_VISUALS,
638
+ MEASUREMENT_SENSING_VISUALS,
639
+ MEDIA_ANALYTICS_VISUALS,
640
+ MULTISENSORY_HAPTIC_VISUALS,
641
+ MUSICAL_SOUND_VISUALS,
642
+ MUSIC_PERFORMANCE_VISUALS,
643
+ NARRATIVE_STORYTELLING_VISUALS,
644
+ NETWORKING_AI_VISUALS,
645
+ NPC_ROLES_VISUALS,
646
+ OBJECT_INTERACTION_VISUALS,
647
+ PARSER_CORE_UI_VISUALS,
648
+ PHYSICAL_AFFORDANCES_VISUALS,
649
+ PHYSICS_EXPANSION_VISUALS,
650
+ PROCEDURAL_GENERATION_VISUALS,
651
+ RESOURCE_GATHERING_VISUALS,
652
+ SAFETY_BOUNDARIES_VISUALS,
653
+ SIGNS_COMMUNICATION_VISUALS,
654
+ SIMPLE_MODIFIERS_VISUALS,
655
+ SOCIAL_COMMERCE_VISUALS,
656
+ SOCIAL_EFFECTS_VISUALS,
657
+ SPORTS_FITNESS_VISUALS,
658
+ STATE_PERSISTENCE_VISUALS,
659
+ TRANSPORTATION_VEHICLES_VISUALS,
660
+ VOLUMETRIC_WEBGPU_VISUALS,
661
+ WEATHER_PARTICLES_VISUALS,
662
+ XR_PLATFORM_VISUALS,
663
+ // Hologram Media Pipeline
664
+ HOLOGRAM_MEDIA_VISUALS,
665
+ // GAPS Feature Roadmap — Phase 1
666
+ GAPS_PHYSICS_VISUALS,
667
+ // Phone Sleeve VR — smartphone-as-headset
668
+ PHONE_SLEEVE_VR_VISUALS
669
+ ];
670
+ registerAllPresets();
671
+ }
672
+ });
673
+
674
+ // src/compiler/ObjectPool.ts
675
+ var ASTNodePool;
676
+ var init_ObjectPool = __esm({
677
+ "src/compiler/ObjectPool.ts"() {
678
+ ASTNodePool = class {
679
+ /**
680
+ * @param factory Creates a fresh instance of the node.
681
+ * @param resetter Resets the node state before it is handed out again.
682
+ * @param initialCapacity How many nodes to pre-allocate.
683
+ */
684
+ constructor(factory, resetter, initialCapacity = 1e4) {
685
+ this.pool = [];
686
+ this.factory = factory;
687
+ this.resetter = resetter;
688
+ for (let i = 0; i < initialCapacity; i++) {
689
+ this.pool.push(this.factory());
690
+ }
691
+ }
692
+ /**
693
+ * Acquire a node from the pool, or create a new one if the pool is empty.
694
+ */
695
+ acquire() {
696
+ if (this.pool.length > 0) {
697
+ const node = this.pool.pop();
698
+ this.resetter(node);
699
+ return node;
700
+ }
701
+ return this.factory();
702
+ }
703
+ /**
704
+ * Release a node back to the pool to be reused.
705
+ */
706
+ release(node) {
707
+ this.pool.push(node);
708
+ }
709
+ /**
710
+ * Release an array of nodes back to the pool.
711
+ */
712
+ releaseAll(nodes) {
713
+ for (const node of nodes) {
714
+ this.pool.push(node);
715
+ }
716
+ }
717
+ /**
718
+ * Clear the pool, allowing garbage collection.
719
+ */
720
+ clear() {
721
+ this.pool.length = 0;
722
+ }
723
+ };
724
+ }
725
+ });
726
+
727
+ // src/compiler/R3FCompiler.ts
728
+ var R3FCompiler_exports = {};
729
+ __export(R3FCompiler_exports, {
730
+ ENVIRONMENT_PRESETS: () => ENVIRONMENT_PRESETS,
731
+ MATERIAL_PRESETS: () => MATERIAL_PRESETS,
732
+ QUALITY_TIER_SCALES: () => QUALITY_TIER_SCALES,
733
+ R3FCompiler: () => R3FCompiler,
734
+ UI_COMPONENT_PRESETS: () => UI_COMPONENT_PRESETS
735
+ });
736
+ function isVfxParticleTraitName(name) {
737
+ return name.startsWith("vfx_particle_");
738
+ }
739
+ function vfxParticleEffect(name) {
740
+ return name.replace("vfx_particle_", "");
741
+ }
742
+ function gemResonanceConfig(config) {
743
+ return {
744
+ max_distance: 0.5,
745
+ base_frequencies: "auto",
746
+ blend_mode: "harmonic",
747
+ output: "spatial_audio",
748
+ ...config || {}
749
+ };
750
+ }
751
+ var r3fNodePool, MATERIAL_PRESETS, ENVIRONMENT_PRESETS, MESH_TYPES, UI_COMPONENT_PRESETS, QUALITY_TIER_SCALES, R3FCompiler;
752
+ var init_R3FCompiler = __esm({
753
+ "src/compiler/R3FCompiler.ts"() {
754
+ init_TraitCompositor();
755
+ init_ProvenanceSemiring();
756
+ init_visual();
757
+ init_DomainBlockCompilerMixin();
758
+ init_PlatformConditionalCompilerMixin();
759
+ init_AgentRBAC();
760
+ init_CompilerBase();
761
+ init_ObjectPool();
762
+ init_BotanicalLotusTrait();
763
+ r3fNodePool = new ASTNodePool(
764
+ () => ({ type: "", props: {} }),
765
+ (node) => {
766
+ node.type = "";
767
+ node.id = void 0;
768
+ node.props = {};
769
+ node.children = void 0;
770
+ node.traits = void 0;
771
+ node.directives = void 0;
772
+ node.assetMaturity = void 0;
773
+ },
774
+ 0
775
+ // Was 20000 — demand-allocate instead of pre-allocating
776
+ );
777
+ MATERIAL_PRESETS = {
778
+ plastic: { roughness: 0.5, metalness: 0, clearcoat: 0.1 },
779
+ metal: { roughness: 0.2, metalness: 1 },
780
+ chrome: { roughness: 0.05, metalness: 1, envMapIntensity: 1.5 },
781
+ gold: { roughness: 0.3, metalness: 1, color: "#ffd700" },
782
+ copper: { roughness: 0.4, metalness: 1, color: "#b87333" },
783
+ glass: {
784
+ roughness: 0,
785
+ metalness: 0,
786
+ transmission: 0.95,
787
+ ior: 1.5,
788
+ thickness: 0.5,
789
+ transparent: true
790
+ },
791
+ crystal: {
792
+ roughness: 0,
793
+ metalness: 0.1,
794
+ transmission: 0.9,
795
+ ior: 2,
796
+ iridescence: 1,
797
+ iridescenceIOR: 1.3
798
+ },
799
+ wood: { roughness: 0.8, metalness: 0 },
800
+ fabric: {
801
+ roughness: 0.95,
802
+ metalness: 0,
803
+ sheen: 0.5,
804
+ sheenRoughness: 0.8,
805
+ sheenColor: "#ffffff"
806
+ },
807
+ rubber: { roughness: 0.9, metalness: 0 },
808
+ leather: {
809
+ roughness: 0.7,
810
+ metalness: 0,
811
+ sheen: 0.3,
812
+ sheenRoughness: 0.6,
813
+ sheenColor: "#3d2b1f"
814
+ },
815
+ water: {
816
+ roughness: 0,
817
+ metalness: 0,
818
+ transmission: 0.9,
819
+ ior: 1.33,
820
+ transparent: true,
821
+ color: "#006994"
822
+ },
823
+ emissive: { roughness: 0.5, metalness: 0, emissiveIntensity: 2 },
824
+ hologram: {
825
+ roughness: 0,
826
+ metalness: 0.3,
827
+ transparent: true,
828
+ opacity: 0.6,
829
+ emissiveIntensity: 1
830
+ },
831
+ stone: { roughness: 0.85, metalness: 0, color: "#808080" },
832
+ marble: { roughness: 0.15, metalness: 0, color: "#F0EDE6", envMapIntensity: 0.8 },
833
+ shiny: { roughness: 0.05, metalness: 0.3, envMapIntensity: 1.5, clearcoat: 0.8 },
834
+ neon: {
835
+ roughness: 0,
836
+ metalness: 0,
837
+ emissiveIntensity: 3,
838
+ transparent: true,
839
+ opacity: 0.9
840
+ },
841
+ toon: { roughness: 1, metalness: 0 },
842
+ wireframe: { roughness: 0.5, metalness: 0.5, wireframe: true },
843
+ velvet: {
844
+ roughness: 1,
845
+ metalness: 0,
846
+ sheen: 1,
847
+ sheenRoughness: 0.8,
848
+ sheenColor: "#ffffff",
849
+ clearcoat: 0.3
850
+ },
851
+ xray: { roughness: 0, metalness: 0, transparent: true, opacity: 0.3, emissiveIntensity: 0.5 },
852
+ gradient: { roughness: 0.5, metalness: 0 },
853
+ matte: { roughness: 1, metalness: 0 },
854
+ // ===========================================================================
855
+ // REALISTIC FABRICS — differentiated by sheen, roughness, and anisotropy
856
+ // ===========================================================================
857
+ cotton: {
858
+ roughness: 0.95,
859
+ metalness: 0,
860
+ sheen: 0.6,
861
+ sheenRoughness: 0.9,
862
+ sheenColor: "#ffffff"
863
+ },
864
+ polyester: {
865
+ roughness: 0.7,
866
+ metalness: 0,
867
+ sheen: 0.8,
868
+ sheenRoughness: 0.4,
869
+ sheenColor: "#e8e8e8"
870
+ },
871
+ silk: {
872
+ roughness: 0.3,
873
+ metalness: 0,
874
+ sheen: 1,
875
+ sheenRoughness: 0.2,
876
+ sheenColor: "#fffaf0",
877
+ anisotropy: 0.8,
878
+ anisotropyRotation: 0
879
+ },
880
+ satin: {
881
+ roughness: 0.25,
882
+ metalness: 0,
883
+ sheen: 0.9,
884
+ sheenRoughness: 0.15,
885
+ sheenColor: "#fff5ee",
886
+ anisotropy: 0.6,
887
+ anisotropyRotation: 0
888
+ },
889
+ linen: {
890
+ roughness: 0.9,
891
+ metalness: 0,
892
+ sheen: 0.4,
893
+ sheenRoughness: 0.85,
894
+ sheenColor: "#f5f0e8"
895
+ },
896
+ wool: {
897
+ roughness: 1,
898
+ metalness: 0,
899
+ sheen: 0.7,
900
+ sheenRoughness: 1,
901
+ sheenColor: "#e8dcc8"
902
+ },
903
+ denim: {
904
+ roughness: 0.85,
905
+ metalness: 0,
906
+ color: "#2b4570",
907
+ sheen: 0.5,
908
+ sheenRoughness: 0.7,
909
+ sheenColor: "#4a6fa5"
910
+ },
911
+ canvas: {
912
+ roughness: 0.95,
913
+ metalness: 0,
914
+ color: "#c8b88a",
915
+ sheen: 0.3,
916
+ sheenRoughness: 0.9,
917
+ sheenColor: "#d4c9a8"
918
+ },
919
+ burlap: {
920
+ roughness: 1,
921
+ metalness: 0,
922
+ color: "#8b7355",
923
+ sheen: 0.2,
924
+ sheenRoughness: 1,
925
+ sheenColor: "#a08060"
926
+ },
927
+ // ===========================================================================
928
+ // SKIN & ORGANIC — differentiated by subsurface scattering
929
+ // ===========================================================================
930
+ skin: {
931
+ roughness: 0.5,
932
+ metalness: 0,
933
+ color: "#e8b89d",
934
+ thickness: 0.8,
935
+ attenuationColor: "#cc4422",
936
+ attenuationDistance: 0.5
937
+ },
938
+ skin_dark: {
939
+ roughness: 0.45,
940
+ metalness: 0,
941
+ color: "#8d5524",
942
+ thickness: 1,
943
+ attenuationColor: "#661111",
944
+ attenuationDistance: 0.3
945
+ },
946
+ // Dragon / creature material presets
947
+ dragon_bone: {
948
+ roughness: 0.35,
949
+ metalness: 0.15,
950
+ color: "#e8dcc8"
951
+ },
952
+ dragon_leather: {
953
+ roughness: 0.8,
954
+ metalness: 0,
955
+ color: "#5c3a21"
956
+ },
957
+ dragon_scale: {
958
+ roughness: 0.25,
959
+ metalness: 0.4,
960
+ color: "#1a0d3d"
961
+ },
962
+ obsidian: {
963
+ roughness: 0.05,
964
+ metalness: 0.1,
965
+ color: "#0d0d0d",
966
+ clearcoat: 0.9,
967
+ clearcoatRoughness: 0.1,
968
+ envMapIntensity: 1.2
969
+ },
970
+ skin_pale: {
971
+ roughness: 0.55,
972
+ metalness: 0,
973
+ color: "#fde0c8",
974
+ thickness: 0.6,
975
+ attenuationColor: "#ee5533",
976
+ attenuationDistance: 0.6
977
+ },
978
+ candle_wax: {
979
+ roughness: 0.7,
980
+ metalness: 0,
981
+ color: "#fff8dc",
982
+ thickness: 2,
983
+ attenuationColor: "#ffaa44",
984
+ attenuationDistance: 0.3,
985
+ transmission: 0.15
986
+ },
987
+ jade: {
988
+ roughness: 0.2,
989
+ metalness: 0,
990
+ color: "#00a86b",
991
+ thickness: 1.5,
992
+ attenuationColor: "#004d32",
993
+ attenuationDistance: 1,
994
+ transmission: 0.1
995
+ },
996
+ milk: {
997
+ roughness: 0.3,
998
+ metalness: 0,
999
+ color: "#fdfff5",
1000
+ thickness: 1,
1001
+ attenuationColor: "#fff5d6",
1002
+ attenuationDistance: 0.2,
1003
+ transmission: 0.6,
1004
+ ior: 1.35
1005
+ },
1006
+ leaf: {
1007
+ roughness: 0.6,
1008
+ metalness: 0,
1009
+ color: "#228b22",
1010
+ thickness: 0.3,
1011
+ attenuationColor: "#44cc22",
1012
+ attenuationDistance: 0.5
1013
+ },
1014
+ honey: {
1015
+ roughness: 0.1,
1016
+ metalness: 0,
1017
+ color: "#eb9605",
1018
+ thickness: 1.5,
1019
+ attenuationColor: "#cc6600",
1020
+ attenuationDistance: 0.4,
1021
+ transmission: 0.7,
1022
+ ior: 1.5
1023
+ },
1024
+ // ===========================================================================
1025
+ // MUD & EARTH — differentiated by roughness, color, and subtle properties
1026
+ // ===========================================================================
1027
+ clay_mud: {
1028
+ roughness: 0.95,
1029
+ metalness: 0,
1030
+ color: "#8b4513",
1031
+ thickness: 0.5,
1032
+ attenuationColor: "#663311",
1033
+ attenuationDistance: 0.8
1034
+ },
1035
+ sandy_mud: {
1036
+ roughness: 0.85,
1037
+ metalness: 0.02,
1038
+ color: "#c2a66b"
1039
+ },
1040
+ wet_mud: {
1041
+ roughness: 0.4,
1042
+ metalness: 0,
1043
+ color: "#3d2b1f",
1044
+ clearcoat: 0.6,
1045
+ clearcoatRoughness: 0.2
1046
+ },
1047
+ dry_earth: {
1048
+ roughness: 1,
1049
+ metalness: 0,
1050
+ color: "#9b7653"
1051
+ },
1052
+ peat: {
1053
+ roughness: 0.9,
1054
+ metalness: 0,
1055
+ color: "#2d1f0e"
1056
+ },
1057
+ red_clay: {
1058
+ roughness: 0.95,
1059
+ metalness: 0,
1060
+ color: "#cc4b2e",
1061
+ thickness: 0.4,
1062
+ attenuationColor: "#993322",
1063
+ attenuationDistance: 0.6
1064
+ },
1065
+ volcanic_ash: {
1066
+ roughness: 0.8,
1067
+ metalness: 0.05,
1068
+ color: "#3c3c3c"
1069
+ },
1070
+ wet_sand: {
1071
+ roughness: 0.6,
1072
+ metalness: 0.02,
1073
+ color: "#c2b280",
1074
+ clearcoat: 0.3,
1075
+ clearcoatRoughness: 0.4
1076
+ },
1077
+ dry_sand: {
1078
+ roughness: 0.95,
1079
+ metalness: 0.02,
1080
+ color: "#e0cc8e"
1081
+ },
1082
+ // ===========================================================================
1083
+ // METALS (BRUSHED/ANISOTROPIC) — directional roughness
1084
+ // ===========================================================================
1085
+ brushed_steel: {
1086
+ roughness: 0.35,
1087
+ metalness: 1,
1088
+ color: "#c0c0c0",
1089
+ anisotropy: 0.7,
1090
+ anisotropyRotation: 0
1091
+ },
1092
+ brushed_aluminum: {
1093
+ roughness: 0.3,
1094
+ metalness: 1,
1095
+ color: "#d0d0d0",
1096
+ anisotropy: 0.8,
1097
+ anisotropyRotation: 0
1098
+ },
1099
+ brushed_copper: {
1100
+ roughness: 0.35,
1101
+ metalness: 1,
1102
+ color: "#b87333",
1103
+ anisotropy: 0.6,
1104
+ anisotropyRotation: 0
1105
+ },
1106
+ cast_iron: {
1107
+ roughness: 0.7,
1108
+ metalness: 0.9,
1109
+ color: "#3a3a3a"
1110
+ },
1111
+ bronze: {
1112
+ roughness: 0.45,
1113
+ metalness: 1,
1114
+ color: "#cd7f32"
1115
+ },
1116
+ silver: {
1117
+ roughness: 0.15,
1118
+ metalness: 1,
1119
+ color: "#c0c0c0",
1120
+ envMapIntensity: 1.3
1121
+ },
1122
+ platinum: {
1123
+ roughness: 0.2,
1124
+ metalness: 1,
1125
+ color: "#e5e4e2",
1126
+ envMapIntensity: 1.2
1127
+ },
1128
+ rust: {
1129
+ roughness: 0.9,
1130
+ metalness: 0.3,
1131
+ color: "#8b3a15"
1132
+ },
1133
+ // ===========================================================================
1134
+ // HAIR & FIBERS — anisotropy-driven
1135
+ // ===========================================================================
1136
+ hair_dark: {
1137
+ roughness: 0.35,
1138
+ metalness: 0,
1139
+ color: "#1a1209",
1140
+ anisotropy: 1,
1141
+ anisotropyRotation: Math.PI / 2,
1142
+ sheen: 0.3,
1143
+ sheenRoughness: 0.3,
1144
+ sheenColor: "#2a2219"
1145
+ },
1146
+ hair_blonde: {
1147
+ roughness: 0.3,
1148
+ metalness: 0,
1149
+ color: "#c8a55a",
1150
+ anisotropy: 1,
1151
+ anisotropyRotation: Math.PI / 2,
1152
+ sheen: 0.4,
1153
+ sheenRoughness: 0.25,
1154
+ sheenColor: "#d4b86a"
1155
+ },
1156
+ hair_red: {
1157
+ roughness: 0.35,
1158
+ metalness: 0,
1159
+ color: "#8b3a15",
1160
+ anisotropy: 1,
1161
+ anisotropyRotation: Math.PI / 2,
1162
+ sheen: 0.35,
1163
+ sheenRoughness: 0.3,
1164
+ sheenColor: "#a04520"
1165
+ },
1166
+ // ===========================================================================
1167
+ // WET SURFACES — clearcoat simulates water film
1168
+ // ===========================================================================
1169
+ wet_stone: {
1170
+ roughness: 0.3,
1171
+ metalness: 0,
1172
+ color: "#606060",
1173
+ clearcoat: 0.8,
1174
+ clearcoatRoughness: 0.1
1175
+ },
1176
+ wet_wood: {
1177
+ roughness: 0.4,
1178
+ metalness: 0,
1179
+ color: "#5a3a1a",
1180
+ clearcoat: 0.7,
1181
+ clearcoatRoughness: 0.15
1182
+ },
1183
+ wet_concrete: {
1184
+ roughness: 0.5,
1185
+ metalness: 0,
1186
+ color: "#707070",
1187
+ clearcoat: 0.5,
1188
+ clearcoatRoughness: 0.2
1189
+ },
1190
+ // ===========================================================================
1191
+ // FOOD & ORGANIC — SSS-heavy
1192
+ // ===========================================================================
1193
+ fruit: {
1194
+ roughness: 0.4,
1195
+ metalness: 0,
1196
+ color: "#ff4444",
1197
+ thickness: 0.8,
1198
+ attenuationColor: "#cc2200",
1199
+ attenuationDistance: 0.5,
1200
+ clearcoat: 0.3,
1201
+ clearcoatRoughness: 0.2
1202
+ },
1203
+ cheese: {
1204
+ roughness: 0.7,
1205
+ metalness: 0,
1206
+ color: "#ffc125",
1207
+ thickness: 1.2,
1208
+ attenuationColor: "#cc9900",
1209
+ attenuationDistance: 0.4
1210
+ },
1211
+ bread: {
1212
+ roughness: 0.95,
1213
+ metalness: 0,
1214
+ color: "#c4a35a",
1215
+ thickness: 0.3,
1216
+ attenuationColor: "#8b6914",
1217
+ attenuationDistance: 0.8
1218
+ },
1219
+ chocolate: {
1220
+ roughness: 0.5,
1221
+ metalness: 0,
1222
+ color: "#3b1e08",
1223
+ clearcoat: 0.2,
1224
+ clearcoatRoughness: 0.3
1225
+ },
1226
+ // ===========================================================================
1227
+ // COATED SURFACES — clearcoat-driven
1228
+ // ===========================================================================
1229
+ car_paint: {
1230
+ roughness: 0.1,
1231
+ metalness: 0,
1232
+ clearcoat: 1,
1233
+ clearcoatRoughness: 0.05
1234
+ },
1235
+ lacquer: {
1236
+ roughness: 0.05,
1237
+ metalness: 0,
1238
+ clearcoat: 1,
1239
+ clearcoatRoughness: 0.02
1240
+ },
1241
+ varnished_wood: {
1242
+ roughness: 0.3,
1243
+ metalness: 0,
1244
+ color: "#8b5e3c",
1245
+ clearcoat: 0.9,
1246
+ clearcoatRoughness: 0.1
1247
+ },
1248
+ glazed_ceramic: {
1249
+ roughness: 0.15,
1250
+ metalness: 0,
1251
+ color: "#f0ede6",
1252
+ clearcoat: 0.8,
1253
+ clearcoatRoughness: 0.05
1254
+ },
1255
+ enamel: {
1256
+ roughness: 0.1,
1257
+ metalness: 0,
1258
+ clearcoat: 0.9,
1259
+ clearcoatRoughness: 0.03
1260
+ },
1261
+ // ===========================================================================
1262
+ // IRIDESCENT — thin-film interference
1263
+ // ===========================================================================
1264
+ soap_bubble: {
1265
+ roughness: 0,
1266
+ metalness: 0,
1267
+ transmission: 0.9,
1268
+ ior: 1.33,
1269
+ transparent: true,
1270
+ opacity: 0.3,
1271
+ iridescence: 1,
1272
+ iridescenceIOR: 1.5
1273
+ },
1274
+ oil_slick: {
1275
+ roughness: 0,
1276
+ metalness: 0.1,
1277
+ color: "#1a1a2e",
1278
+ iridescence: 1,
1279
+ iridescenceIOR: 1.8
1280
+ },
1281
+ beetle_shell: {
1282
+ roughness: 0.2,
1283
+ metalness: 0.3,
1284
+ color: "#0a3d0a",
1285
+ iridescence: 0.8,
1286
+ iridescenceIOR: 1.6,
1287
+ clearcoat: 0.5,
1288
+ clearcoatRoughness: 0.1
1289
+ },
1290
+ pearl: {
1291
+ roughness: 0.15,
1292
+ metalness: 0,
1293
+ color: "#fdeef4",
1294
+ iridescence: 0.6,
1295
+ iridescenceIOR: 1.3,
1296
+ sheen: 0.3,
1297
+ sheenRoughness: 0.2,
1298
+ sheenColor: "#fff0f5"
1299
+ },
1300
+ abalone: {
1301
+ roughness: 0.1,
1302
+ metalness: 0.1,
1303
+ color: "#e0f0e8",
1304
+ iridescence: 1,
1305
+ iridescenceIOR: 1.5
1306
+ },
1307
+ // ===========================================================================
1308
+ // GEMSTONES — transmission + IOR + iridescence
1309
+ // ===========================================================================
1310
+ diamond: {
1311
+ roughness: 0,
1312
+ metalness: 0,
1313
+ color: "#ffffff",
1314
+ transmission: 0.95,
1315
+ ior: 2.417,
1316
+ thickness: 0.5,
1317
+ transparent: true
1318
+ },
1319
+ ruby: {
1320
+ roughness: 0.05,
1321
+ metalness: 0,
1322
+ color: "#e0115f",
1323
+ transmission: 0.4,
1324
+ ior: 1.76,
1325
+ thickness: 1
1326
+ },
1327
+ sapphire: {
1328
+ roughness: 0.05,
1329
+ metalness: 0,
1330
+ color: "#0f52ba",
1331
+ transmission: 0.4,
1332
+ ior: 1.77,
1333
+ thickness: 1
1334
+ },
1335
+ emerald: {
1336
+ roughness: 0.1,
1337
+ metalness: 0,
1338
+ color: "#50c878",
1339
+ transmission: 0.3,
1340
+ ior: 1.57,
1341
+ thickness: 1.2
1342
+ },
1343
+ amber: {
1344
+ roughness: 0.1,
1345
+ metalness: 0,
1346
+ color: "#ffbf00",
1347
+ transmission: 0.6,
1348
+ ior: 1.55,
1349
+ thickness: 2,
1350
+ transparent: true,
1351
+ attenuationColor: "#cc6600",
1352
+ attenuationDistance: 1
1353
+ },
1354
+ opal: {
1355
+ roughness: 0.15,
1356
+ metalness: 0,
1357
+ color: "#e8e0d0",
1358
+ iridescence: 0.9,
1359
+ iridescenceIOR: 1.45,
1360
+ transmission: 0.1,
1361
+ ior: 1.45
1362
+ },
1363
+ amethyst: {
1364
+ roughness: 0.05,
1365
+ metalness: 0,
1366
+ color: "#9966cc",
1367
+ transmission: 0.5,
1368
+ ior: 1.54,
1369
+ thickness: 1,
1370
+ transparent: true
1371
+ },
1372
+ topaz: {
1373
+ roughness: 0.02,
1374
+ metalness: 0,
1375
+ color: "#ffc87c",
1376
+ transmission: 0.7,
1377
+ ior: 1.63,
1378
+ thickness: 0.8,
1379
+ transparent: true
1380
+ },
1381
+ turquoise: {
1382
+ roughness: 0.6,
1383
+ metalness: 0,
1384
+ color: "#40e0d0"
1385
+ },
1386
+ lapis_lazuli: {
1387
+ roughness: 0.4,
1388
+ metalness: 0,
1389
+ color: "#26619c",
1390
+ clearcoat: 0.3,
1391
+ clearcoatRoughness: 0.1
1392
+ },
1393
+ // ===========================================================================
1394
+ // MORE METALS — extended metallic palette
1395
+ // ===========================================================================
1396
+ titanium: {
1397
+ roughness: 0.25,
1398
+ metalness: 1,
1399
+ color: "#878681"
1400
+ },
1401
+ tungsten: {
1402
+ roughness: 0.3,
1403
+ metalness: 1,
1404
+ color: "#696969"
1405
+ },
1406
+ tin: {
1407
+ roughness: 0.35,
1408
+ metalness: 1,
1409
+ color: "#b0b0b0",
1410
+ envMapIntensity: 0.8
1411
+ },
1412
+ lead: {
1413
+ roughness: 0.6,
1414
+ metalness: 0.9,
1415
+ color: "#595959"
1416
+ },
1417
+ brass: {
1418
+ roughness: 0.35,
1419
+ metalness: 1,
1420
+ color: "#b5a642"
1421
+ },
1422
+ wrought_iron: {
1423
+ roughness: 0.7,
1424
+ metalness: 0.85,
1425
+ color: "#2c2c2c"
1426
+ },
1427
+ mercury: {
1428
+ roughness: 0,
1429
+ metalness: 1,
1430
+ color: "#d4d4d4",
1431
+ envMapIntensity: 2
1432
+ },
1433
+ // ===========================================================================
1434
+ // NATURAL / WEATHER — environmental surfaces
1435
+ // ===========================================================================
1436
+ snow: {
1437
+ roughness: 0.8,
1438
+ metalness: 0,
1439
+ color: "#f0f8ff",
1440
+ thickness: 0.5,
1441
+ attenuationColor: "#c8e0ff",
1442
+ attenuationDistance: 2
1443
+ },
1444
+ fresh_snow: {
1445
+ roughness: 0.6,
1446
+ metalness: 0,
1447
+ color: "#ffffff",
1448
+ sheen: 0.3,
1449
+ sheenRoughness: 0.5,
1450
+ sheenColor: "#e8f0ff"
1451
+ },
1452
+ frost: {
1453
+ roughness: 0.3,
1454
+ metalness: 0,
1455
+ color: "#e8f4f8",
1456
+ transmission: 0.15,
1457
+ ior: 1.31,
1458
+ clearcoat: 0.4,
1459
+ clearcoatRoughness: 0.1
1460
+ },
1461
+ ice: {
1462
+ roughness: 0.1,
1463
+ metalness: 0,
1464
+ color: "#d6eaf8",
1465
+ transmission: 0.8,
1466
+ ior: 1.31,
1467
+ transparent: true
1468
+ },
1469
+ moss: {
1470
+ roughness: 1,
1471
+ metalness: 0,
1472
+ color: "#4a7c3f",
1473
+ sheen: 0.2,
1474
+ sheenRoughness: 1,
1475
+ sheenColor: "#5a9c4f"
1476
+ },
1477
+ lichen: {
1478
+ roughness: 0.9,
1479
+ metalness: 0,
1480
+ color: "#8fa37a"
1481
+ },
1482
+ bark: {
1483
+ roughness: 0.95,
1484
+ metalness: 0,
1485
+ color: "#5c4033"
1486
+ },
1487
+ dried_leaves: {
1488
+ roughness: 0.9,
1489
+ metalness: 0,
1490
+ color: "#8b6914",
1491
+ thickness: 0.1,
1492
+ attenuationColor: "#664400",
1493
+ attenuationDistance: 0.3
1494
+ },
1495
+ // ===========================================================================
1496
+ // AGED / WEATHERED — patina, tarnish, wear
1497
+ // ===========================================================================
1498
+ patina: {
1499
+ roughness: 0.6,
1500
+ metalness: 0.4,
1501
+ color: "#4a9c7e"
1502
+ },
1503
+ tarnished_silver: {
1504
+ roughness: 0.5,
1505
+ metalness: 0.7,
1506
+ color: "#8a8a7a"
1507
+ },
1508
+ aged_bronze: {
1509
+ roughness: 0.55,
1510
+ metalness: 0.6,
1511
+ color: "#6b8e5a"
1512
+ },
1513
+ weathered_wood: {
1514
+ roughness: 0.95,
1515
+ metalness: 0,
1516
+ color: "#8a8070"
1517
+ },
1518
+ cracked_paint: {
1519
+ roughness: 0.8,
1520
+ metalness: 0,
1521
+ color: "#c8c0b0"
1522
+ },
1523
+ oxidized_copper: {
1524
+ roughness: 0.65,
1525
+ metalness: 0.5,
1526
+ color: "#2e8b57"
1527
+ },
1528
+ // ===========================================================================
1529
+ // CONSTRUCTION — architectural materials
1530
+ // ===========================================================================
1531
+ asphalt: {
1532
+ roughness: 0.9,
1533
+ metalness: 0,
1534
+ color: "#3a3a3a"
1535
+ },
1536
+ cement: {
1537
+ roughness: 0.85,
1538
+ metalness: 0,
1539
+ color: "#a0a0a0"
1540
+ },
1541
+ tile_ceramic: {
1542
+ roughness: 0.2,
1543
+ metalness: 0,
1544
+ color: "#e8e0d0",
1545
+ clearcoat: 0.6,
1546
+ clearcoatRoughness: 0.05
1547
+ },
1548
+ tile_porcelain: {
1549
+ roughness: 0.1,
1550
+ metalness: 0,
1551
+ color: "#f5f5f5",
1552
+ clearcoat: 0.8,
1553
+ clearcoatRoughness: 0.02
1554
+ },
1555
+ linoleum: {
1556
+ roughness: 0.6,
1557
+ metalness: 0,
1558
+ color: "#c0b090",
1559
+ clearcoat: 0.2,
1560
+ clearcoatRoughness: 0.3
1561
+ },
1562
+ drywall: {
1563
+ roughness: 1,
1564
+ metalness: 0,
1565
+ color: "#f0ece0"
1566
+ },
1567
+ rebar: {
1568
+ roughness: 0.6,
1569
+ metalness: 0.9,
1570
+ color: "#5a4a3a"
1571
+ },
1572
+ stucco: {
1573
+ roughness: 0.95,
1574
+ metalness: 0,
1575
+ color: "#e8dcc8"
1576
+ },
1577
+ gravel: {
1578
+ roughness: 1,
1579
+ metalness: 0.02,
1580
+ color: "#8a8070"
1581
+ },
1582
+ // ===========================================================================
1583
+ // LEATHER VARIANTS — sheen + clearcoat differentiation
1584
+ // ===========================================================================
1585
+ suede: {
1586
+ roughness: 1,
1587
+ metalness: 0,
1588
+ color: "#8b6914",
1589
+ sheen: 0.6,
1590
+ sheenRoughness: 1,
1591
+ sheenColor: "#a07828"
1592
+ },
1593
+ patent_leather: {
1594
+ roughness: 0.05,
1595
+ metalness: 0,
1596
+ color: "#1a1a1a",
1597
+ clearcoat: 1,
1598
+ clearcoatRoughness: 0.02
1599
+ },
1600
+ distressed_leather: {
1601
+ roughness: 0.8,
1602
+ metalness: 0,
1603
+ color: "#5a3a1a",
1604
+ sheen: 0.15,
1605
+ sheenRoughness: 0.8,
1606
+ sheenColor: "#4a3010"
1607
+ },
1608
+ nubuck: {
1609
+ roughness: 0.95,
1610
+ metalness: 0,
1611
+ color: "#c8a882",
1612
+ sheen: 0.5,
1613
+ sheenRoughness: 0.9,
1614
+ sheenColor: "#d4b892"
1615
+ },
1616
+ // ===========================================================================
1617
+ // RUBBER VARIANTS
1618
+ // ===========================================================================
1619
+ tire_rubber: {
1620
+ roughness: 0.85,
1621
+ metalness: 0,
1622
+ color: "#1a1a1a"
1623
+ },
1624
+ silicone: {
1625
+ roughness: 0.6,
1626
+ metalness: 0,
1627
+ color: "#e0e0e0",
1628
+ thickness: 0.5,
1629
+ attenuationColor: "#cccccc",
1630
+ attenuationDistance: 1,
1631
+ transmission: 0.05
1632
+ },
1633
+ latex: {
1634
+ roughness: 0.3,
1635
+ metalness: 0,
1636
+ color: "#ffefd5",
1637
+ clearcoat: 0.5,
1638
+ clearcoatRoughness: 0.1,
1639
+ thickness: 0.3,
1640
+ attenuationColor: "#ffcc88",
1641
+ attenuationDistance: 0.5
1642
+ },
1643
+ eraser: {
1644
+ roughness: 0.95,
1645
+ metalness: 0,
1646
+ color: "#ff6b81"
1647
+ },
1648
+ // ===========================================================================
1649
+ // LIQUIDS — transmission + animated surface hints
1650
+ // ===========================================================================
1651
+ lava: {
1652
+ roughness: 0.8,
1653
+ metalness: 0,
1654
+ color: "#ff4400",
1655
+ emissive: "#ff2200",
1656
+ emissiveIntensity: 3
1657
+ },
1658
+ blood: {
1659
+ roughness: 0.2,
1660
+ metalness: 0,
1661
+ color: "#8b0000",
1662
+ clearcoat: 0.7,
1663
+ clearcoatRoughness: 0.05,
1664
+ thickness: 1,
1665
+ attenuationColor: "#440000",
1666
+ attenuationDistance: 0.3
1667
+ },
1668
+ oil_liquid: {
1669
+ roughness: 0.05,
1670
+ metalness: 0,
1671
+ color: "#1a1a0a",
1672
+ clearcoat: 0.9,
1673
+ clearcoatRoughness: 0.02
1674
+ },
1675
+ molten_metal: {
1676
+ roughness: 0.15,
1677
+ metalness: 0.8,
1678
+ color: "#ff8c00",
1679
+ emissive: "#ff6600",
1680
+ emissiveIntensity: 5
1681
+ },
1682
+ syrup: {
1683
+ roughness: 0.1,
1684
+ metalness: 0,
1685
+ color: "#8b4513",
1686
+ transmission: 0.4,
1687
+ ior: 1.49,
1688
+ thickness: 2,
1689
+ attenuationColor: "#663300",
1690
+ attenuationDistance: 0.5
1691
+ },
1692
+ // ===========================================================================
1693
+ // BLACKBODY / THERMAL — temperature-driven emission
1694
+ // ===========================================================================
1695
+ heated_metal_low: {
1696
+ roughness: 0.5,
1697
+ metalness: 0.9,
1698
+ color: "#4a4a4a",
1699
+ emissive: "#ff1a00",
1700
+ emissiveIntensity: 1.5
1701
+ },
1702
+ heated_metal_mid: {
1703
+ roughness: 0.4,
1704
+ metalness: 0.8,
1705
+ color: "#5a5a5a",
1706
+ emissive: "#ff6600",
1707
+ emissiveIntensity: 3
1708
+ },
1709
+ heated_metal_hot: {
1710
+ roughness: 0.3,
1711
+ metalness: 0.7,
1712
+ color: "#6a6a6a",
1713
+ emissive: "#ffcc00",
1714
+ emissiveIntensity: 5
1715
+ },
1716
+ heated_metal_white: {
1717
+ roughness: 0.2,
1718
+ metalness: 0.6,
1719
+ color: "#8a8a8a",
1720
+ emissive: "#ffffff",
1721
+ emissiveIntensity: 8
1722
+ },
1723
+ ember: {
1724
+ roughness: 0.9,
1725
+ metalness: 0,
1726
+ color: "#2a0a00",
1727
+ emissive: "#ff4400",
1728
+ emissiveIntensity: 2
1729
+ },
1730
+ coal: {
1731
+ roughness: 0.85,
1732
+ metalness: 0,
1733
+ color: "#1a1a1a",
1734
+ emissive: "#cc2200",
1735
+ emissiveIntensity: 0.5
1736
+ },
1737
+ // ===========================================================================
1738
+ // SPECIAL EFFECTS — sparkle, glow, energy
1739
+ // ===========================================================================
1740
+ glitter: {
1741
+ roughness: 0.2,
1742
+ metalness: 0.8,
1743
+ color: "#ffd700",
1744
+ envMapIntensity: 2
1745
+ },
1746
+ sequin: {
1747
+ roughness: 0.05,
1748
+ metalness: 1,
1749
+ envMapIntensity: 2.5,
1750
+ iridescence: 0.3
1751
+ },
1752
+ mica: {
1753
+ roughness: 0.3,
1754
+ metalness: 0.2,
1755
+ color: "#c8b888",
1756
+ iridescence: 0.4,
1757
+ iridescenceIOR: 1.58,
1758
+ sheen: 0.2,
1759
+ sheenRoughness: 0.3,
1760
+ sheenColor: "#d4c498"
1761
+ },
1762
+ fluorescent_green: {
1763
+ roughness: 0.5,
1764
+ metalness: 0,
1765
+ color: "#39ff14",
1766
+ emissive: "#39ff14",
1767
+ emissiveIntensity: 1.5
1768
+ },
1769
+ fluorescent_orange: {
1770
+ roughness: 0.5,
1771
+ metalness: 0,
1772
+ color: "#ff6700",
1773
+ emissive: "#ff6700",
1774
+ emissiveIntensity: 1.5
1775
+ },
1776
+ fluorescent_pink: {
1777
+ roughness: 0.5,
1778
+ metalness: 0,
1779
+ color: "#ff1493",
1780
+ emissive: "#ff1493",
1781
+ emissiveIntensity: 1.5
1782
+ },
1783
+ glow_in_dark: {
1784
+ roughness: 0.7,
1785
+ metalness: 0,
1786
+ color: "#2a3a2a",
1787
+ emissive: "#44ff44",
1788
+ emissiveIntensity: 0.8
1789
+ },
1790
+ plasma: {
1791
+ roughness: 0,
1792
+ metalness: 0,
1793
+ color: "#4400ff",
1794
+ emissive: "#8844ff",
1795
+ emissiveIntensity: 4,
1796
+ transparent: true,
1797
+ opacity: 0.7
1798
+ },
1799
+ energy_field: {
1800
+ roughness: 0,
1801
+ metalness: 0,
1802
+ emissive: "#00ccff",
1803
+ emissiveIntensity: 3,
1804
+ transparent: true,
1805
+ opacity: 0.4,
1806
+ transmission: 0.6
1807
+ },
1808
+ force_field: {
1809
+ roughness: 0,
1810
+ metalness: 0,
1811
+ emissive: "#00ff88",
1812
+ emissiveIntensity: 2,
1813
+ transparent: true,
1814
+ opacity: 0.2,
1815
+ iridescence: 0.8,
1816
+ iridescenceIOR: 1.5
1817
+ },
1818
+ // ===========================================================================
1819
+ // RETROREFLECTIVE — safety, signage
1820
+ // ===========================================================================
1821
+ safety_vest: {
1822
+ roughness: 0.6,
1823
+ metalness: 0,
1824
+ color: "#ccff00",
1825
+ emissive: "#ccff00",
1826
+ emissiveIntensity: 0.3
1827
+ },
1828
+ road_sign: {
1829
+ roughness: 0.4,
1830
+ metalness: 0.1,
1831
+ color: "#ffffff",
1832
+ envMapIntensity: 1.8,
1833
+ emissive: "#ffffff",
1834
+ emissiveIntensity: 0.2
1835
+ },
1836
+ reflective_tape: {
1837
+ roughness: 0.2,
1838
+ metalness: 0.3,
1839
+ color: "#e0e0e0",
1840
+ envMapIntensity: 2.5
1841
+ },
1842
+ // ===========================================================================
1843
+ // MISC — everything else in the real world
1844
+ // ===========================================================================
1845
+ chalkboard: {
1846
+ roughness: 0.9,
1847
+ metalness: 0,
1848
+ color: "#2a3a2a"
1849
+ },
1850
+ chalk: {
1851
+ roughness: 1,
1852
+ metalness: 0,
1853
+ color: "#ffffff"
1854
+ },
1855
+ charcoal: {
1856
+ roughness: 0.9,
1857
+ metalness: 0,
1858
+ color: "#1a1a1a"
1859
+ },
1860
+ cork: {
1861
+ roughness: 0.95,
1862
+ metalness: 0,
1863
+ color: "#b88a50"
1864
+ },
1865
+ felt: {
1866
+ roughness: 1,
1867
+ metalness: 0,
1868
+ color: "#5a8a5a",
1869
+ sheen: 0.4,
1870
+ sheenRoughness: 1,
1871
+ sheenColor: "#6a9a6a"
1872
+ },
1873
+ sponge: {
1874
+ roughness: 1,
1875
+ metalness: 0,
1876
+ color: "#e8c840"
1877
+ },
1878
+ porcelain: {
1879
+ roughness: 0.1,
1880
+ metalness: 0,
1881
+ color: "#f8f4f0",
1882
+ clearcoat: 0.7,
1883
+ clearcoatRoughness: 0.02
1884
+ },
1885
+ terracotta: {
1886
+ roughness: 0.85,
1887
+ metalness: 0,
1888
+ color: "#cc6644"
1889
+ },
1890
+ concrete_polished: {
1891
+ roughness: 0.3,
1892
+ metalness: 0,
1893
+ color: "#a0a0a0",
1894
+ clearcoat: 0.3,
1895
+ clearcoatRoughness: 0.15
1896
+ },
1897
+ rope: {
1898
+ roughness: 1,
1899
+ metalness: 0,
1900
+ color: "#c4a35a",
1901
+ sheen: 0.2,
1902
+ sheenRoughness: 1,
1903
+ sheenColor: "#b89848"
1904
+ },
1905
+ wicker: {
1906
+ roughness: 0.9,
1907
+ metalness: 0,
1908
+ color: "#a08050"
1909
+ },
1910
+ parchment: {
1911
+ roughness: 0.8,
1912
+ metalness: 0,
1913
+ color: "#f0e6c8",
1914
+ thickness: 0.1,
1915
+ attenuationColor: "#d4c0a0",
1916
+ attenuationDistance: 0.2
1917
+ },
1918
+ // ===========================================================================
1919
+ // ANIMATED MATERIALS — time-driven surface effects (wired to scene.time)
1920
+ // These set metadata flags that the runtime uses to drive animated shaders.
1921
+ // ===========================================================================
1922
+ flowing_water: {
1923
+ roughness: 0,
1924
+ metalness: 0,
1925
+ color: "#006994",
1926
+ transmission: 0.85,
1927
+ ior: 1.33,
1928
+ transparent: true,
1929
+ _animated: { pattern: "flow", speed: 0.8, amplitude: 0.3 }
1930
+ },
1931
+ rippling_water: {
1932
+ roughness: 0.05,
1933
+ metalness: 0,
1934
+ color: "#005577",
1935
+ transmission: 0.8,
1936
+ ior: 1.33,
1937
+ transparent: true,
1938
+ _animated: { pattern: "ripple", speed: 1, amplitude: 0.4 }
1939
+ },
1940
+ flickering_fire: {
1941
+ roughness: 0.8,
1942
+ metalness: 0,
1943
+ color: "#ff4400",
1944
+ emissive: "#ff2200",
1945
+ emissiveIntensity: 3,
1946
+ _animated: { pattern: "flicker", speed: 3, amplitude: 0.6 }
1947
+ },
1948
+ pulsing_glow: {
1949
+ roughness: 0.5,
1950
+ metalness: 0,
1951
+ emissive: "#00ff88",
1952
+ emissiveIntensity: 2,
1953
+ _animated: { pattern: "pulse", speed: 1.5, amplitude: 0.5 }
1954
+ },
1955
+ breathing_light: {
1956
+ roughness: 0.3,
1957
+ metalness: 0,
1958
+ emissive: "#4488ff",
1959
+ emissiveIntensity: 1.5,
1960
+ _animated: { pattern: "breathe", speed: 0.5, amplitude: 0.8 }
1961
+ },
1962
+ scrolling_lava: {
1963
+ roughness: 0.8,
1964
+ metalness: 0,
1965
+ color: "#ff4400",
1966
+ emissive: "#ff2200",
1967
+ emissiveIntensity: 4,
1968
+ _animated: { pattern: "scroll", speed: 0.3, amplitude: 1 }
1969
+ },
1970
+ waving_grass: {
1971
+ roughness: 0.9,
1972
+ metalness: 0,
1973
+ color: "#228b22",
1974
+ sheen: 0.2,
1975
+ sheenRoughness: 0.8,
1976
+ sheenColor: "#44cc22",
1977
+ _animated: { pattern: "wave", speed: 0.8, amplitude: 0.2 }
1978
+ },
1979
+ flickering_neon: {
1980
+ roughness: 0,
1981
+ metalness: 0,
1982
+ emissive: "#ff00ff",
1983
+ emissiveIntensity: 3.5,
1984
+ transparent: true,
1985
+ opacity: 0.9,
1986
+ _animated: { pattern: "flicker", speed: 5, amplitude: 0.4 }
1987
+ },
1988
+ pulsing_crystal: {
1989
+ roughness: 0,
1990
+ metalness: 0.1,
1991
+ transmission: 0.8,
1992
+ ior: 2,
1993
+ iridescence: 0.8,
1994
+ iridescenceIOR: 1.3,
1995
+ emissive: "#8844ff",
1996
+ emissiveIntensity: 1,
1997
+ _animated: { pattern: "pulse", speed: 0.8, amplitude: 0.6 }
1998
+ },
1999
+ animated_hologram: {
2000
+ roughness: 0,
2001
+ metalness: 0.3,
2002
+ transparent: true,
2003
+ opacity: 0.5,
2004
+ emissive: "#00ccff",
2005
+ emissiveIntensity: 1.5,
2006
+ _animated: { pattern: "scroll", speed: 1.5, amplitude: 0.3 }
2007
+ },
2008
+ boiling_surface: {
2009
+ roughness: 0.7,
2010
+ metalness: 0,
2011
+ color: "#cc4400",
2012
+ emissive: "#ff6600",
2013
+ emissiveIntensity: 2,
2014
+ _animated: { pattern: "noise", speed: 2, amplitude: 0.5 }
2015
+ },
2016
+ shimmer_heat: {
2017
+ roughness: 0,
2018
+ metalness: 0,
2019
+ transparent: true,
2020
+ opacity: 0.15,
2021
+ _animated: { pattern: "wave", speed: 2, amplitude: 0.1 }
2022
+ },
2023
+ // ===========================================================================
2024
+ // VOLUMETRIC MATERIALS — metadata for ray-marched volume rendering
2025
+ // These presets describe volumetric phenomena; the runtime renders them via
2026
+ // a ray marching pass on a bounding box/sphere geometry.
2027
+ // ===========================================================================
2028
+ fog: {
2029
+ roughness: 0,
2030
+ metalness: 0,
2031
+ color: "#c0c0c0",
2032
+ transparent: true,
2033
+ opacity: 0.3,
2034
+ _volumetric: { type: "fog", density: 0.3, scattering: 0.8, absorption: 0.05 }
2035
+ },
2036
+ dense_fog: {
2037
+ roughness: 0,
2038
+ metalness: 0,
2039
+ color: "#a0a0a0",
2040
+ transparent: true,
2041
+ opacity: 0.5,
2042
+ _volumetric: { type: "fog", density: 0.7, scattering: 0.9, absorption: 0.1 }
2043
+ },
2044
+ smoke: {
2045
+ roughness: 0,
2046
+ metalness: 0,
2047
+ color: "#404040",
2048
+ transparent: true,
2049
+ opacity: 0.4,
2050
+ _volumetric: {
2051
+ type: "smoke",
2052
+ density: 0.5,
2053
+ scattering: 0.3,
2054
+ absorption: 0.4,
2055
+ riseSpeed: 0.5,
2056
+ turbulence: 0.6
2057
+ }
2058
+ },
2059
+ campfire_smoke: {
2060
+ roughness: 0,
2061
+ metalness: 0,
2062
+ color: "#505050",
2063
+ transparent: true,
2064
+ opacity: 0.35,
2065
+ _volumetric: {
2066
+ type: "smoke",
2067
+ density: 0.4,
2068
+ scattering: 0.25,
2069
+ absorption: 0.5,
2070
+ riseSpeed: 0.8,
2071
+ turbulence: 0.4
2072
+ }
2073
+ },
2074
+ fire_volume: {
2075
+ roughness: 0,
2076
+ metalness: 0,
2077
+ color: "#ff4400",
2078
+ emissive: "#ff2200",
2079
+ emissiveIntensity: 4,
2080
+ transparent: true,
2081
+ opacity: 0.7,
2082
+ _volumetric: {
2083
+ type: "fire",
2084
+ density: 0.6,
2085
+ scattering: 0.1,
2086
+ absorption: 0.2,
2087
+ riseSpeed: 1.2,
2088
+ turbulence: 0.7,
2089
+ temperature: 2500
2090
+ }
2091
+ },
2092
+ candle_flame: {
2093
+ roughness: 0,
2094
+ metalness: 0,
2095
+ color: "#ffaa33",
2096
+ emissive: "#ff8800",
2097
+ emissiveIntensity: 3,
2098
+ transparent: true,
2099
+ opacity: 0.6,
2100
+ _volumetric: {
2101
+ type: "fire",
2102
+ density: 0.4,
2103
+ scattering: 0.05,
2104
+ absorption: 0.1,
2105
+ riseSpeed: 0.3,
2106
+ turbulence: 0.2,
2107
+ temperature: 1800
2108
+ }
2109
+ },
2110
+ clouds: {
2111
+ roughness: 0,
2112
+ metalness: 0,
2113
+ color: "#ffffff",
2114
+ transparent: true,
2115
+ opacity: 0.6,
2116
+ _volumetric: {
2117
+ type: "clouds",
2118
+ density: 0.4,
2119
+ scattering: 0.95,
2120
+ absorption: 0.02,
2121
+ noiseScale: 2,
2122
+ octaves: 6
2123
+ }
2124
+ },
2125
+ storm_clouds: {
2126
+ roughness: 0,
2127
+ metalness: 0,
2128
+ color: "#3a3a4a",
2129
+ transparent: true,
2130
+ opacity: 0.8,
2131
+ _volumetric: {
2132
+ type: "clouds",
2133
+ density: 0.7,
2134
+ scattering: 0.6,
2135
+ absorption: 0.15,
2136
+ noiseScale: 1.5,
2137
+ octaves: 6
2138
+ }
2139
+ },
2140
+ dust_motes: {
2141
+ roughness: 0,
2142
+ metalness: 0,
2143
+ color: "#c8b888",
2144
+ transparent: true,
2145
+ opacity: 0.15,
2146
+ _volumetric: { type: "dust", density: 0.1, scattering: 0.5, absorption: 0.02 }
2147
+ },
2148
+ mist: {
2149
+ roughness: 0,
2150
+ metalness: 0,
2151
+ color: "#e0e8f0",
2152
+ transparent: true,
2153
+ opacity: 0.25,
2154
+ _volumetric: {
2155
+ type: "mist",
2156
+ density: 0.2,
2157
+ scattering: 0.85,
2158
+ absorption: 0.03,
2159
+ heightFalloff: 1.5
2160
+ }
2161
+ },
2162
+ steam: {
2163
+ roughness: 0,
2164
+ metalness: 0,
2165
+ color: "#e8e8e8",
2166
+ transparent: true,
2167
+ opacity: 0.3,
2168
+ _volumetric: {
2169
+ type: "steam",
2170
+ density: 0.35,
2171
+ scattering: 0.7,
2172
+ absorption: 0.05,
2173
+ riseSpeed: 1,
2174
+ turbulence: 0.3
2175
+ }
2176
+ },
2177
+ aurora_borealis: {
2178
+ roughness: 0,
2179
+ metalness: 0,
2180
+ emissive: "#00ff88",
2181
+ emissiveIntensity: 2,
2182
+ transparent: true,
2183
+ opacity: 0.3,
2184
+ _volumetric: {
2185
+ type: "aurora",
2186
+ density: 0.15,
2187
+ scattering: 0.1,
2188
+ absorption: 0.01,
2189
+ emissionIntensity: 2
2190
+ }
2191
+ },
2192
+ nebula: {
2193
+ roughness: 0,
2194
+ metalness: 0,
2195
+ emissive: "#ff44aa",
2196
+ emissiveIntensity: 1.5,
2197
+ transparent: true,
2198
+ opacity: 0.4,
2199
+ _volumetric: {
2200
+ type: "nebula",
2201
+ density: 0.25,
2202
+ scattering: 0.3,
2203
+ absorption: 0.05,
2204
+ emissionIntensity: 1.5,
2205
+ noiseScale: 1
2206
+ }
2207
+ },
2208
+ underwater_caustics: {
2209
+ roughness: 0,
2210
+ metalness: 0,
2211
+ color: "#003366",
2212
+ transparent: true,
2213
+ opacity: 0.2,
2214
+ _volumetric: { type: "underwater", density: 0.15, scattering: 0.6, absorption: 0.1 }
2215
+ },
2216
+ god_rays: {
2217
+ roughness: 0,
2218
+ metalness: 0,
2219
+ color: "#ffffd0",
2220
+ transparent: true,
2221
+ opacity: 0.15,
2222
+ emissive: "#ffff88",
2223
+ emissiveIntensity: 0.5,
2224
+ _volumetric: { type: "god_rays", density: 0.1, scattering: 0.9, absorption: 0.01 }
2225
+ },
2226
+ neon_gas: {
2227
+ roughness: 0,
2228
+ metalness: 0,
2229
+ emissive: "#ff4400",
2230
+ emissiveIntensity: 3,
2231
+ transparent: true,
2232
+ opacity: 0.5,
2233
+ _volumetric: {
2234
+ type: "neon_gas",
2235
+ density: 0.3,
2236
+ scattering: 0.2,
2237
+ absorption: 0.05,
2238
+ emissionIntensity: 3
2239
+ }
2240
+ },
2241
+ explosion: {
2242
+ roughness: 0,
2243
+ metalness: 0,
2244
+ color: "#ff6600",
2245
+ emissive: "#ff4400",
2246
+ emissiveIntensity: 6,
2247
+ transparent: true,
2248
+ opacity: 0.8,
2249
+ _volumetric: {
2250
+ type: "fire",
2251
+ density: 0.8,
2252
+ scattering: 0.15,
2253
+ absorption: 0.3,
2254
+ riseSpeed: 2,
2255
+ turbulence: 1,
2256
+ temperature: 4e3
2257
+ }
2258
+ },
2259
+ toxic_gas: {
2260
+ roughness: 0,
2261
+ metalness: 0,
2262
+ color: "#44cc00",
2263
+ emissive: "#33aa00",
2264
+ emissiveIntensity: 1,
2265
+ transparent: true,
2266
+ opacity: 0.35,
2267
+ _volumetric: {
2268
+ type: "smoke",
2269
+ density: 0.3,
2270
+ scattering: 0.4,
2271
+ absorption: 0.2,
2272
+ riseSpeed: 0.2,
2273
+ turbulence: 0.3
2274
+ }
2275
+ },
2276
+ magical_mist: {
2277
+ roughness: 0,
2278
+ metalness: 0,
2279
+ emissive: "#8844ff",
2280
+ emissiveIntensity: 1.5,
2281
+ transparent: true,
2282
+ opacity: 0.3,
2283
+ iridescence: 0.6,
2284
+ iridescenceIOR: 1.5,
2285
+ _volumetric: {
2286
+ type: "mist",
2287
+ density: 0.2,
2288
+ scattering: 0.5,
2289
+ absorption: 0.03,
2290
+ emissionIntensity: 1.5
2291
+ }
2292
+ },
2293
+ // --- Architectural & Natural Stone ---
2294
+ brick: { roughness: 0.9, metalness: 0, color: "#a6523c" },
2295
+ concrete: { roughness: 0.88, metalness: 0, color: "#8a8a8a" },
2296
+ granite: { roughness: 0.6, metalness: 0, color: "#666670" },
2297
+ sandstone: { roughness: 0.85, metalness: 0, color: "#cca66e" },
2298
+ slate: { roughness: 0.7, metalness: 0, color: "#3f4450" },
2299
+ adobe: { roughness: 0.95, metalness: 0, color: "#bf9160" },
2300
+ plaster: { roughness: 0.82, metalness: 0, color: "#ebe8de" },
2301
+ // --- Plant & Cellulose ---
2302
+ bamboo: { roughness: 0.65, metalness: 0, color: "#b3a84d" },
2303
+ paper: { roughness: 0.9, metalness: 0, color: "#f3f0e5" },
2304
+ cardboard: { roughness: 0.88, metalness: 0, color: "#b88c58" },
2305
+ // --- Organic & Animal ---
2306
+ bone: { roughness: 0.7, metalness: 0, color: "#e0d4b5" },
2307
+ ivory: { roughness: 0.35, metalness: 0, color: "#f0e8c5", envMapIntensity: 0.4 },
2308
+ coral: { roughness: 0.75, metalness: 0, color: "#f2614d" },
2309
+ shell: {
2310
+ roughness: 0.25,
2311
+ metalness: 0.05,
2312
+ color: "#f5ede0",
2313
+ iridescence: 0.8,
2314
+ iridescenceIOR: 1.5,
2315
+ envMapIntensity: 0.6
2316
+ },
2317
+ thatch: { roughness: 0.95, metalness: 0, color: "#c0a84a" },
2318
+ // --- Synthetic & Engineered ---
2319
+ resin: {
2320
+ roughness: 0.08,
2321
+ metalness: 0,
2322
+ transmission: 0.75,
2323
+ ior: 1.5,
2324
+ color: "#e8c46a",
2325
+ transparent: true,
2326
+ opacity: 0.88
2327
+ },
2328
+ foam: { roughness: 0.95, metalness: 0, color: "#f0f0f0" },
2329
+ composite: { roughness: 0.5, metalness: 0.25, color: "#333338" },
2330
+ carbon_fiber: {
2331
+ roughness: 0.28,
2332
+ metalness: 0.6,
2333
+ color: "#111114",
2334
+ envMapIntensity: 1.2,
2335
+ clearcoat: 0.6,
2336
+ clearcoatRoughness: 0.1
2337
+ },
2338
+ kevlar: { roughness: 0.82, metalness: 0, color: "#ccbb66" },
2339
+ fiberglass: {
2340
+ roughness: 0.3,
2341
+ metalness: 0.05,
2342
+ transmission: 0.4,
2343
+ ior: 1.45,
2344
+ color: "#e0ede0",
2345
+ transparent: true,
2346
+ opacity: 0.92
2347
+ },
2348
+ stained_glass: {
2349
+ roughness: 0.05,
2350
+ metalness: 0,
2351
+ transmission: 0.85,
2352
+ ior: 1.52,
2353
+ color: "#cc44ff",
2354
+ transparent: true,
2355
+ opacity: 0.75,
2356
+ thickness: 0.3
2357
+ }
2358
+ };
2359
+ ENVIRONMENT_PRESETS = {
2360
+ forest_sunset: {
2361
+ background: true,
2362
+ envPreset: "sunset",
2363
+ fog: { color: "#ff9966", near: 10, far: 100 },
2364
+ ground: { color: "#2d5a27" },
2365
+ lighting: {
2366
+ ambient: { color: "#ffa366", intensity: 0.3 },
2367
+ directional: { color: "#ff7700", intensity: 1.5, position: [10, 20, 5], shadows: true }
2368
+ }
2369
+ },
2370
+ cyberpunk_city: {
2371
+ background: true,
2372
+ envPreset: "night",
2373
+ fog: { color: "#0a0020", near: 5, far: 60 },
2374
+ ground: { color: "#1a1a2e" },
2375
+ lighting: {
2376
+ ambient: { color: "#220044", intensity: 0.2 },
2377
+ directional: { color: "#ff00ff", intensity: 0.5, position: [5, 15, 5], shadows: true },
2378
+ points: [
2379
+ { color: "#00ffff", intensity: 3, position: [-5, 3, -5], distance: 15 },
2380
+ { color: "#ff00ff", intensity: 3, position: [5, 3, 5], distance: 15 }
2381
+ ]
2382
+ },
2383
+ postprocessing: { bloom: { intensity: 1.5, luminanceThreshold: 0.1 } }
2384
+ },
2385
+ space_void: {
2386
+ background: true,
2387
+ envPreset: "night",
2388
+ lighting: {
2389
+ ambient: { color: "#111133", intensity: 0.1 },
2390
+ directional: { color: "#ffffff", intensity: 0.5, position: [0, 10, 0], shadows: false }
2391
+ }
2392
+ },
2393
+ studio: {
2394
+ background: true,
2395
+ envPreset: "studio",
2396
+ ground: { color: "#cccccc" },
2397
+ lighting: {
2398
+ ambient: { color: "#ffffff", intensity: 0.4 },
2399
+ directional: { color: "#ffffff", intensity: 1, position: [5, 10, 5], shadows: true }
2400
+ }
2401
+ },
2402
+ underwater: {
2403
+ background: true,
2404
+ envPreset: "dawn",
2405
+ fog: { color: "#003366", near: 2, far: 40 },
2406
+ ground: { color: "#1a3a4a" },
2407
+ lighting: {
2408
+ ambient: { color: "#004488", intensity: 0.3 },
2409
+ directional: { color: "#66aacc", intensity: 0.8, position: [0, 20, 0], shadows: true }
2410
+ }
2411
+ },
2412
+ desert: {
2413
+ background: true,
2414
+ envPreset: "sunset",
2415
+ fog: { color: "#d4a574", near: 20, far: 150 },
2416
+ ground: { color: "#c4a35a" },
2417
+ lighting: {
2418
+ ambient: { color: "#f5deb3", intensity: 0.4 },
2419
+ directional: { color: "#ffffcc", intensity: 2, position: [15, 30, 10], shadows: true }
2420
+ }
2421
+ }
2422
+ };
2423
+ MESH_TYPES = /* @__PURE__ */ new Set([
2424
+ "orb",
2425
+ "sphere",
2426
+ "cube",
2427
+ "box",
2428
+ "cylinder",
2429
+ "pyramid",
2430
+ "cone",
2431
+ "plane",
2432
+ "torus",
2433
+ "ring",
2434
+ "capsule",
2435
+ "object",
2436
+ "avatar",
2437
+ "dna",
2438
+ "gaussian_splat",
2439
+ "splat",
2440
+ "nerf",
2441
+ "volumetric_video",
2442
+ // Procedural geometry types (hull/spline/membrane/blob/metaball)
2443
+ "hull",
2444
+ "spline",
2445
+ "membrane",
2446
+ "blob",
2447
+ "metaball"
2448
+ ]);
2449
+ UI_COMPONENT_PRESETS = {
2450
+ UIPanel: {
2451
+ component: "Container",
2452
+ // @react-three/uikit Container
2453
+ defaultProps: {
2454
+ flexDirection: "column",
2455
+ padding: 16,
2456
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
2457
+ borderRadius: 8
2458
+ }
2459
+ },
2460
+ UIText: {
2461
+ component: "Text",
2462
+ // @react-three/uikit Text
2463
+ defaultProps: {
2464
+ fontSize: 16,
2465
+ color: "white"
2466
+ }
2467
+ },
2468
+ UIButton: {
2469
+ component: "Button",
2470
+ // Custom button using Container with hover
2471
+ defaultProps: {
2472
+ padding: 12,
2473
+ paddingX: 24,
2474
+ backgroundColor: "#4a90d9",
2475
+ borderRadius: 4,
2476
+ cursor: "pointer"
2477
+ }
2478
+ },
2479
+ UISlider: {
2480
+ component: "Slider",
2481
+ // Custom slider implementation
2482
+ defaultProps: {
2483
+ width: 200,
2484
+ height: 20,
2485
+ trackColor: "#333",
2486
+ fillColor: "#4a90d9",
2487
+ thumbSize: 16
2488
+ }
2489
+ },
2490
+ UIInput: {
2491
+ component: "Input",
2492
+ // @react-three/uikit Input
2493
+ defaultProps: {
2494
+ width: 200,
2495
+ padding: 8,
2496
+ backgroundColor: "#222",
2497
+ borderColor: "#444",
2498
+ borderWidth: 1,
2499
+ borderRadius: 4,
2500
+ color: "white"
2501
+ }
2502
+ },
2503
+ UIImage: {
2504
+ component: "Image",
2505
+ // @react-three/uikit Image
2506
+ defaultProps: {
2507
+ objectFit: "contain"
2508
+ }
2509
+ },
2510
+ UIChart: {
2511
+ component: "Chart",
2512
+ // Custom chart component
2513
+ defaultProps: {
2514
+ width: 300,
2515
+ height: 200,
2516
+ backgroundColor: "#1a1a2e"
2517
+ }
2518
+ },
2519
+ UIGauge: {
2520
+ component: "Gauge",
2521
+ // Custom gauge component
2522
+ defaultProps: {
2523
+ size: 100,
2524
+ strokeWidth: 8,
2525
+ trackColor: "#333",
2526
+ fillColor: "#4a90d9"
2527
+ }
2528
+ }
2529
+ };
2530
+ QUALITY_TIER_SCALES = {
2531
+ low: {
2532
+ particleScale: 0.25,
2533
+ lodLevel: "draft",
2534
+ maxLights: 2,
2535
+ shadowMapSize: 512,
2536
+ shaderComplexity: "basic"
2537
+ },
2538
+ med: {
2539
+ particleScale: 0.6,
2540
+ lodLevel: "mesh",
2541
+ maxLights: 4,
2542
+ shadowMapSize: 1024,
2543
+ shaderComplexity: "standard"
2544
+ },
2545
+ high: {
2546
+ particleScale: 1,
2547
+ lodLevel: "final",
2548
+ maxLights: 8,
2549
+ shadowMapSize: 2048,
2550
+ shaderComplexity: "physical"
2551
+ },
2552
+ ultra: {
2553
+ particleScale: 1.5,
2554
+ lodLevel: "final",
2555
+ maxLights: 16,
2556
+ shadowMapSize: 4096,
2557
+ shaderComplexity: "physical"
2558
+ }
2559
+ };
2560
+ R3FCompiler = class {
2561
+ constructor(options = {}) {
2562
+ // ─── RBAC Enforcement ─────────────────────────────────────────────────
2563
+ this.compilerName = "R3FCompiler";
2564
+ this.rbac = getRBAC();
2565
+ this.qualityTier = options.qualityTier ?? "high";
2566
+ this.tierScales = QUALITY_TIER_SCALES[this.qualityTier];
2567
+ this._defaultLighting = options.defaultLighting ?? true;
2568
+ this._holomapPointCloud = options.holomapPointCloud;
2569
+ if (options.platformTarget) {
2570
+ this._platformTarget = typeof options.platformTarget === "string" ? createPlatformTarget(options.platformTarget) : options.platformTarget;
2571
+ }
2572
+ }
2573
+ /**
2574
+ * Validate agent permissions before compilation.
2575
+ * Skips validation when no token is provided (backwards compatibility).
2576
+ *
2577
+ * Checks:
2578
+ * 1. AST read access (can the agent read AST?)
2579
+ * 2. Code generation access (can the agent generate code?)
2580
+ * 3. Output path scope (if outputPath provided)
2581
+ *
2582
+ * @param agentToken - Agent JWT token (optional for backwards compat)
2583
+ * @param outputPath - Optional output file path for scope validation
2584
+ * @throws UnauthorizedCompilerAccessError if token is provided but invalid/unauthorized
2585
+ */
2586
+ validateCompilerAccess(agentToken, outputPath) {
2587
+ if (!agentToken) return;
2588
+ const astDecision = this.rbac.checkAccess({
2589
+ token: agentToken,
2590
+ resourceType: "ast" /* AST */,
2591
+ operation: "read",
2592
+ expectedWorkflowStep: "generate_assembly" /* GENERATE_ASSEMBLY */
2593
+ });
2594
+ if (!astDecision.allowed) {
2595
+ throw new UnauthorizedCompilerAccessError(astDecision, "AST access", this.compilerName);
2596
+ }
2597
+ const codeDecision = this.rbac.checkAccess({
2598
+ token: agentToken,
2599
+ resourceType: "code" /* CODE */,
2600
+ operation: "write",
2601
+ expectedWorkflowStep: "generate_assembly" /* GENERATE_ASSEMBLY */
2602
+ });
2603
+ if (!codeDecision.allowed) {
2604
+ throw new UnauthorizedCompilerAccessError(codeDecision, "code generation", this.compilerName);
2605
+ }
2606
+ if (outputPath) {
2607
+ const outputDecision = this.rbac.checkAccess({
2608
+ token: agentToken,
2609
+ resourceType: "output" /* OUTPUT */,
2610
+ operation: "write",
2611
+ resourcePath: outputPath,
2612
+ expectedWorkflowStep: "serialize" /* SERIALIZE */
2613
+ });
2614
+ if (!outputDecision.allowed) {
2615
+ throw new UnauthorizedCompilerAccessError(
2616
+ outputDecision,
2617
+ `output write to '${outputPath}'`,
2618
+ this.compilerName
2619
+ );
2620
+ }
2621
+ }
2622
+ }
2623
+ // ─── Spread Expansion Utility ─────────────────────────────────────────
2624
+ /**
2625
+ * Expands spread expressions in a properties object.
2626
+ * Spreads are stored with keys like `__spread_0`, `__spread_1` and have
2627
+ * the structure: { type: 'spread', argument: <value> }
2628
+ *
2629
+ * @param props - The properties object potentially containing spreads
2630
+ * @param context - Optional context for resolving references (templates, state)
2631
+ * @returns A new object with spreads expanded and merged
2632
+ */
2633
+ expandSpreads(props, context) {
2634
+ const result = {};
2635
+ const spreadKeys = [];
2636
+ for (const [key, value] of Object.entries(props)) {
2637
+ if (key.startsWith("__spread_")) {
2638
+ spreadKeys.push(key);
2639
+ } else if (value && typeof value === "object" && value.type === "spread") {
2640
+ spreadKeys.push(key);
2641
+ } else {
2642
+ if (value && typeof value === "object" && !Array.isArray(value) && !("__ref" in value) && !("__expr" in value)) {
2643
+ result[key] = this.expandSpreads(value, context);
2644
+ } else if (Array.isArray(value)) {
2645
+ result[key] = this.expandArraySpreads(value, context);
2646
+ } else {
2647
+ result[key] = value;
2648
+ }
2649
+ }
2650
+ }
2651
+ for (const spreadKey of spreadKeys) {
2652
+ const spreadValue = props[spreadKey];
2653
+ if (spreadValue && typeof spreadValue === "object" && spreadValue.type === "spread") {
2654
+ const resolved = this.resolveSpreadArgument(
2655
+ spreadValue.argument,
2656
+ context
2657
+ );
2658
+ if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
2659
+ Object.assign(result, this.expandSpreads(resolved, context));
2660
+ }
2661
+ }
2662
+ }
2663
+ for (const [key, value] of Object.entries(props)) {
2664
+ if (!key.startsWith("__spread_") && !(value && typeof value === "object" && value.type === "spread")) {
2665
+ if (value && typeof value === "object" && !Array.isArray(value) && !("__ref" in value) && !("__expr" in value)) {
2666
+ result[key] = this.expandSpreads(value, context);
2667
+ } else if (Array.isArray(value)) {
2668
+ result[key] = this.expandArraySpreads(value, context);
2669
+ } else {
2670
+ result[key] = value;
2671
+ }
2672
+ }
2673
+ }
2674
+ return result;
2675
+ }
2676
+ /**
2677
+ * Expands spread expressions within an array.
2678
+ * Spread elements have { type: 'spread', argument: <value> }
2679
+ */
2680
+ expandArraySpreads(arr, context) {
2681
+ const result = [];
2682
+ for (const item of arr) {
2683
+ if (item && typeof item === "object" && item.type === "spread") {
2684
+ const resolved = this.resolveSpreadArgument(
2685
+ item.argument,
2686
+ context
2687
+ );
2688
+ if (Array.isArray(resolved)) {
2689
+ result.push(...resolved);
2690
+ } else if (resolved !== void 0 && resolved !== null) {
2691
+ result.push(resolved);
2692
+ }
2693
+ } else if (item && typeof item === "object" && !Array.isArray(item)) {
2694
+ result.push(this.expandSpreads(item, context));
2695
+ } else {
2696
+ result.push(item);
2697
+ }
2698
+ }
2699
+ return result;
2700
+ }
2701
+ /**
2702
+ * Resolves a spread argument to its value.
2703
+ * Handles: direct values, __ref references, template references
2704
+ */
2705
+ resolveSpreadArgument(argument, context) {
2706
+ if (argument === null || argument === void 0) {
2707
+ return void 0;
2708
+ }
2709
+ if (typeof argument === "object" && !("__ref" in argument)) {
2710
+ return argument;
2711
+ }
2712
+ if (typeof argument === "object" && "__ref" in argument) {
2713
+ const ref = argument.__ref;
2714
+ if (context?.templates) {
2715
+ const template = context.templates.get(ref);
2716
+ if (template) {
2717
+ return template.properties || template;
2718
+ }
2719
+ }
2720
+ if (context?.state && ref in context.state) {
2721
+ return context.state[ref];
2722
+ }
2723
+ if (context?.state && ref.includes(".")) {
2724
+ const parts = ref.split(".");
2725
+ let value = context.state;
2726
+ for (const part of parts) {
2727
+ if (value && typeof value === "object" && part in value) {
2728
+ value = value[part];
2729
+ } else {
2730
+ value = void 0;
2731
+ break;
2732
+ }
2733
+ }
2734
+ if (value !== void 0) {
2735
+ return value;
2736
+ }
2737
+ }
2738
+ return argument;
2739
+ }
2740
+ if (typeof argument === "string") {
2741
+ if (context?.templates) {
2742
+ const template = context.templates.get(argument);
2743
+ if (template) {
2744
+ return template.properties || template;
2745
+ }
2746
+ }
2747
+ return { __ref: argument };
2748
+ }
2749
+ return argument;
2750
+ }
2751
+ // ─── HSPlusAST Compilation ────────────────────────────────────────────
2752
+ compile(ast, agentToken, outputPath) {
2753
+ this.validateCompilerAccess(agentToken, outputPath);
2754
+ const root = this.compileNode(ast.root);
2755
+ if (this.hasPostProcessing(root)) {
2756
+ root.children?.unshift({
2757
+ type: "EffectComposer",
2758
+ props: {},
2759
+ children: this.extractPostProcessingNodes(root)
2760
+ });
2761
+ }
2762
+ this.injectDefaultLighting(root);
2763
+ const domainBlocks = ast.domainBlocks ?? [];
2764
+ if (domainBlocks.length > 0) {
2765
+ const compiled = compileDomainBlocks(
2766
+ domainBlocks,
2767
+ {
2768
+ material: (block) => {
2769
+ const mat = compileMaterialBlock(block);
2770
+ return {
2771
+ type: "DomainBlockOutput",
2772
+ props: {
2773
+ __raw: materialToR3F(mat, this.tierScales),
2774
+ __domain: "material",
2775
+ __name: mat.name
2776
+ },
2777
+ children: []
2778
+ };
2779
+ },
2780
+ physics: (block) => {
2781
+ const phys = compilePhysicsBlock(block);
2782
+ return {
2783
+ type: "DomainBlockOutput",
2784
+ props: {
2785
+ __raw: physicsToR3F(phys),
2786
+ __domain: "physics",
2787
+ __name: phys.name || phys.keyword
2788
+ },
2789
+ children: []
2790
+ };
2791
+ },
2792
+ vfx: (block) => {
2793
+ const ps = compileParticleBlock(block);
2794
+ return {
2795
+ type: "DomainBlockOutput",
2796
+ props: {
2797
+ __raw: particlesToR3F(ps, this.tierScales),
2798
+ __domain: "vfx",
2799
+ __name: ps.name
2800
+ },
2801
+ children: []
2802
+ };
2803
+ },
2804
+ postfx: (block) => {
2805
+ const pp = compilePostProcessingBlock(block);
2806
+ return {
2807
+ type: "DomainBlockOutput",
2808
+ props: {
2809
+ __raw: postProcessingToR3F(pp),
2810
+ __domain: "postfx",
2811
+ __name: pp.name || "PostProcessing"
2812
+ },
2813
+ children: []
2814
+ };
2815
+ },
2816
+ audio: (block) => {
2817
+ const audio = compileAudioSourceBlock(block);
2818
+ return {
2819
+ type: "DomainBlockOutput",
2820
+ props: { __raw: audioSourceToR3F(audio), __domain: "audio", __name: audio.name },
2821
+ children: []
2822
+ };
2823
+ },
2824
+ weather: (block) => {
2825
+ const weather = compileWeatherBlock(block);
2826
+ return {
2827
+ type: "DomainBlockOutput",
2828
+ props: {
2829
+ __raw: weatherToR3F(weather),
2830
+ __domain: "weather",
2831
+ __name: weather.name || "Weather"
2832
+ },
2833
+ children: []
2834
+ };
2835
+ },
2836
+ simulation: (block) => {
2837
+ const sim = compileSimulationBlock(block);
2838
+ return {
2839
+ type: "DomainBlockOutput",
2840
+ props: {
2841
+ __raw: simulationToR3F(sim),
2842
+ __domain: "simulation",
2843
+ __name: sim.name || "Simulation"
2844
+ },
2845
+ children: []
2846
+ };
2847
+ }
2848
+ }
2849
+ );
2850
+ if (!root.children) root.children = [];
2851
+ for (const c of compiled) {
2852
+ if (typeof c === "object") root.children.push(c);
2853
+ }
2854
+ }
2855
+ return root;
2856
+ }
2857
+ /**
2858
+ * Compiles a declarative 'world' node into R3F scene nodes.
2859
+ * Nested `world.children` (objects) are compiled via the same path as top-level objects.
2860
+ */
2861
+ compileWorldNode(world, templateMap) {
2862
+ const nodes = [];
2863
+ const props = {};
2864
+ if (world.properties) {
2865
+ for (const prop of world.properties) {
2866
+ props[prop.key] = prop.value;
2867
+ }
2868
+ }
2869
+ if (props.ambient_light !== void 0) {
2870
+ nodes.push(
2871
+ this.createNode("ambientLight", {
2872
+ intensity: Number(props.ambient_light)
2873
+ })
2874
+ );
2875
+ }
2876
+ if (props.skybox_color !== void 0) {
2877
+ nodes.push(
2878
+ this.createNode("Environment", {
2879
+ background: true,
2880
+ preset: "sunset"
2881
+ // Default preset if just color is given
2882
+ })
2883
+ );
2884
+ nodes.push(
2885
+ this.createNode("color", {
2886
+ attach: "background",
2887
+ args: [props.skybox_color]
2888
+ })
2889
+ );
2890
+ }
2891
+ if (props.gravity !== void 0) {
2892
+ nodes.push(
2893
+ this.createNode("Physics", {
2894
+ gravity: [0, -Number(props.gravity), 0]
2895
+ })
2896
+ );
2897
+ }
2898
+ const childNodes = [];
2899
+ if (world.children && world.children.length > 0) {
2900
+ for (const child of world.children) {
2901
+ childNodes.push(this.compileObjectDecl(child, templateMap));
2902
+ }
2903
+ }
2904
+ if (childNodes.length === 0) {
2905
+ return nodes;
2906
+ }
2907
+ const group = this.createNode(
2908
+ "group",
2909
+ {},
2910
+ world.name ? escapeStringValue(world.name, "JSX") : void 0
2911
+ );
2912
+ group.children = [...nodes, ...childNodes];
2913
+ return [group];
2914
+ }
2915
+ createNode(type, props = {}, id) {
2916
+ const node = r3fNodePool.acquire();
2917
+ node.type = type;
2918
+ node.id = id;
2919
+ node.props = props;
2920
+ node.children = [];
2921
+ node.traits = /* @__PURE__ */ new Map();
2922
+ node.directives = [];
2923
+ return node;
2924
+ }
2925
+ /**
2926
+ * I.007 closure: emit a node's compiled petal material spec into its props.
2927
+ * Shared by every trait-bearing compile path (compileNode directives + the
2928
+ * .holo compileObjectDecl obj.traits path) so the emission can't silently miss
2929
+ * the real parser route. The spec is the locked CompiledMaterialSpec shape that
2930
+ * the renderer's buildCompiledMaterial consumes — building the petal material
2931
+ * from `.holo` data instead of hand-authoring it.
2932
+ */
2933
+ emitCompiledLotusMaterial(props, config) {
2934
+ const profile = createBotanicalLotusRenderProfile(config);
2935
+ props.__compiledMaterial = buildLotusPetalMaterialSpec(profile);
2936
+ props.__uniformBindings = LOTUS_PETAL_UNIFORM_BINDINGS;
2937
+ }
2938
+ compileNode(node) {
2939
+ if (node.type === "system") {
2940
+ return this.compileSystemNode(node);
2941
+ }
2942
+ if (node.type === "component") {
2943
+ return this.compileComponentNode(node);
2944
+ }
2945
+ const rawProps = node.properties || {};
2946
+ const type = this.mapType(node.type, rawProps);
2947
+ const r3fNode = r3fNodePool.acquire();
2948
+ r3fNode.type = type;
2949
+ const rawId = node.id || node.name;
2950
+ r3fNode.id = rawId ? escapeStringValue(rawId, "JSX") : void 0;
2951
+ r3fNode.props = this.compileProperties(node, rawProps);
2952
+ r3fNode.children = [];
2953
+ r3fNode.traits = /* @__PURE__ */ new Map();
2954
+ r3fNode.directives = node.directives || [];
2955
+ if (node.directives) {
2956
+ for (const directive of node.directives) {
2957
+ if (directive.type === "trait") {
2958
+ r3fNode.traits?.set(
2959
+ directive.name,
2960
+ directive.config
2961
+ );
2962
+ }
2963
+ }
2964
+ }
2965
+ const lotusConfig = r3fNode.traits?.get("botanical_lotus");
2966
+ if (lotusConfig) {
2967
+ this.emitCompiledLotusMaterial(r3fNode.props, lotusConfig);
2968
+ }
2969
+ const enhanced = node;
2970
+ if (enhanced.graphics) {
2971
+ this.applyGraphicsConfig(r3fNode, enhanced.graphics);
2972
+ }
2973
+ if (enhanced.children && Array.isArray(enhanced.children)) {
2974
+ r3fNode.children = enhanced.children.map(
2975
+ (child) => this.compileNode(child)
2976
+ );
2977
+ }
2978
+ return r3fNode;
2979
+ }
2980
+ // ─── HoloComposition Compilation (.holo files) ────────────────────────
2981
+ compileComposition(composition, agentToken, outputPath) {
2982
+ this.validateCompilerAccess(agentToken, outputPath);
2983
+ if (this._platformTarget) {
2984
+ const platformMixin = new PlatformConditionalCompilerMixin();
2985
+ composition = platformMixin.filterForPlatform(composition, this._platformTarget);
2986
+ }
2987
+ const root = r3fNodePool.acquire();
2988
+ root.type = "group";
2989
+ root.id = composition.name ? escapeStringValue(composition.name, "JSX") : void 0;
2990
+ root.props = {};
2991
+ root.children = [];
2992
+ root.traits = /* @__PURE__ */ new Map();
2993
+ root.directives = [];
2994
+ const templateMap = /* @__PURE__ */ new Map();
2995
+ if (Array.isArray(composition.templates)) {
2996
+ for (const tmpl of composition.templates) {
2997
+ templateMap.set(tmpl.name, tmpl);
2998
+ }
2999
+ }
3000
+ if (composition.children && Array.isArray(composition.children)) {
3001
+ for (const child of composition.children) {
3002
+ if (child.type === "template" && child.name) {
3003
+ templateMap.set(child.name, child);
3004
+ }
3005
+ }
3006
+ for (const child of composition.children) {
3007
+ root.children.push(this.compileChildNode(child, templateMap));
3008
+ }
3009
+ }
3010
+ if (composition.environment) {
3011
+ root.children.push(
3012
+ ...this.compileEnvironmentBlock(composition.environment)
3013
+ );
3014
+ }
3015
+ if (Array.isArray(composition.lights)) {
3016
+ for (const light of composition.lights) {
3017
+ root.children.push(this.compileLightBlock(light));
3018
+ }
3019
+ }
3020
+ if (Array.isArray(composition.objects)) {
3021
+ for (const obj of composition.objects) {
3022
+ root.children.push(this.compileObjectDecl(obj, templateMap));
3023
+ }
3024
+ }
3025
+ if (Array.isArray(composition.spatialGroups)) {
3026
+ for (const group of composition.spatialGroups) {
3027
+ root.children.push(this.compileSpatialGroup(group, templateMap));
3028
+ }
3029
+ }
3030
+ if (Array.isArray(composition.timelines)) {
3031
+ for (const timeline of composition.timelines) {
3032
+ root.children.push(this.compileTimelineBlock(timeline));
3033
+ }
3034
+ }
3035
+ if (Array.isArray(composition.audio)) {
3036
+ for (const audio of composition.audio) {
3037
+ root.children.push(this.compileAudioBlock(audio));
3038
+ }
3039
+ }
3040
+ if (Array.isArray(composition.zones)) {
3041
+ for (const zone of composition.zones) {
3042
+ root.children.push(this.compileZoneBlock(zone));
3043
+ }
3044
+ }
3045
+ if (Array.isArray(composition.worlds)) {
3046
+ for (const world of composition.worlds) {
3047
+ root.children.push(
3048
+ ...this.compileWorldNode(
3049
+ world,
3050
+ templateMap
3051
+ )
3052
+ );
3053
+ }
3054
+ }
3055
+ if (composition.ui) {
3056
+ root.children.push(this.compileUIBlock(composition.ui));
3057
+ }
3058
+ if (Array.isArray(composition.transitions)) {
3059
+ for (const transition of composition.transitions) {
3060
+ root.children.push(this.compileTransitionBlock(transition));
3061
+ }
3062
+ }
3063
+ if (Array.isArray(composition.conditionals)) {
3064
+ for (const cond of composition.conditionals) {
3065
+ root.children.push(this.compileConditionalBlock(cond, templateMap));
3066
+ }
3067
+ }
3068
+ if (Array.isArray(composition.iterators)) {
3069
+ for (const iter of composition.iterators) {
3070
+ root.children.push(this.compileForEachBlock(iter, templateMap));
3071
+ }
3072
+ }
3073
+ if (composition.camera) {
3074
+ root.children.push(this.compileCameraBlock(composition.camera));
3075
+ }
3076
+ if (composition.effects) {
3077
+ root.children.unshift(
3078
+ this.compileEffectsBlock(composition.effects)
3079
+ );
3080
+ } else if (this.hasPostProcessing(root)) {
3081
+ root.children.unshift({
3082
+ type: "EffectComposer",
3083
+ props: {},
3084
+ children: this.extractPostProcessingNodes(root)
3085
+ });
3086
+ }
3087
+ this.injectHolomapPointCloud(root);
3088
+ this.injectDefaultLighting(root);
3089
+ return root;
3090
+ }
3091
+ /** R3F host apps can map this node to BufferGeometry + pointsMaterial from base64 buffers. */
3092
+ injectHolomapPointCloud(root) {
3093
+ const h = this._holomapPointCloud;
3094
+ if (!h || h.pointCount < 1 || !h.positionsB64 || !h.colorsB64) return;
3095
+ if (!root.children) root.children = [];
3096
+ root.children.push({
3097
+ type: "holomapPointCloud",
3098
+ props: {
3099
+ positionsB64: h.positionsB64,
3100
+ colorsB64: h.colorsB64,
3101
+ pointCount: h.pointCount
3102
+ }
3103
+ });
3104
+ }
3105
+ compileLightBlock(light) {
3106
+ const lightMapping = {
3107
+ directional: "directionalLight",
3108
+ point: "pointLight",
3109
+ spot: "spotLight",
3110
+ hemisphere: "hemisphereLight",
3111
+ ambient: "ambientLight",
3112
+ area: "rectAreaLight"
3113
+ };
3114
+ const type = lightMapping[light.lightType] || "directionalLight";
3115
+ const props = {};
3116
+ if (Array.isArray(light.properties)) {
3117
+ for (const prop of light.properties) {
3118
+ const key = prop.key;
3119
+ const value = prop.value;
3120
+ if (key === "cast_shadow" || key === "castShadow") {
3121
+ props.castShadow = value;
3122
+ } else if (key === "ground_color" || key === "groundColor") {
3123
+ props.groundColor = value;
3124
+ } else if (key === "shadow_map_size") {
3125
+ props["shadow-mapSize"] = Array.isArray(value) ? value : [value, value];
3126
+ } else {
3127
+ props[key] = value;
3128
+ }
3129
+ }
3130
+ }
3131
+ if ((light.lightType === "directional" || light.lightType === "spot") && props.castShadow === void 0) {
3132
+ props.castShadow = true;
3133
+ }
3134
+ const r3fNode = r3fNodePool.acquire();
3135
+ r3fNode.type = type;
3136
+ r3fNode.id = light.name ? escapeStringValue(light.name, "JSX") : void 0;
3137
+ r3fNode.props = props;
3138
+ r3fNode.children = [];
3139
+ r3fNode.traits = /* @__PURE__ */ new Map();
3140
+ r3fNode.directives = [];
3141
+ return r3fNode;
3142
+ }
3143
+ compileEffectsBlock(effects) {
3144
+ const children = [];
3145
+ if (Array.isArray(effects.effects)) {
3146
+ for (const effect of effects.effects) {
3147
+ const effectMapping = {
3148
+ bloom: "Bloom",
3149
+ ssao: "SSAO",
3150
+ vignette: "Vignette",
3151
+ dof: "DepthOfField",
3152
+ chromatic_aberration: "ChromaticAberration",
3153
+ tone_mapping: "ToneMapping",
3154
+ noise: "Noise"
3155
+ };
3156
+ const effectType = effect.effectType;
3157
+ const type = effectMapping[effectType] || effectType;
3158
+ children.push(
3159
+ this.createNode(type, { ...effect.properties || {} })
3160
+ );
3161
+ }
3162
+ }
3163
+ const composer = this.createNode("EffectComposer", {});
3164
+ composer.children = children;
3165
+ return composer;
3166
+ }
3167
+ compileCameraBlock(camera) {
3168
+ const props = {};
3169
+ if (Array.isArray(camera.properties)) {
3170
+ for (const prop of camera.properties) {
3171
+ if (prop.key === "field_of_view" || prop.key === "fov") {
3172
+ props.fov = prop.value;
3173
+ } else if (prop.key === "look_at" || prop.key === "lookAt") {
3174
+ props.lookAt = prop.value;
3175
+ } else {
3176
+ props[prop.key] = prop.value;
3177
+ }
3178
+ }
3179
+ }
3180
+ props.cameraType = camera.cameraType;
3181
+ return this.createNode("Camera", props, "__camera");
3182
+ }
3183
+ compileEnvironmentBlock(env) {
3184
+ const nodes = [];
3185
+ const envProps = {};
3186
+ if (env.properties) {
3187
+ for (const prop of env.properties) {
3188
+ envProps[prop.key] = prop.value;
3189
+ }
3190
+ }
3191
+ const presetName = envProps.skybox || envProps.preset;
3192
+ if (presetName) {
3193
+ const preset = ENVIRONMENT_PRESETS[presetName];
3194
+ if (preset) {
3195
+ nodes.push(
3196
+ this.createNode("Environment", {
3197
+ background: true,
3198
+ preset: preset.envPreset || presetName
3199
+ })
3200
+ );
3201
+ const lighting = preset.lighting;
3202
+ if (lighting?.ambient) {
3203
+ nodes.push(
3204
+ this.createNode("ambientLight", {
3205
+ color: lighting.ambient.color,
3206
+ intensity: lighting.ambient.intensity
3207
+ })
3208
+ );
3209
+ }
3210
+ if (lighting?.directional) {
3211
+ const dl = lighting.directional;
3212
+ nodes.push(
3213
+ this.createNode("directionalLight", {
3214
+ color: dl.color,
3215
+ intensity: dl.intensity,
3216
+ position: dl.position,
3217
+ castShadow: dl.shadows !== false,
3218
+ "shadow-mapSize": [2048, 2048]
3219
+ })
3220
+ );
3221
+ }
3222
+ if (Array.isArray(lighting?.points)) {
3223
+ for (const pl of lighting.points) {
3224
+ nodes.push(
3225
+ this.createNode("pointLight", {
3226
+ color: pl.color,
3227
+ intensity: pl.intensity,
3228
+ position: pl.position,
3229
+ distance: pl.distance
3230
+ })
3231
+ );
3232
+ }
3233
+ }
3234
+ const presetMap = preset;
3235
+ if (presetMap.fog) {
3236
+ const fogMap = presetMap.fog;
3237
+ nodes.push(
3238
+ this.createNode("fog", {
3239
+ attach: "fog",
3240
+ color: fogMap.color,
3241
+ near: fogMap.near,
3242
+ far: fogMap.far
3243
+ })
3244
+ );
3245
+ }
3246
+ if (presetMap.ground) {
3247
+ const groundMap = presetMap.ground;
3248
+ nodes.push(
3249
+ this.createNode(
3250
+ "mesh",
3251
+ {
3252
+ hsType: "plane",
3253
+ rotation: [-Math.PI / 2, 0, 0],
3254
+ position: [0, -0.01, 0],
3255
+ receiveShadow: true,
3256
+ args: [200, 200],
3257
+ color: groundMap.color,
3258
+ materialProps: { roughness: 0.8, metalness: 0 }
3259
+ },
3260
+ "__ground"
3261
+ )
3262
+ );
3263
+ }
3264
+ } else {
3265
+ nodes.push(this.createNode("Environment", { background: true, preset: presetName }));
3266
+ }
3267
+ }
3268
+ if (envProps.ambient_light !== void 0) {
3269
+ nodes.push(
3270
+ this.createNode("ambientLight", {
3271
+ intensity: typeof envProps.ambient_light === "number" ? envProps.ambient_light : 0.5
3272
+ })
3273
+ );
3274
+ }
3275
+ const explicitFog = envProps.fog;
3276
+ if (explicitFog && typeof explicitFog === "object") {
3277
+ nodes.push(
3278
+ this.createNode("fog", {
3279
+ attach: "fog",
3280
+ color: explicitFog.color || "#cccccc",
3281
+ near: explicitFog.near || 10,
3282
+ far: explicitFog.far || 100
3283
+ })
3284
+ );
3285
+ }
3286
+ return nodes;
3287
+ }
3288
+ compileObjectDecl(obj, templateMap) {
3289
+ const props = {};
3290
+ let geometryType = "cube";
3291
+ if (obj.template && templateMap) {
3292
+ const tmpl = templateMap.get(obj.template);
3293
+ if (tmpl) {
3294
+ const tmplTraits = tmpl.traits;
3295
+ if (tmplTraits && Array.isArray(tmplTraits)) {
3296
+ const existingTraitNames = new Set(
3297
+ (obj.traits || []).map(
3298
+ (t) => t.name
3299
+ )
3300
+ );
3301
+ obj.traits = [
3302
+ ...tmplTraits.filter(
3303
+ (t) => !existingTraitNames.has(t.name)
3304
+ ),
3305
+ ...obj.traits || []
3306
+ ];
3307
+ }
3308
+ const tmplProps = tmpl.properties;
3309
+ if (tmplProps && Array.isArray(tmplProps)) {
3310
+ const existingKeys = new Set(
3311
+ (obj.properties || []).map(
3312
+ (p) => p.key
3313
+ )
3314
+ );
3315
+ const mergedProps = tmplProps.filter((p) => !existingKeys.has(p.key)).map((p) => ({
3316
+ type: "ObjectProperty",
3317
+ key: p.key,
3318
+ value: p.value
3319
+ }));
3320
+ obj.properties = [...mergedProps, ...obj.properties || []];
3321
+ }
3322
+ }
3323
+ }
3324
+ if (obj.properties && Array.isArray(obj.properties)) {
3325
+ const expandedProperties = [];
3326
+ for (const p of obj.properties) {
3327
+ const prop = p;
3328
+ if (prop && prop.type === "spread") {
3329
+ const resolved = this.resolveSpreadArgument(
3330
+ prop.target || prop.argument,
3331
+ {
3332
+ templates: templateMap
3333
+ }
3334
+ );
3335
+ if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
3336
+ for (const [key, value] of Object.entries(resolved)) {
3337
+ expandedProperties.push({ key, value });
3338
+ }
3339
+ } else if (Array.isArray(resolved)) {
3340
+ expandedProperties.push(...resolved);
3341
+ }
3342
+ } else {
3343
+ expandedProperties.push(prop);
3344
+ }
3345
+ }
3346
+ obj.properties = expandedProperties;
3347
+ }
3348
+ if (obj.properties) {
3349
+ for (const p of obj.properties) {
3350
+ const key = p.key;
3351
+ const value = p.value;
3352
+ if (key === "geometry" || key === "mesh") {
3353
+ geometryType = value;
3354
+ } else if (key === "type") {
3355
+ const valStr = value;
3356
+ if (["text", "sparkles", "portal", "audio"].includes(valStr)) {
3357
+ geometryType = valStr;
3358
+ } else if (["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(valStr)) {
3359
+ geometryType = "light";
3360
+ props.lightType = valStr;
3361
+ } else {
3362
+ props[key] = value;
3363
+ }
3364
+ } else if (key === "light_type") {
3365
+ props.lightType = value;
3366
+ } else if (key === "position" && Array.isArray(value)) {
3367
+ props.position = value;
3368
+ } else if (key === "rotation" && Array.isArray(value)) {
3369
+ props.rotation = value;
3370
+ } else if (key === "scale") {
3371
+ props.scale = Array.isArray(value) ? value : [value, value, value];
3372
+ } else if (key === "color") {
3373
+ props.color = value;
3374
+ } else if (key === "src" || key === "model" || key === "source") {
3375
+ props.src = value;
3376
+ geometryType = "model";
3377
+ } else if (key === "text") {
3378
+ props.children = this.resolveValue(value);
3379
+ props.text = this.resolveValue(value);
3380
+ } else if (key === "font_size") {
3381
+ props.fontSize = value;
3382
+ } else if (key === "material") {
3383
+ const currentMaterialProps = props.materialProps || {};
3384
+ if (typeof value === "string" && MATERIAL_PRESETS[value]) {
3385
+ props.materialProps = { ...MATERIAL_PRESETS[value], ...currentMaterialProps };
3386
+ } else if (typeof value === "object" && value !== null) {
3387
+ const valObj = value;
3388
+ if (valObj.preset && typeof valObj.preset === "string" && MATERIAL_PRESETS[valObj.preset]) {
3389
+ const { preset: _, ...rest } = valObj;
3390
+ props.materialProps = {
3391
+ ...MATERIAL_PRESETS[valObj.preset],
3392
+ ...rest,
3393
+ ...currentMaterialProps
3394
+ };
3395
+ } else {
3396
+ props.materialProps = { ...currentMaterialProps, ...valObj };
3397
+ }
3398
+ }
3399
+ } else if (key === "roughness" || key === "metalness" || key === "metallic") {
3400
+ const mProps = props.materialProps || {};
3401
+ mProps[key === "metallic" ? "metalness" : key] = value;
3402
+ props.materialProps = mProps;
3403
+ } else if (key === "opacity") {
3404
+ const mProps = props.materialProps || {};
3405
+ mProps.opacity = value;
3406
+ mProps.transparent = value < 1;
3407
+ props.materialProps = mProps;
3408
+ } else if (key === "emissive") {
3409
+ props.materialProps = {
3410
+ ...props.materialProps || {},
3411
+ emissive: value
3412
+ };
3413
+ } else if (key === "emissiveIntensity" || key === "emissive_intensity") {
3414
+ props.materialProps = {
3415
+ ...props.materialProps || {},
3416
+ emissiveIntensity: value
3417
+ };
3418
+ } else if (key === "size") {
3419
+ if (Array.isArray(value)) {
3420
+ props.args = value;
3421
+ }
3422
+ props.size = value;
3423
+ } else if (key === "radius") {
3424
+ props.size = value * 2;
3425
+ } else if (key === "intensity") {
3426
+ props.intensity = value;
3427
+ } else if (key === "cast_shadow" || key === "castShadow") {
3428
+ props.castShadow = value;
3429
+ } else if (key === "receiveShadow" || key === "receive_shadow") {
3430
+ props.receiveShadow = value;
3431
+ } else if (key === "visible") {
3432
+ props[key] = value;
3433
+ } else if (key === "maturity") {
3434
+ props.maturityOverride = value;
3435
+ } else if (key === "promoteUrl" || key === "promote_url") {
3436
+ props.promoteUrl = value;
3437
+ } else if (key === "collisionShape" || key === "collision_shape") {
3438
+ props.collisionShape = value;
3439
+ } else {
3440
+ props[key] = this.resolveValue(value);
3441
+ }
3442
+ }
3443
+ }
3444
+ if (obj.traits && Array.isArray(obj.traits)) {
3445
+ const semiring = new ProvenanceSemiring();
3446
+ const physicsApplications = obj.traits.filter((t) => t.name === "physics" || t.name === "collidable").map((t) => {
3447
+ let baseConfig = t.config || {};
3448
+ if (t.name === "collidable" && !baseConfig.type)
3449
+ baseConfig = { ...baseConfig, type: "fixed" };
3450
+ if (t.name === "physics" && !baseConfig.type)
3451
+ baseConfig = { ...baseConfig, type: "dynamic" };
3452
+ return {
3453
+ name: t.name,
3454
+ config: baseConfig,
3455
+ context: obj.provenance?.context
3456
+ };
3457
+ });
3458
+ if (physicsApplications.length > 0) {
3459
+ const { config: mergedPhysics } = semiring.add(physicsApplications);
3460
+ props.rigidBody = { ...mergedPhysics };
3461
+ props.collider = { type: "auto" };
3462
+ if (props.rigidBody?.type === "fixed") {
3463
+ props.castShadow = true;
3464
+ props.receiveShadow = true;
3465
+ }
3466
+ }
3467
+ for (const trait of obj.traits) {
3468
+ const name = trait.name;
3469
+ if (name === "physics" || name === "collidable") {
3470
+ continue;
3471
+ } else if (name === "grabbable") {
3472
+ props.castShadow = true;
3473
+ props.grabbable = trait.config || true;
3474
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3475
+ if (!props.collider) props.collider = { type: "auto" };
3476
+ } else if (name === "hoverable") {
3477
+ props.hoverable = trait.config || true;
3478
+ } else if (name === "animated") {
3479
+ props.animated = trait.config || true;
3480
+ } else if (name === "positional" || name === "spatial_audio") {
3481
+ props.spatial = true;
3482
+ } else if (name === "gem_resonance") {
3483
+ props.gemResonance = gemResonanceConfig(trait.config);
3484
+ props.spatial = true;
3485
+ } else if (name === "shadow") {
3486
+ props.castShadow = true;
3487
+ if (trait.config?.mapSize)
3488
+ props["shadow-mapSize"] = [trait.config.mapSize, trait.config.mapSize];
3489
+ } else if (name === "material") {
3490
+ const presetName = trait.config?.preset;
3491
+ if (presetName && typeof presetName === "string" && MATERIAL_PRESETS[presetName]) {
3492
+ const { preset: _, ...rest } = trait.config;
3493
+ props.materialProps = {
3494
+ ...MATERIAL_PRESETS[presetName],
3495
+ ...rest,
3496
+ ...props.materialProps
3497
+ };
3498
+ } else {
3499
+ props.materialProps = {
3500
+ ...props.materialProps,
3501
+ ...trait.config
3502
+ };
3503
+ }
3504
+ } else if (name === "networked") {
3505
+ props.networked = trait.config || true;
3506
+ } else if (name === "moldable") {
3507
+ props.moldable = trait.config || true;
3508
+ } else if (name === "stretchable") {
3509
+ props.stretchable = trait.config || true;
3510
+ } else if (name === "bloom") {
3511
+ props.bloom = trait.config || { intensity: 1 };
3512
+ } else if (name === "portal") {
3513
+ props.portal = trait.config || true;
3514
+ } else if (name === "attach") {
3515
+ props.attach = trait.config || true;
3516
+ } else if (name === "orbit") {
3517
+ props.orbit = trait.config || true;
3518
+ } else if (name === "look_at") {
3519
+ props.lookAtTarget = trait.config || true;
3520
+ } else if (name === "follow") {
3521
+ props.follow = trait.config || true;
3522
+ } else if (name === "plane_detection") {
3523
+ props.planeDetection = trait.config || { mode: "all" };
3524
+ } else if (name === "mesh_detection") {
3525
+ props.meshDetection = trait.config || { classification: true };
3526
+ } else if (name === "anchor") {
3527
+ props.anchor = trait.config || { type: "spatial" };
3528
+ } else if (name === "persistent_anchor") {
3529
+ props.persistentAnchor = trait.config || { storage: "local" };
3530
+ } else if (name === "shared_anchor") {
3531
+ props.sharedAnchor = trait.config || { authority: "creator" };
3532
+ } else if (name === "occlusion") {
3533
+ props.occlusionMode = trait.config?.mode || "environment";
3534
+ props.occlusion = trait.config || true;
3535
+ } else if (name === "light_estimation") {
3536
+ props.lightEstimation = trait.config || { auto_apply: true };
3537
+ } else if (name === "geospatial") {
3538
+ props.geospatial = trait.config || true;
3539
+ } else if (name === "gaussian_splat") {
3540
+ props.gaussianSplat = trait.config || true;
3541
+ } else if (name === "nerf") {
3542
+ props.nerf = trait.config || true;
3543
+ } else if (name === "volumetric_video") {
3544
+ props.volumetricVideo = trait.config || true;
3545
+ } else if (name === "point_cloud") {
3546
+ props.pointCloud = trait.config || true;
3547
+ } else if (name === "photogrammetry") {
3548
+ props.photogrammetry = trait.config || true;
3549
+ } else if (name === "web_surface") {
3550
+ props.webSurface = trait.config || true;
3551
+ } else if (name === "cloth") {
3552
+ props.cloth = trait.config || { stiffness: 0.8 };
3553
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3554
+ } else if (name === "fluid") {
3555
+ props.fluid = trait.config || { viscosity: 0.01 };
3556
+ props.__gapsComponents = props.__gapsComponents || [];
3557
+ props.__gapsComponents.push("FluidRenderer");
3558
+ } else if (name === "soft_body") {
3559
+ props.softBody = trait.config || { elasticity: 0.5 };
3560
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3561
+ } else if (name === "rope") {
3562
+ props.rope = trait.config || { segments: 20 };
3563
+ } else if (name === "chain") {
3564
+ props.chain = trait.config || { link_count: 20 };
3565
+ } else if (name === "wind") {
3566
+ props.wind = trait.config || { strength: 5 };
3567
+ } else if (name === "buoyancy") {
3568
+ props.buoyancy = trait.config || { water_level: 0 };
3569
+ } else if (name === "destruction") {
3570
+ props.destruction = trait.config || { health: 100 };
3571
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3572
+ if (!props.collider) props.collider = { type: "auto" };
3573
+ } else if (name === "soft_body_pro") {
3574
+ props.softBodyPro = trait.config || { tear_threshold: 0.5 };
3575
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3576
+ } else if (name === "crowd_sim") {
3577
+ props.crowdSim = trait.config || { max_agents: 1e3 };
3578
+ } else if (name === "deformable_terrain") {
3579
+ props.deformableTerrain = trait.config || { resolution: 256 };
3580
+ } else if (name === "volumetric_clouds") {
3581
+ props.volumetricClouds = trait.config || { coverage: 0.5 };
3582
+ props.__gapsComponents = props.__gapsComponents || [];
3583
+ props.__gapsComponents.push("CloudRenderer");
3584
+ } else if (name === "god_rays") {
3585
+ props.godRays = trait.config || { intensity: 1 };
3586
+ props.__gapsComponents = props.__gapsComponents || [];
3587
+ props.__gapsComponents.push("GodRaysEffect");
3588
+ } else if (name === "spatial_voice") {
3589
+ props.spatialVoice = trait.config || { max_distance: 30 };
3590
+ props.spatial = true;
3591
+ } else if (name === "ai_companion") {
3592
+ props.aiCompanion = trait.config || { personality: "friendly" };
3593
+ } else if (name === "moderation") {
3594
+ props.moderation = trait.config || { sensitivity: "medium" };
3595
+ } else if (name === "anti_grief") {
3596
+ props.antiGrief = trait.config || { detection_window: 30 };
3597
+ } else if (name === "world_state") {
3598
+ props.worldState = trait.config || { sync_rate: 10 };
3599
+ } else if (name === "token_gated") {
3600
+ props.tokenGated = trait.config || { token_contract: "", min_balance: 1 };
3601
+ } else if (name === "ambisonics") {
3602
+ props.ambisonics = trait.config || { order: 1 };
3603
+ props.spatial = true;
3604
+ } else if (name === "hrtf") {
3605
+ props.hrtf = trait.config || true;
3606
+ props.spatial = true;
3607
+ } else if (name === "reverb_zone") {
3608
+ props.reverbZone = trait.config || { preset: "room" };
3609
+ } else if (name === "audio_occlusion") {
3610
+ props.audioOcclusion = trait.config || true;
3611
+ } else if (name === "audio_portal") {
3612
+ props.audioPortal = trait.config || true;
3613
+ } else if (name === "head_tracked_audio") {
3614
+ props.headTrackedAudio = trait.config || true;
3615
+ props.spatial = true;
3616
+ } else if (name === "accessible") {
3617
+ props.accessible = trait.config || { role: "generic" };
3618
+ } else if (name === "alt_text") {
3619
+ props.altText = trait.config?.text || "";
3620
+ } else if (name === "magnifiable") {
3621
+ props.magnifiable = trait.config || { max_scale: 3 };
3622
+ } else if (name === "high_contrast") {
3623
+ props.highContrast = trait.config || { mode: "outline" };
3624
+ } else if (name === "motion_reduced") {
3625
+ props.motionReduced = trait.config || true;
3626
+ if (props.animated) props.animated = false;
3627
+ } else if (name === "compute") {
3628
+ props.compute = trait.config || true;
3629
+ } else if (name === "gpu_particle") {
3630
+ props.gpuParticle = trait.config || { count: 1e4 };
3631
+ } else if (isVfxParticleTraitName(name)) {
3632
+ const particleConfig = {
3633
+ effect: vfxParticleEffect(name),
3634
+ ...trait.config || {}
3635
+ };
3636
+ const gpuParticles = props.gpuParticles ?? [];
3637
+ props.gpuParticles = [...gpuParticles, particleConfig];
3638
+ if (!props.gpuParticle) props.gpuParticle = particleConfig;
3639
+ } else if (name === "gpu_physics") {
3640
+ props.gpuPhysics = trait.config || true;
3641
+ } else if (name === "digital_twin") {
3642
+ props.digitalTwin = trait.config || true;
3643
+ } else if (name === "sensor") {
3644
+ props.sensor = trait.config || true;
3645
+ } else if (name === "data_binding") {
3646
+ props.dataBinding = trait.config || true;
3647
+ } else if (name === "behavior_tree") {
3648
+ props.behaviorTree = trait.config || true;
3649
+ } else if (name === "llm_agent") {
3650
+ props.llmAgent = trait.config || true;
3651
+ } else if (name === "neural_link") {
3652
+ props.neuralLink = trait.config || { model: "brittney-v4.gguf", temperature: 0.7 };
3653
+ } else if (name === "perception") {
3654
+ props.perception = trait.config || { sight_range: 20 };
3655
+ } else if (name === "patrol") {
3656
+ props.patrol = trait.config || true;
3657
+ } else if (name === "co_located") {
3658
+ props.coLocated = trait.config || true;
3659
+ } else if (name === "shared_world") {
3660
+ props.sharedWorld = trait.config || true;
3661
+ } else if (name === "voice_proximity") {
3662
+ props.voiceProximity = trait.config || { max_distance: 20 };
3663
+ props.spatial = true;
3664
+ } else if (name === "spatial_persona") {
3665
+ props.spatialPersona = trait.config || { style: "realistic" };
3666
+ } else if (name === "shareplay") {
3667
+ props.sharePlay = trait.config || { activity_type: "custom" };
3668
+ } else if (name === "object_tracking") {
3669
+ props.objectTracking = trait.config || true;
3670
+ } else if (name === "scene_reconstruction") {
3671
+ props.sceneReconstruction = trait.config || { mode: "mesh" };
3672
+ } else if (name === "eye_tracked") {
3673
+ props.eyeTracked = true;
3674
+ } else if (name === "eye_hand_fusion") {
3675
+ props.eyeHandFusion = true;
3676
+ } else if (name === "controlnet") {
3677
+ props.controlNet = trait.config || { model: "canny" };
3678
+ } else if (name === "ai_texture_gen") {
3679
+ props.aiTextureGen = trait.config || { style: "photorealistic" };
3680
+ } else if (name === "diffusion_realtime") {
3681
+ props.diffusionRealtime = trait.config || { backend: "cuda" };
3682
+ } else if (name === "ai_upscaling") {
3683
+ props.aiUpscaling = trait.config || { factor: 2 };
3684
+ } else if (name === "ai_inpainting") {
3685
+ props.aiInpainting = trait.config || true;
3686
+ } else if (name === "neural_forge") {
3687
+ props.neuralForge = trait.config || true;
3688
+ } else if (name === "embedding_search") {
3689
+ props.embeddingSearch = trait.config || { dimensions: 1536 };
3690
+ } else if (name === "ai_npc_brain") {
3691
+ props.aiNpcBrain = trait.config || { model: "llm" };
3692
+ } else if (name === "vector_db") {
3693
+ props.vectorDb = trait.config || true;
3694
+ } else if (name === "vision" || name === "ai_vision") {
3695
+ props.vision = trait.config || { task: "detection" };
3696
+ } else if (name === "spatial_awareness") {
3697
+ props.spatialAwareness = trait.config || true;
3698
+ } else if (name === "neural_animation") {
3699
+ props.neuralAnimation = trait.config || { style: "motion_matching" };
3700
+ } else if (name === "draft") {
3701
+ props.draftMode = true;
3702
+ props.draftShape = trait.config?.shape || "box";
3703
+ props.draftColor = trait.config?.color || "#88aaff";
3704
+ props.draftOpacity = trait.config?.opacity ?? 1;
3705
+ props.draftWireframe = trait.config?.wireframe || false;
3706
+ if (trait.config?.collision !== false) {
3707
+ if (!props.rigidBody) props.rigidBody = { type: "fixed" };
3708
+ if (!props.collider) props.collider = { type: "auto" };
3709
+ }
3710
+ } else if (name === "botanical_lotus") {
3711
+ this.emitCompiledLotusMaterial(props, trait.config || {});
3712
+ } else {
3713
+ props[name] = trait.config || true;
3714
+ if (!props.__unrecognizedTraits) {
3715
+ props.__unrecognizedTraits = [];
3716
+ }
3717
+ props.__unrecognizedTraits.push(name);
3718
+ }
3719
+ }
3720
+ }
3721
+ if (obj.traits && Array.isArray(obj.traits)) {
3722
+ const traitNames = obj.traits.map(
3723
+ (t) => t.name
3724
+ );
3725
+ const compositor = new TraitCompositor();
3726
+ const composedMaterial = compositor.compose(traitNames);
3727
+ if (Object.keys(composedMaterial).length > 0) {
3728
+ props.materialProps = {
3729
+ ...props.materialProps,
3730
+ ...composedMaterial
3731
+ };
3732
+ }
3733
+ }
3734
+ let type;
3735
+ if (geometryType === "model" && props.src) {
3736
+ type = "gltfModel";
3737
+ } else if (geometryType === "light") {
3738
+ const lightType = props.lightType || props.type || "directional";
3739
+ const lightMapping = {
3740
+ directional: "directionalLight",
3741
+ point: "pointLight",
3742
+ spot: "spotLight",
3743
+ hemisphere: "hemisphereLight",
3744
+ ambient: "ambientLight",
3745
+ area: "rectAreaLight"
3746
+ };
3747
+ type = lightMapping[lightType] || "directionalLight";
3748
+ delete props.lightType;
3749
+ } else if (geometryType === "text") {
3750
+ type = "Text";
3751
+ } else if (geometryType === "sparkles") {
3752
+ type = "Sparkles";
3753
+ } else if (geometryType === "portal") {
3754
+ type = "Portal";
3755
+ } else {
3756
+ type = "mesh";
3757
+ props.hsType = geometryType;
3758
+ if (!props.args) {
3759
+ const size = typeof props.size === "number" ? props.size : 1;
3760
+ props.args = this.getGeometryArgs(geometryType, { size });
3761
+ }
3762
+ }
3763
+ const r3fNode = this.createNode(type, props, obj.name);
3764
+ if (props.draftMode) {
3765
+ r3fNode.assetMaturity = "draft";
3766
+ } else if (props.maturityOverride) {
3767
+ const m = props.maturityOverride;
3768
+ if (m === "draft" || m === "mesh" || m === "final") {
3769
+ r3fNode.assetMaturity = m;
3770
+ }
3771
+ }
3772
+ delete props.maturityOverride;
3773
+ if (obj.children && Array.isArray(obj.children)) {
3774
+ for (const child of obj.children) {
3775
+ r3fNode.children.push(this.compileObjectDecl(child));
3776
+ }
3777
+ }
3778
+ if (props.__gapsComponents && Array.isArray(props.__gapsComponents)) {
3779
+ for (const componentType of props.__gapsComponents) {
3780
+ const componentProps = {};
3781
+ if (componentType === "CloudRenderer" && props.volumetricClouds) {
3782
+ const vc = props.volumetricClouds;
3783
+ componentProps.coverage = vc.coverage ?? 0.5;
3784
+ componentProps.altitude = vc.altitude ?? 500;
3785
+ componentProps.windOffset = vc.wind ?? [0, 0, 0];
3786
+ componentProps.layers = vc.layers ?? 3;
3787
+ } else if (componentType === "GodRaysEffect" && props.godRays) {
3788
+ const gr = props.godRays;
3789
+ componentProps.intensity = gr.intensity ?? 1;
3790
+ componentProps.decay = gr.decay ?? 0.96;
3791
+ componentProps.lightColor = gr.color ?? "#fffde7";
3792
+ } else if (componentType === "FluidRenderer" && props.fluid) {
3793
+ const fl = props.fluid;
3794
+ componentProps.color = fl.color ?? "#1a6fc4";
3795
+ componentProps.particleSize = fl.particle_radius ?? 0.02;
3796
+ componentProps.renderMode = fl.render_mode ?? "points";
3797
+ }
3798
+ r3fNode.children.push(
3799
+ this.createNode(componentType, componentProps, `${obj.name}-${componentType}`)
3800
+ );
3801
+ }
3802
+ delete props.__gapsComponents;
3803
+ }
3804
+ return r3fNode;
3805
+ }
3806
+ /**
3807
+ * Compile a SystemNode into an R3FNode.
3808
+ *
3809
+ * Systems are logical containers with state, actions, lifecycle hooks,
3810
+ * and optionally child objects/UI. In the R3F tree, a system compiles
3811
+ * to a group node annotated with its rich metadata (state, actions,
3812
+ * hooks) so the runtime/renderer can wire up behavior.
3813
+ */
3814
+ compileSystemNode(node, templateMap) {
3815
+ const props = {};
3816
+ if (node.state) {
3817
+ props.systemState = node.state;
3818
+ }
3819
+ if (node.actions) {
3820
+ props.systemActions = node.actions;
3821
+ }
3822
+ if (node.hooks) {
3823
+ props.systemHooks = node.hooks;
3824
+ }
3825
+ if (node.properties && typeof node.properties === "object") {
3826
+ for (const [key, value] of Object.entries(node.properties)) {
3827
+ props[key] = value;
3828
+ }
3829
+ }
3830
+ const r3fNode = this.createNode("System", props, node.id || node.name);
3831
+ if (node.directives) {
3832
+ r3fNode.directives = node.directives;
3833
+ }
3834
+ if (node.directives) {
3835
+ for (const d of node.directives) {
3836
+ if (d.type === "trait") {
3837
+ r3fNode.traits?.set(d.name, d.config || {});
3838
+ }
3839
+ }
3840
+ }
3841
+ if (node.children && Array.isArray(node.children)) {
3842
+ for (const child of node.children) {
3843
+ r3fNode.children.push(this.compileChildNode(child, templateMap));
3844
+ }
3845
+ }
3846
+ if (node.ui && Array.isArray(node.ui)) {
3847
+ for (const uiNode of node.ui) {
3848
+ r3fNode.children.push(this.compileNode(uiNode));
3849
+ }
3850
+ }
3851
+ return r3fNode;
3852
+ }
3853
+ /**
3854
+ * Compile a ComponentNode into an R3FNode.
3855
+ *
3856
+ * Components are UI-focused containers with props, state, actions,
3857
+ * and render/UI blocks. They compile to a group node annotated with
3858
+ * component metadata for the runtime.
3859
+ */
3860
+ compileComponentNode(node, templateMap) {
3861
+ const props = {};
3862
+ if (node.props) {
3863
+ props.componentProps = node.props;
3864
+ }
3865
+ if (node.state) {
3866
+ props.componentState = node.state;
3867
+ }
3868
+ if (node.actions) {
3869
+ props.componentActions = node.actions;
3870
+ }
3871
+ if (node.hooks) {
3872
+ props.componentHooks = node.hooks;
3873
+ }
3874
+ if (node.properties && typeof node.properties === "object") {
3875
+ for (const [key, value] of Object.entries(node.properties)) {
3876
+ props[key] = value;
3877
+ }
3878
+ }
3879
+ const r3fNode = this.createNode(
3880
+ "Component",
3881
+ props,
3882
+ node.id || node.name
3883
+ );
3884
+ if (node.directives) {
3885
+ r3fNode.directives = node.directives;
3886
+ }
3887
+ if (node.directives) {
3888
+ for (const d of node.directives) {
3889
+ if (d.type === "trait") {
3890
+ r3fNode.traits?.set(d.name, d.config || {});
3891
+ }
3892
+ }
3893
+ }
3894
+ if (node.children && Array.isArray(node.children)) {
3895
+ for (const child of node.children) {
3896
+ r3fNode.children.push(this.compileChildNode(child, templateMap));
3897
+ }
3898
+ }
3899
+ if (node.ui && Array.isArray(node.ui)) {
3900
+ for (const uiNode of node.ui) {
3901
+ r3fNode.children.push(this.compileNode(uiNode));
3902
+ }
3903
+ }
3904
+ return r3fNode;
3905
+ }
3906
+ /**
3907
+ * Dispatch a child node to the appropriate compile method based on its type.
3908
+ * Used by compileSystemNode, compileComponentNode, and compileComposition
3909
+ * when processing the parser's children array.
3910
+ */
3911
+ compileChildNode(child, templateMap) {
3912
+ switch (child.type) {
3913
+ case "system":
3914
+ return this.compileSystemNode(child, templateMap);
3915
+ case "component":
3916
+ return this.compileComponentNode(child, templateMap);
3917
+ case "object":
3918
+ return this.compileObjectDecl(child, templateMap);
3919
+ case "template":
3920
+ if (templateMap && typeof child.name === "string") {
3921
+ templateMap.set(child.name, child);
3922
+ }
3923
+ return this.compileTemplateNode(child, templateMap);
3924
+ case "spatial_group":
3925
+ return this.compileSpatialGroup(child, templateMap);
3926
+ default:
3927
+ return this.compileNode(child);
3928
+ }
3929
+ }
3930
+ /**
3931
+ * Compile a template node. Templates define reusable types.
3932
+ * In the R3F tree, they compile to an empty group (they're not
3933
+ * rendered directly — objects "using" them inherit their properties).
3934
+ */
3935
+ compileTemplateNode(node, _templateMap) {
3936
+ const props = {};
3937
+ if (node.state || node.properties?.state) {
3938
+ props.templateState = node.state || node.properties?.state;
3939
+ }
3940
+ if (node.properties) {
3941
+ for (const [key, value] of Object.entries(node.properties)) {
3942
+ if (key !== "state") {
3943
+ props[key] = value;
3944
+ }
3945
+ }
3946
+ }
3947
+ return this.createNode("Template", props, node.name);
3948
+ }
3949
+ compileSpatialGroup(group, templateMap) {
3950
+ const props = {};
3951
+ if (group.properties) {
3952
+ for (const prop of group.properties) {
3953
+ if (prop.key === "position") props.position = prop.value;
3954
+ else if (prop.key === "rotation") props.rotation = prop.value;
3955
+ else if (prop.key === "scale")
3956
+ props.scale = Array.isArray(prop.value) ? prop.value : [prop.value, prop.value, prop.value];
3957
+ }
3958
+ }
3959
+ const node = this.createNode("group", props, group.name);
3960
+ if (group.objects) {
3961
+ for (const obj of group.objects)
3962
+ node.children.push(this.compileObjectDecl(obj, templateMap));
3963
+ }
3964
+ if (group.groups) {
3965
+ for (const sub of group.groups)
3966
+ node.children.push(this.compileSpatialGroup(sub, templateMap));
3967
+ }
3968
+ return node;
3969
+ }
3970
+ compileTimelineBlock(timeline) {
3971
+ const entries = [];
3972
+ if (timeline.entries) {
3973
+ for (const entry of timeline.entries) {
3974
+ const action = entry.action;
3975
+ const entryProps = { time: entry.time, actionKind: action.kind };
3976
+ if (action.kind === "animate") {
3977
+ entryProps.target = action.target;
3978
+ entryProps.properties = action.properties;
3979
+ } else if (action.kind === "emit") {
3980
+ entryProps.event = action.event;
3981
+ if (action.data !== void 0) entryProps.data = action.data;
3982
+ } else if (action.kind === "call") {
3983
+ entryProps.method = action.method;
3984
+ if (action.args) entryProps.args = action.args;
3985
+ }
3986
+ entries.push(this.createNode("TimelineEntry", entryProps));
3987
+ }
3988
+ }
3989
+ const safeName = timeline.name ? escapeStringValue(timeline.name, "JSX") : void 0;
3990
+ const timelineNode = this.createNode(
3991
+ "Timeline",
3992
+ { autoplay: timeline.autoplay, loop: timeline.loop },
3993
+ safeName
3994
+ );
3995
+ timelineNode.children = entries;
3996
+ return timelineNode;
3997
+ }
3998
+ compileAudioBlock(audio) {
3999
+ const props = {};
4000
+ if (audio.properties) {
4001
+ for (const prop of audio.properties) {
4002
+ if (prop.key === "src" || prop.key === "source") {
4003
+ props.src = prop.value;
4004
+ } else if (prop.key === "rolloff") {
4005
+ props.rolloffFactor = prop.value;
4006
+ } else {
4007
+ props[prop.key] = prop.value;
4008
+ }
4009
+ }
4010
+ }
4011
+ const safeName = audio.name ? escapeStringValue(audio.name, "JSX") : void 0;
4012
+ return this.createNode("Audio", props, safeName);
4013
+ }
4014
+ compileZoneBlock(zone) {
4015
+ const props = {};
4016
+ if (zone.properties) {
4017
+ for (const prop of zone.properties) {
4018
+ props[prop.key] = prop.value;
4019
+ }
4020
+ }
4021
+ if (zone.handlers && zone.handlers.length > 0) {
4022
+ props.handlers = zone.handlers.map(
4023
+ (h) => ({
4024
+ event: h.event,
4025
+ parameters: h.parameters,
4026
+ body: h.body
4027
+ })
4028
+ );
4029
+ }
4030
+ const safeName = zone.name ? escapeStringValue(zone.name, "JSX") : void 0;
4031
+ return this.createNode("Zone", props, safeName);
4032
+ }
4033
+ compileUIBlock(ui) {
4034
+ const children = [];
4035
+ if (ui.elements) {
4036
+ for (const el of ui.elements) {
4037
+ const elProps = {};
4038
+ if (el.properties) {
4039
+ for (const prop of el.properties) {
4040
+ if (prop.key === "font_size") {
4041
+ elProps.fontSize = prop.value;
4042
+ } else {
4043
+ elProps[prop.key] = this.resolveValue(prop.value);
4044
+ }
4045
+ }
4046
+ }
4047
+ const safeElName = el.name ? escapeStringValue(el.name, "JSX") : void 0;
4048
+ children.push(this.createNode("UIElement", elProps, safeElName));
4049
+ }
4050
+ }
4051
+ const uiNode = this.createNode("UI", {}, "__ui");
4052
+ uiNode.children = children;
4053
+ return uiNode;
4054
+ }
4055
+ compileTransitionBlock(transition) {
4056
+ const props = {};
4057
+ if (transition.properties) {
4058
+ for (const prop of transition.properties) {
4059
+ props[prop.key] = prop.value;
4060
+ }
4061
+ }
4062
+ const safeName = transition.name ? escapeStringValue(transition.name, "JSX") : void 0;
4063
+ return this.createNode("Transition", props, safeName);
4064
+ }
4065
+ compileConditionalBlock(cond, templateMap) {
4066
+ const children = [];
4067
+ if (cond.objects) {
4068
+ for (const obj of cond.objects)
4069
+ children.push(this.compileObjectDecl(obj, templateMap));
4070
+ }
4071
+ if (cond.spatialGroups) {
4072
+ for (const g of cond.spatialGroups)
4073
+ children.push(this.compileSpatialGroup(g, templateMap));
4074
+ }
4075
+ const elseChildren = [];
4076
+ if (cond.elseObjects) {
4077
+ for (const obj of cond.elseObjects)
4078
+ elseChildren.push(this.compileObjectDecl(obj, templateMap));
4079
+ }
4080
+ if (cond.elseSpatialGroups) {
4081
+ for (const g of cond.elseSpatialGroups)
4082
+ elseChildren.push(this.compileSpatialGroup(g, templateMap));
4083
+ }
4084
+ const conditionalNode = this.createNode("ConditionalGroup", {
4085
+ condition: cond.condition,
4086
+ elseChildren: elseChildren.length > 0 ? elseChildren : void 0
4087
+ });
4088
+ conditionalNode.children = children;
4089
+ return conditionalNode;
4090
+ }
4091
+ compileForEachBlock(iter, templateMap) {
4092
+ const templateChildren = [];
4093
+ if (iter.objects) {
4094
+ for (const obj of iter.objects)
4095
+ templateChildren.push(this.compileObjectDecl(obj, templateMap));
4096
+ }
4097
+ if (iter.spatialGroups) {
4098
+ for (const g of iter.spatialGroups)
4099
+ templateChildren.push(this.compileSpatialGroup(g, templateMap));
4100
+ }
4101
+ const forEachNode = this.createNode("ForEachGroup", {
4102
+ variable: iter.variable,
4103
+ iterable: iter.iterable
4104
+ });
4105
+ forEachNode.children = templateChildren;
4106
+ return forEachNode;
4107
+ }
4108
+ /**
4109
+ * Resolve a property value, converting bind expressions into runtime-reactive markers.
4110
+ */
4111
+ resolveValue(value) {
4112
+ if (value && typeof value === "object" && value.__bind) {
4113
+ return {
4114
+ __bind: true,
4115
+ source: value.source,
4116
+ transform: value.transform
4117
+ };
4118
+ }
4119
+ return value;
4120
+ }
4121
+ // ─── Shared Helpers ───────────────────────────────────────────────────
4122
+ injectDefaultLighting(root) {
4123
+ if (!this._defaultLighting) return;
4124
+ if (!this.treeHasLights(root)) {
4125
+ const shadowSize = this.tierScales.shadowMapSize;
4126
+ root.children?.unshift(
4127
+ this.createNode("ambientLight", { intensity: 0.4, color: "#ffffff" }),
4128
+ this.createNode("directionalLight", {
4129
+ intensity: 1,
4130
+ position: [5, 10, 5],
4131
+ castShadow: true,
4132
+ "shadow-mapSize": [shadowSize, shadowSize],
4133
+ color: "#ffffff"
4134
+ })
4135
+ );
4136
+ }
4137
+ }
4138
+ treeHasLights(node) {
4139
+ if (node.type.toLowerCase().includes("light")) return true;
4140
+ return node.children?.some((c) => this.treeHasLights(c)) || false;
4141
+ }
4142
+ hasPostProcessing(node) {
4143
+ if (node.traits?.has("bloom") || node.traits?.has("postprocessing"))
4144
+ return true;
4145
+ if (node.props.bloom) return true;
4146
+ return node.children?.some((c) => this.hasPostProcessing(c)) || false;
4147
+ }
4148
+ extractPostProcessingNodes(node) {
4149
+ const effects = [];
4150
+ const ppTrait = node.traits?.get(
4151
+ "postprocessing"
4152
+ );
4153
+ if (ppTrait) {
4154
+ if (ppTrait.bloom)
4155
+ effects.push(this.createNode("Bloom", ppTrait.bloom));
4156
+ if (ppTrait.ssao)
4157
+ effects.push(this.createNode("SSAO", ppTrait.ssao));
4158
+ if (ppTrait.vignette)
4159
+ effects.push(this.createNode("Vignette", ppTrait.vignette));
4160
+ }
4161
+ if (node.props.bloom) {
4162
+ const bloom = node.props.bloom;
4163
+ const bloomProps = typeof bloom === "object" && bloom !== null ? bloom : { intensity: 1 };
4164
+ effects.push(this.createNode("Bloom", bloomProps));
4165
+ }
4166
+ node.children?.forEach((child) => effects.push(...this.extractPostProcessingNodes(child)));
4167
+ return effects;
4168
+ }
4169
+ mapType(type, props) {
4170
+ if (type === "environment") {
4171
+ if (props.name && typeof props.name === "string" && ENVIRONMENT_PRESETS[props.name]) {
4172
+ Object.assign(props, ENVIRONMENT_PRESETS[props.name]);
4173
+ }
4174
+ return "Environment";
4175
+ }
4176
+ if (type === "light") {
4177
+ const lightType = props.type || "directional";
4178
+ const lightMapping = {
4179
+ directional: "directionalLight",
4180
+ point: "pointLight",
4181
+ spot: "spotLight",
4182
+ hemisphere: "hemisphereLight",
4183
+ ambient: "ambientLight",
4184
+ area: "rectAreaLight"
4185
+ };
4186
+ return lightMapping[lightType] || "directionalLight";
4187
+ }
4188
+ if (type === "portal") return "Portal";
4189
+ if (type === "sparkles") return "Sparkles";
4190
+ if (MESH_TYPES.has(type)) {
4191
+ props.hsType = type;
4192
+ return "mesh";
4193
+ }
4194
+ const mapping = {
4195
+ ambient_light: "ambientLight",
4196
+ model: "gltfModel",
4197
+ audio: "positionalAudio",
4198
+ composition: "group",
4199
+ scale: "group",
4200
+ focus: "group",
4201
+ spatial_agent: "SpatialAgent",
4202
+ spatial_container: "group",
4203
+ ui_panel: "UIPanel",
4204
+ ui_text: "UIText",
4205
+ ui_button: "UIButton",
4206
+ ui_slider: "UISlider",
4207
+ ui_input: "UIInput",
4208
+ ui_image: "UIImage",
4209
+ ui_chart: "UIChart",
4210
+ ui_gauge: "UIGauge",
4211
+ ui_value: "UIValue",
4212
+ ui_status_indicator: "UIStatusIndicator",
4213
+ tool_slot: "ToolSlot",
4214
+ behavior: "group",
4215
+ system: "System",
4216
+ component: "Component",
4217
+ dna: "DNA",
4218
+ gaussian_splat: "GaussianSplat",
4219
+ splat: "GaussianSplat",
4220
+ nerf: "NeRF",
4221
+ volumetric_video: "VolumetricVideo",
4222
+ world: "group"
4223
+ };
4224
+ return mapping[type] || type;
4225
+ }
4226
+ compileProperties(node, rawProps) {
4227
+ const expandedProps = this.expandSpreads(rawProps);
4228
+ const props = { ...expandedProps };
4229
+ if (node.position) {
4230
+ props.position = node.position;
4231
+ }
4232
+ if (rawProps.position && Array.isArray(rawProps.position)) {
4233
+ props.position = rawProps.position;
4234
+ }
4235
+ if (node.hologram) {
4236
+ const h = node.hologram;
4237
+ if (h.color) props.color = h.color;
4238
+ if (MESH_TYPES.has(node.type)) {
4239
+ props.args = this.getGeometryArgs(node.type, h);
4240
+ props.hsType = node.type;
4241
+ }
4242
+ }
4243
+ if (rawProps.scale !== void 0 && !props.scale) {
4244
+ props.scale = Array.isArray(rawProps.scale) ? rawProps.scale : [rawProps.scale, rawProps.scale, rawProps.scale];
4245
+ }
4246
+ if (rawProps.geometry && !props.hsType) {
4247
+ props.hsType = rawProps.geometry;
4248
+ props.args = this.getGeometryArgs(rawProps.geometry, { size: rawProps.size || 1 });
4249
+ }
4250
+ if (rawProps.material && typeof rawProps.material === "string" && MATERIAL_PRESETS[rawProps.material]) {
4251
+ props.materialProps = {
4252
+ ...MATERIAL_PRESETS[rawProps.material],
4253
+ ...props.materialProps
4254
+ };
4255
+ }
4256
+ if (node.directives) {
4257
+ for (const d of node.directives) {
4258
+ if (d.type === "trait") {
4259
+ if (d.name === "grabbable") {
4260
+ props.castShadow = true;
4261
+ props.grabbable = d.config || true;
4262
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
4263
+ if (!props.collider) props.collider = { type: "auto" };
4264
+ } else if (d.name === "animated") {
4265
+ props.animated = d.config || true;
4266
+ } else if (d.name === "spatial_audio" || d.name === "voice") {
4267
+ props.spatial = true;
4268
+ } else if (d.name === "gem_resonance") {
4269
+ props.gemResonance = gemResonanceConfig(d.config);
4270
+ props.spatial = true;
4271
+ } else if (d.name === "networked") {
4272
+ props.networked = d.config || true;
4273
+ } else if (d.name === "moldable") {
4274
+ props.moldable = d.config || true;
4275
+ } else if (d.name === "stretchable") {
4276
+ props.stretchable = d.config || true;
4277
+ } else if (d.name === "ai_driven") {
4278
+ props.ai_driven = d.config || true;
4279
+ } else if (d.name === "dialogue") {
4280
+ props.dialogue = d.config || true;
4281
+ } else if (d.name === "gesture") {
4282
+ props.gesture = d.config || true;
4283
+ } else if (d.name === "haptic") {
4284
+ props.haptic = d.config || true;
4285
+ } else if (d.name === "avatar_embodiment") {
4286
+ props.avatarEmbodiment = d.config || true;
4287
+ } else if (d.name === "lip_sync") {
4288
+ props.lipSync = d.config || true;
4289
+ } else if (d.name === "emotion_directive") {
4290
+ props.emotionDirective = d.config || true;
4291
+ } else if (d.name === "stt") {
4292
+ props.stt = d.config || true;
4293
+ } else if (d.name === "tts") {
4294
+ props.tts = d.config || true;
4295
+ } else if (d.name === "generate") {
4296
+ props.generate = d.config;
4297
+ } else if (d.name === "skeleton") {
4298
+ props.skeleton = d.config || true;
4299
+ } else if (d.name === "body") {
4300
+ props.body = d.config || true;
4301
+ } else if (d.name === "gaussian_splat") {
4302
+ props.gaussianSplat = d.config || true;
4303
+ } else if (d.name === "nerf") {
4304
+ props.nerf = d.config || true;
4305
+ } else if (d.name === "volumetric_video") {
4306
+ props.volumetricVideo = d.config || true;
4307
+ } else if (d.name === "web_surface") {
4308
+ props.webSurface = d.config || true;
4309
+ }
4310
+ }
4311
+ }
4312
+ }
4313
+ delete props.type;
4314
+ delete props.geometry;
4315
+ return props;
4316
+ }
4317
+ applyGraphicsConfig(r3fNode, graphics) {
4318
+ if (graphics.material) {
4319
+ const m = graphics.material;
4320
+ const materialProps = {};
4321
+ if (m.preset && MATERIAL_PRESETS[m.preset]) {
4322
+ Object.assign(materialProps, MATERIAL_PRESETS[m.preset]);
4323
+ }
4324
+ if (m.type === "pbr" && m.pbr) {
4325
+ if (m.pbr.baseColor) materialProps["color"] = this.mapColor(m.pbr.baseColor);
4326
+ if (m.pbr.metallic !== void 0) materialProps["metalness"] = m.pbr.metallic;
4327
+ if (m.pbr.roughness !== void 0) materialProps["roughness"] = m.pbr.roughness;
4328
+ if (m.pbr.emission) materialProps["emissive"] = this.mapColor(m.pbr.emission);
4329
+ if (m.pbr.emissionStrength) materialProps["emissiveIntensity"] = m.pbr.emissionStrength;
4330
+ if (m.pbr.clearcoat !== void 0) materialProps["clearcoat"] = m.pbr.clearcoat;
4331
+ if (m.pbr.transmission !== void 0) materialProps["transmission"] = m.pbr.transmission;
4332
+ if (m.pbr.ior !== void 0) materialProps["ior"] = m.pbr.ior;
4333
+ if (m.pbr.iridescence !== void 0) materialProps["iridescence"] = m.pbr.iridescence;
4334
+ }
4335
+ const prior = r3fNode.props.materialProps ?? {};
4336
+ r3fNode.props.materialProps = { ...prior, ...materialProps };
4337
+ }
4338
+ if (graphics.lighting) {
4339
+ const l = graphics.lighting;
4340
+ if (r3fNode.type.toLowerCase().includes("light")) {
4341
+ if (l.shadows) r3fNode.props.castShadow = true;
4342
+ if (l.intensity !== void 0) r3fNode.props.intensity = l.intensity;
4343
+ if (l.color) r3fNode.props.color = this.mapColor(l.color);
4344
+ }
4345
+ if (r3fNode.type === "Environment" && l.preset) {
4346
+ r3fNode.props.preset = l.preset;
4347
+ }
4348
+ }
4349
+ if (graphics.networked) {
4350
+ r3fNode.props.networked = graphics.networked;
4351
+ }
4352
+ }
4353
+ mapColor(c) {
4354
+ if (typeof c === "string") return c;
4355
+ if (typeof c === "number") return `#${c.toString(16).padStart(6, "0")}`;
4356
+ if (c.r !== void 0) {
4357
+ const r = c.r > 1 ? c.r : Math.floor(c.r * 255);
4358
+ const g = c.g > 1 ? c.g : Math.floor(c.g * 255);
4359
+ const b = c.b > 1 ? c.b : Math.floor(c.b * 255);
4360
+ return `rgb(${r}, ${g}, ${b})`;
4361
+ }
4362
+ return "#ffffff";
4363
+ }
4364
+ getGeometryArgs(type, hologram) {
4365
+ const size = hologram.size || 1;
4366
+ switch (type) {
4367
+ case "sphere":
4368
+ case "orb":
4369
+ return [size * 0.5, 32, 32];
4370
+ case "cube":
4371
+ case "box":
4372
+ return [size, size, size];
4373
+ case "cylinder":
4374
+ return [size * 0.5, size * 0.5, size, 32];
4375
+ case "pyramid":
4376
+ case "cone":
4377
+ return [size * 0.5, 0, size, 4];
4378
+ case "plane":
4379
+ return [size, size];
4380
+ case "torus":
4381
+ return [size * 0.5, size * 0.15, 16, 32];
4382
+ case "ring":
4383
+ return [size * 0.3, size * 0.5, 32];
4384
+ case "capsule":
4385
+ return [size * 0.3, size * 0.5, 4, 16];
4386
+ default:
4387
+ return [size, size, size];
4388
+ }
4389
+ }
4390
+ };
4391
+ }
4392
+ });
4393
+
4394
+ export { ASTNodePool, ENVIRONMENT_PRESETS, MATERIAL_PRESETS, QUALITY_TIER_SCALES, R3FCompiler, R3FCompiler_exports, UI_COMPONENT_PRESETS, init_ObjectPool, init_R3FCompiler, init_visual, registerAllPresets };
4395
+ //# sourceMappingURL=chunk-BGY3SDG3.js.map
4396
+ //# sourceMappingURL=chunk-BGY3SDG3.js.map