|
@@ -17446,7 +17446,7 @@ function WebGLObjects( geometries, infoRender ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function clear() {
|
|
|
+ function dispose() {
|
|
|
|
|
|
updateList = {};
|
|
|
|
|
@@ -17455,7 +17455,7 @@ function WebGLObjects( geometries, infoRender ) {
|
|
|
return {
|
|
|
|
|
|
update: update,
|
|
|
- clear: clear
|
|
|
+ dispose: dispose
|
|
|
|
|
|
};
|
|
|
|
|
@@ -18483,7 +18483,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
*/
|
|
|
|
|
|
-function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, infoMemory ) {
|
|
|
+function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, infoMemory, infoRender ) {
|
|
|
|
|
|
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext );
|
|
|
var _videoTextures = {};
|
|
@@ -18678,6 +18678,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
var textureProperties = properties.get( texture );
|
|
|
|
|
|
+ if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
|
+
|
|
|
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
|
|
|
|
var image = texture.image;
|
|
@@ -18889,12 +18891,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
textureProperties.__webglTexture = _gl.createTexture();
|
|
|
|
|
|
- if ( texture.isVideoTexture ) {
|
|
|
-
|
|
|
- _videoTextures[ texture.id ] = texture;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
infoMemory.textures ++;
|
|
|
|
|
|
}
|
|
@@ -19276,11 +19272,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
- function updateVideoTextures() {
|
|
|
+ function updateVideoTexture( texture ) {
|
|
|
+
|
|
|
+ var id = texture.id;
|
|
|
+ var frame = infoRender.frame;
|
|
|
+
|
|
|
+ // Check the last frame we updated the VideoTexture
|
|
|
|
|
|
- for ( var id in _videoTextures ) {
|
|
|
+ if ( _videoTextures[ id ] !== frame ) {
|
|
|
|
|
|
- _videoTextures[ id ].update();
|
|
|
+ _videoTextures[ id ] = frame;
|
|
|
+ texture.update();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -19291,7 +19293,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
this.setTextureCubeDynamic = setTextureCubeDynamic;
|
|
|
this.setupRenderTarget = setupRenderTarget;
|
|
|
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
|
|
|
- this.updateVideoTextures = updateVideoTextures;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -19325,7 +19326,7 @@ function WebGLProperties() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function clear() {
|
|
|
+ function dispose() {
|
|
|
|
|
|
properties = {};
|
|
|
|
|
@@ -19334,7 +19335,7 @@ function WebGLProperties() {
|
|
|
return {
|
|
|
get: get,
|
|
|
remove: remove,
|
|
|
- clear: clear
|
|
|
+ dispose: dispose
|
|
|
};
|
|
|
|
|
|
}
|
|
@@ -21472,7 +21473,7 @@ function WebGLRenderer( parameters ) {
|
|
|
state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ) );
|
|
|
|
|
|
properties = new WebGLProperties();
|
|
|
- textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, _infoMemory );
|
|
|
+ textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, _infoMemory, _infoRender );
|
|
|
attributes = new WebGLAttributes( _gl );
|
|
|
geometries = new WebGLGeometries( _gl, attributes, _infoMemory );
|
|
|
objects = new WebGLObjects( geometries, _infoRender );
|
|
@@ -21709,6 +21710,8 @@ function WebGLRenderer( parameters ) {
|
|
|
_canvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );
|
|
|
|
|
|
renderLists.dispose();
|
|
|
+ properties.dispose();
|
|
|
+ objects.dispose();
|
|
|
|
|
|
vr.dispose();
|
|
|
|
|
@@ -22329,10 +22332,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
//
|
|
|
|
|
|
- textures.updateVideoTextures();
|
|
|
-
|
|
|
- //
|
|
|
-
|
|
|
if ( _clippingEnabled ) _clipping.beginShadows();
|
|
|
|
|
|
shadowMap.render( shadowsArray, scene, camera );
|
|
@@ -25148,19 +25147,6 @@ function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, forma
|
|
|
|
|
|
this.generateMipmaps = false;
|
|
|
|
|
|
- // Set needsUpdate when first frame is ready
|
|
|
-
|
|
|
- var scope = this;
|
|
|
-
|
|
|
- function onLoaded() {
|
|
|
-
|
|
|
- video.removeEventListener( 'loadeddata', onLoaded, false );
|
|
|
- scope.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- video.addEventListener( 'loadeddata', onLoaded, false );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
|