mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 04:49:39 -10:00
* Initial KTX1/ETC2 support * Conditional glad include * remove unused function * define glenum for non opengl build * remove unused param * fix qtbuild * change ktx format to enum * use nullptr * ktx: support the same etc2 formats available in amd compressonator * add comments and missing include * correct flag type * clarify variable name for clang * cleanup * update glad loader to GL4.3
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
#pragma once
|
|
#include "globalincs/pstypes.h"
|
|
#include "cfile/cfile.h"
|
|
|
|
// ETC2 types
|
|
enum KTX_Format {
|
|
KTX_ETC2_RGB = 100,
|
|
KTX_ETC2_RGBA_EAC,
|
|
KTX_ETC2_SRGB,
|
|
KTX_ETC2_SRGBA_EAC,
|
|
KTX_ETC2_RGB_A1,
|
|
KTX_ETC2_SRGB_A1
|
|
};
|
|
|
|
enum KTX1_Error {
|
|
KTX1_ERROR_NONE = 0,
|
|
KTX1_ERROR_INVALID_FILENAME,
|
|
KTX1_ERROR_BAD_HEADER,
|
|
KTX1_ERROR_UNSUPPORTED,
|
|
KTX1_ERROR_INVALID_FORMAT
|
|
};
|
|
|
|
struct KTX1_Header {
|
|
uint8_t identifier[12];
|
|
uint32_t endianness; // 0x04030201 little
|
|
uint32_t glType;
|
|
uint32_t glTypeSize;
|
|
uint32_t glFormat;
|
|
uint32_t glInternalFormat;
|
|
uint32_t glBaseInternalFormat;
|
|
uint32_t pixelWidth, pixelHeight, pixelDepth;
|
|
uint32_t numberOfArrayElements;
|
|
uint32_t numberOfFaces;
|
|
uint32_t numberOfMipmapLevels;
|
|
uint32_t bytesOfKeyValueData;
|
|
};
|
|
|
|
//reads a dds header and returns a KTX1_Error
|
|
int ktx1_read_header(const char* filename, CFILE* img_cfp, int* w, int* h, int* bpp, int* c_type, int* mip_levels, size_t* total_size);
|
|
|
|
//reads bitmap and returns a KTX1_Error
|
|
int ktx1_read_bitmap(const char* filename, ubyte* dst, ubyte* out_bpp);
|
|
|
|
//Get the GL enum type for this KTX format type, returns 0 if type is invalid.
|
|
int ktx_map_ktx_format_to_gl_internal(const int ktx_format);
|
|
|
|
//Get ktx block size (bytes per block) from GL internat format enum, returns 0 if internal format is invalid
|
|
uint32_t ktx_etc_block_size(const int internal_format); |