Creates a GLSL definition of an array, and initialises it with the given values, type, and variable name.

The initialisation is valid GLSL1 or greater syntax; but is written with escaped new-lines so it may be used in a single-line (e.g: for preprocessor macros).

For a qualify of const on any GLSL < 3, falls back to using non-array variables with the index appended to name, since const arrays aren't supported before GLSL3.

  • Parameters

    • type: string

      The GLSL list data-type.

    • name: string

      The name of the GLSL list variable.

    • a: array<number, array<number>>

      The list of GLSL values.

    • Optionalqualify: string = ''

      A GLSL qualifier, if needed (e.g: const).

    • Optionalglsl: number = 1

      The GLSL version to target, if specified.

    • Optionalinit: string

      A data-type initialiser.

    Returns string

    The GLSL (1 or 3) array or array-like declaration string.