@holoscript/core 8.0.7 → 8.0.9

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 (462) hide show
  1. package/bin/holoscript.cjs +5 -1
  2. package/dist/GLTFPipeline-L76YTXKA.js +15 -0
  3. package/dist/GLTFPipeline-ZWJN7GI6.cjs +36 -0
  4. package/dist/HoloCompositionParser-K76KTEEE.js +12 -0
  5. package/dist/HoloCompositionParser-UZH6Y4HO.cjs +45 -0
  6. package/dist/HoloScriptCodeParser-2D4ERFUZ.js +6 -0
  7. package/dist/HoloScriptCodeParser-UDRLDA7I.cjs +23 -0
  8. package/dist/HoloScriptPlusParser-FTMCGWXD.js +13 -0
  9. package/dist/HoloScriptPlusParser-LQR5GIKF.cjs +30 -0
  10. package/dist/HoloScriptRuntime-UTRLJI5L.js +12 -0
  11. package/dist/HoloScriptRuntime-YBYXJHJN.cjs +21 -0
  12. package/dist/SceneIRCompiler-63KA3M2F.js +17 -0
  13. package/dist/SceneIRCompiler-KWUFHZ4O.cjs +42 -0
  14. package/dist/{USDZExporter-AUHZODOF.cjs → USDZExporter-ML4UMIGC.cjs} +3 -3
  15. package/dist/{USDZExporter-GXB4AUSG.js → USDZExporter-ZFKLQ76G.js} +3 -3
  16. package/dist/agents/index.cjs +1 -1
  17. package/dist/agents/index.js +1 -1
  18. package/dist/audit/AuditLogger.d.ts +106 -0
  19. package/dist/audit/AuditQueryBuilder.d.ts +79 -0
  20. package/dist/audit/ComplianceReporter.d.ts +90 -0
  21. package/dist/audit/index.d.ts +13 -0
  22. package/dist/{chunk-FGMDMJM7.js → chunk-2BYAUHBO.js} +3 -3
  23. package/dist/{chunk-EDPYCLRC.cjs → chunk-2E6PP5UE.cjs} +83 -59
  24. package/dist/{chunk-GASCWJK5.js → chunk-2EGGAZT3.js} +65 -287
  25. package/dist/{chunk-SIEXCILW.js → chunk-2I3XAGMF.js} +3 -3
  26. package/dist/{chunk-OS533P33.cjs → chunk-2KKOYZYI.cjs} +1074 -1655
  27. package/dist/chunk-2MQKNDNH.js +51 -0
  28. package/dist/{chunk-7DMMMBCY.cjs → chunk-2X3IPCBK.cjs} +10 -10
  29. package/dist/chunk-2ZOTBO25.cjs +202 -0
  30. package/dist/chunk-356N4NPM.cjs +152 -0
  31. package/dist/{chunk-X3GJPRVK.cjs → chunk-36NPLOI4.cjs} +92 -81
  32. package/dist/{chunk-SLU6UPJI.cjs → chunk-37HHY7RH.cjs} +5 -5
  33. package/dist/{chunk-YDPEHCCI.cjs → chunk-3CDDRUER.cjs} +3 -118
  34. package/dist/chunk-3F7ZZWIN.js +1651 -0
  35. package/dist/chunk-3ILD7TKP.cjs +187 -0
  36. package/dist/{chunk-X27QRG4C.cjs → chunk-3IUHTGDD.cjs} +153 -41
  37. package/dist/{chunk-PXNZ6TME.js → chunk-4376VHNJ.js} +60 -36
  38. package/dist/{chunk-YKGPCZEE.cjs → chunk-4FIBOJW6.cjs} +10 -10
  39. package/dist/chunk-4Q7RKQQI.cjs +14195 -0
  40. package/dist/{chunk-YCM6QQRT.cjs → chunk-566ZB4LZ.cjs} +180 -8
  41. package/dist/{chunk-2Y3V22SG.js → chunk-5CURIYGT.js} +3 -3
  42. package/dist/{chunk-QBWNJXNR.js → chunk-5FYMCVBY.js} +5 -5
  43. package/dist/{chunk-ZA34AN3R.js → chunk-5LVFTGKH.js} +841 -12
  44. package/dist/chunk-63AUAIL6.js +48 -0
  45. package/dist/chunk-655FATJU.js +110 -0
  46. package/dist/{chunk-TQ377OLB.cjs → chunk-65S62L4D.cjs} +28 -22
  47. package/dist/chunk-6NTAZN5Z.cjs +502 -0
  48. package/dist/chunk-6TRX6AR2.js +9376 -0
  49. package/dist/chunk-6ZCCLKS2.cjs +51 -0
  50. package/dist/{chunk-MDR235RZ.js → chunk-734OB5SK.js} +721 -8
  51. package/dist/{chunk-Q2Q34NF3.js → chunk-77QI552M.js} +6 -6
  52. package/dist/{chunk-WKX5AMOY.js → chunk-7I74JWPW.js} +3 -3
  53. package/dist/{chunk-5FSKKMR7.cjs → chunk-7IDJDMPU.cjs} +232 -4
  54. package/dist/chunk-7VBKRGIZ.cjs +847 -0
  55. package/dist/{chunk-KCPHASCO.js → chunk-AATYYLYK.js} +5 -5
  56. package/dist/{chunk-WFKVS2K4.cjs → chunk-AUZRKIHQ.cjs} +1101 -55
  57. package/dist/{chunk-DTGBOSEM.cjs → chunk-AWXFEAQL.cjs} +12 -12
  58. package/dist/{chunk-THCK6ECW.js → chunk-B3CWTCK2.js} +231 -3
  59. package/dist/chunk-BCP4E7MD.cjs +997 -0
  60. package/dist/chunk-BG7RPYJP.js +91 -0
  61. package/dist/{chunk-VF257YKO.js → chunk-BP4KTMLY.js} +117 -5
  62. package/dist/{chunk-YN6IETRZ.js → chunk-BQJ3YBF3.js} +6424 -987
  63. package/dist/{chunk-KOUAQL2B.cjs → chunk-CANAL6CT.cjs} +1569 -168
  64. package/dist/{chunk-FDSGHPAK.js → chunk-CBSDJF3B.js} +3 -3
  65. package/dist/{chunk-FEWUHQNM.cjs → chunk-CFVK26P4.cjs} +4 -4
  66. package/dist/{chunk-M7K4LE66.cjs → chunk-CI33NINL.cjs} +4 -4
  67. package/dist/{chunk-2OWDB4FB.js → chunk-CKV5NYAE.js} +6 -6
  68. package/dist/{chunk-LPS5AMQD.cjs → chunk-CM4NHXVO.cjs} +24 -24
  69. package/dist/chunk-D3HSRXYB.js +115 -0
  70. package/dist/{chunk-FNHJRI32.js → chunk-DBH3D2MU.js} +1561 -160
  71. package/dist/{chunk-GW3LKD5C.js → chunk-DJNH4HFW.js} +3 -3
  72. package/dist/{chunk-2GCNOI2U.cjs → chunk-DN6F4DHH.cjs} +9 -3
  73. package/dist/chunk-DQRJ5RJG.js +432 -0
  74. package/dist/{chunk-C7ZBSV2Q.js → chunk-DUG3OQAS.js} +106 -43
  75. package/dist/chunk-ECUYJOJ2.cjs +199 -0
  76. package/dist/chunk-EEMTCAK7.js +182 -0
  77. package/dist/{chunk-3SKLAUDD.cjs → chunk-EI3J6LTW.cjs} +359 -581
  78. package/dist/{chunk-SSSN7VAM.js → chunk-EM2OGPYE.js} +4 -4
  79. package/dist/{chunk-56VOWURB.cjs → chunk-ENZCIQZC.cjs} +522 -453
  80. package/dist/chunk-ESBXUYOC.cjs +836 -0
  81. package/dist/{chunk-L5U4W6JC.js → chunk-ESSEF6U2.js} +4 -4
  82. package/dist/chunk-ET3AN4W3.js +824 -0
  83. package/dist/chunk-EXKSFGSX.cjs +14 -14
  84. package/dist/{chunk-I76GIKN7.cjs → chunk-F3YT6GUF.cjs} +17 -17
  85. package/dist/{chunk-WRWEX5ZF.js → chunk-F75DZBBI.js} +3 -3
  86. package/dist/{chunk-4JGRWHZJ.js → chunk-FG6PYGIZ.js} +12 -6
  87. package/dist/chunk-FGGJQRLZ.js +14 -14
  88. package/dist/{chunk-SXOSDZD6.js → chunk-FWCHPCD4.js} +128 -10
  89. package/dist/{chunk-XW6IXEQH.cjs → chunk-G35CAQ7I.cjs} +5 -5
  90. package/dist/{chunk-7VMGP2FW.js → chunk-G6KACNMO.js} +132 -188
  91. package/dist/{chunk-FJPADH77.cjs → chunk-GAWJJAGT.cjs} +6 -6
  92. package/dist/chunk-GGR7QUKK.cjs +4724 -0
  93. package/dist/chunk-GIBF4BHH.js +14098 -0
  94. package/dist/{chunk-AWB7QYY6.cjs → chunk-GILYQ5VH.cjs} +6 -6
  95. package/dist/{chunk-FWVYAMNW.cjs → chunk-GKFCHGCM.cjs} +4 -4
  96. package/dist/{chunk-Y3ZFVUUU.js → chunk-GLEJ2TLS.js} +3 -3
  97. package/dist/{chunk-3GWWJT7L.js → chunk-GP3OKSKT.js} +13 -13
  98. package/dist/chunk-GTIPOEHN.js +196 -0
  99. package/dist/{chunk-LMJ5EBV7.cjs → chunk-GZPUA2TL.cjs} +16 -15
  100. package/dist/{chunk-IELX2OKI.js → chunk-H4LJ4HEA.js} +3 -115
  101. package/dist/{chunk-ACVWFGBI.cjs → chunk-HCX4SMFK.cjs} +3 -3
  102. package/dist/{chunk-HYNTS5CP.js → chunk-HHRZ6STP.js} +24 -2
  103. package/dist/chunk-HIDEIEFG.js +48 -0
  104. package/dist/{chunk-W6RW64BB.cjs → chunk-HSWBIDZM.cjs} +228 -5
  105. package/dist/{chunk-GSOUNWEL.js → chunk-HVX7QQYK.js} +1035 -1616
  106. package/dist/{chunk-TRCGG42I.cjs → chunk-IFW5IW4L.cjs} +6502 -1019
  107. package/dist/{chunk-F5LKJ6F5.cjs → chunk-IJU6AS67.cjs} +32 -28
  108. package/dist/{chunk-TVANHNJ7.js → chunk-IK6Z2HNC.js} +173 -3
  109. package/dist/{chunk-QGMUTVVH.cjs → chunk-IS7NTKY5.cjs} +20 -20
  110. package/dist/{chunk-YFVQWSNJ.js → chunk-IXWGYWH6.js} +3 -3
  111. package/dist/chunk-J2DAS2PL.js +148 -0
  112. package/dist/chunk-JBQXZIWB.js +148 -0
  113. package/dist/chunk-JBYBMBMW.js +261 -0
  114. package/dist/{chunk-LWUOUCYL.js → chunk-JEJ7TT54.js} +5 -5
  115. package/dist/{chunk-DUCB6LGL.js → chunk-JOTCTHN5.js} +211 -5
  116. package/dist/{chunk-47RUFYKR.js → chunk-K56UVEXV.js} +3 -3
  117. package/dist/{chunk-XSFNHP2E.js → chunk-KB26H447.js} +3 -3
  118. package/dist/{chunk-3NGDZZR4.js → chunk-KEYG7HGY.js} +430 -37
  119. package/dist/{chunk-DY72BMU5.js → chunk-KFVNCW4Q.js} +4 -4
  120. package/dist/chunk-KPGC7SK2.js +192 -0
  121. package/dist/chunk-KROXXBK5.cjs +53 -0
  122. package/dist/{chunk-ZPZAVHXL.cjs → chunk-LB3ZZMKT.cjs} +137 -19
  123. package/dist/chunk-LDYZWNJW.cjs +1654 -0
  124. package/dist/{chunk-ULMSSHCJ.cjs → chunk-LMB555QB.cjs} +405 -38
  125. package/dist/{chunk-CBJY23VL.js → chunk-MD4IVS42.js} +3 -3
  126. package/dist/{chunk-VMLKSV26.js → chunk-MDDWEBCX.js} +226 -3
  127. package/dist/chunk-MUWH4QK5.cjs +94 -0
  128. package/dist/{chunk-T6W3Z3SH.cjs → chunk-N2ILK7BF.cjs} +4 -4
  129. package/dist/{chunk-6EX3I5P4.cjs → chunk-N74QRJGP.cjs} +6 -6
  130. package/dist/chunk-NFFHLX37.cjs +132 -0
  131. package/dist/chunk-NJSYWX7H.js +190 -0
  132. package/dist/{chunk-SH5PPVK7.cjs → chunk-NQN5LFN4.cjs} +165 -221
  133. package/dist/chunk-NTQRFOPP.cjs +56 -0
  134. package/dist/{chunk-YFWRJW4B.js → chunk-NWMJPTVL.js} +51 -55
  135. package/dist/{chunk-63ZGNR2T.cjs → chunk-OC6GV5QH.cjs} +42 -42
  136. package/dist/{chunk-7E7GCQCK.js → chunk-OG3MBHM3.js} +9 -3
  137. package/dist/chunk-OMNHTCS4.cjs +264 -0
  138. package/dist/chunk-OQXB6NNC.cjs +117 -0
  139. package/dist/{chunk-Y57W2CT5.cjs → chunk-OV46CCA2.cjs} +51 -55
  140. package/dist/{chunk-6PRZIHGL.cjs → chunk-OV6HHKLE.cjs} +21 -266
  141. package/dist/{chunk-C37BHB7N.cjs → chunk-P26YYPOO.cjs} +5 -5
  142. package/dist/{chunk-2BZHWUSR.cjs → chunk-P7JEKJTZ.cjs} +16 -16
  143. package/dist/{chunk-NGBXXZLL.cjs → chunk-PDXX5UI4.cjs} +45 -45
  144. package/dist/{chunk-FHQFPYV4.js → chunk-PJFTTSKE.js} +8 -7
  145. package/dist/{chunk-GVFJ6T4S.cjs → chunk-PVODJEJ7.cjs} +721 -8
  146. package/dist/{chunk-ZZ7RO2UQ.js → chunk-Q265VZJ4.js} +3 -3
  147. package/dist/{chunk-E7JP3BS3.cjs → chunk-Q47JEE2C.cjs} +4 -4
  148. package/dist/chunk-QBY7LRN2.js +281 -0
  149. package/dist/{chunk-Z6PMDS4G.js → chunk-QDQWKSU3.js} +1090 -53
  150. package/dist/{chunk-GH6C2QGW.cjs → chunk-QEDMOGF3.cjs} +857 -16
  151. package/dist/{chunk-5WUNN6ZN.cjs → chunk-QHSAVOOL.cjs} +24 -2
  152. package/dist/chunk-QJNCDVYM.cjs +137 -0
  153. package/dist/chunk-QM7FJB5W.js +4717 -0
  154. package/dist/chunk-QQFB4RT2.cjs +448 -0
  155. package/dist/chunk-QSYBHQAD.cjs +196 -0
  156. package/dist/{chunk-UGXHYIWT.cjs → chunk-QUJ3ZB55.cjs} +28 -28
  157. package/dist/{chunk-2YSNA2F2.cjs → chunk-QVJMDVYZ.cjs} +5 -5
  158. package/dist/chunk-RAJMAX6D.js +131 -0
  159. package/dist/{chunk-VVKVQZI6.js → chunk-RAN3ECAS.js} +3 -3
  160. package/dist/chunk-RKGUZBOC.js +79 -0
  161. package/dist/{chunk-HLFDZ35S.cjs → chunk-RRQIAJLQ.cjs} +8 -8
  162. package/dist/{chunk-PABONWKI.js → chunk-RXQNRZ5F.js} +3 -3
  163. package/dist/{chunk-7ZHYEITD.cjs → chunk-S4O7CFHQ.cjs} +10 -11
  164. package/dist/chunk-SE7ANBGN.js +128 -0
  165. package/dist/{chunk-X2AVEAZM.cjs → chunk-SJIRCTIS.cjs} +176 -2
  166. package/dist/{chunk-WXQ57LAO.js → chunk-SQXAZHDG.js} +4 -4
  167. package/dist/chunk-SR73L5ZP.cjs +84 -0
  168. package/dist/{chunk-OABEO6HH.js → chunk-SZOLTWWD.js} +2349 -214
  169. package/dist/{chunk-5JEU52DW.js → chunk-TPZ3BN2D.js} +3 -3
  170. package/dist/{chunk-QFU53KRH.js → chunk-TSTFYGGX.js} +4 -5
  171. package/dist/{chunk-EBS32AJI.cjs → chunk-TZCFKZ6Z.cjs} +5 -5
  172. package/dist/chunk-UCVZXQ63.js +724 -0
  173. package/dist/chunk-UGQ3QNV6.js +992 -0
  174. package/dist/chunk-UNMVGZVW.js +142 -0
  175. package/dist/{chunk-TEVX443G.js → chunk-UTUD6GJI.js} +178 -6
  176. package/dist/chunk-UXBYA7DV.cjs +155 -0
  177. package/dist/chunk-V6GXFSK7.cjs +443 -0
  178. package/dist/chunk-VHORVGCG.cjs +761 -0
  179. package/dist/{chunk-B4EKV6HQ.js → chunk-VKCTYLDN.js} +500 -442
  180. package/dist/{chunk-O3MGZDCT.cjs → chunk-VTEXJOSD.cjs} +63 -63
  181. package/dist/chunk-VVAAZITA.cjs +287 -0
  182. package/dist/{chunk-V7AKE5VT.cjs → chunk-W2GA3EQB.cjs} +435 -42
  183. package/dist/chunk-W4GABFCR.js +37 -0
  184. package/dist/chunk-WKEK4NCA.js +490 -0
  185. package/dist/{chunk-5A4TCHOC.cjs → chunk-WNYXT4TE.cjs} +4 -4
  186. package/dist/{chunk-S762UEV5.js → chunk-WTH23ISI.js} +6 -6
  187. package/dist/{chunk-BTKZGHAV.js → chunk-WWNCM473.js} +10 -6
  188. package/dist/{chunk-7X5PNIQJ.js → chunk-X3YFRH6K.js} +27 -25
  189. package/dist/{chunk-4YNYPHH3.cjs → chunk-X75H75UY.cjs} +2351 -213
  190. package/dist/{chunk-LYJJI7ZK.cjs → chunk-XCUDDFKC.cjs} +216 -9
  191. package/dist/chunk-YAO4HPJL.cjs +120 -0
  192. package/dist/chunk-YKY2JBER.cjs +9443 -0
  193. package/dist/chunk-YP5CHEYU.cjs +154 -0
  194. package/dist/{chunk-WRNEH5MO.js → chunk-YW3I2FQL.js} +18 -7
  195. package/dist/{chunk-BRNUPDHJ.js → chunk-Z557DVYN.js} +386 -19
  196. package/dist/{chunk-VSACG2AR.js → chunk-Z6LZUYZF.js} +21 -264
  197. package/dist/chunk-ZHPMP447.cjs +43 -0
  198. package/dist/{chunk-LODTHGST.cjs → chunk-ZK7KX5CD.cjs} +133 -70
  199. package/dist/{chunk-CCPSNT6B.cjs → chunk-ZRPALBQB.cjs} +5 -5
  200. package/dist/chunk-ZVFHPMC5.js +824 -0
  201. package/dist/chunk-ZVQMKUGJ.js +443 -0
  202. package/dist/cli/holoscript-runner.cjs +86 -48
  203. package/dist/cli/holoscript-runner.js +54 -16
  204. package/dist/codebase/index.cjs +1 -1
  205. package/dist/codebase/index.js +1 -1
  206. package/dist/compiler/agent-inference.cjs +11 -11
  207. package/dist/compiler/agent-inference.js +9 -6
  208. package/dist/compiler/android-xr.cjs +13 -12
  209. package/dist/compiler/android-xr.js +11 -10
  210. package/dist/compiler/android.cjs +12 -12
  211. package/dist/compiler/android.js +10 -10
  212. package/dist/compiler/business-quest.cjs +10 -10
  213. package/dist/compiler/business-quest.js +2 -2
  214. package/dist/compiler/coco.cjs +1 -1
  215. package/dist/compiler/coco.js +1 -1
  216. package/dist/compiler/context.cjs +9 -9
  217. package/dist/compiler/context.js +6 -6
  218. package/dist/compiler/daimon-seed.cjs +36 -0
  219. package/dist/compiler/daimon-seed.js +12 -0
  220. package/dist/compiler/domain-block-utils.cjs +205 -156
  221. package/dist/compiler/domain-block-utils.js +8 -7
  222. package/dist/compiler/dtdl.cjs +10 -10
  223. package/dist/compiler/dtdl.js +7 -7
  224. package/dist/compiler/gltf-pipeline.cjs +9 -9
  225. package/dist/compiler/gltf-pipeline.js +2 -2
  226. package/dist/compiler/godot.cjs +10 -9
  227. package/dist/compiler/godot.js +9 -8
  228. package/dist/compiler/incremental.cjs +11 -11
  229. package/dist/compiler/incremental.js +6 -6
  230. package/dist/compiler/index.cjs +2585 -3273
  231. package/dist/compiler/index.d.ts +149 -35
  232. package/dist/compiler/index.js +2197 -3102
  233. package/dist/compiler/ios.cjs +11 -11
  234. package/dist/compiler/ios.js +9 -9
  235. package/dist/compiler/llm-provider-capabilities.cjs +9 -9
  236. package/dist/compiler/llm-provider-capabilities.js +6 -6
  237. package/dist/compiler/nodetoy.cjs +1 -1
  238. package/dist/compiler/nodetoy.js +1 -1
  239. package/dist/compiler/openxr.cjs +11 -10
  240. package/dist/compiler/openxr.js +10 -9
  241. package/dist/compiler/remotion.cjs +1 -1
  242. package/dist/compiler/remotion.js +1 -1
  243. package/dist/compiler/reproducibility.cjs +1 -1
  244. package/dist/compiler/reproducibility.js +1 -1
  245. package/dist/compiler/sdf.cjs +11 -10
  246. package/dist/compiler/sdf.js +9 -8
  247. package/dist/compiler/semantic-scene.cjs +7 -7
  248. package/dist/compiler/semantic-scene.js +2 -2
  249. package/dist/compiler/state.cjs +9 -9
  250. package/dist/compiler/state.js +7 -7
  251. package/dist/compiler/trait-composition.cjs +11 -11
  252. package/dist/compiler/trait-composition.js +7 -7
  253. package/dist/compiler/traits/ProvenanceSemiring.d.ts +167 -0
  254. package/dist/compiler/traits/Semiring.d.ts +26 -0
  255. package/dist/compiler/unity.cjs +11 -10
  256. package/dist/compiler/unity.js +10 -9
  257. package/dist/compiler/unreal.cjs +12 -11
  258. package/dist/compiler/unreal.js +10 -9
  259. package/dist/compiler/urdf.cjs +18 -17
  260. package/dist/compiler/urdf.js +9 -8
  261. package/dist/compiler/usd-physics.cjs +11 -10
  262. package/dist/compiler/usd-physics.js +8 -7
  263. package/dist/compiler/visionos.cjs +11 -10
  264. package/dist/compiler/visionos.js +10 -9
  265. package/dist/compiler/vrchat.cjs +11 -10
  266. package/dist/compiler/vrchat.js +9 -8
  267. package/dist/compiler/wasm.cjs +14 -13
  268. package/dist/compiler/wasm.js +9 -8
  269. package/dist/compiler/webgpu.cjs +10 -9
  270. package/dist/compiler/webgpu.js +9 -8
  271. package/dist/constants.cjs +398 -0
  272. package/dist/constants.js +9 -0
  273. package/dist/coordinators/index.cjs +4 -1
  274. package/dist/coordinators/index.js +4 -1
  275. package/dist/debugger.cjs +11 -9
  276. package/dist/debugger.js +9 -7
  277. package/dist/{dist-ACXG6IH5.cjs → dist-GRMOP2UL.cjs} +341 -65
  278. package/dist/{dist-VD4L6V7Q.js → dist-ZBUKU2JG.js} +333 -63
  279. package/dist/entries/interop.cjs +23 -23
  280. package/dist/entries/interop.js +3 -3
  281. package/dist/entries/scripting.cjs +12 -11
  282. package/dist/entries/scripting.js +8 -7
  283. package/dist/evolution/index.cjs +66 -0
  284. package/dist/evolution/index.d.ts +162 -0
  285. package/dist/evolution/index.js +17 -0
  286. package/dist/hololand/index.cjs +41 -37
  287. package/dist/hololand/index.js +3 -3
  288. package/dist/index.cjs +12394 -3224
  289. package/dist/index.d.ts +260 -18
  290. package/dist/index.js +10755 -2182
  291. package/dist/keyword-registry/PluginKeywordRegistry.d.ts +138 -0
  292. package/dist/keyword-registry/index.cjs +29 -0
  293. package/dist/keyword-registry/index.d.ts +1 -0
  294. package/dist/keyword-registry/index.js +4 -0
  295. package/dist/math/tropical-spmv.cjs +11 -11
  296. package/dist/math/tropical-spmv.d.ts +1 -0
  297. package/dist/math/tropical-spmv.js +2 -2
  298. package/dist/math/tropicalSpmv.d.ts +43 -0
  299. package/dist/math/vec3.cjs +1 -1
  300. package/dist/math/vec3.js +1 -1
  301. package/dist/matter/StagedMatter.d.ts +82 -0
  302. package/dist/matter/index.cjs +17 -0
  303. package/dist/matter/index.d.ts +1 -0
  304. package/dist/matter/index.js +4 -0
  305. package/dist/{ml-dsa-Z7JDKW4L.js → ml-dsa-J6VKVT4K.js} +3 -3
  306. package/dist/{ml-dsa-FSKBTE3W.cjs → ml-dsa-MTIK4ZUQ.cjs} +23 -23
  307. package/dist/paper-0c-spike/index.cjs +1 -1
  308. package/dist/paper-0c-spike/index.js +1 -1
  309. package/dist/parameter-envelope/ParameterEnvelope.d.ts +128 -0
  310. package/dist/parameter-envelope/index.cjs +17 -0
  311. package/dist/parameter-envelope/index.d.ts +2 -0
  312. package/dist/parameter-envelope/index.js +4 -0
  313. package/dist/parser/HoloCompositionTypes.d.ts +2013 -0
  314. package/dist/parser/PipelineParser.d.ts +162 -0
  315. package/dist/parser.cjs +36 -20
  316. package/dist/parser.js +13 -9
  317. package/dist/plugin-manifest/ManifestAutoLoader.d.ts +35 -0
  318. package/dist/plugin-manifest/PluginManifest.d.ts +156 -0
  319. package/dist/plugin-manifest/index.cjs +25 -0
  320. package/dist/plugin-manifest/index.d.ts +2 -0
  321. package/dist/plugin-manifest/index.js +4 -0
  322. package/dist/plugin-solver-contract/PluginSolverContract.d.ts +288 -0
  323. package/dist/plugin-solver-contract/index.cjs +41 -0
  324. package/dist/plugin-solver-contract/index.d.ts +1 -0
  325. package/dist/plugin-solver-contract/index.js +4 -0
  326. package/dist/policy/ContentPolicyGate.d.ts +51 -0
  327. package/dist/policy/PolicyPack.d.ts +120 -0
  328. package/dist/policy/blocklist.d.ts +32 -0
  329. package/dist/policy/defaults.d.ts +44 -0
  330. package/dist/policy/index.cjs +106 -0
  331. package/dist/policy/index.d.ts +17 -0
  332. package/dist/policy/index.js +5 -0
  333. package/dist/policy/jsonLogic.d.ts +31 -0
  334. package/dist/policy/types.d.ts +174 -0
  335. package/dist/proof-composition/ProofCompositionLaw.d.ts +93 -0
  336. package/dist/proof-composition/index.cjs +25 -0
  337. package/dist/proof-composition/index.d.ts +1 -0
  338. package/dist/proof-composition/index.js +4 -0
  339. package/dist/receipts/hash-policy.d.ts +85 -0
  340. package/dist/reconstruction/index.cjs +75 -47
  341. package/dist/reconstruction/index.js +5 -5
  342. package/dist/runtime/plugin-trait-registrar.d.ts +36 -0
  343. package/dist/runtime.cjs +81 -79
  344. package/dist/runtime.js +9 -7
  345. package/dist/scene-presets-EDKYZ5GW.js +4 -0
  346. package/dist/scene-presets-NCW2CFRS.cjs +17 -0
  347. package/dist/self-improvement/index.cjs +1 -1
  348. package/dist/self-improvement/index.js +1 -1
  349. package/dist/{src-PT2FERDV.cjs → src-G3D7ZATQ.cjs} +545 -21
  350. package/dist/{src-J6CM4AUR.js → src-UXYA7HM6.js} +539 -16
  351. package/dist/storage/index.cjs +10 -10
  352. package/dist/storage/index.js +3 -3
  353. package/dist/testing.cjs +1 -1
  354. package/dist/testing.js +1 -1
  355. package/dist/tools/index.cjs +3631 -0
  356. package/dist/tools/index.js +3581 -0
  357. package/dist/traitDocs/traitDocs.cjs +9 -9
  358. package/dist/traitDocs/traitDocs.d.ts +1 -0
  359. package/dist/traitDocs/traitDocs.js +3 -3
  360. package/dist/traits/ControlLoopTrait.d.ts +154 -0
  361. package/dist/traits/KinematicChainTrait.d.ts +116 -0
  362. package/dist/traits/SensorSamplingTrait.d.ts +154 -0
  363. package/dist/traits/TraitTypes.d.ts +270 -0
  364. package/dist/traits/TransactionTrait.d.ts +121 -0
  365. package/dist/traits/botanical-lotus.cjs +54 -50
  366. package/dist/traits/botanical-lotus.js +2 -5
  367. package/dist/traits/control-loop.cjs +21 -0
  368. package/dist/traits/control-loop.d.ts +1 -0
  369. package/dist/traits/control-loop.js +4 -0
  370. package/dist/traits/engines/cloth-verlet.d.ts +65 -0
  371. package/dist/traits/engines/index.cjs +19 -19
  372. package/dist/traits/engines/index.d.ts +15 -275
  373. package/dist/traits/engines/index.js +3 -3
  374. package/dist/traits/engines/motion-data-schema.d.ts +119 -0
  375. package/dist/traits/engines/motion-matching.d.ts +102 -0
  376. package/dist/traits/engines/noise.d.ts +25 -0
  377. package/dist/traits/engines/onnx-adapter.d.ts +173 -0
  378. package/dist/traits/engines/onnx-motion-matching.d.ts +163 -0
  379. package/dist/traits/engines/pfnn-network.d.ts +92 -0
  380. package/dist/traits/engines/synthetic-walk-cycle.d.ts +38 -0
  381. package/dist/traits/engines/tensor-ops.d.ts +15 -0
  382. package/dist/traits/index.cjs +2789 -1259
  383. package/dist/traits/index.d.ts +35 -0
  384. package/dist/traits/index.js +1692 -411
  385. package/dist/traits/kinematic-chain.cjs +25 -0
  386. package/dist/traits/kinematic-chain.d.ts +1 -0
  387. package/dist/traits/kinematic-chain.js +4 -0
  388. package/dist/traits/sensor-sampling.cjs +33 -0
  389. package/dist/traits/sensor-sampling.d.ts +1 -0
  390. package/dist/traits/sensor-sampling.js +4 -0
  391. package/dist/traits/simulation-solver-factory.cjs +1 -1
  392. package/dist/traits/simulation-solver-factory.js +1 -1
  393. package/dist/traits/transaction.cjs +29 -0
  394. package/dist/traits/transaction.d.ts +1 -0
  395. package/dist/traits/transaction.js +4 -0
  396. package/dist/traits/webcam-gaze.cjs +1 -1
  397. package/dist/traits/webcam-gaze.js +1 -1
  398. package/dist/type-checker.cjs +7 -6
  399. package/dist/type-checker.js +5 -4
  400. package/dist/types/AdvancedTypeSystem.d.ts +489 -0
  401. package/dist/types/HoloScriptPlus.d.ts +810 -0
  402. package/dist/types/base.d.ts +248 -0
  403. package/dist/types.d.ts +799 -0
  404. package/dist/world/index.cjs +3 -4
  405. package/dist/world/index.js +3 -4
  406. package/dist/world-model/index.cjs +1 -1
  407. package/dist/world-model/index.js +1 -1
  408. package/dist/wot/index.cjs +1 -1
  409. package/dist/wot/index.js +1 -1
  410. package/package.json +80 -13
  411. package/dist/GLTFPipeline-3EJLL3TS.cjs +0 -38
  412. package/dist/GLTFPipeline-3OWJV2VK.js +0 -17
  413. package/dist/HoloScriptPlusParser-ADWRY5OS.cjs +0 -698
  414. package/dist/HoloScriptPlusParser-JLJDXHSC.js +0 -693
  415. package/dist/HoloScriptPlusParser-QCGFPWIL.cjs +0 -27
  416. package/dist/HoloScriptPlusParser-WENAFEFV.js +0 -10
  417. package/dist/HoloScriptRuntime-GGRVEU4T.cjs +0 -19
  418. package/dist/HoloScriptRuntime-GJK6VJPH.js +0 -10
  419. package/dist/chunk-22Q5A6RV.js +0 -979
  420. package/dist/chunk-4C57PR42.js +0 -468
  421. package/dist/chunk-4W5G5QVL.cjs +0 -847
  422. package/dist/chunk-5ET6L4NS.js +0 -487
  423. package/dist/chunk-C4GSLCHE.cjs +0 -7153
  424. package/dist/chunk-F2G6CWFT.js +0 -7089
  425. package/dist/chunk-G6PNEASF.cjs +0 -814
  426. package/dist/chunk-GTA4Q3A3.js +0 -1491
  427. package/dist/chunk-HCCQLAA4.cjs +0 -74
  428. package/dist/chunk-HFSVMKM3.cjs +0 -72
  429. package/dist/chunk-KAIVDEIG.cjs +0 -4539
  430. package/dist/chunk-KQU64CIX.cjs +0 -1508
  431. package/dist/chunk-MSYSQ2AJ.js +0 -4533
  432. package/dist/chunk-NHJLP37F.js +0 -70
  433. package/dist/chunk-NHYRRAGI.cjs +0 -490
  434. package/dist/chunk-OIQYIIO3.cjs +0 -473
  435. package/dist/chunk-OL46QLBJ.js +0 -61
  436. package/dist/chunk-SKZPC5AG.cjs +0 -984
  437. package/dist/chunk-SLHLXUMO.js +0 -445
  438. package/dist/chunk-UOIGFQXC.cjs +0 -9750
  439. package/dist/chunk-UOL6Y5TD.cjs +0 -759
  440. package/dist/chunk-UVFI7XIR.cjs +0 -452
  441. package/dist/chunk-VEPGBETF.js +0 -844
  442. package/dist/chunk-XQ5MWMP2.js +0 -756
  443. package/dist/chunk-XT6JY5W5.js +0 -9684
  444. package/dist/chunk-YRRAUB35.js +0 -811
  445. package/dist/compiler/GasOptimizationAnalyzer.d.ts +0 -73
  446. package/dist/compiler/NFTMarketplaceCompiler.d.ts +0 -23
  447. package/dist/compiler/ar.cjs +0 -23
  448. package/dist/compiler/ar.js +0 -11
  449. package/dist/compiler/babylon.cjs +0 -21
  450. package/dist/compiler/babylon.js +0 -15
  451. package/dist/compiler/multi-layer.cjs +0 -24
  452. package/dist/compiler/multi-layer.js +0 -15
  453. package/dist/compiler/playcanvas.cjs +0 -19
  454. package/dist/compiler/playcanvas.js +0 -13
  455. package/dist/compiler/r3f.cjs +0 -39
  456. package/dist/compiler/r3f.d.ts +0 -22
  457. package/dist/compiler/r3f.js +0 -17
  458. package/dist/compiler/vrr.cjs +0 -24
  459. package/dist/compiler/vrr.js +0 -12
  460. package/dist/parser/NFTMarketplaceTypes.d.ts +0 -191
  461. package/dist/playwright-3AT3AKTV.cjs +0 -98673
  462. package/dist/playwright-VZPDVUEQ.js +0 -98660
@@ -1,4533 +0,0 @@
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, buildLotusPetalGeometryData, lotusPetalGeometryParamsFromProfile, buildLotusFlowerPlacements, buildLotusSceneScaffold } from './chunk-B4EKV6HQ.js';
3
- import { init_ProvenanceSemiring, ProvenanceSemiring } from './chunk-SLHLXUMO.js';
4
- import { init_TraitVisualRegistry, init_types, init_TraitCompositor, TraitCompositor, TraitVisualRegistry } from './chunk-4C57PR42.js';
5
- import { init_PlatformConditionalCompilerMixin, createPlatformTarget, PlatformConditionalCompilerMixin } from './chunk-GW3LKD5C.js';
6
- import { init_DomainBlockCompilerMixin, compileDomainBlocks, compileSimulationBlock, simulationToR3F, compileWeatherBlock, weatherToR3F, compileAudioSourceBlock, audioSourceToR3F, compilePostProcessingBlock, postProcessingToR3F, compileParticleBlock, particlesToR3F, compilePhysicsBlock, physicsToR3F, compileMaterialBlock, materialToR3F } from './chunk-ZA34AN3R.js';
7
- import { init_AgentRBAC, init_CompilerBase, getRBAC, UnauthorizedCompilerAccessError, escapeStringValue } from './chunk-C7ZBSV2Q.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(
2902
- this.compileObjectDecl(child, templateMap)
2903
- );
2904
- }
2905
- }
2906
- if (childNodes.length === 0) {
2907
- return nodes;
2908
- }
2909
- const group = this.createNode(
2910
- "group",
2911
- {},
2912
- world.name ? escapeStringValue(world.name, "JSX") : void 0
2913
- );
2914
- group.children = [...nodes, ...childNodes];
2915
- return [group];
2916
- }
2917
- createNode(type, props = {}, id) {
2918
- const node = r3fNodePool.acquire();
2919
- node.type = type;
2920
- node.id = id;
2921
- node.props = props;
2922
- node.children = [];
2923
- node.traits = /* @__PURE__ */ new Map();
2924
- node.directives = [];
2925
- return node;
2926
- }
2927
- /**
2928
- * I.007 closure: emit a node's compiled petal material spec into its props.
2929
- * Shared by every trait-bearing compile path (compileNode directives + the
2930
- * .holo compileObjectDecl obj.traits path) so the emission can't silently miss
2931
- * the real parser route. The spec is the locked CompiledMaterialSpec shape that
2932
- * the renderer's buildCompiledMaterial consumes — building the petal material
2933
- * from `.holo` data instead of hand-authoring it.
2934
- */
2935
- emitCompiledLotusMaterial(props, config) {
2936
- const profile = createBotanicalLotusRenderProfile(config);
2937
- props.__compiledMaterial = buildLotusPetalMaterialSpec(profile);
2938
- props.__uniformBindings = LOTUS_PETAL_UNIFORM_BINDINGS;
2939
- props.__petalGeometry = buildLotusPetalGeometryData(
2940
- lotusPetalGeometryParamsFromProfile(profile)
2941
- );
2942
- props.__petalPlacements = buildLotusFlowerPlacements(profile);
2943
- const scaffold = buildLotusSceneScaffold();
2944
- props.__lotusScene = {
2945
- stemHeight: scaffold.stem.height,
2946
- scaffold,
2947
- colors: {
2948
- water: profile.colors.water,
2949
- leaf: profile.colors.leaf,
2950
- leafDark: profile.colors.leaf_dark
2951
- },
2952
- // The flower CENTRE: the seed pod (receptacle) ringed by stamen filaments —
2953
- // the iconic lotus centre, colours + count from the profile.
2954
- center: {
2955
- seedPod: profile.colors.seed_pod,
2956
- seedPodRim: profile.colors.seed_pod_rim,
2957
- stamen: profile.colors.stamen,
2958
- stamenTip: profile.colors.stamen_tip,
2959
- stamenCount: profile.stamen_filament_count,
2960
- // Carpel layout for the flat-topped "shower-head" seed pod, parsed from the
2961
- // profile's declared dot pattern (e.g. '1_center_7_12_18_radial' → [1,7,12,18]
2962
- // = 1 central carpel + radial rings of 7, 12, 18). The renderer recesses a
2963
- // carpel well per entry — the iconic lotus receptacle, compiled from `.holo`.
2964
- carpelRings: (profile.seed_pod_dot_pattern?.match(/\d+/g) ?? [
2965
- "1",
2966
- "7",
2967
- "12",
2968
- "18"
2969
- ]).map(Number)
2970
- }
2971
- };
2972
- const waterColor = profile.colors.water;
2973
- const leafColor = profile.colors.leaf;
2974
- const leafDarkColor = profile.colors.leaf_dark;
2975
- const stemHeight = scaffold.stem.height;
2976
- const scaffoldNodes = [
2977
- this.createNode("mesh", {
2978
- hsType: "plane",
2979
- width: scaffold.waterSize,
2980
- height: scaffold.waterSize,
2981
- rotation: [-Math.PI / 2, 0, 0],
2982
- color: waterColor,
2983
- roughness: 0.22,
2984
- metalness: 0.5,
2985
- // Mark the pond as a REFLECTIVE surface — the renderer's generic MeshNode draws
2986
- // it with a mirror material so the flower + pads reflect (a real water read).
2987
- reflective: true
2988
- }),
2989
- ...scaffold.pads.map(
2990
- (pad, padIdx) => this.createNode("mesh", {
2991
- hsType: "lilypad",
2992
- radius: pad.radius,
2993
- // Per-pad notch width variation so the pads don't look stamped.
2994
- notchAngle: 0.48 + padIdx % 3 * 0.07,
2995
- position: pad.pos,
2996
- rotation: [-Math.PI / 2, 0, pad.rotation],
2997
- color: pad.dark ? leafDarkColor : leafColor,
2998
- roughness: 0.85
2999
- })
3000
- )
3001
- ];
3002
- const stemNode = this.createNode("group", {
3003
- __animatedTransform: [
3004
- { prop: "scaleY", target: "developmentalTime", edge0: 0, edge1: 0.42, from: 1e-3, to: 1 },
3005
- {
3006
- prop: "posY",
3007
- target: "developmentalTime",
3008
- edge0: 0,
3009
- edge1: 0.42,
3010
- from: 0,
3011
- to: stemHeight / 2
3012
- }
3013
- ]
3014
- });
3015
- stemNode.children = [
3016
- this.createNode("mesh", {
3017
- hsType: "cylinder",
3018
- radiusTop: scaffold.stem.topRadius,
3019
- radiusBottom: scaffold.stem.bottomRadius,
3020
- height: stemHeight,
3021
- color: leafDarkColor,
3022
- roughness: 0.7
3023
- })
3024
- ];
3025
- scaffoldNodes.push(stemNode);
3026
- scaffold.leaves.forEach((lf, i) => {
3027
- const leafNode = this.createNode("group", {
3028
- position: lf.pos,
3029
- __animatedTransform: [
3030
- {
3031
- prop: "scaleUniform",
3032
- target: "developmentalTime",
3033
- edge0: 0.15 + i * 0.08,
3034
- edge1: 0.55 + i * 0.08,
3035
- from: 0,
3036
- to: 1
3037
- }
3038
- ]
3039
- });
3040
- leafNode.children = [
3041
- this.createNode("mesh", {
3042
- hsType: "cylinder",
3043
- radiusTop: 0.03,
3044
- radiusBottom: 0.045,
3045
- height: lf.height,
3046
- position: [0, lf.height / 2, 0],
3047
- color: leafDarkColor,
3048
- roughness: 0.7
3049
- }),
3050
- this.createNode("mesh", {
3051
- hsType: "circle",
3052
- radius: lf.radius,
3053
- position: [0, lf.height, 0],
3054
- rotation: [-Math.PI / 2 + lf.tilt, 0, lf.rotation],
3055
- color: lf.dark ? leafDarkColor : leafColor,
3056
- roughness: 0.8
3057
- })
3058
- ];
3059
- scaffoldNodes.push(leafNode);
3060
- });
3061
- props.__scaffoldNodes = scaffoldNodes;
3062
- }
3063
- compileNode(node) {
3064
- if (node.type === "system") {
3065
- return this.compileSystemNode(node);
3066
- }
3067
- if (node.type === "component") {
3068
- return this.compileComponentNode(node);
3069
- }
3070
- const rawProps = node.properties || {};
3071
- const type = this.mapType(node.type, rawProps);
3072
- const r3fNode = r3fNodePool.acquire();
3073
- r3fNode.type = type;
3074
- const rawId = node.id || node.name;
3075
- r3fNode.id = rawId ? escapeStringValue(rawId, "JSX") : void 0;
3076
- r3fNode.props = this.compileProperties(node, rawProps);
3077
- r3fNode.children = [];
3078
- r3fNode.traits = /* @__PURE__ */ new Map();
3079
- r3fNode.directives = node.directives || [];
3080
- if (node.directives) {
3081
- for (const directive of node.directives) {
3082
- if (directive.type === "trait") {
3083
- r3fNode.traits?.set(
3084
- directive.name,
3085
- directive.config
3086
- );
3087
- }
3088
- }
3089
- }
3090
- const lotusConfig = r3fNode.traits?.get("botanical_lotus");
3091
- if (lotusConfig) {
3092
- this.emitCompiledLotusMaterial(r3fNode.props, lotusConfig);
3093
- }
3094
- const enhanced = node;
3095
- if (enhanced.graphics) {
3096
- this.applyGraphicsConfig(r3fNode, enhanced.graphics);
3097
- }
3098
- if (enhanced.children && Array.isArray(enhanced.children)) {
3099
- r3fNode.children = enhanced.children.map(
3100
- (child) => this.compileNode(child)
3101
- );
3102
- }
3103
- return r3fNode;
3104
- }
3105
- // ─── HoloComposition Compilation (.holo files) ────────────────────────
3106
- compileComposition(composition, agentToken, outputPath) {
3107
- this.validateCompilerAccess(agentToken, outputPath);
3108
- if (this._platformTarget) {
3109
- const platformMixin = new PlatformConditionalCompilerMixin();
3110
- composition = platformMixin.filterForPlatform(composition, this._platformTarget);
3111
- }
3112
- const root = r3fNodePool.acquire();
3113
- root.type = "group";
3114
- root.id = composition.name ? escapeStringValue(composition.name, "JSX") : void 0;
3115
- root.props = {};
3116
- root.children = [];
3117
- root.traits = /* @__PURE__ */ new Map();
3118
- root.directives = [];
3119
- const templateMap = /* @__PURE__ */ new Map();
3120
- if (Array.isArray(composition.templates)) {
3121
- for (const tmpl of composition.templates) {
3122
- templateMap.set(tmpl.name, tmpl);
3123
- }
3124
- }
3125
- if (composition.children && Array.isArray(composition.children)) {
3126
- for (const child of composition.children) {
3127
- if (child.type === "template" && child.name) {
3128
- templateMap.set(child.name, child);
3129
- }
3130
- }
3131
- for (const child of composition.children) {
3132
- root.children.push(this.compileChildNode(child, templateMap));
3133
- }
3134
- }
3135
- if (composition.environment) {
3136
- root.children.push(
3137
- ...this.compileEnvironmentBlock(
3138
- composition.environment
3139
- )
3140
- );
3141
- }
3142
- if (Array.isArray(composition.lights)) {
3143
- for (const light of composition.lights) {
3144
- root.children.push(this.compileLightBlock(light));
3145
- }
3146
- }
3147
- if (Array.isArray(composition.objects)) {
3148
- for (const obj of composition.objects) {
3149
- root.children.push(this.compileObjectDecl(obj, templateMap));
3150
- }
3151
- }
3152
- if (Array.isArray(composition.spatialGroups)) {
3153
- for (const group of composition.spatialGroups) {
3154
- root.children.push(this.compileSpatialGroup(group, templateMap));
3155
- }
3156
- }
3157
- if (Array.isArray(composition.timelines)) {
3158
- for (const timeline of composition.timelines) {
3159
- root.children.push(
3160
- this.compileTimelineBlock(timeline)
3161
- );
3162
- }
3163
- }
3164
- if (Array.isArray(composition.audio)) {
3165
- for (const audio of composition.audio) {
3166
- root.children.push(this.compileAudioBlock(audio));
3167
- }
3168
- }
3169
- if (Array.isArray(composition.zones)) {
3170
- for (const zone of composition.zones) {
3171
- root.children.push(this.compileZoneBlock(zone));
3172
- }
3173
- }
3174
- if (Array.isArray(composition.worlds)) {
3175
- for (const world of composition.worlds) {
3176
- root.children.push(
3177
- ...this.compileWorldNode(
3178
- world,
3179
- templateMap
3180
- )
3181
- );
3182
- }
3183
- }
3184
- if (composition.ui) {
3185
- root.children.push(
3186
- this.compileUIBlock(composition.ui)
3187
- );
3188
- }
3189
- if (Array.isArray(composition.transitions)) {
3190
- for (const transition of composition.transitions) {
3191
- root.children.push(
3192
- this.compileTransitionBlock(transition)
3193
- );
3194
- }
3195
- }
3196
- if (Array.isArray(composition.conditionals)) {
3197
- for (const cond of composition.conditionals) {
3198
- root.children.push(this.compileConditionalBlock(cond, templateMap));
3199
- }
3200
- }
3201
- if (Array.isArray(composition.iterators)) {
3202
- for (const iter of composition.iterators) {
3203
- root.children.push(this.compileForEachBlock(iter, templateMap));
3204
- }
3205
- }
3206
- if (composition.camera) {
3207
- root.children.push(
3208
- this.compileCameraBlock(composition.camera)
3209
- );
3210
- }
3211
- if (composition.effects) {
3212
- root.children.unshift(
3213
- this.compileEffectsBlock(composition.effects)
3214
- );
3215
- } else if (this.hasPostProcessing(root)) {
3216
- root.children.unshift({
3217
- type: "EffectComposer",
3218
- props: {},
3219
- children: this.extractPostProcessingNodes(root)
3220
- });
3221
- }
3222
- this.injectHolomapPointCloud(root);
3223
- this.injectDefaultLighting(root);
3224
- return root;
3225
- }
3226
- /** R3F host apps can map this node to BufferGeometry + pointsMaterial from base64 buffers. */
3227
- injectHolomapPointCloud(root) {
3228
- const h = this._holomapPointCloud;
3229
- if (!h || h.pointCount < 1 || !h.positionsB64 || !h.colorsB64) return;
3230
- if (!root.children) root.children = [];
3231
- root.children.push({
3232
- type: "holomapPointCloud",
3233
- props: {
3234
- positionsB64: h.positionsB64,
3235
- colorsB64: h.colorsB64,
3236
- pointCount: h.pointCount
3237
- }
3238
- });
3239
- }
3240
- compileLightBlock(light) {
3241
- const lightMapping = {
3242
- directional: "directionalLight",
3243
- point: "pointLight",
3244
- spot: "spotLight",
3245
- hemisphere: "hemisphereLight",
3246
- ambient: "ambientLight",
3247
- area: "rectAreaLight"
3248
- };
3249
- const type = lightMapping[light.lightType] || "directionalLight";
3250
- const props = {};
3251
- if (Array.isArray(light.properties)) {
3252
- for (const prop of light.properties) {
3253
- const key = prop.key;
3254
- const value = prop.value;
3255
- if (key === "cast_shadow" || key === "castShadow") {
3256
- props.castShadow = value;
3257
- } else if (key === "ground_color" || key === "groundColor") {
3258
- props.groundColor = value;
3259
- } else if (key === "shadow_map_size") {
3260
- props["shadow-mapSize"] = Array.isArray(value) ? value : [value, value];
3261
- } else {
3262
- props[key] = value;
3263
- }
3264
- }
3265
- }
3266
- if ((light.lightType === "directional" || light.lightType === "spot") && props.castShadow === void 0) {
3267
- props.castShadow = true;
3268
- }
3269
- const r3fNode = r3fNodePool.acquire();
3270
- r3fNode.type = type;
3271
- r3fNode.id = light.name ? escapeStringValue(light.name, "JSX") : void 0;
3272
- r3fNode.props = props;
3273
- r3fNode.children = [];
3274
- r3fNode.traits = /* @__PURE__ */ new Map();
3275
- r3fNode.directives = [];
3276
- return r3fNode;
3277
- }
3278
- compileEffectsBlock(effects) {
3279
- const children = [];
3280
- if (Array.isArray(effects.effects)) {
3281
- for (const effect of effects.effects) {
3282
- const effectMapping = {
3283
- bloom: "Bloom",
3284
- ssao: "SSAO",
3285
- vignette: "Vignette",
3286
- dof: "DepthOfField",
3287
- chromatic_aberration: "ChromaticAberration",
3288
- tone_mapping: "ToneMapping",
3289
- noise: "Noise"
3290
- };
3291
- const effectType = effect.effectType;
3292
- const type = effectMapping[effectType] || effectType;
3293
- children.push(
3294
- this.createNode(type, { ...effect.properties || {} })
3295
- );
3296
- }
3297
- }
3298
- const composer = this.createNode("EffectComposer", {});
3299
- composer.children = children;
3300
- return composer;
3301
- }
3302
- compileCameraBlock(camera) {
3303
- const props = {};
3304
- if (Array.isArray(camera.properties)) {
3305
- for (const prop of camera.properties) {
3306
- if (prop.key === "field_of_view" || prop.key === "fov") {
3307
- props.fov = prop.value;
3308
- } else if (prop.key === "look_at" || prop.key === "lookAt") {
3309
- props.lookAt = prop.value;
3310
- } else {
3311
- props[prop.key] = prop.value;
3312
- }
3313
- }
3314
- }
3315
- props.cameraType = camera.cameraType;
3316
- return this.createNode("Camera", props, "__camera");
3317
- }
3318
- compileEnvironmentBlock(env) {
3319
- const nodes = [];
3320
- const envProps = {};
3321
- if (env.properties) {
3322
- for (const prop of env.properties) {
3323
- envProps[prop.key] = prop.value;
3324
- }
3325
- }
3326
- const presetName = envProps.skybox || envProps.preset;
3327
- if (presetName) {
3328
- const preset = ENVIRONMENT_PRESETS[presetName];
3329
- if (preset) {
3330
- nodes.push(
3331
- this.createNode("Environment", {
3332
- background: true,
3333
- preset: preset.envPreset || presetName
3334
- })
3335
- );
3336
- const lighting = preset.lighting;
3337
- if (lighting?.ambient) {
3338
- nodes.push(
3339
- this.createNode("ambientLight", {
3340
- color: lighting.ambient.color,
3341
- intensity: lighting.ambient.intensity
3342
- })
3343
- );
3344
- }
3345
- if (lighting?.directional) {
3346
- const dl = lighting.directional;
3347
- nodes.push(
3348
- this.createNode("directionalLight", {
3349
- color: dl.color,
3350
- intensity: dl.intensity,
3351
- position: dl.position,
3352
- castShadow: dl.shadows !== false,
3353
- "shadow-mapSize": [2048, 2048]
3354
- })
3355
- );
3356
- }
3357
- if (Array.isArray(lighting?.points)) {
3358
- for (const pl of lighting.points) {
3359
- nodes.push(
3360
- this.createNode("pointLight", {
3361
- color: pl.color,
3362
- intensity: pl.intensity,
3363
- position: pl.position,
3364
- distance: pl.distance
3365
- })
3366
- );
3367
- }
3368
- }
3369
- const presetMap = preset;
3370
- if (presetMap.fog) {
3371
- const fogMap = presetMap.fog;
3372
- nodes.push(
3373
- this.createNode("fog", {
3374
- attach: "fog",
3375
- color: fogMap.color,
3376
- near: fogMap.near,
3377
- far: fogMap.far
3378
- })
3379
- );
3380
- }
3381
- if (presetMap.ground) {
3382
- const groundMap = presetMap.ground;
3383
- nodes.push(
3384
- this.createNode(
3385
- "mesh",
3386
- {
3387
- hsType: "plane",
3388
- rotation: [-Math.PI / 2, 0, 0],
3389
- position: [0, -0.01, 0],
3390
- receiveShadow: true,
3391
- args: [200, 200],
3392
- color: groundMap.color,
3393
- materialProps: { roughness: 0.8, metalness: 0 }
3394
- },
3395
- "__ground"
3396
- )
3397
- );
3398
- }
3399
- } else {
3400
- nodes.push(this.createNode("Environment", { background: true, preset: presetName }));
3401
- }
3402
- }
3403
- if (envProps.ambient_light !== void 0) {
3404
- nodes.push(
3405
- this.createNode("ambientLight", {
3406
- intensity: typeof envProps.ambient_light === "number" ? envProps.ambient_light : 0.5
3407
- })
3408
- );
3409
- }
3410
- const explicitFog = envProps.fog;
3411
- if (explicitFog && typeof explicitFog === "object") {
3412
- nodes.push(
3413
- this.createNode("fog", {
3414
- attach: "fog",
3415
- color: explicitFog.color || "#cccccc",
3416
- near: explicitFog.near || 10,
3417
- far: explicitFog.far || 100
3418
- })
3419
- );
3420
- }
3421
- return nodes;
3422
- }
3423
- compileObjectDecl(obj, templateMap) {
3424
- const props = {};
3425
- let geometryType = "cube";
3426
- if (obj.template && templateMap) {
3427
- const tmpl = templateMap.get(obj.template);
3428
- if (tmpl) {
3429
- const tmplTraits = tmpl.traits;
3430
- if (tmplTraits && Array.isArray(tmplTraits)) {
3431
- const existingTraitNames = new Set(
3432
- (obj.traits || []).map(
3433
- (t) => t.name
3434
- )
3435
- );
3436
- obj.traits = [
3437
- ...tmplTraits.filter(
3438
- (t) => !existingTraitNames.has(t.name)
3439
- ),
3440
- ...obj.traits || []
3441
- ];
3442
- }
3443
- const tmplProps = tmpl.properties;
3444
- if (tmplProps && Array.isArray(tmplProps)) {
3445
- const existingKeys = new Set(
3446
- (obj.properties || []).map(
3447
- (p) => p.key
3448
- )
3449
- );
3450
- const mergedProps = tmplProps.filter((p) => !existingKeys.has(p.key)).map((p) => ({
3451
- type: "ObjectProperty",
3452
- key: p.key,
3453
- value: p.value
3454
- }));
3455
- obj.properties = [...mergedProps, ...obj.properties || []];
3456
- }
3457
- }
3458
- }
3459
- if (obj.properties && Array.isArray(obj.properties)) {
3460
- const expandedProperties = [];
3461
- for (const p of obj.properties) {
3462
- const prop = p;
3463
- if (prop && prop.type === "spread") {
3464
- const resolved = this.resolveSpreadArgument(
3465
- prop.target || prop.argument,
3466
- {
3467
- templates: templateMap
3468
- }
3469
- );
3470
- if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
3471
- for (const [key, value] of Object.entries(resolved)) {
3472
- expandedProperties.push({ key, value });
3473
- }
3474
- } else if (Array.isArray(resolved)) {
3475
- expandedProperties.push(...resolved);
3476
- }
3477
- } else {
3478
- expandedProperties.push(prop);
3479
- }
3480
- }
3481
- obj.properties = expandedProperties;
3482
- }
3483
- if (obj.properties) {
3484
- for (const p of obj.properties) {
3485
- const key = p.key;
3486
- const value = p.value;
3487
- if (key === "geometry" || key === "mesh") {
3488
- geometryType = value;
3489
- } else if (key === "type") {
3490
- const valStr = value;
3491
- if (["text", "sparkles", "portal", "audio"].includes(valStr)) {
3492
- geometryType = valStr;
3493
- } else if (["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(valStr)) {
3494
- geometryType = "light";
3495
- props.lightType = valStr;
3496
- } else {
3497
- props[key] = value;
3498
- }
3499
- } else if (key === "light_type") {
3500
- props.lightType = value;
3501
- } else if (key === "position" && Array.isArray(value)) {
3502
- props.position = value;
3503
- } else if (key === "rotation" && Array.isArray(value)) {
3504
- props.rotation = value;
3505
- } else if (key === "scale") {
3506
- props.scale = Array.isArray(value) ? value : [value, value, value];
3507
- } else if (key === "color") {
3508
- props.color = value;
3509
- } else if (key === "src" || key === "model" || key === "source") {
3510
- props.src = value;
3511
- geometryType = "model";
3512
- } else if (key === "text") {
3513
- props.children = this.resolveValue(value);
3514
- props.text = this.resolveValue(value);
3515
- } else if (key === "font_size") {
3516
- props.fontSize = value;
3517
- } else if (key === "material") {
3518
- const currentMaterialProps = props.materialProps || {};
3519
- if (typeof value === "string" && MATERIAL_PRESETS[value]) {
3520
- props.materialProps = { ...MATERIAL_PRESETS[value], ...currentMaterialProps };
3521
- } else if (typeof value === "object" && value !== null) {
3522
- const valObj = value;
3523
- if (valObj.preset && typeof valObj.preset === "string" && MATERIAL_PRESETS[valObj.preset]) {
3524
- const { preset: _, ...rest } = valObj;
3525
- props.materialProps = {
3526
- ...MATERIAL_PRESETS[valObj.preset],
3527
- ...rest,
3528
- ...currentMaterialProps
3529
- };
3530
- } else {
3531
- props.materialProps = { ...currentMaterialProps, ...valObj };
3532
- }
3533
- }
3534
- } else if (key === "roughness" || key === "metalness" || key === "metallic") {
3535
- const mProps = props.materialProps || {};
3536
- mProps[key === "metallic" ? "metalness" : key] = value;
3537
- props.materialProps = mProps;
3538
- } else if (key === "opacity") {
3539
- const mProps = props.materialProps || {};
3540
- mProps.opacity = value;
3541
- mProps.transparent = value < 1;
3542
- props.materialProps = mProps;
3543
- } else if (key === "emissive") {
3544
- props.materialProps = {
3545
- ...props.materialProps || {},
3546
- emissive: value
3547
- };
3548
- } else if (key === "emissiveIntensity" || key === "emissive_intensity") {
3549
- props.materialProps = {
3550
- ...props.materialProps || {},
3551
- emissiveIntensity: value
3552
- };
3553
- } else if (key === "size") {
3554
- if (Array.isArray(value)) {
3555
- props.args = value;
3556
- }
3557
- props.size = value;
3558
- } else if (key === "radius") {
3559
- props.size = value * 2;
3560
- } else if (key === "intensity") {
3561
- props.intensity = value;
3562
- } else if (key === "cast_shadow" || key === "castShadow") {
3563
- props.castShadow = value;
3564
- } else if (key === "receiveShadow" || key === "receive_shadow") {
3565
- props.receiveShadow = value;
3566
- } else if (key === "visible") {
3567
- props[key] = value;
3568
- } else if (key === "maturity") {
3569
- props.maturityOverride = value;
3570
- } else if (key === "promoteUrl" || key === "promote_url") {
3571
- props.promoteUrl = value;
3572
- } else if (key === "collisionShape" || key === "collision_shape") {
3573
- props.collisionShape = value;
3574
- } else {
3575
- props[key] = this.resolveValue(value);
3576
- }
3577
- }
3578
- }
3579
- if (obj.traits && Array.isArray(obj.traits)) {
3580
- const semiring = new ProvenanceSemiring();
3581
- const physicsApplications = obj.traits.filter((t) => t.name === "physics" || t.name === "collidable").map((t) => {
3582
- let baseConfig = t.config || {};
3583
- if (t.name === "collidable" && !baseConfig.type)
3584
- baseConfig = { ...baseConfig, type: "fixed" };
3585
- if (t.name === "physics" && !baseConfig.type)
3586
- baseConfig = { ...baseConfig, type: "dynamic" };
3587
- return {
3588
- name: t.name,
3589
- config: baseConfig,
3590
- context: obj.provenance?.context
3591
- };
3592
- });
3593
- if (physicsApplications.length > 0) {
3594
- const { config: mergedPhysics } = semiring.add(physicsApplications);
3595
- props.rigidBody = { ...mergedPhysics };
3596
- props.collider = { type: "auto" };
3597
- if (props.rigidBody?.type === "fixed") {
3598
- props.castShadow = true;
3599
- props.receiveShadow = true;
3600
- }
3601
- }
3602
- for (const trait of obj.traits) {
3603
- const name = trait.name;
3604
- if (name === "physics" || name === "collidable") {
3605
- continue;
3606
- } else if (name === "grabbable") {
3607
- props.castShadow = true;
3608
- props.grabbable = trait.config || true;
3609
- if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3610
- if (!props.collider) props.collider = { type: "auto" };
3611
- } else if (name === "hoverable") {
3612
- props.hoverable = trait.config || true;
3613
- } else if (name === "animated") {
3614
- props.animated = trait.config || true;
3615
- } else if (name === "positional" || name === "spatial_audio") {
3616
- props.spatial = true;
3617
- } else if (name === "gem_resonance") {
3618
- props.gemResonance = gemResonanceConfig(trait.config);
3619
- props.spatial = true;
3620
- } else if (name === "shadow") {
3621
- props.castShadow = true;
3622
- if (trait.config?.mapSize)
3623
- props["shadow-mapSize"] = [trait.config.mapSize, trait.config.mapSize];
3624
- } else if (name === "material") {
3625
- const presetName = trait.config?.preset;
3626
- if (presetName && typeof presetName === "string" && MATERIAL_PRESETS[presetName]) {
3627
- const { preset: _, ...rest } = trait.config;
3628
- props.materialProps = {
3629
- ...MATERIAL_PRESETS[presetName],
3630
- ...rest,
3631
- ...props.materialProps
3632
- };
3633
- } else {
3634
- props.materialProps = {
3635
- ...props.materialProps,
3636
- ...trait.config
3637
- };
3638
- }
3639
- } else if (name === "networked") {
3640
- props.networked = trait.config || true;
3641
- } else if (name === "moldable") {
3642
- props.moldable = trait.config || true;
3643
- } else if (name === "stretchable") {
3644
- props.stretchable = trait.config || true;
3645
- } else if (name === "bloom") {
3646
- props.bloom = trait.config || { intensity: 1 };
3647
- } else if (name === "portal") {
3648
- props.portal = trait.config || true;
3649
- } else if (name === "attach") {
3650
- props.attach = trait.config || true;
3651
- } else if (name === "orbit") {
3652
- props.orbit = trait.config || true;
3653
- } else if (name === "look_at") {
3654
- props.lookAtTarget = trait.config || true;
3655
- } else if (name === "follow") {
3656
- props.follow = trait.config || true;
3657
- } else if (name === "plane_detection") {
3658
- props.planeDetection = trait.config || { mode: "all" };
3659
- } else if (name === "mesh_detection") {
3660
- props.meshDetection = trait.config || { classification: true };
3661
- } else if (name === "anchor") {
3662
- props.anchor = trait.config || { type: "spatial" };
3663
- } else if (name === "persistent_anchor") {
3664
- props.persistentAnchor = trait.config || { storage: "local" };
3665
- } else if (name === "shared_anchor") {
3666
- props.sharedAnchor = trait.config || { authority: "creator" };
3667
- } else if (name === "occlusion") {
3668
- props.occlusionMode = trait.config?.mode || "environment";
3669
- props.occlusion = trait.config || true;
3670
- } else if (name === "light_estimation") {
3671
- props.lightEstimation = trait.config || { auto_apply: true };
3672
- } else if (name === "geospatial") {
3673
- props.geospatial = trait.config || true;
3674
- } else if (name === "gaussian_splat") {
3675
- props.gaussianSplat = trait.config || true;
3676
- } else if (name === "nerf") {
3677
- props.nerf = trait.config || true;
3678
- } else if (name === "volumetric_video") {
3679
- props.volumetricVideo = trait.config || true;
3680
- } else if (name === "point_cloud") {
3681
- props.pointCloud = trait.config || true;
3682
- } else if (name === "photogrammetry") {
3683
- props.photogrammetry = trait.config || true;
3684
- } else if (name === "web_surface") {
3685
- props.webSurface = trait.config || true;
3686
- } else if (name === "cloth") {
3687
- props.cloth = trait.config || { stiffness: 0.8 };
3688
- if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3689
- } else if (name === "fluid") {
3690
- props.fluid = trait.config || { viscosity: 0.01 };
3691
- props.__gapsComponents = props.__gapsComponents || [];
3692
- props.__gapsComponents.push("FluidRenderer");
3693
- } else if (name === "soft_body") {
3694
- props.softBody = trait.config || { elasticity: 0.5 };
3695
- if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3696
- } else if (name === "rope") {
3697
- props.rope = trait.config || { segments: 20 };
3698
- } else if (name === "chain") {
3699
- props.chain = trait.config || { link_count: 20 };
3700
- } else if (name === "wind") {
3701
- props.wind = trait.config || { strength: 5 };
3702
- } else if (name === "buoyancy") {
3703
- props.buoyancy = trait.config || { water_level: 0 };
3704
- } else if (name === "destruction") {
3705
- props.destruction = trait.config || { health: 100 };
3706
- if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3707
- if (!props.collider) props.collider = { type: "auto" };
3708
- } else if (name === "soft_body_pro") {
3709
- props.softBodyPro = trait.config || { tear_threshold: 0.5 };
3710
- if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3711
- } else if (name === "crowd_sim") {
3712
- props.crowdSim = trait.config || { max_agents: 1e3 };
3713
- } else if (name === "deformable_terrain") {
3714
- props.deformableTerrain = trait.config || { resolution: 256 };
3715
- } else if (name === "volumetric_clouds") {
3716
- props.volumetricClouds = trait.config || { coverage: 0.5 };
3717
- props.__gapsComponents = props.__gapsComponents || [];
3718
- props.__gapsComponents.push("CloudRenderer");
3719
- } else if (name === "god_rays") {
3720
- props.godRays = trait.config || { intensity: 1 };
3721
- props.__gapsComponents = props.__gapsComponents || [];
3722
- props.__gapsComponents.push("GodRaysEffect");
3723
- } else if (name === "spatial_voice") {
3724
- props.spatialVoice = trait.config || { max_distance: 30 };
3725
- props.spatial = true;
3726
- } else if (name === "ai_companion") {
3727
- props.aiCompanion = trait.config || { personality: "friendly" };
3728
- } else if (name === "moderation") {
3729
- props.moderation = trait.config || { sensitivity: "medium" };
3730
- } else if (name === "anti_grief") {
3731
- props.antiGrief = trait.config || { detection_window: 30 };
3732
- } else if (name === "world_state") {
3733
- props.worldState = trait.config || { sync_rate: 10 };
3734
- } else if (name === "token_gated") {
3735
- props.tokenGated = trait.config || { token_contract: "", min_balance: 1 };
3736
- } else if (name === "ambisonics") {
3737
- props.ambisonics = trait.config || { order: 1 };
3738
- props.spatial = true;
3739
- } else if (name === "hrtf") {
3740
- props.hrtf = trait.config || true;
3741
- props.spatial = true;
3742
- } else if (name === "reverb_zone") {
3743
- props.reverbZone = trait.config || { preset: "room" };
3744
- } else if (name === "audio_occlusion") {
3745
- props.audioOcclusion = trait.config || true;
3746
- } else if (name === "audio_portal") {
3747
- props.audioPortal = trait.config || true;
3748
- } else if (name === "head_tracked_audio") {
3749
- props.headTrackedAudio = trait.config || true;
3750
- props.spatial = true;
3751
- } else if (name === "accessible") {
3752
- props.accessible = trait.config || { role: "generic" };
3753
- } else if (name === "alt_text") {
3754
- props.altText = trait.config?.text || "";
3755
- } else if (name === "magnifiable") {
3756
- props.magnifiable = trait.config || { max_scale: 3 };
3757
- } else if (name === "high_contrast") {
3758
- props.highContrast = trait.config || { mode: "outline" };
3759
- } else if (name === "motion_reduced") {
3760
- props.motionReduced = trait.config || true;
3761
- if (props.animated) props.animated = false;
3762
- } else if (name === "compute") {
3763
- props.compute = trait.config || true;
3764
- } else if (name === "gpu_particle") {
3765
- props.gpuParticle = trait.config || { count: 1e4 };
3766
- } else if (isVfxParticleTraitName(name)) {
3767
- const particleConfig = {
3768
- effect: vfxParticleEffect(name),
3769
- ...trait.config || {}
3770
- };
3771
- const gpuParticles = props.gpuParticles ?? [];
3772
- props.gpuParticles = [...gpuParticles, particleConfig];
3773
- if (!props.gpuParticle) props.gpuParticle = particleConfig;
3774
- } else if (name === "gpu_physics") {
3775
- props.gpuPhysics = trait.config || true;
3776
- } else if (name === "digital_twin") {
3777
- props.digitalTwin = trait.config || true;
3778
- } else if (name === "sensor") {
3779
- props.sensor = trait.config || true;
3780
- } else if (name === "data_binding") {
3781
- props.dataBinding = trait.config || true;
3782
- } else if (name === "behavior_tree") {
3783
- props.behaviorTree = trait.config || true;
3784
- } else if (name === "llm_agent") {
3785
- props.llmAgent = trait.config || true;
3786
- } else if (name === "neural_link") {
3787
- props.neuralLink = trait.config || { model: "brittney-v4.gguf", temperature: 0.7 };
3788
- } else if (name === "perception") {
3789
- props.perception = trait.config || { sight_range: 20 };
3790
- } else if (name === "patrol") {
3791
- props.patrol = trait.config || true;
3792
- } else if (name === "co_located") {
3793
- props.coLocated = trait.config || true;
3794
- } else if (name === "shared_world") {
3795
- props.sharedWorld = trait.config || true;
3796
- } else if (name === "voice_proximity") {
3797
- props.voiceProximity = trait.config || { max_distance: 20 };
3798
- props.spatial = true;
3799
- } else if (name === "spatial_persona") {
3800
- props.spatialPersona = trait.config || { style: "realistic" };
3801
- } else if (name === "shareplay") {
3802
- props.sharePlay = trait.config || { activity_type: "custom" };
3803
- } else if (name === "object_tracking") {
3804
- props.objectTracking = trait.config || true;
3805
- } else if (name === "scene_reconstruction") {
3806
- props.sceneReconstruction = trait.config || { mode: "mesh" };
3807
- } else if (name === "eye_tracked") {
3808
- props.eyeTracked = true;
3809
- } else if (name === "eye_hand_fusion") {
3810
- props.eyeHandFusion = true;
3811
- } else if (name === "controlnet") {
3812
- props.controlNet = trait.config || { model: "canny" };
3813
- } else if (name === "ai_texture_gen") {
3814
- props.aiTextureGen = trait.config || { style: "photorealistic" };
3815
- } else if (name === "diffusion_realtime") {
3816
- props.diffusionRealtime = trait.config || { backend: "cuda" };
3817
- } else if (name === "ai_upscaling") {
3818
- props.aiUpscaling = trait.config || { factor: 2 };
3819
- } else if (name === "ai_inpainting") {
3820
- props.aiInpainting = trait.config || true;
3821
- } else if (name === "neural_forge") {
3822
- props.neuralForge = trait.config || true;
3823
- } else if (name === "embedding_search") {
3824
- props.embeddingSearch = trait.config || { dimensions: 1536 };
3825
- } else if (name === "ai_npc_brain") {
3826
- props.aiNpcBrain = trait.config || { model: "llm" };
3827
- } else if (name === "vector_db") {
3828
- props.vectorDb = trait.config || true;
3829
- } else if (name === "vision" || name === "ai_vision") {
3830
- props.vision = trait.config || { task: "detection" };
3831
- } else if (name === "spatial_awareness") {
3832
- props.spatialAwareness = trait.config || true;
3833
- } else if (name === "neural_animation") {
3834
- props.neuralAnimation = trait.config || { style: "motion_matching" };
3835
- } else if (name === "draft") {
3836
- props.draftMode = true;
3837
- props.draftShape = trait.config?.shape || "box";
3838
- props.draftColor = trait.config?.color || "#88aaff";
3839
- props.draftOpacity = trait.config?.opacity ?? 1;
3840
- props.draftWireframe = trait.config?.wireframe || false;
3841
- if (trait.config?.collision !== false) {
3842
- if (!props.rigidBody) props.rigidBody = { type: "fixed" };
3843
- if (!props.collider) props.collider = { type: "auto" };
3844
- }
3845
- } else if (name === "botanical_lotus") {
3846
- this.emitCompiledLotusMaterial(props, trait.config || {});
3847
- } else {
3848
- props[name] = trait.config || true;
3849
- if (!props.__unrecognizedTraits) {
3850
- props.__unrecognizedTraits = [];
3851
- }
3852
- props.__unrecognizedTraits.push(name);
3853
- }
3854
- }
3855
- }
3856
- if (obj.traits && Array.isArray(obj.traits)) {
3857
- const traitNames = obj.traits.map(
3858
- (t) => t.name
3859
- );
3860
- const compositor = new TraitCompositor();
3861
- const composedMaterial = compositor.compose(traitNames);
3862
- if (Object.keys(composedMaterial).length > 0) {
3863
- props.materialProps = {
3864
- ...props.materialProps,
3865
- ...composedMaterial
3866
- };
3867
- }
3868
- }
3869
- let type;
3870
- if (geometryType === "model" && props.src) {
3871
- type = "gltfModel";
3872
- } else if (geometryType === "light") {
3873
- const lightType = props.lightType || props.type || "directional";
3874
- const lightMapping = {
3875
- directional: "directionalLight",
3876
- point: "pointLight",
3877
- spot: "spotLight",
3878
- hemisphere: "hemisphereLight",
3879
- ambient: "ambientLight",
3880
- area: "rectAreaLight"
3881
- };
3882
- type = lightMapping[lightType] || "directionalLight";
3883
- delete props.lightType;
3884
- } else if (geometryType === "text") {
3885
- type = "Text";
3886
- } else if (geometryType === "sparkles") {
3887
- type = "Sparkles";
3888
- } else if (geometryType === "portal") {
3889
- type = "Portal";
3890
- } else {
3891
- type = "mesh";
3892
- props.hsType = geometryType;
3893
- if (!props.args) {
3894
- const size = typeof props.size === "number" ? props.size : 1;
3895
- props.args = this.getGeometryArgs(geometryType, { size });
3896
- }
3897
- }
3898
- const r3fNode = this.createNode(type, props, obj.name);
3899
- if (props.draftMode) {
3900
- r3fNode.assetMaturity = "draft";
3901
- } else if (props.maturityOverride) {
3902
- const m = props.maturityOverride;
3903
- if (m === "draft" || m === "mesh" || m === "final") {
3904
- r3fNode.assetMaturity = m;
3905
- }
3906
- }
3907
- delete props.maturityOverride;
3908
- if (obj.children && Array.isArray(obj.children)) {
3909
- for (const child of obj.children) {
3910
- r3fNode.children.push(this.compileObjectDecl(child));
3911
- }
3912
- }
3913
- if (props.__gapsComponents && Array.isArray(props.__gapsComponents)) {
3914
- for (const componentType of props.__gapsComponents) {
3915
- const componentProps = {};
3916
- if (componentType === "CloudRenderer" && props.volumetricClouds) {
3917
- const vc = props.volumetricClouds;
3918
- componentProps.coverage = vc.coverage ?? 0.5;
3919
- componentProps.altitude = vc.altitude ?? 500;
3920
- componentProps.windOffset = vc.wind ?? [0, 0, 0];
3921
- componentProps.layers = vc.layers ?? 3;
3922
- } else if (componentType === "GodRaysEffect" && props.godRays) {
3923
- const gr = props.godRays;
3924
- componentProps.intensity = gr.intensity ?? 1;
3925
- componentProps.decay = gr.decay ?? 0.96;
3926
- componentProps.lightColor = gr.color ?? "#fffde7";
3927
- } else if (componentType === "FluidRenderer" && props.fluid) {
3928
- const fl = props.fluid;
3929
- componentProps.color = fl.color ?? "#1a6fc4";
3930
- componentProps.particleSize = fl.particle_radius ?? 0.02;
3931
- componentProps.renderMode = fl.render_mode ?? "points";
3932
- }
3933
- r3fNode.children.push(
3934
- this.createNode(componentType, componentProps, `${obj.name}-${componentType}`)
3935
- );
3936
- }
3937
- delete props.__gapsComponents;
3938
- }
3939
- return r3fNode;
3940
- }
3941
- /**
3942
- * Compile a SystemNode into an R3FNode.
3943
- *
3944
- * Systems are logical containers with state, actions, lifecycle hooks,
3945
- * and optionally child objects/UI. In the R3F tree, a system compiles
3946
- * to a group node annotated with its rich metadata (state, actions,
3947
- * hooks) so the runtime/renderer can wire up behavior.
3948
- */
3949
- compileSystemNode(node, templateMap) {
3950
- const props = {};
3951
- if (node.state) {
3952
- props.systemState = node.state;
3953
- }
3954
- if (node.actions) {
3955
- props.systemActions = node.actions;
3956
- }
3957
- if (node.hooks) {
3958
- props.systemHooks = node.hooks;
3959
- }
3960
- if (node.properties && typeof node.properties === "object") {
3961
- for (const [key, value] of Object.entries(node.properties)) {
3962
- props[key] = value;
3963
- }
3964
- }
3965
- const r3fNode = this.createNode("System", props, node.id || node.name);
3966
- if (node.directives) {
3967
- r3fNode.directives = node.directives;
3968
- }
3969
- if (node.directives) {
3970
- for (const d of node.directives) {
3971
- if (d.type === "trait") {
3972
- r3fNode.traits?.set(d.name, d.config || {});
3973
- }
3974
- }
3975
- }
3976
- if (node.children && Array.isArray(node.children)) {
3977
- for (const child of node.children) {
3978
- r3fNode.children.push(this.compileChildNode(child, templateMap));
3979
- }
3980
- }
3981
- if (node.ui && Array.isArray(node.ui)) {
3982
- for (const uiNode of node.ui) {
3983
- r3fNode.children.push(this.compileNode(uiNode));
3984
- }
3985
- }
3986
- return r3fNode;
3987
- }
3988
- /**
3989
- * Compile a ComponentNode into an R3FNode.
3990
- *
3991
- * Components are UI-focused containers with props, state, actions,
3992
- * and render/UI blocks. They compile to a group node annotated with
3993
- * component metadata for the runtime.
3994
- */
3995
- compileComponentNode(node, templateMap) {
3996
- const props = {};
3997
- if (node.props) {
3998
- props.componentProps = node.props;
3999
- }
4000
- if (node.state) {
4001
- props.componentState = node.state;
4002
- }
4003
- if (node.actions) {
4004
- props.componentActions = node.actions;
4005
- }
4006
- if (node.hooks) {
4007
- props.componentHooks = node.hooks;
4008
- }
4009
- if (node.properties && typeof node.properties === "object") {
4010
- for (const [key, value] of Object.entries(node.properties)) {
4011
- props[key] = value;
4012
- }
4013
- }
4014
- const r3fNode = this.createNode(
4015
- "Component",
4016
- props,
4017
- node.id || node.name
4018
- );
4019
- if (node.directives) {
4020
- r3fNode.directives = node.directives;
4021
- }
4022
- if (node.directives) {
4023
- for (const d of node.directives) {
4024
- if (d.type === "trait") {
4025
- r3fNode.traits?.set(d.name, d.config || {});
4026
- }
4027
- }
4028
- }
4029
- if (node.children && Array.isArray(node.children)) {
4030
- for (const child of node.children) {
4031
- r3fNode.children.push(this.compileChildNode(child, templateMap));
4032
- }
4033
- }
4034
- if (node.ui && Array.isArray(node.ui)) {
4035
- for (const uiNode of node.ui) {
4036
- r3fNode.children.push(this.compileNode(uiNode));
4037
- }
4038
- }
4039
- return r3fNode;
4040
- }
4041
- /**
4042
- * Dispatch a child node to the appropriate compile method based on its type.
4043
- * Used by compileSystemNode, compileComponentNode, and compileComposition
4044
- * when processing the parser's children array.
4045
- */
4046
- compileChildNode(child, templateMap) {
4047
- switch (child.type) {
4048
- case "system":
4049
- return this.compileSystemNode(child, templateMap);
4050
- case "component":
4051
- return this.compileComponentNode(child, templateMap);
4052
- case "object":
4053
- return this.compileObjectDecl(child, templateMap);
4054
- case "template":
4055
- if (templateMap && typeof child.name === "string") {
4056
- templateMap.set(child.name, child);
4057
- }
4058
- return this.compileTemplateNode(child, templateMap);
4059
- case "spatial_group":
4060
- return this.compileSpatialGroup(child, templateMap);
4061
- default:
4062
- return this.compileNode(child);
4063
- }
4064
- }
4065
- /**
4066
- * Compile a template node. Templates define reusable types.
4067
- * In the R3F tree, they compile to an empty group (they're not
4068
- * rendered directly — objects "using" them inherit their properties).
4069
- */
4070
- compileTemplateNode(node, _templateMap) {
4071
- const props = {};
4072
- if (node.state || node.properties?.state) {
4073
- props.templateState = node.state || node.properties?.state;
4074
- }
4075
- if (node.properties) {
4076
- for (const [key, value] of Object.entries(node.properties)) {
4077
- if (key !== "state") {
4078
- props[key] = value;
4079
- }
4080
- }
4081
- }
4082
- return this.createNode("Template", props, node.name);
4083
- }
4084
- compileSpatialGroup(group, templateMap) {
4085
- const props = {};
4086
- if (group.properties) {
4087
- for (const prop of group.properties) {
4088
- if (prop.key === "position") props.position = prop.value;
4089
- else if (prop.key === "rotation") props.rotation = prop.value;
4090
- else if (prop.key === "scale")
4091
- props.scale = Array.isArray(prop.value) ? prop.value : [prop.value, prop.value, prop.value];
4092
- }
4093
- }
4094
- const node = this.createNode("group", props, group.name);
4095
- if (group.objects) {
4096
- for (const obj of group.objects)
4097
- node.children.push(this.compileObjectDecl(obj, templateMap));
4098
- }
4099
- if (group.groups) {
4100
- for (const sub of group.groups)
4101
- node.children.push(this.compileSpatialGroup(sub, templateMap));
4102
- }
4103
- return node;
4104
- }
4105
- compileTimelineBlock(timeline) {
4106
- const entries = [];
4107
- if (timeline.entries) {
4108
- for (const entry of timeline.entries) {
4109
- const action = entry.action;
4110
- const entryProps = { time: entry.time, actionKind: action.kind };
4111
- if (action.kind === "animate") {
4112
- entryProps.target = action.target;
4113
- entryProps.properties = action.properties;
4114
- } else if (action.kind === "emit") {
4115
- entryProps.event = action.event;
4116
- if (action.data !== void 0) entryProps.data = action.data;
4117
- } else if (action.kind === "call") {
4118
- entryProps.method = action.method;
4119
- if (action.args) entryProps.args = action.args;
4120
- }
4121
- entries.push(this.createNode("TimelineEntry", entryProps));
4122
- }
4123
- }
4124
- const safeName = timeline.name ? escapeStringValue(timeline.name, "JSX") : void 0;
4125
- const timelineNode = this.createNode(
4126
- "Timeline",
4127
- { autoplay: timeline.autoplay, loop: timeline.loop },
4128
- safeName
4129
- );
4130
- timelineNode.children = entries;
4131
- return timelineNode;
4132
- }
4133
- compileAudioBlock(audio) {
4134
- const props = {};
4135
- if (audio.properties) {
4136
- for (const prop of audio.properties) {
4137
- if (prop.key === "src" || prop.key === "source") {
4138
- props.src = prop.value;
4139
- } else if (prop.key === "rolloff") {
4140
- props.rolloffFactor = prop.value;
4141
- } else {
4142
- props[prop.key] = prop.value;
4143
- }
4144
- }
4145
- }
4146
- const safeName = audio.name ? escapeStringValue(audio.name, "JSX") : void 0;
4147
- return this.createNode("Audio", props, safeName);
4148
- }
4149
- compileZoneBlock(zone) {
4150
- const props = {};
4151
- if (zone.properties) {
4152
- for (const prop of zone.properties) {
4153
- props[prop.key] = prop.value;
4154
- }
4155
- }
4156
- if (zone.handlers && zone.handlers.length > 0) {
4157
- props.handlers = zone.handlers.map(
4158
- (h) => ({
4159
- event: h.event,
4160
- parameters: h.parameters,
4161
- body: h.body
4162
- })
4163
- );
4164
- }
4165
- const safeName = zone.name ? escapeStringValue(zone.name, "JSX") : void 0;
4166
- return this.createNode("Zone", props, safeName);
4167
- }
4168
- compileUIBlock(ui) {
4169
- const children = [];
4170
- if (ui.elements) {
4171
- for (const el of ui.elements) {
4172
- const elProps = {};
4173
- if (el.properties) {
4174
- for (const prop of el.properties) {
4175
- if (prop.key === "font_size") {
4176
- elProps.fontSize = prop.value;
4177
- } else {
4178
- elProps[prop.key] = this.resolveValue(prop.value);
4179
- }
4180
- }
4181
- }
4182
- const safeElName = el.name ? escapeStringValue(el.name, "JSX") : void 0;
4183
- children.push(this.createNode("UIElement", elProps, safeElName));
4184
- }
4185
- }
4186
- const uiNode = this.createNode("UI", {}, "__ui");
4187
- uiNode.children = children;
4188
- return uiNode;
4189
- }
4190
- compileTransitionBlock(transition) {
4191
- const props = {};
4192
- if (transition.properties) {
4193
- for (const prop of transition.properties) {
4194
- props[prop.key] = prop.value;
4195
- }
4196
- }
4197
- const safeName = transition.name ? escapeStringValue(transition.name, "JSX") : void 0;
4198
- return this.createNode("Transition", props, safeName);
4199
- }
4200
- compileConditionalBlock(cond, templateMap) {
4201
- const children = [];
4202
- if (cond.objects) {
4203
- for (const obj of cond.objects)
4204
- children.push(this.compileObjectDecl(obj, templateMap));
4205
- }
4206
- if (cond.spatialGroups) {
4207
- for (const g of cond.spatialGroups)
4208
- children.push(this.compileSpatialGroup(g, templateMap));
4209
- }
4210
- const elseChildren = [];
4211
- if (cond.elseObjects) {
4212
- for (const obj of cond.elseObjects)
4213
- elseChildren.push(this.compileObjectDecl(obj, templateMap));
4214
- }
4215
- if (cond.elseSpatialGroups) {
4216
- for (const g of cond.elseSpatialGroups)
4217
- elseChildren.push(this.compileSpatialGroup(g, templateMap));
4218
- }
4219
- const conditionalNode = this.createNode("ConditionalGroup", {
4220
- condition: cond.condition,
4221
- elseChildren: elseChildren.length > 0 ? elseChildren : void 0
4222
- });
4223
- conditionalNode.children = children;
4224
- return conditionalNode;
4225
- }
4226
- compileForEachBlock(iter, templateMap) {
4227
- const templateChildren = [];
4228
- if (iter.objects) {
4229
- for (const obj of iter.objects)
4230
- templateChildren.push(this.compileObjectDecl(obj, templateMap));
4231
- }
4232
- if (iter.spatialGroups) {
4233
- for (const g of iter.spatialGroups)
4234
- templateChildren.push(this.compileSpatialGroup(g, templateMap));
4235
- }
4236
- const forEachNode = this.createNode("ForEachGroup", {
4237
- variable: iter.variable,
4238
- iterable: iter.iterable
4239
- });
4240
- forEachNode.children = templateChildren;
4241
- return forEachNode;
4242
- }
4243
- /**
4244
- * Resolve a property value, converting bind expressions into runtime-reactive markers.
4245
- */
4246
- resolveValue(value) {
4247
- if (value && typeof value === "object" && value.__bind) {
4248
- return {
4249
- __bind: true,
4250
- source: value.source,
4251
- transform: value.transform
4252
- };
4253
- }
4254
- return value;
4255
- }
4256
- // ─── Shared Helpers ───────────────────────────────────────────────────
4257
- injectDefaultLighting(root) {
4258
- if (!this._defaultLighting) return;
4259
- if (!this.treeHasLights(root)) {
4260
- const shadowSize = this.tierScales.shadowMapSize;
4261
- root.children?.unshift(
4262
- this.createNode("ambientLight", { intensity: 0.4, color: "#ffffff" }),
4263
- this.createNode("directionalLight", {
4264
- intensity: 1,
4265
- position: [5, 10, 5],
4266
- castShadow: true,
4267
- "shadow-mapSize": [shadowSize, shadowSize],
4268
- color: "#ffffff"
4269
- })
4270
- );
4271
- }
4272
- }
4273
- treeHasLights(node) {
4274
- if (node.type.toLowerCase().includes("light")) return true;
4275
- return node.children?.some((c) => this.treeHasLights(c)) || false;
4276
- }
4277
- hasPostProcessing(node) {
4278
- if (node.traits?.has("bloom") || node.traits?.has("postprocessing"))
4279
- return true;
4280
- if (node.props.bloom) return true;
4281
- return node.children?.some((c) => this.hasPostProcessing(c)) || false;
4282
- }
4283
- extractPostProcessingNodes(node) {
4284
- const effects = [];
4285
- const ppTrait = node.traits?.get(
4286
- "postprocessing"
4287
- );
4288
- if (ppTrait) {
4289
- if (ppTrait.bloom)
4290
- effects.push(this.createNode("Bloom", ppTrait.bloom));
4291
- if (ppTrait.ssao)
4292
- effects.push(this.createNode("SSAO", ppTrait.ssao));
4293
- if (ppTrait.vignette)
4294
- effects.push(this.createNode("Vignette", ppTrait.vignette));
4295
- }
4296
- if (node.props.bloom) {
4297
- const bloom = node.props.bloom;
4298
- const bloomProps = typeof bloom === "object" && bloom !== null ? bloom : { intensity: 1 };
4299
- effects.push(this.createNode("Bloom", bloomProps));
4300
- }
4301
- node.children?.forEach((child) => effects.push(...this.extractPostProcessingNodes(child)));
4302
- return effects;
4303
- }
4304
- mapType(type, props) {
4305
- if (type === "environment") {
4306
- if (props.name && typeof props.name === "string" && ENVIRONMENT_PRESETS[props.name]) {
4307
- Object.assign(props, ENVIRONMENT_PRESETS[props.name]);
4308
- }
4309
- return "Environment";
4310
- }
4311
- if (type === "light") {
4312
- const lightType = props.type || "directional";
4313
- const lightMapping = {
4314
- directional: "directionalLight",
4315
- point: "pointLight",
4316
- spot: "spotLight",
4317
- hemisphere: "hemisphereLight",
4318
- ambient: "ambientLight",
4319
- area: "rectAreaLight"
4320
- };
4321
- return lightMapping[lightType] || "directionalLight";
4322
- }
4323
- if (type === "portal") return "Portal";
4324
- if (type === "sparkles") return "Sparkles";
4325
- if (MESH_TYPES.has(type)) {
4326
- props.hsType = type;
4327
- return "mesh";
4328
- }
4329
- const mapping = {
4330
- ambient_light: "ambientLight",
4331
- model: "gltfModel",
4332
- audio: "positionalAudio",
4333
- composition: "group",
4334
- scale: "group",
4335
- focus: "group",
4336
- spatial_agent: "SpatialAgent",
4337
- spatial_container: "group",
4338
- ui_panel: "UIPanel",
4339
- ui_text: "UIText",
4340
- ui_button: "UIButton",
4341
- ui_slider: "UISlider",
4342
- ui_input: "UIInput",
4343
- ui_image: "UIImage",
4344
- ui_chart: "UIChart",
4345
- ui_gauge: "UIGauge",
4346
- ui_value: "UIValue",
4347
- ui_status_indicator: "UIStatusIndicator",
4348
- tool_slot: "ToolSlot",
4349
- behavior: "group",
4350
- system: "System",
4351
- component: "Component",
4352
- dna: "DNA",
4353
- gaussian_splat: "GaussianSplat",
4354
- splat: "GaussianSplat",
4355
- nerf: "NeRF",
4356
- volumetric_video: "VolumetricVideo",
4357
- world: "group"
4358
- };
4359
- return mapping[type] || type;
4360
- }
4361
- compileProperties(node, rawProps) {
4362
- const expandedProps = this.expandSpreads(rawProps);
4363
- const props = { ...expandedProps };
4364
- if (node.position) {
4365
- props.position = node.position;
4366
- }
4367
- if (rawProps.position && Array.isArray(rawProps.position)) {
4368
- props.position = rawProps.position;
4369
- }
4370
- if (node.hologram) {
4371
- const h = node.hologram;
4372
- if (h.color) props.color = h.color;
4373
- if (MESH_TYPES.has(node.type)) {
4374
- props.args = this.getGeometryArgs(node.type, h);
4375
- props.hsType = node.type;
4376
- }
4377
- }
4378
- if (rawProps.scale !== void 0 && !props.scale) {
4379
- props.scale = Array.isArray(rawProps.scale) ? rawProps.scale : [rawProps.scale, rawProps.scale, rawProps.scale];
4380
- }
4381
- if (rawProps.geometry && !props.hsType) {
4382
- props.hsType = rawProps.geometry;
4383
- props.args = this.getGeometryArgs(rawProps.geometry, { size: rawProps.size || 1 });
4384
- }
4385
- if (rawProps.material && typeof rawProps.material === "string" && MATERIAL_PRESETS[rawProps.material]) {
4386
- props.materialProps = {
4387
- ...MATERIAL_PRESETS[rawProps.material],
4388
- ...props.materialProps
4389
- };
4390
- }
4391
- if (node.directives) {
4392
- for (const d of node.directives) {
4393
- if (d.type === "trait") {
4394
- if (d.name === "grabbable") {
4395
- props.castShadow = true;
4396
- props.grabbable = d.config || true;
4397
- if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
4398
- if (!props.collider) props.collider = { type: "auto" };
4399
- } else if (d.name === "animated") {
4400
- props.animated = d.config || true;
4401
- } else if (d.name === "spatial_audio" || d.name === "voice") {
4402
- props.spatial = true;
4403
- } else if (d.name === "gem_resonance") {
4404
- props.gemResonance = gemResonanceConfig(
4405
- d.config
4406
- );
4407
- props.spatial = true;
4408
- } else if (d.name === "networked") {
4409
- props.networked = d.config || true;
4410
- } else if (d.name === "moldable") {
4411
- props.moldable = d.config || true;
4412
- } else if (d.name === "stretchable") {
4413
- props.stretchable = d.config || true;
4414
- } else if (d.name === "ai_driven") {
4415
- props.ai_driven = d.config || true;
4416
- } else if (d.name === "dialogue") {
4417
- props.dialogue = d.config || true;
4418
- } else if (d.name === "gesture") {
4419
- props.gesture = d.config || true;
4420
- } else if (d.name === "haptic") {
4421
- props.haptic = d.config || true;
4422
- } else if (d.name === "avatar_embodiment") {
4423
- props.avatarEmbodiment = d.config || true;
4424
- } else if (d.name === "lip_sync") {
4425
- props.lipSync = d.config || true;
4426
- } else if (d.name === "emotion_directive") {
4427
- props.emotionDirective = d.config || true;
4428
- } else if (d.name === "stt") {
4429
- props.stt = d.config || true;
4430
- } else if (d.name === "tts") {
4431
- props.tts = d.config || true;
4432
- } else if (d.name === "generate") {
4433
- props.generate = d.config;
4434
- } else if (d.name === "skeleton") {
4435
- props.skeleton = d.config || true;
4436
- } else if (d.name === "body") {
4437
- props.body = d.config || true;
4438
- } else if (d.name === "gaussian_splat") {
4439
- props.gaussianSplat = d.config || true;
4440
- } else if (d.name === "nerf") {
4441
- props.nerf = d.config || true;
4442
- } else if (d.name === "volumetric_video") {
4443
- props.volumetricVideo = d.config || true;
4444
- } else if (d.name === "web_surface") {
4445
- props.webSurface = d.config || true;
4446
- }
4447
- }
4448
- }
4449
- }
4450
- delete props.type;
4451
- delete props.geometry;
4452
- return props;
4453
- }
4454
- applyGraphicsConfig(r3fNode, graphics) {
4455
- if (graphics.material) {
4456
- const m = graphics.material;
4457
- const materialProps = {};
4458
- if (m.preset && MATERIAL_PRESETS[m.preset]) {
4459
- Object.assign(materialProps, MATERIAL_PRESETS[m.preset]);
4460
- }
4461
- if (m.type === "pbr" && m.pbr) {
4462
- if (m.pbr.baseColor) materialProps["color"] = this.mapColor(m.pbr.baseColor);
4463
- if (m.pbr.metallic !== void 0) materialProps["metalness"] = m.pbr.metallic;
4464
- if (m.pbr.roughness !== void 0) materialProps["roughness"] = m.pbr.roughness;
4465
- if (m.pbr.emission) materialProps["emissive"] = this.mapColor(m.pbr.emission);
4466
- if (m.pbr.emissionStrength) materialProps["emissiveIntensity"] = m.pbr.emissionStrength;
4467
- if (m.pbr.clearcoat !== void 0) materialProps["clearcoat"] = m.pbr.clearcoat;
4468
- if (m.pbr.transmission !== void 0) materialProps["transmission"] = m.pbr.transmission;
4469
- if (m.pbr.ior !== void 0) materialProps["ior"] = m.pbr.ior;
4470
- if (m.pbr.iridescence !== void 0) materialProps["iridescence"] = m.pbr.iridescence;
4471
- }
4472
- const prior = r3fNode.props.materialProps ?? {};
4473
- r3fNode.props.materialProps = { ...prior, ...materialProps };
4474
- }
4475
- if (graphics.lighting) {
4476
- const l = graphics.lighting;
4477
- if (r3fNode.type.toLowerCase().includes("light")) {
4478
- if (l.shadows) r3fNode.props.castShadow = true;
4479
- if (l.intensity !== void 0) r3fNode.props.intensity = l.intensity;
4480
- if (l.color) r3fNode.props.color = this.mapColor(l.color);
4481
- }
4482
- if (r3fNode.type === "Environment" && l.preset) {
4483
- r3fNode.props.preset = l.preset;
4484
- }
4485
- }
4486
- if (graphics.networked) {
4487
- r3fNode.props.networked = graphics.networked;
4488
- }
4489
- }
4490
- mapColor(c) {
4491
- if (typeof c === "string") return c;
4492
- if (typeof c === "number") return `#${c.toString(16).padStart(6, "0")}`;
4493
- if (c.r !== void 0) {
4494
- const r = c.r > 1 ? c.r : Math.floor(c.r * 255);
4495
- const g = c.g > 1 ? c.g : Math.floor(c.g * 255);
4496
- const b = c.b > 1 ? c.b : Math.floor(c.b * 255);
4497
- return `rgb(${r}, ${g}, ${b})`;
4498
- }
4499
- return "#ffffff";
4500
- }
4501
- getGeometryArgs(type, hologram) {
4502
- const size = hologram.size || 1;
4503
- switch (type) {
4504
- case "sphere":
4505
- case "orb":
4506
- return [size * 0.5, 32, 32];
4507
- case "cube":
4508
- case "box":
4509
- return [size, size, size];
4510
- case "cylinder":
4511
- return [size * 0.5, size * 0.5, size, 32];
4512
- case "pyramid":
4513
- case "cone":
4514
- return [size * 0.5, 0, size, 4];
4515
- case "plane":
4516
- return [size, size];
4517
- case "torus":
4518
- return [size * 0.5, size * 0.15, 16, 32];
4519
- case "ring":
4520
- return [size * 0.3, size * 0.5, 32];
4521
- case "capsule":
4522
- return [size * 0.3, size * 0.5, 4, 16];
4523
- default:
4524
- return [size, size, size];
4525
- }
4526
- }
4527
- };
4528
- }
4529
- });
4530
-
4531
- export { ASTNodePool, ENVIRONMENT_PRESETS, MATERIAL_PRESETS, QUALITY_TIER_SCALES, R3FCompiler, R3FCompiler_exports, UI_COMPONENT_PRESETS, init_ObjectPool, init_R3FCompiler, init_visual, registerAllPresets };
4532
- //# sourceMappingURL=chunk-MSYSQ2AJ.js.map
4533
- //# sourceMappingURL=chunk-MSYSQ2AJ.js.map