From 63b71af98eaf4eb802fc828896e8a0e939761b0a Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 8 Sep 2005 11:49:00 +0000 Subject: [PATCH] removed detail texturing (it only worked in q1bsp and hlbsp maps, did not work properly with rtlights, was liked by some people and disliked by many more, and consumed some memory) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5699 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 71 -------------------------------------------------- gl_rsurf.c | 2 -- menu.c | 5 +--- model_alias.c | 14 +++++----- model_brush.c | 14 +++++----- model_shared.c | 15 +++-------- model_shared.h | 8 +++--- render.h | 5 ---- 8 files changed, 21 insertions(+), 113 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 33f58d26..bde443b4 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -119,7 +119,6 @@ rtexture_t *r_texture_black; rtexture_t *r_texture_notexture; rtexture_t *r_texture_whitecube; rtexture_t *r_texture_normalizationcube; -rtexture_t *r_texture_detailtextures[NUM_DETAILTEXTURES]; void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b) { @@ -219,55 +218,6 @@ void FOG_registercvars(void) } } -static void R_BuildDetailTextures (void) -{ - int i, x, y, light; - float vc[3], vx[3], vy[3], vn[3], lightdir[3]; -#define DETAILRESOLUTION 256 - qbyte (*data)[DETAILRESOLUTION][4]; - qbyte (*noise)[DETAILRESOLUTION]; - - // Allocate the buffers dynamically to avoid having such big guys on the stack - data = Mem_Alloc(tempmempool, DETAILRESOLUTION * sizeof(*data)); - noise = Mem_Alloc(tempmempool, DETAILRESOLUTION * sizeof(*noise)); - - lightdir[0] = 0.5; - lightdir[1] = 1; - lightdir[2] = -0.25; - VectorNormalize(lightdir); - for (i = 0;i < NUM_DETAILTEXTURES;i++) - { - fractalnoise(&noise[0][0], DETAILRESOLUTION, DETAILRESOLUTION >> 4); - for (y = 0;y < DETAILRESOLUTION;y++) - { - for (x = 0;x < DETAILRESOLUTION;x++) - { - vc[0] = x; - vc[1] = y; - vc[2] = noise[y][x] * (1.0f / 32.0f); - vx[0] = x + 1; - vx[1] = y; - vx[2] = noise[y][(x + 1) % DETAILRESOLUTION] * (1.0f / 32.0f); - vy[0] = x; - vy[1] = y + 1; - vy[2] = noise[(y + 1) % DETAILRESOLUTION][x] * (1.0f / 32.0f); - VectorSubtract(vx, vc, vx); - VectorSubtract(vy, vc, vy); - CrossProduct(vx, vy, vn); - VectorNormalize(vn); - light = 128 - DotProduct(vn, lightdir) * 128; - light = bound(0, light, 255); - data[y][x][0] = data[y][x][1] = data[y][x][2] = light; - data[y][x][3] = 255; - } - } - r_texture_detailtextures[i] = R_LoadTexture2D(r_main_texturepool, va("detailtexture%i", i), DETAILRESOLUTION, DETAILRESOLUTION, &data[0][0][0], TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_PRECACHE, NULL); - } - - Mem_Free(noise); - Mem_Free(data); -} - static void R_BuildBlankTextures(void) { qbyte data[4]; @@ -394,7 +344,6 @@ void gl_main_start(void) r_bloom_texture_bloom = NULL; R_BuildBlankTextures(); R_BuildNoTexture(); - R_BuildDetailTextures(); if (gl_texturecubemap) { R_BuildWhiteCube(); @@ -1673,7 +1622,6 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text const msurface_t *surface; qboolean dolightmap; qboolean doambient; - qboolean dodetail; qboolean doglow; qboolean dofogpass; qboolean fogallpasses; @@ -1771,7 +1719,6 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text // normal surface (wall or water) dolightmap = !(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT); doambient = r_ambient.value >= (1/64.0f); - dodetail = r_detailtextures.integer && texture->skin.detail != NULL && !(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT); doglow = texture->skin.glow != NULL; dofogpass = fogenabled && !(texture->currentmaterialflags & MATERIALFLAG_ADD); fogallpasses = fogenabled && !(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT); @@ -2078,24 +2025,6 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text GL_LockArrays(0, 0); } } - if (dodetail) - { - GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR); - GL_DepthMask(false); - GL_Color(1, 1, 1, 1); - memset(&m, 0, sizeof(m)); - m.tex[0] = R_GetTexture(texture->skin.detail); - R_Mesh_State(&m); - for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++) - { - surface = texturesurfacelist[texturesurfaceindex]; - RSurf_SetVertexPointer(ent, texture, surface, modelorg); - R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoorddetail2f); - GL_LockArrays(surface->num_firstvertex, surface->num_vertices); - R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle)); - GL_LockArrays(0, 0); - } - } if (doglow) { // if glow was not already done using multitexture, do it now. diff --git a/gl_rsurf.c b/gl_rsurf.c index 0da793bd..ab54df99 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t r_ambient = {0, "r_ambient", "0"}; cvar_t r_drawportals = {0, "r_drawportals", "0"}; cvar_t r_testvis = {0, "r_testvis", "0"}; -cvar_t r_detailtextures = {CVAR_SAVE, "r_detailtextures", "1"}; cvar_t r_surfaceworldnode = {0, "r_surfaceworldnode", "0"}; cvar_t r_drawcollisionbrushes_polygonfactor = {0, "r_drawcollisionbrushes_polygonfactor", "-1"}; cvar_t r_drawcollisionbrushes_polygonoffset = {0, "r_drawcollisionbrushes_polygonoffset", "0"}; @@ -866,7 +865,6 @@ void GL_Surf_Init(void) Cvar_RegisterVariable(&r_ambient); Cvar_RegisterVariable(&r_drawportals); Cvar_RegisterVariable(&r_testvis); - Cvar_RegisterVariable(&r_detailtextures); Cvar_RegisterVariable(&r_surfaceworldnode); Cvar_RegisterVariable(&r_drawcollisionbrushes_polygonfactor); Cvar_RegisterVariable(&r_drawcollisionbrushes_polygonoffset); diff --git a/menu.c b/menu.c index 10596838..09025546 100644 --- a/menu.c +++ b/menu.c @@ -1761,7 +1761,7 @@ void M_Options_Key (int k, char ascii) } } -#define OPTIONS_EFFECTS_ITEMS 36 +#define OPTIONS_EFFECTS_ITEMS 35 int options_effects_cursor; @@ -1773,7 +1773,6 @@ void M_Menu_Options_Effects_f (void) } -extern cvar_t r_detailtextures; extern cvar_t cl_stainmaps; extern cvar_t cl_stainmaps_clearonload; extern cvar_t r_explosionclip; @@ -1807,7 +1806,6 @@ void M_Menu_Options_Effects_AdjustSliders (int dir) else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps_clearonload, !cl_stainmaps_clearonload.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_decals, !cl_decals.integer); - else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer); @@ -1861,7 +1859,6 @@ void M_Options_Effects_Draw (void) M_Options_PrintCheckbox(" Stainmaps", true, cl_stainmaps.integer); M_Options_PrintCheckbox("Onload Clear Stainmaps", true, cl_stainmaps_clearonload.integer); M_Options_PrintCheckbox(" Decals", true, cl_decals.integer); - M_Options_PrintCheckbox(" Detail Texturing", true, r_detailtextures.integer); M_Options_PrintCheckbox(" Bullet Impacts", true, cl_particles_bulletimpacts.integer); M_Options_PrintCheckbox(" Smoke", true, cl_particles_smoke.integer); M_Options_PrintCheckbox(" Sparks", true, cl_particles_sparks.integer); diff --git a/model_alias.c b/model_alias.c index 8215251c..e0f3efac 100644 --- a/model_alias.c +++ b/model_alias.c @@ -399,13 +399,13 @@ static void Mod_BuildAliasSkinsFromSkinFiles(texture_t *skin, skinfile_t *skinfi if (!strcmp(skinfileitem->name, meshname) && strcmp(skinfileitem->replacement, "common/nodraw") && strcmp(skinfileitem->replacement, "textures/common/nodraw")) { memset(&tempskinframe, 0, sizeof(tempskinframe)); - if (Mod_LoadSkinFrame(&tempskinframe, skinfileitem->replacement, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, false, true)) + if (Mod_LoadSkinFrame(&tempskinframe, skinfileitem->replacement, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true)) Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe); else { if (cls.state != ca_dedicated) Con_Printf("mesh \"%s\": failed to load skin #%i \"%s\", falling back to mesh's internal shader name \"%s\"\n", meshname, i, skinfileitem->replacement, shadername); - if (Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, false, true)) + if (Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true)) Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe); else { @@ -421,7 +421,7 @@ static void Mod_BuildAliasSkinsFromSkinFiles(texture_t *skin, skinfile_t *skinfi else { memset(&tempskinframe, 0, sizeof(tempskinframe)); - if (Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, false, true)) + if (Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true)) Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe); else { @@ -699,8 +699,8 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) sprintf (name, "%s_%i_%i", loadmodel->name, i, j); else sprintf (name, "%s_%i", loadmodel->name, i); - if (!Mod_LoadSkinFrame(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, false, true)) - Mod_LoadSkinFrame_Internal(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, false, r_fullbrights.integer, (qbyte *)datapointer, skinwidth, skinheight); + if (!Mod_LoadSkinFrame(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, true)) + Mod_LoadSkinFrame_Internal(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, r_fullbrights.integer, (qbyte *)datapointer, skinwidth, skinheight); Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + totalskins * loadmodel->num_surfaces, &tempskinframe); datapointer += skinwidth * skinheight; totalskins++; @@ -708,7 +708,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) } // check for skins that don't exist in the model, but do exist as external images // (this was added because yummyluv kept pestering me about support for it) - while (Mod_LoadSkinFrame(&tempskinframe, va("%s_%i", loadmodel->name, loadmodel->numskins), (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, false, true)) + while (Mod_LoadSkinFrame(&tempskinframe, va("%s_%i", loadmodel->name, loadmodel->numskins), (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, true)) { // expand the arrays to make room tempskinscenes = loadmodel->skinscenes; @@ -857,7 +857,7 @@ void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t)); for (i = 0;i < loadmodel->numskins;i++, inskin += MD2_SKINNAME) { - if (Mod_LoadSkinFrame(&tempskinframe, inskin, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, false, true)) + if (Mod_LoadSkinFrame(&tempskinframe, inskin, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true)) Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + i * loadmodel->num_surfaces, &tempskinframe); else { diff --git a/model_brush.c b/model_brush.c index 6e46b5fe..18dc01fe 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1141,7 +1141,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) } else { - if (!Mod_LoadSkinFrame(&tx->skin, tx->name, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, false, tx->name[0] != '*', true)) + if (!Mod_LoadSkinFrame(&tx->skin, tx->name, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, false, true)) { // did not find external texture, load it from the bsp or wad3 if (loadmodel->brush.ishlbsp) @@ -1176,7 +1176,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) Mem_Free(freepixels); } else if (mtdata) // texture included - Mod_LoadSkinFrame_Internal(&tx->skin, tx->name, TEXF_MIPMAP | TEXF_PRECACHE | TEXF_PICMIP, false, tx->name[0] != '*', tx->name[0] != '*' && r_fullbrights.integer, mtdata, tx->width, tx->height); + Mod_LoadSkinFrame_Internal(&tx->skin, tx->name, TEXF_MIPMAP | TEXF_PRECACHE | TEXF_PICMIP, false, tx->name[0] != '*' && r_fullbrights.integer, mtdata, tx->width, tx->height); } } if (tx->skin.base == NULL) @@ -1845,7 +1845,7 @@ static void Mod_Q1BSP_LoadFaces(lump_t *l) // vertex limit loadmodel->nummeshes = 1; loadmodel->meshlist = Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *)); - loadmodel->meshlist[0] = Mod_AllocSurfMesh(loadmodel->mempool, totalverts, totaltris, true, true, false, false); + loadmodel->meshlist[0] = Mod_AllocSurfMesh(loadmodel->mempool, totalverts, totaltris, true, false, false); totalverts = 0; totaltris = 0; @@ -1894,8 +1894,6 @@ static void Mod_Q1BSP_LoadFaces(lump_t *l) t = DotProduct(((surface->groupmesh->data_vertex3f + 3 * surface->num_firstvertex) + i * 3), surface->lightmapinfo->texinfo->vecs[1]) + surface->lightmapinfo->texinfo->vecs[1][3]; (surface->groupmesh->data_texcoordtexture2f + 2 * surface->num_firstvertex)[i * 2 + 0] = s / surface->texture->width; (surface->groupmesh->data_texcoordtexture2f + 2 * surface->num_firstvertex)[i * 2 + 1] = t / surface->texture->height; - (surface->groupmesh->data_texcoorddetail2f + 2 * surface->num_firstvertex)[i * 2 + 0] = s * (1.0f / 16.0f); - (surface->groupmesh->data_texcoorddetail2f + 2 * surface->num_firstvertex)[i * 2 + 1] = t * (1.0f / 16.0f); (surface->groupmesh->data_texcoordlightmap2f + 2 * surface->num_firstvertex)[i * 2 + 0] = 0; (surface->groupmesh->data_texcoordlightmap2f + 2 * surface->num_firstvertex)[i * 2 + 1] = 0; (surface->groupmesh->data_lightmapoffsets + surface->num_firstvertex)[i] = 0; @@ -3984,8 +3982,8 @@ parseerror: //if (R_TextureHasAlpha(out->skin.base)) // out->surfaceparms |= Q3SURFACEPARM_TRANS; } - if (!Mod_LoadSkinFrame(&out->skin, out->name, (((out->textureflags & Q3TEXTUREFLAG_NOMIPMAPS) || (out->surfaceparms & Q3SURFACEPARM_NOMIPMAPS)) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | (out->textureflags & Q3TEXTUREFLAG_NOPICMIP ? 0 : TEXF_PICMIP), false, false, true)) - if (!Mod_LoadSkinFrame(&out->skin, out->firstpasstexturename, (((out->textureflags & Q3TEXTUREFLAG_NOMIPMAPS) || (out->surfaceparms & Q3SURFACEPARM_NOMIPMAPS)) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | (out->textureflags & Q3TEXTUREFLAG_NOPICMIP ? 0 : TEXF_PICMIP), false, false, true)) + if (!Mod_LoadSkinFrame(&out->skin, out->name, (((out->textureflags & Q3TEXTUREFLAG_NOMIPMAPS) || (out->surfaceparms & Q3SURFACEPARM_NOMIPMAPS)) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | (out->textureflags & Q3TEXTUREFLAG_NOPICMIP ? 0 : TEXF_PICMIP), false, true)) + if (!Mod_LoadSkinFrame(&out->skin, out->firstpasstexturename, (((out->textureflags & Q3TEXTUREFLAG_NOMIPMAPS) || (out->surfaceparms & Q3SURFACEPARM_NOMIPMAPS)) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | (out->textureflags & Q3TEXTUREFLAG_NOPICMIP ? 0 : TEXF_PICMIP), false, true)) if (cls.state != ca_dedicated) Con_Printf("%s: texture loading for shader \"%s\" failed (first layer \"%s\" not found either)\n", loadmodel->name, out->name, out->firstpasstexturename); // no animation @@ -4358,7 +4356,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) i = oldi; in = oldin; out = oldout; - mesh = tempmeshlist[meshnum] = Mod_AllocSurfMesh(loadmodel->mempool, meshvertices, meshtriangles, false, false, true, false); + mesh = tempmeshlist[meshnum] = Mod_AllocSurfMesh(loadmodel->mempool, meshvertices, meshtriangles, false, true, false); meshvertices = 0; meshtriangles = 0; for (;i < count && meshvertices + out->num_vertices <= mesh->num_vertices;i++, in++, out++) diff --git a/model_shared.c b/model_shared.c index 29dcad64..40967880 100644 --- a/model_shared.c +++ b/model_shared.c @@ -632,11 +632,11 @@ void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int num VectorNormalize(v); } -surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean detailtexcoords, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors) +surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors) { surfmesh_t *mesh; qbyte *data; - mesh = Mem_Alloc(mempool, sizeof(surfmesh_t) + numvertices * (3 + 3 + 3 + 3 + 2 + 2 + (detailtexcoords ? 2 : 0) + (vertexcolors ? 4 : 0)) * sizeof(float) + numvertices * (lightmapoffsets ? 1 : 0) * sizeof(int) + numtriangles * (3 + 3 + (neighbors ? 3 : 0)) * sizeof(int)); + mesh = Mem_Alloc(mempool, sizeof(surfmesh_t) + numvertices * (3 + 3 + 3 + 3 + 2 + 2 + (vertexcolors ? 4 : 0)) * sizeof(float) + numvertices * (lightmapoffsets ? 1 : 0) * sizeof(int) + numtriangles * (3 + 3 + (neighbors ? 3 : 0)) * sizeof(int)); mesh->num_vertices = numvertices; mesh->num_triangles = numtriangles; data = (qbyte *)(mesh + 1); @@ -648,8 +648,6 @@ surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriang mesh->data_normal3f = (float *)data, data += sizeof(float[3]) * mesh->num_vertices; mesh->data_texcoordtexture2f = (float *)data, data += sizeof(float[2]) * mesh->num_vertices; mesh->data_texcoordlightmap2f = (float *)data, data += sizeof(float[2]) * mesh->num_vertices; - if (detailtexcoords) - mesh->data_texcoorddetail2f = (float *)data, data += sizeof(float[2]) * mesh->num_vertices; if (vertexcolors) mesh->data_lightmapcolor4f = (float *)data, data += sizeof(float[4]) * mesh->num_vertices; if (lightmapoffsets) @@ -914,15 +912,12 @@ static rtexture_t *GL_TextureForSkinLayer(const qbyte *in, int width, int height return NULL; } -static int detailtexturecycle = 0; -int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture) +int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture) { imageskin_t s; memset(skinframe, 0, sizeof(*skinframe)); if (!image_loadskin(&s, basename)) return false; - if (usedetailtexture) - skinframe->detail = r_texture_detailtextures[(detailtexturecycle++) % NUM_DETAILTEXTURES]; skinframe->base = R_LoadTexture2D (loadmodel->texturepool, basename, s.basepixels_width, s.basepixels_height, s.basepixels, TEXTYPE_RGBA, textureflags, NULL); if (s.nmappixels != NULL) skinframe->nmap = R_LoadTexture2D (loadmodel->texturepool, va("%s_nmap", basename), s.nmappixels_width, s.nmappixels_height, s.nmappixels, TEXTYPE_RGBA, textureflags, NULL); @@ -947,14 +942,12 @@ int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, return true; } -int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height) +int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture, qbyte *skindata, int width, int height) { qbyte *temp1, *temp2; memset(skinframe, 0, sizeof(*skinframe)); if (!skindata) return false; - if (usedetailtexture) - skinframe->detail = r_texture_detailtextures[(detailtexturecycle++) % NUM_DETAILTEXTURES]; if (r_shadow_bumpscale_basetexture.value > 0) { temp1 = Mem_Alloc(loadmodel->mempool, width * height * 8); diff --git a/model_shared.h b/model_shared.h index b2b72fa6..1b450be0 100644 --- a/model_shared.h +++ b/model_shared.h @@ -51,7 +51,6 @@ typedef struct skinframe_s rtexture_t *shirt; // shirt only (in greyscale) rtexture_t *nmap; // normalmap (bumpmap for dot3) rtexture_t *gloss; // glossmap (for dot3) - rtexture_t *detail; // detail texture (silly bumps for non-dot3) rtexture_t *glow; // glow only (fullbrights) rtexture_t *fog; // alpha of the base texture (if not opaque) } @@ -96,7 +95,6 @@ typedef struct surfmesh_s float *data_normal3f; // float[verts*3] direction of 'R' (out) texture axis for each vertex float *data_texcoordtexture2f; // float[verts*2] texcoords for surface texture float *data_texcoordlightmap2f; // float[verts*2] texcoords for lightmap texture - float *data_texcoorddetail2f; // float[verts*2] texcoords for detail texture float *data_lightmapcolor4f; int *data_lightmapoffsets; // index into surface's lightmap samples for vertex lighting // morph blending, these are zero if model is skeletal or static @@ -570,7 +568,7 @@ void Mod_ValidateElements(int *elements, int numtriangles, int numverts, const c void Mod_BuildNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const int *elements, float *normal3f, qboolean areaweighting); void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals, qboolean areaweighting); -surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean detailtexcoords, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors); +surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors); shadowmesh_t *Mod_ShadowMesh_Alloc(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int neighbors, int expandable); shadowmesh_t *Mod_ShadowMesh_ReAlloc(mempool_t *mempool, shadowmesh_t *oldmesh, int light, int neighbors); @@ -582,8 +580,8 @@ shadowmesh_t *Mod_ShadowMesh_Finish(mempool_t *mempool, shadowmesh_t *firstmesh, void Mod_ShadowMesh_CalcBBox(shadowmesh_t *firstmesh, vec3_t mins, vec3_t maxs, vec3_t center, float *radius); void Mod_ShadowMesh_Free(shadowmesh_t *mesh); -int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture); -int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height); +int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture); +int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture, qbyte *skindata, int width, int height); extern cvar_t r_mipskins; diff --git a/render.h b/render.h index 65d9681d..c89b8ff4 100644 --- a/render.h +++ b/render.h @@ -68,9 +68,6 @@ extern cvar_t gl_flashblend; // vis stuff extern cvar_t r_novis; -// detail texture stuff -extern cvar_t r_detailtextures; - extern cvar_t r_lerpsprites; extern cvar_t r_lerpmodels; extern cvar_t r_waterscroll; @@ -207,8 +204,6 @@ extern rtexture_t *r_texture_black; extern rtexture_t *r_texture_notexture; extern rtexture_t *r_texture_whitecube; extern rtexture_t *r_texture_normalizationcube; -#define NUM_DETAILTEXTURES 1 -extern rtexture_t *r_texture_detailtextures[NUM_DETAILTEXTURES]; void R_TimeReport(char *name); void R_TimeReport_Start(void); -- 2.39.2