Skip to content

Commit

Permalink
xrRender/blenders/Blender_detail_still.cpp: reduced duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Apr 27, 2023
1 parent c6fd76e commit 551a88c
Showing 1 changed file with 37 additions and 55 deletions.
92 changes: 37 additions & 55 deletions src/Layers/xrRender/blenders/Blender_detail_still.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,82 +38,64 @@ void CBlender_Detail_Still::Compile(CBlender_Compile& C)

void CBlender_Detail_Still::CompileFFP(CBlender_Compile& C) const
{
C.PassBegin();

C.PassSET_ZB(TRUE, TRUE);
if (oBlend.value)
C.PassSET_Blend_BLEND(TRUE, 200);
else
C.PassSET_Blend_SET(TRUE, 200);

if (ps_r1_ffp_lighting_mode == R1_FFP_LIGHTING_CONSTANT)
{
C.PassBegin();
{
C.PassSET_ZB(TRUE, TRUE);
if (oBlend.value)
C.PassSET_Blend_BLEND(TRUE, 200);
else
C.PassSET_Blend_SET(TRUE, 200);
C.PassSET_LightFog(TRUE, TRUE);
C.PassSET_LightFog(TRUE, TRUE);

// Stage1 - Base texture
C.StageBegin();
C.StageSET_Color(D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE);
C.StageSET_Alpha(D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE);
C.StageSET_TMC(oT_Name, "$null", "$null", 0);
C.StageEnd();
}
C.PassEnd();
// Stage1 - Base texture
C.StageBegin();
C.StageSET_Color(D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE);
C.StageSET_Alpha(D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE);
C.StageSET_TMC(oT_Name, "$null", "$null", 0);
C.StageEnd();
}
else
{
C.PassSET_LightFog(FALSE, FALSE);

switch (C.iElement)
{
case SE_R1_NORMAL_HQ:
case SE_R1_NORMAL_LQ:
{
C.PassBegin();
switch (C.iElement)
{
C.PassSET_ZB(TRUE, TRUE);
if (oBlend.value)
C.PassSET_Blend_BLEND(TRUE, 200);
else
C.PassSET_Blend_SET(TRUE, 200);
C.PassSET_LightFog(FALSE, FALSE);

switch (C.iElement)
{
case SE_R1_NORMAL_HQ: C.PassSET_Shaders("detail_wave", "null"); break;
case SE_R1_NORMAL_LQ: C.PassSET_Shaders("detail_still", "null"); break;
}

// Stage1 - Base texture
C.StageBegin();
C.StageSET_Color(D3DTA_TEXTURE, D3DTOP_MODULATE2X, D3DTA_DIFFUSE);
C.StageSET_Alpha(D3DTA_TEXTURE, D3DTOP_MODULATE2X, D3DTA_DIFFUSE);
C.StageSET_TMC(oT_Name, "$null", "$null", 0);
C.StageEnd();
case SE_R1_NORMAL_HQ: C.PassSET_Shaders("detail_wave", "null"); break;
case SE_R1_NORMAL_LQ: C.PassSET_Shaders("detail_still", "null"); break;
}
C.PassEnd();

// Stage1 - Base texture
C.StageBegin();
C.StageSET_Color(D3DTA_TEXTURE, D3DTOP_MODULATE2X, D3DTA_DIFFUSE);
C.StageSET_Alpha(D3DTA_TEXTURE, D3DTOP_MODULATE2X, D3DTA_DIFFUSE);
C.StageSET_TMC(oT_Name, "$null", "$null", 0);
C.StageEnd();
break;
}
case SE_R1_LMODELS:
{
C.PassBegin();
{
C.PassSET_ZB(TRUE, TRUE);
if (oBlend.value)
C.PassSET_Blend_BLEND(TRUE, 200);
else
C.PassSET_Blend_SET(TRUE, 200);
C.PassSET_LightFog(FALSE, FALSE);
C.PassSET_Shaders("detail_still", "null");

// Stage1 - Base texture
C.StageBegin();
C.StageSET_Color(D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
C.StageSET_Alpha(D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE);
C.StageSET_TMC(oT_Name, "$null", "$null", 0);
C.StageEnd();
}
C.PassEnd();
C.PassSET_Shaders("detail_still", "null");

// Stage1 - Base texture
C.StageBegin();
C.StageSET_Color(D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
C.StageSET_Alpha(D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE);
C.StageSET_TMC(oT_Name, "$null", "$null", 0);
C.StageEnd();
break;
}
} // switch (C.iElement)
}

C.PassEnd();
}

void CBlender_Detail_Still::CompileProgrammable(CBlender_Compile& C) const
Expand Down

1 comment on commit 551a88c

@Xottab-DUTY
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.