shader method Null safety
- {Vector4? uColor,
- double? uAlpha,
- Vector4? uSparkleColor,
- double? uSparkleAlpha,
- double? uBlur,
- Vector2? uCenter,
- double? uRadiusScale,
- double? uMaxRadius,
- Vector2? uResolutionScale,
- Vector2? uNoiseScale,
- double? uNoisePhase,
- double? uTurbulencePhase,
- Vector2? uCircle1,
- Vector2? uCircle2,
- Vector2? uCircle3,
- Vector2? uRotation1,
- Vector2? uRotation2,
- Vector2? uRotation3}
Creates a shader with the original program and optional uniforms.
A new shader must be made whenever the uniforms are updated.
Implementation
Shader shader({
Vector4? uColor,
double? uAlpha,
Vector4? uSparkleColor,
double? uSparkleAlpha,
double? uBlur,
Vector2? uCenter,
double? uRadiusScale,
double? uMaxRadius,
Vector2? uResolutionScale,
Vector2? uNoiseScale,
double? uNoisePhase,
double? uTurbulencePhase,
Vector2? uCircle1,
Vector2? uCircle2,
Vector2? uCircle3,
Vector2? uRotation1,
Vector2? uRotation2,
Vector2? uRotation3,
}) {
return _program.shader(
floatUniforms: Float32List.fromList(<double>[
...uColor != null ? uColor.storage : <double>[0, 0, 0, 0],
...uAlpha != null ? <double>[uAlpha] : <double>[0],
...uSparkleColor != null ? uSparkleColor.storage : <double>[0, 0, 0, 0],
...uSparkleAlpha != null ? <double>[uSparkleAlpha] : <double>[0],
...uBlur != null ? <double>[uBlur] : <double>[0],
...uCenter != null ? uCenter.storage : <double>[0, 0],
...uRadiusScale != null ? <double>[uRadiusScale] : <double>[0],
...uMaxRadius != null ? <double>[uMaxRadius] : <double>[0],
...uResolutionScale != null ? uResolutionScale.storage : <double>[0, 0],
...uNoiseScale != null ? uNoiseScale.storage : <double>[0, 0],
...uNoisePhase != null ? <double>[uNoisePhase] : <double>[0],
...uCircle1 != null ? uCircle1.storage : <double>[0, 0],
...uCircle2 != null ? uCircle2.storage : <double>[0, 0],
...uCircle3 != null ? uCircle3.storage : <double>[0, 0],
...uRotation1 != null ? uRotation1.storage : <double>[0, 0],
...uRotation2 != null ? uRotation2.storage : <double>[0, 0],
...uRotation3 != null ? uRotation3.storage : <double>[0, 0],
]),
);
}