@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,552 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIB3+ TouchDesigner GLSL TOP Export
|
|
3
|
+
*
|
|
4
|
+
* Generates TouchDesigner-compatible GLSL TOP (Texture Operator) code from
|
|
5
|
+
* VIB3+ shader systems. Adapts WebGL GLSL to TouchDesigner's GLSL environment,
|
|
6
|
+
* handling uniform naming conventions, texture I/O, and TD-specific headers.
|
|
7
|
+
*
|
|
8
|
+
* TouchDesigner uses GLSL 3.30+ with specific built-in uniforms and
|
|
9
|
+
* output conventions. This module translates VIB3+ shaders accordingly.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* const glslTop = Vib3TouchDesignerExport.exportGLSLTOP('quantum');
|
|
13
|
+
* // Paste into a GLSL TOP in TouchDesigner
|
|
14
|
+
*
|
|
15
|
+
* const tox = Vib3TouchDesignerExport.exportTOX();
|
|
16
|
+
* // Save as .tox component file
|
|
17
|
+
*
|
|
18
|
+
* @module Vib3TouchDesignerExport
|
|
19
|
+
* @version 1.0.0
|
|
20
|
+
* @license All Rights Reserved - Clear Seas Solutions LLC
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* TouchDesigner uniform mapping from VIB3 parameter names.
|
|
25
|
+
* TD custom uniforms are prefixed with 'u' by convention in Custom Parameters.
|
|
26
|
+
* @constant {Object}
|
|
27
|
+
*/
|
|
28
|
+
const TD_UNIFORM_MAP = {
|
|
29
|
+
u_time: { tdName: 'uTime', tdType: 'float', source: 'absTime.seconds', description: 'Time in seconds (auto from TD timeline)' },
|
|
30
|
+
u_resolution: { tdName: 'uResolution', tdType: 'vec2', source: 'uTDOutputInfo.res.zw', description: 'Output resolution (auto from TD)' },
|
|
31
|
+
u_geometry: { tdName: 'uGeometry', tdType: 'float', customPar: true, range: [0, 23], default: 0, description: 'Geometry variant (0-23)' },
|
|
32
|
+
u_gridDensity: { tdName: 'uGriddensity', tdType: 'float', customPar: true, range: [4, 100], default: 15, description: 'Pattern density' },
|
|
33
|
+
u_morphFactor: { tdName: 'uMorphfactor', tdType: 'float', customPar: true, range: [0, 2], default: 1.0, description: 'Shape interpolation' },
|
|
34
|
+
u_chaos: { tdName: 'uChaos', tdType: 'float', customPar: true, range: [0, 1], default: 0.2, description: 'Randomness level' },
|
|
35
|
+
u_speed: { tdName: 'uSpeed', tdType: 'float', customPar: true, range: [0.1, 3], default: 1.0, description: 'Animation speed' },
|
|
36
|
+
u_hue: { tdName: 'uHue', tdType: 'float', customPar: true, range: [0, 1], default: 0.556, description: 'Color hue (0-1, normalized)' },
|
|
37
|
+
u_intensity: { tdName: 'uIntensity', tdType: 'float', customPar: true, range: [0, 1], default: 0.5, description: 'Visual intensity' },
|
|
38
|
+
u_saturation: { tdName: 'uSaturation', tdType: 'float', customPar: true, range: [0, 1], default: 0.8, description: 'Color saturation' },
|
|
39
|
+
u_dimension: { tdName: 'uDimension', tdType: 'float', customPar: true, range: [3.0, 4.5], default: 3.5, description: '4D projection distance' },
|
|
40
|
+
u_rot4dXY: { tdName: 'uRot4dxy', tdType: 'float', customPar: true, range: [-6.28, 6.28], default: 0, description: 'XY plane rotation (radians)' },
|
|
41
|
+
u_rot4dXZ: { tdName: 'uRot4dxz', tdType: 'float', customPar: true, range: [-6.28, 6.28], default: 0, description: 'XZ plane rotation (radians)' },
|
|
42
|
+
u_rot4dYZ: { tdName: 'uRot4dyz', tdType: 'float', customPar: true, range: [-6.28, 6.28], default: 0, description: 'YZ plane rotation (radians)' },
|
|
43
|
+
u_rot4dXW: { tdName: 'uRot4dxw', tdType: 'float', customPar: true, range: [-2, 2], default: 0, description: 'XW hyperplane rotation (radians)' },
|
|
44
|
+
u_rot4dYW: { tdName: 'uRot4dyw', tdType: 'float', customPar: true, range: [-2, 2], default: 0, description: 'YW hyperplane rotation (radians)' },
|
|
45
|
+
u_rot4dZW: { tdName: 'uRot4dzw', tdType: 'float', customPar: true, range: [-2, 2], default: 0, description: 'ZW hyperplane rotation (radians)' },
|
|
46
|
+
u_bass: { tdName: 'uBass', tdType: 'float', customPar: true, range: [0, 1], default: 0, description: 'Audio bass level (0-1)' },
|
|
47
|
+
u_mid: { tdName: 'uMid', tdType: 'float', customPar: true, range: [0, 1], default: 0, description: 'Audio mid level (0-1)' },
|
|
48
|
+
u_high: { tdName: 'uHigh', tdType: 'float', customPar: true, range: [0, 1], default: 0, description: 'Audio high level (0-1)' }
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Available VIB3 systems for export.
|
|
53
|
+
* @constant {string[]}
|
|
54
|
+
*/
|
|
55
|
+
const EXPORTABLE_SYSTEMS = ['quantum', 'faceted', 'holographic'];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* TouchDesigner export for VIB3+ visualization shaders.
|
|
59
|
+
*
|
|
60
|
+
* Translates VIB3+ WebGL shaders into TouchDesigner GLSL TOP format,
|
|
61
|
+
* handling differences in GLSL version, uniform conventions, and output.
|
|
62
|
+
*
|
|
63
|
+
* @class
|
|
64
|
+
*/
|
|
65
|
+
export class Vib3TouchDesignerExport {
|
|
66
|
+
/**
|
|
67
|
+
* Exports a VIB3+ system shader as TouchDesigner GLSL TOP code.
|
|
68
|
+
*
|
|
69
|
+
* The generated code:
|
|
70
|
+
* - Uses GLSL 3.30 (TD standard) with proper layout qualifiers
|
|
71
|
+
* - Maps VIB3 uniforms to TD Custom Parameter conventions
|
|
72
|
+
* - Uses TD's built-in absTime.seconds for time
|
|
73
|
+
* - Uses uTDOutputInfo.res for resolution
|
|
74
|
+
* - Outputs to fragColor with layout(location = 0) qualifier
|
|
75
|
+
* - Includes all 6D rotation matrices and 24 geometry functions
|
|
76
|
+
* - Includes audio reactivity uniforms for CHOP-driven input
|
|
77
|
+
*
|
|
78
|
+
* @param {string} [system='faceted'] - VIB3 system: 'quantum' | 'faceted' | 'holographic'
|
|
79
|
+
* @param {object} [options={}] - Export options
|
|
80
|
+
* @param {boolean} [options.includeComments=true] - Include descriptive comments
|
|
81
|
+
* @param {boolean} [options.includeAudio=true] - Include audio reactivity uniforms
|
|
82
|
+
* @param {boolean} [options.useCustomParams=true] - Use TD Custom Parameters (vs. hardcoded values)
|
|
83
|
+
* @returns {string} Complete GLSL TOP source code for TouchDesigner
|
|
84
|
+
* @example
|
|
85
|
+
* const glsl = Vib3TouchDesignerExport.exportGLSLTOP('quantum', { includeAudio: true });
|
|
86
|
+
* // Paste into GLSL TOP's pixel shader in TouchDesigner
|
|
87
|
+
*/
|
|
88
|
+
static exportGLSLTOP(system = 'faceted', options = {}) {
|
|
89
|
+
const includeComments = options.includeComments !== false;
|
|
90
|
+
const includeAudio = options.includeAudio !== false;
|
|
91
|
+
const useCustomParams = options.useCustomParams !== false;
|
|
92
|
+
|
|
93
|
+
let code = '';
|
|
94
|
+
|
|
95
|
+
// ---- TD Header ----
|
|
96
|
+
if (includeComments) {
|
|
97
|
+
code += `// ============================================================
|
|
98
|
+
// VIB3+ 4D Visualization - TouchDesigner GLSL TOP
|
|
99
|
+
// System: ${system}
|
|
100
|
+
// Generated by VIB3+ Engine - Clear Seas Solutions LLC
|
|
101
|
+
//
|
|
102
|
+
// Setup:
|
|
103
|
+
// 1. Create a GLSL TOP
|
|
104
|
+
// 2. Paste this code into the Pixel Shader
|
|
105
|
+
// 3. Add Custom Parameters (Ctrl+P on the GLSL TOP):
|
|
106
|
+
// - See parameter list below for names and ranges
|
|
107
|
+
// 4. For audio reactivity, connect an Audio Device In CHOP
|
|
108
|
+
// to the Custom Parameters via CHOP Execute or Export
|
|
109
|
+
// ============================================================
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ---- Uniforms ----
|
|
114
|
+
code += `
|
|
115
|
+
// TouchDesigner built-in uniforms (automatically available)
|
|
116
|
+
// uniform float absTime.seconds;
|
|
117
|
+
// uniform vec4 uTDOutputInfo.res; // .zw = width, height
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
if (useCustomParams) {
|
|
122
|
+
code += `// Custom Parameter uniforms (add these as Custom Parameters on the GLSL TOP)\n`;
|
|
123
|
+
for (const [vib3Name, td] of Object.entries(TD_UNIFORM_MAP)) {
|
|
124
|
+
if (td.customPar) {
|
|
125
|
+
const comment = includeComments ? ` // ${td.description} [${td.range[0]} - ${td.range[1]}]` : '';
|
|
126
|
+
code += `uniform ${td.tdType} ${td.tdName};${comment}\n`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
code += `// Hardcoded defaults (replace with Custom Parameters for interactive control)\n`;
|
|
131
|
+
for (const [vib3Name, td] of Object.entries(TD_UNIFORM_MAP)) {
|
|
132
|
+
if (td.customPar) {
|
|
133
|
+
code += `#define ${td.tdName} ${typeof td.default === 'number' ? td.default.toFixed(4) : td.default}\n`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ---- Output declaration ----
|
|
139
|
+
code += `
|
|
140
|
+
// Output
|
|
141
|
+
layout(location = 0) out vec4 fragColor;
|
|
142
|
+
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
// ---- Rotation matrices ----
|
|
146
|
+
code += `// ---- 6D Rotation Matrices ----
|
|
147
|
+
mat4 rotateXY(float a) { float c=cos(a),s=sin(a); return mat4(c,-s,0,0, s,c,0,0, 0,0,1,0, 0,0,0,1); }
|
|
148
|
+
mat4 rotateXZ(float a) { float c=cos(a),s=sin(a); return mat4(c,0,-s,0, 0,1,0,0, s,0,c,0, 0,0,0,1); }
|
|
149
|
+
mat4 rotateYZ(float a) { float c=cos(a),s=sin(a); return mat4(1,0,0,0, 0,c,-s,0, 0,s,c,0, 0,0,0,1); }
|
|
150
|
+
mat4 rotateXW(float a) { float c=cos(a),s=sin(a); return mat4(c,0,0,-s, 0,1,0,0, 0,0,1,0, s,0,0,c); }
|
|
151
|
+
mat4 rotateYW(float a) { float c=cos(a),s=sin(a); return mat4(1,0,0,0, 0,c,0,-s, 0,0,1,0, 0,s,0,c); }
|
|
152
|
+
mat4 rotateZW(float a) { float c=cos(a),s=sin(a); return mat4(1,0,0,0, 0,1,0,0, 0,0,c,-s, 0,0,s,c); }
|
|
153
|
+
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
// ---- Projection ----
|
|
157
|
+
code += `// ---- 4D Projection ----
|
|
158
|
+
vec3 project4Dto3D(vec4 p, float dim) {
|
|
159
|
+
float w = 1.0 / (dim - p.w);
|
|
160
|
+
return p.xyz * w;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
// ---- HSL to RGB ----
|
|
166
|
+
code += `// ---- HSL to RGB ----
|
|
167
|
+
vec3 hsl2rgb(float h, float s, float l) {
|
|
168
|
+
float c = (1.0 - abs(2.0 * l - 1.0)) * s;
|
|
169
|
+
float hp = h * 6.0;
|
|
170
|
+
float x = c * (1.0 - abs(mod(hp, 2.0) - 1.0));
|
|
171
|
+
float m = l - c * 0.5;
|
|
172
|
+
vec3 rgb;
|
|
173
|
+
if (hp < 1.0) rgb = vec3(c, x, 0);
|
|
174
|
+
else if (hp < 2.0) rgb = vec3(x, c, 0);
|
|
175
|
+
else if (hp < 3.0) rgb = vec3(0, c, x);
|
|
176
|
+
else if (hp < 4.0) rgb = vec3(0, x, c);
|
|
177
|
+
else if (hp < 5.0) rgb = vec3(x, 0, c);
|
|
178
|
+
else rgb = vec3(c, 0, x);
|
|
179
|
+
return rgb + m;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
`;
|
|
183
|
+
|
|
184
|
+
// ---- Core warp functions ----
|
|
185
|
+
code += `// ---- Core Warp Functions (24 Geometry Support) ----
|
|
186
|
+
vec3 warpHypersphere(vec3 p, float geomIdx, float t, float spd, float morph, float dim) {
|
|
187
|
+
float radius = length(p);
|
|
188
|
+
float mb = clamp(morph * 0.6 + (dim - 3.0) * 0.25, 0.0, 2.0);
|
|
189
|
+
float w = sin(radius * (1.3 + geomIdx * 0.12) + t * 0.8 * spd) * (0.4 + mb * 0.45);
|
|
190
|
+
vec4 p4 = vec4(p * (1.0 + mb * 0.2), w);
|
|
191
|
+
p4 = rotateXY(uRot4dxy) * rotateXZ(uRot4dxz) * rotateYZ(uRot4dyz) *
|
|
192
|
+
rotateXW(uRot4dxw) * rotateYW(uRot4dyw) * rotateZW(uRot4dzw) * p4;
|
|
193
|
+
return mix(p, project4Dto3D(p4, dim), clamp(0.45 + mb * 0.35, 0.0, 1.0));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
vec3 warpHypertetra(vec3 p, float geomIdx, float t, float spd, float morph, float dim) {
|
|
197
|
+
vec3 c1 = normalize(vec3(1,1,1)), c2 = normalize(vec3(-1,-1,1));
|
|
198
|
+
vec3 c3 = normalize(vec3(-1,1,-1)), c4 = normalize(vec3(1,-1,-1));
|
|
199
|
+
float mb = clamp(morph * 0.8 + (dim - 3.0) * 0.2, 0.0, 2.0);
|
|
200
|
+
float basis = dot(p, c1) * 0.14 + dot(p, c2) * 0.1 + dot(p, c3) * 0.08;
|
|
201
|
+
float w = sin(basis * 5.5 + t * 0.9 * spd) * cos(dot(p, c4) * 4.2 - t * 0.7 * spd) * (0.5 + mb * 0.4);
|
|
202
|
+
vec3 ofs = vec3(dot(p, c1), dot(p, c2), dot(p, c3)) * 0.1 * mb;
|
|
203
|
+
vec4 p4 = vec4(p + ofs, w);
|
|
204
|
+
p4 = rotateXY(uRot4dxy) * rotateXZ(uRot4dxz) * rotateYZ(uRot4dyz) *
|
|
205
|
+
rotateXW(uRot4dxw) * rotateYW(uRot4dyw) * rotateZW(uRot4dzw) * p4;
|
|
206
|
+
vec3 proj = project4Dto3D(p4, dim);
|
|
207
|
+
float plane = min(min(abs(dot(p, c1)), abs(dot(p, c2))), min(abs(dot(p, c3)), abs(dot(p, c4))));
|
|
208
|
+
vec3 blended = mix(p, proj, clamp(0.45 + mb * 0.35, 0.0, 1.0));
|
|
209
|
+
return mix(blended, blended * (1.0 - plane * 0.55), 0.2 + mb * 0.2);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
vec3 applyCoreWarp(vec3 p, float geomType, float t, float spd, float morph, float dim) {
|
|
213
|
+
float coreF = floor(geomType / 8.0);
|
|
214
|
+
int core = int(clamp(coreF, 0.0, 2.0));
|
|
215
|
+
float baseF = mod(geomType, 8.0);
|
|
216
|
+
if (core == 1) return warpHypersphere(p, baseF, t, spd, morph, dim);
|
|
217
|
+
if (core == 2) return warpHypertetra(p, baseF, t, spd, morph, dim);
|
|
218
|
+
return p;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
// ---- Geometry functions ----
|
|
224
|
+
code += `// ---- 8 Base Geometry Lattice Functions ----
|
|
225
|
+
float tetraLattice(vec3 p, float gs) { vec3 q=fract(p*gs)-0.5; float d1=length(q); float d2=length(q-vec3(0.4,0,0)); float d3=length(q-vec3(0,0.4,0)); float d4=length(q-vec3(0,0,0.4)); return max(1.0-smoothstep(0.0,0.04,min(min(d1,d2),min(d3,d4))), (1.0-smoothstep(0.0,0.02,abs(length(q.xy)-0.2)))*0.5); }
|
|
226
|
+
float cubeLattice(vec3 p, float gs) { vec3 g=fract(p*gs); vec3 e=min(g,1.0-g); return max((1.0-smoothstep(0.0,0.03,min(min(e.x,e.y),e.z)))*0.7, 1.0-smoothstep(0.45,0.5,max(max(abs(g.x-0.5),abs(g.y-0.5)),abs(g.z-0.5)))); }
|
|
227
|
+
float sphereLattice(vec3 p, float gs) { vec3 c=fract(p*gs)-0.5; return max(1.0-smoothstep(0.15,0.25,length(c)), (1.0-smoothstep(0.0,0.02,abs(length(c.xy)-0.3)))*0.6); }
|
|
228
|
+
float torusLattice(vec3 p, float gs) { vec3 c=fract(p*gs)-0.5; float td=length(vec2(length(c.xy)-0.3,c.z)); return 1.0-smoothstep(0.08,0.12,td); }
|
|
229
|
+
float kleinLattice(vec3 p, float gs) { vec3 c=fract(p*gs)-0.5; float u2=atan(c.y,c.x)/3.14159+1.0; float v2=c.z+0.5; vec3 kp=vec3((2.0+cos(u2*0.5))*cos(u2),(2.0+cos(u2*0.5))*sin(u2),sin(u2*0.5)+v2)*0.1; return 1.0-smoothstep(0.1,0.15,length(c-kp)); }
|
|
230
|
+
float fractalLattice(vec3 p, float gs) { vec3 c=abs(fract(p*gs)*2.0-1.0); float d=length(max(abs(c)-0.3,0.0)); for(int i=0;i<3;i++){c=abs(c*2.0-1.0);d=min(d,length(max(abs(c)-0.3,0.0))/pow(2.0,float(i+1)));} return 1.0-smoothstep(0.0,0.05,d); }
|
|
231
|
+
float waveLattice(vec3 p, float gs, float t, float spd) { return (sin(p.x*gs*2.0+t*2.0*spd)+sin(p.y*gs*1.8+t*1.5*spd)+sin(p.z*gs*2.2+t*1.8*spd))/6.0+0.5; }
|
|
232
|
+
float crystalLattice(vec3 p, float gs) { vec3 c=fract(p*gs)-0.5; float cr=max(max(abs(c.x)+abs(c.y),abs(c.y)+abs(c.z)),abs(c.x)+abs(c.z)); return max(1.0-smoothstep(0.3,0.4,cr), max(max(1.0-smoothstep(0.0,0.02,abs(abs(c.x)-0.35)), 1.0-smoothstep(0.0,0.02,abs(abs(c.y)-0.35))), 1.0-smoothstep(0.0,0.02,abs(abs(c.z)-0.35)))*0.5); }
|
|
233
|
+
|
|
234
|
+
float geometryFunc(vec3 wp, float gs, float geom, float t, float spd) {
|
|
235
|
+
float base = mod(geom, 8.0);
|
|
236
|
+
int gt = int(clamp(floor(base + 0.5), 0.0, 7.0));
|
|
237
|
+
if (gt == 0) return tetraLattice(wp, gs);
|
|
238
|
+
if (gt == 1) return cubeLattice(wp, gs);
|
|
239
|
+
if (gt == 2) return sphereLattice(wp, gs);
|
|
240
|
+
if (gt == 3) return torusLattice(wp, gs);
|
|
241
|
+
if (gt == 4) return kleinLattice(wp, gs);
|
|
242
|
+
if (gt == 5) return fractalLattice(wp, gs);
|
|
243
|
+
if (gt == 6) return waveLattice(wp, gs, t, spd);
|
|
244
|
+
if (gt == 7) return crystalLattice(wp, gs);
|
|
245
|
+
return cubeLattice(wp, gs);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
`;
|
|
249
|
+
|
|
250
|
+
// ---- Main function (system-specific) ----
|
|
251
|
+
const mainFunctions = {
|
|
252
|
+
faceted: `// ---- Main (Faceted System) ----
|
|
253
|
+
void main() {
|
|
254
|
+
// TouchDesigner: gl_FragCoord is pixel coordinates
|
|
255
|
+
vec2 res = uTDOutputInfo.res.zw;
|
|
256
|
+
vec2 uv = (gl_FragCoord.xy - res * 0.5) / min(res.x, res.y);
|
|
257
|
+
|
|
258
|
+
float t = absTime.seconds * uSpeed;
|
|
259
|
+
vec4 p = vec4(uv * 3.0, sin(t * 3.0), cos(t * 2.0));
|
|
260
|
+
|
|
261
|
+
// Apply 6D rotation
|
|
262
|
+
p = rotateXY(uRot4dxy) * rotateXZ(uRot4dxz) * rotateYZ(uRot4dyz) *
|
|
263
|
+
rotateXW(uRot4dxw) * rotateYW(uRot4dyw) * rotateZW(uRot4dzw) * p;
|
|
264
|
+
|
|
265
|
+
vec3 proj = project4Dto3D(p, uDimension);
|
|
266
|
+
vec3 warped = applyCoreWarp(proj, uGeometry, t, uSpeed, uMorphfactor, uDimension);
|
|
267
|
+
float gs = uGriddensity * 0.08;
|
|
268
|
+
|
|
269
|
+
float value = geometryFunc(warped, gs, uGeometry, t, uSpeed) * uMorphfactor;
|
|
270
|
+
value += sin(proj.x * 7.0) * cos(proj.y * 11.0) * sin(proj.z * 13.0) * uChaos;
|
|
271
|
+
${includeAudio ? `
|
|
272
|
+
// Audio reactivity
|
|
273
|
+
value += uBass * 0.3 + uMid * 0.2 + uHigh * 0.1;
|
|
274
|
+
` : ''}
|
|
275
|
+
float gi = pow(1.0 - clamp(abs(value * 0.8), 0.0, 1.0), 1.5) * uIntensity;
|
|
276
|
+
vec3 color = hsl2rgb(uHue, uSaturation, 0.3 + gi * 0.5) * gi * 2.0;
|
|
277
|
+
|
|
278
|
+
fragColor = TDOutputSwizzle(vec4(color, gi));
|
|
279
|
+
}`,
|
|
280
|
+
|
|
281
|
+
quantum: `// ---- Main (Quantum System) ----
|
|
282
|
+
void main() {
|
|
283
|
+
vec2 res = uTDOutputInfo.res.zw;
|
|
284
|
+
vec2 uv = (gl_FragCoord.xy - res * 0.5) / min(res.x, res.y);
|
|
285
|
+
|
|
286
|
+
float t = absTime.seconds * uSpeed;
|
|
287
|
+
vec4 p = vec4(uv * 3.0, sin(t * 3.0), cos(t * 2.0));
|
|
288
|
+
|
|
289
|
+
p = rotateXY(uRot4dxy) * rotateXZ(uRot4dxz) * rotateYZ(uRot4dyz) *
|
|
290
|
+
rotateXW(uRot4dxw) * rotateYW(uRot4dyw) * rotateZW(uRot4dzw) * p;
|
|
291
|
+
|
|
292
|
+
vec3 proj = project4Dto3D(p, uDimension);
|
|
293
|
+
vec3 warped = applyCoreWarp(proj, uGeometry, t, uSpeed, uMorphfactor, uDimension);
|
|
294
|
+
float gs = uGriddensity * 0.08;
|
|
295
|
+
|
|
296
|
+
float value = geometryFunc(warped, gs, uGeometry, t, uSpeed) * uMorphfactor;
|
|
297
|
+
float noise = sin(proj.x * 7.0) * cos(proj.y * 11.0) * sin(proj.z * 13.0);
|
|
298
|
+
value += noise * uChaos;
|
|
299
|
+
${includeAudio ? `
|
|
300
|
+
// Audio reactivity (quantum-enhanced)
|
|
301
|
+
value += uBass * 0.4 + uMid * 0.3;
|
|
302
|
+
` : ''}
|
|
303
|
+
float gi = pow(1.0 - clamp(abs(value * 0.8), 0.0, 1.0), 1.5);
|
|
304
|
+
|
|
305
|
+
// Holographic shimmer
|
|
306
|
+
float shimmer = sin(uv.x * 20.0 + t * 5.0) * cos(uv.y * 15.0 + t * 3.0) * 0.1;
|
|
307
|
+
gi += shimmer * gi;
|
|
308
|
+
gi *= uIntensity;
|
|
309
|
+
|
|
310
|
+
vec3 color = hsl2rgb(uHue, uSaturation, 0.3 + gi * 0.5);
|
|
311
|
+
|
|
312
|
+
// RGB separation
|
|
313
|
+
float sep = gi * 0.05;
|
|
314
|
+
float dist = length(uv);
|
|
315
|
+
float angle = atan(uv.y, uv.x);
|
|
316
|
+
color.r += sin(dist * 30.0 + angle * 10.0 + t * 4.0) * sep;
|
|
317
|
+
color.g += cos(dist * 25.0 + angle * 8.0 + t * 3.5) * sep * 0.9;
|
|
318
|
+
color.b += sin(dist * 35.0 + angle * 12.0 + t * 4.5) * sep * 1.1;
|
|
319
|
+
|
|
320
|
+
fragColor = TDOutputSwizzle(vec4(color * gi * 2.0, gi));
|
|
321
|
+
}`,
|
|
322
|
+
|
|
323
|
+
holographic: `// ---- Main (Holographic System) ----
|
|
324
|
+
void main() {
|
|
325
|
+
vec2 res = uTDOutputInfo.res.zw;
|
|
326
|
+
vec2 uv = (gl_FragCoord.xy - res * 0.5) / min(res.x, res.y);
|
|
327
|
+
|
|
328
|
+
float t = absTime.seconds * uSpeed;
|
|
329
|
+
vec4 p = vec4(uv * 3.0, sin(t * 3.0), cos(t * 2.0));
|
|
330
|
+
|
|
331
|
+
p = rotateXY(uRot4dxy) * rotateXZ(uRot4dxz) * rotateYZ(uRot4dyz) *
|
|
332
|
+
rotateXW(uRot4dxw) * rotateYW(uRot4dyw) * rotateZW(uRot4dzw) * p;
|
|
333
|
+
|
|
334
|
+
vec3 proj = project4Dto3D(p, uDimension);
|
|
335
|
+
vec3 warped = applyCoreWarp(proj, uGeometry, t, uSpeed, uMorphfactor, uDimension);
|
|
336
|
+
float gs = uGriddensity * 0.08;
|
|
337
|
+
|
|
338
|
+
float value = geometryFunc(warped, gs, uGeometry, t, uSpeed) * uMorphfactor;
|
|
339
|
+
value += sin(proj.x * 7.0) * cos(proj.y * 11.0) * uChaos * 0.3;
|
|
340
|
+
${includeAudio ? `
|
|
341
|
+
value += uBass * 0.5 + uMid * 0.3;
|
|
342
|
+
` : ''}
|
|
343
|
+
float gi = pow(clamp(value, 0.0, 1.0), 1.5) * uIntensity;
|
|
344
|
+
|
|
345
|
+
// 5-layer holographic blend
|
|
346
|
+
vec3 bgColor = hsl2rgb(uHue, uSaturation * 0.7, 0.15) * (0.3 + gi * 0.4);
|
|
347
|
+
vec3 contentColor = hsl2rgb(uHue, uSaturation, 0.55) * (gi * 1.2 + 0.2);
|
|
348
|
+
vec3 highlightColor = hsl2rgb(fract(uHue + 0.15), uSaturation, 0.6) * pow(gi, 3.0) * 1.5;
|
|
349
|
+
vec3 accentColor = hsl2rgb(fract(uHue + 0.67), uSaturation, 0.5) * (sin(value * 50.0 + t * 10.0) * 0.5 + 0.5) * gi;
|
|
350
|
+
|
|
351
|
+
// Glassmorphic blend
|
|
352
|
+
float fresnel = pow(1.0 - abs(dot(normalize(vec3(uv, 1.0)), vec3(0, 0, 1))), 2.0);
|
|
353
|
+
vec3 color = bgColor * 0.4 + contentColor * 0.5 + highlightColor * 0.3 + accentColor * 0.15;
|
|
354
|
+
color += fresnel * hsl2rgb(fract(uHue + 0.33), uSaturation * 0.9, 0.3) * 0.2;
|
|
355
|
+
|
|
356
|
+
// Particles
|
|
357
|
+
vec2 puv = uv * 12.0;
|
|
358
|
+
vec2 pid = floor(puv);
|
|
359
|
+
float pdist = length(fract(puv) - 0.5);
|
|
360
|
+
float palpha = sin(t * 3.0 + dot(pid, vec2(127.1, 311.7))) * 0.5 + 0.5;
|
|
361
|
+
float particles = (1.0 - smoothstep(0.05, 0.2, pdist)) * palpha * 0.3;
|
|
362
|
+
color += particles * hsl2rgb(fract(uHue + 0.15), uSaturation * 0.5, 0.85);
|
|
363
|
+
|
|
364
|
+
fragColor = TDOutputSwizzle(vec4(color, gi * 0.8 + 0.1));
|
|
365
|
+
}`
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
code += mainFunctions[system] || mainFunctions.faceted;
|
|
369
|
+
code += '\n';
|
|
370
|
+
|
|
371
|
+
return code;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Exports a TouchDesigner .tox component structure (XML-based).
|
|
376
|
+
*
|
|
377
|
+
* The returned object represents the XML structure of a .tox file
|
|
378
|
+
* containing a GLSL TOP with all VIB3 Custom Parameters pre-configured.
|
|
379
|
+
*
|
|
380
|
+
* Note: TouchDesigner .tox files are binary containers. This method
|
|
381
|
+
* returns the component definition as structured data. For a true .tox,
|
|
382
|
+
* you would need to use TouchDesigner's Python scripting to create the
|
|
383
|
+
* component programmatically.
|
|
384
|
+
*
|
|
385
|
+
* @param {object} [options={}] - TOX generation options
|
|
386
|
+
* @param {string} [options.system='faceted'] - VIB3 system to include
|
|
387
|
+
* @param {string} [options.name='vib3_visualizer'] - Component name
|
|
388
|
+
* @returns {object} TOX component definition structure
|
|
389
|
+
*/
|
|
390
|
+
static exportTOX(options = {}) {
|
|
391
|
+
const system = options.system || 'faceted';
|
|
392
|
+
const name = options.name || 'vib3_visualizer';
|
|
393
|
+
|
|
394
|
+
const customParams = [];
|
|
395
|
+
for (const [vib3Name, td] of Object.entries(TD_UNIFORM_MAP)) {
|
|
396
|
+
if (td.customPar) {
|
|
397
|
+
customParams.push({
|
|
398
|
+
name: td.tdName,
|
|
399
|
+
label: td.description,
|
|
400
|
+
type: 'Float',
|
|
401
|
+
default: td.default,
|
|
402
|
+
min: td.range[0],
|
|
403
|
+
max: td.range[1],
|
|
404
|
+
clampMin: true,
|
|
405
|
+
clampMax: true
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return {
|
|
411
|
+
type: 'COMP',
|
|
412
|
+
name,
|
|
413
|
+
description: `VIB3+ ${system} 4D Visualization Component`,
|
|
414
|
+
version: '1.0.0',
|
|
415
|
+
operators: [
|
|
416
|
+
{
|
|
417
|
+
type: 'glslTOP',
|
|
418
|
+
name: `${name}_glsl`,
|
|
419
|
+
parameters: {
|
|
420
|
+
pixelshader: Vib3TouchDesignerExport.exportGLSLTOP(system),
|
|
421
|
+
outputresolution: 'Custom',
|
|
422
|
+
resolutionw: 1920,
|
|
423
|
+
resolutionh: 1080,
|
|
424
|
+
format: 'RGBA 8-bit',
|
|
425
|
+
npasses: 1
|
|
426
|
+
},
|
|
427
|
+
customParameters: customParams
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
pythonSetupScript: `
|
|
431
|
+
# VIB3+ TouchDesigner Component Setup Script
|
|
432
|
+
# Run this in a Script CHOP or textport to create the component
|
|
433
|
+
|
|
434
|
+
def create_vib3_comp(parent_op, name='${name}'):
|
|
435
|
+
"""Create a VIB3+ GLSL TOP with all Custom Parameters."""
|
|
436
|
+
comp = parent_op.create(baseCOMP, name)
|
|
437
|
+
|
|
438
|
+
# Create GLSL TOP
|
|
439
|
+
glsl = comp.create(glslTOP, '${name}_glsl')
|
|
440
|
+
glsl.par.resolutionw = 1920
|
|
441
|
+
glsl.par.resolutionh = 1080
|
|
442
|
+
glsl.par.outputresolution = 'Custom'
|
|
443
|
+
|
|
444
|
+
# Add Custom Parameters
|
|
445
|
+
page = comp.appendCustomPage('VIB3')
|
|
446
|
+
${customParams.map(p => ` page.appendFloat('${p.name}', label='${p.label}')[0].default = ${p.default}
|
|
447
|
+
page.appendFloat('${p.name}', label='${p.label}')[0].min = ${p.min}
|
|
448
|
+
page.appendFloat('${p.name}', label='${p.label}')[0].max = ${p.max}`).join('\n')}
|
|
449
|
+
|
|
450
|
+
# Set pixel shader
|
|
451
|
+
# (paste exported GLSL code into glsl.par.pixelshader)
|
|
452
|
+
|
|
453
|
+
# Wire custom params to GLSL uniforms
|
|
454
|
+
for par in comp.customPars:
|
|
455
|
+
glsl.par[par.name].expr = f"parent().par.{par.name}"
|
|
456
|
+
|
|
457
|
+
# Output
|
|
458
|
+
out = comp.create(outTOP, 'out1')
|
|
459
|
+
out.inputConnectors[0].connect(glsl)
|
|
460
|
+
|
|
461
|
+
return comp
|
|
462
|
+
`
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Returns usage documentation for the TouchDesigner export.
|
|
468
|
+
*
|
|
469
|
+
* @param {string} [system='faceted'] - System the docs are for
|
|
470
|
+
* @returns {string} Formatted usage instructions
|
|
471
|
+
*/
|
|
472
|
+
static getReadme(system = 'faceted') {
|
|
473
|
+
const customParamList = Object.entries(TD_UNIFORM_MAP)
|
|
474
|
+
.filter(([_, td]) => td.customPar)
|
|
475
|
+
.map(([_, td]) => ` - ${td.tdName}: ${td.description} [${td.range[0]} to ${td.range[1]}] (default: ${td.default})`)
|
|
476
|
+
.join('\n');
|
|
477
|
+
|
|
478
|
+
return `# VIB3+ TouchDesigner Integration
|
|
479
|
+
## System: ${system}
|
|
480
|
+
|
|
481
|
+
### Quick Setup
|
|
482
|
+
|
|
483
|
+
1. **Create a GLSL TOP**
|
|
484
|
+
- Right-click in the network editor > TOP > GLSL
|
|
485
|
+
- Set Output Resolution to your desired size (e.g. 1920x1080)
|
|
486
|
+
|
|
487
|
+
2. **Paste the Shader**
|
|
488
|
+
- Open the GLSL TOP's parameters
|
|
489
|
+
- Click the "Pixel" tab
|
|
490
|
+
- Paste the exported GLSL code into the pixel shader field
|
|
491
|
+
|
|
492
|
+
3. **Add Custom Parameters**
|
|
493
|
+
- Select the GLSL TOP
|
|
494
|
+
- Press Ctrl+P to open Custom Parameters
|
|
495
|
+
- Add the following Float parameters:
|
|
496
|
+
|
|
497
|
+
${customParamList}
|
|
498
|
+
|
|
499
|
+
4. **Wire Custom Parameters**
|
|
500
|
+
- In the GLSL TOP's "Vectors 1" page, reference custom params:
|
|
501
|
+
e.g., me.par.uGeometry for the geometry parameter
|
|
502
|
+
|
|
503
|
+
### Audio Reactivity
|
|
504
|
+
|
|
505
|
+
1. Create an **Audio Device In CHOP**
|
|
506
|
+
2. Add an **Audio Spectrum CHOP** (optional, for frequency bands)
|
|
507
|
+
3. Use **CHOP Execute** or **Export CHOP** to map:
|
|
508
|
+
- Low frequency band -> uBass parameter
|
|
509
|
+
- Mid frequency band -> uMid parameter
|
|
510
|
+
- High frequency band -> uHigh parameter
|
|
511
|
+
|
|
512
|
+
### LFO Animation
|
|
513
|
+
|
|
514
|
+
Use **LFO CHOPs** to animate rotation parameters:
|
|
515
|
+
- Connect LFO output to uRot4dxw, uRot4dyw, uRot4dzw for smooth 4D rotation
|
|
516
|
+
- Recommended: sine wave, 0.1-0.5 Hz, amplitude matching parameter range
|
|
517
|
+
|
|
518
|
+
### Performance Tips
|
|
519
|
+
|
|
520
|
+
- Start with 1080p resolution; scale up as GPU allows
|
|
521
|
+
- Reduce uGriddensity for better performance on complex geometries
|
|
522
|
+
- The fractal geometry (5) is most GPU-intensive
|
|
523
|
+
- Use TOP > Resolution to downsample if needed
|
|
524
|
+
|
|
525
|
+
### Geometry Guide
|
|
526
|
+
|
|
527
|
+
| Index | Base | Core |
|
|
528
|
+
|-------|------|------|
|
|
529
|
+
| 0-7 | Tet/Cube/Sph/Tor/Kln/Frc/Wav/Cry | Base |
|
|
530
|
+
| 8-15 | Same | Hypersphere |
|
|
531
|
+
| 16-23 | Same | Hypertetrahedron |
|
|
532
|
+
|
|
533
|
+
### Generated by VIB3+ Engine - Clear Seas Solutions LLC
|
|
534
|
+
`;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Returns the TouchDesigner uniform mapping table.
|
|
539
|
+
* @returns {Object} Map of VIB3 uniform names to TD definitions
|
|
540
|
+
*/
|
|
541
|
+
static getUniformMap() {
|
|
542
|
+
return { ...TD_UNIFORM_MAP };
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Returns the list of exportable system names.
|
|
547
|
+
* @returns {string[]}
|
|
548
|
+
*/
|
|
549
|
+
static getExportableSystems() {
|
|
550
|
+
return [...EXPORTABLE_SYSTEMS];
|
|
551
|
+
}
|
|
552
|
+
}
|