@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,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommandBuffer TypeScript Definitions
|
|
3
|
+
* VIB3+ SDK - Command Batching and Sorting
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { RenderCommand, RenderBackend, CommandType } from './RenderCommand';
|
|
7
|
+
|
|
8
|
+
/** Sort mode for command buffer */
|
|
9
|
+
export const enum SortMode {
|
|
10
|
+
/** No sorting - commands execute in submission order */
|
|
11
|
+
NONE = 'none',
|
|
12
|
+
/** Sort by state to minimize GPU state changes */
|
|
13
|
+
STATE = 'state',
|
|
14
|
+
/** Sort front-to-back for early-z optimization */
|
|
15
|
+
FRONT_TO_BACK = 'front_to_back',
|
|
16
|
+
/** Sort back-to-front for correct transparency */
|
|
17
|
+
BACK_TO_FRONT = 'back_to_front',
|
|
18
|
+
/** Use custom comparator function */
|
|
19
|
+
CUSTOM = 'custom'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Command buffer options */
|
|
23
|
+
export interface CommandBufferOptions {
|
|
24
|
+
sortMode?: SortMode;
|
|
25
|
+
label?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Command buffer statistics */
|
|
29
|
+
export interface CommandBufferStats {
|
|
30
|
+
commandCount: number;
|
|
31
|
+
drawCalls: number;
|
|
32
|
+
triangles: number;
|
|
33
|
+
stateChanges: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Execution profiling result */
|
|
37
|
+
export interface ExecutionProfile extends CommandBufferStats {
|
|
38
|
+
executionTime: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Custom command comparator */
|
|
42
|
+
export type CommandComparator = (a: RenderCommand, b: RenderCommand) => number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Command buffer for batching and sorting render commands
|
|
46
|
+
*/
|
|
47
|
+
export declare class CommandBuffer {
|
|
48
|
+
sortMode: SortMode;
|
|
49
|
+
customComparator: CommandComparator | null;
|
|
50
|
+
label: string;
|
|
51
|
+
|
|
52
|
+
constructor(options?: CommandBufferOptions);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get number of commands in buffer
|
|
56
|
+
*/
|
|
57
|
+
readonly length: number;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Check if buffer is empty
|
|
61
|
+
*/
|
|
62
|
+
readonly isEmpty: boolean;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get copy of commands array
|
|
66
|
+
*/
|
|
67
|
+
readonly commands: RenderCommand[];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get buffer statistics
|
|
71
|
+
*/
|
|
72
|
+
readonly stats: CommandBufferStats;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Begin recording commands
|
|
76
|
+
*/
|
|
77
|
+
begin(): void;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* End recording commands
|
|
81
|
+
*/
|
|
82
|
+
end(): void;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Add a command to the buffer
|
|
86
|
+
*/
|
|
87
|
+
add(command: RenderCommand): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Add multiple commands to the buffer
|
|
91
|
+
*/
|
|
92
|
+
addAll(commands: RenderCommand[]): void;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Clear all commands
|
|
96
|
+
*/
|
|
97
|
+
clear(): void;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Sort commands according to sort mode
|
|
101
|
+
*/
|
|
102
|
+
sort(): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Execute all commands on a backend
|
|
106
|
+
*/
|
|
107
|
+
execute(backend: RenderBackend): void;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Execute with profiling and return statistics
|
|
111
|
+
*/
|
|
112
|
+
executeWithProfiling(backend: RenderBackend): ExecutionProfile;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Filter commands by type
|
|
116
|
+
*/
|
|
117
|
+
filterByType(type: CommandType): RenderCommand[];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get only draw commands
|
|
121
|
+
*/
|
|
122
|
+
getDrawCommands(): RenderCommand[];
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Merge another buffer into this one
|
|
126
|
+
*/
|
|
127
|
+
merge(other: CommandBuffer): void;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Clone this buffer
|
|
131
|
+
*/
|
|
132
|
+
clone(): CommandBuffer;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Pool for reusing command buffers
|
|
137
|
+
*/
|
|
138
|
+
export declare class CommandBufferPool {
|
|
139
|
+
constructor(initialSize?: number);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Acquire a buffer from the pool
|
|
143
|
+
*/
|
|
144
|
+
acquire(options?: CommandBufferOptions): CommandBuffer;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Release a buffer back to the pool
|
|
148
|
+
*/
|
|
149
|
+
release(buffer: CommandBuffer): void;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Release all buffers back to the pool
|
|
153
|
+
*/
|
|
154
|
+
releaseAll(): void;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get pool statistics
|
|
158
|
+
*/
|
|
159
|
+
getStats(): {
|
|
160
|
+
available: number;
|
|
161
|
+
inUse: number;
|
|
162
|
+
total: number;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Global command buffer pool instance
|
|
168
|
+
*/
|
|
169
|
+
export declare const commandBufferPool: CommandBufferPool;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RenderCommand TypeScript Definitions
|
|
3
|
+
* VIB3+ SDK - Render Command Hierarchy
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { RenderState, Color4 } from './RenderState';
|
|
7
|
+
|
|
8
|
+
/** Command type identifiers */
|
|
9
|
+
export const enum CommandType {
|
|
10
|
+
SET_STATE = 'set_state',
|
|
11
|
+
CLEAR = 'clear',
|
|
12
|
+
BIND_SHADER = 'bind_shader',
|
|
13
|
+
BIND_TEXTURE = 'bind_texture',
|
|
14
|
+
BIND_VERTEX_ARRAY = 'bind_vertex_array',
|
|
15
|
+
BIND_RENDER_TARGET = 'bind_render_target',
|
|
16
|
+
SET_UNIFORM = 'set_uniform',
|
|
17
|
+
DRAW = 'draw',
|
|
18
|
+
DRAW_INDEXED = 'draw_indexed',
|
|
19
|
+
DRAW_INSTANCED = 'draw_instanced',
|
|
20
|
+
DRAW_INDEXED_INSTANCED = 'draw_indexed_instanced',
|
|
21
|
+
SET_VIEWPORT = 'set_viewport',
|
|
22
|
+
CUSTOM = 'custom'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Primitive topology types */
|
|
26
|
+
export const enum PrimitiveType {
|
|
27
|
+
POINTS = 'points',
|
|
28
|
+
LINES = 'lines',
|
|
29
|
+
LINE_LOOP = 'line_loop',
|
|
30
|
+
LINE_STRIP = 'line_strip',
|
|
31
|
+
TRIANGLES = 'triangles',
|
|
32
|
+
TRIANGLE_STRIP = 'triangle_strip',
|
|
33
|
+
TRIANGLE_FAN = 'triangle_fan'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Index buffer element types */
|
|
37
|
+
export type IndexType = 'uint16' | 'uint32';
|
|
38
|
+
|
|
39
|
+
/** Uniform value types */
|
|
40
|
+
export type UniformValue =
|
|
41
|
+
| number
|
|
42
|
+
| boolean
|
|
43
|
+
| number[]
|
|
44
|
+
| Float32Array
|
|
45
|
+
| Int32Array;
|
|
46
|
+
|
|
47
|
+
/** Backend interface for command execution */
|
|
48
|
+
export interface RenderBackend {
|
|
49
|
+
clear(command: ClearCommand): void;
|
|
50
|
+
setState(state: RenderState): void;
|
|
51
|
+
bindShader(shader: any): void;
|
|
52
|
+
bindTexture(texture: any, slot: number): void;
|
|
53
|
+
bindVertexArray(vao: any): void;
|
|
54
|
+
bindRenderTarget(target: any): void;
|
|
55
|
+
setUniform(name: string, value: UniformValue, type?: string): void;
|
|
56
|
+
setViewport(x: number, y: number, width: number, height: number): void;
|
|
57
|
+
draw(command: DrawCommand): void;
|
|
58
|
+
drawIndexed(command: DrawIndexedCommand): void;
|
|
59
|
+
drawInstanced(command: DrawInstancedCommand): void;
|
|
60
|
+
drawIndexedInstanced(command: DrawIndexedInstancedCommand): void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Base class for all render commands
|
|
65
|
+
*/
|
|
66
|
+
export declare abstract class RenderCommand {
|
|
67
|
+
readonly id: number;
|
|
68
|
+
readonly type: CommandType;
|
|
69
|
+
priority: number;
|
|
70
|
+
sortKey: number;
|
|
71
|
+
depth: number;
|
|
72
|
+
label: string;
|
|
73
|
+
|
|
74
|
+
constructor(type: CommandType);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Set command label for debugging
|
|
78
|
+
*/
|
|
79
|
+
setLabel(label: string): this;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Execute this command on a backend
|
|
83
|
+
*/
|
|
84
|
+
abstract execute(backend: RenderBackend): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Clear command options */
|
|
88
|
+
export interface ClearOptions {
|
|
89
|
+
clearColor?: boolean;
|
|
90
|
+
clearDepth?: boolean;
|
|
91
|
+
clearStencil?: boolean;
|
|
92
|
+
colorValue?: Color4;
|
|
93
|
+
depthValue?: number;
|
|
94
|
+
stencilValue?: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Clear framebuffer command
|
|
99
|
+
*/
|
|
100
|
+
export declare class ClearCommand extends RenderCommand {
|
|
101
|
+
clearColor: boolean;
|
|
102
|
+
clearDepth: boolean;
|
|
103
|
+
clearStencil: boolean;
|
|
104
|
+
colorValue: Color4;
|
|
105
|
+
depthValue: number;
|
|
106
|
+
stencilValue: number;
|
|
107
|
+
|
|
108
|
+
constructor(options?: ClearOptions);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Create color-only clear
|
|
112
|
+
*/
|
|
113
|
+
static color(value: Color4): ClearCommand;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Create depth-only clear
|
|
117
|
+
*/
|
|
118
|
+
static depth(value?: number): ClearCommand;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Create stencil-only clear
|
|
122
|
+
*/
|
|
123
|
+
static stencil(value?: number): ClearCommand;
|
|
124
|
+
|
|
125
|
+
execute(backend: RenderBackend): void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Set render state command
|
|
130
|
+
*/
|
|
131
|
+
export declare class SetStateCommand extends RenderCommand {
|
|
132
|
+
state: RenderState;
|
|
133
|
+
|
|
134
|
+
constructor(state: RenderState);
|
|
135
|
+
|
|
136
|
+
execute(backend: RenderBackend): void;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Bind shader program command
|
|
141
|
+
*/
|
|
142
|
+
export declare class BindShaderCommand extends RenderCommand {
|
|
143
|
+
shader: any;
|
|
144
|
+
|
|
145
|
+
constructor(shader: any);
|
|
146
|
+
|
|
147
|
+
execute(backend: RenderBackend): void;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Bind texture command
|
|
152
|
+
*/
|
|
153
|
+
export declare class BindTextureCommand extends RenderCommand {
|
|
154
|
+
texture: any;
|
|
155
|
+
slot: number;
|
|
156
|
+
|
|
157
|
+
constructor(texture: any, slot?: number);
|
|
158
|
+
|
|
159
|
+
execute(backend: RenderBackend): void;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Bind vertex array object command
|
|
164
|
+
*/
|
|
165
|
+
export declare class BindVertexArrayCommand extends RenderCommand {
|
|
166
|
+
vao: any;
|
|
167
|
+
|
|
168
|
+
constructor(vao: any);
|
|
169
|
+
|
|
170
|
+
execute(backend: RenderBackend): void;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Bind render target command
|
|
175
|
+
*/
|
|
176
|
+
export declare class BindRenderTargetCommand extends RenderCommand {
|
|
177
|
+
target: any;
|
|
178
|
+
|
|
179
|
+
constructor(target: any);
|
|
180
|
+
|
|
181
|
+
execute(backend: RenderBackend): void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Set shader uniform command
|
|
186
|
+
*/
|
|
187
|
+
export declare class SetUniformCommand extends RenderCommand {
|
|
188
|
+
name: string;
|
|
189
|
+
value: UniformValue;
|
|
190
|
+
uniformType: string | null;
|
|
191
|
+
|
|
192
|
+
constructor(name: string, value: UniformValue, type?: string);
|
|
193
|
+
|
|
194
|
+
execute(backend: RenderBackend): void;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Draw command options */
|
|
198
|
+
export interface DrawOptions {
|
|
199
|
+
primitive?: PrimitiveType;
|
|
200
|
+
vertexCount?: number;
|
|
201
|
+
firstVertex?: number;
|
|
202
|
+
sortKey?: number;
|
|
203
|
+
depth?: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Draw arrays command
|
|
208
|
+
*/
|
|
209
|
+
export declare class DrawCommand extends RenderCommand {
|
|
210
|
+
primitive: PrimitiveType;
|
|
211
|
+
vertexCount: number;
|
|
212
|
+
firstVertex: number;
|
|
213
|
+
|
|
214
|
+
constructor(options?: DrawOptions);
|
|
215
|
+
|
|
216
|
+
execute(backend: RenderBackend): void;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Draw indexed command options */
|
|
220
|
+
export interface DrawIndexedOptions extends DrawOptions {
|
|
221
|
+
indexCount?: number;
|
|
222
|
+
firstIndex?: number;
|
|
223
|
+
baseVertex?: number;
|
|
224
|
+
indexType?: IndexType;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Draw indexed elements command
|
|
229
|
+
*/
|
|
230
|
+
export declare class DrawIndexedCommand extends RenderCommand {
|
|
231
|
+
primitive: PrimitiveType;
|
|
232
|
+
indexCount: number;
|
|
233
|
+
firstIndex: number;
|
|
234
|
+
baseVertex: number;
|
|
235
|
+
indexType: IndexType;
|
|
236
|
+
|
|
237
|
+
constructor(options?: DrawIndexedOptions);
|
|
238
|
+
|
|
239
|
+
execute(backend: RenderBackend): void;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Draw instanced command options */
|
|
243
|
+
export interface DrawInstancedOptions extends DrawOptions {
|
|
244
|
+
instanceCount?: number;
|
|
245
|
+
firstInstance?: number;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Draw instanced arrays command
|
|
250
|
+
*/
|
|
251
|
+
export declare class DrawInstancedCommand extends RenderCommand {
|
|
252
|
+
primitive: PrimitiveType;
|
|
253
|
+
vertexCount: number;
|
|
254
|
+
firstVertex: number;
|
|
255
|
+
instanceCount: number;
|
|
256
|
+
firstInstance: number;
|
|
257
|
+
|
|
258
|
+
constructor(options?: DrawInstancedOptions);
|
|
259
|
+
|
|
260
|
+
execute(backend: RenderBackend): void;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Draw indexed instanced command options */
|
|
264
|
+
export interface DrawIndexedInstancedOptions extends DrawIndexedOptions {
|
|
265
|
+
instanceCount?: number;
|
|
266
|
+
firstInstance?: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Draw indexed instanced elements command
|
|
271
|
+
*/
|
|
272
|
+
export declare class DrawIndexedInstancedCommand extends RenderCommand {
|
|
273
|
+
primitive: PrimitiveType;
|
|
274
|
+
indexCount: number;
|
|
275
|
+
firstIndex: number;
|
|
276
|
+
baseVertex: number;
|
|
277
|
+
indexType: IndexType;
|
|
278
|
+
instanceCount: number;
|
|
279
|
+
firstInstance: number;
|
|
280
|
+
|
|
281
|
+
constructor(options?: DrawIndexedInstancedOptions);
|
|
282
|
+
|
|
283
|
+
execute(backend: RenderBackend): void;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Set viewport command
|
|
288
|
+
*/
|
|
289
|
+
export declare class SetViewportCommand extends RenderCommand {
|
|
290
|
+
x: number;
|
|
291
|
+
y: number;
|
|
292
|
+
width: number;
|
|
293
|
+
height: number;
|
|
294
|
+
|
|
295
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
296
|
+
|
|
297
|
+
execute(backend: RenderBackend): void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** Custom command callback */
|
|
301
|
+
export type CustomCommandCallback = (backend: RenderBackend) => void;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Custom command for arbitrary GPU operations
|
|
305
|
+
*/
|
|
306
|
+
export declare class CustomCommand extends RenderCommand {
|
|
307
|
+
callback: CustomCommandCallback;
|
|
308
|
+
|
|
309
|
+
constructor(callback: CustomCommandCallback);
|
|
310
|
+
|
|
311
|
+
execute(backend: RenderBackend): void;
|
|
312
|
+
}
|