UNPKG

1.01 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var constants = require('@pixi/constants');
6var BufferResource = require('./BufferResource.js');
7
8class DepthResource extends BufferResource.BufferResource {
9 upload(renderer, baseTexture, glTexture) {
10 const gl = renderer.gl;
11 gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK);
12 const width = baseTexture.realWidth;
13 const height = baseTexture.realHeight;
14 if (glTexture.width === width && glTexture.height === height) {
15 gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data);
16 } else {
17 glTexture.width = width;
18 glTexture.height = height;
19 gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data);
20 }
21 return true;
22 }
23}
24
25exports.DepthResource = DepthResource;
26//# sourceMappingURL=DepthResource.js.map