private void loadDX10Header() throws IOException { int dxgiFormat = in.readInt(); if (dxgiFormat == 0) { pixelFormat = Format.ETC1; bpp = 4; } else { throw new IOException("Unsupported DX10 format: " + dxgiFormat); } compressed = true; int resDim = in.readInt(); if (resDim == DX10DIM_TEXTURE3D) { texture3D = true; } int miscFlag = in.readInt(); int arraySize = in.readInt(); if (is(miscFlag, DX10MISC_TEXTURECUBE)) { // mark texture as cube if (arraySize != 6) { throw new IOException("Cubemaps should consist of 6 images!"); } } in.skipBytes(4); // skip reserved value }
if (!is(flags, DDSD_MANDATORY) && !is(flags, DDSD_MANDATORY_DX10)) { throw new IOException("Mandatory flags missing"); if (!is(caps1, DDSCAPS_TEXTURE)) { logger.warning("Texture is missing the DDSCAPS_TEXTURE-flag"); if (is(caps2, DDSCAPS2_CUBEMAP)) { depth = 6; // somewhat of a hack, force loading 6 textures if a cubemap if (is(caps2, DDSCAPS2_VOLUME)) { texture3D = true; if (is(caps1, DDSCAPS_MIPMAP)) { if (!is(flags, DDSD_MIPMAPCOUNT)) { mipMapCount = expectedMipmaps; } else if (mipMapCount != expectedMipmaps) {
normal = is(pfFlags, DDPF_NORMAL); if (is(pfFlags, DDPF_FOURCC)) { compressed = true; int fourcc = in.readInt(); case PF_DXT1: bpp = 4; if (is(pfFlags, DDPF_ALPHAPIXELS)) { pixelFormat = Image.Format.DXT1A; } else { if (is(flags, DDSD_LINEARSIZE)) { if (pitchOrSize == 0) { logger.warning("Must use linear size with fourcc"); if (is(pfFlags, DDPF_RGB)) { if (is(pfFlags, DDPF_ALPHAPIXELS)) { if (bpp == 16) { pixelFormat = Format.RGB5A1; } else if (is(pfFlags, DDPF_GRAYSCALE) && is(pfFlags, DDPF_ALPHAPIXELS)) { switch (bpp) { case 16: } else if (is(pfFlags, DDPF_GRAYSCALE)) { switch (bpp) { case 8:
private void loadDX10Header() throws IOException { int dxgiFormat = in.readInt(); if (dxgiFormat == 0) { pixelFormat = Format.ETC1; bpp = 4; } else { throw new IOException("Unsupported DX10 format: " + dxgiFormat); } compressed = true; int resDim = in.readInt(); if (resDim == DX10DIM_TEXTURE3D) { texture3D = true; } int miscFlag = in.readInt(); int arraySize = in.readInt(); if (is(miscFlag, DX10MISC_TEXTURECUBE)) { // mark texture as cube if (arraySize != 6) { throw new IOException("Cubemaps should consist of 6 images!"); } } in.skipBytes(4); // skip reserved value }
private void loadDX10Header() throws IOException { int dxgiFormat = in.readInt(); if (dxgiFormat != 83) { throw new IOException("Only DXGI_FORMAT_BC5_UNORM " + "is supported for DirectX10 DDS! Got: " + dxgiFormat); } pixelFormat = Format.LATC; bpp = 8; compressed = true; int resDim = in.readInt(); if (resDim == DX10DIM_TEXTURE3D) { texture3D = true; } int miscFlag = in.readInt(); int arraySize = in.readInt(); if (is(miscFlag, DX10MISC_TEXTURECUBE)) { // mark texture as cube if (arraySize != 6) { throw new IOException("Cubemaps should consist of 6 images!"); } } in.skipBytes(4); // skip reserved value }
if (!is(flags, DDSD_MANDATORY) && !is(flags, DDSD_MANDATORY_DX10)) { throw new IOException("Mandatory flags missing"); if (!is(caps1, DDSCAPS_TEXTURE)) { throw new IOException("File is not a texture"); if (is(caps2, DDSCAPS2_CUBEMAP)) { depth = 6; // somewhat of a hack, force loading 6 textures if a cubemap if (is(caps2, DDSCAPS2_VOLUME)) { texture3D = true; if (is(caps1, DDSCAPS_MIPMAP)) { if (!is(flags, DDSD_MIPMAPCOUNT)) { mipMapCount = expectedMipmaps; } else if (mipMapCount != expectedMipmaps) {
if (!is(flags, DDSD_MANDATORY) && !is(flags, DDSD_MANDATORY_DX10)) { throw new IOException("Mandatory flags missing"); if (!is(caps1, DDSCAPS_TEXTURE)) { logger.warning("Texture is missing the DDSCAPS_TEXTURE-flag"); if (is(caps2, DDSCAPS2_CUBEMAP)) { depth = 6; // somewhat of a hack, force loading 6 textures if a cubemap if (is(caps2, DDSCAPS2_VOLUME)) { texture3D = true; if (is(caps1, DDSCAPS_MIPMAP)) { if (!is(flags, DDSD_MIPMAPCOUNT)) { mipMapCount = expectedMipmaps; } else if (mipMapCount != expectedMipmaps) {
normal = is(pfFlags, DDPF_NORMAL); if (is(pfFlags, DDPF_FOURCC)) { compressed = true; int fourcc = in.readInt(); case PF_DXT1: bpp = 4; if (is(pfFlags, DDPF_ALPHAPIXELS)) { pixelFormat = Image.Format.DXT1A; } else { if (is(flags, DDSD_LINEARSIZE)) { if (pitchOrSize == 0) { logger.warning("Must use linear size with fourcc"); if (is(pfFlags, DDPF_RGB)) { if (is(pfFlags, DDPF_ALPHAPIXELS)) { pixelFormat = Format.RGBA8; } else { pixelFormat = Format.RGB8; } else if (is(pfFlags, DDPF_GRAYSCALE) && is(pfFlags, DDPF_ALPHAPIXELS)) { switch (bpp) { case 16: } else if (is(pfFlags, DDPF_GRAYSCALE)) { switch (bpp) { case 8:
normal = is(pfFlags, DDPF_NORMAL); if (is(pfFlags, DDPF_FOURCC)) { compressed = true; int fourcc = in.readInt(); case PF_DXT1: bpp = 4; if (is(pfFlags, DDPF_ALPHAPIXELS)) { pixelFormat = Image.Format.DXT1A; } else { if (is(flags, DDSD_LINEARSIZE)) { if (pitchOrSize == 0) { logger.warning("Must use linear size with fourcc"); if (is(pfFlags, DDPF_RGB)) { if (is(pfFlags, DDPF_ALPHAPIXELS)) { if (bpp == 16) { pixelFormat = Format.RGB5A1; } else if (is(pfFlags, DDPF_GRAYSCALE) && is(pfFlags, DDPF_ALPHAPIXELS)) { switch (bpp) { case 16: } else if (is(pfFlags, DDPF_GRAYSCALE)) { switch (bpp) { case 8: