'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var Matrix = require('../../../maths/Matrix.js');
var _const = require('../../batcher/shared/const.js');
var compileHighShaderToProgram = require('../../high-shader/compileHighShaderToProgram.js');
var colorBit = require('../../high-shader/shader-bits/colorBit.js');
var generateTextureBatchBit = require('../../high-shader/shader-bits/generateTextureBatchBit.js');
var localUniformBit = require('../../high-shader/shader-bits/localUniformBit.js');
var batchSamplersUniformGroup = require('../../renderers/gl/shader/batchSamplersUniformGroup.js');
var Shader = require('../../renderers/shared/shader/Shader.js');
var UniformGroup = require('../../renderers/shared/shader/UniformGroup.js');
var localUniformMSDFBit = require('./shader-bits/localUniformMSDFBit.js');
var mSDFBit = require('./shader-bits/mSDFBit.js');

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

exports.SdfShader = SdfShader;
//# sourceMappingURL=SdfShader.js.map
