Przeglądaj źródła

- add more formats to TextureAtlas

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9026 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 lat temu
rodzic
commit
81b2e7ca51

+ 13 - 1
engine/src/tools/jme3tools/optimize/TextureAtlas.java

@@ -150,8 +150,20 @@ public class TextureAtlas {
                     image[i + 1] = sourceData.get(j); //b
                     image[i + 1] = sourceData.get(j); //b
                     image[i + 2] = sourceData.get(j + 1); //g
                     image[i + 2] = sourceData.get(j + 1); //g
                     image[i + 3] = sourceData.get(j + 2); //r
                     image[i + 3] = sourceData.get(j + 2); //r
+                } else if (source.getFormat() == Format.RGB8) {
+                    int j = (xPos + yPos * width) * 3;
+                    image[i] = 0; //b
+                    image[i + 1] = sourceData.get(j + 2); //b
+                    image[i + 2] = sourceData.get(j + 1); //g
+                    image[i + 3] = sourceData.get(j); //r
+                } else if (source.getFormat() == Format.RGBA8) {
+                    int j = (xPos + yPos * width) * 4;
+                    image[i] = sourceData.get(j + 3); //a
+                    image[i + 1] = sourceData.get(j + 2); //b
+                    image[i + 2] = sourceData.get(j + 1); //g
+                    image[i + 3] = sourceData.get(j); //r
                 } else {
                 } else {
-                    logger.log(Level.WARNING, "Could not draw texture {0} ", mapName);
+                    logger.log(Level.WARNING, "Could not draw texture with format {0}", source.getFormat());
                 }
                 }
             }
             }
         }
         }