From 30dfa52f51b9d3645cd4c16cf4f4ea0c5a74352b Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 12 May 2012 19:19:26 +0000 Subject: [PATCH] * 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 --- .../com/jme3/texture/plugins/TGALoader.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/src/core-plugins/com/jme3/texture/plugins/TGALoader.java b/engine/src/core-plugins/com/jme3/texture/plugins/TGALoader.java index e9e1904df..20f50df12 100644 --- a/engine/src/core-plugins/com/jme3/texture/plugins/TGALoader.java +++ b/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"); }