Răsfoiți Sursa

Revert VideoTexture: Added frameRate property

Mr.doob 7 ani în urmă
părinte
comite
9a0b4d95f8

+ 0 - 1
examples/webgl_kinect.html

@@ -143,7 +143,6 @@
 					texture = new THREE.VideoTexture( video );
 					texture.minFilter = THREE.NearestFilter;
 					texture.format = THREE.RGBFormat;
-					texture.frameRate = 30;
 
 					var width = 640, height = 480;
 					var nearClipping = 850, farClipping = 4000;

+ 0 - 1
examples/webgl_materials_video.html

@@ -108,7 +108,6 @@
 				texture.minFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.LinearFilter;
 				texture.format = THREE.RGBFormat;
-				texture.frameRate = 24;
 
 				//
 

+ 0 - 1
examples/webgl_video_panorama_equirectangular.html

@@ -79,7 +79,6 @@
 				var texture = new THREE.VideoTexture( video );
 				texture.minFilter = THREE.LinearFilter;
 				texture.format = THREE.RGBFormat;
-				texture.frameRate = 25;
 
 				var material   = new THREE.MeshBasicMaterial( { map : texture } );
 

+ 0 - 1
examples/webvr_video.html

@@ -69,7 +69,6 @@
 				texture.minFilter = THREE.NearestFilter;
 				texture.maxFilter = THREE.NearestFilter;
 				texture.format = THREE.RGBFormat;
-				texture.frameRate = 24;
 
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0x101010 );

+ 5 - 19
src/textures/VideoTexture.js

@@ -9,7 +9,6 @@ function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, forma
 	Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
 	this.generateMipmaps = false;
-	this.frameRate = 30;
 
 }
 
@@ -19,30 +18,17 @@ VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
 
 	isVideoTexture: true,
 
-	update: ( function () {
+	update: function () {
 
-		var prevTime = Date.now();
+		var video = this.image;
 
-		return function () {
+		if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
 
-			var video = this.image;
-
-			if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
-
-				var time = Date.now();
-
-				if ( time - prevTime >= ( 1000 / this.frameRate ) ) {
-
-					this.needsUpdate = true;
-					prevTime = time;
-
-				}
-
-			}
+			this.needsUpdate = true;
 
 		}
 
-	} )()
+	}
 
 } );