Skip to content

Commit

Permalink
Fixed display on HUD of transparent surfaces. Untested!
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Feb 10, 2018
1 parent b3c4ad8 commit 9ab3eae
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/Layers/xrRender/D3DXRenderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class D3DXRenderBase : public IRender, public pureFrame
R_dsgraph::mapHUD_T mapHUD;
R_dsgraph::mapLOD_T mapLOD;
R_dsgraph::mapSorted_T mapDistort;
R_dsgraph::mapHUD_T mapHUDSorted;

#if RENDER != R_R1
R_dsgraph::mapSorted_T mapWmark; // sorted
Expand Down Expand Up @@ -142,10 +143,12 @@ class D3DXRenderBase : public IRender, public pureFrame
mapHUD.clear();
mapLOD.clear();
mapDistort.clear();
mapHUDSorted.clear();

#if RENDER != R_R1
mapWmark.clear();
mapEmissive.clear();
mapHUDEmissive.clear();
#endif
}

Expand Down
15 changes: 6 additions & 9 deletions src/Layers/xrRender/r__dsgraph_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,14 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic(dxRender_Visual* pVisual, Fvector&
if (RI.val_bHUD)
{
if (sh->flags.bStrictB2F)
{
mapSorted.emplace_back(std::make_pair(distSQ, _MatrixItemS({ SSA, RI.val_pObject, pVisual, *RI.val_pTransform, sh })));
}
mapHUDSorted.emplace_back(std::make_pair(distSQ, _MatrixItemS({ SSA, RI.val_pObject, pVisual, *RI.val_pTransform, sh })));
else
{
mapHUD.emplace_back(std::make_pair(distSQ, _MatrixItemS({ SSA, RI.val_pObject, pVisual, *RI.val_pTransform, sh })));
mapHUD .emplace_back(std::make_pair(distSQ, _MatrixItemS({ SSA, RI.val_pObject, pVisual, *RI.val_pTransform, sh })));

#if RENDER != R_R1
if (sh->flags.bEmissive)
mapHUDEmissive.emplace_back(std::make_pair(distSQ, _MatrixItemS({ SSA, RI.val_pObject, pVisual, *RI.val_pTransform, sh_d }))); // sh_d -> L_special
#endif // RENDER!=R_R1
}
if (sh->flags.bEmissive)
mapHUDEmissive.emplace_back(std::make_pair(distSQ, _MatrixItemS({ SSA, RI.val_pObject, pVisual, *RI.val_pTransform, sh_d }))); // sh_d -> L_special
#endif
return;
}

Expand Down
28 changes: 25 additions & 3 deletions src/Layers/xrRender/r__dsgraph_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ void D3DXRenderBase::r_dsgraph_render_hud_ui()
{
VERIFY(g_hud && g_hud->RenderActiveItemUIQuery());

extern ENGINE_API float psHUD_FOV;

PIX_EVENT(r_dsgraph_render_hud_ui);

extern ENGINE_API float psHUD_FOV;

// Change projection
Fmatrix Pold = Device.mProject;
Fmatrix FTold = Device.mFullTransform;
Expand Down Expand Up @@ -435,6 +435,29 @@ void D3DXRenderBase::r_dsgraph_render_sorted()
for (auto &i : mapSorted)
sorted_L1(i);
mapSorted.clear();

extern ENGINE_API float psHUD_FOV;

// Change projection
Fmatrix Pold = Device.mProject;
Fmatrix FTold = Device.mFullTransform;
Device.mProject.build_projection(deg2rad(psHUD_FOV * Device.fFOV /* *Device.fASPECT*/), Device.fASPECT,
VIEWPORT_NEAR, g_pGamePersistent->Environment().CurrentEnv->far_plane);

Device.mFullTransform.mul(Device.mProject, Device.mView);
RCache.set_xform_project(Device.mProject);

// Rendering
rmNear();
std::sort(mapHUDSorted.begin(), mapHUDSorted.end(), cmp_first_h<R_dsgraph::mapSorted_T::value_type>); // back-to-front
for (auto &i : mapHUDSorted)
sorted_L1(i);
rmNormal();

// Restore projection
Device.mProject = Pold;
Device.mFullTransform = FTold;
RCache.set_xform_project(Device.mProject);
}

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -467,7 +490,6 @@ void D3DXRenderBase::r_dsgraph_render_emissive()
for (auto &i : mapHUDEmissive)
sorted_L1(i);
mapHUDEmissive.clear();

rmNormal();

// Restore projection
Expand Down

0 comments on commit 9ab3eae

Please sign in to comment.