@vib3code/sdk 2.0.3-canary.91a95f3 → 2.0.3-canary.98b84da
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/DOCS/AGENT_HARNESS_ARCHITECTURE.md +2 -0
- package/DOCS/ANDROID_DEPLOYMENT.md +59 -0
- package/DOCS/ARCHITECTURE.md +1 -0
- package/DOCS/CI_TESTING.md +2 -0
- package/DOCS/CLI_ONBOARDING.md +2 -0
- package/DOCS/CONTROL_REFERENCE.md +2 -0
- package/DOCS/CROSS_SITE_DESIGN_PATTERNS.md +2 -0
- package/DOCS/ENV_SETUP.md +2 -0
- package/DOCS/EPIC_SCROLL_EVENTS.md +2 -0
- package/DOCS/EXPANSION_DESIGN.md +979 -0
- package/DOCS/EXPANSION_DESIGN_ULTRA.md +389 -0
- package/DOCS/EXPORT_FORMATS.md +2 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +2 -0
- package/DOCS/HANDOFF_LANDING_PAGE.md +2 -0
- package/DOCS/HANDOFF_SDK_DEVELOPMENT.md +2 -0
- package/DOCS/LICENSING_TIERS.md +2 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +4 -2
- package/DOCS/MULTIVIZ_CHOREOGRAPHY_PATTERNS.md +3 -1
- package/DOCS/OBS_SETUP_GUIDE.md +2 -0
- package/DOCS/OPTIMIZATION_PLAN_MATH.md +119 -0
- package/DOCS/PRODUCT_STRATEGY.md +2 -0
- package/DOCS/PROJECT_SETUP.md +2 -0
- package/DOCS/README.md +5 -3
- package/DOCS/REFERENCE_SCROLL_ANALYSIS.md +2 -0
- package/DOCS/RENDERER_LIFECYCLE.md +2 -0
- package/DOCS/REPO_MANIFEST.md +2 -0
- package/DOCS/ROADMAP.md +2 -0
- package/DOCS/SCROLL_TIMELINE_v3.md +2 -0
- package/DOCS/SITE_REFACTOR_PLAN.md +2 -0
- package/DOCS/STATUS.md +2 -0
- package/DOCS/SYSTEM_INVENTORY.md +4 -2
- package/DOCS/TELEMETRY_EXPORTS.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_CLICKERSS.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_FACETAD.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_SIMONE.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_TABLESIDE.md +2 -0
- package/DOCS/WEBGPU_STATUS.md +121 -38
- package/DOCS/XR_BENCHMARKS.md +2 -0
- package/DOCS/archive/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +1 -34
- package/DOCS/archive/DEV_TRACK_ANALYSIS.md +1 -80
- package/DOCS/archive/DEV_TRACK_PLAN_2026-01-07.md +1 -42
- package/DOCS/archive/SESSION_014_PLAN.md +1 -195
- package/DOCS/archive/SESSION_LOG_2026-01-07.md +1 -56
- package/DOCS/archive/STRATEGIC_BLUEPRINT_2026-01-07.md +1 -72
- package/DOCS/archive/SYSTEM_AUDIT_2026-01-30.md +1 -741
- package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +1 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-01-31.md +2 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-06.md +2 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-13.md +15 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-15.md +144 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-16.md +110 -0
- package/DOCS/dev-tracks/PERF_UPGRADE_2026-02-16.md +310 -0
- package/DOCS/dev-tracks/README.md +2 -0
- package/docs/webgpu-live.html +1 -1
- package/package.json +11 -4
- package/src/agent/index.js +1 -3
- package/src/agent/mcp/MCPServer.js +542 -188
- package/src/agent/mcp/index.js +1 -1
- package/src/agent/mcp/tools.js +132 -32
- package/src/cli/index.js +431 -47
- package/src/core/VIB3Engine.js +55 -3
- package/src/core/index.js +18 -0
- package/src/core/renderers/FacetedRendererAdapter.js +10 -9
- package/src/core/renderers/HolographicRendererAdapter.js +11 -7
- package/src/core/renderers/QuantumRendererAdapter.js +11 -7
- package/src/creative/index.js +11 -0
- package/src/experimental/GameLoop.js +72 -0
- package/src/experimental/LatticePhysics.js +100 -0
- package/src/experimental/LiveDirector.js +143 -0
- package/src/experimental/PlayerController4D.js +154 -0
- package/src/experimental/VIB3Actor.js +138 -0
- package/src/experimental/VIB3Compositor.js +117 -0
- package/src/experimental/VIB3Link.js +122 -0
- package/src/experimental/VIB3Orchestrator.js +146 -0
- package/src/experimental/VIB3Universe.js +109 -0
- package/src/experimental/demos/CrystalLabyrinth.js +202 -0
- package/src/export/SVGExporter.js +9 -5
- package/src/export/index.js +11 -1
- package/src/faceted/FacetedSystem.js +27 -10
- package/src/games/glyph-war/GlyphWarVisualizer.js +641 -0
- package/src/geometry/generators/Crystal.js +2 -2
- package/src/geometry/warp/HypersphereCore.js +53 -24
- package/src/holograms/HolographicVisualizer.js +58 -89
- package/src/holograms/RealHolographicSystem.js +126 -31
- package/src/math/Mat4x4.js +372 -140
- package/src/math/Projection.js +39 -4
- package/src/math/Rotor4D.js +157 -67
- package/src/math/Vec4.js +265 -111
- package/src/math/index.js +7 -7
- package/src/quantum/QuantumVisualizer.js +24 -20
- package/src/reactivity/index.js +3 -5
- package/src/render/LayerPresetManager.js +372 -0
- package/src/render/LayerReactivityBridge.js +344 -0
- package/src/render/LayerRelationshipGraph.js +610 -0
- package/src/render/MultiCanvasBridge.js +148 -25
- package/src/render/ShaderLoader.js +38 -0
- package/src/render/ShaderProgram.js +4 -4
- package/src/render/UnifiedRenderBridge.js +1 -1
- package/src/render/backends/WebGPUBackend.js +8 -4
- package/src/render/index.js +27 -2
- package/src/scene/Node4D.js +74 -24
- package/src/scene/index.js +4 -4
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +4 -4
- package/src/shaders/common/rotation4d.wgsl +2 -2
- package/src/shaders/common/uniforms.wgsl +15 -8
- package/src/shaders/faceted/faceted.frag.wgsl +19 -6
- package/src/shaders/holographic/holographic.frag.wgsl +7 -5
- package/src/shaders/quantum/quantum.frag.wgsl +7 -5
- package/src/testing/ParallelTestFramework.js +2 -2
- package/src/testing/ProjectionClass.test.js +38 -0
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +2 -2
- package/src/viewer/GalleryUI.js +17 -0
- package/src/viewer/ViewerPortal.js +2 -2
- package/tools/shader-sync-verify.js +6 -4
- package/tools/update_projection.py +109 -0
- package/types/adaptive-sdk.d.ts +204 -5
- package/types/agent/cli.d.ts +78 -0
- package/types/agent/index.d.ts +18 -0
- package/types/agent/mcp.d.ts +87 -0
- package/types/agent/telemetry.d.ts +190 -0
- package/types/core/VIB3Engine.d.ts +26 -0
- package/types/core/index.d.ts +261 -0
- package/types/creative/AestheticMapper.d.ts +72 -0
- package/types/creative/ChoreographyPlayer.d.ts +96 -0
- package/types/creative/index.d.ts +17 -0
- package/types/export/index.d.ts +243 -0
- package/types/geometry/index.d.ts +164 -0
- package/types/math/index.d.ts +214 -0
- package/types/render/LayerPresetManager.d.ts +78 -0
- package/types/render/LayerReactivityBridge.d.ts +85 -0
- package/types/render/LayerRelationshipGraph.d.ts +174 -0
- package/types/render/index.d.ts +3 -0
- package/types/scene/index.d.ts +204 -0
- package/types/systems/index.d.ts +244 -0
- package/types/variations/index.d.ts +62 -0
- package/types/viewer/index.d.ts +225 -0
|
@@ -16,13 +16,14 @@ import { Vec4 } from '../../math/Vec4.js';
|
|
|
16
16
|
* @param {number} radius - Hypersphere radius
|
|
17
17
|
* @returns {Vec4} Point on hypersphere
|
|
18
18
|
*/
|
|
19
|
-
export function projectToHypersphere(point, radius = 1) {
|
|
19
|
+
export function projectToHypersphere(point, radius = 1, target = null) {
|
|
20
20
|
const len = point.length();
|
|
21
21
|
if (len < 0.0001) {
|
|
22
22
|
// Handle origin - project to north pole
|
|
23
|
+
if (target) return target.set(0, 0, 0, radius);
|
|
23
24
|
return new Vec4(0, 0, 0, radius);
|
|
24
25
|
}
|
|
25
|
-
return point.scale(radius / len);
|
|
26
|
+
return point.scale(radius / len, target);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -30,9 +31,10 @@ export function projectToHypersphere(point, radius = 1) {
|
|
|
30
31
|
* Maps all of 3D space onto the 4D hypersphere
|
|
31
32
|
* @param {Vec4} point - Input point (uses x, y, z)
|
|
32
33
|
* @param {number} radius - Hypersphere radius
|
|
34
|
+
* @param {Vec4} [target=null] - Optional target vector
|
|
33
35
|
* @returns {Vec4} Point on hypersphere
|
|
34
36
|
*/
|
|
35
|
-
export function stereographicToHypersphere(point, radius = 1) {
|
|
37
|
+
export function stereographicToHypersphere(point, radius = 1, target = null) {
|
|
36
38
|
const x = point.x;
|
|
37
39
|
const y = point.y;
|
|
38
40
|
const z = point.z;
|
|
@@ -40,6 +42,15 @@ export function stereographicToHypersphere(point, radius = 1) {
|
|
|
40
42
|
const sumSq = x * x + y * y + z * z;
|
|
41
43
|
const denom = sumSq + 1;
|
|
42
44
|
|
|
45
|
+
if (target) {
|
|
46
|
+
return target.set(
|
|
47
|
+
(2 * x) / denom * radius,
|
|
48
|
+
(2 * y) / denom * radius,
|
|
49
|
+
(2 * z) / denom * radius,
|
|
50
|
+
(sumSq - 1) / denom * radius
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
return new Vec4(
|
|
44
55
|
(2 * x) / denom * radius,
|
|
45
56
|
(2 * y) / denom * radius,
|
|
@@ -56,12 +67,22 @@ export function stereographicToHypersphere(point, radius = 1) {
|
|
|
56
67
|
* @param {number} phi - Azimuth on base S² (0 to 2π)
|
|
57
68
|
* @param {number} psi - Fiber angle (0 to 2π)
|
|
58
69
|
* @param {number} radius - Hypersphere radius
|
|
70
|
+
* @param {Vec4} [target=null] - Optional target vector
|
|
59
71
|
* @returns {Vec4} Point on hypersphere
|
|
60
72
|
*/
|
|
61
|
-
export function hopfFibration(theta, phi, psi, radius = 1) {
|
|
73
|
+
export function hopfFibration(theta, phi, psi, radius = 1, target = null) {
|
|
62
74
|
const cosTheta2 = Math.cos(theta / 2);
|
|
63
75
|
const sinTheta2 = Math.sin(theta / 2);
|
|
64
76
|
|
|
77
|
+
if (target) {
|
|
78
|
+
return target.set(
|
|
79
|
+
cosTheta2 * Math.cos((phi + psi) / 2) * radius,
|
|
80
|
+
cosTheta2 * Math.sin((phi + psi) / 2) * radius,
|
|
81
|
+
sinTheta2 * Math.cos((phi - psi) / 2) * radius,
|
|
82
|
+
sinTheta2 * Math.sin((phi - psi) / 2) * radius
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
65
86
|
return new Vec4(
|
|
66
87
|
cosTheta2 * Math.cos((phi + psi) / 2) * radius,
|
|
67
88
|
cosTheta2 * Math.sin((phi + psi) / 2) * radius,
|
|
@@ -78,8 +99,9 @@ export function hopfFibration(theta, phi, psi, radius = 1) {
|
|
|
78
99
|
* @returns {Vec4[]} Warped vertices
|
|
79
100
|
*/
|
|
80
101
|
export function warpRadial(vertices, radius = 1, blendFactor = 1) {
|
|
102
|
+
const onSphere = new Vec4();
|
|
81
103
|
return vertices.map(v => {
|
|
82
|
-
|
|
104
|
+
projectToHypersphere(v, radius, onSphere);
|
|
83
105
|
return v.lerp(onSphere, blendFactor);
|
|
84
106
|
});
|
|
85
107
|
}
|
|
@@ -93,8 +115,9 @@ export function warpRadial(vertices, radius = 1, blendFactor = 1) {
|
|
|
93
115
|
* @returns {Vec4[]} Warped vertices
|
|
94
116
|
*/
|
|
95
117
|
export function warpStereographic(vertices, radius = 1, scale = 1) {
|
|
118
|
+
const scaled = new Vec4();
|
|
96
119
|
return vertices.map(v => {
|
|
97
|
-
|
|
120
|
+
v.scale(scale, scaled);
|
|
98
121
|
return stereographicToHypersphere(scaled, radius);
|
|
99
122
|
});
|
|
100
123
|
}
|
|
@@ -146,25 +169,31 @@ export function warpHypersphereCore(geometry, options = {}) {
|
|
|
146
169
|
twist = 1
|
|
147
170
|
} = options;
|
|
148
171
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
const temp = new Vec4();
|
|
173
|
+
const warpedVertices = geometry.vertices.map(v => {
|
|
174
|
+
// Combined scaling and warping to minimize allocations
|
|
175
|
+
const result = v.scale(scale);
|
|
176
|
+
|
|
177
|
+
if (method === 'stereographic') {
|
|
178
|
+
stereographicToHypersphere(result, radius, result);
|
|
179
|
+
} else if (method === 'hopf') {
|
|
180
|
+
const r = result.length();
|
|
181
|
+
if (r < 0.0001) {
|
|
182
|
+
result.set(0, 0, 0, radius);
|
|
183
|
+
} else {
|
|
184
|
+
const theta = Math.acos(result.z / r);
|
|
185
|
+
const phi = Math.atan2(result.y, result.x);
|
|
186
|
+
const psi = result.w * twist + phi * 0.5;
|
|
187
|
+
hopfFibration(theta, phi, psi, radius, result);
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
// Radial (default)
|
|
191
|
+
projectToHypersphere(result, radius, temp);
|
|
192
|
+
result.lerp(temp, blend, result);
|
|
193
|
+
}
|
|
162
194
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
warpedVertices = warpRadial(scaledVertices, radius, blend);
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
195
|
+
return result;
|
|
196
|
+
});
|
|
168
197
|
|
|
169
198
|
return {
|
|
170
199
|
...geometry,
|
|
@@ -132,28 +132,28 @@ export class HolographicVisualizer {
|
|
|
132
132
|
const finalName = geometryName + suffixes[variationLevel];
|
|
133
133
|
|
|
134
134
|
const geometryConfigs = {
|
|
135
|
-
0: {
|
|
136
|
-
1: {
|
|
137
|
-
2: {
|
|
138
|
-
3: {
|
|
139
|
-
4: {
|
|
140
|
-
5: {
|
|
141
|
-
6: {
|
|
142
|
-
7: {
|
|
135
|
+
0: { gridDensity: 0.8 + variationLevel * 0.2, speed: 0.3 + variationLevel * 0.1, chaos: variationLevel * 0.1, morphFactor: 0.0 + variationLevel * 0.2 },
|
|
136
|
+
1: { gridDensity: 1.0 + variationLevel * 0.3, speed: 0.5 + variationLevel * 0.1, chaos: variationLevel * 0.15, morphFactor: variationLevel * 0.2 },
|
|
137
|
+
2: { gridDensity: 1.2 + variationLevel * 0.4, speed: 0.4 + variationLevel * 0.2, chaos: 0.1 + variationLevel * 0.1, morphFactor: 0.3 + variationLevel * 0.2 },
|
|
138
|
+
3: { gridDensity: 0.9 + variationLevel * 0.3, speed: 0.6 + variationLevel * 0.2, chaos: 0.2 + variationLevel * 0.2, morphFactor: 0.5 + variationLevel * 0.1 },
|
|
139
|
+
4: { gridDensity: 1.4 + variationLevel * 0.5, speed: 0.7 + variationLevel * 0.1, chaos: 0.3 + variationLevel * 0.2, morphFactor: 0.7 + variationLevel * 0.1 },
|
|
140
|
+
5: { gridDensity: 1.8 + variationLevel * 0.3, speed: 0.5 + variationLevel * 0.3, chaos: 0.5 + variationLevel * 0.2, morphFactor: 0.8 + variationLevel * 0.05 },
|
|
141
|
+
6: { gridDensity: 0.6 + variationLevel * 0.4, speed: 0.8 + variationLevel * 0.4, chaos: 0.4 + variationLevel * 0.3, morphFactor: 0.6 + variationLevel * 0.2 },
|
|
142
|
+
7: { gridDensity: 1.6 + variationLevel * 0.2, speed: 0.2 + variationLevel * 0.1, chaos: 0.1 + variationLevel * 0.1, morphFactor: 0.2 + variationLevel * 0.2 }
|
|
143
143
|
};
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
const config = geometryConfigs[baseGeometry];
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
return {
|
|
148
|
-
|
|
148
|
+
geometry: baseGeometry,
|
|
149
149
|
name: finalName,
|
|
150
|
-
|
|
150
|
+
gridDensity: config.gridDensity,
|
|
151
151
|
speed: config.speed,
|
|
152
152
|
hue: (variant * 12.27) % 360,
|
|
153
|
-
saturation: 0.8 + (variationLevel * 0.05),
|
|
153
|
+
saturation: 0.8 + (variationLevel * 0.05),
|
|
154
154
|
intensity: 0.5 + (variationLevel * 0.1),
|
|
155
155
|
chaos: config.chaos,
|
|
156
|
-
|
|
156
|
+
morphFactor: config.morphFactor
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -169,20 +169,20 @@ export class HolographicVisualizer {
|
|
|
169
169
|
densityMult: 0.8, speedMult: 0.3, colorShift: 180.0, intensity: 0.4,
|
|
170
170
|
mouseReactivity: 0.5, clickReactivity: 0.3
|
|
171
171
|
},
|
|
172
|
-
'content': {
|
|
173
|
-
densityMult: vp.
|
|
172
|
+
'content': {
|
|
173
|
+
densityMult: vp.gridDensity, speedMult: vp.speed,
|
|
174
174
|
colorShift: vp.hue, intensity: vp.intensity,
|
|
175
|
-
mouseReactivity: 1.0, clickReactivity: 0.8
|
|
175
|
+
mouseReactivity: 1.0, clickReactivity: 0.8
|
|
176
176
|
},
|
|
177
|
-
'highlight': {
|
|
178
|
-
densityMult: 1.5 + (vp.
|
|
177
|
+
'highlight': {
|
|
178
|
+
densityMult: 1.5 + (vp.gridDensity * 0.3), speedMult: 0.8 + (vp.speed * 0.2),
|
|
179
179
|
colorShift: vp.hue + 60.0, intensity: 0.6 + (vp.intensity * 0.2),
|
|
180
|
-
mouseReactivity: 1.2, clickReactivity: 1.0
|
|
180
|
+
mouseReactivity: 1.2, clickReactivity: 1.0
|
|
181
181
|
},
|
|
182
|
-
'accent': {
|
|
183
|
-
densityMult: 2.5 + (vp.
|
|
182
|
+
'accent': {
|
|
183
|
+
densityMult: 2.5 + (vp.gridDensity * 0.5), speedMult: 0.4 + (vp.speed * 0.1),
|
|
184
184
|
colorShift: vp.hue + 300.0, intensity: 0.3 + (vp.intensity * 0.1),
|
|
185
|
-
mouseReactivity: 1.5, clickReactivity: 1.2
|
|
185
|
+
mouseReactivity: 1.5, clickReactivity: 1.2
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -207,7 +207,7 @@ export class HolographicVisualizer {
|
|
|
207
207
|
uniform float u_time;
|
|
208
208
|
uniform vec2 u_mouse;
|
|
209
209
|
uniform float u_geometry;
|
|
210
|
-
uniform float
|
|
210
|
+
uniform float u_gridDensity;
|
|
211
211
|
uniform float u_speed;
|
|
212
212
|
uniform vec3 u_color;
|
|
213
213
|
uniform float u_intensity;
|
|
@@ -218,9 +218,8 @@ export class HolographicVisualizer {
|
|
|
218
218
|
uniform float u_mouseIntensity;
|
|
219
219
|
uniform float u_clickIntensity;
|
|
220
220
|
uniform float u_densityVariation;
|
|
221
|
-
uniform float u_geometryType;
|
|
222
221
|
uniform float u_chaos;
|
|
223
|
-
uniform float
|
|
222
|
+
uniform float u_morphFactor;
|
|
224
223
|
uniform float u_touchMorph;
|
|
225
224
|
uniform float u_touchChaos;
|
|
226
225
|
uniform float u_scrollParallax;
|
|
@@ -293,7 +292,7 @@ export class HolographicVisualizer {
|
|
|
293
292
|
// ========================================
|
|
294
293
|
vec3 warpHypersphereCore(vec3 p, int geometryIndex, vec2 mouseDelta) {
|
|
295
294
|
float radius = length(p);
|
|
296
|
-
float morphBlend = clamp(
|
|
295
|
+
float morphBlend = clamp(u_morphFactor * 0.6 + 0.3, 0.0, 2.0);
|
|
297
296
|
float w = sin(radius * (1.3 + float(geometryIndex) * 0.12) + u_time * 0.0008 * u_speed);
|
|
298
297
|
w *= (0.4 + morphBlend * 0.45);
|
|
299
298
|
|
|
@@ -315,7 +314,7 @@ export class HolographicVisualizer {
|
|
|
315
314
|
vec3 c3 = normalize(vec3(-1.0, 1.0, -1.0));
|
|
316
315
|
vec3 c4 = normalize(vec3(1.0, -1.0, -1.0));
|
|
317
316
|
|
|
318
|
-
float morphBlend = clamp(
|
|
317
|
+
float morphBlend = clamp(u_morphFactor * 0.8 + 0.2, 0.0, 2.0);
|
|
319
318
|
float basisMix = dot(p, c1) * 0.14 + dot(p, c2) * 0.1 + dot(p, c3) * 0.08;
|
|
320
319
|
float w = sin(basisMix * 5.5 + u_time * 0.0009 * u_speed);
|
|
321
320
|
w *= cos(dot(p, c4) * 4.2 - u_time * 0.0007 * u_speed);
|
|
@@ -551,12 +550,12 @@ export class HolographicVisualizer {
|
|
|
551
550
|
float audioDensityMod = 1.0 + u_audioDensityBoost * 0.5;
|
|
552
551
|
// Controlled density calculation - breathing modulation added
|
|
553
552
|
float breathDensityMod = 1.0 + u_breath * 0.1;
|
|
554
|
-
float baseDensity =
|
|
553
|
+
float baseDensity = u_gridDensity * u_roleDensity * breathDensityMod;
|
|
555
554
|
|
|
556
555
|
float densityVariations = (u_densityVariation * 0.3 + (scrollDensityMod - 1.0) * 0.4 + (audioDensityMod - 1.0) * 0.2);
|
|
557
556
|
float roleDensity = baseDensity + densityVariations;
|
|
558
557
|
|
|
559
|
-
float morphedGeometry =
|
|
558
|
+
float morphedGeometry = u_geometry + u_morphFactor * 3.0 + u_touchMorph * 2.0 + u_audioMorphBoost * 1.5;
|
|
560
559
|
float lattice = getDynamicGeometry(p, roleDensity, morphedGeometry);
|
|
561
560
|
|
|
562
561
|
// Enhanced holographic color processing
|
|
@@ -590,9 +589,9 @@ export class HolographicVisualizer {
|
|
|
590
589
|
color = rgbGlitch(color, uv, enhancedChaos);
|
|
591
590
|
|
|
592
591
|
// Apply morph distortion to position
|
|
593
|
-
vec2 morphDistortion = vec2(sin(uv.y * 10.0 + u_time * 0.001) *
|
|
594
|
-
cos(uv.x * 10.0 + u_time * 0.001) *
|
|
595
|
-
color = mix(color, color * (1.0 + length(morphDistortion)),
|
|
592
|
+
vec2 morphDistortion = vec2(sin(uv.y * 10.0 + u_time * 0.001) * u_morphFactor * 0.1,
|
|
593
|
+
cos(uv.x * 10.0 + u_time * 0.001) * u_morphFactor * 0.1);
|
|
594
|
+
color = mix(color, color * (1.0 + length(morphDistortion)), u_morphFactor * 0.5);
|
|
596
595
|
|
|
597
596
|
// Enhanced holographic interaction effects
|
|
598
597
|
float mouseDist = length(uv - (u_mouse - 0.5) * vec2(aspectRatio, 1.0));
|
|
@@ -621,7 +620,7 @@ export class HolographicVisualizer {
|
|
|
621
620
|
time: this.gl.getUniformLocation(this.program, 'u_time'),
|
|
622
621
|
mouse: this.gl.getUniformLocation(this.program, 'u_mouse'),
|
|
623
622
|
geometry: this.gl.getUniformLocation(this.program, 'u_geometry'),
|
|
624
|
-
|
|
623
|
+
gridDensity: this.gl.getUniformLocation(this.program, 'u_gridDensity'),
|
|
625
624
|
speed: this.gl.getUniformLocation(this.program, 'u_speed'),
|
|
626
625
|
color: this.gl.getUniformLocation(this.program, 'u_color'),
|
|
627
626
|
intensity: this.gl.getUniformLocation(this.program, 'u_intensity'),
|
|
@@ -632,9 +631,8 @@ export class HolographicVisualizer {
|
|
|
632
631
|
mouseIntensity: this.gl.getUniformLocation(this.program, 'u_mouseIntensity'),
|
|
633
632
|
clickIntensity: this.gl.getUniformLocation(this.program, 'u_clickIntensity'),
|
|
634
633
|
densityVariation: this.gl.getUniformLocation(this.program, 'u_densityVariation'),
|
|
635
|
-
geometryType: this.gl.getUniformLocation(this.program, 'u_geometryType'),
|
|
636
634
|
chaos: this.gl.getUniformLocation(this.program, 'u_chaos'),
|
|
637
|
-
|
|
635
|
+
morphFactor: this.gl.getUniformLocation(this.program, 'u_morphFactor'),
|
|
638
636
|
touchMorph: this.gl.getUniformLocation(this.program, 'u_touchMorph'),
|
|
639
637
|
touchChaos: this.gl.getUniformLocation(this.program, 'u_touchChaos'),
|
|
640
638
|
scrollParallax: this.gl.getUniformLocation(this.program, 'u_scrollParallax'),
|
|
@@ -894,11 +892,11 @@ export class HolographicVisualizer {
|
|
|
894
892
|
this.gl.uniform2f(this.uniforms.resolution, this.canvas.width, this.canvas.height);
|
|
895
893
|
this.gl.uniform1f(this.uniforms.time, time);
|
|
896
894
|
this.gl.uniform2f(this.uniforms.mouse, this.mouseX, this.mouseY);
|
|
897
|
-
this.gl.uniform1f(this.uniforms.
|
|
898
|
-
this.gl.uniform1f(this.uniforms.
|
|
899
|
-
//
|
|
900
|
-
const baseSpeed = (this.variantParams.speed || 0.5) * 0.2;
|
|
901
|
-
const audioBoost = (this.audioSpeedBoost || 0.0) * 0.1;
|
|
895
|
+
this.gl.uniform1f(this.uniforms.geometry, this.variantParams.geometry !== undefined ? this.variantParams.geometry : this.variant || 0);
|
|
896
|
+
this.gl.uniform1f(this.uniforms.gridDensity, this.variantParams.gridDensity || 1.0);
|
|
897
|
+
// Controlled speed calculation - base speed controls main movement, audio provides subtle boost
|
|
898
|
+
const baseSpeed = (this.variantParams.speed || 0.5) * 0.2;
|
|
899
|
+
const audioBoost = (this.audioSpeedBoost || 0.0) * 0.1;
|
|
902
900
|
this.gl.uniform1f(this.uniforms.speed, baseSpeed + audioBoost);
|
|
903
901
|
this.gl.uniform3fv(this.uniforms.color, new Float32Array(rgbColor));
|
|
904
902
|
this.gl.uniform1f(this.uniforms.intensity, (this.variantParams.intensity || 0.5) * this.roleParams.intensity);
|
|
@@ -909,9 +907,8 @@ export class HolographicVisualizer {
|
|
|
909
907
|
this.gl.uniform1f(this.uniforms.mouseIntensity, this.mouseIntensity);
|
|
910
908
|
this.gl.uniform1f(this.uniforms.clickIntensity, this.clickIntensity);
|
|
911
909
|
this.gl.uniform1f(this.uniforms.densityVariation, this.densityVariation);
|
|
912
|
-
this.gl.uniform1f(this.uniforms.geometryType, this.variantParams.geometryType !== undefined ? this.variantParams.geometryType : this.variant || 0);
|
|
913
910
|
this.gl.uniform1f(this.uniforms.chaos, this.variantParams.chaos || 0.0);
|
|
914
|
-
this.gl.uniform1f(this.uniforms.
|
|
911
|
+
this.gl.uniform1f(this.uniforms.morphFactor, this.variantParams.morphFactor || 0.0);
|
|
915
912
|
|
|
916
913
|
// Touch and scroll uniforms
|
|
917
914
|
this.gl.uniform1f(this.uniforms.touchMorph, this.touchMorph);
|
|
@@ -1001,62 +998,34 @@ export class HolographicVisualizer {
|
|
|
1001
998
|
}
|
|
1002
999
|
|
|
1003
1000
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1001
|
+
* Update visualization parameters from SDK global parameter names.
|
|
1002
|
+
* Parameters are written directly to variantParams — no name mapping needed
|
|
1003
|
+
* since shader uniforms now use SDK-standard names.
|
|
1006
1004
|
*/
|
|
1007
1005
|
updateParameters(params) {
|
|
1008
1006
|
if (!params || typeof params !== 'object') return;
|
|
1009
|
-
// Update variant parameters with proper mapping and scaling
|
|
1010
1007
|
if (this.variantParams) {
|
|
1011
1008
|
Object.keys(params).forEach(param => {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
this.variantParams[mappedParam] = scaledValue;
|
|
1027
|
-
|
|
1028
|
-
// Handle special parameter types
|
|
1029
|
-
if (mappedParam === 'geometryType') {
|
|
1030
|
-
// Regenerate role params with new geometry
|
|
1031
|
-
this.roleParams = this.generateRoleParams(this.role);
|
|
1032
|
-
}
|
|
1009
|
+
let scaledValue = params[param];
|
|
1010
|
+
// Guard against NaN/Infinity reaching GPU uniforms
|
|
1011
|
+
if (typeof scaledValue !== 'number' || !Number.isFinite(scaledValue)) return;
|
|
1012
|
+
|
|
1013
|
+
// Scale gridDensity (5-100) to holographic density range (0.3-2.5)
|
|
1014
|
+
if (param === 'gridDensity') {
|
|
1015
|
+
scaledValue = 0.3 + (parseFloat(params[param]) - 5) / 95 * 2.2;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
this.variantParams[param] = scaledValue;
|
|
1019
|
+
|
|
1020
|
+
// Regenerate role params when geometry changes
|
|
1021
|
+
if (param === 'geometry') {
|
|
1022
|
+
this.roleParams = this.generateRoleParams(this.role);
|
|
1033
1023
|
}
|
|
1034
1024
|
});
|
|
1035
1025
|
}
|
|
1036
|
-
|
|
1026
|
+
|
|
1037
1027
|
// Don't call render() here - engine will call it to prevent infinite loop
|
|
1038
1028
|
}
|
|
1039
|
-
|
|
1040
|
-
/**
|
|
1041
|
-
* Map global parameter names to holographic system parameter names
|
|
1042
|
-
*/
|
|
1043
|
-
mapParameterName(globalParam) {
|
|
1044
|
-
const paramMap = {
|
|
1045
|
-
'gridDensity': 'density',
|
|
1046
|
-
'morphFactor': 'morph',
|
|
1047
|
-
'rot4dXW': 'rot4dXW',
|
|
1048
|
-
'rot4dYW': 'rot4dYW',
|
|
1049
|
-
'rot4dZW': 'rot4dZW',
|
|
1050
|
-
'hue': 'hue',
|
|
1051
|
-
'intensity': 'intensity',
|
|
1052
|
-
'saturation': 'saturation',
|
|
1053
|
-
'chaos': 'chaos',
|
|
1054
|
-
'speed': 'speed',
|
|
1055
|
-
'geometry': 'geometryType',
|
|
1056
|
-
'breath': 'breath'
|
|
1057
|
-
};
|
|
1058
|
-
return paramMap[globalParam] || globalParam;
|
|
1059
|
-
}
|
|
1060
1029
|
|
|
1061
1030
|
/**
|
|
1062
1031
|
* Clean up all WebGL resources and event listeners
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { HolographicVisualizer } from './HolographicVisualizer.js';
|
|
7
7
|
import { MultiCanvasBridge } from '../render/MultiCanvasBridge.js';
|
|
8
|
+
import { LayerRelationshipGraph } from '../render/LayerRelationshipGraph.js';
|
|
8
9
|
import { shaderLoader } from '../render/ShaderLoader.js';
|
|
9
10
|
|
|
10
11
|
export class RealHolographicSystem {
|
|
@@ -32,6 +33,12 @@ export class RealHolographicSystem {
|
|
|
32
33
|
/** @type {number} time accumulator for bridge rendering (ms) */
|
|
33
34
|
this._bridgeTime = 0;
|
|
34
35
|
|
|
36
|
+
// Layer relationship graph — keystone-driven inter-layer parameter system
|
|
37
|
+
/** @type {LayerRelationshipGraph} */
|
|
38
|
+
this._layerGraph = new LayerRelationshipGraph({
|
|
39
|
+
profile: options.relationshipProfile || 'holographic'
|
|
40
|
+
});
|
|
41
|
+
|
|
35
42
|
// Conditional reactivity: Use built-in only if ReactivityManager not active
|
|
36
43
|
this.useBuiltInReactivity = !window.reactivityManager;
|
|
37
44
|
|
|
@@ -220,7 +227,11 @@ export class RealHolographicSystem {
|
|
|
220
227
|
if (Object.keys(canvasMap).length === 0) return null;
|
|
221
228
|
|
|
222
229
|
const bridge = new MultiCanvasBridge();
|
|
223
|
-
await bridge.initialize({
|
|
230
|
+
await bridge.initialize({
|
|
231
|
+
canvases: canvasMap,
|
|
232
|
+
preferWebGPU: options.preferWebGPU !== false,
|
|
233
|
+
relationshipGraph: this._layerGraph
|
|
234
|
+
});
|
|
224
235
|
|
|
225
236
|
// Load external shader files, fall back to inline if unavailable
|
|
226
237
|
let sources = {
|
|
@@ -369,48 +380,130 @@ export class RealHolographicSystem {
|
|
|
369
380
|
}
|
|
370
381
|
|
|
371
382
|
updateParameter(param, value) {
|
|
372
|
-
// Store custom parameter overrides
|
|
383
|
+
// Store custom parameter overrides (keystone state)
|
|
373
384
|
if (!this.customParams) {
|
|
374
385
|
this.customParams = {};
|
|
375
386
|
}
|
|
376
387
|
this.customParams[param] = value;
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
388
|
+
|
|
389
|
+
// Build keystone params from current state + this update
|
|
390
|
+
const keystoneParams = { ...this._buildKeystoneParams(), [param]: value };
|
|
391
|
+
|
|
392
|
+
// Resolve all layers through the relationship graph
|
|
393
|
+
const resolved = this._layerGraph.resolveAll(keystoneParams, Date.now());
|
|
394
|
+
|
|
395
|
+
// Apply resolved params to each visualizer by role
|
|
381
396
|
this.visualizers.forEach((visualizer, index) => {
|
|
397
|
+
const role = visualizer.role || 'content';
|
|
398
|
+
const layerParams = resolved[role] || keystoneParams;
|
|
399
|
+
|
|
382
400
|
try {
|
|
383
401
|
if (visualizer.updateParameters) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
} else {
|
|
390
|
-
console.warn(`⚠️ Holographic layer ${index} missing updateParameters method, using fallback`);
|
|
391
|
-
// Fallback for older method (direct parameter setting)
|
|
392
|
-
if (visualizer.variantParams) {
|
|
393
|
-
visualizer.variantParams[param] = value;
|
|
394
|
-
|
|
395
|
-
// If it's a geometry type change, regenerate role params with new geometry
|
|
396
|
-
if (param === 'geometryType') {
|
|
397
|
-
visualizer.roleParams = visualizer.generateRoleParams(visualizer.role);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// Force manual render for older visualizers
|
|
401
|
-
if (visualizer.render) {
|
|
402
|
-
visualizer.render();
|
|
403
|
-
}
|
|
402
|
+
visualizer.updateParameters(layerParams);
|
|
403
|
+
} else if (visualizer.variantParams) {
|
|
404
|
+
Object.assign(visualizer.variantParams, layerParams);
|
|
405
|
+
if (param === 'geometryType' || param === 'geometry') {
|
|
406
|
+
visualizer.roleParams = visualizer.generateRoleParams(role);
|
|
404
407
|
}
|
|
405
408
|
}
|
|
406
409
|
} catch (error) {
|
|
407
|
-
console.error(
|
|
410
|
+
console.error(`Failed to update holographic layer ${index} (${role}):`, error);
|
|
408
411
|
}
|
|
409
412
|
});
|
|
410
|
-
|
|
411
|
-
console.log(`🔄 Holographic parameter update complete: ${param}=${value}`);
|
|
412
413
|
}
|
|
413
|
-
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Update multiple parameters at once (RendererContract / VIB3Engine compatible).
|
|
417
|
+
* Resolves all layers through the relationship graph in a single pass.
|
|
418
|
+
* @param {Object} params - Key-value pairs of parameters to update
|
|
419
|
+
*/
|
|
420
|
+
updateParameters(params) {
|
|
421
|
+
if (!params || typeof params !== 'object') return;
|
|
422
|
+
|
|
423
|
+
// Merge into custom params (keystone state)
|
|
424
|
+
if (!this.customParams) {
|
|
425
|
+
this.customParams = {};
|
|
426
|
+
}
|
|
427
|
+
Object.assign(this.customParams, params);
|
|
428
|
+
|
|
429
|
+
// Build keystone params + resolve all layers in one shot
|
|
430
|
+
const keystoneParams = { ...this._buildKeystoneParams(), ...params };
|
|
431
|
+
const resolved = this._layerGraph.resolveAll(keystoneParams, Date.now());
|
|
432
|
+
|
|
433
|
+
this.visualizers.forEach((visualizer, index) => {
|
|
434
|
+
const role = visualizer.role || 'content';
|
|
435
|
+
const layerParams = resolved[role] || keystoneParams;
|
|
436
|
+
|
|
437
|
+
try {
|
|
438
|
+
if (visualizer.updateParameters) {
|
|
439
|
+
visualizer.updateParameters(layerParams);
|
|
440
|
+
} else if (visualizer.variantParams) {
|
|
441
|
+
Object.assign(visualizer.variantParams, layerParams);
|
|
442
|
+
}
|
|
443
|
+
} catch (error) {
|
|
444
|
+
console.error(`Failed to update holographic layer ${index} (${role}):`, error);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// ========================================================================
|
|
450
|
+
// Layer Relationship Graph API
|
|
451
|
+
// ========================================================================
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Build keystone parameters from current state.
|
|
455
|
+
* These are the driver values that get transformed by the relationship
|
|
456
|
+
* graph to produce each dependent layer's parameters.
|
|
457
|
+
* @private
|
|
458
|
+
* @returns {Object}
|
|
459
|
+
*/
|
|
460
|
+
_buildKeystoneParams() {
|
|
461
|
+
const base = {};
|
|
462
|
+
// Pull from first (content) visualizer's variant params if available
|
|
463
|
+
const content = this.visualizers.find(v => v.role === 'content');
|
|
464
|
+
if (content && content.variantParams) {
|
|
465
|
+
Object.assign(base, content.variantParams);
|
|
466
|
+
}
|
|
467
|
+
// Merge custom overrides
|
|
468
|
+
if (this.customParams) {
|
|
469
|
+
Object.assign(base, this.customParams);
|
|
470
|
+
}
|
|
471
|
+
return base;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Get the layer relationship graph for direct configuration.
|
|
476
|
+
* @returns {LayerRelationshipGraph}
|
|
477
|
+
*/
|
|
478
|
+
get layerGraph() {
|
|
479
|
+
return this._layerGraph;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Load a relationship profile by name.
|
|
484
|
+
* @param {string} profileName - holographic, symmetry, chord, storm, legacy
|
|
485
|
+
*/
|
|
486
|
+
loadRelationshipProfile(profileName) {
|
|
487
|
+
this._layerGraph.loadProfile(profileName);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Set the keystone (driver) layer.
|
|
492
|
+
* @param {string} layerName - background, shadow, content, highlight, or accent
|
|
493
|
+
*/
|
|
494
|
+
setKeystone(layerName) {
|
|
495
|
+
this._layerGraph.setKeystone(layerName);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Set the relationship for a dependent layer.
|
|
500
|
+
* @param {string} layerName
|
|
501
|
+
* @param {string|Function|Object} relationship - Preset name, function, or { preset, config }
|
|
502
|
+
*/
|
|
503
|
+
setLayerRelationship(layerName, relationship) {
|
|
504
|
+
this._layerGraph.setRelationship(layerName, relationship);
|
|
505
|
+
}
|
|
506
|
+
|
|
414
507
|
// Override updateVariant to preserve custom parameters
|
|
415
508
|
updateVariant(newVariant) {
|
|
416
509
|
if (newVariant < 0) newVariant = this.totalVariants - 1;
|
|
@@ -469,7 +562,9 @@ export class RealHolographicSystem {
|
|
|
469
562
|
Object.assign(params, this.customParams);
|
|
470
563
|
}
|
|
471
564
|
|
|
472
|
-
|
|
565
|
+
// Include layer relationship graph config for serialization
|
|
566
|
+
params.layerRelationship = this._layerGraph.exportConfig();
|
|
567
|
+
|
|
473
568
|
return params;
|
|
474
569
|
}
|
|
475
570
|
|