mirror of
https://github.com/UberGames/ioef.git
synced 2025-01-31 04:50:37 +00:00
OpenGL2: automatically load textures with a _s suffix as specular.
This commit is contained in:
parent
f663104cfc
commit
2954bdfa65
1 changed files with 21 additions and 0 deletions
|
@ -2212,12 +2212,33 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse,
|
|||
|
||||
if (r_specularMapping->integer)
|
||||
{
|
||||
image_t *diffuseImg;
|
||||
if (specular)
|
||||
{
|
||||
//ri.Printf(PRINT_ALL, ", specularmap %s", specular->bundle[0].image[0]->imgName);
|
||||
diffuse->bundle[TB_SPECULARMAP] = specular->bundle[0];
|
||||
VectorCopy4(specular->specularScale, diffuse->specularScale);
|
||||
}
|
||||
else if ((lightmap || useLightVector || useLightVertex) && (diffuseImg = diffuse->bundle[TB_DIFFUSEMAP].image[0]))
|
||||
{
|
||||
char specularName[MAX_QPATH];
|
||||
image_t *specularImg;
|
||||
imgFlags_t specularFlags = (diffuseImg->flags & ~(IMGFLAG_GENNORMALMAP | IMGFLAG_SRGB)) | IMGFLAG_NOLIGHTSCALE;
|
||||
|
||||
COM_StripExtension(diffuseImg->imgName, specularName, MAX_QPATH);
|
||||
Q_strcat(specularName, MAX_QPATH, "_s");
|
||||
|
||||
specularImg = R_FindImageFile(specularName, IMGTYPE_COLORALPHA, specularFlags);
|
||||
|
||||
if (specularImg)
|
||||
{
|
||||
diffuse->bundle[TB_SPECULARMAP] = diffuse->bundle[0];
|
||||
diffuse->bundle[TB_SPECULARMAP].numImageAnimations = 0;
|
||||
diffuse->bundle[TB_SPECULARMAP].image[0] = specularImg;
|
||||
|
||||
VectorSet4(diffuse->specularScale, 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tcgen || diffuse->bundle[0].numTexMods)
|
||||
|
|
Loading…
Reference in a new issue