diff --git a/src/renderer/tr_image.c b/src/renderer/tr_image.c index f59af07b..9308cb4b 100644 --- a/src/renderer/tr_image.c +++ b/src/renderer/tr_image.c @@ -1219,7 +1219,7 @@ image_t *R_FindImageFile( const char *name, imgFlags_t flags ) return image; } -#include "renderImage.h" +#include "../renderercommon/renderImage.h" static void R_CreateTCRenderImage( void ) { tr.tcRenderImage = R_CreateImage( "*tcRender", NULL, (byte*)tcRenderImage, TCRENDER_SIZE, TCRENDER_SIZE, IMGFLAG_PICMIP ); diff --git a/src/renderer/renderImage.h b/src/renderercommon/renderImage.h similarity index 100% rename from src/renderer/renderImage.h rename to src/renderercommon/renderImage.h diff --git a/src/renderervk/tr_image.c b/src/renderervk/tr_image.c index da599d91..2a9f3ec8 100644 --- a/src/renderervk/tr_image.c +++ b/src/renderervk/tr_image.c @@ -1258,7 +1258,7 @@ static const int numImageLoaders = ARRAY_LEN( imageLoaders ); ================= R_LoadImage -Loads any of the supported image types into a cannonical +Loads any of the supported image types into a canonical 32 bit format. ================= */ @@ -1460,6 +1460,12 @@ image_t *R_FindImageFile( const char *name, imgFlags_t flags ) } +#include "../renderercommon/renderImage.h" + +static void R_CreateTCRenderImage( void ) { + tr.tcRenderImage = R_CreateImage( "*tcRender", NULL, (byte*)tcRenderImage, TCRENDER_SIZE, TCRENDER_SIZE, IMGFLAG_PICMIP ); +} + /* ================ R_CreateDlightImage @@ -1710,6 +1716,8 @@ static void R_CreateBuiltinImages( void ) { R_CreateDlightImage(); R_CreateFogImage(); + + R_CreateTCRenderImage(); } diff --git a/src/renderervk/tr_local.h b/src/renderervk/tr_local.h index 90e0ef8a..609957f3 100644 --- a/src/renderervk/tr_local.h +++ b/src/renderervk/tr_local.h @@ -1426,6 +1426,8 @@ typedef struct { image_t *whiteImage; // full of 0xff image_t *identityLightImage; // full of tr.identityLightByte + image_t *tcRenderImage; + shader_t *defaultShader; shader_t *whiteShader; shader_t *cinematicShader; @@ -1433,6 +1435,8 @@ typedef struct { shader_t *projectionShadowShader; shader_t *dlightShader; //----(SA) added + shader_t *tcRenderShader; + shader_t *flareShader; char sunShaderName[MAX_QPATH]; shader_t *sunShader; diff --git a/src/renderervk/tr_shader.c b/src/renderervk/tr_shader.c index 51b16847..dad37244 100644 --- a/src/renderervk/tr_shader.c +++ b/src/renderervk/tr_shader.c @@ -4040,6 +4040,10 @@ shader_t *R_FindShaderByName( const char *name ) { hash = generateHashValue(strippedName, FILE_HASH_SIZE); + if ( tr.tcRenderShader && !tr.tcRenderShader->defaultShader && !Q_stricmp( name, tr.tcRenderShader->name ) ) { + return tr.tcRenderShader; + } + // // see if the shader is already loaded // @@ -4243,6 +4247,10 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag hash = generateHashValue(strippedName, FILE_HASH_SIZE); + if ( tr.tcRenderShader && !tr.tcRenderShader->defaultShader && !Q_stricmp( name, tr.tcRenderShader->name ) ) { + return tr.tcRenderShader; + } + // // see if the shader is already loaded // @@ -4884,6 +4892,16 @@ static void CreateInternalShaders( void ) { stages[0].bundle[0].rgbGen = CGEN_IDENTITY_LIGHTING; stages[0].stateBits = GLS_DEPTHTEST_DISABLE; tr.cinematicShader = FinishShader(); + + InitShader( "", LIGHTMAP_NONE ); + shader.polygonOffset = qtrue; + shader.noPicMip = qtrue; + stages[0].bundle[0].image[0] = tr.tcRenderImage; + stages[0].active = qtrue; + stages[0].bundle[0].rgbGen = CGEN_VERTEX; + stages[0].bundle[0].alphaGen = AGEN_VERTEX; + stages[0].stateBits = GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE; + tr.tcRenderShader = FinishShader(); }