-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add files from OpenGL render by Armada
- Loading branch information
1 parent
1bfc3d2
commit 85a35db
Showing
100 changed files
with
19,596 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include "stdafx.h" | ||
#pragma hdrstop | ||
|
||
#include "Layers/xrRender/ResourceManager.h" | ||
#include "Layers/xrRender/blenders/Blender_Recorder.h" | ||
#include "Layers/xrRender/blenders/Blender.h" | ||
#include "Layers/xrRender/tss.h" | ||
|
||
void fix_texture_name(LPSTR fn); | ||
|
||
void CBlender_Compile::r_Stencil(BOOL Enable, u32 Func, u32 Mask, u32 WriteMask, u32 Fail, u32 Pass, u32 ZFail) | ||
{ | ||
RS.SetRS( D3DRS_STENCILENABLE, BC(Enable) ); | ||
if (!Enable) return; | ||
RS.SetRS( D3DRS_STENCILFUNC, Func); | ||
RS.SetRS( D3DRS_STENCILMASK, Mask); | ||
RS.SetRS( D3DRS_STENCILWRITEMASK, WriteMask); | ||
RS.SetRS( D3DRS_STENCILFAIL, Fail); | ||
RS.SetRS( D3DRS_STENCILPASS, Pass); | ||
RS.SetRS( D3DRS_STENCILZFAIL, ZFail); | ||
} | ||
|
||
void CBlender_Compile::r_StencilRef(u32 Ref) | ||
{ | ||
RS.SetRS( D3DRS_STENCILREF, Ref); | ||
} | ||
|
||
void CBlender_Compile::r_CullMode(D3DCULL Mode) | ||
{ | ||
RS.SetRS( D3DRS_CULLMODE, (u32)Mode); | ||
} | ||
|
||
void CBlender_Compile::i_Comparison(u32 s, u32 func) | ||
{ | ||
RS.SetSAMP(s, XRDX10SAMP_COMPARISONFILTER, TRUE); | ||
RS.SetSAMP(s, XRDX10SAMP_COMPARISONFUNC, func); | ||
} | ||
|
||
void CBlender_Compile::r_Sampler_cmp(LPCSTR name, LPCSTR texture, bool b_ps1x_ProjectiveDivide) | ||
{ | ||
u32 s = r_Sampler(name, texture, b_ps1x_ProjectiveDivide, D3DTADDRESS_CLAMP, D3DTEXF_LINEAR, D3DTEXF_NONE, D3DTEXF_LINEAR); | ||
if (u32(-1) != s) | ||
{ | ||
RS.SetSAMP(s, XRDX10SAMP_COMPARISONFILTER, TRUE); | ||
RS.SetSAMP(s, XRDX10SAMP_COMPARISONFUNC, (u32)D3D_COMPARISON_LESS_EQUAL); | ||
} | ||
} | ||
|
||
void CBlender_Compile::r_Pass (LPCSTR _vs, LPCSTR _gs, LPCSTR _ps, bool bFog, BOOL bZtest, BOOL bZwrite, BOOL bABlend, D3DBLEND abSRC, D3DBLEND abDST, BOOL aTest, u32 aRef) | ||
{ | ||
RS.Invalidate (); | ||
ctable.clear (); | ||
passTextures.clear (); | ||
passMatrices.clear (); | ||
passConstants.clear (); | ||
dwStage = 0; | ||
|
||
// Setup FF-units (Z-buffer, blender) | ||
PassSET_ZB (bZtest,bZwrite); | ||
PassSET_Blend (bABlend,abSRC,abDST,aTest,aRef); | ||
PassSET_LightFog (FALSE,bFog); | ||
|
||
// Create shaders | ||
SPS* ps = RImplementation.Resources->_CreatePS(_ps); | ||
SVS* vs = RImplementation.Resources->_CreateVS(_vs); | ||
SGS* gs = RImplementation.Resources->_CreateGS(_gs); | ||
dest.ps = ps; | ||
dest.vs = vs; | ||
dest.gs = gs; | ||
#ifdef USE_DX11 | ||
dest.hs = RImplementation.Resources->_CreateHS("null"); | ||
dest.ds = RImplementation.Resources->_CreateDS("null"); | ||
#endif | ||
ctable.merge (&ps->constants); | ||
ctable.merge (&vs->constants); | ||
ctable.merge (&gs->constants); | ||
|
||
// Last Stage - disable | ||
if (0==stricmp(_ps,"null")) { | ||
RS.SetTSS (0,D3DTSS_COLOROP,D3DTOP_DISABLE); | ||
RS.SetTSS (0,D3DTSS_ALPHAOP,D3DTOP_DISABLE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
#include "stdafx.h" | ||
#include "./glRainBlender.h" | ||
|
||
void CBlender_rain::Compile(CBlender_Compile& C) | ||
{ | ||
IBlender::Compile (C); | ||
|
||
switch (C.iElement) | ||
{ | ||
case 0: // Test | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, FALSE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
jitter (C); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
C.r_Sampler ("s_water", "water\\water_normal"); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
|
||
case 1: // Patch normals | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_patch_normal_nomsaa", false, TRUE, FALSE, FALSE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
//C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
C.r_Sampler_rtf ("s_diffuse", r2_RT_albedo); | ||
|
||
jitter (C); | ||
|
||
// C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
//C.r_Sampler ("s_water", "water\\water_normal"); | ||
|
||
C.r_Sampler ("s_water", "water\\water_SBumpVolume"); | ||
//C.r_Sampler ("s_waterFall", "water\\water_normal"); | ||
C.r_Sampler ("s_waterFall", "water\\water_flowing_nmap"); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
|
||
case 2: // Apply normals | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_apply_normal_nomsaa", false, TRUE, FALSE, FALSE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
//C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
//C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
jitter (C); | ||
|
||
// C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
C.r_Sampler ("s_patched_normal", r2_RT_accum); | ||
|
||
// Normal can be packed into R and G | ||
if (RImplementation.o.dx10_gbuffer_opt) | ||
C.r_ColorWriteEnable( true, true, false, false ); | ||
else | ||
C.r_ColorWriteEnable( true, true, true, false ); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
|
||
case 3: // Apply gloss | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_apply_gloss_nomsaa", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
//C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
//C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
jitter (C); | ||
|
||
// C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
C.r_Sampler ("s_patched_normal", r2_RT_accum); | ||
|
||
//C.r_ColorWriteEnable( false, false, false, true ); | ||
|
||
C.RS.SetRS(D3DRS_SRCBLEND, D3DBLEND_ZERO ); | ||
C.RS.SetRS(D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR ); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
} | ||
} | ||
|
||
void CBlender_rain_msaa::SetDefine( LPCSTR Name, LPCSTR Definition ) | ||
{ | ||
this->Name = Name; | ||
this->Definition = Definition; | ||
} | ||
|
||
void CBlender_rain_msaa::Compile(CBlender_Compile& C) | ||
{ | ||
IBlender::Compile (C); | ||
|
||
if( Name ) | ||
GEnv.Render->m_MSAASample = atoi( Definition ); | ||
else | ||
GEnv.Render->m_MSAASample = -1; | ||
|
||
switch (C.iElement) | ||
{ | ||
case 0: // Patch normals | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_patch_normal_msaa", false, TRUE, FALSE, FALSE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
//C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
C.r_Sampler_rtf ("s_diffuse", r2_RT_albedo); | ||
|
||
jitter (C); | ||
|
||
// C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
//C.r_Sampler ("s_water", "water\\water_normal"); | ||
|
||
C.r_Sampler ("s_water", "water\\water_SBumpVolume"); | ||
//C.r_dx10Texture ("s_waterFall", "water\\water_normal"); | ||
C.r_Sampler ("s_waterFall", "water\\water_flowing_nmap"); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
|
||
case 1: // Apply normals | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_apply_normal_msaa", false, TRUE, FALSE, FALSE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
//C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
//C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
jitter (C); | ||
|
||
// C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
C.r_Sampler("s_patched_normal", r2_RT_accum); | ||
|
||
// Normal can be packed into R and G | ||
if (RImplementation.o.dx10_gbuffer_opt) | ||
C.r_ColorWriteEnable( true, true, false, false ); | ||
else | ||
C.r_ColorWriteEnable( true, true, true, false ); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
|
||
case 2: // Apply gloss | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
//C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); | ||
C.r_Pass ("stub_notransform_2uv", "rain_apply_gloss_msaa", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); | ||
C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer | ||
|
||
C.r_Sampler_rtf ("s_position", r2_RT_P); | ||
//C.r_Sampler_rtf ("s_normal", r2_RT_N); | ||
C.r_Sampler_clw ("s_material", r2_material); | ||
//C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); | ||
C.r_Sampler ("s_lmap", r2_sunmask); | ||
C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); | ||
|
||
jitter (C); | ||
|
||
// C.r_Sampler ("s_water", "water\\water_water"); | ||
|
||
//C.r_Sampler ("s_water", "water\\water_studen"); | ||
C.r_Sampler("s_patched_normal", r2_RT_accum); | ||
|
||
//C.r_ColorWriteEnable( false, false, false, true ); | ||
|
||
C.RS.SetRS(D3DRS_SRCBLEND, D3DBLEND_ZERO ); | ||
C.RS.SetRS(D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR ); | ||
|
||
C.r_End (); | ||
|
||
break; | ||
} | ||
GEnv.Render->m_MSAASample = -1; | ||
} | ||
|
Oops, something went wrong.