From 29939c951c16daeb7dc98a99c270ee9d34befab5 Mon Sep 17 00:00:00 2001 From: myT <> Date: Sun, 10 Sep 2023 20:22:46 +0200 Subject: [PATCH] removed unused fog logic and data --- code/renderer/grp_world.cpp | 1 - code/renderer/tr_image.cpp | 62 ----------- code/renderer/tr_init.cpp | 2 - code/renderer/tr_local.h | 46 +------- code/renderer/tr_main.cpp | 12 +-- code/renderer/tr_mesh.cpp | 2 +- code/renderer/tr_scene.cpp | 2 +- code/renderer/tr_shade_calc.cpp | 180 -------------------------------- code/renderer/tr_shader.cpp | 38 +------ code/renderer/tr_world.cpp | 4 +- 10 files changed, 13 insertions(+), 336 deletions(-) diff --git a/code/renderer/grp_world.cpp b/code/renderer/grp_world.cpp index b0a4d3f..ab2642e 100644 --- a/code/renderer/grp_world.cpp +++ b/code/renderer/grp_world.cpp @@ -566,7 +566,6 @@ void World::BeginBatch(const shader_t* shader, bool hasStaticGeo, BatchType::Id { tess.numVertexes = 0; tess.numIndexes = 0; - tess.fogNum = 0; tess.depthFade = DFT_NONE; tess.deformsPreApplied = qfalse; tess.xstages = (const shaderStage_t**)shader->stages; diff --git a/code/renderer/tr_image.cpp b/code/renderer/tr_image.cpp index 1ede426..a47c201 100644 --- a/code/renderer/tr_image.cpp +++ b/code/renderer/tr_image.cpp @@ -792,66 +792,6 @@ image_t* R_FindImageFile( const char* name, int flags, textureWrap_t glWrapClamp } -void R_InitFogTable() -{ - const float exp = 0.5; - - for (int i = 0; i < FOG_TABLE_SIZE; ++i) { - tr.fogTable[i] = pow( (float)i/(FOG_TABLE_SIZE-1), exp ); - } -} - - -/* -Returns a 0.0 to 1.0 fog density value -This is called for each texel of the fog texture on startup -and for each vertex of transparent shaders in fog dynamically -*/ -float R_FogFactor( float s, float t ) -{ - s -= 1.0/512; - if ( s < 0 ) { - return 0; - } - if ( t < 1.0/32 ) { - return 0; - } - if ( t < 31.0/32 ) { - s *= (t - 1.0f/32.0f) / (30.0f/32.0f); - } - - // we need to leave a lot of clamp range - s *= 8; - - if ( s > 1.0 ) { - s = 1.0; - } - - return tr.fogTable[ (int)(s * (FOG_TABLE_SIZE-1)) ]; -} - - -static void R_CreateFogImage() -{ - const int FOG_S = 256; - const int FOG_T = 32; - - RI_AutoPtr ap( FOG_S * FOG_T * 4 ); - byte* p = ap; - - // S is distance, T is depth - for (int x = 0; x < FOG_S; ++x) { - for (int y = 0; y < FOG_T; ++y) { - float d = R_FogFactor( ( x + 0.5f ) / FOG_S, ( y + 0.5f ) / FOG_T ); - p[(y*FOG_S+x)*4+0] = p[(y*FOG_S+x)*4+1] = p[(y*FOG_S+x)*4+2] = 255; - p[(y*FOG_S+x)*4+3] = 255*d; - } - } - - tr.fogImage = R_CreateImage( "*fog", p, FOG_S, FOG_T, TF_RGBA8, IMG_NOPICMIP, TW_CLAMP_TO_EDGE ); -} - - static void R_CreateDefaultImage() { const int DEFAULT_SIZE = 16; @@ -893,8 +833,6 @@ static void R_CreateBuiltinImages() // these are just placeholders: RE_StretchRaw will regenerate them when it wants them for (i = 0; i < ARRAY_LEN(tr.scratchImage); ++i) tr.scratchImage[i] = R_CreateImage( "*scratch", data, 1, 1, TF_RGBA8, IMG_NOMIPMAP | IMG_NOPICMIP, TW_CLAMP_TO_EDGE ); - - R_CreateFogImage(); } diff --git a/code/renderer/tr_init.cpp b/code/renderer/tr_init.cpp index 7368227..73750b5 100644 --- a/code/renderer/tr_init.cpp +++ b/code/renderer/tr_init.cpp @@ -746,8 +746,6 @@ void R_Init() if ((intptr_t)tess.xyz & 15) Com_Printf( "WARNING: tess.xyz not 16 byte aligned\n" ); - R_InitFogTable(); - R_NoiseInit(); R_Register(); diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index ccd5939..291d797 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -195,7 +195,6 @@ typedef enum { CGEN_ONE_MINUS_VERTEX, CGEN_WAVEFORM, // programmatically generated CGEN_LIGHTING_DIFFUSE, - CGEN_FOG, // standard fog CGEN_CONST, // fixed color CGEN_DEBUG_ALPHA // debug only: replicate the alpha channel } colorGen_t; @@ -206,17 +205,9 @@ typedef enum { TCGEN_LIGHTMAP, TCGEN_TEXTURE, TCGEN_ENVIRONMENT_MAPPED, - TCGEN_FOG, TCGEN_VECTOR // S and T from world coordinates } texCoordGen_t; -typedef enum { - ACFF_NONE, - ACFF_MODULATE_RGB, - ACFF_MODULATE_RGBA, - ACFF_MODULATE_ALPHA -} acff_t; - typedef struct { genFunc_t func; @@ -321,8 +312,6 @@ typedef struct { unsigned stateBits; // GLS_xxxx mask - acff_t adjustColorsForFog; - qbool isDetail; stageType_t type; } shaderStage_t; @@ -340,12 +329,6 @@ typedef enum { CT_COUNT } cullType_t; -typedef enum { - FP_NONE, // surface is translucent and will just be adjusted properly - FP_EQUAL, // surface is opaque but possibly alpha tested - FP_LE // surface is trnaslucent, but still needs a fog pass (fog surface) -} fogPass_t; - typedef struct { float cloudHeight; image_t *outerbox[6], *innerbox[6]; // innerbox was never actually used by Q3 @@ -412,12 +395,10 @@ struct shader_t { int numDeforms; deformStage_t deforms[MAX_SHADER_DEFORMS]; - int numStages; // not counting fog pass (if any) + int numStages; shaderStage_t *stages[MAX_SHADER_STAGES]; int lightingStages[ST_MAX]; - fogPass_t fogPass; // draw a blended pass, possibly with depth test equals - double clampTime; // time this shader is clamped to double timeOffset; // current time offset for this shader @@ -879,9 +860,6 @@ typedef struct { } backEndState_t; -#define FOG_TABLE_SIZE 256 - - enum renderMode_t { RM_NONE, RM_UI, @@ -921,7 +899,6 @@ typedef struct { image_t* defaultImage; image_t* whiteImage; // { 255, 255, 255, 255 } image_t* fullBrightImage; // RGB scale based on r_mapBrightness, alpha 255 - image_t* fogImage; image_t* scratchImage[16]; // MAX_VIDEO_HANDLES shader_t* defaultShader; @@ -977,8 +954,6 @@ typedef struct { int numSkins; skin_t* skins[MAX_SKINS]; - float fogTable[FOG_TABLE_SIZE]; - float mipFilter[4]; // only used by the GPU generators qbool worldSurface; // is the currently added draw surface a world surface? @@ -1120,16 +1095,14 @@ extern cvar_t *r_debugInput; void R_NoiseInit(); double R_NoiseGet4f( double x, double y, double z, double t ); -void R_SwapBuffers( int ); - void R_RenderScene( const viewParms_t* parms ); void R_AddMD3Surfaces( trRefEntity_t *e ); void R_AddPolygonSurfaces(); -void R_AddDrawSurf(const surfaceType_t* surface, const shader_t* shader, int fogIndex, int staticGeoChunk = 0, int zppFirstIndex = 0, int zppIndexCount = 0, float radiusOverZ = 666.0f ); -void R_AddLitSurf( const surfaceType_t* surface, const shader_t* shader, int fogIndex, int staticGeoChunk ); +void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int staticGeoChunk = 0, int zppFirstIndex = 0, int zppIndexCount = 0, float radiusOverZ = 666.0f ); +void R_AddLitSurf( const surfaceType_t* surface, const shader_t* shader, int staticGeoChunk ); uint64_t R_ComposeSort( int entityNum, const shader_t* shader, int staticGeoChunk ); void R_DecomposeSort( uint64_t sort, int* entityNum, const shader_t** shader ); uint32_t R_ComposeLitSort( int entityNum, const shader_t* shader, int staticGeoChunk ); @@ -1224,10 +1197,7 @@ void R_SkinList_f( void ); void R_AddImageShader( image_t* image, shader_t* shader ); -void R_InitFogTable(); -float R_FogFactor( float s, float t ); void R_InitImages(); -void R_DeleteTextures(); void R_InitSkins(); const skin_t* R_GetSkinByHandle( qhandle_t hSkin ); @@ -1324,13 +1294,11 @@ struct shaderCommands_t vec2_t texCoords2[SHADER_MAX_VERTEXES]; color4ub_t vertexColors[SHADER_MAX_VERTEXES]; stageVars_t svars[MAX_SHADER_STAGES]; - stageVars_t svarsFog; enum { TP_BASE, TP_LIGHT } pass; const shader_t* shader; double shaderTime; - int fogNum; int numIndexes; int numVertexes; @@ -1345,12 +1313,6 @@ struct shaderCommands_t // when qtrue, RB_EndSurface doesn't need to compute deforms, colors, texture coordinates qbool deformsPreApplied; - // when qtrue, draw a fog pass using fogStateBits and svarsFog - qbool drawFog; - - // use this state vector when drawing the fog pass - unsigned int fogStateBits; - // how to process the colors of the current batch float greyscale; }; @@ -1467,8 +1429,6 @@ void R_TransformClipToWindow( const vec4_t clip, const viewParms_t *view, vec4_t void RB_DeformTessGeometry( int firstVertex, int numVertexes, int firstIndex, int numIndexes ); -void RB_CalcFogTexCoords( float *st, int firstVertex, int numVertexes ); - /* ============================================================= diff --git a/code/renderer/tr_main.cpp b/code/renderer/tr_main.cpp index d1937c1..6d21aae 100644 --- a/code/renderer/tr_main.cpp +++ b/code/renderer/tr_main.cpp @@ -1280,8 +1280,7 @@ static float SurfGreyscaleAmount( const shader_t* shader ) } -// @TODO: remove the fogIndex argument -void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int /*fogIndex*/, int staticGeoChunk, int zppFirstIndex, int zppIndexCount, float radiusOverZ ) +void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int staticGeoChunk, int zppFirstIndex, int zppIndexCount, float radiusOverZ ) { if (tr.refdef.numDrawSurfs >= MAX_DRAWSURFS) return; @@ -1299,8 +1298,7 @@ void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int /* } -// @TODO: remove the fogIndex argument -void R_AddLitSurf( const surfaceType_t* surface, const shader_t* shader, int /*fogIndex*/, int staticGeoChunk ) +void R_AddLitSurf( const surfaceType_t* surface, const shader_t* shader, int staticGeoChunk ) { if (tr.refdef.numLitSurfs >= MAX_DRAWSURFS) return; @@ -1611,7 +1609,7 @@ static void R_AddEntitySurfaces() continue; } shader = R_GetShaderByHandle( ent->e.customShader ); - R_AddDrawSurf( &entitySurface, shader, R_SpriteFogNum( ent ) ); + R_AddDrawSurf( &entitySurface, shader ); break; case RT_MODEL: @@ -1620,7 +1618,7 @@ static void R_AddEntitySurfaces() tr.currentModel = R_GetModelByHandle( ent->e.hModel ); if (!tr.currentModel) { - R_AddDrawSurf( &entitySurface, tr.defaultShader, 0 ); + R_AddDrawSurf( &entitySurface, tr.defaultShader ); } else { switch ( tr.currentModel->type ) { case MOD_MD3: @@ -1635,7 +1633,7 @@ static void R_AddEntitySurfaces() case MOD_BAD: // null model axis if ( (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal) break; - R_AddDrawSurf( &entitySurface, tr.defaultShader, 0 ); + R_AddDrawSurf( &entitySurface, tr.defaultShader ); break; default: ri.Error( ERR_DROP, "R_AddEntitySurfaces: Bad modeltype" ); diff --git a/code/renderer/tr_mesh.cpp b/code/renderer/tr_mesh.cpp index 6b23713..fb2f57c 100644 --- a/code/renderer/tr_mesh.cpp +++ b/code/renderer/tr_mesh.cpp @@ -314,7 +314,7 @@ void R_AddMD3Surfaces( trRefEntity_t* ent ) // don't add third_person objects if not viewing through a portal if ( !personalModel ) { - R_AddDrawSurf( (const surfaceType_t*)surface, shader, fogNum ); + R_AddDrawSurf( (const surfaceType_t*)surface, shader ); } surface = (const md3Surface_t*)( (byte *)surface + surface->ofsEnd ); diff --git a/code/renderer/tr_scene.cpp b/code/renderer/tr_scene.cpp index 7a4a4ac..ef336bf 100644 --- a/code/renderer/tr_scene.cpp +++ b/code/renderer/tr_scene.cpp @@ -83,7 +83,7 @@ void R_AddPolygonSurfaces() const srfPoly_t* poly = tr.refdef.polys; for (int i = 0; i < tr.refdef.numPolys; ++i, ++poly) { - R_AddDrawSurf( (const surfaceType_t*)poly, R_GetShaderByHandle( poly->hShader ), poly->fogIndex ); + R_AddDrawSurf( (const surfaceType_t*)poly, R_GetShaderByHandle( poly->hShader ) ); } } diff --git a/code/renderer/tr_shade_calc.cpp b/code/renderer/tr_shade_calc.cpp index 793c80b..4fc2543 100644 --- a/code/renderer/tr_shade_calc.cpp +++ b/code/renderer/tr_shade_calc.cpp @@ -683,153 +683,6 @@ static void RB_CalcWaveAlpha( const waveForm_t *wf, unsigned char *dstColors, in } -/* -======================== -RB_CalcFogTexCoords - -To do the clipped fog plane really correctly, we should use -projected textures, but I don't trust the drivers and it -doesn't fit our shader data. -======================== -*/ -void RB_CalcFogTexCoords( float *st, int firstVertex, int numVertexes ) { - int i; - float *v; - float s, t; - float eyeT; - qbool eyeOutside; - fog_t *fog; - vec3_t local; - vec4_t fogDistanceVector, fogDepthVector = {0, 0, 0, 0}; - - fog = tr.world->fogs + tess.fogNum; - - // all fogging distance is based on world Z units - VectorSubtract( backEnd.orient.origin, backEnd.viewParms.orient.origin, local ); - fogDistanceVector[0] = -backEnd.orient.modelMatrix[2]; - fogDistanceVector[1] = -backEnd.orient.modelMatrix[6]; - fogDistanceVector[2] = -backEnd.orient.modelMatrix[10]; - fogDistanceVector[3] = DotProduct( local, backEnd.viewParms.orient.axis[0] ); - - // scale the fog vectors based on the fog's thickness - fogDistanceVector[0] *= fog->tcScale; - fogDistanceVector[1] *= fog->tcScale; - fogDistanceVector[2] *= fog->tcScale; - fogDistanceVector[3] *= fog->tcScale; - - // rotate the gradient vector for this orientation - if ( fog->hasSurface ) { - fogDepthVector[0] = fog->surface[0] * backEnd.orient.axis[0][0] + - fog->surface[1] * backEnd.orient.axis[0][1] + fog->surface[2] * backEnd.orient.axis[0][2]; - fogDepthVector[1] = fog->surface[0] * backEnd.orient.axis[1][0] + - fog->surface[1] * backEnd.orient.axis[1][1] + fog->surface[2] * backEnd.orient.axis[1][2]; - fogDepthVector[2] = fog->surface[0] * backEnd.orient.axis[2][0] + - fog->surface[1] * backEnd.orient.axis[2][1] + fog->surface[2] * backEnd.orient.axis[2][2]; - fogDepthVector[3] = -fog->surface[3] + DotProduct( backEnd.orient.origin, fog->surface ); - - eyeT = DotProduct( backEnd.orient.viewOrigin, fogDepthVector ) + fogDepthVector[3]; - } else { - eyeT = 1; // non-surface fog always has eye inside - } - - // see if the viewpoint is outside - // this is needed for clipping distance even for constant fog - - if ( eyeT < 0 ) { - eyeOutside = qtrue; - } else { - eyeOutside = qfalse; - } - - fogDistanceVector[3] += 1.0/512; - - v = tess.xyz[firstVertex]; - st += firstVertex * 2; - - // calculate density for each point - for (i = 0 ; i < numVertexes ; i++, v += 4) { - // calculate the length in fog - s = DotProduct( v, fogDistanceVector ) + fogDistanceVector[3]; - t = DotProduct( v, fogDepthVector ) + fogDepthVector[3]; - - // partially clipped fogs use the T axis - if ( eyeOutside ) { - if ( t < 1.0 ) { - t = 1.0/32; // point is outside, so no fogging - } else { - t = 1.0/32 + 30.0/32 * t / ( t - eyeT ); // cut the distance at the fog plane - } - } else { - if ( t < 0 ) { - t = 1.0/32; // point is outside, so no fogging - } else { - t = 31.0/32; - } - } - - st[0] = s; - st[1] = t; - st += 2; - } -} - - -static void RB_CalcModulateColorsByFog( unsigned char *colors, int firstVertex, int numVertexes ) { - int i; - float texCoords[SHADER_MAX_VERTEXES][2]; - - // calculate texcoords so we can derive density - // this is not wasted, because it would only have - // been previously called if the surface was opaque - RB_CalcFogTexCoords( texCoords[0], firstVertex, numVertexes ); - - colors += firstVertex * 4; - for ( i = firstVertex; i < firstVertex + numVertexes; i++, colors += 4 ) { - float f = 1.0 - R_FogFactor( texCoords[i][0], texCoords[i][1] ); - colors[0] *= f; - colors[1] *= f; - colors[2] *= f; - } -} - - -static void RB_CalcModulateAlphasByFog( unsigned char *colors, int firstVertex, int numVertexes ) { - int i; - float texCoords[SHADER_MAX_VERTEXES][2]; - - // calculate texcoords so we can derive density - // this is not wasted, because it would only have - // been previously called if the surface was opaque - RB_CalcFogTexCoords( texCoords[0], firstVertex, numVertexes ); - - colors += firstVertex * 4; - for ( i = firstVertex; i < firstVertex + numVertexes; i++, colors += 4 ) { - float f = 1.0 - R_FogFactor( texCoords[i][0], texCoords[i][1] ); - colors[3] *= f; - } -} - - -static void RB_CalcModulateRGBAsByFog( unsigned char *colors, int firstVertex, int numVertexes ) { - int i; - float texCoords[SHADER_MAX_VERTEXES][2]; - - // calculate texcoords so we can derive density - // this is not wasted, because it would only have - // been previously called if the surface was opaque - RB_CalcFogTexCoords( texCoords[0], firstVertex, numVertexes ); - - colors += firstVertex * 4; - for ( i = firstVertex; i < firstVertex + numVertexes; i++, colors += 4 ) { - float f = 1.0 - R_FogFactor( texCoords[i][0], texCoords[i][1] ); - colors[0] *= f; - colors[1] *= f; - colors[2] *= f; - colors[3] *= f; - } -} - - static void RB_CalcEnvironmentTexCoords( float *st, int firstVertex, int numVertexes ) { int i; @@ -1093,14 +946,6 @@ void R_ComputeColors( const shaderStage_t* pStage, stageVars_t& svars, int first } } break; - case CGEN_FOG: - { - const fog_t* fog = tr.world->fogs + tess.fogNum; - for ( int i = firstVertex; i < firstVertex + numVertexes; i++ ) { - *(int*)&svars.colors[i] = fog->colorInt; - } - } - break; case CGEN_WAVEFORM: RB_CalcWaveColor( &pStage->rgbWave, ( unsigned char * ) &svars.colors[firstVertex], numVertexes ); break; @@ -1181,27 +1026,6 @@ void R_ComputeColors( const shaderStage_t* pStage, stageVars_t& svars, int first } break; } - - // - // fog adjustment for colors to fade out as fog increases - // - if ( tess.fogNum ) - { - switch ( pStage->adjustColorsForFog ) - { - case ACFF_MODULATE_RGB: - RB_CalcModulateColorsByFog( ( unsigned char * ) svars.colors, firstVertex, numVertexes ); - break; - case ACFF_MODULATE_ALPHA: - RB_CalcModulateAlphasByFog( ( unsigned char * ) svars.colors, firstVertex, numVertexes ); - break; - case ACFF_MODULATE_RGBA: - RB_CalcModulateRGBAsByFog( ( unsigned char * ) svars.colors, firstVertex, numVertexes ); - break; - case ACFF_NONE: - break; - } - } } @@ -1238,10 +1062,6 @@ void R_ComputeTexCoords( const shaderStage_t* pStage, stageVars_t& svars, int fi } break; - case TCGEN_FOG: - RB_CalcFogTexCoords( ( float * ) svars.texcoords, firstVertex, numVertexes ); - break; - case TCGEN_ENVIRONMENT_MAPPED: RB_CalcEnvironmentTexCoords( ( float * ) svars.texcoords, firstVertex, numVertexes ); break; diff --git a/code/renderer/tr_shader.cpp b/code/renderer/tr_shader.cpp index 74e8c5b..657f7f1 100644 --- a/code/renderer/tr_shader.cpp +++ b/code/renderer/tr_shader.cpp @@ -1579,7 +1579,6 @@ static qbool IsColorGenDynamic(colorGen_t cGen) case CGEN_VERTEX: case CGEN_EXACT_VERTEX: case CGEN_ONE_MINUS_VERTEX: - case CGEN_FOG: return qfalse; case CGEN_WAVEFORM: // time-based @@ -1628,7 +1627,6 @@ static qbool IsTexCoordGenDynamic(texCoordGen_t tcGen) case TCGEN_TEXTURE: case TCGEN_LIGHTMAP: case TCGEN_VECTOR: - case TCGEN_FOG: // not relevant for us anyhow return qfalse; case TCGEN_ENVIRONMENT_MAPPED: // changes with camera position @@ -1843,12 +1841,6 @@ static shader_t* GeneratePermanentShader( shader_t* sh ) hashTable[hash] = newShader; } - if ( shader.sort <= SS_OPAQUE ) { - newShader->fogPass = FP_EQUAL; - } else if ( shader.contentFlags & CONTENTS_FOG ) { - newShader->fogPass = FP_LE; - } - for ( int i = 0; i < newShader->numStages; ++i ) { if ( !stages[i].active ) { newShader->numStages = i; @@ -2211,7 +2203,6 @@ static alphaGen_t GetActualAlphaTest(const shaderStage_t* stage) case CGEN_VERTEX: return AGEN_VERTEX; case CGEN_EXACT_VERTEX: return AGEN_VERTEX; case CGEN_ONE_MINUS_VERTEX: return (alphaGen_t)__LINE__; // doesn't write to alpha currently... - case CGEN_FOG: return (alphaGen_t)__LINE__; case CGEN_WAVEFORM: return AGEN_IDENTITY; case CGEN_ENTITY: return AGEN_ENTITY; case CGEN_ONE_MINUS_ENTITY: return AGEN_ONE_MINUS_ENTITY; @@ -2445,37 +2436,10 @@ static shader_t* FinishShader( shader_t* sh = NULL ) } // - // determine sort order and fog color adjustment + // determine sort order // if ( ( pStage->stateBits & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) && ( stages[0].stateBits & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) ) { - int blendSrcBits = pStage->stateBits & GLS_SRCBLEND_BITS; - int blendDstBits = pStage->stateBits & GLS_DSTBLEND_BITS; - - // fog color adjustment only works for blend modes that have a contribution - // that aproaches 0 as the modulate values aproach 0 -- - // GL_ONE, GL_ONE - // GL_ZERO, GL_ONE_MINUS_SRC_COLOR - // GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA - - // modulate, additive - if ( ( ( blendSrcBits == GLS_SRCBLEND_ONE ) && ( blendDstBits == GLS_DSTBLEND_ONE ) ) || - ( ( blendSrcBits == GLS_SRCBLEND_ZERO ) && ( blendDstBits == GLS_DSTBLEND_ONE_MINUS_SRC_COLOR ) ) ) { - pStage->adjustColorsForFog = ACFF_MODULATE_RGB; - } - // strict blend - else if ( ( blendSrcBits == GLS_SRCBLEND_SRC_ALPHA ) && ( blendDstBits == GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA ) ) - { - pStage->adjustColorsForFog = ACFF_MODULATE_ALPHA; - } - // premultiplied alpha - else if ( ( blendSrcBits == GLS_SRCBLEND_ONE ) && ( blendDstBits == GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA ) ) - { - pStage->adjustColorsForFog = ACFF_MODULATE_RGBA; - } else { - // we can't adjust this one correctly, so it won't be exactly correct in fog - } - // don't screw with sort order if this is a portal or environment if ( !shader.sort ) { // see through item, like a grill or grate diff --git a/code/renderer/tr_world.cpp b/code/renderer/tr_world.cpp index 27ebc8f..5f3fd5a 100644 --- a/code/renderer/tr_world.cpp +++ b/code/renderer/tr_world.cpp @@ -210,7 +210,7 @@ static void R_AddWorldSurface( msurface_t* surf ) radiusOverZ = triangles->radius / max( dist, 0.001f ); } - R_AddDrawSurf( surf->data, surf->shader, surf->fogIndex, surf->staticGeoChunk, surf->zppFirstIndex, surf->zppIndexCount, radiusOverZ ); + R_AddDrawSurf( surf->data, surf->shader, surf->staticGeoChunk, surf->zppFirstIndex, surf->zppIndexCount, radiusOverZ ); } @@ -378,7 +378,7 @@ static void R_AddLitSurface( msurface_t* surf, const dlight_t* light ) return; } - R_AddLitSurf( surf->data, surf->shader, surf->fogIndex, surf->staticGeoChunk ); + R_AddLitSurf( surf->data, surf->shader, surf->staticGeoChunk ); }