conform some of the "specularColor" entries (TODO: matinfo flags, like emissive/glow ect)

This commit is contained in:
AzaezelX 2019-04-10 12:56:20 -05:00
parent 15ca6eabb4
commit ed385ff342

View file

@ -3177,22 +3177,34 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
meta->addStatement(new GenOp(" @ = float4(1.0,1.0,1.0,1.0);\r\n", colorDecl)); //default to flat white meta->addStatement(new GenOp(" @ = float4(1.0,1.0,1.0,1.0);\r\n", colorDecl)); //default to flat white
} }
Var *specularColor = (Var*)LangElement::find("specularColor"); Var *matinfo = (Var*)LangElement::find("specularColor");
if (!specularColor) if (!matinfo)
{ {
specularColor = new Var; Var* metalness = (Var*)LangElement::find("metalness");
specularColor->setType("float4"); if (!metalness)
specularColor->setName("specularColor"); {
LangElement* colorDecl = new DecOp(specularColor); metalness = new Var("metalness", "float");
meta->addStatement(new GenOp(" @ = float4(0.0,0.0,1.0,0.0);\r\n", colorDecl)); //default to no flag, no rough or metal, no ao darkening metalness->uniform = true;
metalness->constSortPos = cspPotentialPrimitive;
}
Var* smoothness = (Var*)LangElement::find("smoothness");
if (!smoothness)
{
smoothness = new Var("smoothness", "float");
smoothness->uniform = true;
smoothness->constSortPos = cspPotentialPrimitive;
}
matinfo = new Var("specularColor", "float4");
LangElement* colorDecl = new DecOp(matinfo);
meta->addStatement(new GenOp(" @ = float4(0.0,@,1.0,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
} }
Var *bumpNormal = (Var*)LangElement::find("bumpNormal"); Var *bumpNormal = (Var*)LangElement::find("bumpNormal");
if (!bumpNormal) if (!bumpNormal)
{ {
bumpNormal = new Var; bumpNormal = new Var("bumpNormal", "float4");
bumpNormal->setType("float4");
bumpNormal->setName("bumpNormal");
LangElement* colorDecl = new DecOp(bumpNormal); LangElement* colorDecl = new DecOp(bumpNormal);
meta->addStatement(new GenOp(" @ = float4(1.0,0.0,0.0,0.0);\r\n", colorDecl)); //default to identiry normal meta->addStatement(new GenOp(" @ = float4(1.0,0.0,0.0,0.0);\r\n", colorDecl)); //default to identiry normal
} }
@ -3211,7 +3223,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
//Reflection vec //Reflection vec
Var *surface = new Var("surface", "Surface"); Var *surface = new Var("surface", "Surface");
meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, bumpNormal, specularColor, meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, bumpNormal, matinfo,
inTex, wsPosition, wsEyePos, wsView, worldToCamera)); inTex, wsPosition, wsEyePos, wsView, worldToCamera));
meta->addStatement(new GenOp(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t@,@,@,@,@,\r\n\t\t@,@,@,@,@,@).rgb;\r\n", albedo, meta->addStatement(new GenOp(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t@,@,@,@,@,\r\n\t\t@,@,@,@,@,@).rgb;\r\n", albedo,