Skip to content

Commit

Permalink
RTSS: slightly simplify Lighting parameter resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Apr 30, 2019
1 parent c30aa23 commit c14f884
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,13 @@ bool PerPixelLighting::resolvePerLightParameters(ProgramSet* programSet)
break;

case Light::LT_POINT:
mWorldViewMatrix = vsProgram->resolveParameter(GpuProgramParameters::ACT_WORLDVIEW_MATRIX);
mVSInPosition = vsMain->resolveInputParameter(Parameter::SPC_POSITION_OBJECT_SPACE);
mLightParamsList[i].mPosition = psProgram->resolveParameter(GpuProgramParameters::ACT_LIGHT_POSITION_VIEW_SPACE, i);
mLightParamsList[i].mAttenuatParams = psProgram->resolveParameter(GpuProgramParameters::ACT_LIGHT_ATTENUATION, i);

needViewPos = true;
break;

case Light::LT_SPOTLIGHT:
mWorldViewMatrix = vsProgram->resolveParameter(GpuProgramParameters::ACT_WORLDVIEW_MATRIX);

mVSInPosition = vsMain->resolveInputParameter(Parameter::SPC_POSITION_OBJECT_SPACE);
mLightParamsList[i].mPosition = psProgram->resolveParameter(GpuProgramParameters::ACT_LIGHT_POSITION_VIEW_SPACE, i);
mLightParamsList[i].mDirection = psProgram->resolveParameter(GCT_FLOAT4, -1, (uint16)GPV_LIGHTS, "light_direction_view_space");
mLightParamsList[i].mPSInDirection = mLightParamsList[i].mDirection;
Expand Down Expand Up @@ -191,7 +186,10 @@ bool PerPixelLighting::resolvePerLightParameters(ProgramSet* programSet)

if (needViewPos)
{
mWorldViewMatrix = vsProgram->resolveParameter(GpuProgramParameters::ACT_WORLDVIEW_MATRIX);
mVSInPosition = vsMain->resolveInputParameter(Parameter::SPC_POSITION_OBJECT_SPACE);
mVSOutViewPos = vsMain->resolveOutputParameter(Parameter::SPC_POSITION_VIEW_SPACE);

mViewPos = psMain->resolveInputParameter(mVSOutViewPos);
mToLight = psMain->resolveLocalParameter(Parameter::SPC_LIGHTDIRECTION_VIEW_SPACE0);
mToView = psMain->resolveLocalParameter(Parameter::SPC_POSTOCAMERA_VIEW_SPACE);
Expand Down
10 changes: 0 additions & 10 deletions Components/RTShaderSystem/src/OgreShaderFFPLighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,6 @@ bool FFPLighting::resolveParameters(ProgramSet* programSet)
{
mOutSpecular = vsMain->resolveOutputParameter(Parameter::SPC_COLOR_SPECULAR);
}

if (mVSInPosition.get() == NULL)
{
mVSInPosition = vsMain->resolveInputParameter(Parameter::SPC_POSITION_OBJECT_SPACE);
}

if (mWorldViewMatrix.get() == NULL)
{
mWorldViewMatrix = vsProgram->resolveParameter(GpuProgramParameters::ACT_WORLDVIEW_MATRIX);
}
}
}

Expand Down

0 comments on commit c14f884

Please sign in to comment.