Преглед изворни кода

Renderer: Add `initTexture()`. (#29947)

Michael Herzog пре 1 година
родитељ
комит
1e01d5fdd8
1 измењених фајлова са 22 додато и 0 уклоњено
  1. 22 0
      src/renderers/common/Renderer.js

+ 22 - 0
src/renderers/common/Renderer.js

@@ -1315,6 +1315,28 @@ class Renderer {
 
 	}
 
+	async initTextureAsync( texture ) {
+
+		if ( this._initialized === false ) await this.init();
+
+		this._textures.updateTexture( texture );
+
+	}
+
+	initTexture( texture ) {
+
+		if ( this._initialized === false ) {
+
+			console.warn( 'THREE.Renderer: .initTexture() called before the backend is initialized. Try using .initTextureAsync() instead.' );
+
+			return false;
+
+		}
+
+		this._textures.updateTexture( texture );
+
+	}
+
 	copyFramebufferToTexture( framebufferTexture, rectangle = null ) {
 
 		if ( rectangle !== null ) {

粤ICP备19079148号