@vib3code/sdk 2.0.1

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 (258) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
  3. package/DOCS/CI_TESTING.md +38 -0
  4. package/DOCS/CLI_ONBOARDING.md +75 -0
  5. package/DOCS/CONTROL_REFERENCE.md +64 -0
  6. package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
  7. package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
  8. package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
  9. package/DOCS/ENV_SETUP.md +189 -0
  10. package/DOCS/EXPORT_FORMATS.md +417 -0
  11. package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
  12. package/DOCS/LICENSING_TIERS.md +275 -0
  13. package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
  14. package/DOCS/OBS_SETUP_GUIDE.md +98 -0
  15. package/DOCS/PROJECT_SETUP.md +66 -0
  16. package/DOCS/RENDERER_LIFECYCLE.md +40 -0
  17. package/DOCS/REPO_MANIFEST.md +121 -0
  18. package/DOCS/SESSION_014_PLAN.md +195 -0
  19. package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
  20. package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
  21. package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
  22. package/DOCS/SYSTEM_INVENTORY.md +520 -0
  23. package/DOCS/TELEMETRY_EXPORTS.md +34 -0
  24. package/DOCS/WEBGPU_STATUS.md +38 -0
  25. package/DOCS/XR_BENCHMARKS.md +608 -0
  26. package/LICENSE +21 -0
  27. package/README.md +426 -0
  28. package/docs/.nojekyll +0 -0
  29. package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
  30. package/docs/02-hyperspatial_ego_death.html +346 -0
  31. package/docs/03-post_cartesian_sublime.html +346 -0
  32. package/docs/04-crystalline_void_meditation.html +346 -0
  33. package/docs/05-quantum_decoherence_ballet.html +346 -0
  34. package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
  35. package/docs/07-hyperspatial_ego_death.html +346 -0
  36. package/docs/08-post_cartesian_sublime.html +346 -0
  37. package/docs/09-crystalline_void_meditation.html +346 -0
  38. package/docs/10-quantum_decoherence_ballet.html +346 -0
  39. package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
  40. package/docs/12-hyperspatial_ego_death.html +346 -0
  41. package/docs/13-post_cartesian_sublime.html +346 -0
  42. package/docs/index.html +794 -0
  43. package/docs/test-hub.html +441 -0
  44. package/docs/url-state.js +102 -0
  45. package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
  46. package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
  47. package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
  48. package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
  49. package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
  50. package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
  51. package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
  52. package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
  53. package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
  54. package/docs/vib3-exports/index.html +238 -0
  55. package/docs/webgpu-live.html +702 -0
  56. package/package.json +367 -0
  57. package/src/advanced/AIPresetGenerator.js +777 -0
  58. package/src/advanced/MIDIController.js +703 -0
  59. package/src/advanced/OffscreenWorker.js +1051 -0
  60. package/src/advanced/WebGPUCompute.js +1051 -0
  61. package/src/advanced/WebXRRenderer.js +680 -0
  62. package/src/agent/cli/AgentCLI.js +615 -0
  63. package/src/agent/cli/index.js +14 -0
  64. package/src/agent/index.js +73 -0
  65. package/src/agent/mcp/MCPServer.js +950 -0
  66. package/src/agent/mcp/index.js +9 -0
  67. package/src/agent/mcp/tools.js +548 -0
  68. package/src/agent/telemetry/EventStream.js +669 -0
  69. package/src/agent/telemetry/Instrumentation.js +618 -0
  70. package/src/agent/telemetry/TelemetryExporters.js +427 -0
  71. package/src/agent/telemetry/TelemetryService.js +464 -0
  72. package/src/agent/telemetry/index.js +52 -0
  73. package/src/benchmarks/BenchmarkRunner.js +381 -0
  74. package/src/benchmarks/MetricsCollector.js +299 -0
  75. package/src/benchmarks/index.js +9 -0
  76. package/src/benchmarks/scenes.js +259 -0
  77. package/src/cli/index.js +675 -0
  78. package/src/config/ApiConfig.js +88 -0
  79. package/src/core/CanvasManager.js +217 -0
  80. package/src/core/ErrorReporter.js +117 -0
  81. package/src/core/ParameterMapper.js +333 -0
  82. package/src/core/Parameters.js +396 -0
  83. package/src/core/RendererContracts.js +200 -0
  84. package/src/core/UnifiedResourceManager.js +370 -0
  85. package/src/core/VIB3Engine.js +636 -0
  86. package/src/core/renderers/FacetedRendererAdapter.js +32 -0
  87. package/src/core/renderers/HolographicRendererAdapter.js +29 -0
  88. package/src/core/renderers/QuantumRendererAdapter.js +29 -0
  89. package/src/core/renderers/RendererLifecycleManager.js +63 -0
  90. package/src/creative/ColorPresetsSystem.js +980 -0
  91. package/src/creative/ParameterTimeline.js +1061 -0
  92. package/src/creative/PostProcessingPipeline.js +1113 -0
  93. package/src/creative/TransitionAnimator.js +683 -0
  94. package/src/export/CSSExporter.js +226 -0
  95. package/src/export/CardGeneratorBase.js +279 -0
  96. package/src/export/ExportManager.js +580 -0
  97. package/src/export/FacetedCardGenerator.js +279 -0
  98. package/src/export/HolographicCardGenerator.js +543 -0
  99. package/src/export/LottieExporter.js +552 -0
  100. package/src/export/QuantumCardGenerator.js +315 -0
  101. package/src/export/SVGExporter.js +519 -0
  102. package/src/export/ShaderExporter.js +903 -0
  103. package/src/export/TradingCardGenerator.js +3055 -0
  104. package/src/export/TradingCardManager.js +181 -0
  105. package/src/export/VIB3PackageExporter.js +559 -0
  106. package/src/export/index.js +14 -0
  107. package/src/export/systems/TradingCardSystemFaceted.js +494 -0
  108. package/src/export/systems/TradingCardSystemHolographic.js +452 -0
  109. package/src/export/systems/TradingCardSystemQuantum.js +411 -0
  110. package/src/faceted/FacetedSystem.js +963 -0
  111. package/src/features/CollectionManager.js +433 -0
  112. package/src/gallery/CollectionManager.js +240 -0
  113. package/src/gallery/GallerySystem.js +485 -0
  114. package/src/geometry/GeometryFactory.js +314 -0
  115. package/src/geometry/GeometryLibrary.js +72 -0
  116. package/src/geometry/buffers/BufferBuilder.js +338 -0
  117. package/src/geometry/buffers/index.js +18 -0
  118. package/src/geometry/generators/Crystal.js +420 -0
  119. package/src/geometry/generators/Fractal.js +298 -0
  120. package/src/geometry/generators/KleinBottle.js +197 -0
  121. package/src/geometry/generators/Sphere.js +192 -0
  122. package/src/geometry/generators/Tesseract.js +160 -0
  123. package/src/geometry/generators/Tetrahedron.js +225 -0
  124. package/src/geometry/generators/Torus.js +304 -0
  125. package/src/geometry/generators/Wave.js +341 -0
  126. package/src/geometry/index.js +142 -0
  127. package/src/geometry/warp/HypersphereCore.js +211 -0
  128. package/src/geometry/warp/HypertetraCore.js +386 -0
  129. package/src/geometry/warp/index.js +57 -0
  130. package/src/holograms/HolographicVisualizer.js +1073 -0
  131. package/src/holograms/RealHolographicSystem.js +966 -0
  132. package/src/holograms/variantRegistry.js +69 -0
  133. package/src/integrations/FigmaPlugin.js +854 -0
  134. package/src/integrations/OBSMode.js +754 -0
  135. package/src/integrations/ThreeJsPackage.js +660 -0
  136. package/src/integrations/TouchDesignerExport.js +552 -0
  137. package/src/integrations/frameworks/Vib3React.js +591 -0
  138. package/src/integrations/frameworks/Vib3Svelte.js +654 -0
  139. package/src/integrations/frameworks/Vib3Vue.js +628 -0
  140. package/src/llm/LLMParameterInterface.js +240 -0
  141. package/src/llm/LLMParameterUI.js +577 -0
  142. package/src/math/Mat4x4.js +708 -0
  143. package/src/math/Projection.js +341 -0
  144. package/src/math/Rotor4D.js +637 -0
  145. package/src/math/Vec4.js +476 -0
  146. package/src/math/constants.js +164 -0
  147. package/src/math/index.js +68 -0
  148. package/src/math/projections.js +54 -0
  149. package/src/math/rotations.js +196 -0
  150. package/src/quantum/QuantumEngine.js +906 -0
  151. package/src/quantum/QuantumVisualizer.js +1103 -0
  152. package/src/reactivity/ReactivityConfig.js +499 -0
  153. package/src/reactivity/ReactivityManager.js +586 -0
  154. package/src/reactivity/SpatialInputSystem.js +1783 -0
  155. package/src/reactivity/index.js +93 -0
  156. package/src/render/CommandBuffer.js +465 -0
  157. package/src/render/MultiCanvasBridge.js +340 -0
  158. package/src/render/RenderCommand.js +514 -0
  159. package/src/render/RenderResourceRegistry.js +523 -0
  160. package/src/render/RenderState.js +552 -0
  161. package/src/render/RenderTarget.js +512 -0
  162. package/src/render/ShaderLoader.js +253 -0
  163. package/src/render/ShaderProgram.js +599 -0
  164. package/src/render/UnifiedRenderBridge.js +496 -0
  165. package/src/render/backends/WebGLBackend.js +1108 -0
  166. package/src/render/backends/WebGPUBackend.js +1409 -0
  167. package/src/render/commands/CommandBufferExecutor.js +607 -0
  168. package/src/render/commands/RenderCommandBuffer.js +661 -0
  169. package/src/render/commands/index.js +17 -0
  170. package/src/render/index.js +367 -0
  171. package/src/scene/Disposable.js +498 -0
  172. package/src/scene/MemoryPool.js +618 -0
  173. package/src/scene/Node4D.js +697 -0
  174. package/src/scene/ResourceManager.js +599 -0
  175. package/src/scene/Scene4D.js +540 -0
  176. package/src/scene/index.js +98 -0
  177. package/src/schemas/error.schema.json +84 -0
  178. package/src/schemas/extension.schema.json +88 -0
  179. package/src/schemas/index.js +214 -0
  180. package/src/schemas/parameters.schema.json +142 -0
  181. package/src/schemas/tool-pack.schema.json +44 -0
  182. package/src/schemas/tool-response.schema.json +127 -0
  183. package/src/shaders/common/fullscreen.vert.glsl +5 -0
  184. package/src/shaders/common/fullscreen.vert.wgsl +17 -0
  185. package/src/shaders/common/geometry24.glsl +65 -0
  186. package/src/shaders/common/geometry24.wgsl +54 -0
  187. package/src/shaders/common/rotation4d.glsl +85 -0
  188. package/src/shaders/common/rotation4d.wgsl +86 -0
  189. package/src/shaders/common/uniforms.glsl +44 -0
  190. package/src/shaders/common/uniforms.wgsl +48 -0
  191. package/src/shaders/faceted/faceted.frag.glsl +129 -0
  192. package/src/shaders/faceted/faceted.frag.wgsl +164 -0
  193. package/src/shaders/holographic/holographic.frag.glsl +406 -0
  194. package/src/shaders/holographic/holographic.frag.wgsl +185 -0
  195. package/src/shaders/quantum/quantum.frag.glsl +513 -0
  196. package/src/shaders/quantum/quantum.frag.wgsl +361 -0
  197. package/src/testing/ParallelTestFramework.js +519 -0
  198. package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
  199. package/src/testing/exportFormats.test.js +8 -0
  200. package/src/testing/projections.test.js +14 -0
  201. package/src/testing/rotations.test.js +37 -0
  202. package/src/ui/InteractivityMenu.js +516 -0
  203. package/src/ui/StatusManager.js +96 -0
  204. package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
  205. package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
  206. package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
  207. package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
  208. package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
  209. package/src/variations/VariationManager.js +431 -0
  210. package/src/viewer/AudioReactivity.js +505 -0
  211. package/src/viewer/CardBending.js +481 -0
  212. package/src/viewer/GalleryUI.js +832 -0
  213. package/src/viewer/ReactivityManager.js +590 -0
  214. package/src/viewer/TradingCardExporter.js +600 -0
  215. package/src/viewer/ViewerPortal.js +374 -0
  216. package/src/viewer/index.js +12 -0
  217. package/src/wasm/WasmLoader.js +296 -0
  218. package/src/wasm/index.js +132 -0
  219. package/tools/agentic/mcpTools.js +88 -0
  220. package/tools/cli/agent-cli.js +92 -0
  221. package/tools/export/formats.js +24 -0
  222. package/tools/math/rotation-baseline.mjs +64 -0
  223. package/tools/shader-sync-verify.js +937 -0
  224. package/tools/telemetry/manifestPipeline.js +141 -0
  225. package/tools/telemetry/telemetryEvents.js +35 -0
  226. package/types/adaptive-sdk.d.ts +185 -0
  227. package/types/advanced/AIPresetGenerator.d.ts +81 -0
  228. package/types/advanced/MIDIController.d.ts +100 -0
  229. package/types/advanced/OffscreenWorker.d.ts +82 -0
  230. package/types/advanced/WebGPUCompute.d.ts +52 -0
  231. package/types/advanced/WebXRRenderer.d.ts +77 -0
  232. package/types/advanced/index.d.ts +46 -0
  233. package/types/core/ErrorReporter.d.ts +50 -0
  234. package/types/core/VIB3Engine.d.ts +204 -0
  235. package/types/creative/ColorPresetsSystem.d.ts +91 -0
  236. package/types/creative/ParameterTimeline.d.ts +74 -0
  237. package/types/creative/PostProcessingPipeline.d.ts +109 -0
  238. package/types/creative/TransitionAnimator.d.ts +71 -0
  239. package/types/creative/index.d.ts +35 -0
  240. package/types/integrations/FigmaPlugin.d.ts +46 -0
  241. package/types/integrations/OBSMode.d.ts +74 -0
  242. package/types/integrations/ThreeJsPackage.d.ts +62 -0
  243. package/types/integrations/TouchDesignerExport.d.ts +36 -0
  244. package/types/integrations/Vib3React.d.ts +74 -0
  245. package/types/integrations/Vib3Svelte.d.ts +63 -0
  246. package/types/integrations/Vib3Vue.d.ts +55 -0
  247. package/types/integrations/index.d.ts +52 -0
  248. package/types/reactivity/SpatialInputSystem.d.ts +173 -0
  249. package/types/reactivity/index.d.ts +394 -0
  250. package/types/render/CommandBuffer.d.ts +169 -0
  251. package/types/render/RenderCommand.d.ts +312 -0
  252. package/types/render/RenderState.d.ts +279 -0
  253. package/types/render/RenderTarget.d.ts +254 -0
  254. package/types/render/ShaderProgram.d.ts +277 -0
  255. package/types/render/UnifiedRenderBridge.d.ts +143 -0
  256. package/types/render/WebGLBackend.d.ts +168 -0
  257. package/types/render/WebGPUBackend.d.ts +186 -0
  258. package/types/render/index.d.ts +141 -0
@@ -0,0 +1,513 @@
1
+ // VIB3+ Quantum System Fragment Shader (GLSL)
2
+ // EXACT shader from QuantumVisualizer.js - Complex 3D lattice functions with holographic effects
3
+ // Superior system with volumetric lighting, particles, and RGB glitch effects
4
+ // Supports 24 geometry variants: 8 base + 8 Hypersphere Core + 8 Hypertetrahedron Core
5
+
6
+ #ifdef GL_FRAGMENT_PRECISION_HIGH
7
+ precision highp float;
8
+ #else
9
+ precision mediump float;
10
+ #endif
11
+
12
+ uniform vec2 u_resolution;
13
+ uniform float u_time;
14
+ uniform vec2 u_mouse;
15
+ uniform float u_geometry;
16
+ uniform float u_gridDensity;
17
+ uniform float u_morphFactor;
18
+ uniform float u_chaos;
19
+ uniform float u_speed;
20
+ uniform float u_hue;
21
+ uniform float u_intensity;
22
+ uniform float u_saturation;
23
+ uniform float u_dimension;
24
+ uniform float u_rot4dXY;
25
+ uniform float u_rot4dXZ;
26
+ uniform float u_rot4dYZ;
27
+ uniform float u_rot4dXW;
28
+ uniform float u_rot4dYW;
29
+ uniform float u_rot4dZW;
30
+ uniform float u_mouseIntensity;
31
+ uniform float u_clickIntensity;
32
+ uniform float u_roleIntensity;
33
+
34
+ // 6D rotation matrices - 3D space rotations (XY, XZ, YZ)
35
+ mat4 rotateXY(float theta) {
36
+ float c = cos(theta);
37
+ float s = sin(theta);
38
+ return mat4(c, -s, 0.0, 0.0, s, c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
39
+ }
40
+
41
+ mat4 rotateXZ(float theta) {
42
+ float c = cos(theta);
43
+ float s = sin(theta);
44
+ return mat4(c, 0.0, s, 0.0, 0.0, 1.0, 0.0, 0.0, -s, 0.0, c, 0.0, 0.0, 0.0, 0.0, 1.0);
45
+ }
46
+
47
+ mat4 rotateYZ(float theta) {
48
+ float c = cos(theta);
49
+ float s = sin(theta);
50
+ return mat4(1.0, 0.0, 0.0, 0.0, 0.0, c, -s, 0.0, 0.0, s, c, 0.0, 0.0, 0.0, 0.0, 1.0);
51
+ }
52
+
53
+ // 4D hyperspace rotations (XW, YW, ZW)
54
+ mat4 rotateXW(float theta) {
55
+ float c = cos(theta);
56
+ float s = sin(theta);
57
+ return mat4(c, 0.0, 0.0, -s, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, s, 0.0, 0.0, c);
58
+ }
59
+
60
+ mat4 rotateYW(float theta) {
61
+ float c = cos(theta);
62
+ float s = sin(theta);
63
+ return mat4(1.0, 0.0, 0.0, 0.0, 0.0, c, 0.0, -s, 0.0, 0.0, 1.0, 0.0, 0.0, s, 0.0, c);
64
+ }
65
+
66
+ mat4 rotateZW(float theta) {
67
+ float c = cos(theta);
68
+ float s = sin(theta);
69
+ return mat4(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, c, -s, 0.0, 0.0, s, c);
70
+ }
71
+
72
+ vec3 project4Dto3D(vec4 p) {
73
+ float w = 2.5 / (2.5 + p.w);
74
+ return vec3(p.x * w, p.y * w, p.z * w);
75
+ }
76
+
77
+ // ========================================
78
+ // POLYTOPE CORE WARP FUNCTIONS (24 Geometries)
79
+ // ========================================
80
+ vec3 warpHypersphereCore(vec3 p, int geometryIndex, vec2 mouseDelta) {
81
+ float radius = length(p);
82
+ float morphBlend = clamp(u_morphFactor * 0.6 + (u_dimension - 3.0) * 0.25, 0.0, 2.0);
83
+ float w = sin(radius * (1.3 + float(geometryIndex) * 0.12) + u_time * 0.0008 * u_speed);
84
+ w *= (0.4 + morphBlend * 0.45);
85
+
86
+ vec4 p4d = vec4(p * (1.0 + morphBlend * 0.2), w);
87
+ p4d = rotateXY(u_rot4dXY) * p4d;
88
+ p4d = rotateXZ(u_rot4dXZ) * p4d;
89
+ p4d = rotateYZ(u_rot4dYZ) * p4d;
90
+ p4d = rotateXW(u_rot4dXW) * p4d;
91
+ p4d = rotateYW(u_rot4dYW) * p4d;
92
+ p4d = rotateZW(u_rot4dZW) * p4d;
93
+
94
+ vec3 projected = project4Dto3D(p4d);
95
+ return mix(p, projected, clamp(0.45 + morphBlend * 0.35, 0.0, 1.0));
96
+ }
97
+
98
+ vec3 warpHypertetraCore(vec3 p, int geometryIndex, vec2 mouseDelta) {
99
+ vec3 c1 = normalize(vec3(1.0, 1.0, 1.0));
100
+ vec3 c2 = normalize(vec3(-1.0, -1.0, 1.0));
101
+ vec3 c3 = normalize(vec3(-1.0, 1.0, -1.0));
102
+ vec3 c4 = normalize(vec3(1.0, -1.0, -1.0));
103
+
104
+ float morphBlend = clamp(u_morphFactor * 0.8 + (u_dimension - 3.0) * 0.2, 0.0, 2.0);
105
+ float basisMix = dot(p, c1) * 0.14 + dot(p, c2) * 0.1 + dot(p, c3) * 0.08;
106
+ float w = sin(basisMix * 5.5 + u_time * 0.0009 * u_speed);
107
+ w *= cos(dot(p, c4) * 4.2 - u_time * 0.0007 * u_speed);
108
+ w *= (0.5 + morphBlend * 0.4);
109
+
110
+ vec3 offset = vec3(dot(p, c1), dot(p, c2), dot(p, c3)) * 0.1 * morphBlend;
111
+ vec4 p4d = vec4(p + offset, w);
112
+ p4d = rotateXY(u_rot4dXY) * p4d;
113
+ p4d = rotateXZ(u_rot4dXZ) * p4d;
114
+ p4d = rotateYZ(u_rot4dYZ) * p4d;
115
+ p4d = rotateXW(u_rot4dXW) * p4d;
116
+ p4d = rotateYW(u_rot4dYW) * p4d;
117
+ p4d = rotateZW(u_rot4dZW) * p4d;
118
+
119
+ vec3 projected = project4Dto3D(p4d);
120
+
121
+ float planeInfluence = min(min(abs(dot(p, c1)), abs(dot(p, c2))), min(abs(dot(p, c3)), abs(dot(p, c4))));
122
+ vec3 blended = mix(p, projected, clamp(0.45 + morphBlend * 0.35, 0.0, 1.0));
123
+ return mix(blended, blended * (1.0 - planeInfluence * 0.55), 0.2 + morphBlend * 0.2);
124
+ }
125
+
126
+ vec3 applyCoreWarp(vec3 p, float geometryType, vec2 mouseDelta) {
127
+ float totalBase = 8.0;
128
+ float coreFloat = floor(geometryType / totalBase);
129
+ int coreIndex = int(clamp(coreFloat, 0.0, 2.0));
130
+ float baseGeomFloat = mod(geometryType, totalBase);
131
+ int geometryIndex = int(clamp(floor(baseGeomFloat + 0.5), 0.0, totalBase - 1.0));
132
+
133
+ if (coreIndex == 1) {
134
+ return warpHypersphereCore(p, geometryIndex, mouseDelta);
135
+ }
136
+ if (coreIndex == 2) {
137
+ return warpHypertetraCore(p, geometryIndex, mouseDelta);
138
+ }
139
+ return p;
140
+ }
141
+ // ========================================
142
+
143
+ // Complex 3D Lattice Functions - Superior Quantum Shaders
144
+ float tetrahedronLattice(vec3 p, float gridSize) {
145
+ vec3 q = fract(p * gridSize) - 0.5;
146
+ float d1 = length(q);
147
+ float d2 = length(q - vec3(0.4, 0.0, 0.0));
148
+ float d3 = length(q - vec3(0.0, 0.4, 0.0));
149
+ float d4 = length(q - vec3(0.0, 0.0, 0.4));
150
+ float vertices = 1.0 - smoothstep(0.0, 0.04, min(min(d1, d2), min(d3, d4)));
151
+ float edges = 0.0;
152
+ edges = max(edges, 1.0 - smoothstep(0.0, 0.02, abs(length(q.xy) - 0.2)));
153
+ edges = max(edges, 1.0 - smoothstep(0.0, 0.02, abs(length(q.yz) - 0.2)));
154
+ edges = max(edges, 1.0 - smoothstep(0.0, 0.02, abs(length(q.xz) - 0.2)));
155
+ return max(vertices, edges * 0.5);
156
+ }
157
+
158
+ float hypercubeLattice(vec3 p, float gridSize) {
159
+ vec3 grid = fract(p * gridSize);
160
+ vec3 edges = min(grid, 1.0 - grid);
161
+ float minEdge = min(min(edges.x, edges.y), edges.z);
162
+ float lattice = 1.0 - smoothstep(0.0, 0.03, minEdge);
163
+
164
+ vec3 centers = abs(grid - 0.5);
165
+ float maxCenter = max(max(centers.x, centers.y), centers.z);
166
+ float vertices = 1.0 - smoothstep(0.45, 0.5, maxCenter);
167
+
168
+ return max(lattice * 0.7, vertices);
169
+ }
170
+
171
+ float sphereLattice(vec3 p, float gridSize) {
172
+ vec3 cell = fract(p * gridSize) - 0.5;
173
+ float sphere = 1.0 - smoothstep(0.15, 0.25, length(cell));
174
+
175
+ float rings = 0.0;
176
+ float ringRadius = length(cell.xy);
177
+ rings = max(rings, 1.0 - smoothstep(0.0, 0.02, abs(ringRadius - 0.3)));
178
+ rings = max(rings, 1.0 - smoothstep(0.0, 0.02, abs(ringRadius - 0.2)));
179
+
180
+ return max(sphere, rings * 0.6);
181
+ }
182
+
183
+ float torusLattice(vec3 p, float gridSize) {
184
+ vec3 cell = fract(p * gridSize) - 0.5;
185
+ float majorRadius = 0.3;
186
+ float minorRadius = 0.1;
187
+
188
+ float toroidalDist = length(vec2(length(cell.xy) - majorRadius, cell.z));
189
+ float torus = 1.0 - smoothstep(minorRadius - 0.02, minorRadius + 0.02, toroidalDist);
190
+
191
+ float rings = 0.0;
192
+ float angle = atan(cell.y, cell.x);
193
+ rings = sin(angle * 8.0) * 0.02;
194
+
195
+ return max(torus, 0.0) + rings;
196
+ }
197
+
198
+ float kleinLattice(vec3 p, float gridSize) {
199
+ vec3 cell = fract(p * gridSize) - 0.5;
200
+ float u = atan(cell.y, cell.x) / 3.14159 + 1.0;
201
+ float v = cell.z + 0.5;
202
+
203
+ float x = (2.0 + cos(u * 0.5)) * cos(u);
204
+ float y = (2.0 + cos(u * 0.5)) * sin(u);
205
+ float z = sin(u * 0.5) + v;
206
+
207
+ vec3 kleinPoint = vec3(x, y, z) * 0.1;
208
+ float dist = length(cell - kleinPoint);
209
+
210
+ return 1.0 - smoothstep(0.1, 0.15, dist);
211
+ }
212
+
213
+ float fractalLattice(vec3 p, float gridSize) {
214
+ vec3 cell = fract(p * gridSize);
215
+ cell = abs(cell * 2.0 - 1.0);
216
+
217
+ float dist = length(max(abs(cell) - 0.3, 0.0));
218
+
219
+ // Recursive subdivision
220
+ for(int i = 0; i < 3; i++) {
221
+ cell = abs(cell * 2.0 - 1.0);
222
+ float subdist = length(max(abs(cell) - 0.3, 0.0)) / pow(2.0, float(i + 1));
223
+ dist = min(dist, subdist);
224
+ }
225
+
226
+ return 1.0 - smoothstep(0.0, 0.05, dist);
227
+ }
228
+
229
+ float waveLattice(vec3 p, float gridSize) {
230
+ float time = u_time * 0.001 * u_speed;
231
+ vec3 cell = fract(p * gridSize) - 0.5;
232
+
233
+ float wave1 = sin(p.x * gridSize * 2.0 + time * 2.0);
234
+ float wave2 = sin(p.y * gridSize * 1.8 + time * 1.5);
235
+ float wave3 = sin(p.z * gridSize * 2.2 + time * 1.8);
236
+
237
+ float interference = (wave1 + wave2 + wave3) / 3.0;
238
+ float amplitude = 1.0 - length(cell) * 2.0;
239
+
240
+ return max(0.0, interference * amplitude);
241
+ }
242
+
243
+ float crystalLattice(vec3 p, float gridSize) {
244
+ vec3 cell = fract(p * gridSize) - 0.5;
245
+
246
+ // Octahedral crystal structure
247
+ float crystal = max(max(abs(cell.x) + abs(cell.y), abs(cell.y) + abs(cell.z)), abs(cell.x) + abs(cell.z));
248
+ crystal = 1.0 - smoothstep(0.3, 0.4, crystal);
249
+
250
+ // Add crystalline faces
251
+ float faces = 0.0;
252
+ faces = max(faces, 1.0 - smoothstep(0.0, 0.02, abs(abs(cell.x) - 0.35)));
253
+ faces = max(faces, 1.0 - smoothstep(0.0, 0.02, abs(abs(cell.y) - 0.35)));
254
+ faces = max(faces, 1.0 - smoothstep(0.0, 0.02, abs(abs(cell.z) - 0.35)));
255
+
256
+ return max(crystal, faces * 0.5);
257
+ }
258
+
259
+ // Enhanced geometry function with holographic effects (24 GEOMETRIES)
260
+ float geometryFunction(vec4 p) {
261
+ // Decode geometry: base = geometry % 8 (supports 24 geometries)
262
+ float totalBase = 8.0;
263
+ float baseGeomFloat = mod(u_geometry, totalBase);
264
+ int geomType = int(clamp(floor(baseGeomFloat + 0.5), 0.0, totalBase - 1.0));
265
+
266
+ // Project to 3D and apply polytope warp
267
+ vec3 p3d = project4Dto3D(p);
268
+ vec3 warped = applyCoreWarp(p3d, u_geometry, vec2(0.0, 0.0));
269
+ float gridSize = u_gridDensity * 0.08;
270
+
271
+ if (geomType == 0) {
272
+ return tetrahedronLattice(warped, gridSize) * u_morphFactor;
273
+ }
274
+ else if (geomType == 1) {
275
+ return hypercubeLattice(warped, gridSize) * u_morphFactor;
276
+ }
277
+ else if (geomType == 2) {
278
+ return sphereLattice(warped, gridSize) * u_morphFactor;
279
+ }
280
+ else if (geomType == 3) {
281
+ return torusLattice(warped, gridSize) * u_morphFactor;
282
+ }
283
+ else if (geomType == 4) {
284
+ return kleinLattice(warped, gridSize) * u_morphFactor;
285
+ }
286
+ else if (geomType == 5) {
287
+ return fractalLattice(warped, gridSize) * u_morphFactor;
288
+ }
289
+ else if (geomType == 6) {
290
+ return waveLattice(warped, gridSize) * u_morphFactor;
291
+ }
292
+ else if (geomType == 7) {
293
+ return crystalLattice(warped, gridSize) * u_morphFactor;
294
+ }
295
+ else {
296
+ return hypercubeLattice(warped, gridSize) * u_morphFactor;
297
+ }
298
+ }
299
+
300
+ // EXTREME LAYER-BY-LAYER COLOR SYSTEM
301
+ // Each canvas layer gets completely different color behavior
302
+
303
+ // Layer-specific color palettes with extreme juxtapositions
304
+ vec3 getLayerColorPalette(int layerIndex, float t) {
305
+ if (layerIndex == 0) {
306
+ // BACKGROUND LAYER: Deep space colors - purple/black/deep blue
307
+ vec3 color1 = vec3(0.05, 0.0, 0.2); // Deep purple
308
+ vec3 color2 = vec3(0.0, 0.0, 0.1); // Near black
309
+ vec3 color3 = vec3(0.0, 0.05, 0.3); // Deep blue
310
+ return mix(mix(color1, color2, sin(t * 3.0) * 0.5 + 0.5), color3, cos(t * 2.0) * 0.5 + 0.5);
311
+ }
312
+ else if (layerIndex == 1) {
313
+ // SHADOW LAYER: Toxic greens and sickly yellows - high contrast
314
+ vec3 color1 = vec3(0.0, 1.0, 0.0); // Pure toxic green
315
+ vec3 color2 = vec3(0.8, 1.0, 0.0); // Sickly yellow-green
316
+ vec3 color3 = vec3(0.0, 0.8, 0.3); // Forest green
317
+ return mix(mix(color1, color2, sin(t * 7.0) * 0.5 + 0.5), color3, cos(t * 5.0) * 0.5 + 0.5);
318
+ }
319
+ else if (layerIndex == 2) {
320
+ // CONTENT LAYER: Blazing hot colors - red/orange/white hot
321
+ vec3 color1 = vec3(1.0, 0.0, 0.0); // Pure red
322
+ vec3 color2 = vec3(1.0, 0.5, 0.0); // Blazing orange
323
+ vec3 color3 = vec3(1.0, 1.0, 1.0); // White hot
324
+ return mix(mix(color1, color2, sin(t * 11.0) * 0.5 + 0.5), color3, cos(t * 8.0) * 0.5 + 0.5);
325
+ }
326
+ else if (layerIndex == 3) {
327
+ // HIGHLIGHT LAYER: Electric blues and cyans - crackling energy
328
+ vec3 color1 = vec3(0.0, 1.0, 1.0); // Electric cyan
329
+ vec3 color2 = vec3(0.0, 0.5, 1.0); // Electric blue
330
+ vec3 color3 = vec3(0.5, 1.0, 1.0); // Bright cyan
331
+ return mix(mix(color1, color2, sin(t * 13.0) * 0.5 + 0.5), color3, cos(t * 9.0) * 0.5 + 0.5);
332
+ }
333
+ else {
334
+ // ACCENT LAYER: Violent magentas and purples - chaotic
335
+ vec3 color1 = vec3(1.0, 0.0, 1.0); // Pure magenta
336
+ vec3 color2 = vec3(0.8, 0.0, 1.0); // Violet
337
+ vec3 color3 = vec3(1.0, 0.3, 1.0); // Hot pink
338
+ return mix(mix(color1, color2, sin(t * 17.0) * 0.5 + 0.5), color3, cos(t * 12.0) * 0.5 + 0.5);
339
+ }
340
+ }
341
+
342
+ // Extreme RGB separation and distortion for each layer
343
+ vec3 extremeRGBSeparation(vec3 baseColor, vec2 uv, float intensity, int layerIndex) {
344
+ vec2 offset = vec2(0.01, 0.005) * intensity;
345
+
346
+ // Different separation patterns per layer
347
+ if (layerIndex == 0) {
348
+ // Background: Minimal separation, smooth
349
+ return baseColor + vec3(
350
+ sin(uv.x * 10.0 + u_time * 0.001) * 0.02,
351
+ cos(uv.y * 8.0 + u_time * 0.0015) * 0.02,
352
+ sin(uv.x * uv.y * 6.0 + u_time * 0.0008) * 0.02
353
+ ) * intensity;
354
+ }
355
+ else if (layerIndex == 1) {
356
+ // Shadow: Heavy vertical separation
357
+ float r = baseColor.r + sin(uv.y * 50.0 + u_time * 0.003) * intensity * 0.15;
358
+ float g = baseColor.g + sin((uv.y + 0.1) * 45.0 + u_time * 0.0025) * intensity * 0.12;
359
+ float b = baseColor.b + sin((uv.y - 0.1) * 55.0 + u_time * 0.0035) * intensity * 0.18;
360
+ return vec3(r, g, b);
361
+ }
362
+ else if (layerIndex == 2) {
363
+ // Content: Explosive radial separation
364
+ float dist = length(uv);
365
+ float angle = atan(uv.y, uv.x);
366
+ float r = baseColor.r + sin(dist * 30.0 + angle * 10.0 + u_time * 0.004) * intensity * 0.2;
367
+ float g = baseColor.g + cos(dist * 25.0 + angle * 8.0 + u_time * 0.0035) * intensity * 0.18;
368
+ float b = baseColor.b + sin(dist * 35.0 + angle * 12.0 + u_time * 0.0045) * intensity * 0.22;
369
+ return vec3(r, g, b);
370
+ }
371
+ else if (layerIndex == 3) {
372
+ // Highlight: Lightning-like separation
373
+ float lightning = sin(uv.x * 80.0 + u_time * 0.008) * cos(uv.y * 60.0 + u_time * 0.006);
374
+ float r = baseColor.r + lightning * intensity * 0.25;
375
+ float g = baseColor.g + sin(lightning * 40.0 + u_time * 0.005) * intensity * 0.2;
376
+ float b = baseColor.b + cos(lightning * 30.0 + u_time * 0.007) * intensity * 0.3;
377
+ return vec3(r, g, b);
378
+ }
379
+ else {
380
+ // Accent: Chaotic multi-directional separation
381
+ float chaos1 = sin(uv.x * 100.0 + uv.y * 80.0 + u_time * 0.01);
382
+ float chaos2 = cos(uv.x * 70.0 - uv.y * 90.0 + u_time * 0.008);
383
+ float chaos3 = sin(uv.x * uv.y * 150.0 + u_time * 0.012);
384
+ return baseColor + vec3(chaos1, chaos2, chaos3) * intensity * 0.3;
385
+ }
386
+ }
387
+
388
+ void main() {
389
+ vec2 uv = (gl_FragCoord.xy - u_resolution.xy * 0.5) / min(u_resolution.x, u_resolution.y);
390
+
391
+ // Enhanced 4D position with holographic depth
392
+ float timeSpeed = u_time * 0.0001 * u_speed;
393
+ vec4 pos = vec4(uv * 3.0, sin(timeSpeed * 3.0), cos(timeSpeed * 2.0));
394
+ pos.xy += (u_mouse - 0.5) * u_mouseIntensity * 2.0;
395
+
396
+ // Apply 6D rotations - 3D space rotations first, then 4D hyperspace
397
+ pos = rotateXY(u_rot4dXY) * pos;
398
+ pos = rotateXZ(u_rot4dXZ) * pos;
399
+ pos = rotateYZ(u_rot4dYZ) * pos;
400
+ pos = rotateXW(u_rot4dXW) * pos;
401
+ pos = rotateYW(u_rot4dYW) * pos;
402
+ pos = rotateZW(u_rot4dZW) * pos;
403
+
404
+ // Calculate enhanced geometry value
405
+ float value = geometryFunction(pos);
406
+
407
+ // Enhanced chaos with holographic effects
408
+ float noise = sin(pos.x * 7.0) * cos(pos.y * 11.0) * sin(pos.z * 13.0);
409
+ value += noise * u_chaos;
410
+
411
+ // Enhanced intensity calculation with holographic glow
412
+ float geometryIntensity = 1.0 - clamp(abs(value * 0.8), 0.0, 1.0);
413
+ geometryIntensity = pow(geometryIntensity, 1.5); // More dramatic falloff
414
+ geometryIntensity += u_clickIntensity * 0.3;
415
+
416
+ // Holographic shimmer effect
417
+ float shimmer = sin(uv.x * 20.0 + timeSpeed * 5.0) * cos(uv.y * 15.0 + timeSpeed * 3.0) * 0.1;
418
+ geometryIntensity += shimmer * geometryIntensity;
419
+
420
+ // Apply user intensity control
421
+ float finalIntensity = geometryIntensity * u_intensity;
422
+
423
+ // EXTREME LAYER-BY-LAYER COLOR SYSTEM
424
+ // Determine canvas layer from role/variant (0=background, 1=shadow, 2=content, 3=highlight, 4=accent)
425
+ int layerIndex = 0;
426
+ if (u_roleIntensity == 0.7) layerIndex = 1; // shadow layer
427
+ else if (u_roleIntensity == 1.0) layerIndex = 2; // content layer
428
+ else if (u_roleIntensity == 0.85) layerIndex = 3; // highlight layer
429
+ else if (u_roleIntensity == 0.6) layerIndex = 4; // accent layer
430
+
431
+ // Get layer-specific base color with extreme dynamics
432
+ // Use u_hue as global intensity modifier (0-1) affecting all layers
433
+ float globalIntensity = u_hue; // Now 0-1 from JavaScript
434
+ float colorTime = timeSpeed * 2.0 + value * 3.0 + globalIntensity * 5.0;
435
+ vec3 layerColor = getLayerColorPalette(layerIndex, colorTime) * (0.5 + globalIntensity * 1.5);
436
+
437
+ // Apply geometry-based intensity modulation per layer
438
+ vec3 extremeBaseColor;
439
+ if (layerIndex == 0) {
440
+ // Background: Subtle, fills empty space
441
+ extremeBaseColor = layerColor * (0.3 + geometryIntensity * 0.4);
442
+ }
443
+ else if (layerIndex == 1) {
444
+ // Shadow: Aggressive, high contrast where geometry is weak
445
+ float shadowIntensity = pow(1.0 - geometryIntensity, 2.0); // Inverted for shadows
446
+ extremeBaseColor = layerColor * (shadowIntensity * 0.8 + 0.1);
447
+ }
448
+ else if (layerIndex == 2) {
449
+ // Content: Dominant, follows geometry strongly
450
+ extremeBaseColor = layerColor * (geometryIntensity * 1.2 + 0.2);
451
+ }
452
+ else if (layerIndex == 3) {
453
+ // Highlight: Electric, peaks only
454
+ float peakIntensity = pow(geometryIntensity, 3.0); // Cubic for sharp peaks
455
+ extremeBaseColor = layerColor * (peakIntensity * 1.5 + 0.1);
456
+ }
457
+ else {
458
+ // Accent: Chaotic, random bursts
459
+ float randomBurst = sin(value * 50.0 + timeSpeed * 10.0) * 0.5 + 0.5;
460
+ extremeBaseColor = layerColor * (randomBurst * geometryIntensity * 2.0 + 0.05);
461
+ }
462
+
463
+ // Apply extreme RGB separation per layer
464
+ vec3 extremeColor = extremeRGBSeparation(extremeBaseColor, uv, finalIntensity, layerIndex);
465
+
466
+ // Layer-specific particle systems with extreme colors
467
+ float extremeParticles = 0.0;
468
+ if (layerIndex == 2 || layerIndex == 3) {
469
+ // Only content and highlight layers get particles
470
+ vec2 particleUV = uv * (layerIndex == 2 ? 12.0 : 20.0);
471
+ vec2 particleID = floor(particleUV);
472
+ vec2 particlePos = fract(particleUV) - 0.5;
473
+ float particleDist = length(particlePos);
474
+
475
+ float particleTime = timeSpeed * (layerIndex == 2 ? 3.0 : 8.0) + dot(particleID, vec2(127.1, 311.7));
476
+ float particleAlpha = sin(particleTime) * 0.5 + 0.5;
477
+ float particleSize = layerIndex == 2 ? 0.2 : 0.1;
478
+ extremeParticles = (1.0 - smoothstep(0.05, particleSize, particleDist)) * particleAlpha * 0.4;
479
+ }
480
+
481
+ // Combine extreme color with particles based on layer
482
+ vec3 finalColor;
483
+ if (layerIndex == 0) {
484
+ // Background: Pure extreme color
485
+ finalColor = extremeColor;
486
+ }
487
+ else if (layerIndex == 1) {
488
+ // Shadow: Dark with toxic highlights
489
+ finalColor = extremeColor * 0.8;
490
+ }
491
+ else if (layerIndex == 2) {
492
+ // Content: Blazing with white-hot particles
493
+ finalColor = extremeColor + extremeParticles * vec3(1.0, 1.0, 1.0);
494
+ }
495
+ else if (layerIndex == 3) {
496
+ // Highlight: Electric with cyan particles
497
+ finalColor = extremeColor + extremeParticles * vec3(0.0, 1.0, 1.0);
498
+ }
499
+ else {
500
+ // Accent: Chaotic magenta madness
501
+ finalColor = extremeColor * (1.0 + sin(timeSpeed * 20.0) * 0.3);
502
+ }
503
+
504
+ // Layer-specific alpha intensity with extreme contrast
505
+ float layerAlpha;
506
+ if (layerIndex == 0) layerAlpha = 0.6; // Background: Medium
507
+ else if (layerIndex == 1) layerAlpha = 0.4; // Shadow: Lower
508
+ else if (layerIndex == 2) layerAlpha = 1.0; // Content: Full intensity
509
+ else if (layerIndex == 3) layerAlpha = 0.8; // Highlight: High
510
+ else layerAlpha = 0.3; // Accent: Subtle bursts
511
+
512
+ gl_FragColor = vec4(finalColor, finalIntensity * layerAlpha);
513
+ }