DepthTexture.js 1.3 KB

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