Added partial support for RTCW shader keywords

Added partial support for RTCW shader keywords

diff --git a/src/engine/GPURenderer/r_backend.cpp b/src/engine/GPURenderer/r_backend.cpp
index 054ce57..22e782f 100644
--- a/src/engine/GPURenderer/r_backend.cpp
+++ b/src/engine/GPURenderer/r_backend.cpp
@@ -1267,14 +1267,18 @@ const void* RB_DrawSurfs( const void* data )
     
     if( !isShadowView )
     {
+        float32 scale;
+        
         RB_RenderDrawSurfList( cmd->drawSurfs, cmd->numDrawSurfs );
         
+        scale = tr.sunShaderScale;
+        
         if( r_drawSun->integer )
         {
-            RB_DrawSun( 0.1, tr.sunShader );
+            RB_DrawSun( scale, tr.sunShader );
         }
         
-        if( glRefConfig.framebufferObject && r_drawSunRays->integer )
+        if( glRefConfig.framebufferObject && r_drawSunRays->integer && scale > 0 )
         {
             FBO_t* oldFbo = glState.currentFBO;
             FBO_Bind( tr.sunRaysFbo );
diff --git a/src/engine/GPURenderer/r_bsp_tech3.cpp b/src/engine/GPURenderer/r_bsp_tech3.cpp
index f8bb8cd..8d0cee7 100644
--- a/src/engine/GPURenderer/r_bsp_tech3.cpp
+++ b/src/engine/GPURenderer/r_bsp_tech3.cpp
@@ -3256,6 +3256,7 @@ void idRenderSystemLocal::LoadWorld( pointer name )
         R_RenderMissingCubemaps();
     }
     
+    R_InitExternalShaders();
     
     fileSystem->FreeFile( buffer.v );
 }
diff --git a/src/engine/GPURenderer/r_common.h b/src/engine/GPURenderer/r_common.h
index 5054c13..ccfddd7 100644
--- a/src/engine/GPURenderer/r_common.h
+++ b/src/engine/GPURenderer/r_common.h
@@ -55,6 +55,8 @@ typedef enum
     IMGFLAG_SRGB           = 0x0400,
 } imgFlags_t;
 
+#define MIP_RAW_IMAGE ( IMGFLAG_MIPMAP | IMGFLAG_PICMIP )
+
 typedef struct image_s
 {
     valueType		imgName[MAX_QPATH];		// game path, including extension
diff --git a/src/engine/GPURenderer/r_image.cpp b/src/engine/GPURenderer/r_image.cpp
index 7ef918e..9a02261 100644
--- a/src/engine/GPURenderer/r_image.cpp
+++ b/src/engine/GPURenderer/r_image.cpp
@@ -3148,7 +3148,7 @@ void R_CreateBuiltinImages( void )
         if( r_cubeMapping->integer )
         {
             tr.renderCubeImage = R_CreateImage( "*renderCube", nullptr, r_cubemapSize->integer, r_cubemapSize->integer, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_CUBEMAP, hdrFormat );
-            tr.prefilterEnvMapImage = R_CreateImage( "*prefilterEnvMapFbo", nullptr, r_cubemapSize->integer / 2, r_cubemapSize->integer / 2, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, hdrFormat );
+            tr.prefilterEnvMapImage = R_CreateImage( "*prefilterEnvMap", nullptr, r_cubemapSize->integer / 2, r_cubemapSize->integer / 2, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, hdrFormat );
         }
     }
 }
diff --git a/src/engine/GPURenderer/r_init.cpp b/src/engine/GPURenderer/r_init.cpp
index 795e836..5782e80 100644
--- a/src/engine/GPURenderer/r_init.cpp
+++ b/src/engine/GPURenderer/r_init.cpp
@@ -1290,7 +1290,7 @@ void R_Register( void )
     r_parallaxMapShadows = cvarSystem->Get( "r_parallaxMapShadows", "0", CVAR_ARCHIVE | CVAR_LATCH, "Enable self-shadowing on parallax map supported materials. 0 - No. (default) 1 - Yes." );
     r_cubeMapping = cvarSystem->Get( "r_cubeMapping", "1", CVAR_ARCHIVE | CVAR_LATCH, "Enable cubemap environment mapping" );
     r_horizonFade = cvarSystem->Get( "r_horizonFade", "3", CVAR_ARCHIVE | CVAR_LATCH, "Enable horizon fade cubemap environment mapping" );
-    r_cubemapSize = cvarSystem->Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH, "Cubempa size" );
+    r_cubemapSize = cvarSystem->Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH, "Cubemap size" );
     r_deluxeSpecular = cvarSystem->Get( "r_deluxeSpecular", "0.3", CVAR_ARCHIVE | CVAR_LATCH, "Enable deluxe specular for materials that support it" );
     r_pbr = cvarSystem->Get( "r_pbr", "1", CVAR_ARCHIVE | CVAR_LATCH, "Enable physically based rendering." );
     r_baseNormalX = cvarSystem->Get( "r_baseNormalX", "1.0", CVAR_ARCHIVE | CVAR_LATCH, "Set the scale of the X values from normal maps when the normalScale keyword is not used. -1 - Flip X. 0 - Ignore X. 1 - Normal X. (default) 2 - Double X." );
@@ -1352,7 +1352,7 @@ void R_Register( void )
     r_bloomScale = cvarSystem->Get( "r_bloomScale", "1.5", CVAR_ARCHIVE, "Scaling bloom effects" );
     r_fxaa = cvarSystem->Get( "r_fxaa", "0", CVAR_ARCHIVE, "Enabled Full Screen Anti Aliasing effects" );
     
-    r_texturedetail = cvarSystem->Get( "r_texturedetail", "0", CVAR_ARCHIVE, "Enabled texture details effects" );
+    r_texturedetail = cvarSystem->Get( "r_textureDetail", "0", CVAR_ARCHIVE, "Enabled texture details effects" );
     r_texturedetailStrength = cvarSystem->Get( "r_texturedetailStrength", "0.004", CVAR_ARCHIVE, "Toggles texture details strength" );
     r_rbm = cvarSystem->Get( "r_rbm", "0", CVAR_ARCHIVE, "Enabled Reflective Bump Mapping effects" );
     r_rbmStrength = cvarSystem->Get( "r_rbmStrength", "0.015", CVAR_ARCHIVE, "Toggles Reflective Bump Mapping strength" );
diff --git a/src/engine/GPURenderer/r_light.cpp b/src/engine/GPURenderer/r_light.cpp
index 9e3bee8..6f69655 100644
--- a/src/engine/GPURenderer/r_light.cpp
+++ b/src/engine/GPURenderer/r_light.cpp
@@ -315,6 +315,15 @@ static void R_SetupEntityLightingGrid( trRefEntity_t* ent, world_t* world )
     VectorScale( ent->ambientLight, r_ambientScale->value, ent->ambientLight );
     VectorScale( ent->directedLight, r_directedScale->value, ent->directedLight );
     
+    if( tr.lightGridMulAmbient )
+    {
+        VectorScale( ent->ambientLight, tr.lightGridMulAmbient, ent->ambientLight );
+    }
+    if( tr.lightGridMulDirected )
+    {
+        VectorScale( ent->directedLight, tr.lightGridMulDirected, ent->directedLight );
+    }
+    
     VectorNormalize2( direction, ent->lightDir );
 }
 
diff --git a/src/engine/GPURenderer/r_local.h b/src/engine/GPURenderer/r_local.h
index 8619fa7..eb02174 100644
--- a/src/engine/GPURenderer/r_local.h
+++ b/src/engine/GPURenderer/r_local.h
@@ -1666,6 +1666,8 @@ typedef struct
     shader_t* flareShader;
     shader_t* sunShader;
     shader_t* sunFlareShader;
+    valueType sunShaderName[MAX_QPATH];
+    float32 sunShaderScale;
     
     sint	numLightmaps;
     sint	lightmapSize;
@@ -1766,6 +1768,9 @@ typedef struct
     vec3_t lastCascadeSunDirection;
     float32 lastCascadeSunMvp[16];
     
+    float32 lightGridMulAmbient;	// lightgrid multipliers specified in sky shader
+    float32 lightGridMulDirected;	//
+    
     frontEndCounters_t pc;
     sint frontEndMsec; // not in pc due to clearing issue
     
@@ -2618,7 +2623,7 @@ void R_AddCapShadowmapCmd( sint dlight, sint cubeSide );
 void R_AddConvolveCubemapCmd( sint cubemap );
 void R_AddPostProcessCmd( void );
 
-void RE_EndFrame( sint* frontEndMsec, sint* backEndMsec );
+void R_InitExternalShaders( void );
 void RE_SaveJPG( valueType* filename, sint quality, sint image_width, sint image_height, uchar8* image_buffer, sint padding );
 uint32 RE_SaveJPGToBuffer( uchar8* buffer, uint32 bufSize, sint quality, sint image_width, sint image_height, uchar8* image_buffer, sint padding );
 
diff --git a/src/engine/GPURenderer/r_main.cpp b/src/engine/GPURenderer/r_main.cpp
index b0704df..13a8705 100644
--- a/src/engine/GPURenderer/r_main.cpp
+++ b/src/engine/GPURenderer/r_main.cpp
@@ -2749,12 +2749,14 @@ void R_RenderCubemapSide( sint cubemapIndex, sint cubemapSide, bool subscene )
     parms.viewportHeight = tr.renderCubeFbo->height;
     parms.isPortal = false;
     parms.isMirror = true;
-    parms.flags =  VPF_NOVIEWMODEL | VPF_NOCUBEMAPS;
+    parms.flags = VPF_NOVIEWMODEL | VPF_NOCUBEMAPS;
     
     parms.fovX = 90;
     parms.fovY = 90;
     parms.zNear = 4.0;
     
+    parms.stereoFrame = tr.refdef.stereoFrame;
+    
     VectorCopy( refdef.vieworg, parms.orientation.origin );
     VectorCopy( refdef.viewaxis[0], parms.orientation.axis[0] );
     VectorCopy( refdef.viewaxis[1], parms.orientation.axis[1] );

[... diff too long, it was truncated ...]

GitHub
sha: 44b43671