@holoscript/core 6.0.3 → 7.0.0

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 (244) hide show
  1. package/README.md +40 -40
  2. package/dist/codebase/index.d.ts +25 -0
  3. package/dist/compiler/index.d.ts +82 -0
  4. package/dist/constants.d.ts +4 -0
  5. package/dist/coordinators/index.d.ts +189 -0
  6. package/dist/entries/interop.d.ts +9 -0
  7. package/dist/entries/scripting.d.ts +7 -0
  8. package/dist/index.d.ts +520 -19
  9. package/dist/paper-0c-spike/index.d.ts +29 -0
  10. package/dist/reconstruction/index.d.ts +78 -0
  11. package/dist/self-improvement/index.d.ts +0 -48
  12. package/dist/storage/index.d.ts +24 -0
  13. package/dist/tools/index.d.ts +33 -0
  14. package/dist/traitDocs/traitDocs.d.ts +69 -0
  15. package/dist/traits/index.d.ts +61 -0
  16. package/package.json +102 -19
  17. package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
  18. package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
  19. package/dist/HoloScriptPlusParser-BZR5DELQ.js +0 -692
  20. package/dist/HoloScriptPlusParser-SBMYDNXO.cjs +0 -697
  21. package/dist/USDZExporter-MHEHXZB4.cjs +0 -709
  22. package/dist/USDZExporter-YA55ZS35.js +0 -707
  23. package/dist/chunk-26TLYBFD.js +0 -309
  24. package/dist/chunk-27LWW5FU.cjs +0 -410
  25. package/dist/chunk-2UX5LRAP.cjs +0 -833
  26. package/dist/chunk-32TWR3HE.js +0 -70
  27. package/dist/chunk-3FXV5S25.cjs +0 -633
  28. package/dist/chunk-3FYZOR7S.cjs +0 -69
  29. package/dist/chunk-3KEU5QYY.cjs +0 -175
  30. package/dist/chunk-4FCZDTD5.js +0 -610
  31. package/dist/chunk-4KJ2R7VP.cjs +0 -507
  32. package/dist/chunk-4SMUJFHL.js +0 -1213
  33. package/dist/chunk-54FHG2MX.js +0 -655
  34. package/dist/chunk-56IF4NTA.js +0 -56
  35. package/dist/chunk-5GLCTO44.js +0 -161
  36. package/dist/chunk-5TOFIR6L.js +0 -407
  37. package/dist/chunk-65RFOWZI.js +0 -765
  38. package/dist/chunk-6OQBLABR.js +0 -5240
  39. package/dist/chunk-6WNCRE6F.js +0 -126
  40. package/dist/chunk-74YCHHTE.js +0 -1872
  41. package/dist/chunk-7H5UNJZD.cjs +0 -1973
  42. package/dist/chunk-7KPI4EKH.cjs +0 -701
  43. package/dist/chunk-7LCYLPW2.cjs +0 -663
  44. package/dist/chunk-7N3JIJMT.js +0 -1395
  45. package/dist/chunk-7X2IEJIE.cjs +0 -2526
  46. package/dist/chunk-A6GO3DPZ.cjs +0 -1002
  47. package/dist/chunk-AC4BSHFV.js +0 -765
  48. package/dist/chunk-AIUXRS74.cjs +0 -3681
  49. package/dist/chunk-ARNKA274.cjs +0 -130
  50. package/dist/chunk-AW7WAELW.js +0 -975
  51. package/dist/chunk-BKIGPPVM.js +0 -629
  52. package/dist/chunk-BO2OKHIY.js +0 -6055
  53. package/dist/chunk-BU5ZAFMC.js +0 -115
  54. package/dist/chunk-BY3B7ZYV.cjs +0 -457
  55. package/dist/chunk-C2QHVHZF.js +0 -4066
  56. package/dist/chunk-C7BNX4XJ.js +0 -1043
  57. package/dist/chunk-CLYEIWA5.cjs +0 -408
  58. package/dist/chunk-CMYAWUX3.js +0 -4455
  59. package/dist/chunk-CN4NOESF.cjs +0 -416
  60. package/dist/chunk-CNVM7J3M.js +0 -883
  61. package/dist/chunk-CO2VM2DK.js +0 -1965
  62. package/dist/chunk-CQDOF3G7.cjs +0 -1404
  63. package/dist/chunk-DH5G2JUA.cjs +0 -614
  64. package/dist/chunk-DIEDKX5B.cjs +0 -660
  65. package/dist/chunk-DN7UFU63.cjs +0 -172
  66. package/dist/chunk-DXVCEFZB.js +0 -2027
  67. package/dist/chunk-EGIZHYJP.cjs +0 -85
  68. package/dist/chunk-EJA7G2C4.cjs +0 -428
  69. package/dist/chunk-ELLQPFAF.js +0 -830
  70. package/dist/chunk-EMO7HAKJ.cjs +0 -1875
  71. package/dist/chunk-ENV7K6XA.js +0 -282
  72. package/dist/chunk-EPWRXL6S.js +0 -2522
  73. package/dist/chunk-EUFLX2PI.js +0 -56956
  74. package/dist/chunk-F5LVGHNT.js +0 -449
  75. package/dist/chunk-FEFHPUEM.cjs +0 -6122
  76. package/dist/chunk-FF3Q7ADR.js +0 -380
  77. package/dist/chunk-GC3YU46J.js +0 -762
  78. package/dist/chunk-H6WMMLQK.cjs +0 -4492
  79. package/dist/chunk-H7XMORZI.js +0 -2731
  80. package/dist/chunk-HAN4V3PF.cjs +0 -2037
  81. package/dist/chunk-HBZYCASG.js +0 -4208
  82. package/dist/chunk-HF4OFY25.cjs +0 -4097
  83. package/dist/chunk-HHS6FMOU.cjs +0 -3813
  84. package/dist/chunk-HJJLD366.js +0 -1169
  85. package/dist/chunk-HKCVM6OK.cjs +0 -2237
  86. package/dist/chunk-HUFNKFA6.js +0 -698
  87. package/dist/chunk-I3XGTIHM.cjs +0 -1505
  88. package/dist/chunk-I6XZ5DZF.cjs +0 -488
  89. package/dist/chunk-IHOUYQIA.js +0 -406
  90. package/dist/chunk-ILRBGFVD.cjs +0 -72
  91. package/dist/chunk-KDB6BUMB.js +0 -3666
  92. package/dist/chunk-KUJRR4FJ.js +0 -657
  93. package/dist/chunk-KYM4XRFG.js +0 -421
  94. package/dist/chunk-L3Z2HIWJ.cjs +0 -793
  95. package/dist/chunk-LBPEZQAF.js +0 -2232
  96. package/dist/chunk-LER4WXW5.cjs +0 -286
  97. package/dist/chunk-LK5IAVH6.cjs +0 -1173
  98. package/dist/chunk-M6FU6S22.js +0 -2911
  99. package/dist/chunk-MWEFR6YQ.js +0 -1857
  100. package/dist/chunk-N5FTS757.cjs +0 -415
  101. package/dist/chunk-NCUHGRTZ.js +0 -752
  102. package/dist/chunk-NKRKT6V2.js +0 -69
  103. package/dist/chunk-NLPSZT4C.js +0 -630
  104. package/dist/chunk-NRUB55IT.cjs +0 -771
  105. package/dist/chunk-NTMZSDXM.cjs +0 -633
  106. package/dist/chunk-ODGMVILH.js +0 -9662
  107. package/dist/chunk-PBA6NXCT.cjs +0 -1216
  108. package/dist/chunk-PHENW4MQ.js +0 -65
  109. package/dist/chunk-PJMOXFPR.cjs +0 -1861
  110. package/dist/chunk-PLMYCCA4.js +0 -504
  111. package/dist/chunk-PPULB4GG.cjs +0 -9728
  112. package/dist/chunk-PQLGZKMC.cjs +0 -755
  113. package/dist/chunk-Q56TT7IL.js +0 -483
  114. package/dist/chunk-QHVVVN47.cjs +0 -2033
  115. package/dist/chunk-QWKUKVRE.js +0 -2026
  116. package/dist/chunk-RE3OKSYF.cjs +0 -424
  117. package/dist/chunk-RT7LJRSF.cjs +0 -57378
  118. package/dist/chunk-SPDELRRV.cjs +0 -319
  119. package/dist/chunk-SUCBB66F.js +0 -229
  120. package/dist/chunk-TSWTWZ42.cjs +0 -4214
  121. package/dist/chunk-UITWA6DV.cjs +0 -2829
  122. package/dist/chunk-UQW6SLM5.js +0 -172
  123. package/dist/chunk-V2ILLPHK.cjs +0 -237
  124. package/dist/chunk-V42NTCFH.js +0 -3645
  125. package/dist/chunk-VJ3L7CHT.cjs +0 -169
  126. package/dist/chunk-VJVCD5T5.cjs +0 -769
  127. package/dist/chunk-VK5AXKO3.js +0 -746
  128. package/dist/chunk-VSXOIUCF.cjs +0 -473
  129. package/dist/chunk-VZNKJZTT.cjs +0 -749
  130. package/dist/chunk-W76ETJTI.js +0 -678
  131. package/dist/chunk-WFJIDI2N.cjs +0 -424
  132. package/dist/chunk-WN3YF33G.cjs +0 -118
  133. package/dist/chunk-WUXIRGZP.cjs +0 -2915
  134. package/dist/chunk-WYH4GVZ5.js +0 -1488
  135. package/dist/chunk-X4YVN7H3.cjs +0 -888
  136. package/dist/chunk-X67XRI2T.js +0 -410
  137. package/dist/chunk-XDXZM3ZP.cjs +0 -1046
  138. package/dist/chunk-XH7SE4HH.cjs +0 -72
  139. package/dist/chunk-XNMEH2BI.js +0 -126
  140. package/dist/chunk-XSF76QRU.js +0 -468
  141. package/dist/chunk-XSUZMPVQ.cjs +0 -682
  142. package/dist/chunk-XUILI4KB.cjs +0 -430
  143. package/dist/chunk-Y5MUAYTO.js +0 -167
  144. package/dist/chunk-Y7VK5TH3.cjs +0 -129
  145. package/dist/chunk-YCMQQQ5U.cjs +0 -5244
  146. package/dist/chunk-YYXH45E2.js +0 -426
  147. package/dist/chunk-ZGTGVSTZ.js +0 -422
  148. package/dist/chunk-ZL6VJ6SN.js +0 -421
  149. package/dist/cli/holoscript-runner.cjs +0 -2258
  150. package/dist/cli/holoscript-runner.js +0 -2233
  151. package/dist/codebase/index.cjs +0 -336
  152. package/dist/codebase/index.js +0 -331
  153. package/dist/compiler/agent-inference.cjs +0 -29
  154. package/dist/compiler/agent-inference.js +0 -6
  155. package/dist/compiler/android-xr.cjs +0 -20
  156. package/dist/compiler/android-xr.js +0 -10
  157. package/dist/compiler/android.cjs +0 -21
  158. package/dist/compiler/android.js +0 -11
  159. package/dist/compiler/ar.cjs +0 -21
  160. package/dist/compiler/ar.js +0 -9
  161. package/dist/compiler/babylon.cjs +0 -18
  162. package/dist/compiler/babylon.js +0 -12
  163. package/dist/compiler/coco.cjs +0 -27
  164. package/dist/compiler/coco.js +0 -4
  165. package/dist/compiler/domain-block-utils.cjs +0 -595
  166. package/dist/compiler/domain-block-utils.js +0 -9
  167. package/dist/compiler/dtdl.cjs +0 -25
  168. package/dist/compiler/dtdl.js +0 -9
  169. package/dist/compiler/gltf-pipeline.cjs +0 -39
  170. package/dist/compiler/gltf-pipeline.js +0 -4
  171. package/dist/compiler/godot.cjs +0 -16
  172. package/dist/compiler/godot.js +0 -10
  173. package/dist/compiler/incremental.cjs +0 -30
  174. package/dist/compiler/incremental.js +0 -5
  175. package/dist/compiler/index.cjs +0 -1522
  176. package/dist/compiler/index.js +0 -1321
  177. package/dist/compiler/ios.cjs +0 -21
  178. package/dist/compiler/ios.js +0 -11
  179. package/dist/compiler/multi-layer.cjs +0 -27
  180. package/dist/compiler/multi-layer.js +0 -12
  181. package/dist/compiler/nodetoy.cjs +0 -23
  182. package/dist/compiler/nodetoy.js +0 -4
  183. package/dist/compiler/openxr.cjs +0 -16
  184. package/dist/compiler/openxr.js +0 -10
  185. package/dist/compiler/playcanvas.cjs +0 -17
  186. package/dist/compiler/playcanvas.js +0 -11
  187. package/dist/compiler/r3f.cjs +0 -35
  188. package/dist/compiler/r3f.js +0 -13
  189. package/dist/compiler/remotion.cjs +0 -23
  190. package/dist/compiler/remotion.js +0 -4
  191. package/dist/compiler/reproducibility.cjs +0 -39
  192. package/dist/compiler/reproducibility.js +0 -4
  193. package/dist/compiler/sdf.cjs +0 -22
  194. package/dist/compiler/sdf.js +0 -10
  195. package/dist/compiler/semantic-scene.cjs +0 -31
  196. package/dist/compiler/semantic-scene.js +0 -4
  197. package/dist/compiler/state.cjs +0 -18
  198. package/dist/compiler/state.js +0 -8
  199. package/dist/compiler/trait-composition.cjs +0 -27
  200. package/dist/compiler/trait-composition.js +0 -6
  201. package/dist/compiler/unity.cjs +0 -16
  202. package/dist/compiler/unity.js +0 -10
  203. package/dist/compiler/unreal.cjs +0 -20
  204. package/dist/compiler/unreal.js +0 -10
  205. package/dist/compiler/urdf.cjs +0 -46
  206. package/dist/compiler/urdf.js +0 -10
  207. package/dist/compiler/usd-physics.cjs +0 -24
  208. package/dist/compiler/usd-physics.js +0 -7
  209. package/dist/compiler/visionos.cjs +0 -16
  210. package/dist/compiler/visionos.js +0 -10
  211. package/dist/compiler/vrchat.cjs +0 -20
  212. package/dist/compiler/vrchat.js +0 -10
  213. package/dist/compiler/vrr.cjs +0 -22
  214. package/dist/compiler/vrr.js +0 -10
  215. package/dist/compiler/wasm.cjs +0 -34
  216. package/dist/compiler/wasm.js +0 -10
  217. package/dist/compiler/webgpu.cjs +0 -16
  218. package/dist/compiler/webgpu.js +0 -10
  219. package/dist/debugger.cjs +0 -21
  220. package/dist/debugger.js +0 -8
  221. package/dist/entries/interop.cjs +0 -62
  222. package/dist/entries/interop.js +0 -5
  223. package/dist/entries/scripting.cjs +0 -67
  224. package/dist/entries/scripting.js +0 -10
  225. package/dist/index.cjs +0 -61703
  226. package/dist/index.js +0 -58652
  227. package/dist/math/vec3.cjs +0 -57
  228. package/dist/math/vec3.js +0 -4
  229. package/dist/parser.cjs +0 -26
  230. package/dist/parser.js +0 -9
  231. package/dist/playwright-7DTEQCBD.cjs +0 -98673
  232. package/dist/playwright-BIZXMLD2.js +0 -98660
  233. package/dist/post-quantum-JTTAAGO3.cjs +0 -6
  234. package/dist/post-quantum-RVPVDEPI.js +0 -4
  235. package/dist/runtime.cjs +0 -16
  236. package/dist/runtime.js +0 -7
  237. package/dist/storage/index.cjs +0 -37
  238. package/dist/storage/index.js +0 -4
  239. package/dist/traits/index.cjs +0 -14331
  240. package/dist/traits/index.js +0 -12126
  241. package/dist/type-checker.cjs +0 -18
  242. package/dist/type-checker.js +0 -5
  243. package/dist/wot/index.cjs +0 -29
  244. package/dist/wot/index.js +0 -4
@@ -1,630 +0,0 @@
1
- import { init_DomainBlockCompilerMixin, compileDomainBlocks, inputToGodot, compileInputBlock, navigationToGodot, compileNavigationBlock, renderingToGodot, compileRenderingBlock, proceduralToGodot, compileProceduralBlock, web3ToGodot, compileWeb3Block, architectureToGodot, compileArchitectureBlock, musicToGodot, compileMusicBlock, educationToGodot, compileEducationBlock, datavizToGodot, compileDataVizBlock, iotToGodot, compileIoTBlock, compileRoboticsBlock, roboticsToGodot, compileHealthcareBlock, healthcareToGodot, compilePaymentBlock, paymentToGodot, compileNarrativeBlock, narrativeToGodot, compileWeatherBlock, weatherToGodot, compileAudioSourceBlock, audioSourceToGodot, compilePostProcessingBlock, postProcessingToGodot, compileParticleBlock, particlesToGodot, compilePhysicsBlock, physicsToGodot, compileMaterialBlock, materialToGodot } from './chunk-KDB6BUMB.js';
2
- import { init_CompilerBase, init_ANSNamespace, CompilerBase, ANSCapabilityPath } from './chunk-QWKUKVRE.js';
3
- import { __export, __esm } from './chunk-32TWR3HE.js';
4
-
5
- // src/compiler/GodotCompiler.ts
6
- var GodotCompiler_exports = {};
7
- __export(GodotCompiler_exports, {
8
- GodotCompiler: () => GodotCompiler
9
- });
10
- var GodotCompiler;
11
- var init_GodotCompiler = __esm({
12
- "src/compiler/GodotCompiler.ts"() {
13
- init_CompilerBase();
14
- init_ANSNamespace();
15
- init_DomainBlockCompilerMixin();
16
- GodotCompiler = class extends CompilerBase {
17
- constructor(options = {}) {
18
- super();
19
- this.compilerName = "GodotCompiler";
20
- this.lines = [];
21
- this.indentLevel = 0;
22
- this.options = {
23
- className: options.className || "GeneratedScene",
24
- indent: options.indent || " ",
25
- godotVersion: options.godotVersion || "4.3"
26
- };
27
- }
28
- getRequiredCapability() {
29
- return ANSCapabilityPath.GODOT;
30
- }
31
- compile(composition, agentToken, outputPath) {
32
- this.validateCompilerAccess(agentToken, outputPath);
33
- this.lines = [];
34
- this.indentLevel = 0;
35
- this.emit(`# Auto-generated by HoloScript GodotCompiler`);
36
- this.emit(
37
- `# Source: composition "${this.escapeStringValue(composition.name, "GDScript")}"`
38
- );
39
- this.emit(`# Target: Godot ${this.options.godotVersion}`);
40
- this.emit(`# Do not edit manually \u2014 regenerate from .holo source`);
41
- this.emit("");
42
- this.emit("extends Node3D");
43
- this.emit(`class_name ${this.options.className}`);
44
- this.emit("");
45
- if (composition.state) {
46
- this.emit("# === State ===");
47
- for (const prop of composition.state.properties) {
48
- const gdVal = this.toGDScriptValue(prop.value);
49
- this.emit(`var ${this.escapeStringValue(prop.key, "GDScript")} = ${gdVal}`);
50
- }
51
- this.emit("");
52
- }
53
- this.emit("func _ready():");
54
- this.indentLevel++;
55
- if (composition.environment) {
56
- this.compileEnvironment(composition.environment);
57
- }
58
- if (composition.lights) {
59
- for (const light of composition.lights) {
60
- this.compileLight(light);
61
- }
62
- }
63
- if (composition.camera) {
64
- this.compileCamera(composition.camera);
65
- }
66
- if (composition.objects) {
67
- for (const obj of composition.objects) {
68
- this.compileObject(obj, "self");
69
- }
70
- }
71
- if (composition.spatialGroups) {
72
- for (const group of composition.spatialGroups) {
73
- this.compileSpatialGroup(group, "self");
74
- }
75
- }
76
- if (composition.audio) {
77
- for (const audio of composition.audio) {
78
- this.compileAudio(audio);
79
- }
80
- }
81
- if (composition.zones) {
82
- for (const zone of composition.zones) {
83
- this.compileZone(zone);
84
- }
85
- }
86
- if (composition.timelines) {
87
- for (const tl of composition.timelines) {
88
- if (tl.autoplay) {
89
- this.emit(`_play_${this.sanitizeName(tl.name)}()`);
90
- }
91
- }
92
- }
93
- if (composition.ui) {
94
- this.compileUI(composition.ui);
95
- }
96
- this.indentLevel--;
97
- this.emit("");
98
- if (composition.timelines) {
99
- for (const tl of composition.timelines) {
100
- this.compileTimeline(tl);
101
- }
102
- }
103
- if (composition.transitions) {
104
- for (const tr of composition.transitions) {
105
- this.compileTransition(tr);
106
- }
107
- }
108
- if (composition.effects) {
109
- this.compileEffects(composition.effects);
110
- }
111
- this.compileGodotDomainBlocks(composition);
112
- return this.lines.join("\n");
113
- }
114
- compileGodotDomainBlocks(composition) {
115
- const domainBlocks = composition.domainBlocks ?? [];
116
- if (domainBlocks.length === 0) return;
117
- this.emit("");
118
- this.emit("# === v4.2 Domain Blocks ===");
119
- let blockIdx = 0;
120
- const compiled = compileDomainBlocks(
121
- domainBlocks,
122
- {
123
- material: (block) => {
124
- const mat = compileMaterialBlock(block);
125
- return materialToGodot(mat, `db${blockIdx++}`);
126
- },
127
- physics: (block) => {
128
- const phys = compilePhysicsBlock(block);
129
- return physicsToGodot(phys, `db${blockIdx++}`);
130
- },
131
- vfx: (block) => {
132
- const ps = compileParticleBlock(block);
133
- return particlesToGodot(ps, `db${blockIdx++}`);
134
- },
135
- postfx: (block) => {
136
- const pp = compilePostProcessingBlock(block);
137
- return postProcessingToGodot(pp);
138
- },
139
- audio: (block) => {
140
- const audio = compileAudioSourceBlock(block);
141
- return audioSourceToGodot(audio, `db${blockIdx++}`);
142
- },
143
- weather: (block) => {
144
- const weather = compileWeatherBlock(block);
145
- return weatherToGodot(weather);
146
- },
147
- narrative: (block) => {
148
- const narr = compileNarrativeBlock(block);
149
- return narrativeToGodot(narr);
150
- },
151
- payment: (block) => {
152
- const pay = compilePaymentBlock(block);
153
- return paymentToGodot(pay);
154
- },
155
- healthcare: (block) => {
156
- const h = compileHealthcareBlock(block);
157
- return healthcareToGodot(h);
158
- },
159
- robotics: (block) => {
160
- const r = compileRoboticsBlock(block);
161
- return roboticsToGodot(r);
162
- },
163
- iot: (block) => iotToGodot(compileIoTBlock(block)),
164
- dataviz: (block) => datavizToGodot(compileDataVizBlock(block)),
165
- education: (block) => educationToGodot(compileEducationBlock(block)),
166
- music: (block) => musicToGodot(compileMusicBlock(block)),
167
- architecture: (block) => architectureToGodot(compileArchitectureBlock(block)),
168
- web3: (block) => web3ToGodot(compileWeb3Block(block)),
169
- procedural: (block) => proceduralToGodot(compileProceduralBlock(block)),
170
- rendering: (block) => renderingToGodot(compileRenderingBlock(block)),
171
- navigation: (block) => navigationToGodot(compileNavigationBlock(block)),
172
- input: (block) => inputToGodot(compileInputBlock(block))
173
- },
174
- (block) => `# Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "GDScript")}"`
175
- );
176
- for (const line of compiled) {
177
- for (const l of line.split("\n")) {
178
- this.emit(l);
179
- }
180
- }
181
- }
182
- compileEnvironment(env) {
183
- this.emit("# === Environment ===");
184
- for (const prop of env.properties) {
185
- if (prop.key === "preset" || prop.key === "skybox") {
186
- this.emit(`var env = WorldEnvironment.new()`);
187
- this.emit(`env.environment = Environment.new()`);
188
- this.emit(`env.environment.background_mode = Environment.BG_SKY`);
189
- this.emit(`add_child(env)`);
190
- } else if (prop.key === "fog" && typeof prop.value === "object") {
191
- const fog = prop.value;
192
- this.emit(`# Fog settings`);
193
- if (fog.color) this.emit(`# fog_color: ${fog.color}`);
194
- if (fog.near !== void 0) this.emit(`# fog_near: ${fog.near}`);
195
- if (fog.far !== void 0) this.emit(`# fog_far: ${fog.far}`);
196
- } else if (prop.key === "ambient_light") {
197
- this.emit(`# Ambient light intensity: ${prop.value}`);
198
- }
199
- }
200
- this.emit("");
201
- }
202
- compileLight(light) {
203
- const varName = this.sanitizeName(light.name);
204
- this.emit(`# Light: ${this.escapeStringValue(light.name, "GDScript")}`);
205
- const typeMap = {
206
- directional: "DirectionalLight3D",
207
- point: "OmniLight3D",
208
- spot: "SpotLight3D"
209
- };
210
- const gdType = typeMap[light.lightType] || "DirectionalLight3D";
211
- this.emit(`var ${varName} = ${gdType}.new()`);
212
- this.emit(`${varName}.name = "${this.escapeStringValue(light.name, "GDScript")}"`);
213
- for (const prop of light.properties) {
214
- if (prop.key === "color") {
215
- this.emit(`${varName}.light_color = ${this.toColor(prop.value)}`);
216
- } else if (prop.key === "intensity") {
217
- this.emit(`${varName}.light_energy = ${prop.value}`);
218
- } else if (prop.key === "position" && Array.isArray(prop.value)) {
219
- this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
220
- } else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
221
- this.emit(`${varName}.shadow_enabled = ${prop.value}`);
222
- } else if (prop.key === "distance") {
223
- this.emit(`${varName}.omni_range = ${prop.value}`);
224
- }
225
- }
226
- this.emit(`add_child(${varName})`);
227
- this.emit("");
228
- }
229
- compileCamera(camera) {
230
- this.emit("# === Camera ===");
231
- this.emit("var cam = Camera3D.new()");
232
- const fov = this.findProp(camera.properties, "fov");
233
- if (fov) this.emit(`cam.fov = ${fov}`);
234
- const pos = this.findProp(camera.properties, "position");
235
- if (pos) this.emit(`cam.position = ${this.toVector3(pos)}`);
236
- const lookAt = this.findProp(camera.properties, "look_at") || this.findProp(camera.properties, "lookAt");
237
- if (lookAt) this.emit(`cam.look_at(${this.toVector3(lookAt)})`);
238
- const near = this.findProp(camera.properties, "near");
239
- if (near) this.emit(`cam.near = ${near}`);
240
- const far = this.findProp(camera.properties, "far");
241
- if (far) this.emit(`cam.far = ${far}`);
242
- this.emit("cam.current = true");
243
- this.emit("add_child(cam)");
244
- this.emit("");
245
- }
246
- compileObject(obj, parentVar) {
247
- const varName = this.sanitizeName(obj.name);
248
- const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
249
- const isText = meshType === "text";
250
- const isModel = !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src");
251
- const isSparkles = meshType === "sparkles";
252
- const isLight = ["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(
253
- meshType
254
- );
255
- this.emit(`# Object: ${this.escapeStringValue(obj.name, "GDScript")}`);
256
- if (isLight) {
257
- const lightMap = {
258
- directional: "DirectionalLight3D",
259
- point: "OmniLight3D",
260
- spot: "SpotLight3D"
261
- };
262
- this.emit(`var ${varName} = ${lightMap[meshType] || "DirectionalLight3D"}.new()`);
263
- } else if (isText) {
264
- this.emit(`var ${varName} = Label3D.new()`);
265
- const text = this.findObjProp(obj, "text");
266
- if (text) this.emit(`${varName}.text = "${text}"`);
267
- const fontSize = this.findObjProp(obj, "font_size");
268
- if (fontSize) this.emit(`${varName}.font_size = ${Math.round(fontSize * 100)}`);
269
- const color = this.findObjProp(obj, "color");
270
- if (color) this.emit(`${varName}.modulate = ${this.toColor(color)}`);
271
- } else if (isModel) {
272
- const src = this.findObjProp(obj, "model") || this.findObjProp(obj, "src");
273
- this.emit(`var ${varName} = load("res://models/${src}.glb").instantiate()`);
274
- } else if (isSparkles) {
275
- this.emit(`var ${varName} = GPUParticles3D.new()`);
276
- } else {
277
- const hasPhysics2 = obj.traits?.some((t) => t.name === "physics" || t.name === "grabbable");
278
- if (hasPhysics2) {
279
- this.emit(`var ${varName}_body = RigidBody3D.new()`);
280
- this.emit(
281
- `${varName}_body.name = "${this.escapeStringValue(obj.name, "GDScript")}"`
282
- );
283
- }
284
- this.emit(`var ${varName} = MeshInstance3D.new()`);
285
- const meshMap = {
286
- sphere: "SphereMesh",
287
- box: "BoxMesh",
288
- cube: "BoxMesh",
289
- cylinder: "CylinderMesh",
290
- cone: "CylinderMesh",
291
- plane: "PlaneMesh",
292
- torus: "TorusMesh",
293
- capsule: "CapsuleMesh"
294
- };
295
- const gdMesh = meshMap[meshType] || "BoxMesh";
296
- this.emit(`${varName}.mesh = ${gdMesh}.new()`);
297
- const size = this.findObjProp(obj, "size");
298
- if (size && gdMesh === "BoxMesh" && Array.isArray(size)) {
299
- this.emit(`${varName}.mesh.size = ${this.toVector3(size)}`);
300
- } else if (typeof size === "number" && gdMesh === "PlaneMesh") {
301
- this.emit(`${varName}.mesh.size = Vector2(${size}, ${size})`);
302
- }
303
- const material = this.findObjProp(obj, "material");
304
- if (material && typeof material === "object") {
305
- const mat = material;
306
- this.emit(`var ${varName}_mat = StandardMaterial3D.new()`);
307
- if (mat.color) this.emit(`${varName}_mat.albedo_color = ${this.toColor(mat.color)}`);
308
- if (mat.roughness !== void 0) this.emit(`${varName}_mat.roughness = ${mat.roughness}`);
309
- if (mat.metalness !== void 0) this.emit(`${varName}_mat.metallic = ${mat.metalness}`);
310
- if (mat.emissive) {
311
- this.emit(`${varName}_mat.emission_enabled = true`);
312
- this.emit(`${varName}_mat.emission = ${this.toColor(mat.emissive)}`);
313
- }
314
- if (mat.transmission) {
315
- this.emit(`${varName}_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA`);
316
- }
317
- this.emit(`${varName}.material_override = ${varName}_mat`);
318
- }
319
- const hasCollider = obj.traits?.some(
320
- (t) => t.name === "collidable" || t.name === "physics" || t.name === "grabbable"
321
- );
322
- if (hasCollider && !hasPhysics2) {
323
- this.emit(`var ${varName}_static = StaticBody3D.new()`);
324
- this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
325
- this.emit(`${varName}_shape.shape = ${varName}.mesh.create_convex_shape()`);
326
- this.emit(`${varName}_static.add_child(${varName}_shape)`);
327
- this.emit(`${varName}_static.add_child(${varName})`);
328
- }
329
- if (hasPhysics2) {
330
- this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
331
- this.emit(`${varName}_shape.shape = ${varName}.mesh.create_convex_shape()`);
332
- this.emit(`${varName}_body.add_child(${varName}_shape)`);
333
- this.emit(`${varName}_body.add_child(${varName})`);
334
- }
335
- }
336
- this.emit(`${varName}.name = "${this.escapeStringValue(obj.name, "GDScript")}"`);
337
- const pos = this.findObjProp(obj, "position");
338
- if (pos) this.emit(`${varName}.position = ${this.toVector3(pos)}`);
339
- const rot = this.findObjProp(obj, "rotation");
340
- if (rot && Array.isArray(rot)) {
341
- this.emit(`${varName}.rotation_degrees = ${this.toVector3(rot)}`);
342
- }
343
- const scale = this.findObjProp(obj, "scale");
344
- if (scale) this.emit(`${varName}.scale = ${this.toVector3(scale)}`);
345
- const hasPhysics = obj.traits?.some((t) => t.name === "physics" || t.name === "grabbable");
346
- if (hasPhysics) {
347
- this.emit(`${parentVar}.add_child(${varName}_body)`);
348
- } else {
349
- this.emit(`${parentVar}.add_child(${varName})`);
350
- }
351
- if (obj.traits) {
352
- for (const trait of obj.traits) {
353
- const tn = trait.name;
354
- if (tn === "collidable" || tn === "physics" || tn === "grabbable") continue;
355
- if (tn === "plane_detection") {
356
- this.emit(`# @plane_detection \u2014 use XRServer plane detection`);
357
- } else if (tn === "mesh_detection") {
358
- this.emit(`# @mesh_detection \u2014 use XRServer mesh tracking`);
359
- } else if (tn === "anchor" || tn === "persistent_anchor" || tn === "shared_anchor") {
360
- this.emit(`# @${tn} \u2014 XRAnchor3D`);
361
- } else if (tn === "occlusion") {
362
- this.emit(`# @occlusion \u2014 Environment3D occlusion`);
363
- } else if (tn === "light_estimation") {
364
- this.emit(`# @light_estimation \u2014 XR light estimation`);
365
- } else if (tn === "cloth") {
366
- this.emit(`var ${varName}_soft = SoftBody3D.new()`);
367
- this.emit(
368
- `${varName}_soft.name = "${this.escapeStringValue(obj.name, "GDScript")}_cloth"`
369
- );
370
- this.emit(`# @cloth \u2014 configure SoftBody3D stiffness/damping`);
371
- } else if (tn === "wind") {
372
- this.emit(`# @wind \u2014 use GPUParticles3D attractor or custom force`);
373
- } else if (tn === "fluid") {
374
- this.emit(`# @fluid \u2014 custom SPH/particle fluid simulation`);
375
- } else if (tn === "destruction") {
376
- this.emit(`# @destruction \u2014 pre-fractured mesh swap on impact`);
377
- } else if (tn === "rope" || tn === "chain") {
378
- this.emit(`# @${tn} \u2014 use PinJoint3D chain or custom solver`);
379
- } else if (tn === "reverb_zone") {
380
- this.emit(`var ${varName}_reverb = AudioEffectReverb.new()`);
381
- this.emit(`# @reverb_zone \u2014 add to AudioBus`);
382
- } else if (tn === "ambisonics" || tn === "hrtf" || tn === "audio_occlusion" || tn === "audio_portal" || tn === "audio_material" || tn === "head_tracked_audio") {
383
- this.emit(`# @${tn} \u2014 spatial audio: ${JSON.stringify(trait.config || {})}`);
384
- } else if (tn === "gaussian_splat" || tn === "nerf" || tn === "volumetric_video" || tn === "point_cloud" || tn === "photogrammetry") {
385
- this.emit(`# @${tn} \u2014 volumetric renderer: ${JSON.stringify(trait.config || {})}`);
386
- } else if (tn === "accessible" || tn === "alt_text" || tn === "screen_reader" || tn === "high_contrast" || tn === "motion_reduced" || tn === "magnifiable") {
387
- this.emit(`# @${tn} \u2014 accessibility: ${JSON.stringify(trait.config || {})}`);
388
- } else if (tn === "eye_tracking" || tn === "hand_tracking" || tn === "body_tracking" || tn === "face_tracking" || tn === "controller") {
389
- this.emit(`# @${tn} \u2014 XR input: ${JSON.stringify(trait.config || {})}`);
390
- } else if (tn === "spatial_persona") {
391
- this.emit(`# @spatial_persona \u2014 visionOS-specific; use custom avatar scene for Godot`);
392
- } else if (tn === "shareplay") {
393
- this.emit(`# @shareplay \u2014 multiplayer via ENetMultiplayerPeer or WebSocketPeer`);
394
- } else if (tn === "object_tracking") {
395
- this.emit(`# @object_tracking \u2014 use XRTracker or custom vision-based tracker`);
396
- } else if (tn === "scene_reconstruction") {
397
- this.emit(`# @scene_reconstruction \u2014 use XRServer environment mesh`);
398
- } else if (tn === "eye_tracked" || tn === "eye_hand_fusion") {
399
- this.emit(`# @${tn} \u2014 use XRPositionalTracker for eye/hand data`);
400
- } else if (tn === "controlnet" || tn === "ai_texture_gen" || tn === "diffusion_realtime" || tn === "ai_upscaling" || tn === "ai_inpainting") {
401
- this.emit(`# @${tn} \u2014 AI generation: route to external inference or GDExtension`);
402
- } else if (tn === "neural_link" || tn === "neural_forge") {
403
- this.emit(`# @${tn} \u2014 neural interface: ${JSON.stringify(trait.config || {})}`);
404
- } else if (tn === "embedding_search" || tn === "ai_npc_brain" || tn === "vector_db") {
405
- this.emit(`# @${tn} \u2014 knowledge/AI: integrate via HTTP or GDExtension`);
406
- } else if (tn === "vision" || tn === "ai_vision" || tn === "spatial_awareness") {
407
- this.emit(`# @${tn} \u2014 computer vision: use OpenCV GDExtension or XRServer`);
408
- } else if (tn === "neural_animation") {
409
- this.emit(`# @neural_animation \u2014 motion matching via AnimationTree + custom solver`);
410
- } else {
411
- this.emit(`# @${tn}: ${JSON.stringify(trait.config || {})}`);
412
- }
413
- }
414
- }
415
- if (obj.children) {
416
- for (const child of obj.children) {
417
- this.compileObject(child, varName);
418
- }
419
- }
420
- this.emit("");
421
- }
422
- compileSpatialGroup(group, parentVar) {
423
- const varName = this.sanitizeName(group.name);
424
- this.emit(`# Spatial Group: ${this.escapeStringValue(group.name, "GDScript")}`);
425
- this.emit(`var ${varName} = Node3D.new()`);
426
- this.emit(`${varName}.name = "${this.escapeStringValue(group.name, "GDScript")}"`);
427
- for (const prop of group.properties) {
428
- if (prop.key === "position" && Array.isArray(prop.value)) {
429
- this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
430
- }
431
- }
432
- this.emit(`${parentVar}.add_child(${varName})`);
433
- for (const obj of group.objects) {
434
- this.compileObject(obj, varName);
435
- }
436
- if (group.groups) {
437
- for (const sub of group.groups) {
438
- this.compileSpatialGroup(sub, varName);
439
- }
440
- }
441
- this.emit("");
442
- }
443
- compileAudio(audio) {
444
- const varName = this.sanitizeName(audio.name);
445
- const spatial = audio.properties.find((p) => p.key === "spatial")?.value;
446
- this.emit(`# Audio: ${this.escapeStringValue(audio.name, "GDScript")}`);
447
- if (spatial) {
448
- this.emit(`var ${varName} = AudioStreamPlayer3D.new()`);
449
- } else {
450
- this.emit(`var ${varName} = AudioStreamPlayer.new()`);
451
- }
452
- this.emit(`${varName}.name = "${this.escapeStringValue(audio.name, "GDScript")}"`);
453
- for (const prop of audio.properties) {
454
- if (prop.key === "src" || prop.key === "source") {
455
- this.emit(`${varName}.stream = load("res://audio/${prop.value}")`);
456
- } else if (prop.key === "volume") {
457
- this.emit(`${varName}.volume_db = linear_to_db(${prop.value})`);
458
- } else if (prop.key === "position" && Array.isArray(prop.value)) {
459
- this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
460
- } else if (prop.key === "distance") {
461
- this.emit(`${varName}.max_distance = ${prop.value}`);
462
- }
463
- }
464
- const loop = audio.properties.find((p) => p.key === "loop")?.value;
465
- this.emit(`add_child(${varName})`);
466
- this.emit(`${varName}.play()`);
467
- if (loop) {
468
- this.emit(`${varName}.finished.connect(func(): ${varName}.play())`);
469
- }
470
- this.emit("");
471
- }
472
- compileZone(zone) {
473
- const varName = this.sanitizeName(zone.name);
474
- this.emit(`# Zone: ${this.escapeStringValue(zone.name, "GDScript")}`);
475
- this.emit(`var ${varName} = Area3D.new()`);
476
- this.emit(`${varName}.name = "${this.escapeStringValue(zone.name, "GDScript")}"`);
477
- const shape = zone.properties.find((p) => p.key === "shape")?.value;
478
- this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
479
- if (shape === "box") {
480
- this.emit(`${varName}_shape.shape = BoxShape3D.new()`);
481
- const size = zone.properties.find((p) => p.key === "size")?.value;
482
- if (size && Array.isArray(size)) {
483
- this.emit(`${varName}_shape.shape.size = ${this.toVector3(size)}`);
484
- }
485
- } else if (shape === "sphere") {
486
- this.emit(`${varName}_shape.shape = SphereShape3D.new()`);
487
- const radius = zone.properties.find((p) => p.key === "radius")?.value;
488
- if (radius) this.emit(`${varName}_shape.shape.radius = ${radius}`);
489
- }
490
- this.emit(`${varName}.add_child(${varName}_shape)`);
491
- const pos = zone.properties.find((p) => p.key === "position")?.value;
492
- if (pos) this.emit(`${varName}.position = ${this.toVector3(pos)}`);
493
- for (const handler of zone.handlers) {
494
- if (handler.event === "on_enter") {
495
- this.emit(
496
- `${varName}.body_entered.connect(func(body): print("${this.escapeStringValue(zone.name, "GDScript")}: enter"))`
497
- );
498
- } else if (handler.event === "on_exit") {
499
- this.emit(
500
- `${varName}.body_exited.connect(func(body): print("${this.escapeStringValue(zone.name, "GDScript")}: exit"))`
501
- );
502
- }
503
- }
504
- this.emit(`add_child(${varName})`);
505
- this.emit("");
506
- }
507
- compileTimeline(tl) {
508
- const varName = this.sanitizeName(tl.name);
509
- this.emit(`func _play_${varName}():`);
510
- this.indentLevel++;
511
- this.emit(`var tween = create_tween()`);
512
- if (tl.loop) {
513
- this.emit(`tween.set_loops()`);
514
- }
515
- for (const entry of tl.entries) {
516
- if (entry.action.kind === "animate") {
517
- this.emit(
518
- `tween.tween_callback(func(): pass) # animate "${entry.action.target}" at ${entry.time}s`
519
- );
520
- for (const [key, value] of Object.entries(entry.action.properties)) {
521
- this.emit(`# ${key}: ${JSON.stringify(value)}`);
522
- }
523
- } else if (entry.action.kind === "emit") {
524
- this.emit(
525
- `tween.tween_callback(func(): print("Event: ${entry.action.event}")).set_delay(${entry.time})`
526
- );
527
- } else if (entry.action.kind === "call") {
528
- this.emit(
529
- `tween.tween_callback(func(): ${entry.action.method}()).set_delay(${entry.time})`
530
- );
531
- }
532
- }
533
- this.indentLevel--;
534
- this.emit("");
535
- }
536
- compileTransition(tr) {
537
- const varName = this.sanitizeName(tr.name);
538
- this.emit(`func ${varName}():`);
539
- this.indentLevel++;
540
- const target = tr.properties.find((p) => p.key === "target")?.value;
541
- const effect = tr.properties.find((p) => p.key === "effect")?.value;
542
- const duration = tr.properties.find((p) => p.key === "duration")?.value;
543
- this.emit(`# Transition: ${effect} (${duration}s)`);
544
- if (target) {
545
- this.emit(`get_tree().change_scene_to_file("res://scenes/${target}.tscn")`);
546
- }
547
- this.indentLevel--;
548
- this.emit("");
549
- }
550
- compileEffects(effects) {
551
- this.emit("# === Post-Processing (configure via WorldEnvironment) ===");
552
- for (const effect of effects.effects) {
553
- this.emit(`# Effect: ${effect.effectType} \u2014 ${JSON.stringify(effect.properties)}`);
554
- }
555
- this.emit("");
556
- }
557
- compileUI(ui) {
558
- this.emit("# === UI Overlay ===");
559
- this.emit("var ui_layer = CanvasLayer.new()");
560
- this.emit('ui_layer.name = "HoloUI"');
561
- this.emit("add_child(ui_layer)");
562
- this.emit("");
563
- for (const el of ui.elements) {
564
- const varName = this.sanitizeName(el.name);
565
- const elType = el.properties.find((p) => p.key === "type")?.value;
566
- this.emit(`# UI: ${this.escapeStringValue(el.name, "GDScript")} (${elType})`);
567
- if (elType === "text") {
568
- this.emit(`var ${varName} = Label.new()`);
569
- const text = el.properties.find((p) => p.key === "text")?.value;
570
- if (text) this.emit(`${varName}.text = "${text}"`);
571
- } else if (elType === "progress") {
572
- this.emit(`var ${varName} = ProgressBar.new()`);
573
- } else if (elType === "panel") {
574
- this.emit(`var ${varName} = Panel.new()`);
575
- } else {
576
- this.emit(`var ${varName} = Control.new()`);
577
- }
578
- this.emit(`${varName}.name = "${this.escapeStringValue(el.name, "GDScript")}"`);
579
- const pos = el.properties.find((p) => p.key === "position")?.value;
580
- if (pos && Array.isArray(pos)) {
581
- this.emit(`${varName}.position = Vector2(${pos[0]}, ${pos[1]})`);
582
- }
583
- const size = el.properties.find((p) => p.key === "size")?.value;
584
- if (size && Array.isArray(size)) {
585
- this.emit(`${varName}.size = Vector2(${size[0]}, ${size[1]})`);
586
- }
587
- this.emit(`ui_layer.add_child(${varName})`);
588
- this.emit("");
589
- }
590
- }
591
- // ─── Helpers ───────────────────────────────────────────────────────────
592
- emit(line) {
593
- this.lines.push(this.options.indent.repeat(this.indentLevel) + line);
594
- }
595
- sanitizeName(name) {
596
- return name.replace(/[^a-zA-Z0-9_]/g, "_");
597
- }
598
- toVector3(arr) {
599
- if (Array.isArray(arr) && arr.length >= 3) {
600
- return `Vector3(${arr[0]}, ${arr[1]}, ${arr[2]})`;
601
- }
602
- return `Vector3(${arr}, ${arr}, ${arr})`;
603
- }
604
- toColor(value) {
605
- if (typeof value === "string" && value.startsWith("#")) {
606
- return `Color.html("${value}")`;
607
- }
608
- return `Color.WHITE`;
609
- }
610
- toGDScriptValue(value) {
611
- if (typeof value === "number") return `${value}`;
612
- if (typeof value === "boolean") return value ? "true" : "false";
613
- if (typeof value === "string") return `"${this.escapeStringValue(value, "GDScript")}"`;
614
- if (value === null) return "null";
615
- if (Array.isArray(value)) return `[${value.map((v) => this.toGDScriptValue(v)).join(", ")}]`;
616
- return "null";
617
- }
618
- findProp(props, key) {
619
- return props?.find((p) => p.key === key)?.value;
620
- }
621
- findObjProp(obj, key) {
622
- return obj.properties?.find((p) => p.key === key)?.value;
623
- }
624
- };
625
- }
626
- });
627
-
628
- export { GodotCompiler, GodotCompiler_exports, init_GodotCompiler };
629
- //# sourceMappingURL=chunk-NLPSZT4C.js.map
630
- //# sourceMappingURL=chunk-NLPSZT4C.js.map