getMipLevels method

int getMipLevels(
  1. Texture texture,
  2. dynamic image,
  3. dynamic supportsMips
)

Implementation

int getMipLevels(Texture texture, image, supportsMips) {
  if (textureNeedsGenerateMipmaps(texture, supportsMips) == true ||
      (texture is FramebufferTexture && texture.minFilter != NearestFilter && texture.minFilter != LinearFilter)) {
    return Math.log2(Math.max(image.width, image.height)).toInt() + 1;
  } else if (texture.mipmaps.isNotEmpty) {
    // user-defined mipmaps

    return texture.mipmaps.length;
  } else if (texture is CompressedTexture && texture.image is List) {
    // Dart: TODO texture.image is List ???
    return image.mipmaps.length;
  } else {
    // texture without mipmaps (only base level)

    return 1;
  }
}