@vib3code/sdk 2.0.1 → 2.0.3-canary.0a63e71
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 +36 -0
- package/DOCS/AGENT_HARNESS_ARCHITECTURE.md +245 -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 +3 -1
- package/DOCS/CONTROL_REFERENCE.md +2 -0
- package/DOCS/CROSS_SITE_DESIGN_PATTERNS.md +119 -0
- package/DOCS/ENV_SETUP.md +2 -0
- package/DOCS/EPIC_SCROLL_EVENTS.md +775 -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 +156 -0
- package/DOCS/HANDOFF_SDK_DEVELOPMENT.md +495 -0
- package/DOCS/LICENSING_TIERS.md +2 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +4 -2
- package/DOCS/MULTIVIZ_CHOREOGRAPHY_PATTERNS.md +939 -0
- package/DOCS/OBS_SETUP_GUIDE.md +2 -0
- package/DOCS/OPTIMIZATION_PLAN_MATH.md +119 -0
- package/DOCS/PRODUCT_STRATEGY.md +65 -0
- package/DOCS/PROJECT_SETUP.md +2 -0
- package/DOCS/README.md +105 -0
- package/DOCS/REFERENCE_SCROLL_ANALYSIS.md +99 -0
- package/DOCS/RENDERER_LIFECYCLE.md +2 -0
- package/DOCS/REPO_MANIFEST.md +2 -0
- package/DOCS/ROADMAP.md +113 -0
- package/DOCS/SCROLL_TIMELINE_v3.md +271 -0
- package/DOCS/SITE_REFACTOR_PLAN.md +102 -0
- package/DOCS/STATUS.md +26 -0
- package/DOCS/SYSTEM_INVENTORY.md +37 -32
- package/DOCS/TELEMETRY_EXPORTS.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_CLICKERSS.md +87 -0
- package/DOCS/VISUAL_ANALYSIS_FACETAD.md +135 -0
- package/DOCS/VISUAL_ANALYSIS_SIMONE.md +97 -0
- package/DOCS/VISUAL_ANALYSIS_TABLESIDE.md +88 -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 -0
- package/DOCS/archive/DEV_TRACK_ANALYSIS.md +1 -0
- package/DOCS/archive/DEV_TRACK_PLAN_2026-01-07.md +1 -0
- package/DOCS/archive/SESSION_014_PLAN.md +1 -0
- package/DOCS/archive/SESSION_LOG_2026-01-07.md +1 -0
- package/DOCS/archive/STRATEGIC_BLUEPRINT_2026-01-07.md +1 -0
- package/DOCS/archive/SYSTEM_AUDIT_2026-01-30.md +1 -0
- package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +1 -0
- package/DOCS/{DEV_TRACK_SESSION_2026-01-31.md → dev-tracks/DEV_TRACK_SESSION_2026-01-31.md} +3 -1
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-06.md +233 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-13.md +129 -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 +12 -0
- package/README.md +26 -13
- package/cpp/CMakeLists.txt +236 -0
- package/cpp/bindings/embind.cpp +269 -0
- package/cpp/build.sh +129 -0
- package/cpp/geometry/Crystal.cpp +103 -0
- package/cpp/geometry/Fractal.cpp +136 -0
- package/cpp/geometry/GeometryGenerator.cpp +262 -0
- package/cpp/geometry/KleinBottle.cpp +71 -0
- package/cpp/geometry/Sphere.cpp +134 -0
- package/cpp/geometry/Tesseract.cpp +94 -0
- package/cpp/geometry/Tetrahedron.cpp +83 -0
- package/cpp/geometry/Torus.cpp +65 -0
- package/cpp/geometry/WarpFunctions.cpp +238 -0
- package/cpp/geometry/Wave.cpp +85 -0
- package/cpp/include/vib3_ffi.h +238 -0
- package/cpp/math/Mat4x4.cpp +409 -0
- package/cpp/math/Mat4x4.hpp +209 -0
- package/cpp/math/Projection.cpp +142 -0
- package/cpp/math/Projection.hpp +148 -0
- package/cpp/math/Rotor4D.cpp +322 -0
- package/cpp/math/Rotor4D.hpp +204 -0
- package/cpp/math/Vec4.cpp +303 -0
- package/cpp/math/Vec4.hpp +225 -0
- package/cpp/src/vib3_ffi.cpp +607 -0
- package/cpp/tests/Geometry_test.cpp +213 -0
- package/cpp/tests/Mat4x4_test.cpp +494 -0
- package/cpp/tests/Projection_test.cpp +298 -0
- package/cpp/tests/Rotor4D_test.cpp +423 -0
- package/cpp/tests/Vec4_test.cpp +489 -0
- package/docs/webgpu-live.html +1 -1
- package/package.json +41 -30
- package/src/agent/index.js +1 -3
- package/src/agent/mcp/MCPServer.js +1220 -144
- package/src/agent/mcp/index.js +1 -1
- package/src/agent/mcp/stdio-server.js +264 -0
- package/src/agent/mcp/tools.js +498 -31
- package/src/cli/index.js +431 -47
- package/src/core/CanvasManager.js +97 -204
- package/src/core/ErrorReporter.js +1 -1
- package/src/core/Parameters.js +1 -1
- package/src/core/VIB3Engine.js +93 -4
- package/src/core/VitalitySystem.js +53 -0
- package/src/core/index.js +18 -0
- package/src/core/renderers/FacetedRendererAdapter.js +10 -9
- package/src/core/renderers/HolographicRendererAdapter.js +13 -9
- package/src/core/renderers/QuantumRendererAdapter.js +11 -7
- package/src/creative/AestheticMapper.js +628 -0
- package/src/creative/ChoreographyPlayer.js +481 -0
- 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/TradingCardManager.js +3 -4
- package/src/export/index.js +11 -1
- package/src/faceted/FacetedSystem.js +260 -394
- 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 +84 -98
- package/src/holograms/RealHolographicSystem.js +194 -43
- package/src/math/Mat4x4.js +308 -105
- package/src/math/Rotor4D.js +124 -40
- package/src/math/Vec4.js +200 -103
- package/src/math/index.js +7 -7
- package/src/polychora/PolychoraSystem.js +77 -0
- package/src/quantum/QuantumEngine.js +103 -66
- package/src/quantum/QuantumVisualizer.js +31 -22
- 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 +4 -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.glsl +220 -80
- package/src/shaders/faceted/faceted.frag.wgsl +144 -90
- package/src/shaders/holographic/holographic.frag.glsl +28 -9
- package/src/shaders/holographic/holographic.frag.wgsl +112 -41
- package/src/shaders/quantum/quantum.frag.glsl +1 -0
- package/src/shaders/quantum/quantum.frag.wgsl +6 -4
- package/src/testing/ParallelTestFramework.js +2 -2
- 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/src/viewer/index.js +1 -1
- package/tools/headless-renderer.js +258 -0
- package/tools/shader-sync-verify.js +14 -8
- package/tools/site-analysis/all-reports.json +32 -0
- package/tools/site-analysis/combined-analysis.md +50 -0
- package/tools/site-analyzer.mjs +779 -0
- package/tools/visual-catalog/capture.js +276 -0
- package/tools/visual-catalog/composite.js +138 -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
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +0 -34
- package/DOCS/DEV_TRACK_ANALYSIS.md +0 -77
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +0 -42
- package/DOCS/SESSION_014_PLAN.md +0 -195
- package/DOCS/SESSION_LOG_2026-01-07.md +0 -56
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +0 -72
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +0 -738
- /package/src/viewer/{ReactivityManager.js → ViewerInputHandler.js} +0 -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,
|
|
@@ -29,7 +29,7 @@ export class HolographicVisualizer {
|
|
|
29
29
|
this.canvas.getContext('experimental-webgl');
|
|
30
30
|
|
|
31
31
|
if (existingContext && !existingContext.isContextLost()) {
|
|
32
|
-
console.log(`🔄 Reusing existing WebGL context for ${
|
|
32
|
+
console.log(`🔄 Reusing existing WebGL context for ${canvasIdOrElement instanceof HTMLCanvasElement ? canvasIdOrElement.id : canvasIdOrElement}`);
|
|
33
33
|
this.gl = existingContext;
|
|
34
34
|
} else {
|
|
35
35
|
// Try WebGL2 first (better mobile support), then WebGL1
|
|
@@ -39,9 +39,9 @@ export class HolographicVisualizer {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (!this.gl) {
|
|
42
|
-
console.error(`WebGL not supported for ${
|
|
42
|
+
console.error(`WebGL not supported for ${canvasIdOrElement}`);
|
|
43
43
|
this.showWebGLError();
|
|
44
|
-
throw new Error(`WebGL not supported for ${
|
|
44
|
+
throw new Error(`WebGL not supported for ${canvasIdOrElement}`);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
this.variantParams = this.generateVariantParams(variant);
|
|
@@ -86,17 +86,17 @@ export class HolographicVisualizer {
|
|
|
86
86
|
this._onContextLost = (e) => {
|
|
87
87
|
e.preventDefault();
|
|
88
88
|
this._contextLost = true;
|
|
89
|
-
console.warn(`WebGL context lost for ${
|
|
89
|
+
console.warn(`WebGL context lost for ${canvasIdOrElement}`);
|
|
90
90
|
};
|
|
91
91
|
this._onContextRestored = () => {
|
|
92
|
-
console.log(`WebGL context restored for ${
|
|
92
|
+
console.log(`WebGL context restored for ${canvasIdOrElement}`);
|
|
93
93
|
this._contextLost = false;
|
|
94
94
|
try {
|
|
95
95
|
this.initShaders();
|
|
96
96
|
this.initBuffers();
|
|
97
97
|
this.resize();
|
|
98
98
|
} catch (err) {
|
|
99
|
-
console.error(`Failed to reinit after context restore for ${
|
|
99
|
+
console.error(`Failed to reinit after context restore for ${canvasIdOrElement}:`, err);
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
this.canvas.addEventListener('webglcontextlost', this._onContextLost);
|
|
@@ -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;
|
|
@@ -238,6 +237,9 @@ export class HolographicVisualizer {
|
|
|
238
237
|
uniform float u_rot4dYW;
|
|
239
238
|
uniform float u_rot4dZW;
|
|
240
239
|
|
|
240
|
+
// EXHALE FEATURE: Breathing uniform
|
|
241
|
+
uniform float u_breath;
|
|
242
|
+
|
|
241
243
|
// 6D rotation matrices - 3D space rotations (XY, XZ, YZ)
|
|
242
244
|
mat4 rotateXY(float theta) {
|
|
243
245
|
float c = cos(theta);
|
|
@@ -276,9 +278,12 @@ export class HolographicVisualizer {
|
|
|
276
278
|
return mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, c, -s, 0, 0, s, c);
|
|
277
279
|
}
|
|
278
280
|
|
|
279
|
-
// 4D to 3D projection
|
|
281
|
+
// 4D to 3D projection - BREATHING EFFECT
|
|
280
282
|
vec3 project4Dto3D(vec4 p) {
|
|
281
|
-
|
|
283
|
+
// Modulate projection distance with breath for "exhale" effect (expansion/contraction)
|
|
284
|
+
float baseDim = 2.5;
|
|
285
|
+
float dim = baseDim + u_breath * 0.5; // Expands on exhale
|
|
286
|
+
float w = dim / (dim + p.w);
|
|
282
287
|
return vec3(p.x * w, p.y * w, p.z * w);
|
|
283
288
|
}
|
|
284
289
|
|
|
@@ -287,7 +292,7 @@ export class HolographicVisualizer {
|
|
|
287
292
|
// ========================================
|
|
288
293
|
vec3 warpHypersphereCore(vec3 p, int geometryIndex, vec2 mouseDelta) {
|
|
289
294
|
float radius = length(p);
|
|
290
|
-
float morphBlend = clamp(
|
|
295
|
+
float morphBlend = clamp(u_morphFactor * 0.6 + 0.3, 0.0, 2.0);
|
|
291
296
|
float w = sin(radius * (1.3 + float(geometryIndex) * 0.12) + u_time * 0.0008 * u_speed);
|
|
292
297
|
w *= (0.4 + morphBlend * 0.45);
|
|
293
298
|
|
|
@@ -309,7 +314,7 @@ export class HolographicVisualizer {
|
|
|
309
314
|
vec3 c3 = normalize(vec3(-1.0, 1.0, -1.0));
|
|
310
315
|
vec3 c4 = normalize(vec3(1.0, -1.0, -1.0));
|
|
311
316
|
|
|
312
|
-
float morphBlend = clamp(
|
|
317
|
+
float morphBlend = clamp(u_morphFactor * 0.8 + 0.2, 0.0, 2.0);
|
|
313
318
|
float basisMix = dot(p, c1) * 0.14 + dot(p, c2) * 0.1 + dot(p, c3) * 0.08;
|
|
314
319
|
float w = sin(basisMix * 5.5 + u_time * 0.0009 * u_speed);
|
|
315
320
|
w *= cos(dot(p, c4) * 4.2 - u_time * 0.0007 * u_speed);
|
|
@@ -543,18 +548,23 @@ export class HolographicVisualizer {
|
|
|
543
548
|
|
|
544
549
|
float scrollDensityMod = 1.0 + u_gridDensityShift * 0.3;
|
|
545
550
|
float audioDensityMod = 1.0 + u_audioDensityBoost * 0.5;
|
|
546
|
-
//
|
|
547
|
-
float
|
|
551
|
+
// Controlled density calculation - breathing modulation added
|
|
552
|
+
float breathDensityMod = 1.0 + u_breath * 0.1;
|
|
553
|
+
float baseDensity = u_gridDensity * u_roleDensity * breathDensityMod;
|
|
554
|
+
|
|
548
555
|
float densityVariations = (u_densityVariation * 0.3 + (scrollDensityMod - 1.0) * 0.4 + (audioDensityMod - 1.0) * 0.2);
|
|
549
556
|
float roleDensity = baseDensity + densityVariations;
|
|
550
557
|
|
|
551
|
-
float morphedGeometry =
|
|
558
|
+
float morphedGeometry = u_geometry + u_morphFactor * 3.0 + u_touchMorph * 2.0 + u_audioMorphBoost * 1.5;
|
|
552
559
|
float lattice = getDynamicGeometry(p, roleDensity, morphedGeometry);
|
|
553
560
|
|
|
554
561
|
// Enhanced holographic color processing
|
|
555
562
|
vec3 baseColor = u_color;
|
|
556
563
|
float latticeIntensity = lattice * u_intensity;
|
|
557
564
|
|
|
565
|
+
// Breathing glow effect
|
|
566
|
+
latticeIntensity *= (1.0 + u_breath * 0.4);
|
|
567
|
+
|
|
558
568
|
// Multi-layer color composition for higher fidelity
|
|
559
569
|
vec3 color = baseColor * (0.2 + latticeIntensity * 0.8);
|
|
560
570
|
|
|
@@ -579,9 +589,9 @@ export class HolographicVisualizer {
|
|
|
579
589
|
color = rgbGlitch(color, uv, enhancedChaos);
|
|
580
590
|
|
|
581
591
|
// Apply morph distortion to position
|
|
582
|
-
vec2 morphDistortion = vec2(sin(uv.y * 10.0 + u_time * 0.001) *
|
|
583
|
-
cos(uv.x * 10.0 + u_time * 0.001) *
|
|
584
|
-
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);
|
|
585
595
|
|
|
586
596
|
// Enhanced holographic interaction effects
|
|
587
597
|
float mouseDist = length(uv - (u_mouse - 0.5) * vec2(aspectRatio, 1.0));
|
|
@@ -610,7 +620,7 @@ export class HolographicVisualizer {
|
|
|
610
620
|
time: this.gl.getUniformLocation(this.program, 'u_time'),
|
|
611
621
|
mouse: this.gl.getUniformLocation(this.program, 'u_mouse'),
|
|
612
622
|
geometry: this.gl.getUniformLocation(this.program, 'u_geometry'),
|
|
613
|
-
|
|
623
|
+
gridDensity: this.gl.getUniformLocation(this.program, 'u_gridDensity'),
|
|
614
624
|
speed: this.gl.getUniformLocation(this.program, 'u_speed'),
|
|
615
625
|
color: this.gl.getUniformLocation(this.program, 'u_color'),
|
|
616
626
|
intensity: this.gl.getUniformLocation(this.program, 'u_intensity'),
|
|
@@ -621,9 +631,8 @@ export class HolographicVisualizer {
|
|
|
621
631
|
mouseIntensity: this.gl.getUniformLocation(this.program, 'u_mouseIntensity'),
|
|
622
632
|
clickIntensity: this.gl.getUniformLocation(this.program, 'u_clickIntensity'),
|
|
623
633
|
densityVariation: this.gl.getUniformLocation(this.program, 'u_densityVariation'),
|
|
624
|
-
geometryType: this.gl.getUniformLocation(this.program, 'u_geometryType'),
|
|
625
634
|
chaos: this.gl.getUniformLocation(this.program, 'u_chaos'),
|
|
626
|
-
|
|
635
|
+
morphFactor: this.gl.getUniformLocation(this.program, 'u_morphFactor'),
|
|
627
636
|
touchMorph: this.gl.getUniformLocation(this.program, 'u_touchMorph'),
|
|
628
637
|
touchChaos: this.gl.getUniformLocation(this.program, 'u_touchChaos'),
|
|
629
638
|
scrollParallax: this.gl.getUniformLocation(this.program, 'u_scrollParallax'),
|
|
@@ -639,7 +648,8 @@ export class HolographicVisualizer {
|
|
|
639
648
|
rot4dYZ: this.gl.getUniformLocation(this.program, 'u_rot4dYZ'),
|
|
640
649
|
rot4dXW: this.gl.getUniformLocation(this.program, 'u_rot4dXW'),
|
|
641
650
|
rot4dYW: this.gl.getUniformLocation(this.program, 'u_rot4dYW'),
|
|
642
|
-
rot4dZW: this.gl.getUniformLocation(this.program, 'u_rot4dZW')
|
|
651
|
+
rot4dZW: this.gl.getUniformLocation(this.program, 'u_rot4dZW'),
|
|
652
|
+
breath: this.gl.getUniformLocation(this.program, 'u_breath')
|
|
643
653
|
};
|
|
644
654
|
}
|
|
645
655
|
|
|
@@ -882,11 +892,11 @@ export class HolographicVisualizer {
|
|
|
882
892
|
this.gl.uniform2f(this.uniforms.resolution, this.canvas.width, this.canvas.height);
|
|
883
893
|
this.gl.uniform1f(this.uniforms.time, time);
|
|
884
894
|
this.gl.uniform2f(this.uniforms.mouse, this.mouseX, this.mouseY);
|
|
885
|
-
this.gl.uniform1f(this.uniforms.
|
|
886
|
-
this.gl.uniform1f(this.uniforms.
|
|
887
|
-
//
|
|
888
|
-
const baseSpeed = (this.variantParams.speed || 0.5) * 0.2;
|
|
889
|
-
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;
|
|
890
900
|
this.gl.uniform1f(this.uniforms.speed, baseSpeed + audioBoost);
|
|
891
901
|
this.gl.uniform3fv(this.uniforms.color, new Float32Array(rgbColor));
|
|
892
902
|
this.gl.uniform1f(this.uniforms.intensity, (this.variantParams.intensity || 0.5) * this.roleParams.intensity);
|
|
@@ -897,9 +907,8 @@ export class HolographicVisualizer {
|
|
|
897
907
|
this.gl.uniform1f(this.uniforms.mouseIntensity, this.mouseIntensity);
|
|
898
908
|
this.gl.uniform1f(this.uniforms.clickIntensity, this.clickIntensity);
|
|
899
909
|
this.gl.uniform1f(this.uniforms.densityVariation, this.densityVariation);
|
|
900
|
-
this.gl.uniform1f(this.uniforms.geometryType, this.variantParams.geometryType !== undefined ? this.variantParams.geometryType : this.variant || 0);
|
|
901
910
|
this.gl.uniform1f(this.uniforms.chaos, this.variantParams.chaos || 0.0);
|
|
902
|
-
this.gl.uniform1f(this.uniforms.
|
|
911
|
+
this.gl.uniform1f(this.uniforms.morphFactor, this.variantParams.morphFactor || 0.0);
|
|
903
912
|
|
|
904
913
|
// Touch and scroll uniforms
|
|
905
914
|
this.gl.uniform1f(this.uniforms.touchMorph, this.touchMorph);
|
|
@@ -939,6 +948,10 @@ export class HolographicVisualizer {
|
|
|
939
948
|
this.gl.uniform1f(this.uniforms.rot4dYW, this.variantParams.rot4dYW || 0.0);
|
|
940
949
|
this.gl.uniform1f(this.uniforms.rot4dZW, this.variantParams.rot4dZW || 0.0);
|
|
941
950
|
|
|
951
|
+
// Exhale feature: Use centralized breath from VitalitySystem (0.0 = inhale, 1.0 = exhale)
|
|
952
|
+
const breathCycle = this.variantParams.breath || 0.0;
|
|
953
|
+
this.gl.uniform1f(this.uniforms.breath, breathCycle);
|
|
954
|
+
|
|
942
955
|
this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);
|
|
943
956
|
}
|
|
944
957
|
|
|
@@ -985,61 +998,34 @@ export class HolographicVisualizer {
|
|
|
985
998
|
}
|
|
986
999
|
|
|
987
1000
|
/**
|
|
988
|
-
*
|
|
989
|
-
*
|
|
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.
|
|
990
1004
|
*/
|
|
991
1005
|
updateParameters(params) {
|
|
992
1006
|
if (!params || typeof params !== 'object') return;
|
|
993
|
-
// Update variant parameters with proper mapping and scaling
|
|
994
1007
|
if (this.variantParams) {
|
|
995
1008
|
Object.keys(params).forEach(param => {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
this.variantParams[mappedParam] = scaledValue;
|
|
1011
|
-
|
|
1012
|
-
// Handle special parameter types
|
|
1013
|
-
if (mappedParam === 'geometryType') {
|
|
1014
|
-
// Regenerate role params with new geometry
|
|
1015
|
-
this.roleParams = this.generateRoleParams(this.role);
|
|
1016
|
-
}
|
|
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);
|
|
1017
1023
|
}
|
|
1018
1024
|
});
|
|
1019
1025
|
}
|
|
1020
|
-
|
|
1026
|
+
|
|
1021
1027
|
// Don't call render() here - engine will call it to prevent infinite loop
|
|
1022
1028
|
}
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
* Map global parameter names to holographic system parameter names
|
|
1026
|
-
*/
|
|
1027
|
-
mapParameterName(globalParam) {
|
|
1028
|
-
const paramMap = {
|
|
1029
|
-
'gridDensity': 'density',
|
|
1030
|
-
'morphFactor': 'morph',
|
|
1031
|
-
'rot4dXW': 'rot4dXW',
|
|
1032
|
-
'rot4dYW': 'rot4dYW',
|
|
1033
|
-
'rot4dZW': 'rot4dZW',
|
|
1034
|
-
'hue': 'hue',
|
|
1035
|
-
'intensity': 'intensity',
|
|
1036
|
-
'saturation': 'saturation',
|
|
1037
|
-
'chaos': 'chaos',
|
|
1038
|
-
'speed': 'speed',
|
|
1039
|
-
'geometry': 'geometryType'
|
|
1040
|
-
};
|
|
1041
|
-
return paramMap[globalParam] || globalParam;
|
|
1042
|
-
}
|
|
1043
1029
|
|
|
1044
1030
|
/**
|
|
1045
1031
|
* Clean up all WebGL resources and event listeners
|