getMipLevels method
int
getMipLevels(
- Texture texture,
- dynamic image,
- 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;
}
}