From 0e843c2a96dcb1df8aeebaea8391f90b4ae34b6f Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 8 Dec 2024 01:27:57 +0100 Subject: [PATCH] stuff --- src/hardware/hw_cache.c | 9 +++------ src/hardware/hw_data.h | 12 +++++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index c67f1b75c..652e1e903 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -336,8 +336,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe else gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY; - gltex->mipmap.width = (UINT16)texture->width; - gltex->mipmap.height = (UINT16)texture->height; + gltex->mipmap.width = SHORT(texture->width); + gltex->mipmap.height = SHORT(texture->height); if (skyspecial) gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ... @@ -416,14 +416,13 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo glPatch->leftoffset = SHORT(patch->leftoffset); glPatch->topoffset = SHORT(patch->topoffset); - //glMipmap->width = (UINT16)SHORT(patch->width); - //glMipmap->height = (UINT16)SHORT(patch->height); glMipmap->width = glMipmap->height = 1; while (glMipmap->width < glPatch->width) glMipmap->width <<= 1; while (glMipmap->height < glPatch->height) glMipmap->height <<= 1; // no wrap around, no chroma key glMipmap->flags = 0; + // setup the texture info glMipmap->format = patchformat; @@ -443,8 +442,6 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo glPatch->width, glPatch->height, patch); } - - //glPatch->max_s = glPatch->max_t = 1.0f; } // ================================================= diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index b149493c5..1f16ebf2a 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -33,16 +33,18 @@ typedef enum GLTextureFormat_e GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22, } GLTextureFormat_t; -// data holds the address of the graphics data cached in heap memory -// NULL if the texture is not in Doom heap cache. +// Texture information (misleadingly named "mipmap" all over the code.) +// The *data pointer holds the address of the graphics data cached in heap memory. +// NULL if the texture is not in SRB2's heap cache. struct GLMipmap_s { + // for UpdateTexture GLTextureFormat_t format; void *data; UINT32 flags; UINT16 width, height; - UINT32 downloaded; // tex_downloaded + UINT32 downloaded; // The GPU has this texture. struct GLMipmap_s *nextcolormap; const UINT8 *colormap; @@ -50,12 +52,12 @@ struct GLMipmap_s typedef struct GLMipmap_s GLMipmap_t; // -// Doom texture info, as cached for hardware rendering +// Level textures, as cached for hardware rendering. // struct GLMapTexture_s { GLMipmap_t mipmap; - float scaleX; //used for scaling textures on walls + float scaleX; //used for scaling textures on walls float scaleY; }; typedef struct GLMapTexture_s GLMapTexture_t;