preliminary glowmap+glowmul feature augmentation math

This commit is contained in:
AzaezelX 2019-10-30 18:29:11 -05:00
parent f284524dd0
commit 070a9845a2
6 changed files with 22 additions and 2 deletions

View file

@ -83,7 +83,7 @@ void PBRConfigMapHLSL::processPix( Vector<ShaderComponent*> &componentList, cons
pbrConfigMapTex->uniform = true;
pbrConfigMapTex->texture = true;
pbrConfigMapTex->constNum = pbrConfigMap->constNum;
LangElement *texOp = new GenOp(" @.Sample(@, @)", pbrConfigMapTex, pbrConfigMap, texCoord);
LangElement *texOp = new GenOp("@.Sample(@, @)", pbrConfigMapTex, pbrConfigMap, texCoord);
Var *metalness = (Var*)LangElement::find("metalness");
if (!metalness) metalness = new Var("metalness", "float");
@ -103,6 +103,21 @@ void PBRConfigMapHLSL::processPix( Vector<ShaderComponent*> &componentList, cons
}
meta->addStatement(new GenOp(" @ = @.g;\r\n", new DecOp(ao), pbrConfig));
meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(metalness), pbrConfig));
if (fd.features[MFT_GlowMap])
{
Var* glowMul = new Var("glowMul", "float");
glowMul->uniform = true;
glowMul->constSortPos = cspPotentialPrimitive;
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
if (fd.features[MFT_isDeferred])
targ = ShaderFeature::RenderTarget1;
Var* diffuseColor = (Var*)LangElement::find(getOutputTargetVarName(targ));
if (diffuseColor)
meta->addStatement(new GenOp(" @.rgb += @.rgb*float3(@,@,@)*@.aaa;\r\n", diffuseColor, diffuseColor, glowMul, glowMul, glowMul, texOp));
}
output = meta;
}