@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
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrystalLabyrinth.js - Vertical Slice Demo
|
|
3
|
+
*
|
|
4
|
+
* Implements the full "Ultra" stack:
|
|
5
|
+
* - VIB3Universe (Multi-instance)
|
|
6
|
+
* - VIB3Orchestrator (Game Loop)
|
|
7
|
+
* - VIB3Compositor (Visuals)
|
|
8
|
+
* - LatticePhysics (4D Collision)
|
|
9
|
+
* - PlayerController4D (Input)
|
|
10
|
+
* - LiveDirector (AI Pacing)
|
|
11
|
+
*
|
|
12
|
+
* @experimental
|
|
13
|
+
*/
|
|
14
|
+
import { VIB3Universe } from '../VIB3Universe.js';
|
|
15
|
+
import { GameLoop } from '../GameLoop.js';
|
|
16
|
+
import { LatticePhysics } from '../LatticePhysics.js';
|
|
17
|
+
import { PlayerController4D } from '../PlayerController4D.js';
|
|
18
|
+
import { LiveDirector } from '../LiveDirector.js';
|
|
19
|
+
|
|
20
|
+
class CrystalLabyrinthGame {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.universe = new VIB3Universe('vib3-universe');
|
|
23
|
+
this.physics = new LatticePhysics();
|
|
24
|
+
this.director = new LiveDirector(this.universe);
|
|
25
|
+
|
|
26
|
+
// Game State
|
|
27
|
+
this.score = 0;
|
|
28
|
+
this.health = 100;
|
|
29
|
+
this.isPlaying = false;
|
|
30
|
+
|
|
31
|
+
// Entities
|
|
32
|
+
this.player = null; // The "Camera"
|
|
33
|
+
this.crystals = [];
|
|
34
|
+
this.shadows = [];
|
|
35
|
+
|
|
36
|
+
// UI
|
|
37
|
+
this.ui = {
|
|
38
|
+
score: document.getElementById('score'),
|
|
39
|
+
health: document.getElementById('health'),
|
|
40
|
+
overlay: document.getElementById('overlay'),
|
|
41
|
+
startBtn: document.getElementById('start-btn')
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Bind input
|
|
45
|
+
this.controller = new PlayerController4D(document.body, {
|
|
46
|
+
setParameter: (k, v) => this.updatePlayerView(k, v)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Setup Loop
|
|
50
|
+
this.loop = new GameLoop(
|
|
51
|
+
(dt) => this.update(dt),
|
|
52
|
+
(alpha) => this.render(alpha)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
this.init();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async init() {
|
|
59
|
+
// Create the "World" (Background Layer)
|
|
60
|
+
// A deep, slow-moving Holographic system representing the void
|
|
61
|
+
const world = await this.universe.spawnActor({
|
|
62
|
+
personality: 'neutral',
|
|
63
|
+
system: 'holographic',
|
|
64
|
+
geometry: 11, // Hypersphere
|
|
65
|
+
layer: { zIndex: 0, opacity: 0.4 }
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Setup UI listeners
|
|
69
|
+
this.ui.startBtn.addEventListener('click', () => this.start());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
start() {
|
|
73
|
+
this.isPlaying = true;
|
|
74
|
+
this.ui.overlay.classList.add('hidden');
|
|
75
|
+
|
|
76
|
+
// Start Systems
|
|
77
|
+
this.universe.start();
|
|
78
|
+
this.loop.start();
|
|
79
|
+
this.director.start();
|
|
80
|
+
|
|
81
|
+
// Spawn Level
|
|
82
|
+
this.spawnLevel();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async spawnLevel() {
|
|
86
|
+
// Spawn 5 Crystals (Pickups)
|
|
87
|
+
for (let i = 0; i < 5; i++) {
|
|
88
|
+
const crystal = await this.universe.spawnActor({
|
|
89
|
+
personality: 'heroic', // Bright, positive
|
|
90
|
+
system: 'faceted',
|
|
91
|
+
geometry: 7, // Crystal
|
|
92
|
+
layer: { zIndex: 10, blendMode: 'screen', opacity: 0.9 }
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Random position in 4D space (mock)
|
|
96
|
+
crystal.physics = {
|
|
97
|
+
pos: {
|
|
98
|
+
x: (Math.random() - 0.5) * 20,
|
|
99
|
+
y: (Math.random() - 0.5) * 5,
|
|
100
|
+
z: (Math.random() - 0.5) * 20
|
|
101
|
+
},
|
|
102
|
+
vel: { x: 0, y: 0, z: 0 },
|
|
103
|
+
acc: { x: 0, y: 0, z: 0 }
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
this.crystals.push(crystal);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Spawn 3 Shadows (Enemies)
|
|
110
|
+
for (let i = 0; i < 3; i++) {
|
|
111
|
+
const shadow = await this.universe.spawnActor({
|
|
112
|
+
personality: 'glitch', // Chaotic, negative
|
|
113
|
+
system: 'quantum',
|
|
114
|
+
geometry: 16, // Spiky
|
|
115
|
+
layer: { zIndex: 5, blendMode: 'multiply', opacity: 0.7 }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
shadow.physics = {
|
|
119
|
+
pos: { x: 0, y: 0, z: -30 }, // Start far away
|
|
120
|
+
vel: { x: 0, y: 0, z: 0 },
|
|
121
|
+
acc: { x: 0, y: 0, z: 0 }
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
this.shadows.push(shadow);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Physics Update (Fixed Timestep)
|
|
130
|
+
*/
|
|
131
|
+
update(dt) {
|
|
132
|
+
if (!this.isPlaying) return;
|
|
133
|
+
|
|
134
|
+
// 1. Update Player Controls
|
|
135
|
+
this.controller.update(dt);
|
|
136
|
+
|
|
137
|
+
// 2. Update Physics World
|
|
138
|
+
// Sync player controller state to physics engine?
|
|
139
|
+
// For now, controller handles movement directly.
|
|
140
|
+
|
|
141
|
+
// 3. AI Logic (Shadows hunt player)
|
|
142
|
+
this.shadows.forEach(shadow => {
|
|
143
|
+
// Move towards player (0,0,0 relative to camera)
|
|
144
|
+
// In a real engine, we'd have absolute coordinates.
|
|
145
|
+
// Here, we simulate relative motion by updating parameters
|
|
146
|
+
|
|
147
|
+
// Mock: Oscillate shadow intensity based on "proximity"
|
|
148
|
+
shadow.emote('panic', 0.5);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// 4. Check Collisions (Mock)
|
|
152
|
+
// If player is close to a crystal -> Collect
|
|
153
|
+
if (Math.random() < 0.005 && this.crystals.length > 0) {
|
|
154
|
+
this.collectCrystal(this.crystals.pop());
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Render Update (Variable Timestep)
|
|
160
|
+
*/
|
|
161
|
+
render(alpha) {
|
|
162
|
+
// Visual interpolation could happen here
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
updatePlayerView(key, value) {
|
|
166
|
+
// Broadcast player view changes to the World actor
|
|
167
|
+
// This makes the world rotate around the player
|
|
168
|
+
const world = this.universe.actors.get(this.universe.orchestrator.entities.keys().next().value);
|
|
169
|
+
if (world && world.engine) {
|
|
170
|
+
world.engine.setParameter(key, value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
collectCrystal(actor) {
|
|
175
|
+
this.score++;
|
|
176
|
+
this.ui.score.innerText = this.score;
|
|
177
|
+
|
|
178
|
+
// FX
|
|
179
|
+
actor.emote('joy', 1.0, 500);
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
this.universe.despawnActor(actor.id);
|
|
182
|
+
}, 500);
|
|
183
|
+
|
|
184
|
+
if (this.score >= 5) {
|
|
185
|
+
this.win();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
win() {
|
|
190
|
+
this.isPlaying = false;
|
|
191
|
+
this.ui.overlay.innerHTML = `
|
|
192
|
+
<h1 style="color: #0f0; text-shadow: 0 0 20px #0f0;">SECTOR STABILIZED</h1>
|
|
193
|
+
<p>The lattice is secure.</p>
|
|
194
|
+
<button onclick="location.reload()">Re-enter</button>
|
|
195
|
+
`;
|
|
196
|
+
this.ui.overlay.classList.remove('hidden');
|
|
197
|
+
this.loop.stop();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Start Game
|
|
202
|
+
new CrystalLabyrinthGame();
|
|
@@ -355,17 +355,21 @@ function projectPoints(points, rotor, dimension, width, height) {
|
|
|
355
355
|
const centerY = height / 2;
|
|
356
356
|
const scale = Math.min(width, height) * 0.4;
|
|
357
357
|
|
|
358
|
+
// Reuse vectors to minimize allocation
|
|
359
|
+
const rotatedBuffer = new Vec4();
|
|
360
|
+
const projectedBuffer = new Vec4();
|
|
361
|
+
|
|
358
362
|
for (const point of points) {
|
|
359
363
|
// Apply 4D rotation
|
|
360
|
-
|
|
364
|
+
rotor.rotate(point, rotatedBuffer);
|
|
361
365
|
|
|
362
366
|
// Project to 3D (perspective from W)
|
|
363
|
-
|
|
367
|
+
rotatedBuffer.projectPerspective(dimension, projectedBuffer);
|
|
364
368
|
|
|
365
369
|
// Project to 2D (simple orthographic for clean SVG)
|
|
366
|
-
const x = centerX +
|
|
367
|
-
const y = centerY -
|
|
368
|
-
const depth =
|
|
370
|
+
const x = centerX + projectedBuffer.x * scale;
|
|
371
|
+
const y = centerY - projectedBuffer.y * scale; // Flip Y for SVG coordinates
|
|
372
|
+
const depth = projectedBuffer.z; // Keep depth for styling
|
|
369
373
|
|
|
370
374
|
projected.push({ x, y, depth, original: point });
|
|
371
375
|
}
|
package/src/export/index.js
CHANGED
|
@@ -8,7 +8,17 @@ export { exportSVG, downloadSVG } from './SVGExporter.js';
|
|
|
8
8
|
export { exportCSS, downloadCSS, toStyleObject } from './CSSExporter.js';
|
|
9
9
|
export { exportLottie, downloadLottie } from './LottieExporter.js';
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// Core managers
|
|
12
12
|
export { ExportManager } from './ExportManager.js';
|
|
13
13
|
export { CardGeneratorBase } from './CardGeneratorBase.js';
|
|
14
14
|
export { TradingCardManager } from './TradingCardManager.js';
|
|
15
|
+
|
|
16
|
+
// Shader & package exporters
|
|
17
|
+
export { ShaderExporter } from './ShaderExporter.js';
|
|
18
|
+
export { VIB3PackageExporter, VIB3_PACKAGE_VERSION, createVIB3Package } from './VIB3PackageExporter.js';
|
|
19
|
+
export { TradingCardGenerator } from './TradingCardGenerator.js';
|
|
20
|
+
|
|
21
|
+
// Per-system card generators
|
|
22
|
+
export { TradingCardSystemFaceted } from './systems/TradingCardSystemFaceted.js';
|
|
23
|
+
export { TradingCardSystemHolographic } from './systems/TradingCardSystemHolographic.js';
|
|
24
|
+
export { TradingCardSystemQuantum } from './systems/TradingCardSystemQuantum.js';
|
|
@@ -160,10 +160,16 @@ const FRAGMENT_SHADER_GLSL = `
|
|
|
160
160
|
int geomType = int(clamp(floor(baseGeomFloat + 0.5), 0.0, totalBase - 1.0));
|
|
161
161
|
|
|
162
162
|
if (geomType == 0) {
|
|
163
|
-
// Tetrahedron lattice
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
// Tetrahedron lattice — tetrahedral symmetry planes
|
|
164
|
+
float d = u_gridDensity * 0.08;
|
|
165
|
+
vec3 c1 = normalize(vec3(1.0, 1.0, 1.0));
|
|
166
|
+
vec3 c2 = normalize(vec3(-1.0, -1.0, 1.0));
|
|
167
|
+
vec3 c3 = normalize(vec3(-1.0, 1.0, -1.0));
|
|
168
|
+
vec3 c4 = normalize(vec3(1.0, -1.0, -1.0));
|
|
169
|
+
vec3 q = fract(p.xyz * d + 0.5) - 0.5;
|
|
170
|
+
float minPlane = min(min(abs(dot(q, c1)), abs(dot(q, c2))),
|
|
171
|
+
min(abs(dot(q, c3)), abs(dot(q, c4))));
|
|
172
|
+
return (1.0 - smoothstep(0.0, 0.05, minPlane)) * u_morphFactor;
|
|
167
173
|
}
|
|
168
174
|
else if (geomType == 1) {
|
|
169
175
|
// Hypercube lattice
|
|
@@ -429,8 +435,15 @@ fn geometryFunction_w(p: vec4<f32>) -> f32 {
|
|
|
429
435
|
let gt = i32(clamp(floor(baseFloat + 0.5), 0.0, 7.0));
|
|
430
436
|
let d = u.gridDensity * 0.08;
|
|
431
437
|
if (gt == 0) {
|
|
432
|
-
|
|
433
|
-
|
|
438
|
+
// Tetrahedron — tetrahedral symmetry planes
|
|
439
|
+
let c1 = normalize(vec3<f32>(1.0, 1.0, 1.0));
|
|
440
|
+
let c2 = normalize(vec3<f32>(-1.0, -1.0, 1.0));
|
|
441
|
+
let c3 = normalize(vec3<f32>(-1.0, 1.0, -1.0));
|
|
442
|
+
let c4 = normalize(vec3<f32>(1.0, -1.0, -1.0));
|
|
443
|
+
let q = fract(p.xyz * d + 0.5) - 0.5;
|
|
444
|
+
let minPlane = min(min(abs(dot(q, c1)), abs(dot(q, c2))),
|
|
445
|
+
min(abs(dot(q, c3)), abs(dot(q, c4))));
|
|
446
|
+
return (1.0 - smoothstep(0.0, 0.05, minPlane)) * u.morphFactor;
|
|
434
447
|
} else if (gt == 1) {
|
|
435
448
|
let pos = fract(p * d); let dist = min(pos, 1.0 - pos);
|
|
436
449
|
return min(min(dist.x, dist.y), min(dist.z, dist.w)) * u.morphFactor;
|
|
@@ -634,15 +647,19 @@ export class FacetedSystem {
|
|
|
634
647
|
return false;
|
|
635
648
|
}
|
|
636
649
|
|
|
637
|
-
async initialize() {
|
|
650
|
+
async initialize(options = {}) {
|
|
638
651
|
if (this.initialized) return true;
|
|
639
|
-
const canvas =
|
|
652
|
+
const canvas = options.canvas ||
|
|
653
|
+
document.getElementById('faceted-content-canvas') ||
|
|
640
654
|
document.getElementById('content-canvas');
|
|
641
655
|
if (!canvas) {
|
|
642
656
|
console.warn("FacetedSystem: No canvas found for initialize()");
|
|
643
657
|
return false;
|
|
644
658
|
}
|
|
645
|
-
return this.initWithBridge(canvas, {
|
|
659
|
+
return this.initWithBridge(canvas, {
|
|
660
|
+
preferWebGPU: options.preferWebGPU !== undefined ? options.preferWebGPU : true,
|
|
661
|
+
debug: options.debug || false
|
|
662
|
+
});
|
|
646
663
|
}
|
|
647
664
|
|
|
648
665
|
// ─── Parameters ───
|
|
@@ -775,7 +792,7 @@ export class FacetedSystem {
|
|
|
775
792
|
if (layer) layer.style.display = active ? 'block' : 'none';
|
|
776
793
|
}
|
|
777
794
|
|
|
778
|
-
init(context) { return this.initialize(); }
|
|
795
|
+
init(context = {}) { return this.initialize(context); }
|
|
779
796
|
|
|
780
797
|
resize(width, height, pixelRatio = 1) {
|
|
781
798
|
const w = Math.floor(width * pixelRatio);
|