mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-23 12:32:09 +00:00
OpenGL2: Render metals as nonmetal on cubemaps, and some ComputeShaderColors cleanup.
This commit is contained in:
parent
80357ff1f2
commit
60f56670d6
1 changed files with 26 additions and 18 deletions
|
@ -446,11 +446,12 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t
|
|||
|| ((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR)
|
||||
|| ((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR)
|
||||
|| ((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);
|
||||
qboolean isWorldDraw = !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL);
|
||||
float scale = 1.0f;
|
||||
|
||||
#if defined(USE_OVERBRIGHT)
|
||||
float exactLight = 1.0f;
|
||||
#else
|
||||
qboolean isWorldDraw = !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL);
|
||||
float exactLight = (isBlend || !isWorldDraw) ? 1.0f : (float)(1 << r_mapOverBrightBits->integer);
|
||||
#endif
|
||||
|
||||
|
@ -610,17 +611,16 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t
|
|||
break;
|
||||
}
|
||||
|
||||
// multiply color by overbrightbits if this isn't a blend
|
||||
if (tr.overbrightBits && !isBlend)
|
||||
{
|
||||
float scale = 1 << tr.overbrightBits;
|
||||
scale *= 1 << tr.overbrightBits;
|
||||
|
||||
baseColor[0] *= scale;
|
||||
baseColor[1] *= scale;
|
||||
baseColor[2] *= scale;
|
||||
vertColor[0] *= scale;
|
||||
vertColor[1] *= scale;
|
||||
vertColor[2] *= scale;
|
||||
if ((backEnd.refdef.colorScale != 1.0f) && !isBlend && isWorldDraw)
|
||||
scale *= backEnd.refdef.colorScale;
|
||||
|
||||
if (scale != 1.0f)
|
||||
{
|
||||
VectorScale(baseColor, scale, baseColor);
|
||||
VectorScale(vertColor, scale, vertColor);
|
||||
}
|
||||
|
||||
// FIXME: find some way to implement this.
|
||||
|
@ -1071,6 +1071,8 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
int deformGen;
|
||||
vec5_t deformParams;
|
||||
|
||||
qboolean renderToCubemap = tr.renderCubeFbo && glState.currentFBO == tr.renderCubeFbo;
|
||||
|
||||
ComputeDeformValues(&deformGen, deformParams);
|
||||
|
||||
ComputeFogValues(fogDistanceVector, fogDepthVector, &eyeT);
|
||||
|
@ -1186,13 +1188,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
|
||||
ComputeShaderColors(pStage, baseColor, vertColor, pStage->stateBits);
|
||||
|
||||
if ((backEnd.refdef.colorScale != 1.0f) && !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL))
|
||||
{
|
||||
// use VectorScale to only scale first three values, not alpha
|
||||
VectorScale(baseColor, backEnd.refdef.colorScale, baseColor);
|
||||
VectorScale(vertColor, backEnd.refdef.colorScale, vertColor);
|
||||
}
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_BASECOLOR, baseColor);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_VERTCOLOR, vertColor);
|
||||
}
|
||||
|
@ -1263,7 +1258,20 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_NORMALSCALE, pStage->normalScale);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_SPECULARSCALE, pStage->specularScale);
|
||||
|
||||
{
|
||||
vec4_t specularScale;
|
||||
Vector4Copy(pStage->specularScale, specularScale);
|
||||
|
||||
if (renderToCubemap)
|
||||
{
|
||||
// force specular to nonmetal if rendering cubemaps
|
||||
if (r_pbr->integer)
|
||||
specularScale[1] = 0.0f;
|
||||
}
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_SPECULARSCALE, pStage->specularScale);
|
||||
}
|
||||
|
||||
//GLSL_SetUniformFloat(sp, UNIFORM_MAPLIGHTSCALE, backEnd.refdef.mapLightScale);
|
||||
|
||||
|
|
Loading…
Reference in a new issue