'use strict';

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

var pixiToGlMaps = require('./pixiToGlMaps.js');

function applyStyleParams(style, gl, mipmaps, anisotropicExt, glFunctionName, firstParam) {
  const castParam = firstParam;
  gl[glFunctionName](castParam, gl.TEXTURE_WRAP_S, pixiToGlMaps.wrapModeToGlAddress[style.addressModeU]);
  gl[glFunctionName](castParam, gl.TEXTURE_WRAP_T, pixiToGlMaps.wrapModeToGlAddress[style.addressModeV]);
  gl[glFunctionName](castParam, gl.TEXTURE_WRAP_R, pixiToGlMaps.wrapModeToGlAddress[style.addressModeW]);
  gl[glFunctionName](castParam, gl.TEXTURE_MAG_FILTER, pixiToGlMaps.scaleModeToGlFilter[style.magFilter]);
  if (mipmaps) {
    const glFilterMode = pixiToGlMaps.mipmapScaleModeToGlFilter[style.minFilter][style.mipmapFilter];
    gl[glFunctionName](castParam, gl.TEXTURE_MIN_FILTER, glFilterMode);
  } else {
    gl[glFunctionName](castParam, gl.TEXTURE_MIN_FILTER, pixiToGlMaps.scaleModeToGlFilter[style.minFilter]);
  }
  if (anisotropicExt && style.maxAnisotropy > 1) {
    const level = Math.min(style.maxAnisotropy, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
    gl[glFunctionName](castParam, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);
  }
  if (style.compare) {
    gl[glFunctionName](castParam, gl.TEXTURE_COMPARE_FUNC, pixiToGlMaps.compareModeToGlCompare[style.compare]);
  }
}

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