1 | import { Texture } from './Texture.js';
|
2 | import { NearestFilter, UnsignedShortType, UnsignedInt248Type, DepthFormat, DepthStencilFormat } from '../constants.js';
|
3 |
|
4 | function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
5 |
|
6 | format = format !== undefined ? format : DepthFormat;
|
7 |
|
8 | if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
9 |
|
10 | throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
11 |
|
12 | }
|
13 |
|
14 | if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
|
15 | if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
|
16 |
|
17 | Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
18 |
|
19 | this.image = { width: width, height: height };
|
20 |
|
21 | this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
22 | this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
23 |
|
24 | this.flipY = false;
|
25 | this.generateMipmaps = false;
|
26 |
|
27 | }
|
28 |
|
29 | DepthTexture.prototype = Object.create( Texture.prototype );
|
30 | DepthTexture.prototype.constructor = DepthTexture;
|
31 | DepthTexture.prototype.isDepthTexture = true;
|
32 |
|
33 | export { DepthTexture };
|