瀏覽代碼

Make sure we copy the mipmap sizes when generating texture array from images

shadowislord 10 年之前
父節點
當前提交
9965d20c44
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      jme3-core/src/main/java/com/jme3/texture/TextureArray.java

+ 8 - 1
jme3-core/src/main/java/com/jme3/texture/TextureArray.java

@@ -33,6 +33,7 @@ package com.jme3.texture;
 
 import com.jme3.texture.Image.Format;
 import com.jme3.texture.image.ColorSpace;
+import java.util.Arrays;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -72,8 +73,10 @@ public class TextureArray extends Texture {
         int height = images.get(0).getHeight();
         Format format = images.get(0).getFormat();
         ColorSpace colorSpace = images.get(0).getColorSpace();
+        int[] mipMapSizes = images.get(0).getMipMapSizes();
         Image arrayImage = new Image(format, width, height, null, colorSpace);
-
+        arrayImage.setMipMapSizes(mipMapSizes);
+        
         for (Image img : images) {
             if (img.getHeight() != height || img.getWidth() != width) {
                 throw new IllegalArgumentException("Images in texture array must have same dimensions");
@@ -81,9 +84,13 @@ public class TextureArray extends Texture {
             if (img.getFormat() != format) {
                 throw new IllegalArgumentException("Images in texture array must have same format");
             }
+            if (!Arrays.equals(mipMapSizes, img.getMipMapSizes())) {
+                throw new IllegalArgumentException("Images in texture array must have same mipmap sizes");
+            }
             
             arrayImage.addData(img.getData(0));
         }
+        
         setImage(arrayImage);
     }