Remove usage of all deprecated image formats
This commit is contained in:
parent
b7a4faebf0
commit
62cfbc8a3e
@ -105,9 +105,6 @@ public class AndroidImageInfo extends ImageRaster {
|
|||||||
case ALPHA_8:
|
case ALPHA_8:
|
||||||
format = Image.Format.Alpha8;
|
format = Image.Format.Alpha8;
|
||||||
break;
|
break;
|
||||||
case ARGB_4444:
|
|
||||||
format = Image.Format.ARGB4444;
|
|
||||||
break;
|
|
||||||
case ARGB_8888:
|
case ARGB_8888:
|
||||||
format = Image.Format.RGBA8;
|
format = Image.Format.RGBA8;
|
||||||
break;
|
break;
|
||||||
|
@ -269,12 +269,6 @@ public class TextureUtil {
|
|||||||
throws UnsupportedOperationException {
|
throws UnsupportedOperationException {
|
||||||
AndroidGLImageFormat imageFormat = new AndroidGLImageFormat();
|
AndroidGLImageFormat imageFormat = new AndroidGLImageFormat();
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case RGBA16:
|
|
||||||
case RGB16:
|
|
||||||
case RGB10:
|
|
||||||
case Luminance16:
|
|
||||||
case Luminance16Alpha16:
|
|
||||||
case Alpha16:
|
|
||||||
case Depth32:
|
case Depth32:
|
||||||
case Depth32F:
|
case Depth32F:
|
||||||
throw new UnsupportedOperationException("The image format '"
|
throw new UnsupportedOperationException("The image format '"
|
||||||
@ -313,11 +307,6 @@ public class TextureUtil {
|
|||||||
imageFormat.dataType = GLES20.GL_UNSIGNED_SHORT_5_6_5;
|
imageFormat.dataType = GLES20.GL_UNSIGNED_SHORT_5_6_5;
|
||||||
imageFormat.renderBufferStorageFormat = GLES20.GL_RGB565;
|
imageFormat.renderBufferStorageFormat = GLES20.GL_RGB565;
|
||||||
break;
|
break;
|
||||||
case ARGB4444:
|
|
||||||
imageFormat.format = GLES20.GL_RGBA4;
|
|
||||||
imageFormat.dataType = GLES20.GL_UNSIGNED_SHORT_4_4_4_4;
|
|
||||||
imageFormat.renderBufferStorageFormat = GLES20.GL_RGBA4;
|
|
||||||
break;
|
|
||||||
case RGB5A1:
|
case RGB5A1:
|
||||||
imageFormat.format = GLES20.GL_RGBA;
|
imageFormat.format = GLES20.GL_RGBA;
|
||||||
imageFormat.dataType = GLES20.GL_UNSIGNED_SHORT_5_5_5_1;
|
imageFormat.dataType = GLES20.GL_UNSIGNED_SHORT_5_5_5_1;
|
||||||
|
@ -434,13 +434,10 @@ public class CombinedTexture {
|
|||||||
switch (image.getFormat()) {
|
switch (image.getFormat()) {
|
||||||
case BGR8:
|
case BGR8:
|
||||||
case DXT1:
|
case DXT1:
|
||||||
case Luminance16:
|
|
||||||
case Luminance16F:
|
case Luminance16F:
|
||||||
case Luminance32F:
|
case Luminance32F:
|
||||||
case Luminance8:
|
case Luminance8:
|
||||||
case RGB10:
|
|
||||||
case RGB111110F:
|
case RGB111110F:
|
||||||
case RGB16:
|
|
||||||
case RGB16F:
|
case RGB16F:
|
||||||
case RGB32F:
|
case RGB32F:
|
||||||
case RGB565:
|
case RGB565:
|
||||||
@ -449,10 +446,8 @@ public class CombinedTexture {
|
|||||||
case ABGR8:
|
case ABGR8:
|
||||||
case DXT3:
|
case DXT3:
|
||||||
case DXT5:
|
case DXT5:
|
||||||
case Luminance16Alpha16:
|
|
||||||
case Luminance16FAlpha16F:
|
case Luminance16FAlpha16F:
|
||||||
case Luminance8Alpha8:
|
case Luminance8Alpha8:
|
||||||
case RGBA16:
|
|
||||||
case RGBA16F:
|
case RGBA16F:
|
||||||
case RGBA32F:
|
case RGBA32F:
|
||||||
case RGBA8:// with these types it is better to make sure if the texture is or is not transparent
|
case RGBA8:// with these types it is better to make sure if the texture is or is not transparent
|
||||||
|
@ -71,8 +71,6 @@ public class TextureBlenderFactory {
|
|||||||
switch (format) {
|
switch (format) {
|
||||||
case Luminance8:
|
case Luminance8:
|
||||||
case Luminance8Alpha8:
|
case Luminance8Alpha8:
|
||||||
case Luminance16:
|
|
||||||
case Luminance16Alpha16:
|
|
||||||
case Luminance16F:
|
case Luminance16F:
|
||||||
case Luminance16FAlpha16F:
|
case Luminance16FAlpha16F:
|
||||||
case Luminance32F:
|
case Luminance32F:
|
||||||
@ -81,9 +79,7 @@ public class TextureBlenderFactory {
|
|||||||
case ABGR8:
|
case ABGR8:
|
||||||
case BGR8:
|
case BGR8:
|
||||||
case RGB8:
|
case RGB8:
|
||||||
case RGB10:
|
|
||||||
case RGB111110F:
|
case RGB111110F:
|
||||||
case RGB16:
|
|
||||||
case RGB16F:
|
case RGB16F:
|
||||||
case RGB16F_to_RGB111110F:
|
case RGB16F_to_RGB111110F:
|
||||||
case RGB16F_to_RGB9E5:
|
case RGB16F_to_RGB9E5:
|
||||||
@ -91,7 +87,6 @@ public class TextureBlenderFactory {
|
|||||||
case RGB565:
|
case RGB565:
|
||||||
case RGB5A1:
|
case RGB5A1:
|
||||||
case RGB9E5:
|
case RGB9E5:
|
||||||
case RGBA16:
|
|
||||||
case RGBA16F:
|
case RGBA16F:
|
||||||
case RGBA32F:
|
case RGBA32F:
|
||||||
return new TextureBlenderAWT(flag, negate, blendType, materialColor, color, colfac);
|
return new TextureBlenderAWT(flag, negate, blendType, materialColor, color, colfac);
|
||||||
@ -100,23 +95,9 @@ public class TextureBlenderFactory {
|
|||||||
case DXT3:
|
case DXT3:
|
||||||
case DXT5:
|
case DXT5:
|
||||||
return new TextureBlenderDDS(flag, negate, blendType, materialColor, color, colfac);
|
return new TextureBlenderDDS(flag, negate, blendType, materialColor, color, colfac);
|
||||||
case Alpha16:
|
default:
|
||||||
case Alpha8:
|
|
||||||
case ARGB4444:
|
|
||||||
case Depth:
|
|
||||||
case Depth16:
|
|
||||||
case Depth24:
|
|
||||||
case Depth32:
|
|
||||||
case Depth32F:
|
|
||||||
case Intensity16:
|
|
||||||
case Intensity8:
|
|
||||||
case LATC:
|
|
||||||
case LTC:
|
|
||||||
case Depth24Stencil8:
|
|
||||||
LOGGER.log(Level.WARNING, "Image type not yet supported for blending: {0}. Returning a blender that does not change the texture.", format);
|
LOGGER.log(Level.WARNING, "Image type not yet supported for blending: {0}. Returning a blender that does not change the texture.", format);
|
||||||
return NON_CHANGING_BLENDER;
|
return NON_CHANGING_BLENDER;
|
||||||
default:
|
|
||||||
throw new IllegalStateException("Unknown image format type: " + format);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,6 @@ public class TextureBlenderLuminance extends AbstractTextureBlender {
|
|||||||
pixelValue = data.get();
|
pixelValue = data.get();
|
||||||
result[1] = pixelValue >= 0 ? pixelValue / 255.0f : 1.0f - ~pixelValue / 255.0f;
|
result[1] = pixelValue >= 0 ? pixelValue / 255.0f : 1.0f - ~pixelValue / 255.0f;
|
||||||
break;
|
break;
|
||||||
case Luminance16:
|
|
||||||
case Luminance16Alpha16:
|
|
||||||
case Luminance16F:
|
case Luminance16F:
|
||||||
case Luminance16FAlpha16F:
|
case Luminance16FAlpha16F:
|
||||||
case Luminance32F:
|
case Luminance32F:
|
||||||
|
@ -37,12 +37,6 @@ import jme3tools.converters.RGB565;
|
|||||||
int b = (rgb5a1 & 0x001f) >> 1 << 3;
|
int b = (rgb5a1 & 0x001f) >> 1 << 3;
|
||||||
pixel.fromARGB8(a == 1 ? (byte) 255 : 0, (byte) r, (byte) g, (byte) b);
|
pixel.fromARGB8(a == 1 ? (byte) 255 : 0, (byte) r, (byte) g, (byte) b);
|
||||||
break;
|
break;
|
||||||
case RGB16:
|
|
||||||
pixel.fromARGB16((short) 0xFFFF, data.getShort(index), data.getShort(index + 2), data.getShort(index + 4));
|
|
||||||
break;
|
|
||||||
case RGBA16:
|
|
||||||
pixel.fromARGB16(data.getShort(index + 6), data.getShort(index), data.getShort(index + 2), data.getShort(index + 4));
|
|
||||||
break;
|
|
||||||
case RGB16F:
|
case RGB16F:
|
||||||
case RGB16F_to_RGB111110F:
|
case RGB16F_to_RGB111110F:
|
||||||
case RGB16F_to_RGB9E5:
|
case RGB16F_to_RGB9E5:
|
||||||
@ -57,7 +51,6 @@ import jme3tools.converters.RGB565;
|
|||||||
case RGB111110F:// the data is stored as 32-bit unsigned int, that is why we cast the read data to long and remove MSB-bytes to get the positive value
|
case RGB111110F:// the data is stored as 32-bit unsigned int, that is why we cast the read data to long and remove MSB-bytes to get the positive value
|
||||||
pixel.fromARGB(1, (float) Double.longBitsToDouble((long) data.getInt(index) & 0x00000000FFFFFFFF), (float) Double.longBitsToDouble((long) data.getInt(index + 4) & 0x00000000FFFFFFFF), (float) Double.longBitsToDouble((long) data.getInt(index + 8) & 0x00000000FFFFFFFF));
|
pixel.fromARGB(1, (float) Double.longBitsToDouble((long) data.getInt(index) & 0x00000000FFFFFFFF), (float) Double.longBitsToDouble((long) data.getInt(index + 4) & 0x00000000FFFFFFFF), (float) Double.longBitsToDouble((long) data.getInt(index + 8) & 0x00000000FFFFFFFF));
|
||||||
break;
|
break;
|
||||||
case RGB10:
|
|
||||||
case RGB9E5:// TODO: support these
|
case RGB9E5:// TODO: support these
|
||||||
throw new IllegalStateException("Not supported image type for IO operations: " + image.getFormat());
|
throw new IllegalStateException("Not supported image type for IO operations: " + image.getFormat());
|
||||||
default:
|
default:
|
||||||
@ -106,17 +99,6 @@ import jme3tools.converters.RGB565;
|
|||||||
short a = (short) ((short) ((argb8 & 0xFF000000) >> 24) > 0 ? 1 : 0);
|
short a = (short) ((short) ((argb8 & 0xFF000000) >> 24) > 0 ? 1 : 0);
|
||||||
data.putShort(index, (short) (r | g | b | a));
|
data.putShort(index, (short) (r | g | b | a));
|
||||||
break;
|
break;
|
||||||
case RGB16:
|
|
||||||
data.putShort(index, pixel.getR16());
|
|
||||||
data.putShort(index + 2, pixel.getG16());
|
|
||||||
data.putShort(index + 4, pixel.getB16());
|
|
||||||
break;
|
|
||||||
case RGBA16:
|
|
||||||
data.putShort(index, pixel.getR16());
|
|
||||||
data.putShort(index + 2, pixel.getG16());
|
|
||||||
data.putShort(index + 4, pixel.getB16());
|
|
||||||
data.putShort(index + 6, pixel.getA16());
|
|
||||||
break;
|
|
||||||
case RGB16F:
|
case RGB16F:
|
||||||
case RGB16F_to_RGB111110F:
|
case RGB16F_to_RGB111110F:
|
||||||
case RGB16F_to_RGB9E5:
|
case RGB16F_to_RGB9E5:
|
||||||
@ -142,7 +124,6 @@ import jme3tools.converters.RGB565;
|
|||||||
data.putInt(index + 4, Float.floatToIntBits(pixel.blue));
|
data.putInt(index + 4, Float.floatToIntBits(pixel.blue));
|
||||||
data.putInt(index + 6, Float.floatToIntBits(pixel.alpha));
|
data.putInt(index + 6, Float.floatToIntBits(pixel.alpha));
|
||||||
break;
|
break;
|
||||||
case RGB10:
|
|
||||||
case RGB9E5:// TODO: support these
|
case RGB9E5:// TODO: support these
|
||||||
throw new IllegalStateException("Not supported image type for IO operations: " + image.getFormat());
|
throw new IllegalStateException("Not supported image type for IO operations: " + image.getFormat());
|
||||||
default:
|
default:
|
||||||
|
@ -21,13 +21,6 @@ import java.nio.ByteBuffer;
|
|||||||
pixel.fromIntensity(data.get(index));
|
pixel.fromIntensity(data.get(index));
|
||||||
pixel.setAlpha(data.get(index + 1));
|
pixel.setAlpha(data.get(index + 1));
|
||||||
break;
|
break;
|
||||||
case Luminance16:
|
|
||||||
pixel.fromIntensity(data.getShort(index));
|
|
||||||
break;
|
|
||||||
case Luminance16Alpha16:
|
|
||||||
pixel.fromIntensity(data.getShort(index));
|
|
||||||
pixel.setAlpha(data.getShort(index + 2));
|
|
||||||
break;
|
|
||||||
case Luminance16F:
|
case Luminance16F:
|
||||||
pixel.intensity = FastMath.convertHalfToFloat(data.getShort(index));
|
pixel.intensity = FastMath.convertHalfToFloat(data.getShort(index));
|
||||||
break;
|
break;
|
||||||
@ -59,13 +52,6 @@ import java.nio.ByteBuffer;
|
|||||||
data.put(index, pixel.getInt());
|
data.put(index, pixel.getInt());
|
||||||
data.put(index + 1, pixel.getA8());
|
data.put(index + 1, pixel.getA8());
|
||||||
break;
|
break;
|
||||||
case Luminance16:
|
|
||||||
data.putShort(index, (short) (pixel.intensity * 65535.0f));
|
|
||||||
break;
|
|
||||||
case Luminance16Alpha16:
|
|
||||||
data.putShort(index, (short) (pixel.intensity * 65535.0f));
|
|
||||||
data.putShort(index + 2, (short) (pixel.alpha * 65535.0f));
|
|
||||||
break;
|
|
||||||
case Luminance16F:
|
case Luminance16F:
|
||||||
data.putShort(index, FastMath.convertFloatToHalf(pixel.intensity));
|
data.putShort(index, FastMath.convertFloatToHalf(pixel.intensity));
|
||||||
break;
|
break;
|
||||||
|
@ -27,9 +27,7 @@ public class PixelIOFactory {
|
|||||||
case RGBA8:
|
case RGBA8:
|
||||||
case BGR8:
|
case BGR8:
|
||||||
case RGB8:
|
case RGB8:
|
||||||
case RGB10:
|
|
||||||
case RGB111110F:
|
case RGB111110F:
|
||||||
case RGB16:
|
|
||||||
case RGB16F:
|
case RGB16F:
|
||||||
case RGB16F_to_RGB111110F:
|
case RGB16F_to_RGB111110F:
|
||||||
case RGB16F_to_RGB9E5:
|
case RGB16F_to_RGB9E5:
|
||||||
@ -37,14 +35,11 @@ public class PixelIOFactory {
|
|||||||
case RGB565:
|
case RGB565:
|
||||||
case RGB5A1:
|
case RGB5A1:
|
||||||
case RGB9E5:
|
case RGB9E5:
|
||||||
case RGBA16:
|
|
||||||
case RGBA16F:
|
case RGBA16F:
|
||||||
case RGBA32F:
|
case RGBA32F:
|
||||||
result = new AWTPixelInputOutput();
|
result = new AWTPixelInputOutput();
|
||||||
break;
|
break;
|
||||||
case Luminance8:
|
case Luminance8:
|
||||||
case Luminance16:
|
|
||||||
case Luminance16Alpha16:
|
|
||||||
case Luminance16F:
|
case Luminance16F:
|
||||||
case Luminance16FAlpha16F:
|
case Luminance16FAlpha16F:
|
||||||
case Luminance32F:
|
case Luminance32F:
|
||||||
|
@ -204,11 +204,8 @@ public enum Caps {
|
|||||||
*/
|
*/
|
||||||
SharedExponentColorBuffer,
|
SharedExponentColorBuffer,
|
||||||
|
|
||||||
/**
|
@Deprecated
|
||||||
* Supports Format.LATC for textures, this includes
|
Reserved1,
|
||||||
* support for ATI's 3Dc texture compression.
|
|
||||||
*/
|
|
||||||
TextureCompressionLATC,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supports Non-Power-Of-Two (NPOT) textures and framebuffers
|
* Supports Non-Power-Of-Two (NPOT) textures and framebuffers
|
||||||
@ -285,8 +282,6 @@ public enum Caps {
|
|||||||
return caps.contains(Caps.PackedDepthStencilBuffer);
|
return caps.contains(Caps.PackedDepthStencilBuffer);
|
||||||
case Depth32F:
|
case Depth32F:
|
||||||
return caps.contains(Caps.FloatDepthBuffer);
|
return caps.contains(Caps.FloatDepthBuffer);
|
||||||
case LATC:
|
|
||||||
return caps.contains(Caps.TextureCompressionLATC);
|
|
||||||
case RGB16F_to_RGB111110F:
|
case RGB16F_to_RGB111110F:
|
||||||
case RGB111110F:
|
case RGB111110F:
|
||||||
return caps.contains(Caps.PackedFloatTexture);
|
return caps.contains(Caps.PackedFloatTexture);
|
||||||
|
@ -61,17 +61,12 @@ abstract class ImageCodec {
|
|||||||
|
|
||||||
params.put(Format.Alpha8, new ByteOffsetImageCodec(1, 0, 0, -1, -1, -1));
|
params.put(Format.Alpha8, new ByteOffsetImageCodec(1, 0, 0, -1, -1, -1));
|
||||||
|
|
||||||
params.put(Format.Alpha16, new BitMaskImageCodec(2, 0, 16, 0, 0, 0,
|
|
||||||
0, 0, 0, 0));
|
|
||||||
|
|
||||||
// == LUMINANCE ==
|
// == LUMINANCE ==
|
||||||
// params.put(Format.Luminance8, new BitMaskImageCodec(1, FLAG_GRAY, 0, 8, 0, 0,
|
// params.put(Format.Luminance8, new BitMaskImageCodec(1, FLAG_GRAY, 0, 8, 0, 0,
|
||||||
// 0, 0, 0, 0));
|
// 0, 0, 0, 0));
|
||||||
|
|
||||||
params.put(Format.Luminance8, new ByteOffsetImageCodec(1, FLAG_GRAY, -1, 0, -1, -1));
|
params.put(Format.Luminance8, new ByteOffsetImageCodec(1, FLAG_GRAY, -1, 0, -1, -1));
|
||||||
|
|
||||||
params.put(Format.Luminance16, new BitMaskImageCodec(2, FLAG_GRAY, 0, 16, 0, 0,
|
|
||||||
0, 0, 0, 0));
|
|
||||||
params.put(Format.Luminance16F, new BitMaskImageCodec(2, FLAG_GRAY | FLAG_F16, 0, 16, 0, 0,
|
params.put(Format.Luminance16F, new BitMaskImageCodec(2, FLAG_GRAY | FLAG_F16, 0, 16, 0, 0,
|
||||||
0, 0, 0, 0));
|
0, 0, 0, 0));
|
||||||
params.put(Format.Luminance32F, new BitMaskImageCodec(4, FLAG_GRAY | FLAG_F32, 0, 32, 0, 0,
|
params.put(Format.Luminance32F, new BitMaskImageCodec(4, FLAG_GRAY | FLAG_F32, 0, 32, 0, 0,
|
||||||
@ -87,10 +82,6 @@ abstract class ImageCodec {
|
|||||||
|
|
||||||
params.put(Format.Luminance8Alpha8, new ByteOffsetImageCodec(2, FLAG_GRAY, 1, 0, -1, -1));
|
params.put(Format.Luminance8Alpha8, new ByteOffsetImageCodec(2, FLAG_GRAY, 1, 0, -1, -1));
|
||||||
|
|
||||||
params.put(Format.Luminance16Alpha16, new BitMaskImageCodec(4, FLAG_GRAY,
|
|
||||||
16, 16, 0, 0,
|
|
||||||
16, 0, 0, 0));
|
|
||||||
|
|
||||||
params.put(Format.Luminance16FAlpha16F, new BitMaskImageCodec(4, FLAG_GRAY | FLAG_F16,
|
params.put(Format.Luminance16FAlpha16F, new BitMaskImageCodec(4, FLAG_GRAY | FLAG_F16,
|
||||||
16, 16, 0, 0,
|
16, 16, 0, 0,
|
||||||
16, 0, 0, 0));
|
16, 0, 0, 0));
|
||||||
@ -111,10 +102,6 @@ abstract class ImageCodec {
|
|||||||
// 0, 0, 8, 16));
|
// 0, 0, 8, 16));
|
||||||
|
|
||||||
params.put(Format.RGB8, new ByteOffsetImageCodec(3, 0, -1, 0, 1, 2));
|
params.put(Format.RGB8, new ByteOffsetImageCodec(3, 0, -1, 0, 1, 2));
|
||||||
|
|
||||||
params.put(Format.RGB16, new ByteAlignedImageCodec(6, 0,
|
|
||||||
0, 2, 2, 2,
|
|
||||||
0, 0, 2, 4));
|
|
||||||
|
|
||||||
params.put(Format.RGB32F, new ByteAlignedImageCodec(12, FLAG_F32,
|
params.put(Format.RGB32F, new ByteAlignedImageCodec(12, FLAG_F32,
|
||||||
0, 4, 4, 4,
|
0, 4, 4, 4,
|
||||||
@ -137,11 +124,7 @@ abstract class ImageCodec {
|
|||||||
params.put(Format.ARGB8, new ByteOffsetImageCodec(4, 0, 0, 1, 2, 3));
|
params.put(Format.ARGB8, new ByteOffsetImageCodec(4, 0, 0, 1, 2, 3));
|
||||||
|
|
||||||
params.put(Format.BGRA8, new ByteOffsetImageCodec(4, 0, 3, 2, 1, 0));
|
params.put(Format.BGRA8, new ByteOffsetImageCodec(4, 0, 3, 2, 1, 0));
|
||||||
|
|
||||||
params.put(Format.ARGB4444, new BitMaskImageCodec(2, 0,
|
|
||||||
4, 4, 4, 4,
|
|
||||||
12, 0, 4, 8));
|
|
||||||
|
|
||||||
params.put(Format.RGB5A1, new BitMaskImageCodec(2, 0,
|
params.put(Format.RGB5A1, new BitMaskImageCodec(2, 0,
|
||||||
1, 5, 5, 5,
|
1, 5, 5, 5,
|
||||||
0, 11, 6, 1));
|
0, 11, 6, 1));
|
||||||
@ -157,10 +140,6 @@ abstract class ImageCodec {
|
|||||||
|
|
||||||
params.put(Format.RGBA8, new ByteOffsetImageCodec(4, 0, 3, 0, 1, 2));
|
params.put(Format.RGBA8, new ByteOffsetImageCodec(4, 0, 3, 0, 1, 2));
|
||||||
|
|
||||||
params.put(Format.RGBA16, new ByteAlignedImageCodec(8, 0,
|
|
||||||
2, 2, 2, 2,
|
|
||||||
6, 0, 2, 4));
|
|
||||||
|
|
||||||
params.put(Format.RGBA16F, new ByteAlignedImageCodec(8, FLAG_F16,
|
params.put(Format.RGBA16F, new ByteAlignedImageCodec(8, FLAG_F16,
|
||||||
2, 2, 2, 2,
|
2, 2, 2, 2,
|
||||||
6, 0, 2, 4));
|
6, 0, 2, 4));
|
||||||
|
@ -150,12 +150,12 @@ public class DDSLoader implements AssetLoader {
|
|||||||
|
|
||||||
private void loadDX10Header() throws IOException {
|
private void loadDX10Header() throws IOException {
|
||||||
int dxgiFormat = in.readInt();
|
int dxgiFormat = in.readInt();
|
||||||
if (dxgiFormat != 83) {
|
if (dxgiFormat == 0) {
|
||||||
throw new IOException("Only DXGI_FORMAT_BC5_UNORM "
|
pixelFormat = Format.ETC1;
|
||||||
+ "is supported for DirectX10 DDS! Got: " + dxgiFormat);
|
bpp = 4;
|
||||||
|
} else {
|
||||||
|
throw new IOException("Unsupported DX10 format: " + dxgiFormat);
|
||||||
}
|
}
|
||||||
pixelFormat = Format.LATC;
|
|
||||||
bpp = 8;
|
|
||||||
compressed = true;
|
compressed = true;
|
||||||
|
|
||||||
int resDim = in.readInt();
|
int resDim = in.readInt();
|
||||||
@ -280,6 +280,7 @@ public class DDSLoader implements AssetLoader {
|
|||||||
normal = true;
|
normal = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
case PF_ATI1:
|
case PF_ATI1:
|
||||||
bpp = 4;
|
bpp = 4;
|
||||||
pixelFormat = Image.Format.LTC;
|
pixelFormat = Image.Format.LTC;
|
||||||
@ -288,6 +289,7 @@ public class DDSLoader implements AssetLoader {
|
|||||||
bpp = 8;
|
bpp = 8;
|
||||||
pixelFormat = Image.Format.LATC;
|
pixelFormat = Image.Format.LATC;
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case PF_DX10:
|
case PF_DX10:
|
||||||
compressed = false;
|
compressed = false;
|
||||||
directx10 = true;
|
directx10 = true;
|
||||||
@ -334,9 +336,6 @@ public class DDSLoader implements AssetLoader {
|
|||||||
case 16:
|
case 16:
|
||||||
pixelFormat = Format.Luminance8Alpha8;
|
pixelFormat = Format.Luminance8Alpha8;
|
||||||
break;
|
break;
|
||||||
case 32:
|
|
||||||
pixelFormat = Format.Luminance16Alpha16;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw new IOException("Unsupported GrayscaleAlpha BPP: " + bpp);
|
throw new IOException("Unsupported GrayscaleAlpha BPP: " + bpp);
|
||||||
}
|
}
|
||||||
@ -346,9 +345,6 @@ public class DDSLoader implements AssetLoader {
|
|||||||
case 8:
|
case 8:
|
||||||
pixelFormat = Format.Luminance8;
|
pixelFormat = Format.Luminance8;
|
||||||
break;
|
break;
|
||||||
case 16:
|
|
||||||
pixelFormat = Format.Luminance16;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw new IOException("Unsupported Grayscale BPP: " + bpp);
|
throw new IOException("Unsupported Grayscale BPP: " + bpp);
|
||||||
}
|
}
|
||||||
@ -358,9 +354,6 @@ public class DDSLoader implements AssetLoader {
|
|||||||
case 8:
|
case 8:
|
||||||
pixelFormat = Format.Alpha8;
|
pixelFormat = Format.Alpha8;
|
||||||
break;
|
break;
|
||||||
case 16:
|
|
||||||
pixelFormat = Format.Alpha16;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw new IOException("Unsupported Alpha BPP: " + bpp);
|
throw new IOException("Unsupported Alpha BPP: " + bpp);
|
||||||
}
|
}
|
||||||
|
@ -213,12 +213,14 @@ public class DXTFlipper {
|
|||||||
case DXT5:
|
case DXT5:
|
||||||
type = 3;
|
type = 3;
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
case LATC:
|
case LATC:
|
||||||
type = 4;
|
type = 4;
|
||||||
break;
|
break;
|
||||||
case LTC:
|
case LTC:
|
||||||
type = 5;
|
type = 5;
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -128,14 +128,6 @@ public class AWTLoader implements AssetLoader {
|
|||||||
ByteBuffer data3 = BufferUtils.createByteBuffer(img.getWidth()*img.getHeight());
|
ByteBuffer data3 = BufferUtils.createByteBuffer(img.getWidth()*img.getHeight());
|
||||||
data3.put(dataBuf3);
|
data3.put(dataBuf3);
|
||||||
return new Image(Format.Luminance8, width, height, data3, null, com.jme3.texture.image.ColorSpace.sRGB);
|
return new Image(Format.Luminance8, width, height, data3, null, com.jme3.texture.image.ColorSpace.sRGB);
|
||||||
case BufferedImage.TYPE_USHORT_GRAY: // grayscale heightmap
|
|
||||||
short[] dataBuf4 = (short[]) extractImageData(img);
|
|
||||||
if (flipY)
|
|
||||||
flipImage(dataBuf4, width, height, 16);
|
|
||||||
|
|
||||||
ByteBuffer data4 = BufferUtils.createByteBuffer(img.getWidth()*img.getHeight()*2);
|
|
||||||
data4.asShortBuffer().put(dataBuf4);
|
|
||||||
return new Image(Format.Luminance16, width, height, data4, null, com.jme3.texture.image.ColorSpace.sRGB);
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,19 +141,14 @@ public class ImageToAwt {
|
|||||||
params.put(Format.ABGR8, new DecodeParams(4, mx___, m___x, m__x_, m_x__,
|
params.put(Format.ABGR8, new DecodeParams(4, mx___, m___x, m__x_, m_x__,
|
||||||
sx___, s___x, s__x_, s_x__,
|
sx___, s___x, s__x_, s_x__,
|
||||||
mxxxx, sxxxx));
|
mxxxx, sxxxx));
|
||||||
params.put(Format.ARGB4444, new DecodeParams(2, m4x___, m4_x__, m4__x_, m4___x,
|
|
||||||
s4x___, s4_x__, s4__x_, s4___x,
|
|
||||||
mxxxx, sxxxx));
|
|
||||||
params.put(Format.Alpha16, new DecodeParams(2, mxxxx, sxxxx, mxxxx, sxxxx, true));
|
|
||||||
params.put(Format.Alpha8, new DecodeParams(1, mxxxx, sxxxx, mxxxx, sxxxx, true));
|
params.put(Format.Alpha8, new DecodeParams(1, mxxxx, sxxxx, mxxxx, sxxxx, true));
|
||||||
params.put(Format.BGR8, new DecodeParams(3, 0, m___x, m__x_, m_x__,
|
params.put(Format.BGR8, new DecodeParams(3, 0, m___x, m__x_, m_x__,
|
||||||
0, s___x, s__x_, s_x__,
|
0, s___x, s__x_, s_x__,
|
||||||
mxxxx, sxxxx));
|
mxxxx, sxxxx));
|
||||||
params.put(Format.Luminance16, new DecodeParams(2, mxxxx, sxxxx, mxxxx, sxxxx, false));
|
|
||||||
params.put(Format.Luminance8, new DecodeParams(1, mxxxx, sxxxx, mxxxx, sxxxx, false));
|
params.put(Format.Luminance8, new DecodeParams(1, mxxxx, sxxxx, mxxxx, sxxxx, false));
|
||||||
params.put(Format.Luminance16Alpha16, new DecodeParams(4, m__xx, mxx__, 0, 0,
|
|
||||||
s__xx, sxx__, 0, 0,
|
|
||||||
mxxxx, sxxxx));
|
|
||||||
params.put(Format.Luminance16F, new DecodeParams(2, mxxxx, sxxxx, mxxxx, sxxxx, false));
|
params.put(Format.Luminance16F, new DecodeParams(2, mxxxx, sxxxx, mxxxx, sxxxx, false));
|
||||||
params.put(Format.Luminance16FAlpha16F, new DecodeParams(4, m__xx, mxx__, 0, 0,
|
params.put(Format.Luminance16FAlpha16F, new DecodeParams(4, m__xx, mxx__, 0, 0,
|
||||||
s__xx, sxx__, 0, 0,
|
s__xx, sxx__, 0, 0,
|
||||||
|
@ -115,12 +115,6 @@ public class TestImageRaster extends SimpleApplication {
|
|||||||
image = convertImage(image, Format.RGB16F_to_RGB111110F);
|
image = convertImage(image, Format.RGB16F_to_RGB111110F);
|
||||||
convertAndPutImage(image, 25, 0);
|
convertAndPutImage(image, 25, 0);
|
||||||
|
|
||||||
image = convertImage(image, Format.RGBA16);
|
|
||||||
convertAndPutImage(image, 0, 5);
|
|
||||||
|
|
||||||
image = convertImage(image, Format.RGB16);
|
|
||||||
convertAndPutImage(image, 5, 5);
|
|
||||||
|
|
||||||
image = convertImage(image, Format.RGBA8);
|
image = convertImage(image, Format.RGBA8);
|
||||||
convertAndPutImage(image, 10, 5);
|
convertAndPutImage(image, 10, 5);
|
||||||
|
|
||||||
@ -142,9 +136,6 @@ public class TestImageRaster extends SimpleApplication {
|
|||||||
image = convertImage(image, Format.RGB5A1);
|
image = convertImage(image, Format.RGB5A1);
|
||||||
convertAndPutImage(image, 0, 10);
|
convertAndPutImage(image, 0, 10);
|
||||||
|
|
||||||
image = convertImage(image, Format.ARGB4444);
|
|
||||||
convertAndPutImage(image, 5, 10);
|
|
||||||
|
|
||||||
image = convertImage(image, Format.Luminance32F);
|
image = convertImage(image, Format.Luminance32F);
|
||||||
convertAndPutImage(image, 0, 15);
|
convertAndPutImage(image, 0, 15);
|
||||||
|
|
||||||
@ -154,17 +145,11 @@ public class TestImageRaster extends SimpleApplication {
|
|||||||
image = convertImage(image, Format.Luminance16F);
|
image = convertImage(image, Format.Luminance16F);
|
||||||
convertAndPutImage(image, 10, 15);
|
convertAndPutImage(image, 10, 15);
|
||||||
|
|
||||||
image = convertImage(image, Format.Luminance16Alpha16);
|
image = convertImage(image, Format.Luminance8Alpha8);
|
||||||
convertAndPutImage(image, 15, 15);
|
convertAndPutImage(image, 15, 15);
|
||||||
|
|
||||||
image = convertImage(image, Format.Luminance16);
|
|
||||||
convertAndPutImage(image, 20, 15);
|
|
||||||
|
|
||||||
image = convertImage(image, Format.Luminance8Alpha8);
|
|
||||||
convertAndPutImage(image, 25, 15);
|
|
||||||
|
|
||||||
image = convertImage(image, Format.Luminance8);
|
image = convertImage(image, Format.Luminance8);
|
||||||
convertAndPutImage(image, 30, 15);
|
convertAndPutImage(image, 20, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -353,10 +353,6 @@ public class LwjglRenderer implements Renderer {
|
|||||||
caps.add(Caps.TextureCompressionS3TC);
|
caps.add(Caps.TextureCompressionS3TC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasExtension("GL_EXT_texture_compression_latc")) {
|
|
||||||
caps.add(Caps.TextureCompressionLATC);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasExtension("GL_ARB_ES3_compatibility")) {
|
if (hasExtension("GL_ARB_ES3_compatibility")) {
|
||||||
caps.add(Caps.TextureCompressionETC1);
|
caps.add(Caps.TextureCompressionETC1);
|
||||||
}
|
}
|
||||||
|
@ -84,17 +84,14 @@ class TextureUtil {
|
|||||||
static {
|
static {
|
||||||
// Alpha formats
|
// Alpha formats
|
||||||
setFormat(Format.Alpha8, GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE, false);
|
setFormat(Format.Alpha8, GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE, false);
|
||||||
setFormat(Format.Alpha16, GL_ALPHA16, GL_ALPHA, GL_UNSIGNED_SHORT, false);
|
|
||||||
|
|
||||||
// Luminance formats
|
// Luminance formats
|
||||||
setFormat(Format.Luminance8, GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE, false);
|
setFormat(Format.Luminance8, GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE, false);
|
||||||
setFormat(Format.Luminance16, GL_LUMINANCE16, GL_LUMINANCE, GL_UNSIGNED_SHORT, false);
|
|
||||||
setFormat(Format.Luminance16F, GL_LUMINANCE16F_ARB, GL_LUMINANCE, GL_HALF_FLOAT_ARB, false);
|
setFormat(Format.Luminance16F, GL_LUMINANCE16F_ARB, GL_LUMINANCE, GL_HALF_FLOAT_ARB, false);
|
||||||
setFormat(Format.Luminance32F, GL_LUMINANCE32F_ARB, GL_LUMINANCE, GL_FLOAT, false);
|
setFormat(Format.Luminance32F, GL_LUMINANCE32F_ARB, GL_LUMINANCE, GL_FLOAT, false);
|
||||||
|
|
||||||
// Luminance alpha formats
|
// Luminance alpha formats
|
||||||
setFormat(Format.Luminance8Alpha8, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, false);
|
setFormat(Format.Luminance8Alpha8, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, false);
|
||||||
setFormat(Format.Luminance16Alpha16, GL_LUMINANCE16_ALPHA16, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT, false);
|
|
||||||
setFormat(Format.Luminance16FAlpha16F, GL_LUMINANCE_ALPHA16F_ARB, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_ARB, false);
|
setFormat(Format.Luminance16FAlpha16F, GL_LUMINANCE_ALPHA16F_ARB, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_ARB, false);
|
||||||
|
|
||||||
// Depth formats
|
// Depth formats
|
||||||
@ -112,8 +109,6 @@ class TextureUtil {
|
|||||||
setFormat(Format.ARGB8, GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, false);
|
setFormat(Format.ARGB8, GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, false);
|
||||||
setFormat(Format.BGRA8, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, false);
|
setFormat(Format.BGRA8, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, false);
|
||||||
setFormat(Format.RGB8, GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, false);
|
setFormat(Format.RGB8, GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, false);
|
||||||
// setFormat(Format.RGB10, GL_RGB10, GL_RGB, GL_UNSIGNED_INT_10_10_10_2, false);
|
|
||||||
setFormat(Format.RGB16, GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, false);
|
|
||||||
setFormat(Format.RGB16F, GL_RGB16F_ARB, GL_RGB, GL_HALF_FLOAT_ARB, false);
|
setFormat(Format.RGB16F, GL_RGB16F_ARB, GL_RGB, GL_HALF_FLOAT_ARB, false);
|
||||||
setFormat(Format.RGB32F, GL_RGB32F_ARB, GL_RGB, GL_FLOAT, false);
|
setFormat(Format.RGB32F, GL_RGB32F_ARB, GL_RGB, GL_FLOAT, false);
|
||||||
|
|
||||||
@ -122,14 +117,11 @@ class TextureUtil {
|
|||||||
setFormat(Format.RGB9E5, GL_RGB9_E5_EXT, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV_EXT, false);
|
setFormat(Format.RGB9E5, GL_RGB9_E5_EXT, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV_EXT, false);
|
||||||
setFormat(Format.RGB16F_to_RGB111110F, GL_R11F_G11F_B10F_EXT, GL_RGB, GL_HALF_FLOAT_ARB, false);
|
setFormat(Format.RGB16F_to_RGB111110F, GL_R11F_G11F_B10F_EXT, GL_RGB, GL_HALF_FLOAT_ARB, false);
|
||||||
setFormat(Format.RGB16F_to_RGB9E5, GL_RGB9_E5_EXT, GL_RGB, GL_HALF_FLOAT_ARB, false);
|
setFormat(Format.RGB16F_to_RGB9E5, GL_RGB9_E5_EXT, GL_RGB, GL_HALF_FLOAT_ARB, false);
|
||||||
setFormat(Format.RGB10_A2, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, false);
|
|
||||||
|
|
||||||
// RGBA formats
|
// RGBA formats
|
||||||
setFormat(Format.ABGR8, GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, false);
|
setFormat(Format.ABGR8, GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, false);
|
||||||
setFormat(Format.RGB5A1, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, false);
|
setFormat(Format.RGB5A1, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, false);
|
||||||
setFormat(Format.ARGB4444,GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, false);
|
|
||||||
setFormat(Format.RGBA8, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false);
|
setFormat(Format.RGBA8, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false);
|
||||||
setFormat(Format.RGBA16, GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, false); // might be incorrect
|
|
||||||
setFormat(Format.RGBA16F, GL_RGBA16F_ARB, GL_RGBA, GL_HALF_FLOAT_ARB, false);
|
setFormat(Format.RGBA16F, GL_RGBA16F_ARB, GL_RGBA, GL_HALF_FLOAT_ARB, false);
|
||||||
setFormat(Format.RGBA32F, GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT, false);
|
setFormat(Format.RGBA32F, GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT, false);
|
||||||
|
|
||||||
@ -139,10 +131,6 @@ class TextureUtil {
|
|||||||
setFormat(Format.DXT3, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, true);
|
setFormat(Format.DXT3, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, true);
|
||||||
setFormat(Format.DXT5, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, true);
|
setFormat(Format.DXT5, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, true);
|
||||||
|
|
||||||
// LTC/LATC/3Dc formats
|
|
||||||
setFormat(Format.LTC, GL_COMPRESSED_LUMINANCE_LATC1_EXT, GL_LUMINANCE, GL_UNSIGNED_BYTE, true);
|
|
||||||
setFormat(Format.LATC, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, true);
|
|
||||||
|
|
||||||
// ETC1 support on regular OpenGL requires ES3 compatibility extension.
|
// ETC1 support on regular OpenGL requires ES3 compatibility extension.
|
||||||
// NOTE: ETC2 is backwards compatible with ETC1, so we can
|
// NOTE: ETC2 is backwards compatible with ETC1, so we can
|
||||||
// upload ETC1 textures as ETC2.
|
// upload ETC1 textures as ETC2.
|
||||||
@ -199,12 +187,6 @@ class TextureUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LATC:
|
|
||||||
case LTC:
|
|
||||||
if (!caps.contains(Caps.TextureCompressionLATC)){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RGB9E5:
|
case RGB9E5:
|
||||||
case RGB16F_to_RGB9E5:
|
case RGB16F_to_RGB9E5:
|
||||||
if (!caps.contains(Caps.SharedExponentTexture)){
|
if (!caps.contains(Caps.SharedExponentTexture)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user