Переглянути джерело

Merge pull request #16651 from WestLangley/dev_render_target

WebGLRenderTarget: add image.width/height to texture property
Mr.doob 6 роки тому
батько
коміт
297551db56
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      src/renderers/WebGLRenderTarget.js

+ 7 - 0
src/renderers/WebGLRenderTarget.js

@@ -28,6 +28,10 @@ function WebGLRenderTarget( width, height, options ) {
 
 	this.texture = new Texture( undefined, undefined, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
 
+	this.texture.image = {};
+	this.texture.image.width = width;
+	this.texture.image.height = height;
+
 	this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
 	this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
 
@@ -50,6 +54,9 @@ WebGLRenderTarget.prototype = Object.assign( Object.create( EventDispatcher.prot
 			this.width = width;
 			this.height = height;
 
+			this.texture.image.width = width;
+			this.texture.image.height = height;
+
 			this.dispose();
 
 		}