DDSLoader: fix loading 16-bit images (as exported by PVRTexTool)
This commit is contained in:
parent
badefdf4e4
commit
629c007cd4
@ -151,10 +151,10 @@ 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 == 0) {
|
if (dxgiFormat == 0) {
|
||||||
pixelFormat = Format.ETC1;
|
pixelFormat = Format.ETC1;
|
||||||
bpp = 4;
|
bpp = 4;
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Unsupported DX10 format: " + dxgiFormat);
|
throw new IOException("Unsupported DX10 format: " + dxgiFormat);
|
||||||
}
|
}
|
||||||
compressed = true;
|
compressed = true;
|
||||||
|
|
||||||
@ -327,9 +327,17 @@ public class DDSLoader implements AssetLoader {
|
|||||||
|
|
||||||
if (is(pfFlags, DDPF_RGB)) {
|
if (is(pfFlags, DDPF_RGB)) {
|
||||||
if (is(pfFlags, DDPF_ALPHAPIXELS)) {
|
if (is(pfFlags, DDPF_ALPHAPIXELS)) {
|
||||||
pixelFormat = Format.RGBA8;
|
if (bpp == 16) {
|
||||||
|
pixelFormat = Format.RGB5A1;
|
||||||
|
} else {
|
||||||
|
pixelFormat = Format.RGBA8;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pixelFormat = Format.RGB8;
|
if (bpp == 16) {
|
||||||
|
pixelFormat = Format.RGB565;
|
||||||
|
} else {
|
||||||
|
pixelFormat = Format.RGB8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (is(pfFlags, DDPF_GRAYSCALE) && is(pfFlags, DDPF_ALPHAPIXELS)) {
|
} else if (is(pfFlags, DDPF_GRAYSCALE) && is(pfFlags, DDPF_ALPHAPIXELS)) {
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user