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