瀏覽代碼

[rtexture] Cubemap mipmap loading improvements (#4721)

* [rtextures] Only build cubemap mipmaps when necessary

* [rtextures] Assign correct mipmap count to cubemaps
Nikolas 7 月之前
父節點
當前提交
49d37b035f
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/rtextures.c

+ 6 - 3
src/rtextures.c

@@ -4208,8 +4208,11 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
 
             Image mipmapped = ImageCopy(image);
         #if defined(SUPPORT_IMAGE_MANIPULATION)
-            ImageMipmaps(&mipmapped);
-            ImageMipmaps(&faces);
+            if (image.mipmaps > 1)
+            {
+                ImageMipmaps(&mipmapped);
+                ImageMipmaps(&faces);
+            }
         #endif
 
             // NOTE: Image formatting does not work with compressed textures
@@ -4226,7 +4229,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
         if (cubemap.id != 0)
         {
             cubemap.format = faces.format;
-            cubemap.mipmaps = 1;
+            cubemap.mipmaps = faces.mipmaps;
         }
         else TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image");