@holoscript/core 6.0.3 → 7.0.0

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