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