textmode.synth.js 1.0.0-beta.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/README.md +180 -0
- package/dist/textmode.synth.esm.js +967 -0
- package/dist/textmode.synth.umd.js +399 -0
- package/dist/types/SynthPlugin.d.ts +22 -0
- package/dist/types/SynthPlugin.d.ts.map +1 -0
- package/dist/types/compiler/GLSLGenerator.d.ts +44 -0
- package/dist/types/compiler/GLSLGenerator.d.ts.map +1 -0
- package/dist/types/compiler/SynthCompiler.d.ts +20 -0
- package/dist/types/compiler/SynthCompiler.d.ts.map +1 -0
- package/dist/types/compiler/UniformManager.d.ts +48 -0
- package/dist/types/compiler/UniformManager.d.ts.map +1 -0
- package/dist/types/compiler/index.d.ts +9 -0
- package/dist/types/compiler/index.d.ts.map +1 -0
- package/dist/types/compiler/types.d.ts +94 -0
- package/dist/types/compiler/types.d.ts.map +1 -0
- package/dist/types/core/ISynthSource.d.ts +718 -0
- package/dist/types/core/ISynthSource.d.ts.map +1 -0
- package/dist/types/core/SynthChain.d.ts +62 -0
- package/dist/types/core/SynthChain.d.ts.map +1 -0
- package/dist/types/core/SynthSource.d.ts +126 -0
- package/dist/types/core/SynthSource.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +7 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +106 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +395 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/ArrayUtils.d.ts +225 -0
- package/dist/types/lib/ArrayUtils.d.ts.map +1 -0
- package/dist/types/transforms/TransformDefinition.d.ts +54 -0
- package/dist/types/transforms/TransformDefinition.d.ts.map +1 -0
- package/dist/types/transforms/TransformFactory.d.ts +64 -0
- package/dist/types/transforms/TransformFactory.d.ts.map +1 -0
- package/dist/types/transforms/TransformRegistry.d.ts +72 -0
- package/dist/types/transforms/TransformRegistry.d.ts.map +1 -0
- package/dist/types/transforms/categories/charModifiers.d.ts +16 -0
- package/dist/types/transforms/categories/charModifiers.d.ts.map +1 -0
- package/dist/types/transforms/categories/colors.d.ts +29 -0
- package/dist/types/transforms/categories/colors.d.ts.map +1 -0
- package/dist/types/transforms/categories/combine.d.ts +19 -0
- package/dist/types/transforms/categories/combine.d.ts.map +1 -0
- package/dist/types/transforms/categories/combineCoord.d.ts +23 -0
- package/dist/types/transforms/categories/combineCoord.d.ts.map +1 -0
- package/dist/types/transforms/categories/coordinates.d.ts +22 -0
- package/dist/types/transforms/categories/coordinates.d.ts.map +1 -0
- package/dist/types/transforms/categories/index.d.ts +15 -0
- package/dist/types/transforms/categories/index.d.ts.map +1 -0
- package/dist/types/transforms/categories/sources.d.ts +19 -0
- package/dist/types/transforms/categories/sources.d.ts.map +1 -0
- package/dist/types/transforms/index.d.ts +8 -0
- package/dist/types/transforms/index.d.ts.map +1 -0
- package/dist/types/utils/CharacterResolver.d.ts +19 -0
- package/dist/types/utils/CharacterResolver.d.ts.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiler types and interfaces.
|
|
3
|
+
*/
|
|
4
|
+
import type { SynthUniform, SynthContext, CharacterMapping } from '../core/types';
|
|
5
|
+
/**
|
|
6
|
+
* Compilation target context determining which texture `src()` samples from.
|
|
7
|
+
*
|
|
8
|
+
* - `char`: Compiling a character source chain → src() samples prevCharBuffer
|
|
9
|
+
* - `charColor`: Compiling a character color chain → src() samples prevBuffer (primary color)
|
|
10
|
+
* - `cellColor`: Compiling a cell color chain → src() samples prevCellColorBuffer
|
|
11
|
+
* - `main`: Compiling the main chain → src() samples prevBuffer (primary color)
|
|
12
|
+
*/
|
|
13
|
+
export type CompilationTarget = 'char' | 'charColor' | 'cellColor' | 'main';
|
|
14
|
+
/**
|
|
15
|
+
* Information about an external layer reference used in the shader.
|
|
16
|
+
* Tracks which textures from the external layer are sampled.
|
|
17
|
+
*/
|
|
18
|
+
export interface ExternalLayerInfo {
|
|
19
|
+
/** Unique identifier for this external layer in the shader */
|
|
20
|
+
layerId: string;
|
|
21
|
+
/** Uniform prefix for this layer's samplers (e.g., 'extLayer0') */
|
|
22
|
+
uniformPrefix: string;
|
|
23
|
+
/** Whether the character texture is sampled */
|
|
24
|
+
usesChar: boolean;
|
|
25
|
+
/** Whether the primary color texture is sampled */
|
|
26
|
+
usesPrimary: boolean;
|
|
27
|
+
/** Whether the cell color texture is sampled */
|
|
28
|
+
usesCellColor: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result of compiling a SynthSource.
|
|
32
|
+
*/
|
|
33
|
+
export interface CompiledSynthShader {
|
|
34
|
+
/** Complete fragment shader source */
|
|
35
|
+
fragmentSource: string;
|
|
36
|
+
/** Uniform definitions with their values/updaters */
|
|
37
|
+
uniforms: Map<string, SynthUniform>;
|
|
38
|
+
/** Dynamic uniform updaters keyed by uniform name */
|
|
39
|
+
dynamicUpdaters: Map<string, (ctx: SynthContext) => number | number[]>;
|
|
40
|
+
/** Character mapping if charMap was used */
|
|
41
|
+
charMapping?: CharacterMapping;
|
|
42
|
+
/** Whether this shader uses feedback (src/prev) - reads from prevBuffer */
|
|
43
|
+
usesFeedback: boolean;
|
|
44
|
+
/** Whether this shader uses character feedback (charSrc) - reads from prevCharBuffer */
|
|
45
|
+
usesCharFeedback: boolean;
|
|
46
|
+
/** Whether this shader uses cell color feedback (cellColorSrc) - reads from prevCellColorBuffer */
|
|
47
|
+
usesCellColorFeedback: boolean;
|
|
48
|
+
/** External layer references used in this shader, keyed by layer ID */
|
|
49
|
+
externalLayers: Map<string, ExternalLayerInfo>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Intermediate representation node for a transform.
|
|
53
|
+
*/
|
|
54
|
+
export interface IRNode {
|
|
55
|
+
/** Transform name */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Resolved argument strings (GLSL literals or uniform names) */
|
|
58
|
+
args: string[];
|
|
59
|
+
/** Transform type */
|
|
60
|
+
type: string;
|
|
61
|
+
/** Reference to nested source result (for combine operations) */
|
|
62
|
+
nestedColorVar?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Result from compiling a chain.
|
|
66
|
+
*/
|
|
67
|
+
export interface ChainCompilationResult {
|
|
68
|
+
/** Current coordinate variable name */
|
|
69
|
+
coordVar: string;
|
|
70
|
+
/** Current color variable name */
|
|
71
|
+
colorVar: string;
|
|
72
|
+
/** Character output variable (if any) */
|
|
73
|
+
charVar?: string;
|
|
74
|
+
/** Flags variable (if any) */
|
|
75
|
+
flagsVar?: string;
|
|
76
|
+
/** Rotation variable (if any) */
|
|
77
|
+
rotationVar?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Context for code generation.
|
|
81
|
+
*/
|
|
82
|
+
export interface GenerationContext {
|
|
83
|
+
/** Counter for unique variable names */
|
|
84
|
+
varCounter: number;
|
|
85
|
+
/** Accumulated GLSL function definitions */
|
|
86
|
+
glslFunctions: Set<string>;
|
|
87
|
+
/** Accumulated main code lines */
|
|
88
|
+
mainCode: string[];
|
|
89
|
+
/** Collected uniforms */
|
|
90
|
+
uniforms: Map<string, SynthUniform>;
|
|
91
|
+
/** Dynamic uniform updaters */
|
|
92
|
+
dynamicUpdaters: Map<string, (ctx: SynthContext) => number | number[]>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/compiler/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,MAAM,CAAC;AAE5E;;;GAGG;AACH,MAAM,WA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