Fixed a bug with spec maps.

This commit is contained in:
Justin Marshall
2026-05-07 12:26:46 -07:00
parent 1a6bc0c447
commit 469be38dbe
6 changed files with 434 additions and 54 deletions
+14
View File
@@ -1900,6 +1900,20 @@ idImage* idMaterial::GetBumpImage(void) const {
return GetEditorImage();
}
/*
===================
idMaterial::GetSpecImage
===================
*/
idImage* idMaterial::GetSpecImage(void) const {
for (int i = 0; i < numStages; i++) {
if (stages[i].lighting == SL_SPECULAR && stages[i].texture.image) {
return stages[i].texture.image;
}
}
return globalImages->blackImage;
}
/*
===================
idMaterial::GetGlowImage
+1
View File
@@ -507,6 +507,7 @@ public:
// jmarshall
idImage* GetDiffuseImage(void) const;
idImage* GetBumpImage(void) const;
idImage* GetSpecImage(void) const;
idImage* GetGlowImage(void) const;
bool IsSky(void) const;
// jmarshall end
+20 -6
View File
@@ -442,10 +442,10 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) {
bool drawSolid = false;
if ( shader->Coverage() == MC_OPAQUE ) {
//if ( shader->Coverage() == MC_OPAQUE ) {
drawSolid = true;
}
//}
#if 0
// we may have multiple alpha tested stages
if ( shader->Coverage() == MC_PERFORATED ) {
// if the only alpha tested stages are condition register omitted,
@@ -497,7 +497,7 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) {
drawSolid = true;
}
}
#endif
// draw the entire surface solid
// draw the entire surface solid
if (drawSolid && !shader->IsSky()) {
@@ -512,10 +512,15 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) {
shader->GetBumpImage()->Bind();
glBindNormalMapTexture(shader->GetBumpImage()->texnum);
GL_SelectTexture(2);
glEnable(GL_TEXTURE_2D);
shader->GetSpecImage()->Bind();
glBindSpecularMapTexture(shader->GetSpecImage()->texnum);
idImage* glowMapImage = shader->GetGlowImage();
if (glowMapImage)
{
GL_SelectTexture(2);
GL_SelectTexture(3);
glEnable(GL_TEXTURE_2D);
glowMapImage->Bind();
glBindGlowMapTexture(glowMapImage->texnum);
@@ -539,11 +544,15 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) {
if (glowMapImage)
{
GL_SelectTexture(2);
GL_SelectTexture(3);
glBindGlowMapTexture(0);
globalImages->BindNull();
}
GL_SelectTexture(2);
glBindSpecularMapTexture(0);
globalImages->BindNull();
GL_SelectTexture(1);
glBindNormalMapTexture(0);
globalImages->BindNull();
@@ -940,6 +949,11 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) {
continue;
}
// check the stage enable condition
if (regs[pStage->conditionRegister] == 0) {
continue;
}
// select the vertex color source
if ( pStage->vertexColor == SVC_IGNORE ) {
glColor4fv( color );