updateRenderTargetMipmap method

void updateRenderTargetMipmap(
  1. RenderTarget renderTarget
)

Implementation

void updateRenderTargetMipmap(RenderTarget renderTarget) {
  var supportsMips = isPowerOfTwo(renderTarget) || isWebGL2;

  var textures = renderTarget.isWebGLMultipleRenderTargets == true
      ? renderTarget.texture
      : [renderTarget.texture];

  for (var i = 0, il = textures.length; i < il; i++) {
    var texture = textures[i];

    if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
      var target = renderTarget.isWebGLCubeRenderTarget
          ? gl.TEXTURE_CUBE_MAP
          : gl.TEXTURE_2D;
      var webglTexture = properties.get(texture)["__webglTexture"];

      state.bindTexture(target, webglTexture);
      generateMipmap(target);
      state.bindTexture(target, null);
    }
  }
}