VideoTexture.js 735 字节
Newer Older
M
Mr.doob 已提交
1 2 3 4
/**
 * @author mrdoob / http://mrdoob.com/
 */

5
import { RGBFormat } from '../constants.js';
B
bentok 已提交
6
import { Texture } from './Texture.js';
M
Mr.doob 已提交
7

M
Mr.doob 已提交
8
function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
M
Mr.doob 已提交
9

10 11
	if ( format === undefined ) format = RGBFormat;

R
Rich Harris 已提交
12
	Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
M
Mr.doob 已提交
13 14

	this.generateMipmaps = false;
15

M
Mugen87 已提交
16
}
M
Mr.doob 已提交
17

M
Mugen87 已提交
18
VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
M
Mr.doob 已提交
19

M
Mugen87 已提交
20
	constructor: VideoTexture,
M
Mugen87 已提交
21

M
Mugen87 已提交
22
	isVideoTexture: true,
M
Mr.doob 已提交
23

24
	update: function () {
M
Mr.doob 已提交
25

26
		var video = this.image;
M
Mr.doob 已提交
27

28
		if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
29

30
			this.needsUpdate = true;
M
Mr.doob 已提交
31

M
Mugen87 已提交
32
		}
M
Mr.doob 已提交
33

34
	}
M
Mr.doob 已提交
35

M
Mugen87 已提交
36
} );
R
Rich Harris 已提交
37 38


39
export { VideoTexture };