diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aaf4bb53..b278c1da3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,9 +207,9 @@ if( MSVC ) # Function-level linking # Disable run-time type information if ( HAVE_VULKAN ) - set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN /DHAVE_SOFTPOLY" ) + set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN" ) else() - set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_SOFTPOLY" ) + set( ALL_C_FLAGS "/GF /Gy /permissive-" ) endif() # Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall @@ -253,9 +253,9 @@ if( MSVC ) else() set( REL_LINKER_FLAGS "" ) if ( HAVE_VULKAN ) - set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN -DHAVE_SOFTPOLY" ) + set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN" ) else() - set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_SOFTPOLY" ) + set( ALL_C_FLAGS "-ffp-contract=off" ) endif() set( ALL_C_FLAGS "${ALL_C_FLAGS} -DUSE_OPENGL=1 -DNOASM=1" ) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d608d2ef2..a19a0c1e3 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -680,7 +680,6 @@ set( POLYRENDER_SOURCES # without being compiled. set( NOT_COMPILED_SOURCE_FILES ${OTHER_SYSTEM_SOURCES} - ${POLYRENDER_SOURCES} sc_man_scanner.h common/engine/sc_man_scanner.re common/scripting/frontend/zcc-parse.lemon @@ -704,7 +703,6 @@ set( VM_JIT_SOURCES set( FASTMATH_SOURCES common/rendering/gl_load/gl_load.c - common/rendering/polyrenderer/poly_all.cpp common/textures/hires/hqnx/init.cpp common/textures/hires/hqnx/hq2x.cpp common/textures/hires/hqnx/hq3x.cpp @@ -755,7 +753,7 @@ set (POLYBACKEND_SOURCES common/rendering/polyrenderer/backend/poly_hwtexture.cpp common/rendering/polyrenderer/backend/poly_renderstate.cpp ) -set (FASTMATH_SOURCES ${FASTMATH_SOURCES} ${POLYBACKEND_SOURCES}) +set (FASTMATH_SOURCES ${FASTMATH_SOURCES}) set (PCH_SOURCES diff --git a/source/blood/src/hudsprites.cpp b/source/blood/src/hudsprites.cpp index 33aa3a9ae..8010583a3 100644 --- a/source/blood/src/hudsprites.cpp +++ b/source/blood/src/hudsprites.cpp @@ -103,7 +103,7 @@ void hudDraw(PLAYER *gView, VIEW *pView, int nSectnum, double bobx, double boby, double look_anghalf = getHalfLookAng(pView->q16look_ang, gView->q16look_ang, cl_syncinput, smoothratio); double looking_arc = fabs(look_anghalf) / 4.5; - DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 2); + DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 0, 2); double cX = 160 - look_anghalf; double cY = 220 + looking_arc; diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index fd6eaae28..d7670bec2 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -706,9 +706,10 @@ void MyLoadSave::Save(void) int nXSprite = sprite[nSprite].extra; if (nXSprite > 0) { + auto saved = xsprite[nXSprite].aiState; IndexAIState(xsprite[nXSprite].aiState); Write(&xsprite[nXSprite], sizeof(XSPRITE)); - UnindexAIState(xsprite[nXSprite].aiState); + xsprite[nXSprite].aiState = saved; } } } diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 46bddc0a5..3e0af6a93 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -178,7 +178,7 @@ fixed_t qglobalhoriz; float fglobalposx, fglobalposy, fglobalposz; int16_t globalang, globalcursectnum; fixed_t qglobalang; -int32_t globalpal, cosglobalang, singlobalang; +int32_t globalpal, globalfloorpal, cosglobalang, singlobalang; int32_t cosviewingrangeglobalang, sinviewingrangeglobalang; int32_t xyaspect; @@ -1767,7 +1767,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) globalorientation = (int32_t)sec->floorstat; if ((globalorientation&1) != 0) continue; - globalpal = sec->floorpal; + globalfloorpal = globalpal = sec->floorpal; globalpicnum = sec->floorpicnum; if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 17bcde053..e1bfd55cc 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1494,6 +1494,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) } #endif int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal); + GLInterface.SetFade(sector[tspr->sectnum].floorpal); GLInterface.SetTexture(-1, tex, palid, CLAMP_XY); if (tspr->clipdist & TSPR_FLAGS_MDHACK) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index fab984e89..fd3054376 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -299,7 +299,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 } if (!lookups.checkTable(globalpal)) - globalpal = 0; + globalfloorpal = globalpal = 0; //Load texture (globalpicnum) setgotpic(globalpicnum); @@ -377,6 +377,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal); + GLInterface.SetFade(globalfloorpal); bool success = GLInterface.SetTexture(globalpicnum, tileGetTexture(globalpicnum), palid, sampleroverride); if (!success) { @@ -1567,7 +1568,7 @@ static void polymost_drawalls(int32_t const bunch) globalpicnum = sec->floorpicnum; globalshade = sec->floorshade; - globalpal = sec->floorpal; + globalfloorpal = globalpal = sec->floorpal; globalorientation = sec->floorstat; GLInterface.SetVisibility(sectorVisibility(sectnum)); @@ -1808,7 +1809,7 @@ static void polymost_drawalls(int32_t const bunch) globalpicnum = sec->ceilingpicnum; globalshade = sec->ceilingshade; - globalpal = sec->ceilingpal; + globalfloorpal = globalpal = sec->ceilingpal; globalorientation = sec->ceilingstat; GLInterface.SetVisibility(sectorVisibility(sectnum)); @@ -2074,7 +2075,7 @@ static void polymost_drawalls(int32_t const bunch) if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat§or[nextsectnum].ceilingstat)&1))) { - globalpicnum = wal->picnum; globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal); + globalpicnum = wal->picnum; globalshade = wal->shade; globalfloorpal = globalpal = (int32_t)((uint8_t)wal->pal); GLInterface.SetVisibility(sectorVisibility(sectnum)); globalorientation = wal->cstat; tileUpdatePicnum(&globalpicnum, wallnum+16384); @@ -2109,7 +2110,7 @@ static void polymost_drawalls(int32_t const bunch) xtex.u += (float)(nwal->xpanning - wal->xpanning) * xtex.d; ytex.u += (float)(nwal->xpanning - wal->xpanning) * ytex.d; } - globalpicnum = nwal->picnum; globalshade = nwal->shade; globalpal = (int32_t)((uint8_t)nwal->pal); + globalpicnum = nwal->picnum; globalshade = nwal->shade; globalfloorpal = globalpal = (int32_t)((uint8_t)nwal->pal); GLInterface.SetVisibility(sectorVisibility(sectnum)); globalorientation = nwal->cstat; tileUpdatePicnum(&globalpicnum, wallnum+16384); @@ -2150,7 +2151,7 @@ static void polymost_drawalls(int32_t const bunch) globalpicnum = (nextsectnum < 0) ? wal->picnum : wal->overpicnum; globalshade = wal->shade; - globalpal = wal->pal; + globalfloorpal = globalpal = wal->pal; GLInterface.SetVisibility(sectorVisibility(sectnum)); globalorientation = wal->cstat; tileUpdatePicnum(&globalpicnum, wallnum+16384); @@ -2670,7 +2671,7 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex) GLInterface.SetVisibility(sectorVisibility(sectnum)); globalshade = (int32_t)wal->shade; - globalpal = (int32_t)((uint8_t)wal->pal); + globalfloorpal = globalpal = (int32_t)((uint8_t)wal->pal); vec2f_t s0 = { (float)(wal->x-globalposx), (float)(wal->y-globalposy) }; vec2f_t p0 = { s0.y*gcosang - s0.x*gsinang, s0.x*gcosang2 + s0.y*gsinang2 }; @@ -3043,6 +3044,7 @@ void polymost_drawsprite(int32_t snum) globalpicnum = tspr->picnum; globalshade = tspr->shade; globalpal = tspr->pal; + globalfloorpal = sector[tspr->sectnum].floorpal; globalorientation = tspr->cstat; GLInterface.SetVisibility(sectorVisibility(tspr->sectnum)); diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index e74ba36bf..59a57cecb 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -1008,7 +1008,7 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length) //Draw voxel model as perfect cubes // Note: This is a hopeless mess that totally forfeits any chance of using a vertex buffer with its messy coordinate adjustments. :( -int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr) +int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr) { // float clut[6] = {1.02,1.02,0.94,1.06,0.98,0.98}; float f, g, k0, zoff; @@ -1016,7 +1016,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr) if ((intptr_t)m == (intptr_t)(-1)) // hackhackhack return 0; - if ((tspr->cstat&48)==32) + if ((tspr->cstat & 48) == 32) return 0; polymost_outputGLDebugMessage(3, "polymost_voxdraw(m:%p, tspr:%p)", m, tspr); @@ -1150,6 +1150,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr) } GLInterface.SetPalswap(globalpal); + GLInterface.SetFade(sector[tspr->sectnum].floorpal); // The texture here is already translated. GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, CLAMP_NOFILTER_XY, true); diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index cc0867b0a..cf89415e5 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1394,7 +1394,7 @@ void DrawGenericCrosshair(int num, int phealth, double xdelta) } -void DrawCrosshair(int deftile, int health, double xdelta, double scale, PalEntry color) +void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, PalEntry color) { int type = -1; if (automapMode == am_off && cl_crosshair) @@ -1405,7 +1405,7 @@ void DrawCrosshair(int deftile, int health, double xdelta, double scale, PalEntr if (tile) { double crosshair_scale = cl_crosshairscale * .01 * scale; - DrawTexture(twod, tile, 160 + xdelta, 100, DTA_Color, color, + DrawTexture(twod, tile, 160 + xdelta, 100 + ydelta, DTA_Color, color, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, TAG_DONE); diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 7268f657b..fc92a6f1b 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -58,7 +58,7 @@ void CONFIG_ReadCombatMacros(); int GameMain(); int GetAutomapZoom(int gZoom); -void DrawCrosshair(int deftile, int health, double xdelta, double scale, PalEntry color = 0xffffffff); +void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, PalEntry color = 0xffffffff); void updatePauseStatus(); void DeferedStartGame(MapRecord* map, int skill); void ChangeLevel(MapRecord* map, int skill); diff --git a/source/core/palette.h b/source/core/palette.h index 72c3e88a9..ac6e441b7 100644 --- a/source/core/palette.h +++ b/source/core/palette.h @@ -165,20 +165,20 @@ inline void videoclearFade() void videoTintBlood(int32_t r, int32_t g, int32_t b); -extern int32_t globalpal; +extern int32_t globalpal, globalfloorpal; extern void paletteLoadFromDisk(void); -typedef struct glblenddef_ +struct glblenddef_t { float alpha; uint8_t src, dst, flags; -} glblenddef_t; +}; -typedef struct glblend_ +struct glblend_t { glblenddef_t def[2]; -} glblend_t; +}; extern glblend_t const nullglblend, defaultglblend; extern glblend_t glblend[MAXBLENDTABS]; diff --git a/source/exhumed/src/gameloop.cpp b/source/exhumed/src/gameloop.cpp index 65856a30e..0ba7359fe 100644 --- a/source/exhumed/src/gameloop.cpp +++ b/source/exhumed/src/gameloop.cpp @@ -107,7 +107,7 @@ void GameInterface::Render() DrawView(smoothratio); DrawStatusBar(); - DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -look_anghalf, 1); + DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -look_anghalf, 0, 1); if (paused && !M_Active()) { diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 1a61e29e7..696b5d5bd 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -300,7 +300,7 @@ void drawoverlays(double smoothratio) if (ps[myconnectindex].newowner == -1 && ud.camerasprite == -1) { - DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio), isRR() ? 0.5 : 1); + DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio), 0, isRR() ? 0.5 : 1); } if (paused == 2) diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index d48cbd8c6..57c2ff7e6 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -152,7 +152,14 @@ void GLInstance::SetIdentityMatrix(int num) void GLInstance::SetPalswap(int index) { renderState.ShadeDiv = lookups.tables[index].ShadeFactor; - renderState.FogColor = lookups.getFade(index); +} + +void GLInstance::SetFade(int index) +{ + if (!hw_useindexedcolortextures) + renderState.FogColor = lookups.getFade(index); + else + renderState.FogColor = 0; } void PolymostRenderState::Apply(FRenderState& state, GLState& oldState) @@ -227,17 +234,24 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState) state.SetDepthFunc(DepthFunc); oldState.DepthFunc = DepthFunc; } + bool foggy = (GLInterface.useMapFog || FogColor); // Disable brightmaps if non-black fog is used. - if (!(Flags & RF_FogDisabled) && ShadeDiv >= 1 / 1000.f && (GLInterface.useMapFog || FogColor)) + if (!(Flags & RF_FogDisabled) && ShadeDiv >= 1 / 1000.f && foggy) { state.EnableFog(1); + float density = GLInterface.useMapFog ? 350.f : 350.f - Scale(numshades - Shade, 150, numshades); + state.SetFog((GLInterface.useMapFog) ? PalEntry(0x999999) : FogColor, density); + state.SetSoftLightLevel(255); + state.SetLightParms(128.f, 1/1000.f); + } + else + { + state.EnableFog(0); + state.SetSoftLightLevel(ShadeDiv >= 1 / 1000.f ? 255 - Scale(Shade, 255, numshades) : 255); + state.SetLightParms(VisFactor, ShadeDiv / (numshades - 2)); } - else state.EnableFog(0); - state.SetFog((GLInterface.useMapFog) ? PalEntry(0x999999) : FogColor, 350.f); // Fixme: The real density still needs to be implemented. 350 is a reasonable default only. - state.SetSoftLightLevel(ShadeDiv >= 1 / 1000.f ? 255 - Scale(Shade, 255, numshades) : 255); - state.SetLightParms(VisFactor, ShadeDiv / (numshades - 2)); state.SetTextureMode(TextureMode); state.SetNpotEmulation(NPOTEmulation.Y, NPOTEmulation.X); @@ -339,6 +353,7 @@ void WriteSavePic(FileWriter* file, int width, int height) RenderState.EnableDrawBuffers(1, true); screen->SetViewportRects(&bounds); + twodpsp.Clear(); bool didit = gi->GenerateSavePic(); float Brightness = 8.f / (r_scenebrightness + 8.f); diff --git a/source/glbackend/glbackend.h b/source/glbackend/glbackend.h index 952b752f4..a3fe80ccb 100644 --- a/source/glbackend/glbackend.h +++ b/source/glbackend/glbackend.h @@ -140,6 +140,7 @@ public: } void SetPalswap(int index); + void SetFade(int palette); void SetShade(int32_t shade, int numshades) { diff --git a/source/platform/win32/gameres.rc b/source/platform/win32/gameres.rc index 2eefbe25a..00222f887 100644 --- a/source/platform/win32/gameres.rc +++ b/source/platform/win32/gameres.rc @@ -28,7 +28,6 @@ BEGIN PUSHBUTTON "E&xit",IDCANCEL,166,228,50,14 CONTROL "&OpenGL",IDC_WELCOME_VULKAN1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,167,41,10 CONTROL "&Vulkan",IDC_WELCOME_VULKAN2,"Button",BS_AUTORADIOBUTTON,13,177,37,10 - CONTROL "&SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON,13,188,43,10 END IDD_CRASHDIALOG DIALOGEX 0, 0, 415, 308 diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 94771db49..6b00d52ec 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1262,7 +1262,7 @@ void DrawCrosshair(PLAYERp pp) if (!(CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) { USERp u = User[pp->PlayerSprite]; - ::DrawCrosshair(2326, u->Health, -getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio), 2, shadeToLight(10)); + ::DrawCrosshair(2326, u->Health, -getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio), 0, 2, shadeToLight(10)); } } @@ -1733,8 +1733,11 @@ drawscreen(PLAYERp pp, double smoothratio) if (!TEST(pp->Flags, PF_VIEW_FROM_CAMERA|PF_VIEW_FROM_OUTSIDE)) { - tz += bob_amt; - tz += pp->obob_z + xs_CRoundToInt(fmulscale16(pp->bob_z - pp->obob_z, smoothratio)); + if (cl_viewbob) + { + tz += bob_amt; + tz += pp->obob_z + xs_CRoundToInt(fmulscale16(pp->bob_z - pp->obob_z, smoothratio)); + } // recoil only when not in camera tq16horiz = tq16horiz + pp->recoil_horizoff; @@ -1773,7 +1776,7 @@ drawscreen(PLAYERp pp, double smoothratio) renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); - UpdatePanel(smoothratio); + if (!ScreenSavePic) UpdatePanel(smoothratio); #define SLIME 2305 // Only animate lava if its picnum is on screen @@ -1789,6 +1792,13 @@ drawscreen(PLAYERp pp, double smoothratio) } #endif + // if doing a screen save don't need to process the rest + if (ScreenSavePic) + { + DrawScreen = false; + return; + } + MarkSectorSeen(pp->cursectnum); @@ -1817,13 +1827,6 @@ drawscreen(PLAYERp pp, double smoothratio) } - // if doing a screen save don't need to process the rest - if (ScreenSavePic) - { - DrawScreen = false; - return; - } - //PrintLocationInfo(pp); //PrintSpriteInfo(pp); diff --git a/wadsrc/static/filter/duke/engine/widescreen.def b/wadsrc/static/filter/duke/engine/widescreen.def index bc9fbf262..cbe32fd04 100644 --- a/wadsrc/static/filter/duke/engine/widescreen.def +++ b/wadsrc/static/filter/duke/engine/widescreen.def @@ -29,8 +29,8 @@ tilefromtexture 2556 { file "tiles/duke3d/2556.png" xoffset -1 yoffset -2 ifcrc tilefromtexture 2557 { file "tiles/duke3d/2557.png" xoffset -1 yoffset -2 ifcrc 3133384900 } // Level Ending Screens (by fgsfds) -tilefromtexture 3240 { file "duke3d/3240.png" ifcrc -2916948 } -tilefromtexture 3245 { file "duke3d/3245.png" ifcrc -721918170 } +tilefromtexture 3240 { file "tiles/duke3d/3240.png" ifcrc -2916948 } +tilefromtexture 3245 { file "tiles/duke3d/3245.png" ifcrc -721918170 } // VACATION diff --git a/wadsrc/static/filter/duke/tiles/duke3d/3240.png b/wadsrc/static/filter/duke/tiles/duke3d/3240.png index 54cdc2db3..2b937ab3f 100644 Binary files a/wadsrc/static/filter/duke/tiles/duke3d/3240.png and b/wadsrc/static/filter/duke/tiles/duke3d/3240.png differ diff --git a/wadsrc/static/shaders/glsl/func_paletted.fp b/wadsrc/static/shaders/glsl/func_paletted.fp index b47dacb7c..1be496917 100644 --- a/wadsrc/static/shaders/glsl/func_paletted.fp +++ b/wadsrc/static/shaders/glsl/func_paletted.fp @@ -60,5 +60,5 @@ vec4 ProcessTexel() color.rgb = uFogColor.rgb * (1.0-fogfactor) + color.rgb * fogfactor;// mix(vec3(0.6), color.rgb, fogfactor); } if (color.a < uAlphaThreshold) discard; // it's only here that we have the alpha value available to be able to perform the alpha test. - return vec4(color.rgb / 0.85, vColor.a); + return vec4(color.rgb, 1.0); }