Merge branch 'remove-glide-2' into 'next'

Remove references to the Glide API

See merge request STJr/SRB2!1037
This commit is contained in:
James R 2020-07-12 19:10:34 -04:00
commit 5bcc821a7d
34 changed files with 914 additions and 988 deletions

View file

@ -439,7 +439,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glide.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h

View file

@ -645,7 +645,7 @@ ifdef SDL
ifdef MINGW ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
@ -654,7 +654,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
else else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
@ -732,7 +732,7 @@ ifndef SDL
ifndef NOHW ifndef NOHW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
@ -741,7 +741,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ command.h hardware/hw_data.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \

View file

@ -626,7 +626,7 @@ static void COM_ExecuteString(char *ptext)
// check cvars // check cvars
// Hurdler: added at Ebola's request ;) // Hurdler: added at Ebola's request ;)
// (don't flood the console in software mode with bad gr_xxx command) // (don't flood the console in software mode with bad gl_xxx command)
if (!CV_Command() && con_destlines) if (!CV_Command() && con_destlines)
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0)); CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
} }

View file

@ -635,7 +635,7 @@ static void D_Display(void)
V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s); V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor); snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor);
V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s); V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s);
if (cv_grbatching.value) if (cv_glbatching.value)
{ {
snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor); snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor);
V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s); V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s);

View file

@ -250,7 +250,7 @@ void HWR_RenderBatches(void)
// sort polygons // sort polygons
rs_hw_batchsorttime = I_GetTimeMicros(); rs_hw_batchsorttime = I_GetTimeMicros();
if (cv_grshaders.value && gr_shadersavailable) if (cv_glshaders.value && gl_shadersavailable)
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons); qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
else else
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders); qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
@ -273,7 +273,7 @@ void HWR_RenderBatches(void)
// set state for first batch // set state for first batch
if (cv_grshaders.value && gr_shadersavailable) if (cv_glshaders.value && gl_shadersavailable)
{ {
HWD.pfnSetShader(currentShader); HWD.pfnSetShader(currentShader);
} }
@ -355,7 +355,7 @@ void HWR_RenderBatches(void)
nextSurfaceInfo = polygonArray[nextIndex].surf; nextSurfaceInfo = polygonArray[nextIndex].surf;
if (nextPolyFlags & PF_NoTexture) if (nextPolyFlags & PF_NoTexture)
nextTexture = 0; nextTexture = 0;
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable) if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
{ {
changeState = true; changeState = true;
changeShader = true; changeShader = true;
@ -370,7 +370,7 @@ void HWR_RenderBatches(void)
changeState = true; changeState = true;
changePolyFlags = true; changePolyFlags = true;
} }
if (cv_grshaders.value && gr_shadersavailable) if (cv_glshaders.value && gl_shadersavailable)
{ {
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||

View file

@ -61,17 +61,17 @@ static INT32 totalsubsecpolys = 0;
/// \todo check out how much is used /// \todo check out how much is used
static size_t POLYPOOLSIZE = 1024000; static size_t POLYPOOLSIZE = 1024000;
static UINT8 *gr_polypool = NULL; static UINT8 *gl_polypool = NULL;
static UINT8 *gr_ppcurrent; static UINT8 *gl_ppcurrent;
static size_t gr_ppfree; static size_t gl_ppfree;
#endif #endif
// only between levels, clear poly pool // only between levels, clear poly pool
static void HWR_ClearPolys(void) static void HWR_ClearPolys(void)
{ {
#ifndef ZPLANALLOC #ifndef ZPLANALLOC
gr_ppcurrent = gr_polypool; gl_ppcurrent = gl_polypool;
gr_ppfree = POLYPOOLSIZE; gl_ppfree = POLYPOOLSIZE;
#endif #endif
} }
@ -86,8 +86,8 @@ void HWR_InitPolyPool(void)
POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb) POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb)
CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE); CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE);
gr_polypool = malloc(POLYPOOLSIZE); gl_polypool = malloc(POLYPOOLSIZE);
if (!gr_polypool) if (!gl_polypool)
I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n"); I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n");
HWR_ClearPolys(); HWR_ClearPolys();
#endif #endif
@ -96,9 +96,9 @@ void HWR_InitPolyPool(void)
void HWR_FreePolyPool(void) void HWR_FreePolyPool(void)
{ {
#ifndef ZPLANALLOC #ifndef ZPLANALLOC
if (gr_polypool) if (gl_polypool)
free(gr_polypool); free(gl_polypool);
gr_polypool = NULL; gl_polypool = NULL;
#endif #endif
} }
@ -110,19 +110,19 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
p = Z_Malloc(size, PU_HWRPLANE, NULL); p = Z_Malloc(size, PU_HWRPLANE, NULL);
#else #else
#ifdef PARANOIA #ifdef PARANOIA
if (!gr_polypool) if (!gl_polypool)
I_Error("Used gr_polypool without init!\n"); I_Error("Used gl_polypool without init!\n");
if (!gr_ppcurrent) if (!gl_ppcurrent)
I_Error("gr_ppcurrent == NULL!\n"); I_Error("gl_ppcurrent == NULL!\n");
#endif #endif
if (gr_ppfree < size) if (gl_ppfree < size)
I_Error("HWR_AllocPoly(): no more memory %u bytes left, %u bytes needed\n\n%s\n", I_Error("HWR_AllocPoly(): no more memory %u bytes left, %u bytes needed\n\n%s\n",
gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); gl_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)");
p = (poly_t *)gr_ppcurrent; p = (poly_t *)gl_ppcurrent;
gr_ppcurrent += size; gl_ppcurrent += size;
gr_ppfree -= size; gl_ppfree -= size;
#endif #endif
p->numpts = numpts; p->numpts = numpts;
return p; return p;
@ -135,13 +135,13 @@ static polyvertex_t *HWR_AllocVertex(void)
#ifdef ZPLANALLOC #ifdef ZPLANALLOC
p = Z_Malloc(size, PU_HWRPLANE, NULL); p = Z_Malloc(size, PU_HWRPLANE, NULL);
#else #else
if (gr_ppfree < size) if (gl_ppfree < size)
I_Error("HWR_AllocVertex(): no more memory %u bytes left, %u bytes needed\n\n%s\n", I_Error("HWR_AllocVertex(): no more memory %u bytes left, %u bytes needed\n\n%s\n",
gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); gl_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)");
p = (polyvertex_t *)gr_ppcurrent; p = (polyvertex_t *)gl_ppcurrent;
gr_ppcurrent += size; gl_ppcurrent += size;
gr_ppfree -= size; gl_ppfree -= size;
#endif #endif
return p; return p;
} }
@ -829,7 +829,7 @@ static INT32 SolveTProblem(void)
INT32 i; INT32 i;
size_t l; size_t l;
if (cv_grsolvetjoin.value == 0) if (cv_glsolvetjoin.value == 0)
return 0; return 0;
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n"); CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
@ -983,9 +983,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors)); I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
// allocate table for back to front drawing of subsectors // allocate table for back to front drawing of subsectors
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors); /*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
if (!gr_drawsubsectors) if (!gl_drawsubsectors)
I_Error("couldn't malloc gr_drawsubsectors\n");*/ I_Error("couldn't malloc gl_drawsubsectors\n");*/
// number of the first new subsector that might be added // number of the first new subsector that might be added
addsubsector = numsubsectors; addsubsector = numsubsectors;

View file

@ -27,27 +27,18 @@
#include "../r_patch.h" #include "../r_patch.h"
#include "../p_setup.h" #include "../p_setup.h"
INT32 patchformat = GR_TEXFMT_AP_88; // use alpha for holes INT32 patchformat = GL_TEXFMT_AP_88; // use alpha for holes
INT32 textureformat = GR_TEXFMT_P_8; // use chromakey for hole INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
static const INT32 format2bpp[16] = static INT32 format2bpp(GLTextureFormat_t format)
{ {
0, //0 if (format == GL_TEXFMT_RGBA)
0, //1 return 4;
1, //2 GR_TEXFMT_ALPHA_8 else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
1, //3 GR_TEXFMT_INTENSITY_8 return 2;
1, //4 GR_TEXFMT_ALPHA_INTENSITY_44 else
1, //5 GR_TEXFMT_P_8 return 1;
4, //6 GR_RGBA }
0, //7
0, //8
0, //9
2, //10 GR_TEXFMT_RGB_565
2, //11 GR_TEXFMT_ARGB_1555
2, //12 GR_TEXFMT_ARGB_4444
2, //13 GR_TEXFMT_ALPHA_INTENSITY_88
2, //14 GR_TEXFMT_AP_88
};
// This code was originally placed directly in HWR_DrawPatchInCache. // This code was originally placed directly in HWR_DrawPatchInCache.
// It is now split from it for my sanity! (and the sanity of others) // It is now split from it for my sanity! (and the sanity of others)
@ -292,7 +283,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
fixed_t xfrac, xfracstep; fixed_t xfrac, xfracstep;
fixed_t yfracstep, scale_y; fixed_t yfracstep, scale_y;
const column_t *patchcol; const column_t *patchcol;
UINT8 *block = mipmap->grInfo.data; UINT8 *block = mipmap->data;
INT32 bpp; INT32 bpp;
INT32 blockmodulo; INT32 blockmodulo;
@ -307,7 +298,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
yfracstep = FRACUNIT; yfracstep = FRACUNIT;
scale_y = FRACUNIT; scale_y = FRACUNIT;
bpp = format2bpp[mipmap->grInfo.format]; bpp = format2bpp(mipmap->format);
if (bpp < 1 || bpp > 4) if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp); I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
@ -339,7 +330,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
fixed_t xfrac, xfracstep; fixed_t xfrac, xfracstep;
fixed_t yfracstep, scale_y; fixed_t yfracstep, scale_y;
const column_t *patchcol; const column_t *patchcol;
UINT8 *block = mipmap->grInfo.data; UINT8 *block = mipmap->data;
INT32 bpp; INT32 bpp;
INT32 blockmodulo; INT32 blockmodulo;
INT32 width, height; INT32 width, height;
@ -400,7 +391,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
yfracstep = (texture->height<< FRACBITS) / pblockheight; yfracstep = (texture->height<< FRACBITS) / pblockheight;
scale_y = (pblockheight << FRACBITS) / texture->height; scale_y = (pblockheight << FRACBITS) / texture->height;
bpp = format2bpp[mipmap->grInfo.format]; bpp = format2bpp(mipmap->format);
if (bpp < 1 || bpp > 4) if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp); I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
@ -431,8 +422,8 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX); UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
INT32 blocksize = (grMipmap->width * grMipmap->height); INT32 blocksize = (grMipmap->width * grMipmap->height);
bpp = format2bpp[grMipmap->grInfo.format]; bpp = format2bpp(grMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data)); block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
switch (bpp) switch (bpp)
{ {
@ -453,7 +444,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
// Create a composite texture from patches, adapt the texture size to a power of 2 // Create a composite texture from patches, adapt the texture size to a power of 2
// height and width for the hardware texture cache. // height and width for the hardware texture cache.
// //
static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
{ {
UINT8 *block; UINT8 *block;
texture_t *texture; texture_t *texture;
@ -483,7 +474,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
grtex->mipmap.width = (UINT16)texture->width; grtex->mipmap.width = (UINT16)texture->width;
grtex->mipmap.height = (UINT16)texture->height; grtex->mipmap.height = (UINT16)texture->height;
grtex->mipmap.grInfo.format = textureformat; grtex->mipmap.format = textureformat;
blockwidth = texture->width; blockwidth = texture->width;
blockheight = texture->height; blockheight = texture->height;
@ -537,7 +528,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
Z_Unlock(realpatch); Z_Unlock(realpatch);
} }
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :( //Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp[grtex->mipmap.grInfo.format]==4) if (format2bpp(grtex->mipmap.format)==4)
{ {
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
{ {
@ -581,15 +572,15 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
// no wrap around, no chroma key // no wrap around, no chroma key
grMipmap->flags = 0; grMipmap->flags = 0;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = patchformat; grMipmap->format = patchformat;
//grPatch->max_s = grPatch->max_t = 1.0f; //grPatch->max_s = grPatch->max_t = 1.0f;
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width; grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height; grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
} }
Z_Free(grMipmap->grInfo.data); Z_Free(grMipmap->data);
grMipmap->grInfo.data = NULL; grMipmap->data = NULL;
if (makebitmap) if (makebitmap)
{ {
@ -607,14 +598,14 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
// CACHING HANDLING // CACHING HANDLING
// ================================================= // =================================================
static size_t gr_numtextures = 0; // Texture count static size_t gl_numtextures = 0; // Texture count
static GLTexture_t *gr_textures; // For all textures static GLMapTexture_t *gl_textures; // For all textures
static GLTexture_t *gr_flats; // For all (texture) flats, as normal flats don't need to be cached static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached
void HWR_InitTextureCache(void) void HWR_InitTextureCache(void)
{ {
gr_textures = NULL; gl_textures = NULL;
gr_flats = NULL; gl_flats = NULL;
} }
// Callback function for HWR_FreeTextureCache. // Callback function for HWR_FreeTextureCache.
@ -648,9 +639,9 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
pat->mipmap->nextcolormap = next->nextcolormap; pat->mipmap->nextcolormap = next->nextcolormap;
// Free image data from memory. // Free image data from memory.
if (next->grInfo.data) if (next->data)
Z_Free(next->grInfo.data); Z_Free(next->data);
next->grInfo.data = NULL; next->data = NULL;
// Free the old colormap mipmap from memory. // Free the old colormap mipmap from memory.
free(next); free(next);
@ -682,13 +673,13 @@ void HWR_FreeTextureCache(void)
// now the heap don't have any 'user' pointing to our // now the heap don't have any 'user' pointing to our
// texturecache info, we can free it // texturecache info, we can free it
if (gr_textures) if (gl_textures)
free(gr_textures); free(gl_textures);
if (gr_flats) if (gl_flats)
free(gr_flats); free(gl_flats);
gr_textures = NULL; gl_textures = NULL;
gr_flats = NULL; gl_flats = NULL;
gr_numtextures = 0; gl_numtextures = 0;
} }
void HWR_LoadTextures(size_t pnumtextures) void HWR_LoadTextures(size_t pnumtextures)
@ -697,13 +688,13 @@ void HWR_LoadTextures(size_t pnumtextures)
HWR_FreeTextureCache(); HWR_FreeTextureCache();
// Why not Z_Malloc? // Why not Z_Malloc?
gr_numtextures = pnumtextures; gl_numtextures = pnumtextures;
gr_textures = calloc(gr_numtextures, sizeof(*gr_textures)); gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
gr_flats = calloc(gr_numtextures, sizeof(*gr_flats)); gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
// Doesn't tell you which it _is_, but hopefully // Doesn't tell you which it _is_, but hopefully
// should never ever happen (right?!) // should never ever happen (right?!)
if ((gr_textures == NULL) || (gr_flats == NULL)) if ((gl_textures == NULL) || (gl_flats == NULL))
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!"); I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
} }
@ -713,7 +704,7 @@ void HWR_SetPalette(RGBA_t *palette)
// hardware driver will flush there own cache if cache is non paletized // hardware driver will flush there own cache if cache is non paletized
// now flush data texture cache so 32 bit texture are recomputed // now flush data texture cache so 32 bit texture are recomputed
if (patchformat == GR_RGBA || textureformat == GR_RGBA) if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
{ {
Z_FreeTag(PU_HWRCACHE); Z_FreeTag(PU_HWRCACHE);
Z_FreeTag(PU_HWRCACHE_UNLOCKED); Z_FreeTag(PU_HWRCACHE_UNLOCKED);
@ -723,20 +714,20 @@ void HWR_SetPalette(RGBA_t *palette)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Make sure texture is downloaded and set it as the source // Make sure texture is downloaded and set it as the source
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
GLTexture_t *HWR_GetTexture(INT32 tex) GLMapTexture_t *HWR_GetTexture(INT32 tex)
{ {
GLTexture_t *grtex; GLMapTexture_t *grtex;
#ifdef PARANOIA #ifdef PARANOIA
if ((unsigned)tex >= gr_numtextures) if ((unsigned)tex >= gl_numtextures)
I_Error("HWR_GetTexture: tex >= numtextures\n"); I_Error("HWR_GetTexture: tex >= numtextures\n");
#endif #endif
// Every texture in memory, stored in the // Every texture in memory, stored in the
// hardware renderer's bit depth format. Wow! // hardware renderer's bit depth format. Wow!
grtex = &gr_textures[tex]; grtex = &gl_textures[tex];
// Generate texture if missing from the cache // Generate texture if missing from the cache
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded) if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_GenerateTexture(tex, grtex); HWR_GenerateTexture(tex, grtex);
// If hardware does not have the texture, then call pfnSetTexture to upload it // If hardware does not have the texture, then call pfnSetTexture to upload it
@ -746,7 +737,7 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
HWR_SetCurrentTexture(&grtex->mipmap); HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
return grtex; return grtex;
} }
@ -756,7 +747,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
size_t size, pflatsize; size_t size, pflatsize;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_P_8; grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
size = W_LumpLength(flatlumpnum); size = W_LumpLength(flatlumpnum);
@ -791,7 +782,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
// the flat raw data needn't be converted with palettized textures // the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum), W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
PU_HWRCACHE, &grMipmap->grInfo.data)); PU_HWRCACHE, &grMipmap->data));
} }
static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum) static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
@ -799,13 +790,13 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
UINT8 *flat; UINT8 *flat;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_P_8; grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->width = (UINT16)textures[texturenum]->width; grMipmap->width = (UINT16)textures[texturenum]->width;
grMipmap->height = (UINT16)textures[texturenum]->height; grMipmap->height = (UINT16)textures[texturenum]->height;
flat = Z_Malloc(grMipmap->width * grMipmap->height, PU_HWRCACHE, &grMipmap->grInfo.data); flat = Z_Malloc(grMipmap->width * grMipmap->height, PU_HWRCACHE, &grMipmap->data);
memset(flat, TRANSPARENTPIXEL, grMipmap->width * grMipmap->height); memset(flat, TRANSPARENTPIXEL, grMipmap->width * grMipmap->height);
R_TextureToFlat(texturenum, flat); R_TextureToFlat(texturenum, flat);
@ -819,7 +810,7 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
return; return;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap; grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->data)
HWR_CacheFlat(grmip, flatlumpnum); HWR_CacheFlat(grmip, flatlumpnum);
// If hardware does not have the texture, then call pfnSetTexture to upload it // If hardware does not have the texture, then call pfnSetTexture to upload it
@ -829,7 +820,7 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
HWR_SetCurrentTexture(grmip); HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
} }
void HWR_GetLevelFlat(levelflat_t *levelflat) void HWR_GetLevelFlat(levelflat_t *levelflat)
@ -842,10 +833,10 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum); HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum);
else if (levelflat->type == LEVELFLAT_TEXTURE) else if (levelflat->type == LEVELFLAT_TEXTURE)
{ {
GLTexture_t *grtex; GLMapTexture_t *grtex;
INT32 texturenum = levelflat->u.texture.num; INT32 texturenum = levelflat->u.texture.num;
#ifdef PARANOIA #ifdef PARANOIA
if ((unsigned)texturenum >= gr_numtextures) if ((unsigned)texturenum >= gl_numtextures)
I_Error("HWR_GetLevelFlat: texturenum >= numtextures\n"); I_Error("HWR_GetLevelFlat: texturenum >= numtextures\n");
#endif #endif
@ -854,10 +845,10 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
return; return;
// Every texture in memory, stored as a 8-bit flat. Wow! // Every texture in memory, stored as a 8-bit flat. Wow!
grtex = &gr_flats[texturenum]; grtex = &gl_flats[texturenum];
// Generate flat if missing from the cache // Generate flat if missing from the cache
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded) if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum); HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
// If hardware does not have the texture, then call pfnSetTexture to upload it // If hardware does not have the texture, then call pfnSetTexture to upload it
@ -867,7 +858,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
HWR_SetCurrentTexture(&grtex->mipmap); HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
} }
else // set no texture else // set no texture
HWR_SetCurrentTexture(NULL); HWR_SetCurrentTexture(NULL);
@ -879,7 +870,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
// //
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch) static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
{ {
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->data)
{ {
patch_t *patch = gpatch->rawpatch; patch_t *patch = gpatch->rawpatch;
if (!patch) if (!patch)
@ -899,7 +890,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
HWR_SetCurrentTexture(grmip); HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
} }
// -----------------+ // -----------------+
@ -908,7 +899,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
void HWR_GetPatch(GLPatch_t *gpatch) void HWR_GetPatch(GLPatch_t *gpatch)
{ {
// is it in hardware cache // is it in hardware cache
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data) if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
{ {
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will // load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
// flush the software patch before the conversion! oh yeah I suffered // flush the software patch before the conversion! oh yeah I suffered
@ -930,7 +921,7 @@ void HWR_GetPatch(GLPatch_t *gpatch)
HWR_SetCurrentTexture(gpatch->mipmap); HWR_SetCurrentTexture(gpatch->mipmap);
// The system-memory patch data can be purged now. // The system-memory patch data can be purged now.
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
} }
@ -980,17 +971,17 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
if (!gpatch) if (!gpatch)
return; return;
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED); Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
} }
static const INT32 picmode2GR[] = static const INT32 picmode2GR[] =
{ {
GR_TEXFMT_P_8, // PALETTE GL_TEXFMT_P_8, // PALETTE
0, // INTENSITY (unsupported yet) 0, // INTENSITY (unsupported yet)
GR_TEXFMT_ALPHA_INTENSITY_88, // INTENSITY_ALPHA (corona use this) GL_TEXFMT_ALPHA_INTENSITY_88, // INTENSITY_ALPHA (corona use this)
0, // RGB24 (unsupported yet) 0, // RGB24 (unsupported yet)
GR_RGBA, // RGBA32 (opengl only) GL_TEXFMT_RGBA, // RGBA32 (opengl only)
}; };
static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight, static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight,
@ -1005,7 +996,7 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight; stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight;
stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth; stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth;
picbpp = format2bpp[picmode2GR[pic->mode]]; picbpp = format2bpp(picmode2GR[pic->mode]);
posy = 0; posy = 0;
for (j = 0; j < pblockheight; j++) for (j = 0; j < pblockheight; j++)
{ {
@ -1065,7 +1056,7 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum) GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
{ {
GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum); GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum);
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{ {
pic_t *pic; pic_t *pic;
UINT8 *block; UINT8 *block;
@ -1083,27 +1074,27 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
grpatch->mipmap->height = (UINT16)grpatch->height; grpatch->mipmap->height = (UINT16)grpatch->height;
if (pic->mode == PALETTE) if (pic->mode == PALETTE)
grpatch->mipmap->grInfo.format = textureformat; // can be set by driver grpatch->mipmap->format = textureformat; // can be set by driver
else else
grpatch->mipmap->grInfo.format = picmode2GR[pic->mode]; grpatch->mipmap->format = picmode2GR[pic->mode];
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
// allocate block // allocate block
block = MakeBlock(grpatch->mipmap); block = MakeBlock(grpatch->mipmap);
if (grpatch->width == SHORT(pic->width) && if (grpatch->width == SHORT(pic->width) &&
grpatch->height == SHORT(pic->height) && grpatch->height == SHORT(pic->height) &&
format2bpp[grpatch->mipmap->grInfo.format] == format2bpp[picmode2GR[pic->mode]]) format2bpp(grpatch->mipmap->format) == format2bpp(picmode2GR[pic->mode]))
{ {
// no conversion needed // no conversion needed
M_Memcpy(grpatch->mipmap->grInfo.data, pic->data,len); M_Memcpy(grpatch->mipmap->data, pic->data,len);
} }
else else
HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height), HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height),
SHORT(pic->width)*format2bpp[grpatch->mipmap->grInfo.format], SHORT(pic->width)*format2bpp(grpatch->mipmap->format),
pic, pic,
format2bpp[grpatch->mipmap->grInfo.format]); format2bpp(grpatch->mipmap->format));
Z_Unlock(pic); Z_Unlock(pic);
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
@ -1112,7 +1103,7 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
grpatch->max_s = grpatch->max_t = 1.0f; grpatch->max_s = grpatch->max_t = 1.0f;
} }
HWD.pfnSetTexture(grpatch->mipmap); HWD.pfnSetTexture(grpatch->mipmap);
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded); //CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.data, grpatch->mipmap.downloaded);
return grpatch; return grpatch;
} }
@ -1145,7 +1136,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
{ {
INT32 i,j; INT32 i,j;
fixed_t posx, posy, stepx, stepy; fixed_t posx, posy, stepx, stepy;
UINT8 *block = mipmap->grInfo.data; // places the data directly into here UINT8 *block = mipmap->data; // places the data directly into here
UINT8 *flat; UINT8 *flat;
UINT8 *dest, *src, texel; UINT8 *dest, *src, texel;
RGBA_t col; RGBA_t col;
@ -1184,7 +1175,7 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
UINT16 fmheight = 0, fmwidth = 0; UINT16 fmheight = 0, fmwidth = 0;
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
grMipmap->flags = 0; grMipmap->flags = 0;
size = W_LumpLength(fademasklumpnum); size = W_LumpLength(fademasklumpnum);
@ -1228,13 +1219,13 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
void HWR_GetFadeMask(lumpnum_t fademasklumpnum) void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{ {
GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap; GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->data)
HWR_CacheFadeMask(grmip, fademasklumpnum); HWR_CacheFadeMask(grmip, fademasklumpnum);
HWD.pfnSetTexture(grmip); HWD.pfnSetTexture(grmip);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
} }
#endif //HWRENDER #endif //HWRENDER

View file

@ -20,8 +20,6 @@
#endif #endif
#include "../doomdef.h" #include "../doomdef.h"
//THIS MUST DISAPPEAR!!!
#include "hw_glide.h"
#include "../screen.h" #include "../screen.h"
@ -29,12 +27,27 @@
// TEXTURE INFO // TEXTURE INFO
// ========================================================================== // ==========================================================================
// grInfo.data holds the address of the graphics data cached in heap memory typedef enum GLTextureFormat_e
{
GL_TEXFMT_P_8 = 0x01, /* 8-bit palette */
GL_TEXFMT_AP_88 = 0x02, /* 8-bit alpha, 8-bit palette */
GL_TEXFMT_RGBA = 0x10, /* 32 bit RGBA! */
GL_TEXFMT_ALPHA_8 = 0x20, /* (0..0xFF) alpha */
GL_TEXFMT_INTENSITY_8 = 0x21, /* (0..0xFF) intensity */
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. // NULL if the texture is not in Doom heap cache.
struct GLMipmap_s struct GLMipmap_s
{ {
GrTexInfo grInfo; //for TexDownloadMipMap //for TexDownloadMipMap
FxU32 flags; GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 height; UINT16 height;
UINT16 width; UINT16 width;
UINT32 downloaded; // the dll driver have it in there cache ? UINT32 downloaded; // the dll driver have it in there cache ?
@ -51,13 +64,13 @@ typedef struct GLMipmap_s GLMipmap_t;
// //
// Doom texture info, as cached for hardware rendering // Doom texture info, as cached for hardware rendering
// //
struct GLTexture_s struct GLMapTexture_s
{ {
GLMipmap_t mipmap; GLMipmap_t mipmap;
float scaleX; //used for scaling textures on walls float scaleX; //used for scaling textures on walls
float scaleY; float scaleY;
}; };
typedef struct GLTexture_s GLTexture_t; typedef struct GLMapTexture_s GLMapTexture_t;
// a cached patch as converted to hardware format, holding the original patch_t // a cached patch as converted to hardware format, holding the original patch_t

View file

@ -936,17 +936,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy; INT32 basewindowx, basewindowy;
GLPatch_t *patch; GLPatch_t *patch;
// if (gr_viewwidth == vid.width) // if (gl_viewwidth == vid.width)
// return; // return;
if (!clearlines) if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution // calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7; baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy)); baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy)); top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwindowx), vid.fdupx)); side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwindowx), vid.fdupx));
// top // top
HWR_DrawFlatFill(0, 0, HWR_DrawFlatFill(0, 0,

View file

@ -1,41 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_glide.h
/// \brief Declaration needed by Glide renderer
/// !!! To be replaced by our own def in the future !!!
#ifndef _GLIDE_H_
#define _GLIDE_H_
#ifndef __GLIDE_H__
typedef unsigned long FxU32;
typedef long FxI32;
typedef FxI32 GrTextureFormat_t;
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */
#define GR_TEXFMT_RGB_565 0xa
#define GR_TEXFMT_ARGB_1555 0xb
#define GR_TEXFMT_ARGB_4444 0xc
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */
#define GR_RGBA 0x6 // 32 bit RGBA !
typedef struct
{
GrTextureFormat_t format;
void *data;
} GrTexInfo;
#endif // __GLIDE_H__ (defined in <glide.h>)
#endif // _GLIDE_H_

View file

@ -59,7 +59,7 @@ typedef struct
// needed for sprite rendering // needed for sprite rendering
// equivalent of the software renderer's vissprites // equivalent of the software renderer's vissprites
typedef struct gr_vissprite_s typedef struct gl_vissprite_s
{ {
float x1, x2; float x1, x2;
float tz, ty; float tz, ty;
@ -75,7 +75,7 @@ typedef struct gr_vissprite_s
UINT8 *colormap; UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
float z1, z2; float z1, z2;
} gr_vissprite_t; } gl_vissprite_t;
// -------- // --------
// hw_bsp.c // hw_bsp.c
@ -96,7 +96,7 @@ void HWR_FreeExtraSubsectors(void);
void HWR_GetLevelFlat(levelflat_t *levelflat); void HWR_GetLevelFlat(levelflat_t *levelflat);
void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum); void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum);
GLTexture_t *HWR_GetTexture(INT32 tex); GLMapTexture_t *HWR_GetTexture(INT32 tex);
void HWR_GetPatch(GLPatch_t *gpatch); void HWR_GetPatch(GLPatch_t *gpatch);
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap); void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch); void HWR_UnlockCachedPatch(GLPatch_t *gpatch);

View file

@ -821,7 +821,7 @@ void HWR_WallLighting(FOutVector *wlVerts)
{ {
int i, j; int i, j;
// dynlights->nb == 0 if cv_grdynamiclighting.value is not set // dynlights->nb == 0 if cv_gldynamiclighting.value is not set
for (j = 0; j < dynlights->nb; j++) for (j = 0; j < dynlights->nb; j++)
{ {
FVector inter; FVector inter;
@ -970,7 +970,7 @@ static lumpnum_t coronalumpnum = LUMPERROR;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// coronas lighting // coronas lighting
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr)
{ {
light_t *p_lspr; light_t *p_lspr;
@ -985,7 +985,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
p_lspr = &lspr[ROCKETEXP_L]; p_lspr = &lspr[ROCKETEXP_L];
} }
if (cv_grcoronas.value && (p_lspr->type & CORONA_SPR)) if (cv_glcoronas.value && (p_lspr->type & CORONA_SPR))
{ // it's an object which emits light { // it's an object which emits light
FOutVector light[4]; FOutVector light[4];
FSurfaceInfo Surf; FSurfaceInfo Surf;
@ -1010,7 +1010,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
} }
if (size > p_lspr->corona_radius) if (size > p_lspr->corona_radius)
size = p_lspr->corona_radius; size = p_lspr->corona_radius;
size *= FIXED_TO_FLOAT(cv_grcoronasize.value<<1); size *= FIXED_TO_FLOAT(cv_glcoronasize.value<<1);
// compute position doing average // compute position doing average
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -1067,7 +1067,7 @@ void HWR_DrawCoronas(void)
{ {
int j; int j;
if (!cv_grcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR) if (!cv_glcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR)
return; return;
HWR_GetPic(coronalumpnum); /// \todo use different coronas HWR_GetPic(coronalumpnum); /// \todo use different coronas
@ -1121,7 +1121,7 @@ void HWR_DrawCoronas(void)
} }
if (size > p_lspr->corona_radius) if (size > p_lspr->corona_radius)
size = p_lspr->corona_radius; size = p_lspr->corona_radius;
size = (float)(FIXED_TO_FLOAT(cv_grcoronasize.value<<1)*size); size = (float)(FIXED_TO_FLOAT(cv_glcoronasize.value<<1)*size);
// put light little forward the sprite so there is no // put light little forward the sprite so there is no
// z-buffer problem (coplanar polygons) // z-buffer problem (coplanar polygons)
@ -1170,13 +1170,13 @@ void HWR_SetLights(int viewnumber)
// Add a light for dynamic lighting // Add a light for dynamic lighting
// The light position is already transformed execpt for mlook // The light position is already transformed execpt for mlook
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) void HWR_DL_AddLight(gl_vissprite_t *spr, GLPatch_t *patch)
{ {
light_t *p_lspr; light_t *p_lspr;
//Hurdler: moved here because it's better;-) //Hurdler: moved here because it's better;-)
(void)patch; (void)patch;
if (!cv_grdynamiclighting.value) if (!cv_gldynamiclighting.value)
return; return;
if (!spr->mobj) if (!spr->mobj)
@ -1193,7 +1193,7 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch)
p_lspr = t_lspr[spr->mobj->sprite]; p_lspr = t_lspr[spr->mobj->sprite];
if (!(p_lspr->type & DYNLIGHT_SPR)) if (!(p_lspr->type & DYNLIGHT_SPR))
return; return;
if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) if ((p_lspr->type != LIGHT_SPR) || cv_glstaticlighting.value)
return; return;
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x);
@ -1229,10 +1229,10 @@ static void HWR_SetLight(void)
{ {
int i, j; int i, j;
if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->grInfo.data) if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->data)
{ {
UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->grInfo.data); UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->data);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
@ -1245,7 +1245,7 @@ static void HWR_SetLight(void)
Data[i*128+j] = 0; Data[i*128+j] = 0;
} }
} }
lightmappatch.mipmap->grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88; lightmappatch.mipmap->format = GL_TEXFMT_ALPHA_INTENSITY_88;
lightmappatch.width = 128; lightmappatch.width = 128;
lightmappatch.height = 128; lightmappatch.height = 128;
@ -1256,7 +1256,7 @@ static void HWR_SetLight(void)
HWD.pfnSetTexture(lightmappatch.mipmap); HWD.pfnSetTexture(lightmappatch.mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(lightmappatch.mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(lightmappatch.mipmap->data, PU_HWRCACHE_UNLOCKED);
} }
//********************************************************** //**********************************************************
@ -1265,8 +1265,8 @@ static void HWR_SetLight(void)
#ifdef STATICLIGHT #ifdef STATICLIGHT
// is this really necessary? // is this really necessary?
static sector_t *lgr_backsector; static sector_t *lgl_backsector;
static seg_t *lgr_curline; static seg_t *lgl_curline;
#endif #endif
// p1 et p2 c'est le deux bou du seg en float // p1 et p2 c'est le deux bou du seg en float
@ -1304,27 +1304,27 @@ static void HWR_AddLightMapForLine(int lightnum, seg_t *line)
*/ */
FVector p1,p2; FVector p1,p2;
lgr_curline = line; lgl_curline = line;
lgr_backsector = line->backsector; lgl_backsector = line->backsector;
// Reject empty lines used for triggers and special events. // Reject empty lines used for triggers and special events.
// Identical floor and ceiling on both sides, // Identical floor and ceiling on both sides,
// identical light levels on both sides, // identical light levels on both sides,
// and no middle texture. // and no middle texture.
/* /*
if ( lgr_backsector->ceilingpic == gr_frontsector->ceilingpic if ( lgl_backsector->ceilingpic == gl_frontsector->ceilingpic
&& lgr_backsector->floorpic == gr_frontsector->floorpic && lgl_backsector->floorpic == gl_frontsector->floorpic
&& lgr_backsector->lightlevel == gr_frontsector->lightlevel && lgl_backsector->lightlevel == gl_frontsector->lightlevel
&& lgr_curline->sidedef->midtexture == 0) && lgl_curline->sidedef->midtexture == 0)
{ {
return; return;
} }
*/ */
p1.y = FIXED_TO_FLOAT(lgr_curline->v1->y); p1.y = FIXED_TO_FLOAT(lgl_curline->v1->y);
p1.x = FIXED_TO_FLOAT(lgr_curline->v1->x); p1.x = FIXED_TO_FLOAT(lgl_curline->v1->x);
p2.y = FIXED_TO_FLOAT(lgr_curline->v2->y); p2.y = FIXED_TO_FLOAT(lgl_curline->v2->y);
p2.x = FIXED_TO_FLOAT(lgr_curline->v2->x); p2.x = FIXED_TO_FLOAT(lgl_curline->v2->x);
// check bbox of the seg // check bbox of the seg
// if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false) // if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false)

View file

@ -24,7 +24,7 @@
#define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored) #define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored)
void HWR_InitLight(void); void HWR_InitLight(void);
void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch); void HWR_DL_AddLight(gl_vissprite_t *spr, GLPatch_t *patch);
void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts); void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts);
void HWR_WallLighting(FOutVector *wlVerts); void HWR_WallLighting(FOutVector *wlVerts);
void HWR_ResetLights(void); void HWR_ResetLights(void);
@ -33,7 +33,7 @@ void HWR_SetLights(int viewnumber);
#ifdef NEWCORONAS #ifdef NEWCORONAS
void HWR_DrawCoronas(void); void HWR_DrawCoronas(void);
#else #else
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr); void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr);
#endif #endif
typedef struct typedef struct

File diff suppressed because it is too large Load diff

View file

@ -74,31 +74,31 @@ boolean HWR_LoadShaders(void);
extern CV_PossibleValue_t granisotropicmode_cons_t[]; extern CV_PossibleValue_t granisotropicmode_cons_t[];
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
extern consvar_t cv_grdynamiclighting; extern consvar_t cv_gldynamiclighting;
extern consvar_t cv_grstaticlighting; extern consvar_t cv_glstaticlighting;
extern consvar_t cv_grcoronas; extern consvar_t cv_glcoronas;
extern consvar_t cv_grcoronasize; extern consvar_t cv_glcoronasize;
#endif #endif
extern consvar_t cv_grshaders; extern consvar_t cv_glshaders;
extern consvar_t cv_grmodels; extern consvar_t cv_glmodels;
extern consvar_t cv_grmodelinterpolation; extern consvar_t cv_glmodelinterpolation;
extern consvar_t cv_grmodellighting; extern consvar_t cv_glmodellighting;
extern consvar_t cv_grfiltermode; extern consvar_t cv_glfiltermode;
extern consvar_t cv_granisotropicmode; extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_fovchange; extern consvar_t cv_fovchange;
extern consvar_t cv_grsolvetjoin; extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_grshearing; extern consvar_t cv_glshearing;
extern consvar_t cv_grspritebillboarding; extern consvar_t cv_glspritebillboarding;
extern consvar_t cv_grskydome; extern consvar_t cv_glskydome;
extern consvar_t cv_grfakecontrast; extern consvar_t cv_glfakecontrast;
extern consvar_t cv_grslopecontrast; extern consvar_t cv_glslopecontrast;
extern consvar_t cv_grbatching; extern consvar_t cv_glbatching;
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy; extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowy;
extern float gr_viewwindowx, gr_basewindowcentery; extern float gl_viewwindowx, gl_basewindowcentery;
// BP: big hack for a test in lighting ref : 1249753487AB // BP: big hack for a test in lighting ref : 1249753487AB
extern fixed_t *hwbbox; extern fixed_t *hwbbox;
@ -122,6 +122,6 @@ extern int rs_hw_numcolors;
extern int rs_hw_batchsorttime; extern int rs_hw_batchsorttime;
extern int rs_hw_batchdrawtime; extern int rs_hw_batchdrawtime;
extern boolean gr_shadersavailable; extern boolean gl_shadersavailable;
#endif #endif

View file

@ -141,7 +141,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext); CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
} }
static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch) static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
{ {
png_structp png_ptr; png_structp png_ptr;
png_infop png_info_ptr; png_infop png_info_ptr;
@ -191,7 +191,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename); //CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL); png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE); fclose(png_FILE);
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
return 0; return 0;
} }
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
@ -232,7 +232,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{ {
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr); png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data); png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep)); png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch; row_pointers[i] = PNG_image + i*pitch;
@ -245,7 +245,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
fclose(png_FILE); fclose(png_FILE);
*w = (int)width; *w = (int)width;
*h = (int)height; *h = (int)height;
return GR_RGBA; return GL_TEXFMT_RGBA;
} }
#endif #endif
@ -271,7 +271,7 @@ typedef struct
UINT8 filler[54]; UINT8 filler[54];
} PcxHeader; } PcxHeader;
static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h, static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
GLPatch_t *grpatch) GLPatch_t *grpatch)
{ {
PcxHeader header; PcxHeader header;
@ -306,7 +306,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1; pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1; ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->grInfo.data); image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE) if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{ {
@ -340,7 +340,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
} }
} }
fclose(file); fclose(file);
return GR_RGBA; return GL_TEXFMT_RGBA;
} }
// -----------------+ // -----------------+
@ -354,7 +354,7 @@ static void md2_loadTexture(md2_t *model)
if (model->grpatch) if (model->grpatch)
{ {
grpatch = model->grpatch; grpatch = model->grpatch;
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
} }
else else
{ {
@ -363,18 +363,18 @@ static void md2_loadTexture(md2_t *model)
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL); grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
} }
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
UINT32 size; UINT32 size;
RGBA_t *image; RGBA_t *image;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
#endif #endif
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
{ {
model->notexturefile = true; // mark it so its not searched for again repeatedly model->notexturefile = true; // mark it so its not searched for again repeatedly
return; return;
@ -389,7 +389,7 @@ static void md2_loadTexture(md2_t *model)
grpatch->mipmap->height = (UINT16)h; grpatch->mipmap->height = (UINT16)h;
// Lactozilla: Apply colour cube // Lactozilla: Apply colour cube
image = grpatch->mipmap->grInfo.data; image = grpatch->mipmap->data;
size = w*h; size = w*h;
while (size--) while (size--)
{ {
@ -414,7 +414,7 @@ static void md2_loadBlendTexture(md2_t *model)
if (model->blendgrpatch) if (model->blendgrpatch)
{ {
grpatch = model->blendgrpatch; grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap->grInfo.data); Z_Free(grpatch->mipmap->data);
} }
else else
{ {
@ -423,15 +423,15 @@ static void md2_loadBlendTexture(md2_t *model)
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL); grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
} }
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
#endif #endif
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch); grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0) if (grpatch->mipmap->format == 0)
{ {
model->noblendfile = true; // mark it so its not searched for again repeatedly model->noblendfile = true; // mark it so its not searched for again repeatedly
Z_Free(filename); Z_Free(filename);
@ -686,20 +686,20 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
// no wrap around, no chroma key // no wrap around, no chroma key
grmip->flags = 0; grmip->flags = 0;
// setup the texture info // setup the texture info
grmip->grInfo.format = GR_RGBA; grmip->format = GL_TEXFMT_RGBA;
} }
if (grmip->grInfo.data) if (grmip->data)
{ {
Z_Free(grmip->grInfo.data); Z_Free(grmip->data);
grmip->grInfo.data = NULL; grmip->data = NULL;
} }
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->grInfo.data); cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->data);
memset(cur, 0x00, size*4); memset(cur, 0x00, size*4);
image = gpatch->mipmap->grInfo.data; image = gpatch->mipmap->data;
blendimage = blendgpatch->mipmap->grInfo.data; blendimage = blendgpatch->mipmap->data;
// TC_METALSONIC includes an actual skincolor translation, on top of its flashing. // TC_METALSONIC includes an actual skincolor translation, on top of its flashing.
if (skinnum == TC_METALSONIC) if (skinnum == TC_METALSONIC)
@ -1050,7 +1050,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
return; return;
} }
if ((blendgpatch && blendgpatch->mipmap->grInfo.format) if ((blendgpatch && blendgpatch->mipmap->format)
&& (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height)) && (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height))
{ {
// Blend image exists, but it's bad. // Blend image exists, but it's bad.
@ -1065,10 +1065,10 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
grmip = grmip->nextcolormap; grmip = grmip->nextcolormap;
if (grmip->colormap == colormap) if (grmip->colormap == colormap)
{ {
if (grmip->downloaded && grmip->grInfo.data) if (grmip->downloaded && grmip->data)
{ {
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE_UNLOCKED); Z_ChangeTag(grmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
return; return;
} }
} }
@ -1090,7 +1090,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color); HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
HWD.pfnSetTexture(newmip); HWD.pfnSetTexture(newmip);
Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE_UNLOCKED); Z_ChangeTag(newmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
} }
#define NORMALFOG 0x00000000 #define NORMALFOG 0x00000000
@ -1108,14 +1108,14 @@ static boolean HWR_AllowModel(mobj_t *mobj)
static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model) static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model)
{ {
if (cv_grmodelinterpolation.value == 2) // Always interpolate if (cv_glmodelinterpolation.value == 2) // Always interpolate
return true; return true;
return model->interpolate[(mobj->frame & FF_FRAMEMASK)]; return model->interpolate[(mobj->frame & FF_FRAMEMASK)];
} }
static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame) static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame)
{ {
if (cv_grmodelinterpolation.value == 2) // Always interpolate if (cv_glmodelinterpolation.value == 2) // Always interpolate
return true; return true;
return spr2frame->interpolate; return spr2frame->interpolate;
} }
@ -1209,7 +1209,7 @@ static void adjustTextureCoords(model_t *model, GLPatch_t *gpatch)
// HWR_DrawModel // HWR_DrawModel
// //
boolean HWR_DrawModel(gr_vissprite_t *spr) boolean HWR_DrawModel(gl_vissprite_t *spr)
{ {
md2_t *md2; md2_t *md2;
@ -1220,7 +1220,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
FTransform p; FTransform p;
FSurfaceInfo Surf; FSurfaceInfo Surf;
if (!cv_grmodels.value) if (!cv_glmodels.value)
return false; return false;
if (spr->precip) if (spr->precip)
@ -1309,13 +1309,13 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
// texture loading before model init, so it knows if sprite graphics are used, which // texture loading before model init, so it knows if sprite graphics are used, which
// means that texture coordinates have to be adjusted // means that texture coordinates have to be adjusted
gpatch = md2->grpatch; gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !md2->notexturefile)) if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2); md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture... gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch && (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded) || ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !md2->noblendfile))) && !md2->noblendfile)))
md2_loadBlendTexture(md2); md2_loadBlendTexture(md2);
@ -1332,7 +1332,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
md2_printModelInfo(md2->model); md2_printModelInfo(md2->model);
// if model uses sprite patch as texture, then // if model uses sprite patch as texture, then
// adjust texture coordinates to take power of two textures into account // adjust texture coordinates to take power of two textures into account
if (!gpatch || !gpatch->mipmap->grInfo.format) if (!gpatch || !gpatch->mipmap->format)
adjustTextureCoords(md2->model, spr->gpatch); adjustTextureCoords(md2->model, spr->gpatch);
HWD.pfnCreateModelVBOs(md2->model); HWD.pfnCreateModelVBOs(md2->model);
} }
@ -1352,7 +1352,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
finalscale = md2->scale; finalscale = md2->scale;
//Hurdler: arf, I don't like that implementation at all... too much crappy //Hurdler: arf, I don't like that implementation at all... too much crappy
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{ {
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
@ -1423,7 +1423,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
#ifdef USE_MODEL_NEXTFRAME #ifdef USE_MODEL_NEXTFRAME
#define INTERPOLERATION_LIMIT TICRATE/4 #define INTERPOLERATION_LIMIT TICRATE/4
if (cv_grmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT) if (cv_glmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT)
{ {
if (durs > INTERPOLERATION_LIMIT) if (durs > INTERPOLERATION_LIMIT)
durs = INTERPOLERATION_LIMIT; durs = INTERPOLERATION_LIMIT;

View file

@ -42,7 +42,7 @@ extern md2_t md2_playermodels[MAXSKINS];
void HWR_InitModels(void); void HWR_InitModels(void);
void HWR_AddPlayerModel(INT32 skin); void HWR_AddPlayerModel(INT32 skin);
void HWR_AddSpriteModel(size_t spritenum); void HWR_AddSpriteModel(size_t spritenum);
boolean HWR_DrawModel(gr_vissprite_t *spr); boolean HWR_DrawModel(gl_vissprite_t *spr);
#define PLAYERMODELPREFIX "PLAYER" #define PLAYERMODELPREFIX "PLAYER"

View file

@ -58,8 +58,8 @@ static GLuint tex_downloaded = 0;
static GLfloat fov = 90.0f; static GLfloat fov = 90.0f;
static FBITFIELD CurrentPolyFlags; static FBITFIELD CurrentPolyFlags;
static FTextureInfo *gr_cachetail = NULL; static FTextureInfo *gl_cachetail = NULL;
static FTextureInfo *gr_cachehead = NULL; static FTextureInfo *gl_cachehead = NULL;
RGBA_t myPaletteData[256]; RGBA_t myPaletteData[256];
GLint screen_width = 0; // used by Draw2DLine() GLint screen_width = 0; // used by Draw2DLine()
@ -1200,7 +1200,7 @@ void SetModelView(GLint w, GLint h)
pglLoadIdentity(); pglLoadIdentity();
GLPerspective(fov, ASPECT_RATIO); GLPerspective(fov, ASPECT_RATIO);
//pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT) //pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gl_scalefrustum (ORIGINAL_ASPECT)
// added for new coronas' code (without depth buffer) // added for new coronas' code (without depth buffer)
pglGetIntegerv(GL_VIEWPORT, viewport); pglGetIntegerv(GL_VIEWPORT, viewport);
@ -1277,14 +1277,14 @@ void Flush(void)
{ {
//GL_DBG_Printf ("HWR_Flush()\n"); //GL_DBG_Printf ("HWR_Flush()\n");
while (gr_cachehead) while (gl_cachehead)
{ {
if (gr_cachehead->downloaded) if (gl_cachehead->downloaded)
pglDeleteTextures(1, (GLuint *)&gr_cachehead->downloaded); pglDeleteTextures(1, (GLuint *)&gl_cachehead->downloaded);
gr_cachehead->downloaded = 0; gl_cachehead->downloaded = 0;
gr_cachehead = gr_cachehead->nextmipmap; gl_cachehead = gl_cachehead->nextmipmap;
} }
gr_cachetail = gr_cachehead = NULL; //Hurdler: well, gr_cachehead is already NULL gl_cachetail = gl_cachehead = NULL; //Hurdler: well, gl_cachehead is already NULL
tex_downloaded = 0; tex_downloaded = 0;
} }
@ -1657,15 +1657,15 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
else else
texnum = pTexInfo->downloaded; texnum = pTexInfo->downloaded;
//GL_DBG_Printf ("DownloadMipmap %d %x\n",(INT32)texnum,pTexInfo->grInfo.data); //GL_DBG_Printf ("DownloadMipmap %d %x\n",(INT32)texnum,pTexInfo->data);
w = pTexInfo->width; w = pTexInfo->width;
h = pTexInfo->height; h = pTexInfo->height;
if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) || if ((pTexInfo->format == GL_TEXFMT_P_8) ||
(pTexInfo->grInfo.format == GR_TEXFMT_AP_88)) (pTexInfo->format == GL_TEXFMT_AP_88))
{ {
const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
INT32 i, j; INT32 i, j;
for (j = 0; j < h; j++) for (j = 0; j < h; j++)
@ -1691,7 +1691,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
pImgData++; pImgData++;
if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88) if (pTexInfo->format == GL_TEXFMT_AP_88)
{ {
if (!(pTexInfo->flags & TF_CHROMAKEYED)) if (!(pTexInfo->flags & TF_CHROMAKEYED))
tex[w*j+i].s.alpha = *pImgData; tex[w*j+i].s.alpha = *pImgData;
@ -1701,15 +1701,15 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
} }
} }
} }
else if (pTexInfo->grInfo.format == GR_RGBA) else if (pTexInfo->format == GL_TEXFMT_RGBA)
{ {
// corona test : passed as ARGB 8888, which is not in glide formats // corona test : passed as ARGB 8888, which is not in glide formats
// Hurdler: not used for coronas anymore, just for dynamic lighting // Hurdler: not used for coronas anymore, just for dynamic lighting
ptex = pTexInfo->grInfo.data; ptex = pTexInfo->data;
} }
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88) else if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88)
{ {
const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
INT32 i, j; INT32 i, j;
for (j = 0; j < h; j++) for (j = 0; j < h; j++)
@ -1725,9 +1725,9 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
} }
} }
} }
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) // Used for fade masks else if (pTexInfo->format == GL_TEXFMT_ALPHA_8) // Used for fade masks
{ {
const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
INT32 i, j; INT32 i, j;
for (j = 0; j < h; j++) for (j = 0; j < h; j++)
@ -1743,7 +1743,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
} }
} }
else else
GL_MSG_Warning ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format); GL_MSG_Warning ("SetTexture(bad format) %ld\n", pTexInfo->format);
// the texture number was already generated by pglGenTextures // the texture number was already generated by pglGenTextures
pglBindTexture(GL_TEXTURE_2D, texnum); pglBindTexture(GL_TEXTURE_2D, texnum);
@ -1761,7 +1761,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
} }
if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88) if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88)
{ {
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); //pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap) if (MipMap)
@ -1782,7 +1782,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
} }
} }
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) else if (pTexInfo->format == GL_TEXFMT_ALPHA_8)
{ {
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); //pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap) if (MipMap)
@ -1860,13 +1860,13 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
{ {
UpdateTexture(pTexInfo); UpdateTexture(pTexInfo);
pTexInfo->nextmipmap = NULL; pTexInfo->nextmipmap = NULL;
if (gr_cachetail) if (gl_cachetail)
{ // insertion at the tail { // insertion at the tail
gr_cachetail->nextmipmap = pTexInfo; gl_cachetail->nextmipmap = pTexInfo;
gr_cachetail = pTexInfo; gl_cachetail = pTexInfo;
} }
else // initialization of the linked list else // initialization of the linked list
gr_cachetail = gr_cachehead = pTexInfo; gl_cachetail = gl_cachehead = pTexInfo;
} }
} }
@ -2961,7 +2961,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
EXPORT INT32 HWRAPI(GetTextureUsed) (void) EXPORT INT32 HWRAPI(GetTextureUsed) (void)
{ {
FTextureInfo *tmp = gr_cachehead; FTextureInfo *tmp = gl_cachehead;
INT32 res = 0; INT32 res = 0;
while (tmp) while (tmp)
@ -2970,14 +2970,10 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
// I don't know which one the game actually _uses_ but this // I don't know which one the game actually _uses_ but this
// follows format2bpp in hw_cache.c // follows format2bpp in hw_cache.c
int bpp = 1; int bpp = 1;
int format = tmp->grInfo.format; int format = tmp->format;
if (format == GR_RGBA) if (format == GL_TEXFMT_RGBA)
bpp = 4; bpp = 4;
else if (format == GR_TEXFMT_RGB_565 else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
|| format == GR_TEXFMT_ARGB_1555
|| format == GR_TEXFMT_ARGB_4444
|| format == GR_TEXFMT_ALPHA_INTENSITY_88
|| format == GR_TEXFMT_AP_88)
bpp = 2; bpp = 2;
// Add it up! // Add it up!

View file

@ -1880,7 +1880,7 @@ static inline void HU_DrawCrosshair(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y = (INT32)gr_basewindowcentery; y = (INT32)gl_basewindowcentery;
else else
#endif #endif
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
@ -1901,7 +1901,7 @@ static inline void HU_DrawCrosshair2(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y = (INT32)gr_basewindowcentery; y = (INT32)gl_basewindowcentery;
else else
#endif #endif
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
@ -1910,7 +1910,7 @@ static inline void HU_DrawCrosshair2(void)
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y += (INT32)gr_viewheight; y += (INT32)gl_viewheight;
else else
#endif #endif
y += viewheight; y += viewheight;

View file

@ -1446,19 +1446,19 @@ static menuitem_t OP_ColorOptionsMenu[] =
static menuitem_t OP_OpenGLOptionsMenu[] = static menuitem_t OP_OpenGLOptionsMenu[] =
{ {
{IT_HEADER, NULL, "3D Models", NULL, 0}, {IT_HEADER, NULL, "3D Models", NULL, 0},
{IT_STRING|IT_CVAR, NULL, "Models", &cv_grmodels, 12}, {IT_STRING|IT_CVAR, NULL, "Models", &cv_glmodels, 12},
{IT_STRING|IT_CVAR, NULL, "Frame interpolation", &cv_grmodelinterpolation, 22}, {IT_STRING|IT_CVAR, NULL, "Frame interpolation", &cv_glmodelinterpolation, 22},
{IT_STRING|IT_CVAR, NULL, "Ambient lighting", &cv_grmodellighting, 32}, {IT_STRING|IT_CVAR, NULL, "Ambient lighting", &cv_glmodellighting, 32},
{IT_HEADER, NULL, "General", NULL, 51}, {IT_HEADER, NULL, "General", NULL, 51},
{IT_STRING|IT_CVAR, NULL, "Shaders", &cv_grshaders, 63}, {IT_STRING|IT_CVAR, NULL, "Shaders", &cv_glshaders, 63},
{IT_STRING|IT_CVAR, NULL, "Lack of perspective", &cv_grshearing, 73}, {IT_STRING|IT_CVAR, NULL, "Lack of perspective", &cv_glshearing, 73},
{IT_STRING|IT_CVAR, NULL, "Field of view", &cv_fov, 83}, {IT_STRING|IT_CVAR, NULL, "Field of view", &cv_fov, 83},
{IT_HEADER, NULL, "Miscellaneous", NULL, 102}, {IT_HEADER, NULL, "Miscellaneous", NULL, 102},
{IT_STRING|IT_CVAR, NULL, "Bit depth", &cv_scr_depth, 114}, {IT_STRING|IT_CVAR, NULL, "Bit depth", &cv_scr_depth, 114},
{IT_STRING|IT_CVAR, NULL, "Texture filter", &cv_grfiltermode, 124}, {IT_STRING|IT_CVAR, NULL, "Texture filter", &cv_glfiltermode, 124},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 134}, {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_glanisotropicmode, 134},
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 144}, {IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 144},
#endif #endif
@ -1470,10 +1470,10 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
static menuitem_t OP_OpenGLLightingMenu[] = static menuitem_t OP_OpenGLLightingMenu[] =
{ {
{IT_STRING|IT_CVAR, NULL, "Coronas", &cv_grcoronas, 0}, {IT_STRING|IT_CVAR, NULL, "Coronas", &cv_glcoronas, 0},
{IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_grcoronasize, 10}, {IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_glcoronasize, 10},
{IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_grdynamiclighting, 20}, {IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_gldynamiclighting, 20},
{IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_grstaticlighting, 30}, {IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_glstaticlighting, 30},
}; };
#endif // ALAM_LIGHTING #endif // ALAM_LIGHTING

View file

@ -10046,7 +10046,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (camorbit) //Sev here, I'm guessing this is where orbital cam lives if (camorbit) //Sev here, I'm guessing this is where orbital cam lives
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl && !cv_grshearing.value) if (rendermode == render_opengl && !cv_glshearing.value)
distxy = FixedMul(dist, FINECOSINE((focusaiming>>ANGLETOFINESHIFT) & FINEMASK)); distxy = FixedMul(dist, FINECOSINE((focusaiming>>ANGLETOFINESHIFT) & FINEMASK));
else else
#endif #endif

View file

@ -1064,7 +1064,7 @@ static void R_SetupFreelook(void)
// (lmps, network and use F12...) // (lmps, network and use F12...)
if (rendermode == render_soft if (rendermode == render_soft
#ifdef HWRENDER #ifdef HWRENDER
|| cv_grshearing.value || cv_glshearing.value
#endif #endif
) )
{ {

View file

@ -1426,10 +1426,10 @@ void R_FreeSingleRotSprite(spritedef_t *spritedef)
} }
if (grPatch->mipmap) if (grPatch->mipmap)
{ {
if (grPatch->mipmap->grInfo.data) if (grPatch->mipmap->data)
{ {
Z_Free(grPatch->mipmap->grInfo.data); Z_Free(grPatch->mipmap->data);
grPatch->mipmap->grInfo.data = NULL; grPatch->mipmap->data = NULL;
} }
Z_Free(grPatch->mipmap); Z_Free(grPatch->mipmap);
grPatch->mipmap = NULL; grPatch->mipmap = NULL;

View file

@ -226,7 +226,6 @@
<ClInclude Include="..\hardware\hw_defs.h" /> <ClInclude Include="..\hardware\hw_defs.h" />
<ClInclude Include="..\hardware\hw_dll.h" /> <ClInclude Include="..\hardware\hw_dll.h" />
<ClInclude Include="..\hardware\hw_drv.h" /> <ClInclude Include="..\hardware\hw_drv.h" />
<ClInclude Include="..\hardware\hw_glide.h" />
<ClInclude Include="..\hardware\hw_glob.h" /> <ClInclude Include="..\hardware\hw_glob.h" />
<ClInclude Include="..\hardware\hw_light.h" /> <ClInclude Include="..\hardware\hw_light.h" />
<ClInclude Include="..\hardware\hw_main.h" /> <ClInclude Include="..\hardware\hw_main.h" />

View file

@ -237,9 +237,6 @@
<ClInclude Include="..\hardware\hw_drv.h"> <ClInclude Include="..\hardware\hw_drv.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\hardware\hw_glide.h">
<Filter>Hw_Hardware</Filter>
</ClInclude>
<ClInclude Include="..\hardware\hw_glob.h"> <ClInclude Include="..\hardware\hw_glob.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>

View file

@ -2410,10 +2410,6 @@
RelativePath="..\hardware\hw_drv.h" RelativePath="..\hardware\hw_drv.h"
> >
</File> </File>
<File
RelativePath="..\hardware\hw_glide.h"
>
</File>
<File <File
RelativePath="..\hardware\hw_glob.h" RelativePath="..\hardware\hw_glob.h"
> >

View file

@ -576,10 +576,6 @@ SOURCE=..\hardware\hw_drv.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\hardware\hw_glide.h
# End Source File
# Begin Source File
SOURCE=..\hardware\hw_glob.h SOURCE=..\hardware\hw_glob.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View file

@ -1064,13 +1064,6 @@
path = ../../hardware/hw_drv.h; path = ../../hardware/hw_drv.h;
refType = 2; refType = 2;
}; };
8417773B085A106C000C01D8 = {
fileEncoding = 30;
isa = PBXFileReference;
name = hw_glide.h;
path = ../../hardware/hw_glide.h;
refType = 2;
};
8417773C085A106C000C01D8 = { 8417773C085A106C000C01D8 = {
fileEncoding = 30; fileEncoding = 30;
isa = PBXFileReference; isa = PBXFileReference;

View file

@ -180,7 +180,6 @@
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; }; 1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; }; 1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; }; 1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
1E44AE670B67CC2B00BAD059 /* hw_glide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glide.h; path = ../../hardware/hw_glide.h; sourceTree = SOURCE_ROOT; };
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; }; 1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; }; 1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; }; 1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
@ -533,7 +532,6 @@
1E44AE640B67CC2B00BAD059 /* hw_cache.c */, 1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
1E44AE650B67CC2B00BAD059 /* hw_dll.h */, 1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
1E44AE660B67CC2B00BAD059 /* hw_drv.h */, 1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
1E44AE670B67CC2B00BAD059 /* hw_glide.h */,
1E44AE680B67CC2B00BAD059 /* hw_light.c */, 1E44AE680B67CC2B00BAD059 /* hw_light.c */,
1E44AE690B67CC2B00BAD059 /* hw_light.h */, 1E44AE690B67CC2B00BAD059 /* hw_light.h */,
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */, 1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,

View file

@ -1732,11 +1732,11 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
grPatch = HWR_GetCachedGLPatchPwad(wad, lump); grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
if (grPatch->mipmap->grInfo.data) if (grPatch->mipmap->data)
{ {
if (tag == PU_CACHE) if (tag == PU_CACHE)
tag = PU_HWRCACHE; tag = PU_HWRCACHE;
Z_ChangeTag(grPatch->mipmap->grInfo.data, tag); Z_ChangeTag(grPatch->mipmap->data, tag);
} }
else else
{ {

View file

@ -398,7 +398,6 @@
<ClInclude Include="..\hardware\hw_defs.h" /> <ClInclude Include="..\hardware\hw_defs.h" />
<ClInclude Include="..\hardware\hw_dll.h" /> <ClInclude Include="..\hardware\hw_dll.h" />
<ClInclude Include="..\hardware\hw_drv.h" /> <ClInclude Include="..\hardware\hw_drv.h" />
<ClInclude Include="..\hardware\hw_glide.h" />
<ClInclude Include="..\hardware\hw_glob.h" /> <ClInclude Include="..\hardware\hw_glob.h" />
<ClInclude Include="..\hardware\hw_light.h" /> <ClInclude Include="..\hardware\hw_light.h" />
<ClInclude Include="..\hardware\hw_main.h" /> <ClInclude Include="..\hardware\hw_main.h" />

View file

@ -513,9 +513,6 @@
<ClInclude Include="..\hardware\hw_drv.h"> <ClInclude Include="..\hardware\hw_drv.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\hardware\hw_glide.h">
<Filter>Hw_Hardware</Filter>
</ClInclude>
<ClInclude Include="..\hardware\hw_glob.h"> <ClInclude Include="..\hardware\hw_glob.h">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClInclude> </ClInclude>

View file

@ -2151,10 +2151,6 @@
RelativePath="..\hardware\hw_drv.h" RelativePath="..\hardware\hw_drv.h"
> >
</File> </File>
<File
RelativePath="..\hardware\hw_glide.h"
>
</File>
<File <File
RelativePath="..\hardware\hw_glob.h" RelativePath="..\hardware\hw_glob.h"
> >

View file

@ -535,10 +535,6 @@ SOURCE=..\hardware\hw_drv.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\hardware\hw_glide.h
# End Source File
# Begin Source File
SOURCE=..\hardware\hw_glob.h SOURCE=..\hardware\hw_glob.h
# End Source File # End Source File
# Begin Source File # Begin Source File