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