Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workaround for skin shaders. #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer/tr_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,7 @@ qhandle_t RE_RegisterIndividualSkin( const char *name , qhandle_t hSkin)
else
{
*/
surf->shader = R_FindShader( token, lightmapsNone, stylesDefault, qtrue );
surf->shader = R_FindShader( token, lightmapsNone, stylesDefault, qtrue, qfalse, qtrue );
/*
}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ Ghoul2 Insert End
qboolean hasGlow;

qboolean isAdvancedRemap;
qboolean isSkinShader;

struct shader_s *remappedShader; // current shader this one is remapped too
struct shader_s *remappedShaderAdvanced; // current shader from the advanced remaps this one is remapped to
Expand Down Expand Up @@ -1460,7 +1461,7 @@ qhandle_t RE_RegisterShader( const char *name );
qhandle_t RE_RegisterShaderNoMip( const char *name );
qhandle_t RE_RegisterShaderFromImage(const char *name, int *lightmapIndex, byte *styles, image_t *image, qboolean mipRawImage);

shader_t *R_FindShader( const char *name, const int *lightmapIndex, const byte *styles, qboolean mipRawImage, qboolean isAdvancedRemap = qfalse );
shader_t *R_FindShader( const char *name, const int *lightmapIndex, const byte *styles, qboolean mipRawImage, qboolean isAdvancedRemap = qfalse, qboolean isSkinShader = qfalse );
shader_t *R_FindAdvancedRemapShader( const char *name, const int *lightmapIndex, const byte *styles, qboolean mipRawImage );
shader_t *R_GetShaderByHandle( qhandle_t hShader );
// shader_t *R_GetShaderByState( int index, int *cycleTime );
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ to overflow.
void RB_BeginSurface( shader_t *shader, int fogNum ) {

shader_t *state = (shader->remappedShaderAdvanced ? shader->remappedShaderAdvanced : (shader->remappedShader ? shader->remappedShader : shader));
if ( state->defaultShader ) state = tr.defaultShader;
if ( !state->isSkinShader && state->defaultShader ) state = tr.defaultShader;

tess.numIndexes = 0;
tess.numVertexes = 0;
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/tr_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3524,7 +3524,7 @@ most world construction surfaces.

===============
*/
shader_t *R_FindShader( const char *name, const int *lightmapIndex, const byte *styles, qboolean mipRawImage, qboolean isAdvancedRemap )
shader_t *R_FindShader( const char *name, const int *lightmapIndex, const byte *styles, qboolean mipRawImage, qboolean isAdvancedRemap, qboolean isSkinShader )
{
char strippedName[MAX_QPATH];
char fileName[MAX_QPATH];
Expand Down Expand Up @@ -3633,6 +3633,10 @@ shader_t *R_FindShader( const char *name, const int *lightmapIndex, const byte *
ri.Printf( PRINT_DEVELOPER, "Couldn't find image for shader %s\n", name );
shader.defaultShader = qtrue;
//return FinishShader();
if ( isSkinShader ) {
shader.isSkinShader = qtrue;
return FinishShader();
}
image = tr.defaultImage;
}

Expand Down
Loading