From 9965d20c4472865a8ebe7a44735be8db8639a2b6 Mon Sep 17 00:00:00 2001 From: shadowislord Date: Tue, 18 Nov 2014 21:12:15 -0500 Subject: [PATCH] Make sure we copy the mipmap sizes when generating texture array from images --- .../src/main/java/com/jme3/texture/TextureArray.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); }