UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

39 lines (35 loc) 1.95 kB
'use strict'; var pixiToGlMaps = require('./pixiToGlMaps.js'); "use strict"; function applyStyleParams(style, gl, mipmaps, anisotropicExt, glFunctionName, firstParam, forceClamp, firstCreation) { const castParam = firstParam; if (!firstCreation || style.addressModeU !== "repeat" || style.addressModeV !== "repeat" || style.addressModeW !== "repeat") { const wrapModeS = pixiToGlMaps.wrapModeToGlAddress[forceClamp ? "clamp-to-edge" : style.addressModeU]; const wrapModeT = pixiToGlMaps.wrapModeToGlAddress[forceClamp ? "clamp-to-edge" : style.addressModeV]; const wrapModeR = pixiToGlMaps.wrapModeToGlAddress[forceClamp ? "clamp-to-edge" : style.addressModeW]; gl[glFunctionName](castParam, gl.TEXTURE_WRAP_S, wrapModeS); gl[glFunctionName](castParam, gl.TEXTURE_WRAP_T, wrapModeT); if (gl.TEXTURE_WRAP_R) gl[glFunctionName](castParam, gl.TEXTURE_WRAP_R, wrapModeR); } if (!firstCreation || style.magFilter !== "linear") { gl[glFunctionName](castParam, gl.TEXTURE_MAG_FILTER, pixiToGlMaps.scaleModeToGlFilter[style.magFilter]); } if (mipmaps) { if (!firstCreation || style.mipmapFilter !== "linear") { 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