* TGA loader now supports loading colormapped (non-RLE only) images

* A non-supported format now yields correct message in TGA loader 

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9379 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent cac820803b
commit 30dfa52f51
  1. 14
      engine/src/core-plugins/com/jme3/texture/plugins/TGALoader.java

@ -157,7 +157,7 @@ public final class TGALoader implements AssetLoader {
// Skip image ID
if (idLength > 0) {
in.skip(idLength);
dis.skip(idLength);
}
ColorMapEntry[] cMapEntries = null;
@ -167,7 +167,7 @@ public final class TGALoader implements AssetLoader {
int bitsPerColor = Math.min(cMapDepth / 3, 8);
byte[] cMapData = new byte[bytesInColorMap];
in.read(cMapData);
dis.read(cMapData);
// Only go to the trouble of constructing the color map
// table if this is declared a color mapped image.
@ -423,9 +423,9 @@ public final class TGALoader implements AssetLoader {
}
ColorMapEntry entry = cMapEntries[index];
rawData[rawDataIndex++] = entry.red;
rawData[rawDataIndex++] = entry.green;
rawData[rawDataIndex++] = entry.blue;
rawData[rawDataIndex++] = entry.green;
rawData[rawDataIndex++] = entry.red;
if (dl == 4) {
rawData[rawDataIndex++] = entry.alpha;
}
@ -444,9 +444,9 @@ public final class TGALoader implements AssetLoader {
}
ColorMapEntry entry = cMapEntries[index];
rawData[rawDataIndex++] = entry.red;
rawData[rawDataIndex++] = entry.green;
rawData[rawDataIndex++] = entry.blue;
rawData[rawDataIndex++] = entry.green;
rawData[rawDataIndex++] = entry.red;
if (dl == 4) {
rawData[rawDataIndex++] = entry.alpha;
}
@ -458,7 +458,7 @@ public final class TGALoader implements AssetLoader {
format = dl == 4 ? Format.RGBA8 : Format.RGB8;
} else {
throw new IOException("Grayscale TGA not supported");
throw new IOException("Monochrome and RLE colormapped images are not supported");
}

Loading…
Cancel
Save