Skip to content

Commit 049dfca

Browse files
committed
Actor shadow added
Implementation by K.D.
1 parent 42fbd81 commit 049dfca

File tree

12 files changed

+41
-9
lines changed

12 files changed

+41
-9
lines changed

src/Layers/xrRender/r__dsgraph_render.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,9 @@ void R_dsgraph_structure::r_dsgraph_render_subspace (IRender_Sector* _sector, CF
715715
renderable->renderable_Render ();
716716
}
717717
}
718+
#if RENDER!=R_R1
719+
if (g_pGameLevel && (phase==RImplementation.PHASE_SMAP) && ps_common_flags.test(RFLAG_ACTOR_SHADOW)) g_pGameLevel->pHUD->Render_Actor_Shadow(); // Actor Shadow
720+
#endif
718721
}
719722

720723
// Restore

src/Layers/xrRender/xrRender_console.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,9 @@ void xrRender_initconsole ()
701701
#endif // DEBUG
702702

703703
CMD2(CCC_tf_Aniso, "r__tf_aniso", &ps_r__tf_Anisotropic ); // {1..16}
704-
704+
705+
CMD3(CCC_Mask, "r__actor_shadow", &ps_common_flags, RFLAG_ACTOR_SHADOW ); //Swartz27
706+
705707
// R1
706708
CMD4(CCC_Float, "r1_ssa_lod_a", &ps_r1_ssaLOD_A, 16, 96 );
707709
CMD4(CCC_Float, "r1_ssa_lod_b", &ps_r1_ssaLOD_B, 16, 64 );

src/Layers/xrRender/xrRender_console.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ enum
195195
R2FLAGEXT_SUN_OLD = (1<<9),
196196
};
197197

198+
enum
199+
{
200+
RFLAG_ACTOR_SHADOW = (1<<0),
201+
};
202+
198203
extern void xrRender_initconsole ();
199204
extern BOOL xrRender_test_hw ();
200205
extern void xrRender_apply_tf ();

src/Layers/xrRenderPC_R1/FStaticRender.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ void CRender::Calculate ()
439439

440440
// Determine visibility for dynamic part of scene
441441
set_Object (0);
442-
g_hud->Render_First ( ); // R1 shadows
442+
//g_hud->Render_First ( ); // R1 shadows
443+
if (ps_common_flags.test(RFLAG_ACTOR_SHADOW)) g_hud->Render_First ( ); // R1 shadows
443444
g_hud->Render_Last ( );
444445
u32 uID_LTRACK = 0xffffffff;
445446
if (phase==PHASE_NORMAL) {

src/Layers/xrRenderPC_R1/FStaticRender.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ class CRender : public R_dsgraph_structure
207207
virtual void rmNear ();
208208
virtual void rmFar ();
209209
virtual void rmNormal ();
210+
virtual u32 active_phase () {return phase;};
210211

211212
// Constructor/destructor/loader
212213
CRender ();

src/Layers/xrRenderPC_R2/r2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ class CRender : public R_dsgraph_structure
306306
virtual void rmNear ();
307307
virtual void rmFar ();
308308
virtual void rmNormal ();
309+
virtual u32 active_phase () {return phase;};
309310

310311
// Constructor/destructor/loader
311312
CRender ();

src/Layers/xrRenderPC_R3/r3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ class CRender : public R_dsgraph_structure
340340
virtual void rmNear ();
341341
virtual void rmFar ();
342342
virtual void rmNormal ();
343+
virtual u32 active_phase () {return phase;};
343344

344345
// Constructor/destructor/loader
345346
CRender ();

src/Layers/xrRenderPC_R4/r4.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ class CRender : public R_dsgraph_structure
341341
virtual void rmNear ();
342342
virtual void rmFar ();
343343
virtual void rmNormal ();
344-
344+
virtual u32 active_phase () {return phase;};
345+
345346
// Constructor/destructor/loader
346347
CRender ();
347348
virtual ~CRender ();

src/xrGame/Actor.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,11 +1375,14 @@ void CActor::renderable_Render ()
13751375
{
13761376
VERIFY(_valid(XFORM()));
13771377
inherited::renderable_Render ();
1378-
if(1/*!HUDview()*/)
1379-
{
1378+
if ((cam_active==eacFirstEye && // first eye cam
1379+
::Render->get_generation() == ::Render->GENERATION_R2 && // R2
1380+
::Render->active_phase() == 1) // shadow map rendering on R2
1381+
||
1382+
!(IsFocused() && (cam_active==eacFirstEye) &&
1383+
((!m_holder) || (m_holder && m_holder->allowWeapon() && m_holder->HUDView())))
1384+
)
13801385
CInventoryOwner::renderable_Render ();
1381-
}
1382-
VERIFY(_valid(XFORM()));
13831386
}
13841387

13851388
BOOL CActor::renderable_ShadowGenerate ()

src/xrGame/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ struct SDefNewsMsg{
311311
CActorCameraManager& Cameras () {VERIFY(m_pActorEffector); return *m_pActorEffector;}
312312
IC CCameraBase* cam_Active () {return cameras[cam_active];}
313313
IC CCameraBase* cam_FirstEye () {return cameras[eacFirstEye];}
314-
314+
IC EActorCameras active_cam () {return cam_active;} // KD: need to know which cam active outside actor methods
315315
protected:
316316
virtual void cam_Set (EActorCameras style);
317317
void cam_Update (float dt, float fFOV);

0 commit comments

Comments
 (0)