Main repository of MikuMikuStudio
Revisão | 6ab7fe755d3462c046bf0a6cd4814de8e049432b (tree) |
---|---|
Hora | 2013-04-20 01:58:40 |
Autor | ShAdOwIsLoRd <ShAdOwIsLoRd@75d0...> |
Commiter | ShAdOwIsLoRd |
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10562 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -31,6 +31,7 @@ | ||
31 | 31 | */ |
32 | 32 | package com.jme3.texture; |
33 | 33 | |
34 | +import com.jme3.texture.Image.Format; | |
34 | 35 | import java.util.List; |
35 | 36 | import java.util.logging.Level; |
36 | 37 | import java.util.logging.Logger; |
@@ -58,26 +59,27 @@ public class TextureArray extends Texture { | ||
58 | 59 | } |
59 | 60 | |
60 | 61 | /** |
61 | - * Construct a TextureArray from the given list of images | |
62 | - * warning, this feature is only supported on opengl 3.0 version. | |
62 | + * Construct a TextureArray from the given list of images. | |
63 | 63 | * To check if a hardware supports TextureArray check : |
64 | 64 | * renderManager.getRenderer().getCaps().contains(Caps.TextureArray) |
65 | 65 | * @param images |
66 | 66 | */ |
67 | 67 | public TextureArray(List<Image> images) { |
68 | - super(); | |
68 | + super(); | |
69 | + | |
69 | 70 | int width = images.get(0).getWidth(); |
70 | 71 | int height = images.get(0).getHeight(); |
71 | - Image arrayImage = new Image(images.get(0).getFormat(), width, height, | |
72 | - null); | |
72 | + Format format = images.get(0).getFormat(); | |
73 | + Image arrayImage = new Image(format, width, height, null); | |
73 | 74 | |
74 | 75 | for (Image img : images) { |
75 | 76 | if (img.getHeight() != height || img.getWidth() != width) { |
76 | - Logger.getLogger(TextureArray.class.getName()).log( | |
77 | - Level.WARNING, | |
78 | - "all images must have the same width/height"); | |
79 | - continue; | |
77 | + throw new IllegalArgumentException("Images in texture array must have same dimensions"); | |
78 | + } | |
79 | + if (img.getFormat() != format) { | |
80 | + throw new IllegalArgumentException("Images in texture array must have same format"); | |
80 | 81 | } |
82 | + | |
81 | 83 | arrayImage.addData(img.getData(0)); |
82 | 84 | } |
83 | 85 | setImage(arrayImage); |