다운로드
#include "dxtlib.h"
#include <stdio.h>
static FILE* gs_fp = NULL;
void WriteDTXnFile(unsigned long count, void* buf)
{
if (!gs_fp)
return;
fwrite(buf, count, 1, gs_fp);
}
void ReadDTXnFile(unsigned long count, void* buf)
{
if (!gs_fp)
return;
fread(buf, count, 1, gs_fp);
}
bool Save(const void* c_data, unsigned int width, unsigned int height, unsigned int byte_pitch, const char* outFileName)
{
if (gs_fp)
return false;
CompressionOptions coptions;
memset(&coptions, 0, sizeof(coptions));
coptions.MipMapType = dNoMipMaps; // dNoMipMaps, dSpecifyMipMaps, dUseExistingMipMaps, dGenerateMipMaps
coptions.MIPFilterType = dMIPFilterBox;
coptions.bDitherEachMIPLevel = coptions.bDitherColor;
coptions.TextureType = dTextureType2D;
coptions.TextureFormat = dDXT3;
gs_fp = fopen(outFileName, "wb");
if (!gs_fp)
return false;
nvDXTcompress((unsigned char*)c_data, width, height, byte_pitch, &coptions, 4, 0);
fclose(gs_fp);
gs_fp = NULL;
return true;
}


python 을 좋아하는 게임 프로그래머