updateTexture method

dynamic updateTexture(
  1. dynamic texture
)

Implementation

updateTexture(texture) {
  var needsUpdate = false;

  var textureProperties = this.properties.get(texture);

  if (texture.version > 0 && textureProperties.version != texture.version) {
    var image = texture.image;

    if (image == undefined) {
      console.warn(
          'THREE.WebGPURenderer: Texture marked for update but image is undefined.');
    } else if (image.complete == false) {
      console.warn(
          'THREE.WebGPURenderer: Texture marked for update but image is incomplete.');
    } else {
      // texture init

      if (textureProperties.initialized == undefined) {
        textureProperties.initialized = true;

        // var disposeCallback = onTextureDispose.bind( this );
        // textureProperties.disposeCallback = disposeCallback;

        // texture.addEventListener( 'dispose', disposeCallback );

        this.info.memory["textures"]++;
      }

      //

      needsUpdate = this._uploadTexture(texture);
    }
  }

  // if the texture is used for RTT, it's necessary to init it once so the binding
  // group's resource definition points to the respective GPUTexture

  if (textureProperties.initializedRTT == false) {
    textureProperties.initializedRTT = true;
    needsUpdate = true;
  }

  return needsUpdate;
}