ExternalTexture.js 953 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Texture } from './Texture.js';
  2. /**
  3. * Represents a texture created externally with the same renderer context.
  4. *
  5. * This may be a texture from a protected media stream, device camera feed,
  6. * or other data feeds like a depth sensor.
  7. *
  8. * Note that this class is only supported in {@link WebGLRenderer}, and in
  9. * the {@link WebGPURenderer} WebGPU backend.
  10. *
  11. * @augments Texture
  12. */
  13. class ExternalTexture extends Texture {
  14. /**
  15. * Creates a new raw texture.
  16. *
  17. * @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture.
  18. */
  19. constructor( sourceTexture = null ) {
  20. super();
  21. /**
  22. * The external source texture.
  23. *
  24. * @type {?(WebGLTexture|GPUTexture)}
  25. * @default null
  26. */
  27. this.sourceTexture = sourceTexture;
  28. /**
  29. * This flag can be used for type testing.
  30. *
  31. * @type {boolean}
  32. * @readonly
  33. * @default true
  34. */
  35. this.isExternalTexture = true;
  36. }
  37. }
  38. export { ExternalTexture };
粤ICP备19079148号