get method

Texture? get(
  1. Texture? texture
)

Implementation

Texture? get(Texture? texture) {
  if (texture != null && texture.isRenderTargetTexture == false) {
    var mapping = texture.mapping;

    if (mapping == EquirectangularReflectionMapping || mapping == EquirectangularRefractionMapping) {
      if (cubemaps.has(texture)) {
        var cubemap = cubemaps.get(texture).texture;
        return mapTextureMapping(cubemap, texture.mapping);
      } else {
        var image = texture.image;

        if (image != null && image.height > 0) {
          var renderTarget = WebGLCubeRenderTarget(image.height ~/ 2, null, null);
          renderTarget.fromEquirectangularTexture(renderer, texture);
          cubemaps.add(key: texture, value: renderTarget);

          texture.addEventListener('dispose', onTextureDispose);

          return mapTextureMapping(renderTarget.texture, texture.mapping);
        } else {
          // image not yet ready. try the conversion next frame

          return null;
        }
      }
    }
  }

  return texture;
}