VideoTexture.js 706 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. import { Texture } from './Texture.js';
  5. function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
  6. Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
  7. this.generateMipmaps = false;
  8. var scope = this;
  9. function update() {
  10. var video = scope.image;
  11. if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
  12. scope.needsUpdate = true;
  13. }
  14. requestAnimationFrame( update );
  15. }
  16. requestAnimationFrame( update );
  17. }
  18. VideoTexture.prototype = Object.create( Texture.prototype );
  19. VideoTexture.prototype.constructor = VideoTexture;
  20. export { VideoTexture };