Skip to content

Commit a5f29f1

Browse files
committed
Grass shadows restored
Grass shadows implementation by K.D., ported to COP from SOC.
1 parent b2472ee commit a5f29f1

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

Layers/xrRender/DetailManager_VS.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,12 @@ void CDetailManager::hw_Render_dump (ref_constant x_array, u32 var_id, u32 lod_
319319
RCache.stat.r.s_details.add (dwCNT_verts);
320320
}
321321
// Clean up
322-
vis.clear_not_free ();
322+
// KD: we must not clear vis on r2 since we want details shadows
323+
#if RENDER!=R_R1
324+
if ((ps_r2_ls_flags.test(R2FLAG_SUN_DETAILS) && (RImplementation.PHASE_SMAP == RImplementation.phase)) // phase_smap
325+
|| (!ps_r2_ls_flags.test(R2FLAG_SUN_DETAILS) && (RImplementation.PHASE_NORMAL == RImplementation.phase))) // phase_normal
326+
#endif
327+
vis.clear_not_free ();
323328
}
324329
vOffset += hw_BatchSize * Object.number_vertices;
325330
iOffset += hw_BatchSize * Object.number_indices;

Layers/xrRenderPC_R2/blender_deffer_aref.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,24 @@ void CBlender_deffer_aref::Compile(CBlender_Compile& C)
4141
case SE_R2_NORMAL_HQ:
4242
case SE_R2_NORMAL_LQ:
4343
if (lmapped) {
44-
C.r_Pass ("lmapE","lmapE",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
44+
C.r_Pass ("lmapE","lmapE",TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
4545
C.r_Sampler ("s_base", C.L_textures[0] );
4646
C.r_Sampler ("s_lmap", C.L_textures[1] );
4747
C.r_Sampler_clf ("s_hemi", *C.L_textures[2]);
4848
C.r_Sampler ("s_env", r2_T_envs0, false,D3DTADDRESS_CLAMP);
4949
C.r_End ();
5050
} else {
51-
C.r_Pass ("vert", "vert", TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
51+
C.r_Pass ("vert", "vert", TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
5252
C.r_Sampler ("s_base", C.L_textures[0] );
5353
C.r_End ();
5454
}
5555
break;
56+
case SE_R2_SHADOW: // smap
57+
if (RImplementation.o.HW_smap) C.r_Pass ("shadow_direct_base_aref","shadow_direct_base_aref",FALSE,TRUE,TRUE,FALSE,D3DBLEND_ZERO,D3DBLEND_ONE,TRUE,220);
58+
else C.r_Pass ("shadow_direct_base_aref","shadow_direct_base_aref",FALSE);
59+
C.r_Sampler ("s_base",C.L_textures[0]);
60+
C.r_End ();
61+
break;
5662
default:
5763
break;
5864
}

Layers/xrRenderPC_R3/blender_deffer_aref.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void CBlender_deffer_aref::Compile(CBlender_Compile& C)
4343
case SE_R2_NORMAL_LQ:
4444
if (lmapped)
4545
{
46-
C.r_Pass ("lmapE","lmapE",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
46+
C.r_Pass ("lmapE","lmapE",TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
4747
//C.r_Sampler ("s_base", C.L_textures[0] );
4848
//C.r_Sampler ("s_lmap", C.L_textures[1] );
4949
//C.r_Sampler_clf ("s_hemi", *C.L_textures[2]);
@@ -61,13 +61,21 @@ void CBlender_deffer_aref::Compile(CBlender_Compile& C)
6161
}
6262
else
6363
{
64-
C.r_Pass ("vert", "vert", TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
64+
C.r_Pass ("vert", "vert", TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
6565
//C.r_Sampler ("s_base", C.L_textures[0] );
6666
C.r_dx10Texture ("s_base", C.L_textures[0]);
6767
C.r_dx10Sampler ("smp_base");
6868
C.r_End ();
6969
}
7070
break;
71+
case SE_R2_SHADOW: // smap
72+
C.r_Pass ("shadow_direct_base_aref","shadow_direct_base_aref", FALSE,TRUE,TRUE,FALSE);
73+
C.r_dx10Texture ("s_base",C.L_textures[0]);
74+
C.r_dx10Sampler ("smp_base");
75+
C.r_dx10Sampler ("smp_linear");
76+
C.r_ColorWriteEnable(false, false, false, false);
77+
C.r_End ();
78+
break;
7179
default:
7280
break;
7381
}

Layers/xrRenderPC_R4/blender_deffer_aref.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void CBlender_deffer_aref::Compile(CBlender_Compile& C)
4343
case SE_R2_NORMAL_LQ:
4444
if (lmapped)
4545
{
46-
C.r_Pass ("lmapE","lmapE",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
46+
C.r_Pass ("lmapE","lmapE",TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
4747
//C.r_Sampler ("s_base", C.L_textures[0] );
4848
//C.r_Sampler ("s_lmap", C.L_textures[1] );
4949
//C.r_Sampler_clf ("s_hemi", *C.L_textures[2]);
@@ -61,13 +61,21 @@ void CBlender_deffer_aref::Compile(CBlender_Compile& C)
6161
}
6262
else
6363
{
64-
C.r_Pass ("vert", "vert", TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
64+
C.r_Pass ("vert", "vert", TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value);
6565
//C.r_Sampler ("s_base", C.L_textures[0] );
6666
C.r_dx10Texture ("s_base", C.L_textures[0]);
6767
C.r_dx10Sampler ("smp_base");
6868
C.r_End ();
6969
}
7070
break;
71+
case SE_R2_SHADOW: // smap
72+
C.r_Pass ("shadow_direct_base_aref","shadow_direct_base_aref", FALSE,TRUE,TRUE,FALSE);
73+
C.r_dx10Texture ("s_base",C.L_textures[0]);
74+
C.r_dx10Sampler ("smp_base");
75+
C.r_dx10Sampler ("smp_linear");
76+
C.r_ColorWriteEnable(false, false, false, false);
77+
C.r_End ();
78+
break;
7179
default:
7280
break;
7381
}

0 commit comments

Comments
 (0)