Skip to content

Commit da55a7a

Browse files
committed
Add basic version support for shaders.
1 parent 3ddf4da commit da55a7a

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

lib/material_palette.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export 'package:material_palette/src/shader_definitions.dart';
88
export 'package:material_palette/src/shader_registry.dart';
99
export 'package:material_palette/src/shader_material.dart';
1010
export 'package:material_palette/src/shader_presets.dart';
11+
export 'package:material_palette/src/version.dart';
1112

1213
// Gradient fills (linear)
1314
export 'package:material_palette/src/shaders/gritty_gradient_shader_fill.dart';

lib/src/shader_definitions.dart

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ class ShaderDefinition {
1818
/// Maps each parameter name to a brief description of its role in this shader.
1919
final Map<String, String> paramDescriptions;
2020

21+
/// The last version of the material_palette package in which this shader's
22+
/// GLSL implementation was changed. When set, the shader's GLSL source is
23+
/// not expected to be changed.
24+
final String? stableVersion;
25+
2126
const ShaderDefinition({
2227
required this.layout,
2328
required this.defaults,
2429
required this.uiDefaults,
2530
required this.hasChildren,
2631
required this.assetPath,
2732
this.paramDescriptions = const {},
33+
this.stableVersion,
2834
});
2935
}
3036

@@ -69,6 +75,7 @@ final grittyGradientDef = ShaderDefinition(
6975
...ParamGroups.gradientColorsDescriptions,
7076
...ParamGroups.postProcessingDescriptions,
7177
},
78+
stableVersion: '1.2.0',
7279
);
7380

7481
// ═══════════════════════════════════════════════════════════════════════════════
@@ -114,6 +121,7 @@ final radialGrittyGradientDef = ShaderDefinition(
114121
...ParamGroups.gradientColorsDescriptions,
115122
...ParamGroups.postProcessingDescriptions,
116123
},
124+
stableVersion: '1.2.0',
117125
);
118126

119127
// ═══════════════════════════════════════════════════════════════════════════════
@@ -173,6 +181,7 @@ final perlinGradientDef = ShaderDefinition(
173181
...ParamGroups.postProcessingDescriptions,
174182
...ParamGroups.lightingDescriptions,
175183
},
184+
stableVersion: '1.2.0',
176185
);
177186

178187
// ═══════════════════════════════════════════════════════════════════════════════
@@ -233,6 +242,7 @@ final radialPerlinGradientDef = ShaderDefinition(
233242
...ParamGroups.postProcessingDescriptions,
234243
...ParamGroups.lightingDescriptions,
235244
},
245+
stableVersion: '1.2.0',
236246
);
237247

238248
// ═══════════════════════════════════════════════════════════════════════════════
@@ -295,6 +305,7 @@ final simplexGradientDef = ShaderDefinition(
295305
...ParamGroups.postProcessingDescriptions,
296306
...ParamGroups.lightingDescriptions,
297307
},
308+
stableVersion: '1.2.0',
298309
);
299310

300311
// ═══════════════════════════════════════════════════════════════════════════════
@@ -355,6 +366,7 @@ final radialSimplexGradientDef = ShaderDefinition(
355366
...ParamGroups.postProcessingDescriptions,
356367
...ParamGroups.lightingDescriptions,
357368
},
369+
stableVersion: '1.2.0',
358370
);
359371

360372
// ═══════════════════════════════════════════════════════════════════════════════
@@ -419,6 +431,7 @@ final fbmGradientDef = ShaderDefinition(
419431
...ParamGroups.postProcessingDescriptions,
420432
...ParamGroups.lightingDescriptions,
421433
},
434+
stableVersion: '1.2.0',
422435
);
423436

424437
// ═══════════════════════════════════════════════════════════════════════════════
@@ -485,6 +498,7 @@ final radialFbmGradientDef = ShaderDefinition(
485498
...ParamGroups.postProcessingDescriptions,
486499
...ParamGroups.lightingDescriptions,
487500
},
501+
stableVersion: '1.2.0',
488502
);
489503

490504
// ═══════════════════════════════════════════════════════════════════════════════
@@ -547,6 +561,7 @@ final turbulenceGradientDef = ShaderDefinition(
547561
...ParamGroups.postProcessingDescriptions,
548562
...ParamGroups.lightingDescriptions,
549563
},
564+
stableVersion: '1.2.0',
550565
);
551566

552567
// ═══════════════════════════════════════════════════════════════════════════════
@@ -610,6 +625,7 @@ final radialTurbulenceGradientDef = ShaderDefinition(
610625
...ParamGroups.postProcessingDescriptions,
611626
...ParamGroups.lightingDescriptions,
612627
},
628+
stableVersion: '1.2.0',
613629
);
614630

615631
// ═══════════════════════════════════════════════════════════════════════════════
@@ -680,6 +696,7 @@ final voronoiGradientDef = ShaderDefinition(
680696
...ParamGroups.postProcessingDescriptions,
681697
...ParamGroups.lightingDescriptions,
682698
},
699+
stableVersion: '1.2.0',
683700
);
684701

685702
// ═══════════════════════════════════════════════════════════════════════════════
@@ -751,6 +768,7 @@ final radialVoronoiGradientDef = ShaderDefinition(
751768
...ParamGroups.postProcessingDescriptions,
752769
...ParamGroups.lightingDescriptions,
753770
},
771+
stableVersion: '1.2.0',
754772
);
755773

756774
// ═══════════════════════════════════════════════════════════════════════════════
@@ -813,6 +831,7 @@ final voronoiseGradientDef = ShaderDefinition(
813831
...ParamGroups.postProcessingDescriptions,
814832
...ParamGroups.lightingDescriptions,
815833
},
834+
stableVersion: '1.2.0',
816835
);
817836

818837
// ═══════════════════════════════════════════════════════════════════════════════
@@ -877,6 +896,7 @@ final radialVoronoiseGradientDef = ShaderDefinition(
877896
...ParamGroups.postProcessingDescriptions,
878897
...ParamGroups.lightingDescriptions,
879898
},
899+
stableVersion: '1.2.0',
880900
);
881901

882902
// ═══════════════════════════════════════════════════════════════════════════════
@@ -970,6 +990,7 @@ final marbleSmearShaderDef = ShaderDefinition(
970990
'smudgeStrength': 'Strength of the smudge distortion',
971991
'smudgeFalloff': 'Falloff curve of the smudge effect',
972992
},
993+
stableVersion: '1.2.0',
973994
);
974995

975996
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1024,6 +1045,7 @@ final rippleShaderDef = ShaderDefinition(
10241045
'speed': 'Propagation speed of the ripple waves',
10251046
'originScale': 'Distance scale applied to wave origins',
10261047
},
1048+
stableVersion: '1.2.0',
10271049
);
10281050

10291051
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1058,6 +1080,7 @@ final clickRippleShaderDef = ShaderDefinition(
10581080
'speed': 'Propagation speed of tap ripples',
10591081
'rippleDuration': 'Lifetime of each tap ripple in seconds',
10601082
},
1083+
stableVersion: '1.2.0',
10611084
);
10621085

10631086
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1093,6 +1116,7 @@ final burnShaderDef = ShaderDefinition(
10931116
'speed': 'Speed of the burn dissolve progression',
10941117
'fireColor': 'Color of the fire glow at the burn edge',
10951118
},
1119+
stableVersion: '1.2.0',
10961120
);
10971121

10981122
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1132,6 +1156,7 @@ final radialBurnShaderDef = ShaderDefinition(
11321156
'speed': 'Speed of the burn dissolve progression',
11331157
'fireColor': 'Color of the fire glow at the burn edge',
11341158
},
1159+
stableVersion: '1.2.0',
11351160
);
11361161

11371162
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1168,6 +1193,7 @@ final tappableBurnShaderDef = ShaderDefinition(
11681193
'burnLifetime': 'Lifetime of each tap burn in seconds',
11691194
'fireColor': 'Color of the fire glow at the burn edge',
11701195
},
1196+
stableVersion: '1.2.0',
11711197
);
11721198

11731199
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1203,6 +1229,7 @@ final smokeShaderDef = ShaderDefinition(
12031229
'speed': 'Speed of the smoke dissolve progression',
12041230
'smokeColor': 'Color of the smoke wisps at the dissolve edge',
12051231
},
1232+
stableVersion: '1.2.0',
12061233
);
12071234

12081235
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1242,6 +1269,7 @@ final radialSmokeShaderDef = ShaderDefinition(
12421269
'speed': 'Speed of the smoke dissolve progression',
12431270
'smokeColor': 'Color of the smoke wisps at the dissolve edge',
12441271
},
1272+
stableVersion: '1.2.0',
12451273
);
12461274

12471275
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1278,6 +1306,7 @@ final tappableSmokeShaderDef = ShaderDefinition(
12781306
'burnLifetime': 'Lifetime of each tap smoke in seconds',
12791307
'smokeColor': 'Color of the smoke wisps at the dissolve edge',
12801308
},
1309+
stableVersion: '1.2.0',
12811310
);
12821311

12831312
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1313,6 +1342,7 @@ final pixelDissolveShaderDef = ShaderDefinition(
13131342
'noiseAmount': 'Amount of noise added to the dissolve pattern',
13141343
'speed': 'Speed of the pixel dissolve progression',
13151344
},
1345+
stableVersion: '1.2.0',
13161346
);
13171347

13181348
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1352,6 +1382,7 @@ final radialPixelDissolveShaderDef = ShaderDefinition(
13521382
'noiseAmount': 'Amount of noise added to the dissolve pattern',
13531383
'speed': 'Speed of the pixel dissolve progression',
13541384
},
1385+
stableVersion: '1.2.0',
13551386
);
13561387

13571388
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1388,6 +1419,7 @@ final tappablePixelDissolveShaderDef = ShaderDefinition(
13881419
'radius': 'Radius of each tap dissolve spot',
13891420
'lifetime': 'Lifetime of each tap dissolve in seconds',
13901421
},
1422+
stableVersion: '1.2.0',
13911423
);
13921424

13931425
// ═══════════════════════════════════════════════════════════════════════════════
@@ -1424,6 +1456,7 @@ final tappableSlurpShaderDef = ShaderDefinition(
14241456
'speed': 'Speed of each tap slurp animation',
14251457
'lifetime': 'Lifetime of each tap slurp in seconds',
14261458
},
1459+
stableVersion: '1.2.0',
14271460
);
14281461

14291462
// ═══════════════════════════════════════════════════════════════════════════════

lib/src/version.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const String packageVersion = '1.4.0';

0 commit comments

Comments
 (0)