@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.
- package/CHANGELOG.md +118 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
- package/DOCS/CI_TESTING.md +38 -0
- package/DOCS/CLI_ONBOARDING.md +75 -0
- package/DOCS/CONTROL_REFERENCE.md +64 -0
- package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
- package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
- package/DOCS/ENV_SETUP.md +189 -0
- package/DOCS/EXPORT_FORMATS.md +417 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
- package/DOCS/LICENSING_TIERS.md +275 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
- package/DOCS/OBS_SETUP_GUIDE.md +98 -0
- package/DOCS/PROJECT_SETUP.md +66 -0
- package/DOCS/RENDERER_LIFECYCLE.md +40 -0
- package/DOCS/REPO_MANIFEST.md +121 -0
- package/DOCS/SESSION_014_PLAN.md +195 -0
- package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
- package/DOCS/SYSTEM_INVENTORY.md +520 -0
- package/DOCS/TELEMETRY_EXPORTS.md +34 -0
- package/DOCS/WEBGPU_STATUS.md +38 -0
- package/DOCS/XR_BENCHMARKS.md +608 -0
- package/LICENSE +21 -0
- package/README.md +426 -0
- package/docs/.nojekyll +0 -0
- package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/02-hyperspatial_ego_death.html +346 -0
- package/docs/03-post_cartesian_sublime.html +346 -0
- package/docs/04-crystalline_void_meditation.html +346 -0
- package/docs/05-quantum_decoherence_ballet.html +346 -0
- package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/07-hyperspatial_ego_death.html +346 -0
- package/docs/08-post_cartesian_sublime.html +346 -0
- package/docs/09-crystalline_void_meditation.html +346 -0
- package/docs/10-quantum_decoherence_ballet.html +346 -0
- package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/12-hyperspatial_ego_death.html +346 -0
- package/docs/13-post_cartesian_sublime.html +346 -0
- package/docs/index.html +794 -0
- package/docs/test-hub.html +441 -0
- package/docs/url-state.js +102 -0
- package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
- package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
- package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
- package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
- package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
- package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
- package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
- package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
- package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
- package/docs/vib3-exports/index.html +238 -0
- package/docs/webgpu-live.html +702 -0
- package/package.json +367 -0
- package/src/advanced/AIPresetGenerator.js +777 -0
- package/src/advanced/MIDIController.js +703 -0
- package/src/advanced/OffscreenWorker.js +1051 -0
- package/src/advanced/WebGPUCompute.js +1051 -0
- package/src/advanced/WebXRRenderer.js +680 -0
- package/src/agent/cli/AgentCLI.js +615 -0
- package/src/agent/cli/index.js +14 -0
- package/src/agent/index.js +73 -0
- package/src/agent/mcp/MCPServer.js +950 -0
- package/src/agent/mcp/index.js +9 -0
- package/src/agent/mcp/tools.js +548 -0
- package/src/agent/telemetry/EventStream.js +669 -0
- package/src/agent/telemetry/Instrumentation.js +618 -0
- package/src/agent/telemetry/TelemetryExporters.js +427 -0
- package/src/agent/telemetry/TelemetryService.js +464 -0
- package/src/agent/telemetry/index.js +52 -0
- package/src/benchmarks/BenchmarkRunner.js +381 -0
- package/src/benchmarks/MetricsCollector.js +299 -0
- package/src/benchmarks/index.js +9 -0
- package/src/benchmarks/scenes.js +259 -0
- package/src/cli/index.js +675 -0
- package/src/config/ApiConfig.js +88 -0
- package/src/core/CanvasManager.js +217 -0
- package/src/core/ErrorReporter.js +117 -0
- package/src/core/ParameterMapper.js +333 -0
- package/src/core/Parameters.js +396 -0
- package/src/core/RendererContracts.js +200 -0
- package/src/core/UnifiedResourceManager.js +370 -0
- package/src/core/VIB3Engine.js +636 -0
- package/src/core/renderers/FacetedRendererAdapter.js +32 -0
- package/src/core/renderers/HolographicRendererAdapter.js +29 -0
- package/src/core/renderers/QuantumRendererAdapter.js +29 -0
- package/src/core/renderers/RendererLifecycleManager.js +63 -0
- package/src/creative/ColorPresetsSystem.js +980 -0
- package/src/creative/ParameterTimeline.js +1061 -0
- package/src/creative/PostProcessingPipeline.js +1113 -0
- package/src/creative/TransitionAnimator.js +683 -0
- package/src/export/CSSExporter.js +226 -0
- package/src/export/CardGeneratorBase.js +279 -0
- package/src/export/ExportManager.js +580 -0
- package/src/export/FacetedCardGenerator.js +279 -0
- package/src/export/HolographicCardGenerator.js +543 -0
- package/src/export/LottieExporter.js +552 -0
- package/src/export/QuantumCardGenerator.js +315 -0
- package/src/export/SVGExporter.js +519 -0
- package/src/export/ShaderExporter.js +903 -0
- package/src/export/TradingCardGenerator.js +3055 -0
- package/src/export/TradingCardManager.js +181 -0
- package/src/export/VIB3PackageExporter.js +559 -0
- package/src/export/index.js +14 -0
- package/src/export/systems/TradingCardSystemFaceted.js +494 -0
- package/src/export/systems/TradingCardSystemHolographic.js +452 -0
- package/src/export/systems/TradingCardSystemQuantum.js +411 -0
- package/src/faceted/FacetedSystem.js +963 -0
- package/src/features/CollectionManager.js +433 -0
- package/src/gallery/CollectionManager.js +240 -0
- package/src/gallery/GallerySystem.js +485 -0
- package/src/geometry/GeometryFactory.js +314 -0
- package/src/geometry/GeometryLibrary.js +72 -0
- package/src/geometry/buffers/BufferBuilder.js +338 -0
- package/src/geometry/buffers/index.js +18 -0
- package/src/geometry/generators/Crystal.js +420 -0
- package/src/geometry/generators/Fractal.js +298 -0
- package/src/geometry/generators/KleinBottle.js +197 -0
- package/src/geometry/generators/Sphere.js +192 -0
- package/src/geometry/generators/Tesseract.js +160 -0
- package/src/geometry/generators/Tetrahedron.js +225 -0
- package/src/geometry/generators/Torus.js +304 -0
- package/src/geometry/generators/Wave.js +341 -0
- package/src/geometry/index.js +142 -0
- package/src/geometry/warp/HypersphereCore.js +211 -0
- package/src/geometry/warp/HypertetraCore.js +386 -0
- package/src/geometry/warp/index.js +57 -0
- package/src/holograms/HolographicVisualizer.js +1073 -0
- package/src/holograms/RealHolographicSystem.js +966 -0
- package/src/holograms/variantRegistry.js +69 -0
- package/src/integrations/FigmaPlugin.js +854 -0
- package/src/integrations/OBSMode.js +754 -0
- package/src/integrations/ThreeJsPackage.js +660 -0
- package/src/integrations/TouchDesignerExport.js +552 -0
- package/src/integrations/frameworks/Vib3React.js +591 -0
- package/src/integrations/frameworks/Vib3Svelte.js +654 -0
- package/src/integrations/frameworks/Vib3Vue.js +628 -0
- package/src/llm/LLMParameterInterface.js +240 -0
- package/src/llm/LLMParameterUI.js +577 -0
- package/src/math/Mat4x4.js +708 -0
- package/src/math/Projection.js +341 -0
- package/src/math/Rotor4D.js +637 -0
- package/src/math/Vec4.js +476 -0
- package/src/math/constants.js +164 -0
- package/src/math/index.js +68 -0
- package/src/math/projections.js +54 -0
- package/src/math/rotations.js +196 -0
- package/src/quantum/QuantumEngine.js +906 -0
- package/src/quantum/QuantumVisualizer.js +1103 -0
- package/src/reactivity/ReactivityConfig.js +499 -0
- package/src/reactivity/ReactivityManager.js +586 -0
- package/src/reactivity/SpatialInputSystem.js +1783 -0
- package/src/reactivity/index.js +93 -0
- package/src/render/CommandBuffer.js +465 -0
- package/src/render/MultiCanvasBridge.js +340 -0
- package/src/render/RenderCommand.js +514 -0
- package/src/render/RenderResourceRegistry.js +523 -0
- package/src/render/RenderState.js +552 -0
- package/src/render/RenderTarget.js +512 -0
- package/src/render/ShaderLoader.js +253 -0
- package/src/render/ShaderProgram.js +599 -0
- package/src/render/UnifiedRenderBridge.js +496 -0
- package/src/render/backends/WebGLBackend.js +1108 -0
- package/src/render/backends/WebGPUBackend.js +1409 -0
- package/src/render/commands/CommandBufferExecutor.js +607 -0
- package/src/render/commands/RenderCommandBuffer.js +661 -0
- package/src/render/commands/index.js +17 -0
- package/src/render/index.js +367 -0
- package/src/scene/Disposable.js +498 -0
- package/src/scene/MemoryPool.js +618 -0
- package/src/scene/Node4D.js +697 -0
- package/src/scene/ResourceManager.js +599 -0
- package/src/scene/Scene4D.js +540 -0
- package/src/scene/index.js +98 -0
- package/src/schemas/error.schema.json +84 -0
- package/src/schemas/extension.schema.json +88 -0
- package/src/schemas/index.js +214 -0
- package/src/schemas/parameters.schema.json +142 -0
- package/src/schemas/tool-pack.schema.json +44 -0
- package/src/schemas/tool-response.schema.json +127 -0
- package/src/shaders/common/fullscreen.vert.glsl +5 -0
- package/src/shaders/common/fullscreen.vert.wgsl +17 -0
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +85 -0
- package/src/shaders/common/rotation4d.wgsl +86 -0
- package/src/shaders/common/uniforms.glsl +44 -0
- package/src/shaders/common/uniforms.wgsl +48 -0
- package/src/shaders/faceted/faceted.frag.glsl +129 -0
- package/src/shaders/faceted/faceted.frag.wgsl +164 -0
- package/src/shaders/holographic/holographic.frag.glsl +406 -0
- package/src/shaders/holographic/holographic.frag.wgsl +185 -0
- package/src/shaders/quantum/quantum.frag.glsl +513 -0
- package/src/shaders/quantum/quantum.frag.wgsl +361 -0
- package/src/testing/ParallelTestFramework.js +519 -0
- package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
- package/src/testing/exportFormats.test.js +8 -0
- package/src/testing/projections.test.js +14 -0
- package/src/testing/rotations.test.js +37 -0
- package/src/ui/InteractivityMenu.js +516 -0
- package/src/ui/StatusManager.js +96 -0
- package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
- package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
- package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
- package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
- package/src/variations/VariationManager.js +431 -0
- package/src/viewer/AudioReactivity.js +505 -0
- package/src/viewer/CardBending.js +481 -0
- package/src/viewer/GalleryUI.js +832 -0
- package/src/viewer/ReactivityManager.js +590 -0
- package/src/viewer/TradingCardExporter.js +600 -0
- package/src/viewer/ViewerPortal.js +374 -0
- package/src/viewer/index.js +12 -0
- package/src/wasm/WasmLoader.js +296 -0
- package/src/wasm/index.js +132 -0
- package/tools/agentic/mcpTools.js +88 -0
- package/tools/cli/agent-cli.js +92 -0
- package/tools/export/formats.js +24 -0
- package/tools/math/rotation-baseline.mjs +64 -0
- package/tools/shader-sync-verify.js +937 -0
- package/tools/telemetry/manifestPipeline.js +141 -0
- package/tools/telemetry/telemetryEvents.js +35 -0
- package/types/adaptive-sdk.d.ts +185 -0
- package/types/advanced/AIPresetGenerator.d.ts +81 -0
- package/types/advanced/MIDIController.d.ts +100 -0
- package/types/advanced/OffscreenWorker.d.ts +82 -0
- package/types/advanced/WebGPUCompute.d.ts +52 -0
- package/types/advanced/WebXRRenderer.d.ts +77 -0
- package/types/advanced/index.d.ts +46 -0
- package/types/core/ErrorReporter.d.ts +50 -0
- package/types/core/VIB3Engine.d.ts +204 -0
- package/types/creative/ColorPresetsSystem.d.ts +91 -0
- package/types/creative/ParameterTimeline.d.ts +74 -0
- package/types/creative/PostProcessingPipeline.d.ts +109 -0
- package/types/creative/TransitionAnimator.d.ts +71 -0
- package/types/creative/index.d.ts +35 -0
- package/types/integrations/FigmaPlugin.d.ts +46 -0
- package/types/integrations/OBSMode.d.ts +74 -0
- package/types/integrations/ThreeJsPackage.d.ts +62 -0
- package/types/integrations/TouchDesignerExport.d.ts +36 -0
- package/types/integrations/Vib3React.d.ts +74 -0
- package/types/integrations/Vib3Svelte.d.ts +63 -0
- package/types/integrations/Vib3Vue.d.ts +55 -0
- package/types/integrations/index.d.ts +52 -0
- package/types/reactivity/SpatialInputSystem.d.ts +173 -0
- package/types/reactivity/index.d.ts +394 -0
- package/types/render/CommandBuffer.d.ts +169 -0
- package/types/render/RenderCommand.d.ts +312 -0
- package/types/render/RenderState.d.ts +279 -0
- package/types/render/RenderTarget.d.ts +254 -0
- package/types/render/ShaderProgram.d.ts +277 -0
- package/types/render/UnifiedRenderBridge.d.ts +143 -0
- package/types/render/WebGLBackend.d.ts +168 -0
- package/types/render/WebGPUBackend.d.ts +186 -0
- package/types/render/index.d.ts +141 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TradingCardSystemHolographic.js - Complete Holographic System for Trading Cards
|
|
3
|
+
* Extracted from monolithic TradingCardGenerator.js for better maintainability
|
|
4
|
+
*
|
|
5
|
+
* Contains:
|
|
6
|
+
* - All 8 VIB3 geometry functions (complete library)
|
|
7
|
+
* - Advanced holographic effects (moire patterns, RGB glitch)
|
|
8
|
+
* - Rich pink/magenta color effects
|
|
9
|
+
* - Role-specific parameter multipliers
|
|
10
|
+
* - Audio reactivity preparation
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export class TradingCardSystemHolographic {
|
|
14
|
+
/**
|
|
15
|
+
* Generate the complete HTML/JS code for a live holographic trading card
|
|
16
|
+
* @param {Object} state - Card state with parameters and metadata
|
|
17
|
+
* @returns {string} Complete JavaScript code for the card
|
|
18
|
+
*/
|
|
19
|
+
static generateLiveSystem(state) {
|
|
20
|
+
return `
|
|
21
|
+
// LIVE Active Holographic System - 5 Layer WebGL with Audio Reactivity
|
|
22
|
+
class LiveTradingCardSystem {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.layers = ['background', 'shadow', 'content', 'highlight', 'accent'];
|
|
25
|
+
this.visualizers = [];
|
|
26
|
+
this.params = ${JSON.stringify(state.parameters)};
|
|
27
|
+
this.startTime = Date.now();
|
|
28
|
+
|
|
29
|
+
this.initializeAllLayers();
|
|
30
|
+
this.startRenderLoop();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
initializeAllLayers() {
|
|
34
|
+
// Create 5 canvases with holographic blend modes
|
|
35
|
+
this.layers.forEach((role, index) => {
|
|
36
|
+
const canvas = document.createElement('canvas');
|
|
37
|
+
canvas.id = 'card-' + role + '-canvas';
|
|
38
|
+
canvas.style.position = 'absolute';
|
|
39
|
+
canvas.style.top = '0';
|
|
40
|
+
canvas.style.left = '0';
|
|
41
|
+
canvas.style.width = '100%';
|
|
42
|
+
canvas.style.height = '100%';
|
|
43
|
+
canvas.style.zIndex = index;
|
|
44
|
+
|
|
45
|
+
// Holographic layer blend modes for rich effects
|
|
46
|
+
if (role === 'background') {
|
|
47
|
+
canvas.style.opacity = '0.3';
|
|
48
|
+
canvas.style.mixBlendMode = 'normal';
|
|
49
|
+
} else if (role === 'shadow') {
|
|
50
|
+
canvas.style.opacity = '0.7';
|
|
51
|
+
canvas.style.mixBlendMode = 'multiply';
|
|
52
|
+
} else if (role === 'content') {
|
|
53
|
+
canvas.style.opacity = '1.0';
|
|
54
|
+
canvas.style.mixBlendMode = 'normal';
|
|
55
|
+
} else if (role === 'highlight') {
|
|
56
|
+
canvas.style.opacity = '0.9';
|
|
57
|
+
canvas.style.mixBlendMode = 'screen';
|
|
58
|
+
} else if (role === 'accent') {
|
|
59
|
+
canvas.style.opacity = '0.6';
|
|
60
|
+
canvas.style.mixBlendMode = 'color-dodge';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
document.getElementById('vib34dCanvas').parentElement.appendChild(canvas);
|
|
64
|
+
|
|
65
|
+
// Create holographic visualizer for this layer
|
|
66
|
+
const visualizer = new HolographicLayerVisualizer(canvas, role, this.params);
|
|
67
|
+
this.visualizers.push(visualizer);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Hide the original canvas
|
|
71
|
+
document.getElementById('vib34dCanvas').style.display = 'none';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
startRenderLoop() {
|
|
75
|
+
const render = () => {
|
|
76
|
+
const time = Date.now() - this.startTime;
|
|
77
|
+
this.visualizers.forEach(visualizer => {
|
|
78
|
+
visualizer.render(time);
|
|
79
|
+
});
|
|
80
|
+
requestAnimationFrame(render);
|
|
81
|
+
};
|
|
82
|
+
render();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
class HolographicLayerVisualizer {
|
|
87
|
+
constructor(canvas, role, params) {
|
|
88
|
+
this.canvas = canvas;
|
|
89
|
+
this.role = role;
|
|
90
|
+
this.params = params;
|
|
91
|
+
this.gl = canvas.getContext('webgl');
|
|
92
|
+
|
|
93
|
+
const roleParams = {
|
|
94
|
+
'background': { densityMult: 0.4, speedMult: 0.2, intensity: 0.2 },
|
|
95
|
+
'shadow': { densityMult: 0.8, speedMult: 0.3, intensity: 0.4 },
|
|
96
|
+
'content': { densityMult: 1.0, speedMult: 0.5, intensity: 0.8 },
|
|
97
|
+
'highlight': { densityMult: 1.5, speedMult: 0.8, intensity: 1.0 },
|
|
98
|
+
'accent': { densityMult: 2.0, speedMult: 0.4, intensity: 0.6 }
|
|
99
|
+
};
|
|
100
|
+
this.roleConfig = roleParams[role] || roleParams['content'];
|
|
101
|
+
|
|
102
|
+
this.initShaders();
|
|
103
|
+
this.initBuffers();
|
|
104
|
+
this.resize();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
resize() {
|
|
108
|
+
this.canvas.width = this.canvas.clientWidth;
|
|
109
|
+
this.canvas.height = this.canvas.clientHeight;
|
|
110
|
+
this.gl.viewport(0, 0, this.canvas.width, this.canvas.height);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
initShaders() {
|
|
114
|
+
const vertexShaderSource = \`
|
|
115
|
+
attribute vec2 a_position;
|
|
116
|
+
void main() {
|
|
117
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
118
|
+
}
|
|
119
|
+
\`;
|
|
120
|
+
|
|
121
|
+
// EXACT HOLOGRAPHIC FRAGMENT SHADER WITH ALL EFFECTS
|
|
122
|
+
const fragmentShaderSource = \`
|
|
123
|
+
precision highp float;
|
|
124
|
+
|
|
125
|
+
uniform vec2 u_resolution;
|
|
126
|
+
uniform float u_time;
|
|
127
|
+
uniform vec2 u_mouse;
|
|
128
|
+
uniform float u_geometry;
|
|
129
|
+
uniform float u_density;
|
|
130
|
+
uniform float u_speed;
|
|
131
|
+
uniform vec3 u_color;
|
|
132
|
+
uniform float u_intensity;
|
|
133
|
+
uniform float u_roleDensity;
|
|
134
|
+
uniform float u_roleSpeed;
|
|
135
|
+
uniform float u_geometryType;
|
|
136
|
+
uniform float u_chaos;
|
|
137
|
+
uniform float u_morph;
|
|
138
|
+
uniform float u_rot4dXW;
|
|
139
|
+
uniform float u_rot4dYW;
|
|
140
|
+
uniform float u_rot4dZW;
|
|
141
|
+
|
|
142
|
+
// 4D rotation matrices
|
|
143
|
+
mat4 rotateXW(float theta) {
|
|
144
|
+
float c = cos(theta);
|
|
145
|
+
float s = sin(theta);
|
|
146
|
+
return mat4(c, 0, 0, -s, 0, 1, 0, 0, 0, 0, 1, 0, s, 0, 0, c);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
mat4 rotateYW(float theta) {
|
|
150
|
+
float c = cos(theta);
|
|
151
|
+
float s = sin(theta);
|
|
152
|
+
return mat4(1, 0, 0, 0, 0, c, 0, -s, 0, 0, 1, 0, 0, s, 0, c);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
mat4 rotateZW(float theta) {
|
|
156
|
+
float c = cos(theta);
|
|
157
|
+
float s = sin(theta);
|
|
158
|
+
return mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, c, -s, 0, 0, s, c);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
vec3 project4Dto3D(vec4 p) {
|
|
162
|
+
float w = 2.5 / (2.5 + p.w);
|
|
163
|
+
return vec3(p.x * w, p.y * w, p.z * w);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Complete VIB3 Geometry Library
|
|
167
|
+
float tetrahedronLattice(vec3 p, float gridSize) {
|
|
168
|
+
vec3 q = fract(p * gridSize) - 0.5;
|
|
169
|
+
float d1 = length(q);
|
|
170
|
+
float d2 = length(q - vec3(0.4, 0.0, 0.0));
|
|
171
|
+
float d3 = length(q - vec3(0.0, 0.4, 0.0));
|
|
172
|
+
float d4 = length(q - vec3(0.0, 0.0, 0.4));
|
|
173
|
+
float vertices = 1.0 - smoothstep(0.0, 0.04, min(min(d1, d2), min(d3, d4)));
|
|
174
|
+
float edges = 0.0;
|
|
175
|
+
edges = max(edges, 1.0 - smoothstep(0.0, 0.02, abs(length(q.xy) - 0.2)));
|
|
176
|
+
edges = max(edges, 1.0 - smoothstep(0.0, 0.02, abs(length(q.yz) - 0.2)));
|
|
177
|
+
edges = max(edges, 1.0 - smoothstep(0.0, 0.02, abs(length(q.xz) - 0.2)));
|
|
178
|
+
return max(vertices, edges * 0.5);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
float hypercubeLattice(vec3 p, float gridSize) {
|
|
182
|
+
vec3 grid = fract(p * gridSize);
|
|
183
|
+
vec3 edges = 1.0 - smoothstep(0.0, 0.03, abs(grid - 0.5));
|
|
184
|
+
return max(max(edges.x, edges.y), edges.z);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
float sphereLattice(vec3 p, float gridSize) {
|
|
188
|
+
vec3 q = fract(p * gridSize) - 0.5;
|
|
189
|
+
float r = length(q);
|
|
190
|
+
return 1.0 - smoothstep(0.2, 0.5, r);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
float torusLattice(vec3 p, float gridSize) {
|
|
194
|
+
vec3 q = fract(p * gridSize) - 0.5;
|
|
195
|
+
float r1 = sqrt(q.x*q.x + q.y*q.y);
|
|
196
|
+
float r2 = sqrt((r1 - 0.3)*(r1 - 0.3) + q.z*q.z);
|
|
197
|
+
return 1.0 - smoothstep(0.0, 0.1, r2);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
float kleinLattice(vec3 p, float gridSize) {
|
|
201
|
+
vec3 q = fract(p * gridSize);
|
|
202
|
+
float u = q.x * 2.0 * 3.14159;
|
|
203
|
+
float v = q.y * 2.0 * 3.14159;
|
|
204
|
+
float x = cos(u) * (3.0 + cos(u/2.0) * sin(v) - sin(u/2.0) * sin(2.0*v));
|
|
205
|
+
float klein = length(vec2(x, q.z)) - 0.1;
|
|
206
|
+
return 1.0 - smoothstep(0.0, 0.05, abs(klein));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
float fractalLattice(vec3 p, float gridSize) {
|
|
210
|
+
vec3 q = p * gridSize;
|
|
211
|
+
float scale = 1.0;
|
|
212
|
+
float fractal = 0.0;
|
|
213
|
+
for(int i = 0; i < 4; i++) {
|
|
214
|
+
q = fract(q) - 0.5;
|
|
215
|
+
fractal += abs(length(q)) / scale;
|
|
216
|
+
scale *= 2.0;
|
|
217
|
+
q *= 2.0;
|
|
218
|
+
}
|
|
219
|
+
return 1.0 - smoothstep(0.0, 1.0, fractal);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
float waveLattice(vec3 p, float gridSize) {
|
|
223
|
+
vec3 q = p * gridSize;
|
|
224
|
+
float wave = sin(q.x * 2.0) * sin(q.y * 2.0) * sin(q.z * 2.0 + u_time);
|
|
225
|
+
return smoothstep(-0.5, 0.5, wave);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
float crystalLattice(vec3 p, float gridSize) {
|
|
229
|
+
vec3 q = fract(p * gridSize) - 0.5;
|
|
230
|
+
float d = max(max(abs(q.x), abs(q.y)), abs(q.z));
|
|
231
|
+
return 1.0 - smoothstep(0.3, 0.5, d);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
float getDynamicGeometry(vec3 p, float gridSize, float geometryType) {
|
|
235
|
+
int baseGeom = int(mod(geometryType, 8.0));
|
|
236
|
+
float variation = floor(geometryType / 8.0) / 4.0;
|
|
237
|
+
float variedGridSize = gridSize * (0.5 + variation * 1.5);
|
|
238
|
+
|
|
239
|
+
if (baseGeom == 0) return tetrahedronLattice(p, variedGridSize);
|
|
240
|
+
else if (baseGeom == 1) return hypercubeLattice(p, variedGridSize);
|
|
241
|
+
else if (baseGeom == 2) return sphereLattice(p, variedGridSize);
|
|
242
|
+
else if (baseGeom == 3) return torusLattice(p, variedGridSize);
|
|
243
|
+
else if (baseGeom == 4) return kleinLattice(p, variedGridSize);
|
|
244
|
+
else if (baseGeom == 5) return fractalLattice(p, variedGridSize);
|
|
245
|
+
else if (baseGeom == 6) return waveLattice(p, variedGridSize);
|
|
246
|
+
else return crystalLattice(p, variedGridSize);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
vec3 rgbGlitch(vec3 color, vec2 uv, float intensity) {
|
|
250
|
+
vec2 offset = vec2(intensity * 0.005, 0.0);
|
|
251
|
+
float r = color.r + sin(uv.y * 30.0 + u_time * 0.001) * intensity * 0.06;
|
|
252
|
+
float g = color.g + sin(uv.y * 28.0 + u_time * 0.0012) * intensity * 0.06;
|
|
253
|
+
float b = color.b + sin(uv.y * 32.0 + u_time * 0.0008) * intensity * 0.06;
|
|
254
|
+
return vec3(r, g, b);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
float moirePattern(vec2 uv, float intensity) {
|
|
258
|
+
float freq1 = 12.0 + intensity * 6.0;
|
|
259
|
+
float freq2 = 14.0 + intensity * 8.0;
|
|
260
|
+
float pattern1 = sin(uv.x * freq1) * sin(uv.y * freq1);
|
|
261
|
+
float pattern2 = sin(uv.x * freq2) * sin(uv.y * freq2);
|
|
262
|
+
return (pattern1 * pattern2) * intensity * 0.15;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
void main() {
|
|
266
|
+
vec2 uv = gl_FragCoord.xy / u_resolution.xy;
|
|
267
|
+
float aspectRatio = u_resolution.x / u_resolution.y;
|
|
268
|
+
uv.x *= aspectRatio;
|
|
269
|
+
uv -= 0.5;
|
|
270
|
+
|
|
271
|
+
float time = u_time * 0.0004 * u_speed * u_roleSpeed;
|
|
272
|
+
|
|
273
|
+
vec4 p4d = vec4(uv * 3.0, sin(time * 0.1) * 0.15, cos(time * 0.08) * 0.15);
|
|
274
|
+
|
|
275
|
+
p4d = rotateXW(u_rot4dXW + time * 0.2) * p4d;
|
|
276
|
+
p4d = rotateYW(u_rot4dYW + time * 0.15) * p4d;
|
|
277
|
+
p4d = rotateZW(u_rot4dZW + time * 0.25) * p4d;
|
|
278
|
+
|
|
279
|
+
vec3 p = project4Dto3D(p4d);
|
|
280
|
+
|
|
281
|
+
float roleDensity = u_density * u_roleDensity;
|
|
282
|
+
float morphedGeometry = u_geometryType + u_morph * 3.0;
|
|
283
|
+
float lattice = getDynamicGeometry(p, roleDensity, morphedGeometry);
|
|
284
|
+
|
|
285
|
+
vec3 baseColor = u_color;
|
|
286
|
+
float latticeIntensity = lattice * u_intensity;
|
|
287
|
+
|
|
288
|
+
vec3 color = baseColor * (0.3 + latticeIntensity * 0.7);
|
|
289
|
+
color += vec3(lattice * 0.4) * baseColor;
|
|
290
|
+
|
|
291
|
+
// Add holographic effects
|
|
292
|
+
color += vec3(moirePattern(uv, u_chaos));
|
|
293
|
+
color = rgbGlitch(color, uv, u_chaos);
|
|
294
|
+
|
|
295
|
+
gl_FragColor = vec4(color, 0.95);
|
|
296
|
+
}
|
|
297
|
+
\`;
|
|
298
|
+
|
|
299
|
+
this.program = this.createProgram(vertexShaderSource, fragmentShaderSource);
|
|
300
|
+
this.uniforms = {
|
|
301
|
+
resolution: this.gl.getUniformLocation(this.program, 'u_resolution'),
|
|
302
|
+
time: this.gl.getUniformLocation(this.program, 'u_time'),
|
|
303
|
+
mouse: this.gl.getUniformLocation(this.program, 'u_mouse'),
|
|
304
|
+
geometry: this.gl.getUniformLocation(this.program, 'u_geometry'),
|
|
305
|
+
density: this.gl.getUniformLocation(this.program, 'u_density'),
|
|
306
|
+
speed: this.gl.getUniformLocation(this.program, 'u_speed'),
|
|
307
|
+
color: this.gl.getUniformLocation(this.program, 'u_color'),
|
|
308
|
+
intensity: this.gl.getUniformLocation(this.program, 'u_intensity'),
|
|
309
|
+
roleDensity: this.gl.getUniformLocation(this.program, 'u_roleDensity'),
|
|
310
|
+
roleSpeed: this.gl.getUniformLocation(this.program, 'u_roleSpeed'),
|
|
311
|
+
geometryType: this.gl.getUniformLocation(this.program, 'u_geometryType'),
|
|
312
|
+
chaos: this.gl.getUniformLocation(this.program, 'u_chaos'),
|
|
313
|
+
morph: this.gl.getUniformLocation(this.program, 'u_morph'),
|
|
314
|
+
rot4dXW: this.gl.getUniformLocation(this.program, 'u_rot4dXW'),
|
|
315
|
+
rot4dYW: this.gl.getUniformLocation(this.program, 'u_rot4dYW'),
|
|
316
|
+
rot4dZW: this.gl.getUniformLocation(this.program, 'u_rot4dZW')
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
createProgram(vertexSource, fragmentSource) {
|
|
321
|
+
const vertexShader = this.createShader(this.gl.VERTEX_SHADER, vertexSource);
|
|
322
|
+
const fragmentShader = this.createShader(this.gl.FRAGMENT_SHADER, fragmentSource);
|
|
323
|
+
|
|
324
|
+
if (!vertexShader || !fragmentShader) return null;
|
|
325
|
+
|
|
326
|
+
const program = this.gl.createProgram();
|
|
327
|
+
this.gl.attachShader(program, vertexShader);
|
|
328
|
+
this.gl.attachShader(program, fragmentShader);
|
|
329
|
+
this.gl.linkProgram(program);
|
|
330
|
+
|
|
331
|
+
if (!this.gl.getProgramParameter(program, this.gl.LINK_STATUS)) {
|
|
332
|
+
console.error('Holographic program linking failed:', this.gl.getProgramInfoLog(program));
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return program;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
createShader(type, source) {
|
|
340
|
+
const shader = this.gl.createShader(type);
|
|
341
|
+
this.gl.shaderSource(shader, source);
|
|
342
|
+
this.gl.compileShader(shader);
|
|
343
|
+
|
|
344
|
+
if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS)) {
|
|
345
|
+
console.error('Holographic shader compilation failed:', this.gl.getShaderInfoLog(shader));
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return shader;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
initBuffers() {
|
|
353
|
+
const positions = new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]);
|
|
354
|
+
this.buffer = this.gl.createBuffer();
|
|
355
|
+
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.buffer);
|
|
356
|
+
this.gl.bufferData(this.gl.ARRAY_BUFFER, positions, this.gl.STATIC_DRAW);
|
|
357
|
+
|
|
358
|
+
const positionLocation = this.gl.getAttribLocation(this.program, 'a_position');
|
|
359
|
+
this.gl.enableVertexAttribArray(positionLocation);
|
|
360
|
+
this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, false, 0, 0);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
render(time) {
|
|
364
|
+
if (!this.program) return;
|
|
365
|
+
|
|
366
|
+
this.resize();
|
|
367
|
+
this.gl.useProgram(this.program);
|
|
368
|
+
|
|
369
|
+
// Calculate holographic color (rich pink/magenta)
|
|
370
|
+
const hue = this.params.hue || 320; // Rich magenta default
|
|
371
|
+
const sat = this.params.saturation || 0.9;
|
|
372
|
+
const intensity = (this.params.intensity || 0.8) * this.roleConfig.intensity;
|
|
373
|
+
|
|
374
|
+
// Convert HSV to RGB for holographic colors
|
|
375
|
+
const h = hue / 60.0;
|
|
376
|
+
const c = sat * intensity;
|
|
377
|
+
const x = c * (1 - Math.abs((h % 2) - 1));
|
|
378
|
+
const m = intensity - c;
|
|
379
|
+
let rgb = [0, 0, 0];
|
|
380
|
+
|
|
381
|
+
if (h < 1) rgb = [c, x, 0];
|
|
382
|
+
else if (h < 2) rgb = [x, c, 0];
|
|
383
|
+
else if (h < 3) rgb = [0, c, x];
|
|
384
|
+
else if (h < 4) rgb = [0, x, c];
|
|
385
|
+
else if (h < 5) rgb = [x, 0, c];
|
|
386
|
+
else rgb = [c, 0, x];
|
|
387
|
+
|
|
388
|
+
const finalColor = [rgb[0] + m, rgb[1] + m, rgb[2] + m];
|
|
389
|
+
|
|
390
|
+
this.gl.uniform2f(this.uniforms.resolution, this.canvas.width, this.canvas.height);
|
|
391
|
+
this.gl.uniform1f(this.uniforms.time, time);
|
|
392
|
+
this.gl.uniform2f(this.uniforms.mouse, 0.5, 0.5);
|
|
393
|
+
this.gl.uniform1f(this.uniforms.geometry, this.params.geometry || 0);
|
|
394
|
+
this.gl.uniform1f(this.uniforms.density, (this.params.gridDensity || 15) * 0.08 * this.roleConfig.densityMult);
|
|
395
|
+
this.gl.uniform1f(this.uniforms.speed, (this.params.speed || 1.0) * this.roleConfig.speedMult);
|
|
396
|
+
this.gl.uniform3f(this.uniforms.color, finalColor[0], finalColor[1], finalColor[2]);
|
|
397
|
+
this.gl.uniform1f(this.uniforms.intensity, intensity);
|
|
398
|
+
this.gl.uniform1f(this.uniforms.roleDensity, this.roleConfig.densityMult);
|
|
399
|
+
this.gl.uniform1f(this.uniforms.roleSpeed, this.roleConfig.speedMult);
|
|
400
|
+
this.gl.uniform1f(this.uniforms.geometryType, this.params.geometry || 0);
|
|
401
|
+
this.gl.uniform1f(this.uniforms.chaos, this.params.chaos || 0.2);
|
|
402
|
+
this.gl.uniform1f(this.uniforms.morph, this.params.morphFactor || 1.0);
|
|
403
|
+
this.gl.uniform1f(this.uniforms.rot4dXW, this.params.rot4dXW || 0.0);
|
|
404
|
+
this.gl.uniform1f(this.uniforms.rot4dYW, this.params.rot4dYW || 0.0);
|
|
405
|
+
this.gl.uniform1f(this.uniforms.rot4dZW, this.params.rot4dZW || 0.0);
|
|
406
|
+
|
|
407
|
+
this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Enhanced interactivity system for Holographic cards
|
|
412
|
+
const canvas = document.getElementById('vib34dCanvas');
|
|
413
|
+
if (!canvas) {
|
|
414
|
+
console.error('Canvas not found for holographic interactivity');
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
let mouseX = 0.5, mouseY = 0.5, mouseIntensity = 0.0;
|
|
419
|
+
let clickIntensity = 0.0;
|
|
420
|
+
|
|
421
|
+
canvas.addEventListener('mousemove', (e) => {
|
|
422
|
+
const rect = canvas.getBoundingClientRect();
|
|
423
|
+
mouseX = (e.clientX - rect.left) / rect.width;
|
|
424
|
+
mouseY = 1.0 - (e.clientY - rect.top) / rect.height;
|
|
425
|
+
mouseIntensity = Math.min(1.0, Math.sqrt(e.movementX*e.movementX + e.movementY*e.movementY) / 40);
|
|
426
|
+
|
|
427
|
+
// Future: Update holographic visualizers with mouse data
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
canvas.addEventListener('dblclick', async () => {
|
|
431
|
+
console.log('🌈 Holographic card audio reactivity - Coming soon!');
|
|
432
|
+
canvas.style.border = '2px solid #ff64ff';
|
|
433
|
+
setTimeout(() => { canvas.style.border = ''; }, 2000);
|
|
434
|
+
});`;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Get system metadata for the holographic system
|
|
439
|
+
*/
|
|
440
|
+
static getSystemInfo() {
|
|
441
|
+
return {
|
|
442
|
+
name: 'Holographic',
|
|
443
|
+
type: 'holographic',
|
|
444
|
+
description: 'Rich holographic effects with complete VIB3 geometry library and audio reactivity',
|
|
445
|
+
features: ['All 8 VIB3 geometries', 'Holographic effects', 'Moire patterns', 'RGB glitch', 'Audio reactive'],
|
|
446
|
+
shaderComplexity: 'very high',
|
|
447
|
+
layers: 5,
|
|
448
|
+
defaultHue: 320,
|
|
449
|
+
specialEffects: ['moirePattern', 'rgbGlitch', 'getDynamicGeometry', 'audioReactivity']
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
}
|