From cf9f7b8be67da827ddee134a3648c64db1dda9e9 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 23 Nov 2024 12:10:03 +0100 Subject: [PATCH] Renderer: Add `initTexture()`. --- src/renderers/common/Renderer.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/renderers/common/Renderer.js b/src/renderers/common/Renderer.js index 99f06f8fff12d6..d174fa168398d9 100644 --- a/src/renderers/common/Renderer.js +++ b/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 ) {