Browse Source

- add size check for normal etc. maps, have to fit to main texture size

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9040 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 13 years ago
parent
commit
29b9a64e12
1 changed files with 4 additions and 2 deletions
  1. 4 2
      engine/src/tools/jme3tools/optimize/TextureAtlas.java

+ 4 - 2
engine/src/tools/jme3tools/optimize/TextureAtlas.java

@@ -137,7 +137,7 @@ public class TextureAtlas {
             rootMapName = mapName;
         }
         if (sourceTextureName == null && !rootMapName.equals(mapName)) {
-            throw new IllegalStateException("Cannot add texture to new map without source texture");
+            throw new IllegalStateException("Cannot add texture " + name + " to new map without source texture.");
         }
         TextureAtlasTile location = locationMap.get(name);
         if (location != null) {
@@ -152,7 +152,9 @@ public class TextureAtlas {
         } else {
             location = locationMap.get(sourceTextureName);
             if (location == null) {
-                throw new IllegalStateException("Cannot find location for source texture");
+                throw new IllegalStateException("Cannot find source texture for " + name + ".");
+            } else if (location.width != image.getWidth() || location.height != image.getHeight()) {
+                throw new IllegalStateException("Secondary texture " + name + " does not fit main texture size.");
             }
         }
         locationMap.put(name, location);