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