'nvidia'에 해당되는 글 1건

  1. nvdxt 사용 방법 (구형 버전) 2007/06/05

nvdxt 사용 방법 (구형 버전)

Posted at 2007/06/05 13:41// Posted in d3d
다운로드


#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;
}
이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/06/05 13:41 2007/06/05 13:41
Tag , ,