@holoscript/core 8.0.8 → 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 +113 -46
  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,1508 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkE7JP3BS3_cjs = require('./chunk-E7JP3BS3.cjs');
4
-
5
- // src/traits/LightingTrait.ts
6
- var LightingTrait = class {
7
- constructor(config) {
8
- this.lights = /* @__PURE__ */ new Map();
9
- this.lightIdCounter = 0;
10
- this.globalIllumination = {
11
- enabled: true,
12
- intensity: 1,
13
- skyColor: { r: 0.5, g: 0.7, b: 1 },
14
- skyIntensity: 1,
15
- groundColor: { r: 0.4, g: 0.4, b: 0.4 },
16
- groundIntensity: 0.5,
17
- probes: true,
18
- indirectDiffuse: 1,
19
- indirectSpecular: 1,
20
- aoIntensity: 1,
21
- screenSpaceAO: true,
22
- ...config
23
- };
24
- }
25
- /**
26
- * Add a light to the scene
27
- */
28
- addLight(light) {
29
- const id = light.name || `light_${this.lightIdCounter++}`;
30
- this.lights.set(id, light);
31
- return id;
32
- }
33
- /**
34
- * Get light by ID
35
- */
36
- getLight(id) {
37
- return this.lights.get(id);
38
- }
39
- /**
40
- * Get all lights
41
- */
42
- getLights() {
43
- return Array.from(this.lights.values());
44
- }
45
- /**
46
- * Get lights by type
47
- */
48
- getLightsByType(type) {
49
- return Array.from(this.lights.values()).filter((l) => l.type === type);
50
- }
51
- /**
52
- * Update light properties
53
- */
54
- updateLight(id, updates) {
55
- const light = this.lights.get(id);
56
- if (!light) return false;
57
- this.lights.set(id, { ...light, ...updates });
58
- return true;
59
- }
60
- /**
61
- * Remove light
62
- */
63
- removeLight(id) {
64
- return this.lights.delete(id);
65
- }
66
- /**
67
- * Clear all lights
68
- */
69
- clearLights() {
70
- this.lights.clear();
71
- }
72
- /**
73
- * Get global illumination config
74
- */
75
- getGlobalIllumination() {
76
- return { ...this.globalIllumination };
77
- }
78
- /**
79
- * Update global illumination
80
- */
81
- updateGlobalIllumination(updates) {
82
- this.globalIllumination = {
83
- ...this.globalIllumination,
84
- ...updates
85
- };
86
- }
87
- /**
88
- * Enable/disable GI
89
- */
90
- setGIEnabled(enabled) {
91
- this.globalIllumination.enabled = enabled;
92
- }
93
- /**
94
- * Set ambient light colors (skybox mode)
95
- */
96
- setAmbientLight(skyColor, groundColor, intensity = 1) {
97
- this.globalIllumination.skyColor = skyColor;
98
- this.globalIllumination.groundColor = groundColor;
99
- this.globalIllumination.skyIntensity = intensity;
100
- this.globalIllumination.groundIntensity = intensity * 0.5;
101
- }
102
- /**
103
- * Enable/disable screen-space ambient occlusion
104
- */
105
- setScreenSpaceAO(enabled, intensity = 1) {
106
- this.globalIllumination.screenSpaceAO = enabled;
107
- this.globalIllumination.aoIntensity = intensity;
108
- }
109
- /**
110
- * Create directional light (sun)
111
- */
112
- createDirectionalLight(direction, color, intensity = 1, castShadows = true) {
113
- const light = {
114
- type: "directional",
115
- name: `sun_${this.lightIdCounter}`,
116
- direction,
117
- color,
118
- intensity,
119
- shadow: castShadows ? {
120
- type: "soft",
121
- resolution: 2048,
122
- cascades: 4,
123
- softness: 1
124
- } : void 0,
125
- volumetric: true,
126
- priority: 100
127
- };
128
- return this.addLight(light);
129
- }
130
- /**
131
- * Create point light
132
- */
133
- createPointLight(position, color, intensity, range, castShadows = false) {
134
- const light = {
135
- type: "point",
136
- name: `point_${this.lightIdCounter}`,
137
- position,
138
- color,
139
- intensity,
140
- range,
141
- shadow: castShadows ? {
142
- type: "soft",
143
- resolution: 512,
144
- softness: 0.5
145
- } : void 0,
146
- priority: 50
147
- };
148
- return this.addLight(light);
149
- }
150
- /**
151
- * Create spot light
152
- */
153
- createSpotLight(position, direction, color, intensity, range, spotAngle = 45, castShadows = true) {
154
- const light = {
155
- type: "spot",
156
- name: `spot_${this.lightIdCounter}`,
157
- position,
158
- direction,
159
- color,
160
- intensity,
161
- range,
162
- spotAngle,
163
- innerSpotAngle: spotAngle * 0.5,
164
- shadow: castShadows ? {
165
- type: "soft",
166
- resolution: 1024,
167
- softness: 0.8
168
- } : void 0,
169
- priority: 75
170
- };
171
- return this.addLight(light);
172
- }
173
- /**
174
- * Create area light for soft lighting
175
- */
176
- createAreaLight(position, color, intensity, width, height) {
177
- const light = {
178
- type: "area",
179
- name: `area_${this.lightIdCounter}`,
180
- position,
181
- color,
182
- intensity,
183
- range: Math.max(width, height) * 2,
184
- priority: 25
185
- };
186
- return this.addLight(light);
187
- }
188
- /**
189
- * Get shadow-casting lights
190
- */
191
- getShadowCastingLights() {
192
- return Array.from(this.lights.values()).filter((l) => l.shadow && l.shadow.type !== "none");
193
- }
194
- /**
195
- * Get light count by type
196
- */
197
- getLightCount() {
198
- const counts = {
199
- directional: 0,
200
- point: 0,
201
- spot: 0,
202
- area: 0,
203
- probe: 0
204
- };
205
- for (const light of Array.from(this.lights.values())) {
206
- counts[light.type]++;
207
- }
208
- return counts;
209
- }
210
- /**
211
- * Estimate light impact for performance optimization
212
- */
213
- getPerformanceImpact() {
214
- const totalLights = this.lights.size;
215
- const shadowCasters = this.getShadowCastingLights().length;
216
- let estimatedGPUCost = "low";
217
- if (totalLights > 16 || shadowCasters > 4) {
218
- estimatedGPUCost = "high";
219
- } else if (totalLights > 8 || shadowCasters > 2) {
220
- estimatedGPUCost = "medium";
221
- }
222
- return {
223
- totalLights,
224
- shadowCasters,
225
- estimatedGPUCost
226
- };
227
- }
228
- /**
229
- * Get scene complexity info
230
- */
231
- getSceneInfo() {
232
- const counts = this.getLightCount();
233
- const impact = this.getPerformanceImpact();
234
- return `Lighting: ${counts.directional} dir, ${counts.point} point, ${counts.spot} spot | Shadows: ${impact.shadowCasters} | GPU: ${impact.estimatedGPUCost}`;
235
- }
236
- /**
237
- * Dispose and cleanup
238
- */
239
- dispose() {
240
- this.lights.clear();
241
- }
242
- };
243
- function createLightingTrait(config) {
244
- return new LightingTrait(config);
245
- }
246
- var LIGHTING_PRESETS = {
247
- /** Neutral studio lighting */
248
- studio: () => ({
249
- enabled: true,
250
- intensity: 1,
251
- skyColor: { r: 0.5, g: 0.5, b: 0.5 },
252
- skyIntensity: 0.5,
253
- groundColor: { r: 0.3, g: 0.3, b: 0.3 },
254
- groundIntensity: 0.3
255
- }),
256
- /** Bright outdoor lighting */
257
- outdoor: () => ({
258
- enabled: true,
259
- intensity: 1.2,
260
- skyColor: { r: 0.7, g: 0.85, b: 1 },
261
- skyIntensity: 1,
262
- groundColor: { r: 0.4, g: 0.4, b: 0.35 },
263
- groundIntensity: 0.6,
264
- indirectDiffuse: 1.2
265
- }),
266
- /** Dim interior lighting */
267
- interior: () => ({
268
- enabled: true,
269
- intensity: 0.6,
270
- skyColor: { r: 0.3, g: 0.3, b: 0.35 },
271
- skyIntensity: 0.4,
272
- groundColor: { r: 0.2, g: 0.2, b: 0.2 },
273
- groundIntensity: 0.2
274
- }),
275
- /** Night scene */
276
- night: () => ({
277
- enabled: true,
278
- intensity: 0.3,
279
- skyColor: { r: 0.01, g: 0.01, b: 0.02 },
280
- skyIntensity: 0.1,
281
- groundColor: { r: 0.02, g: 0.02, b: 0.02 },
282
- groundIntensity: 0.05,
283
- screenSpaceAO: false
284
- }),
285
- /** Sunset/golden hour */
286
- sunset: () => ({
287
- enabled: true,
288
- intensity: 1.1,
289
- skyColor: { r: 1, g: 0.7, b: 0.3 },
290
- skyIntensity: 1,
291
- groundColor: { r: 0.6, g: 0.4, b: 0.2 },
292
- groundIntensity: 0.8
293
- })
294
- };
295
- var lightingHandler = {
296
- name: "lighting",
297
- defaultConfig: {},
298
- onAttach(node, config, ctx) {
299
- const instance = new LightingTrait(config);
300
- node.__lighting_instance = instance;
301
- ctx.emit("lighting_attached", { node, config });
302
- },
303
- onDetach(node, _config, ctx) {
304
- const instance = node.__lighting_instance;
305
- if (instance) {
306
- if (typeof instance.onDetach === "function") instance.onDetach(node, ctx);
307
- else if (typeof instance.dispose === "function") instance.dispose();
308
- else if (typeof instance.cleanup === "function") instance.cleanup();
309
- }
310
- ctx.emit("lighting_detached", { node });
311
- delete node.__lighting_instance;
312
- },
313
- onEvent(node, _config, ctx, event) {
314
- const instance = node.__lighting_instance;
315
- if (!instance) return;
316
- if (typeof instance.onEvent === "function") instance.onEvent(event);
317
- else if (typeof instance.emit === "function" && event.type) instance.emit(event);
318
- if (event.type === "lighting_configure" && event.payload) {
319
- Object.assign(instance, event.payload);
320
- ctx.emit("lighting_configured", { node });
321
- }
322
- },
323
- onUpdate(node, _config, ctx, dt) {
324
- const instance = node.__lighting_instance;
325
- if (!instance) return;
326
- if (typeof instance.onUpdate === "function") instance.onUpdate(node, ctx, dt);
327
- }
328
- };
329
-
330
- // src/traits/MaterialTrait.ts
331
- var MaterialTrait = class {
332
- constructor(config) {
333
- this.textureCache = /* @__PURE__ */ new Map();
334
- this.material = {
335
- ...{ type: "pbr" },
336
- ...config
337
- };
338
- }
339
- /**
340
- * Get material properties
341
- */
342
- getMaterial() {
343
- return { ...this.material };
344
- }
345
- /**
346
- * Update material property
347
- */
348
- setProperty(key, value) {
349
- this.material[key] = value;
350
- }
351
- /**
352
- * Get PBR properties
353
- */
354
- getPBRProperties() {
355
- return this.material.pbr;
356
- }
357
- /**
358
- * Update PBR material
359
- */
360
- updatePBR(pbr) {
361
- if (!this.material.pbr) {
362
- this.material.pbr = {
363
- baseColor: { r: 1, g: 1, b: 1 },
364
- metallic: 0,
365
- roughness: 0.5
366
- };
367
- }
368
- this.material.pbr = { ...this.material.pbr, ...pbr };
369
- }
370
- /**
371
- * Add texture map
372
- */
373
- addTexture(texture) {
374
- if (!this.material.textures) {
375
- this.material.textures = [];
376
- }
377
- this.material.textures.push(texture);
378
- }
379
- /**
380
- * Get all textures
381
- */
382
- getTextures() {
383
- return [...this.material.textures || []];
384
- }
385
- /**
386
- * Clear texture cache (for memory optimization)
387
- */
388
- clearTextureCache() {
389
- this.textureCache.clear();
390
- }
391
- /**
392
- * Get shader code if custom
393
- */
394
- getCustomShader() {
395
- return this.material.customShader;
396
- }
397
- /**
398
- * Set custom shader
399
- */
400
- setCustomShader(shader) {
401
- this.material.customShader = shader;
402
- }
403
- /**
404
- * Get optimization hints
405
- */
406
- getOptimization() {
407
- return this.material.optimization;
408
- }
409
- /**
410
- * Enable/disable texture streaming
411
- */
412
- setTextureStreaming(enabled) {
413
- if (!this.material.optimization) {
414
- this.material.optimization = {};
415
- }
416
- this.material.optimization.streamTextures = enabled;
417
- }
418
- /**
419
- * Set texture compression
420
- */
421
- setCompression(compression) {
422
- if (!this.material.optimization) {
423
- this.material.optimization = {};
424
- }
425
- this.material.optimization.compression = compression;
426
- }
427
- /**
428
- * Enable material instancing for performance
429
- */
430
- setInstanced(instanced) {
431
- if (!this.material.optimization) {
432
- this.material.optimization = {};
433
- }
434
- this.material.optimization.instanced = instanced;
435
- }
436
- /**
437
- * Dispose and cleanup
438
- */
439
- dispose() {
440
- this.textureCache.clear();
441
- }
442
- };
443
- function createMaterialTrait(config) {
444
- return new MaterialTrait(config);
445
- }
446
- var MATERIAL_PRESETS = {
447
- /** Shiny metal */
448
- chrome: () => ({
449
- type: "pbr",
450
- pbr: {
451
- baseColor: { r: 0.77, g: 0.77, b: 0.77 },
452
- metallic: 1,
453
- roughness: 0.1
454
- }
455
- }),
456
- /** Rough plastic */
457
- plastic: () => ({
458
- type: "pbr",
459
- pbr: {
460
- baseColor: { r: 1, g: 1, b: 1 },
461
- metallic: 0,
462
- roughness: 0.8
463
- }
464
- }),
465
- /** Wood texture */
466
- wood: () => ({
467
- type: "pbr",
468
- pbr: {
469
- baseColor: { r: 0.6, g: 0.4, b: 0.2 },
470
- metallic: 0,
471
- roughness: 0.4
472
- }
473
- }),
474
- /** Glass */
475
- glass: () => ({
476
- type: "transparent",
477
- blendMode: "blend",
478
- pbr: {
479
- baseColor: { r: 1, g: 1, b: 1, a: 0.3 },
480
- metallic: 0,
481
- roughness: 0,
482
- ior: 1.5,
483
- transmission: 0.9
484
- }
485
- }),
486
- /** Emissive (glowing) */
487
- emissive: () => ({
488
- type: "pbr",
489
- pbr: {
490
- baseColor: { r: 0, g: 1, b: 0 },
491
- metallic: 0,
492
- roughness: 1,
493
- emission: {
494
- color: { r: 0, g: 1, b: 0 },
495
- intensity: 2
496
- }
497
- }
498
- }),
499
- /** Skin material */
500
- skin: () => ({
501
- type: "pbr",
502
- pbr: {
503
- baseColor: { r: 1, g: 0.8, b: 0.7 },
504
- metallic: 0,
505
- roughness: 0.5,
506
- ambientOcclusion: 0.8
507
- }
508
- })
509
- };
510
- var materialHandler = {
511
- name: "material",
512
- defaultConfig: {},
513
- onAttach(node, config, ctx) {
514
- const instance = new MaterialTrait(config);
515
- node.__material_instance = instance;
516
- ctx.emit("material_attached", { node, config });
517
- },
518
- onDetach(node, _config, ctx) {
519
- const instance = node.__material_instance;
520
- if (instance) {
521
- if (typeof instance.onDetach === "function") instance.onDetach(node, ctx);
522
- else if (typeof instance.dispose === "function") instance.dispose();
523
- else if (typeof instance.cleanup === "function") instance.cleanup();
524
- }
525
- ctx.emit("material_detached", { node });
526
- delete node.__material_instance;
527
- },
528
- onEvent(node, _config, ctx, event) {
529
- const instance = node.__material_instance;
530
- if (!instance) return;
531
- if (typeof instance.onEvent === "function") instance.onEvent(event);
532
- else if (typeof instance.emit === "function" && event.type) instance.emit(event);
533
- if (event.type === "material_configure" && event.payload) {
534
- Object.assign(instance, event.payload);
535
- ctx.emit("material_configured", { node });
536
- }
537
- },
538
- onUpdate(node, _config, ctx, dt) {
539
- const instance = node.__material_instance;
540
- if (!instance) return;
541
- if (typeof instance.onUpdate === "function") instance.onUpdate(node, ctx, dt);
542
- }
543
- };
544
-
545
- // src/traits/RenderingTrait.ts
546
- chunkE7JP3BS3_cjs.init_safeJsonParse();
547
- var RenderingTrait = class {
548
- constructor(config) {
549
- this.optimization = {
550
- lodStrategy: "automatic",
551
- culling: {
552
- mode: "back",
553
- frustum: true,
554
- occlusion: true
555
- },
556
- batching: {
557
- static: true,
558
- dynamic: true,
559
- instancing: true,
560
- maxInstanceCount: 1e3
561
- },
562
- textures: {
563
- streaming: true,
564
- compression: "auto",
565
- mipmaps: true,
566
- maxResolution: 2048
567
- },
568
- shaders: {
569
- simplifiedShaders: true,
570
- lodBias: 0
571
- },
572
- targetGPUTier: "high",
573
- adaptiveQuality: true,
574
- targetFrameRate: 60,
575
- ...config
576
- };
577
- }
578
- /**
579
- * Get rendering optimization config
580
- */
581
- getOptimization() {
582
- return chunkE7JP3BS3_cjs.jsonClone(this.optimization);
583
- }
584
- /**
585
- * Update rendering configuration
586
- */
587
- updateOptimization(updates) {
588
- this.optimization = { ...this.optimization, ...updates };
589
- }
590
- /**
591
- * Setup LOD levels (3 levels is typical)
592
- */
593
- setupLODLevels(strategy = "automatic") {
594
- const levels = [
595
- {
596
- level: 0,
597
- screenRelativeSize: 0.5,
598
- polygonReduction: 1,
599
- textureScale: 1
600
- },
601
- {
602
- level: 1,
603
- screenRelativeSize: 0.25,
604
- polygonReduction: 0.6,
605
- disabledFeatures: ["specular"],
606
- textureScale: 0.5
607
- },
608
- {
609
- level: 2,
610
- screenRelativeSize: 0.1,
611
- polygonReduction: 0.3,
612
- disabledFeatures: ["specular", "normals"],
613
- textureScale: 0.25
614
- }
615
- ];
616
- this.optimization.lodStrategy = strategy;
617
- this.optimization.lodLevels = levels;
618
- }
619
- /**
620
- * Get LOD levels
621
- */
622
- getLODLevels() {
623
- return [...this.optimization.lodLevels || []];
624
- }
625
- /**
626
- * Configure culling
627
- */
628
- setCulling(config) {
629
- const defaultCulling = { mode: "back" };
630
- this.optimization.culling = {
631
- ...defaultCulling,
632
- ...this.optimization.culling,
633
- ...config
634
- };
635
- }
636
- /**
637
- * Enable frustum culling
638
- */
639
- setFrustumCulling(enabled) {
640
- if (!this.optimization.culling) {
641
- this.optimization.culling = { mode: "back" };
642
- }
643
- this.optimization.culling.frustum = enabled;
644
- }
645
- /**
646
- * Enable occlusion culling
647
- */
648
- setOcclusionCulling(enabled, distance) {
649
- if (!this.optimization.culling) {
650
- this.optimization.culling = { mode: "back" };
651
- }
652
- this.optimization.culling.occlusion = enabled;
653
- if (distance) {
654
- this.optimization.culling.occlusionDistance = distance;
655
- }
656
- }
657
- /**
658
- * Configure batching
659
- */
660
- setBatching(config) {
661
- this.optimization.batching = {
662
- ...this.optimization.batching,
663
- ...config
664
- };
665
- }
666
- /**
667
- * Enable GPU instancing
668
- */
669
- setInstancing(enabled, maxInstances) {
670
- if (!this.optimization.batching) {
671
- this.optimization.batching = {};
672
- }
673
- this.optimization.batching.instancing = enabled;
674
- if (maxInstances) {
675
- this.optimization.batching.maxInstanceCount = maxInstances;
676
- }
677
- }
678
- /**
679
- * Configure texture optimization
680
- */
681
- setTextureOptimization(config) {
682
- this.optimization.textures = {
683
- ...this.optimization.textures,
684
- ...config
685
- };
686
- }
687
- /**
688
- * Enable texture streaming
689
- */
690
- setTextureStreaming(enabled, budgetMB) {
691
- if (!this.optimization.textures) {
692
- this.optimization.textures = {};
693
- }
694
- this.optimization.textures.streaming = enabled;
695
- if (budgetMB) {
696
- this.optimization.textures.streamingBudget = budgetMB;
697
- }
698
- }
699
- /**
700
- * Set texture compression
701
- */
702
- setTextureCompression(compression) {
703
- if (!this.optimization.textures) {
704
- this.optimization.textures = {};
705
- }
706
- this.optimization.textures.compression = compression;
707
- }
708
- /**
709
- * Set max texture resolution
710
- */
711
- setMaxTextureResolution(resolution) {
712
- if (!this.optimization.textures) {
713
- this.optimization.textures = {};
714
- }
715
- this.optimization.textures.maxResolution = resolution;
716
- }
717
- /**
718
- * Configure shader optimization
719
- */
720
- setShaderOptimization(config) {
721
- this.optimization.shaders = {
722
- ...this.optimization.shaders,
723
- ...config
724
- };
725
- }
726
- /**
727
- * Set target GPU tier
728
- */
729
- setTargetGPUTier(tier) {
730
- this.optimization.targetGPUTier = tier;
731
- }
732
- /**
733
- * Enable adaptive quality (adjust based on frame rate)
734
- */
735
- setAdaptiveQuality(enabled, targetFrameRate) {
736
- this.optimization.adaptiveQuality = enabled;
737
- if (targetFrameRate) {
738
- this.optimization.targetFrameRate = targetFrameRate;
739
- }
740
- }
741
- /**
742
- * Set fixed timestep for VR/AR
743
- */
744
- setFixedTimestep(timestep) {
745
- this.optimization.fixedTimestep = timestep;
746
- }
747
- /**
748
- * Get rendering preset for quality level
749
- */
750
- getPresetForQuality(quality) {
751
- const presets = {
752
- low: {
753
- targetGPUTier: "low",
754
- lodStrategy: "automatic",
755
- culling: { mode: "back", frustum: true, occlusion: false },
756
- batching: { instancing: true, maxInstanceCount: 500 },
757
- textures: {
758
- compression: "astc",
759
- maxResolution: 512,
760
- streaming: true,
761
- streamingBudget: 128
762
- },
763
- adaptiveQuality: true,
764
- targetFrameRate: 30
765
- },
766
- medium: {
767
- targetGPUTier: "medium",
768
- lodStrategy: "automatic",
769
- culling: { mode: "back", frustum: true, occlusion: true },
770
- batching: { instancing: true, maxInstanceCount: 1e3 },
771
- textures: {
772
- compression: "basis",
773
- maxResolution: 1024,
774
- streaming: true,
775
- streamingBudget: 256
776
- },
777
- adaptiveQuality: true,
778
- targetFrameRate: 60
779
- },
780
- high: {
781
- targetGPUTier: "high",
782
- lodStrategy: "automatic",
783
- culling: { mode: "back", frustum: true, occlusion: true },
784
- batching: { instancing: true, maxInstanceCount: 2e3 },
785
- textures: {
786
- compression: "dxt",
787
- maxResolution: 2048,
788
- streaming: true,
789
- streamingBudget: 512
790
- },
791
- adaptiveQuality: false,
792
- targetFrameRate: 60
793
- },
794
- ultra: {
795
- targetGPUTier: "ultra",
796
- lodStrategy: "manual",
797
- culling: {
798
- mode: "back",
799
- frustum: true,
800
- occlusion: true,
801
- hierarchicalZ: true
802
- },
803
- batching: { instancing: true, maxInstanceCount: 5e3 },
804
- textures: {
805
- compression: "none",
806
- maxResolution: 4096,
807
- virtualTexturing: true,
808
- streaming: true,
809
- streamingBudget: 1024
810
- },
811
- adaptiveQuality: false,
812
- targetFrameRate: 120
813
- }
814
- };
815
- return { ...this.optimization, ...presets[quality] };
816
- }
817
- /**
818
- * Apply quality preset
819
- */
820
- applyQualityPreset(quality) {
821
- const preset = this.getPresetForQuality(quality);
822
- this.optimization = preset;
823
- }
824
- /**
825
- * Estimate GPU memory usage
826
- */
827
- estimateGPUMemory() {
828
- let textureMemory = 0;
829
- let vertexBuffers = 0;
830
- const maxRes = this.optimization.textures?.maxResolution || 2048;
831
- textureMemory = maxRes * maxRes * 4 / (1024 * 1024);
832
- const instanceCount = this.optimization.batching?.maxInstanceCount || 1e3;
833
- const verticesPerMesh = 1e4;
834
- vertexBuffers = verticesPerMesh * 36 * instanceCount / (1024 * 1024) * 0.1;
835
- return {
836
- textureMemory: Math.round(textureMemory),
837
- vertexBuffers: Math.max(1, Math.round(vertexBuffers)),
838
- // At least 1MB
839
- estimatedTotal: Math.round(textureMemory + Math.max(1, vertexBuffers))
840
- };
841
- }
842
- /**
843
- * Get rendering statistics/info
844
- */
845
- getInfo() {
846
- const tier = this.optimization.targetGPUTier;
847
- const lod = this.optimization.lodStrategy;
848
- const culling = this.optimization.culling?.mode;
849
- const instancing = this.optimization.batching?.instancing ? "yes" : "no";
850
- const memory = this.estimateGPUMemory();
851
- return `Rendering: tier=${tier} | LOD=${lod} | culling=${culling} | instancing=${instancing} | memory=${memory.estimatedTotal}MB`;
852
- }
853
- /**
854
- * Optimize for VR/AR (fixed timestep, fast culling)
855
- */
856
- optimizeForVRAR(targetFPS = 90) {
857
- this.optimization.fixedTimestep = 1 / targetFPS;
858
- this.optimization.targetFrameRate = targetFPS;
859
- this.setOcclusionCulling(true, 50);
860
- this.setInstancing(true, 5e3);
861
- this.setAdaptiveQuality(true, targetFPS);
862
- }
863
- /**
864
- * Optimize for mobile (lower resources)
865
- */
866
- optimizeForMobile() {
867
- this.applyQualityPreset("low");
868
- this.setTextureCompression("astc");
869
- this.setInstancing(true, 256);
870
- }
871
- /**
872
- * Optimize for desktop (higher resources)
873
- */
874
- optimizeForDesktop() {
875
- this.applyQualityPreset("ultra");
876
- this.setTextureCompression("none");
877
- this.setInstancing(true, 5e3);
878
- }
879
- /**
880
- * Dispose and cleanup
881
- */
882
- dispose() {
883
- }
884
- };
885
- function createRenderingTrait(config) {
886
- return new RenderingTrait(config);
887
- }
888
- var renderingHandler = {
889
- name: "rendering",
890
- defaultConfig: {},
891
- onAttach(node, config, ctx) {
892
- const instance = new RenderingTrait(config);
893
- node.__rendering_instance = instance;
894
- ctx.emit("rendering_attached", { node, config });
895
- },
896
- onDetach(node, _config, ctx) {
897
- const instance = node.__rendering_instance;
898
- if (instance) {
899
- if (typeof instance.onDetach === "function") instance.onDetach(node, ctx);
900
- else if (typeof instance.dispose === "function") instance.dispose();
901
- else if (typeof instance.cleanup === "function") instance.cleanup();
902
- }
903
- ctx.emit("rendering_detached", { node });
904
- delete node.__rendering_instance;
905
- },
906
- onEvent(node, _config, ctx, event) {
907
- const instance = node.__rendering_instance;
908
- if (!instance) return;
909
- if (typeof instance.onEvent === "function") instance.onEvent(event);
910
- else if (typeof instance.emit === "function" && event.type) instance.emit(event);
911
- if (event.type === "rendering_configure" && event.payload) {
912
- Object.assign(instance, event.payload);
913
- ctx.emit("rendering_configured", { node });
914
- }
915
- },
916
- onUpdate(node, _config, ctx, dt) {
917
- const instance = node.__rendering_instance;
918
- if (!instance) return;
919
- if (typeof instance.onUpdate === "function") instance.onUpdate(node, ctx, dt);
920
- }
921
- };
922
-
923
- // src/traits/ShaderTrait.ts
924
- var SHADER_CHUNKS = {
925
- /** Common noise functions */
926
- noise: `
927
- // Simplex 2D noise
928
- vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
929
- vec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
930
- vec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }
931
-
932
- float snoise(vec2 v) {
933
- const vec4 C = vec4(0.211324865405187, 0.366025403784439,
934
- -0.577350269189626, 0.024390243902439);
935
- vec2 i = floor(v + dot(v, C.yy));
936
- vec2 x0 = v - i + dot(i, C.xx);
937
- vec2 i1 = (x0[0] > x0[1]) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
938
- vec4 x12 = x0.xyxy + C.xxzz;
939
- x12.xy -= i1;
940
- i = mod289(i);
941
- vec3 p = permute(permute(i[1] + vec3(0.0, i1[1], 1.0)) + i[0] + vec3(0.0, i1[0], 1.0));
942
- vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
943
- m = m*m;
944
- m = m*m;
945
- vec3 x = 2.0 * fract(p * C.www) - 1.0;
946
- vec3 h = abs(x) - 0.5;
947
- vec3 ox = floor(x + 0.5);
948
- vec3 a0 = x - ox;
949
- m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
950
- vec3 g;
951
- g[0] = a0[0] * x0[0] + h[0] * x0[1];
952
- g.yz = a0.yz * x12.xz + h.yz * x12.yw;
953
- return 130.0 * dot(m, g);
954
- }
955
- `,
956
- /** Hologram effect */
957
- hologram: `
958
- // Hologram scanline effect
959
- float hologramScanline(vec2 uv, float time, float density) {
960
- return sin(uv[1] * density + time * 2.0) * 0.5 + 0.5;
961
- }
962
-
963
- // Hologram flicker
964
- float hologramFlicker(float time) {
965
- return 0.9 + 0.1 * sin(time * 20.0) * sin(time * 13.0);
966
- }
967
-
968
- // Hologram edge glow
969
- float hologramEdge(vec3 normal, vec3 viewDir) {
970
- return pow(1.0 - abs(dot(normal, viewDir)), 2.0);
971
- }
972
- `,
973
- /** Fresnel effect */
974
- fresnel: `
975
- // Basic Fresnel
976
- float fresnel(vec3 normal, vec3 viewDir, float power) {
977
- return pow(1.0 - abs(dot(normal, viewDir)), power);
978
- }
979
-
980
- // Schlick's approximation
981
- float fresnelSchlick(float cosTheta, float F0) {
982
- return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
983
- }
984
- `,
985
- /** PBR lighting */
986
- pbr: `
987
- // Distribution function (GGX/Trowbridge-Reitz)
988
- float distributionGGX(vec3 N, vec3 H, float roughness) {
989
- float a = roughness * roughness;
990
- float a2 = a * a;
991
- float NdotH = max(dot(N, H), 0.0);
992
- float NdotH2 = NdotH * NdotH;
993
- float num = a2;
994
- float denom = (NdotH2 * (a2 - 1.0) + 1.0);
995
- denom = 3.14159265 * denom * denom;
996
- return num / denom;
997
- }
998
-
999
- // Geometry function (Schlick-GGX)
1000
- float geometrySchlickGGX(float NdotV, float roughness) {
1001
- float r = (roughness + 1.0);
1002
- float k = (r * r) / 8.0;
1003
- float num = NdotV;
1004
- float denom = NdotV * (1.0 - k) + k;
1005
- return num / denom;
1006
- }
1007
-
1008
- // Smith's geometry function
1009
- float geometrySmith(vec3 N, vec3 V, vec3 L, float roughness) {
1010
- float NdotV = max(dot(N, V), 0.0);
1011
- float NdotL = max(dot(N, L), 0.0);
1012
- float ggx2 = geometrySchlickGGX(NdotV, roughness);
1013
- float ggx1 = geometrySchlickGGX(NdotL, roughness);
1014
- return ggx1 * ggx2;
1015
- }
1016
- `,
1017
- /** UV utilities */
1018
- uv: `
1019
- // Rotate UV
1020
- vec2 rotateUV(vec2 uv, float angle) {
1021
- float c = cos(angle);
1022
- float s = sin(angle);
1023
- return vec2(c * uv[0] - s * uv[1], s * uv[0] + c * uv[1]);
1024
- }
1025
-
1026
- // Tile UV
1027
- vec2 tileUV(vec2 uv, vec2 scale) {
1028
- return fract(uv * scale);
1029
- }
1030
-
1031
- // Parallax mapping
1032
- vec2 parallaxUV(vec2 uv, vec3 viewDir, sampler2D heightMap, float scale) {
1033
- float height = texture2D(heightMap, uv).r;
1034
- vec2 p = viewDir.xy / viewDir[2] * (height * scale);
1035
- return uv - p;
1036
- }
1037
- `
1038
- };
1039
- var ShaderTrait = class {
1040
- constructor(config) {
1041
- this.uniformValues = /* @__PURE__ */ new Map();
1042
- this.config = {
1043
- ...config,
1044
- source: {
1045
- language: config.source?.language || "glsl",
1046
- vertex: config.source?.vertex || "",
1047
- fragment: config.source?.fragment || "",
1048
- geometry: config.source?.geometry,
1049
- tessellationControl: config.source?.tessellationControl,
1050
- tessellationEvaluation: config.source?.tessellationEvaluation,
1051
- compute: config.source?.compute
1052
- }
1053
- };
1054
- if (config.uniforms) {
1055
- for (const [name, uniform] of Object.entries(config.uniforms)) {
1056
- this.uniformValues.set(name, uniform.value);
1057
- }
1058
- }
1059
- }
1060
- /**
1061
- * Get shader configuration
1062
- */
1063
- getConfig() {
1064
- return { ...this.config };
1065
- }
1066
- /**
1067
- * Get vertex shader source with includes
1068
- */
1069
- getVertexSource() {
1070
- return this.assembleShaderSource("vertex");
1071
- }
1072
- /**
1073
- * Get fragment shader source with includes
1074
- */
1075
- getFragmentSource() {
1076
- return this.assembleShaderSource("fragment");
1077
- }
1078
- /**
1079
- * Assemble shader source with includes and uniforms
1080
- */
1081
- assembleShaderSource(stage) {
1082
- const source = this.config.source ? this.config.source[stage] : void 0;
1083
- if (!source) return "";
1084
- let assembled = "";
1085
- if (this.config.source?.language === "glsl") {
1086
- assembled += "precision highp float;\n\n";
1087
- }
1088
- if (this.config.uniforms) {
1089
- for (const [name, uniform] of Object.entries(this.config.uniforms)) {
1090
- assembled += `uniform ${this.getGLSLType(uniform.type)} ${name};
1091
- `;
1092
- }
1093
- assembled += "\n";
1094
- }
1095
- if (this.config.includes) {
1096
- for (const include of this.config.includes) {
1097
- const chunk = SHADER_CHUNKS[include.path];
1098
- if (chunk) {
1099
- assembled += `// Include: ${include.path}
1100
- ${chunk}
1101
- `;
1102
- }
1103
- }
1104
- }
1105
- assembled += source;
1106
- return assembled;
1107
- }
1108
- /**
1109
- * Convert uniform type to GLSL type
1110
- */
1111
- getGLSLType(type) {
1112
- const typeMap = {
1113
- float: "float",
1114
- int: "int",
1115
- bool: "bool",
1116
- vec2: "vec2",
1117
- vec3: "vec3",
1118
- vec4: "vec4",
1119
- mat2: "mat2",
1120
- mat3: "mat3",
1121
- mat4: "mat4",
1122
- sampler2D: "sampler2D",
1123
- samplerCube: "samplerCube"
1124
- };
1125
- return typeMap[type] || "float";
1126
- }
1127
- /**
1128
- * Set uniform value
1129
- */
1130
- setUniform(name, value) {
1131
- this.uniformValues.set(name, value);
1132
- }
1133
- /**
1134
- * Get uniform value
1135
- */
1136
- getUniform(name) {
1137
- return this.uniformValues.get(name);
1138
- }
1139
- /**
1140
- * Get all uniform values
1141
- */
1142
- getUniforms() {
1143
- return new Map(this.uniformValues);
1144
- }
1145
- /**
1146
- * Validate shader syntax
1147
- */
1148
- validate() {
1149
- const errors = [];
1150
- const warnings = [];
1151
- if (this.config.source?.vertex) {
1152
- const vertexErrors = this.validateShaderSyntax(this.config.source.vertex, "vertex");
1153
- errors.push(...vertexErrors);
1154
- }
1155
- if (this.config.source?.fragment) {
1156
- const fragmentErrors = this.validateShaderSyntax(this.config.source.fragment, "fragment");
1157
- errors.push(...fragmentErrors);
1158
- }
1159
- if (this.config.source?.vertex && !this.config.source.vertex.includes("void main")) {
1160
- errors.push({
1161
- stage: "vertex",
1162
- line: 1,
1163
- message: "Vertex shader must contain a main() function",
1164
- code: "E001"
1165
- });
1166
- }
1167
- if (this.config.source?.fragment && !this.config.source.fragment.includes("void main")) {
1168
- errors.push({
1169
- stage: "fragment",
1170
- line: 1,
1171
- message: "Fragment shader must contain a main() function",
1172
- code: "E002"
1173
- });
1174
- }
1175
- this.compilationResult = {
1176
- success: errors.length === 0,
1177
- errors,
1178
- warnings
1179
- };
1180
- return this.compilationResult;
1181
- }
1182
- /**
1183
- * Basic shader syntax validation
1184
- */
1185
- validateShaderSyntax(source, stage) {
1186
- const errors = [];
1187
- const lines = source.split("\n");
1188
- let braceCount = 0;
1189
- for (let i = 0; i < lines.length; i++) {
1190
- const line = lines[i];
1191
- braceCount += (line.match(/{/g) || []).length;
1192
- braceCount -= (line.match(/}/g) || []).length;
1193
- }
1194
- if (braceCount !== 0) {
1195
- errors.push({
1196
- stage,
1197
- line: lines.length,
1198
- message: `Unbalanced braces in ${stage} shader`,
1199
- code: "E003"
1200
- });
1201
- }
1202
- let parenCount = 0;
1203
- for (let i = 0; i < lines.length; i++) {
1204
- const line = lines[i];
1205
- parenCount += (line.match(/\(/g) || []).length;
1206
- parenCount -= (line.match(/\)/g) || []).length;
1207
- }
1208
- if (parenCount !== 0) {
1209
- errors.push({
1210
- stage,
1211
- line: lines.length,
1212
- message: `Unbalanced parentheses in ${stage} shader`,
1213
- code: "E004"
1214
- });
1215
- }
1216
- return errors;
1217
- }
1218
- /**
1219
- * Compile shader to target platform
1220
- */
1221
- compile(options) {
1222
- const validation = this.validate();
1223
- if (!validation.success) {
1224
- return validation;
1225
- }
1226
- let vertexSource = this.getVertexSource();
1227
- let fragmentSource = this.getFragmentSource();
1228
- if (options?.defines) {
1229
- for (const [key, value] of Object.entries(options.defines)) {
1230
- const define = `#define ${key} ${value}
1231
- `;
1232
- vertexSource = define + vertexSource;
1233
- fragmentSource = define + fragmentSource;
1234
- }
1235
- }
1236
- return {
1237
- success: true,
1238
- errors: [],
1239
- warnings: [],
1240
- compiledCode: {
1241
- vertex: vertexSource,
1242
- fragment: fragmentSource
1243
- }
1244
- };
1245
- }
1246
- /**
1247
- * Create Three.js ShaderMaterial config
1248
- */
1249
- toThreeJSConfig() {
1250
- const uniformsObj = {};
1251
- for (const [name, value] of this.uniformValues) {
1252
- uniformsObj[name] = { value };
1253
- }
1254
- return {
1255
- vertexShader: this.getVertexSource(),
1256
- fragmentShader: this.getFragmentSource(),
1257
- uniforms: uniformsObj,
1258
- transparent: this.config.blendMode !== "opaque",
1259
- depthTest: this.config.depthTest ?? true,
1260
- depthWrite: this.config.depthWrite ?? true,
1261
- side: this.getCullSide()
1262
- };
1263
- }
1264
- getCullSide() {
1265
- const THREE_FrontSide = 0;
1266
- const THREE_BackSide = 1;
1267
- const THREE_DoubleSide = 2;
1268
- switch (this.config.cullFace) {
1269
- case "front":
1270
- return THREE_BackSide;
1271
- case "back":
1272
- return THREE_FrontSide;
1273
- case "none":
1274
- return THREE_DoubleSide;
1275
- default:
1276
- return THREE_FrontSide;
1277
- }
1278
- }
1279
- };
1280
- var SHADER_PRESETS = {
1281
- /** Hologram effect shader */
1282
- hologram: {
1283
- name: "hologram",
1284
- source: {
1285
- language: "glsl",
1286
- vertex: `
1287
- varying vec2 vUv;
1288
- varying vec3 vNormal;
1289
- varying vec3 vViewPosition;
1290
-
1291
- void main() {
1292
- vUv = uv;
1293
- vNormal = normalize(normalMatrix * normal);
1294
- vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
1295
- vViewPosition = -mvPosition.xyz;
1296
- gl_Position = projectionMatrix * mvPosition;
1297
- }
1298
- `,
1299
- fragment: `
1300
- uniform float time;
1301
- uniform vec3 color;
1302
- uniform float opacity;
1303
- uniform float scanlineIntensity;
1304
- uniform float flickerIntensity;
1305
-
1306
- varying vec2 vUv;
1307
- varying vec3 vNormal;
1308
- varying vec3 vViewPosition;
1309
-
1310
- void main() {
1311
- // Fresnel edge glow
1312
- vec3 viewDir = normalize(vViewPosition);
1313
- float fresnel = pow(1.0 - abs(dot(vNormal, viewDir)), 2.0);
1314
-
1315
- // Scanlines
1316
- float scanline = sin(vUv[1] * 100.0 + time * 2.0) * scanlineIntensity;
1317
-
1318
- // Flicker
1319
- float flicker = 0.9 + flickerIntensity * sin(time * 20.0) * sin(time * 13.0);
1320
-
1321
- // Combine
1322
- float alpha = (opacity + fresnel * 0.3 + scanline) * flicker;
1323
- vec3 finalColor = color + fresnel * 0.5;
1324
-
1325
- gl_FragColor = vec4(finalColor, alpha);
1326
- }
1327
- `
1328
- },
1329
- uniforms: {
1330
- time: { type: "float", value: 0 },
1331
- color: { type: "vec3", value: [0, 1, 1] },
1332
- opacity: { type: "float", value: 0.5, min: 0, max: 1 },
1333
- scanlineIntensity: { type: "float", value: 0.1, min: 0, max: 0.5 },
1334
- flickerIntensity: { type: "float", value: 0.1, min: 0, max: 0.3 }
1335
- },
1336
- blendMode: "blend",
1337
- depthWrite: false,
1338
- cullFace: "none"
1339
- },
1340
- /** Force field shader */
1341
- forceField: {
1342
- name: "forceField",
1343
- source: {
1344
- language: "glsl",
1345
- vertex: `
1346
- varying vec2 vUv;
1347
- varying vec3 vNormal;
1348
- varying vec3 vWorldPosition;
1349
-
1350
- void main() {
1351
- vUv = uv;
1352
- vNormal = normalize(normalMatrix * normal);
1353
- vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
1354
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1355
- }
1356
- `,
1357
- fragment: `
1358
- uniform float time;
1359
- uniform vec3 color;
1360
- uniform float pulseSpeed;
1361
- uniform float hexScale;
1362
-
1363
- varying vec2 vUv;
1364
- varying vec3 vNormal;
1365
- varying vec3 vWorldPosition;
1366
-
1367
- float hexPattern(vec2 p) {
1368
- vec2 q = vec2(p[0] * 2.0 * 0.5773503, p[1] + p[0] * 0.5773503);
1369
- vec2 pi = floor(q);
1370
- vec2 pf = fract(q);
1371
- float v = mod(pi[0] + pi[1], 3.0);
1372
- float ca = step(1.0, v);
1373
- float cb = step(2.0, v);
1374
- vec2 ma = step(pf.xy, pf.yx);
1375
- float e = dot(ma, 1.0 - pf.yx + ca * (pf[0] + pf[1] - 1.0) + cb * (pf.yx - 2.0 * pf.xy));
1376
- return e;
1377
- }
1378
-
1379
- void main() {
1380
- float hex = hexPattern(vUv * hexScale);
1381
- float pulse = sin(time * pulseSpeed) * 0.5 + 0.5;
1382
- float alpha = hex * (0.3 + pulse * 0.2);
1383
- gl_FragColor = vec4(color, alpha);
1384
- }
1385
- `
1386
- },
1387
- uniforms: {
1388
- time: { type: "float", value: 0 },
1389
- color: { type: "vec3", value: [0.2, 0.5, 1] },
1390
- pulseSpeed: { type: "float", value: 2, min: 0.5, max: 5 },
1391
- hexScale: { type: "float", value: 10, min: 5, max: 50 }
1392
- },
1393
- blendMode: "additive",
1394
- depthWrite: false,
1395
- cullFace: "none"
1396
- },
1397
- /** Dissolve effect shader */
1398
- dissolve: {
1399
- name: "dissolve",
1400
- source: {
1401
- language: "glsl",
1402
- vertex: `
1403
- varying vec2 vUv;
1404
- varying vec3 vPosition;
1405
-
1406
- void main() {
1407
- vUv = uv;
1408
- vPosition = position;
1409
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1410
- }
1411
- `,
1412
- fragment: `
1413
- uniform float progress;
1414
- uniform vec3 edgeColor;
1415
- uniform float edgeWidth;
1416
- uniform sampler2D noiseTexture;
1417
-
1418
- varying vec2 vUv;
1419
- varying vec3 vPosition;
1420
-
1421
- void main() {
1422
- float noise = texture2D(noiseTexture, vUv).r;
1423
- float diff = noise - progress;
1424
-
1425
- if (diff < 0.0) discard;
1426
-
1427
- float edge = smoothstep(0.0, edgeWidth, diff);
1428
- vec3 color = mix(edgeColor, vec3(1.0), edge);
1429
-
1430
- gl_FragColor = vec4(color, 1.0);
1431
- }
1432
- `
1433
- },
1434
- uniforms: {
1435
- progress: { type: "float", value: 0, min: 0, max: 1 },
1436
- edgeColor: { type: "vec3", value: [1, 0.5, 0] },
1437
- edgeWidth: { type: "float", value: 0.1, min: 0.01, max: 0.5 },
1438
- noiseTexture: { type: "sampler2D", value: "" }
1439
- },
1440
- blendMode: "opaque"
1441
- }
1442
- };
1443
- function createShaderTrait(config) {
1444
- return new ShaderTrait({
1445
- name: "custom",
1446
- source: {
1447
- language: "glsl",
1448
- vertex: "",
1449
- fragment: ""
1450
- },
1451
- uniforms: {},
1452
- blendMode: "opaque",
1453
- ...config
1454
- });
1455
- }
1456
- var shaderHandler = {
1457
- name: "shader",
1458
- defaultConfig: {},
1459
- onAttach(node, config, ctx) {
1460
- const instance = new ShaderTrait(config);
1461
- node.__shader_instance = instance;
1462
- ctx.emit("shader_attached", { node, config });
1463
- },
1464
- onDetach(node, _config, ctx) {
1465
- const instance = node.__shader_instance;
1466
- if (instance) {
1467
- if (typeof instance.onDetach === "function") instance.onDetach(node, ctx);
1468
- else if (typeof instance.dispose === "function") instance.dispose();
1469
- else if (typeof instance.cleanup === "function") instance.cleanup();
1470
- }
1471
- ctx.emit("shader_detached", { node });
1472
- delete node.__shader_instance;
1473
- },
1474
- onEvent(node, _config, ctx, event) {
1475
- const instance = node.__shader_instance;
1476
- if (!instance) return;
1477
- if (typeof instance.onEvent === "function") instance.onEvent(event);
1478
- else if (typeof instance.emit === "function" && event.type) instance.emit(event);
1479
- if (event.type === "shader_configure" && event.payload) {
1480
- Object.assign(instance, event.payload);
1481
- ctx.emit("shader_configured", { node });
1482
- }
1483
- },
1484
- onUpdate(node, _config, ctx, dt) {
1485
- const instance = node.__shader_instance;
1486
- if (!instance) return;
1487
- if (typeof instance.onUpdate === "function") instance.onUpdate(node, ctx, dt);
1488
- }
1489
- };
1490
-
1491
- exports.LIGHTING_PRESETS = LIGHTING_PRESETS;
1492
- exports.LightingTrait = LightingTrait;
1493
- exports.MATERIAL_PRESETS = MATERIAL_PRESETS;
1494
- exports.MaterialTrait = MaterialTrait;
1495
- exports.RenderingTrait = RenderingTrait;
1496
- exports.SHADER_CHUNKS = SHADER_CHUNKS;
1497
- exports.SHADER_PRESETS = SHADER_PRESETS;
1498
- exports.ShaderTrait = ShaderTrait;
1499
- exports.createLightingTrait = createLightingTrait;
1500
- exports.createMaterialTrait = createMaterialTrait;
1501
- exports.createRenderingTrait = createRenderingTrait;
1502
- exports.createShaderTrait = createShaderTrait;
1503
- exports.lightingHandler = lightingHandler;
1504
- exports.materialHandler = materialHandler;
1505
- exports.renderingHandler = renderingHandler;
1506
- exports.shaderHandler = shaderHandler;
1507
- //# sourceMappingURL=chunk-KQU64CIX.cjs.map
1508
- //# sourceMappingURL=chunk-KQU64CIX.cjs.map