Skip to content

Commit

Permalink
Add tcRender stuff to vk renderer
Browse files Browse the repository at this point in the history
Moved the hard coded image to renderercommon to not have two copies.
  • Loading branch information
ensiform committed Jun 6, 2024
1 parent bf2f43f commit ca39dd8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/renderer/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion src/renderervk/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
=================
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1710,6 +1716,8 @@ static void R_CreateBuiltinImages( void ) {

R_CreateDlightImage();
R_CreateFogImage();

R_CreateTCRenderImage();
}


Expand Down
4 changes: 4 additions & 0 deletions src/renderervk/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1426,13 +1426,17 @@ 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;
shader_t *shadowShader;
shader_t *projectionShadowShader;
shader_t *dlightShader; //----(SA) added

shader_t *tcRenderShader;

shader_t *flareShader;
char sunShaderName[MAX_QPATH];
shader_t *sunShader;
Expand Down
18 changes: 18 additions & 0 deletions src/renderervk/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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
//
Expand Down Expand Up @@ -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( "<tcRender>", 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();
}


Expand Down

0 comments on commit ca39dd8

Please sign in to comment.