Skip to content

Commit 5312d24

Browse files
committed
- deprecating r_modelshader because the shader got stale, old, buggy, and amd hates it now
- r_shadeMethod will be something else (and not shader-based)
1 parent 354edd5 commit 5312d24

5 files changed

Lines changed: 6 additions & 79 deletions

File tree

code/renderer_oa/tr_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ cvar_t *r_flaresDlightScale;
208208
cvar_t *r_alternateBrightness; // leilei - linux overbright fix
209209
cvar_t *r_mockvr; // Leilei - for debugging PVR only!
210210
cvar_t *r_leifx; // Leilei - leifx nostalgia filter
211-
cvar_t *r_modelshader; // Leilei
211+
cvar_t *r_shadeMethod; // Leilei
212212
cvar_t *r_particles; // Leilei - particle effects motif
213213

214214
cvar_t *r_leidebug; // Leilei - debug
@@ -1291,7 +1291,7 @@ void R_Register( void )
12911291

12921292
r_mockvr = ri.Cvar_Get( "r_mockvr", "0" , CVAR_CHEAT);
12931293
r_leifx = ri.Cvar_Get( "r_leifx", "0" , CVAR_ARCHIVE | CVAR_LATCH);
1294-
r_modelshader = ri.Cvar_Get( "r_modelshader", "0" , CVAR_ARCHIVE | CVAR_LATCH); // leilei - load and use special shaders for lightDiffuse models
1294+
r_shadeMethod = ri.Cvar_Get( "r_shadeMethod", "0" , CVAR_ARCHIVE | CVAR_LATCH); // leilei - Alternative lightingDiffuse
12951295
r_detailTextureScale = ri.Cvar_Get( "r_detailtextureScale", "0", CVAR_ARCHIVE | CVAR_LATCH ); // leilei - adjust scale of detail textures
12961296
r_detailTextureLayers = ri.Cvar_Get( "r_detailtextureLayers", "0", CVAR_ARCHIVE | CVAR_LATCH ); // leilei - add more detail layers
12971297

code/renderer_oa/tr_local.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ typedef struct {
365365

366366
int isGLSL;
367367
int isBlend; // leilei - for leifx
368-
qboolean isLeiShade; // leilei - for the automatic shader
369368
qhandle_t program;
370369

371370
int imgWidth;
@@ -1387,7 +1386,7 @@ extern cvar_t *r_flaresDlightScale;
13871386

13881387
extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
13891388
extern cvar_t *r_leifx; // Leilei - leifx nostalgia filter
1390-
extern cvar_t *r_modelshader; // Leilei - new model shading
1389+
extern cvar_t *r_shadeMethod; // Leilei - new model shading methods
13911390

13921391

13931392
extern cvar_t *r_suggestiveThemes; // Leilei - mature content
@@ -2140,8 +2139,6 @@ void RB_CalcDynamicColor( unsigned char *colors );
21402139
void RB_CalcDiffuseColor_Specular( unsigned char *colors ); // leilei - specular hack
21412140
void RB_CalcFlatAmbient( unsigned char *colors ); // leilei - cel hack
21422141
void RB_CalcFlatDirect( unsigned char *colors ); // leilei - cel hack
2143-
void RB_CalcNormal( unsigned char *colors ); // leilei - normal hack
2144-
21452142
void RB_CalcGlowBlend( unsigned char *colors, int glowcol, int fx ); // leilei - rgbMod
21462143
void RB_CalcUVColor( unsigned char *colors, int glowcol, int fx ); // leilei - rgbMod
21472144
void RB_CalcNormalizeToAlpha( unsigned char *colors); // leilei - rgbMod

code/renderer_oa/tr_shade.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,6 @@ static void ComputeColors( shaderStage_t *pStage )
876876
Com_Memset( tess.svars.colors, tr.identityLightByte, tess.numVertexes * 4 );
877877
break;
878878
case CGEN_LIGHTING_DIFFUSE:
879-
if (r_shownormals->integer > 1 || (pStage->isLeiShade)){
880-
RB_CalcNormal( ( unsigned char * ) tess.svars.colors ); // leilei - debug normals, or use the normals as a color for a lighting shader
881-
break;
882-
}
883879
RB_CalcDiffuseColor( ( unsigned char * ) tess.svars.colors );
884880
if(r_monolightmaps->integer)
885881
{
@@ -992,10 +988,6 @@ static void ComputeColors( shaderStage_t *pStage )
992988
RB_CalcColorFromOneMinusEntity( ( unsigned char * ) tess.svars.colors );
993989
break;
994990
case CGEN_LIGHTING_DIFFUSE_SPECULAR: // leilei - specular hack
995-
if (r_shownormals->integer > 1 || (pStage->isLeiShade)){
996-
RB_CalcNormal( ( unsigned char * ) tess.svars.colors ); // leilei - debug normals, or use the normals as a color for a lighting shader
997-
break;
998-
}
999991
RB_CalcDiffuseColor_Specular( ( unsigned char * ) tess.svars.colors );
1000992
if(r_monolightmaps->integer)
1001993
{
@@ -1008,10 +1000,6 @@ static void ComputeColors( shaderStage_t *pStage )
10081000
}
10091001
break;
10101002
case CGEN_MATERIAL:
1011-
if (r_shownormals->integer > 1 || (pStage->isLeiShade)){
1012-
RB_CalcNormal( ( unsigned char * ) tess.svars.colors ); // leilei - debug normals, or use the normals as a color for a lighting shader
1013-
break;
1014-
}
10151003
RB_CalcMaterials( ( unsigned char * ) tess.svars.colors, pStage->matAmb, pStage->matDif, pStage->matSpec, pStage->matEmis, pStage->matHard, pStage->matAlpha );
10161004
break;
10171005
}

code/renderer_oa/tr_shade_calc.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,52 +1854,6 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
18541854
}
18551855
}
18561856

1857-
// leilei - reveal normals to GLSL for light processing. HACK HACK HACK HACK HACK HACK
1858-
void RB_CalcNormal( unsigned char *colors )
1859-
{
1860-
float *v;
1861-
float *normal = ( float * ) tess.normal;
1862-
vec3_t n, m;
1863-
int numVertexes;
1864-
1865-
v = tess.xyz[0];
1866-
//normal = tess.normal[0];
1867-
1868-
numVertexes = tess.numVertexes;
1869-
for (int i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
1870-
int y;
1871-
float mid;
1872-
for (y=0;y<3;y++){
1873-
n[y] = normal[y];
1874-
1875-
// colors[i*4+y] = n[y];
1876-
}
1877-
//VectorNormalize(n);
1878-
1879-
mid = n[1] + n[2];
1880-
if (mid < 0) mid *= -1;
1881-
1882-
1883-
// m[0] = 127 - (n[1]*128);
1884-
// m[1] = 127 - (n[2]*128);
1885-
// m[2] = 255 - (mid*128);
1886-
1887-
m[0] = 127 + (n[0]*128);
1888-
m[1] = 127 + (n[1]*128);
1889-
m[2] = 127 + (n[2]*128);
1890-
1891-
1892-
1893-
1894-
colors[i*4+0] = m[0];
1895-
colors[i*4+1] = m[1];
1896-
colors[i*4+2] = m[2];
1897-
colors[i*4+3] = 255;
1898-
}
1899-
}
1900-
1901-
1902-
19031857
void RB_CalcDiffuseColor_Specular( unsigned char *colors )
19041858
{
19051859
int i, j;

code/renderer_oa/tr_shader.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
13921392
//
13931393
// map3 <name>
13941394
//
1395-
else if ( !Q_stricmp( token, "map3" ) || (!Q_stricmp( token, "normalmap" ) && r_modelshader->integer))
1395+
else if ( !Q_stricmp( token, "map3" ) || (!Q_stricmp( token, "normalmap" )))
13961396
{
13971397
token = COM_ParseExt( text, qfalse );
13981398
if ( !token[0] )
@@ -1440,7 +1440,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
14401440
//
14411441
// map4 <name>
14421442
//
1443-
else if ( !Q_stricmp( token, "map4" ) || (!Q_stricmp( token, "specmap" ) && r_modelshader->integer))
1443+
else if ( !Q_stricmp( token, "map4" ) || (!Q_stricmp( token, "specmap" )))
14441444
{
14451445
token = COM_ParseExt( text, qfalse );
14461446
if ( !token[0] )
@@ -1487,7 +1487,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
14871487
//
14881488
// map5 <name>
14891489
//
1490-
else if ( !Q_stricmp( token, "map5" ) || (!Q_stricmp( token, "shadeballmap" ) && r_modelshader->integer))
1490+
else if ( !Q_stricmp( token, "map5" ) || (!Q_stricmp( token, "shadeballmap" )))
14911491
{
14921492
token = COM_ParseExt( text, qfalse );
14931493
if ( !token[0] )
@@ -4270,18 +4270,6 @@ static shader_t *FinishShader( void ) {
42704270
// vertexLightmap = qtrue;
42714271
//}
42724272

4273-
4274-
#ifdef GLSL_TEXTURES
4275-
4276-
// leilei - force new phong on lightdiffuse and lightdiffusespecular models
4277-
// FIXME: Intel HD doesn't like this.
4278-
if ((r_modelshader->integer) && (pStage->isGLSL==0) && (r_ext_vertex_shader->integer) && ((pStage->rgbGen == CGEN_LIGHTING_DIFFUSE) || (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE_SPECULAR)))
4279-
{
4280-
pStage->program = RE_GLSL_RegisterProgram("leishade", "glsl/leishade_vp.glsl", 1, "glsl/leishade_fp.glsl", 1);
4281-
pStage->isGLSL=1;
4282-
pStage->isLeiShade=1;
4283-
}
4284-
#endif
42854273
//
42864274
// determine sort order and fog color adjustment
42874275
//

0 commit comments

Comments
 (0)