UNPKG

@pixi/core

Version:
23 lines (20 loc) 900 B
import { ALPHA_MODES } from '@pixi/constants'; import { BufferResource } from './BufferResource.mjs'; class DepthResource extends BufferResource { upload(renderer, baseTexture, glTexture) { const gl = renderer.gl; gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK); const width = baseTexture.realWidth; const height = baseTexture.realHeight; if (glTexture.width === width && glTexture.height === height) { gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); } else { glTexture.width = width; glTexture.height = height; gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); } return true; } } export { DepthResource }; //# sourceMappingURL=DepthResource.mjs.map