Skip to content

Commit

Permalink
Added actor shadow (by K.D.) which is enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Mar 31, 2019
1 parent b8fd8b9 commit 794976d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cs/engine/layers/xrRender/r__dsgraph_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,10 @@ void R_dsgraph_structure::r_dsgraph_render_subspace (IRender_Sector* _sector, CF
renderable->renderable_Render ();
}
}
#if RENDER!=R_R1
if (g_pGameLevel && (phase == RImplementation.PHASE_SMAP) && ps_r2_ls_flags_ext.test(R2FLAGEXT_ACTOR_SHADOW))
g_pGameLevel->pHUD->Render_Actor_Shadow();
#endif
}

// Restore
Expand Down
3 changes: 3 additions & 0 deletions cs/engine/layers/xrRender/xrRender_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Flags32 ps_r2_ls_flags = { R2FLAG_SUN

Flags32 ps_r2_ls_flags_ext = {
/*R2FLAGEXT_SSAO_OPT_DATA |*/ R2FLAGEXT_SSAO_HALF_DATA
| R2FLAGEXT_ACTOR_SHADOW
};

float ps_r2_df_parallax_h = 0.02f;
Expand Down Expand Up @@ -601,6 +602,8 @@ void xrRender_initconsole ()

CMD2(CCC_tf_Aniso, "r__tf_aniso", &ps_r__tf_Anisotropic ); // {1..16}

CMD3(CCC_Mask, "r__actor_shadow", &ps_r2_ls_flags_ext, R2FLAGEXT_ACTOR_SHADOW);

// R1
CMD4(CCC_Float, "r1_ssa_lod_a", &ps_r1_ssaLOD_A, 16, 96 );
CMD4(CCC_Float, "r1_ssa_lod_b", &ps_r1_ssaLOD_B, 16, 64 );
Expand Down
3 changes: 2 additions & 1 deletion cs/engine/layers/xrRender/xrRender_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ enum
R2FLAGEXT_SSAO_OPT_DATA = (1<<1),
R2FLAGEXT_SSAO_HALF_DATA = (1<<2),
R2FLAGEXT_SSAO_HBAO = (1<<3),
R2FLAGEXT_SSAO_HDAO = (1<<4)
R2FLAGEXT_SSAO_HDAO = (1<<4),
R2FLAGEXT_ACTOR_SHADOW = (1<<5)
};

extern void xrRender_initconsole ();
Expand Down
3 changes: 2 additions & 1 deletion cs/engine/xrEngine/CustomHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ENGINE_API CCustomHUD:

virtual void Render_First (){;}
virtual void Render_Last (){;}

virtual void Render_Actor_Shadow (){;}

virtual void OnFrame (){;}
virtual void OnEvent (EVENT E, u64 P1, u64 P2){;}

Expand Down
1 change: 1 addition & 0 deletions cs/engine/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ struct SDefNewsMsg{
CActorCameraManager& Cameras () {VERIFY(m_pActorEffector); return *m_pActorEffector;}
IC CCameraBase* cam_Active () {return cameras[cam_active];}
IC CCameraBase* cam_FirstEye () {return cameras[eacFirstEye];}
IC EActorCameras activeCam () { return cam_active; }

protected:
virtual void cam_Set (EActorCameras style);
Expand Down
24 changes: 24 additions & 0 deletions cs/engine/xrGame/HUDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,30 @@ void CHUDManager::Render_Last()
::Render->set_HUD (FALSE);
}

void CHUDManager::Render_Actor_Shadow()
{
if (NULL == pUI)
return;

CObject* O = g_pGameLevel->CurrentViewEntity();
if (NULL == O)
return;

CActor* A = smart_cast<CActor*> (O);
if (!A)
return;

// KD: we need to render actor shadow only in first eye cam mode because
// in other modes actor model already in scene graph and renders well
if (A->activeCam() != eacFirstEye)
return;
::Render->set_Object(O->H_Root());
//O->renderable_Render();
//хак, чтобы были тени от приаттаченных предметов
A->CEntityAlive::renderable_Render();
A->CInventoryOwner::renderable_Render();
}

#include "player_hud.h"
bool CHUDManager::RenderActiveItemUIQuery()
{
Expand Down
2 changes: 2 additions & 0 deletions cs/engine/xrGame/HUDManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class CHUDManager :

virtual void Render_First ();
virtual void Render_Last ();
virtual void Render_Actor_Shadow ();

virtual void OnFrame ();

virtual void RenderUI ();
Expand Down

0 comments on commit 794976d

Please sign in to comment.