diff --git a/jme3-core/src/main/java/com/jme3/texture/TextureArray.java b/jme3-core/src/main/java/com/jme3/texture/TextureArray.java index 20ff1b2fa..50015cff8 100644 --- a/jme3-core/src/main/java/com/jme3/texture/TextureArray.java +++ b/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); }