diff --git a/engine/client/image.c b/engine/client/image.c index 255c5d16..d1f4acc0 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -7240,10 +7240,10 @@ static struct pendingtextureinfo *Image_ReadVTFFile(unsigned int flags, const ch unsigned int numresources; } *vtf; fmtfmt_t vmffmt, lrfmt; - unsigned int bw, bh, bb; + unsigned int bw, bh, bd, bb; qbyte *end = filedata + filesize; - unsigned int face, faces, frame, frames, miplevel, miplevels, img; - unsigned int w, h; + unsigned int faces, frame, frames, miplevel, miplevels, img; + unsigned int w, h, d = 1; size_t datasize; unsigned int version; @@ -7294,10 +7294,10 @@ static struct pendingtextureinfo *Image_ReadVTFFile(unsigned int flags, const ch filedata += vtf->headersize; //and skip the low-res image too. if (vtf->lowreswidth && vtf->lowresheight) - Image_BlockSizeForEncoding(ImageVTF_VtfToFTE(lrfmt), &bb, &bw, &bh); + Image_BlockSizeForEncoding(ImageVTF_VtfToFTE(lrfmt), &bb, &bw, &bh, &bd); else - bb=bw=bh=1; - datasize = ((vtf->lowreswidth+bw-1)/bw) * ((vtf->lowresheight+bh-1)/bh) * bb; + bb=bw=bh=bd=1; + datasize = ((vtf->lowreswidth+bw-1)/bw) * ((vtf->lowresheight+bh-1)/bh) * ((1/*vtf->lowresdepth*/+bd-1)/bd) * bb; filedata += datasize; } @@ -7307,7 +7307,7 @@ static struct pendingtextureinfo *Image_ReadVTFFile(unsigned int flags, const ch mips->type = (vtf->flags & 0x4000)?PTI_CUBE:PTI_2D; mips->encoding = ImageVTF_VtfToFTE(vmffmt); - Image_BlockSizeForEncoding(mips->encoding, &bb, &bw, &bh); + Image_BlockSizeForEncoding(mips->encoding, &bb, &bw, &bh, &bd); miplevels = vtf->mipmapcount; frames = 1;//vtf->numframes; @@ -7335,7 +7335,7 @@ static struct pendingtextureinfo *Image_ReadVTFFile(unsigned int flags, const ch w = 1; if (!h) h = 1; - datasize = ((w+bw-1)/bw) * ((h+bh-1)/bh) * bb; + datasize = ((w+bw-1)/bw) * ((h+bh-1)/bh) * ((d+bd-1)/bd) * bb; for (frame = 0; frame < vtf->numframes; frame++) { if (miplevel < miplevels) diff --git a/engine/common/config_fteqw.h b/engine/common/config_fteqw.h index 0ce86a2c..8272614c 100644 --- a/engine/common/config_fteqw.h +++ b/engine/common/config_fteqw.h @@ -106,7 +106,7 @@ #define IMAGEFMT_BMP //windows bmp. yuck. also includes .ico for the luls #define IMAGEFMT_PCX //paletted junk. required for qw player skins, q2 and a few old skyboxes. #define IMAGEFMT_EXR //openexr, via Industrial Light & Magic's rgba api, giving half-float data. -//#define IMAGEFMT_VTF //hl2 image format +#define IMAGEFMT_VTF //HalfLife2's image format (also enables its materials format) #define AVAIL_PNGLIB //.png image format support (read+screenshots) #define AVAIL_JPEGLIB //.jpeg image format support (read+screenshots) //#define AVAIL_STBI //make use of Sean T. Barrett's lightweight public domain stb_image[_write] single-file-library, to avoid libpng/libjpeg dependancies.