@pixi/core
Version:
Core PixiJS
27 lines (22 loc) • 1.01 kB
JavaScript
Object.defineProperty(exports, '__esModule', { value: true });
var constants = require('@pixi/constants');
var BufferResource = require('./BufferResource.js');
class DepthResource extends BufferResource.BufferResource {
upload(renderer, baseTexture, glTexture) {
const gl = renderer.gl;
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.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;
}
}
exports.DepthResource = DepthResource;
//# sourceMappingURL=DepthResource.js.map
;