DepthTexture.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { Texture } from './Texture.js';
  2. import { NearestFilter, UnsignedShortType, UnsignedInt248Type, DepthFormat, DepthStencilFormat } from '../constants.js';
  3. class DepthTexture extends Texture {
  4. constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
  5. format = format !== undefined ? format : DepthFormat;
  6. if ( format !== DepthFormat && format !== DepthStencilFormat ) {
  7. throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
  8. }
  9. if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
  10. if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
  11. super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
  12. Object.defineProperty( this, 'isDepthTexture', { value: true } );
  13. this.image = { width: width, height: height };
  14. this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
  15. this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
  16. this.flipY = false;
  17. this.generateMipmaps = false;
  18. }
  19. }
  20. export { DepthTexture };
粤ICP备19079148号