1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | var constants = require('@pixi/constants');
|
6 | var BufferResource = require('./BufferResource.js');
|
7 |
|
8 | class 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 |
|
25 | exports.DepthResource = DepthResource;
|
26 |
|