Add vector light support to forward materials.

This commit is contained in:
Areloch 2019-07-22 00:16:58 -05:00
parent 38b0d0f1fe
commit ebe2c2dead
11 changed files with 96 additions and 4 deletions

View file

@ -2235,6 +2235,22 @@ void RTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
lightSpotParams->arraySize = 4;
lightSpotParams->constSortPos = cspPotentialPrimitive;
Var* hasVectorLight = new Var("hasVectorLight", "int");
hasVectorLight->uniform = true;
hasVectorLight->constSortPos = cspPotentialPrimitive;
Var* vectorLightDirection = new Var("vectorLightDirection", "float4");
vectorLightDirection->uniform = true;
vectorLightDirection->constSortPos = cspPotentialPrimitive;
Var* vectorLightColor = new Var("vectorLightColor", "float4");
vectorLightColor->uniform = true;
vectorLightColor->constSortPos = cspPotentialPrimitive;
Var* vectorLightBrightness = new Var("vectorLightBrightness", "float");
vectorLightBrightness->uniform = true;
vectorLightBrightness->constSortPos = cspPotentialPrimitive;
Var* surface = getSurface(componentList, meta, fd);
if (!surface)
{
@ -2253,8 +2269,9 @@ void RTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
Var* lighting = new Var("lighting", "float4");
meta->addStatement(new GenOp(" @ = compute4Lights( @, @, @, @,\r\n"
" @, @, @);\r\n",
new DecOp(lighting), surface, lightMask, inLightPos, inLightConfigData, inLightColor, inLightSpotDir, lightSpotParams));
" @, @, @, @, @, @, @);\r\n",
new DecOp(lighting), surface, lightMask, inLightPos, inLightConfigData, inLightColor, inLightSpotDir, lightSpotParams,
hasVectorLight, vectorLightDirection, vectorLightColor, vectorLightBrightness));
meta->addStatement(new GenOp(" @.rgb += @.rgb;\r\n", curColor, lighting));