import { Matrix } from '../../../maths/Matrix.mjs';
import { MAX_TEXTURES } from '../../batcher/shared/const.mjs';
import { compileHighShaderGpuProgram, compileHighShaderGlProgram } from '../../high-shader/compileHighShaderToProgram.mjs';
import { colorBit, colorBitGl } from '../../high-shader/shader-bits/colorBit.mjs';
import { generateTextureBatchBit, generateTextureBatchBitGl } from '../../high-shader/shader-bits/generateTextureBatchBit.mjs';
import { localUniformBitGl } from '../../high-shader/shader-bits/localUniformBit.mjs';
import { batchSamplersUniformGroup } from '../../renderers/gl/shader/batchSamplersUniformGroup.mjs';
import { Shader } from '../../renderers/shared/shader/Shader.mjs';
import { UniformGroup } from '../../renderers/shared/shader/UniformGroup.mjs';
import { localUniformMSDFBit } from './shader-bits/localUniformMSDFBit.mjs';
import { mSDFBit, mSDFBitGl } from './shader-bits/mSDFBit.mjs';

class SdfShader extends Shader {
  constructor() {
    const uniforms = new UniformGroup({
      uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
      uTransformMatrix: { value: new Matrix(), type: "mat3x3<f32>" },
      uDistance: { value: 4, type: "f32" }
    });
    const gpuProgram = compileHighShaderGpuProgram({
      name: "sdf-shader",
      bits: [
        colorBit,
        generateTextureBatchBit(MAX_TEXTURES),
        localUniformMSDFBit,
        mSDFBit
      ]
    });
    const glProgram = compileHighShaderGlProgram({
      name: "sdf-shader",
      bits: [
        colorBitGl,
        generateTextureBatchBitGl(MAX_TEXTURES),
        localUniformBitGl,
        mSDFBitGl
      ]
    });
    super({
      glProgram,
      gpuProgram,
      resources: {
        localUniforms: uniforms,
        batchSamplers: batchSamplersUniformGroup
      }
    });
  }
}

export { SdfShader };
//# sourceMappingURL=SdfShader.mjs.map
