void CBlender_bloom_build::Compile (CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // transfer into bloom-target C.r_Pass ("null", "bloom_build", FALSE, FALSE, FALSE, FALSE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); C.r_Sampler_clf ("s_image", r2_RT_generic1); C.r_End (); break; case 1: // X-filter C.r_Pass ("null", "bloom_filter", FALSE, FALSE, FALSE); C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); C.r_End (); break; case 2: // Y-filter C.r_Pass ("null", "bloom_filter", FALSE, FALSE, FALSE); C.r_Sampler_clf ("s_bloom", r2_RT_bloom2); C.r_End (); break; case 3: // FF-filter_P0 C.r_Pass ("null", "bloom_filter_f", FALSE, FALSE, FALSE); C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); C.r_End (); break; case 4: // FF-filter_P1 C.r_Pass ("null", "bloom_filter_f", FALSE, FALSE, FALSE); C.r_Sampler_clf ("s_bloom", r2_RT_bloom2); C.r_End (); break; } }
// TODO: DX10: if nesessary for NV stencil optimisation implement pass 1 void CBlender_light_occq::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // occlusion testing C.r_Pass ("dumb", "dumb",false,TRUE,FALSE,FALSE); C.r_End (); // Color write as well as culling and stencil are set up manually in code. break; case 1: // NV40 optimization :) C.r_Pass ("stub_notransform_t", "dumb",false,FALSE,FALSE,FALSE); C.r_ColorWriteEnable (false,false,false,false); C.r_CullMode (D3DCULL_NONE); C.r_Stencil (TRUE,D3DCMP_LESSEQUAL,0xff,0x00); // keep/keep/keep C.r_End (); break; case 2: // Stencil clear in case we've ran out of markers. C.r_Pass ("stub_notransform_t", "dumb",false,FALSE,FALSE,FALSE); C.r_ColorWriteEnable (false,false,false,false); C.r_CullMode (D3DCULL_NONE); if( RImplementation.o.dx10_msaa ) C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0x7E, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO); else { // Clear all bits except the last one C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0xFE, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO); } //C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0xFF, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO); // keep/keep/keep C.r_End (); break; } }
void CBlender_Model_EbB::Compile( CBlender_Compile& C ) { IBlender::Compile(C); if (oBlend.value) { // forward LPCSTR vsname = 0; LPCSTR psname = 0; switch(C.iElement) { case 0: case 1: vsname = psname = "model_env_lq"; C.r_Pass (vsname,psname,TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); //C.r_Sampler ("s_base", C.L_textures[0]); //C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_dx10Texture ("s_base", C.L_textures[0]); C.r_dx10Texture ("s_env", oT2_Name); C.r_dx10Sampler ("smp_base"); C.r_dx10Sampler ("smp_rtlinear"); C.r_End (); break; } } else { // deferred switch(C.iElement) { case SE_R2_NORMAL_HQ: // deffer uber_deffer (C,true, "model","base",false,0,true); C.r_Stencil ( TRUE,D3DCMP_ALWAYS,0xff,0x7f,D3DSTENCILOP_KEEP,D3DSTENCILOP_REPLACE,D3DSTENCILOP_KEEP); C.r_StencilRef (0x01); C.r_End (); break; case SE_R2_NORMAL_LQ: // deffer uber_deffer (C,false, "model","base",false,0,true); C.r_Stencil ( TRUE,D3DCMP_ALWAYS,0xff,0x7f,D3DSTENCILOP_KEEP,D3DSTENCILOP_REPLACE,D3DSTENCILOP_KEEP); C.r_StencilRef (0x01); C.r_End (); break; case SE_R2_SHADOW: // smap //if (RImplementation.o.HW_smap) C.r_Pass ("shadow_direct_model","dumb", FALSE,TRUE,TRUE,FALSE); //else C.r_Pass ("shadow_direct_model","shadow_direct_base",FALSE); C.r_Pass ("shadow_direct_model","dumb", FALSE,TRUE,TRUE,FALSE); //C.r_Sampler ("s_base",C.L_textures[0]); C.r_dx10Texture ("s_base",C.L_textures[0]); C.r_dx10Sampler ("smp_base"); C.r_dx10Sampler ("smp_linear"); C.r_ColorWriteEnable(false, false, false, false); C.r_End (); break; } } }
////////////////////////////////////////////////////////////////////////// // R2 ////////////////////////////////////////////////////////////////////////// void CBlender_LmEbB::Compile(CBlender_Compile& C) { if (oBlend.value) C.r_Pass ("lmapE","lmapE",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); else C.r_Pass ("lmapE","lmapE",TRUE); C.r_Sampler ("s_base", C.L_textures[0] ); C.r_Sampler ("s_lmap", C.L_textures[1] ); C.r_Sampler_clf ("s_hemi", *C.L_textures[2]); C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_End (); }
void CBlender_deffer_model::Compile(CBlender_Compile& C) { IBlender::Compile (C); BOOL bForward = FALSE; if (oBlend.value && oAREF.value<16) bForward = TRUE; if (oStrictSorting.value) bForward = TRUE; if (bForward) { // forward rendering LPCSTR vsname,psname; switch(C.iElement) { case 0: // case 1: // vsname = psname = "model_def_lq"; C.r_Pass (vsname,psname,TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,oAREF.value); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; default: break; } } else { BOOL bAref = oBlend.value; // deferred rendering // codepath is the same, only the shaders differ switch(C.iElement) { case SE_R2_NORMAL_HQ: // deffer uber_deffer (C,true, "model", "base",bAref); break; case SE_R2_NORMAL_LQ: // deffer uber_deffer (C,false, "model", "base",bAref); break; case SE_R2_SHADOW: // smap if (bAref) { if (RImplementation.o.HW_smap) C.r_Pass ("shadow_direct_model_aref","shadow_direct_base_aref", FALSE,TRUE,TRUE,FALSE,D3DBLEND_ZERO,D3DBLEND_ONE,TRUE,220); else C.r_Pass ("shadow_direct_model_aref","shadow_direct_base_aref", FALSE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; } else { if (RImplementation.o.HW_smap) C.r_Pass ("shadow_direct_model","dumb", FALSE,TRUE,TRUE,FALSE); else C.r_Pass ("shadow_direct_model","shadow_direct_base", FALSE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; } } } }
void CBlender_deffer_aref::Compile(CBlender_Compile& C) { IBlender::Compile (C); // oBlend.value = FALSE ; if (oBlend.value) { switch(C.iElement) { case SE_R2_NORMAL_HQ: case SE_R2_NORMAL_LQ: if (lmapped) { C.r_Pass ("lmapE","lmapE",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value); C.r_Sampler ("s_base", C.L_textures[0] ); C.r_Sampler ("s_lmap", C.L_textures[1] ); C.r_Sampler_clf ("s_hemi", *C.L_textures[2]); C.r_Sampler ("s_env", r2_T_envs0, false,D3DTADDRESS_CLAMP); C.r_End (); } else { C.r_Pass ("vert", "vert", TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE, oAREF.value); C.r_Sampler ("s_base", C.L_textures[0] ); C.r_End (); } break; default: break; } } else { C.SetParams (1,false); //. // codepath is the same, only the shaders differ // ***only pixel shaders differ*** switch(C.iElement) { case SE_R2_NORMAL_HQ: // deffer uber_deffer (C,true,"base","base",true); break; case SE_R2_NORMAL_LQ: // deffer uber_deffer (C,false,"base","base",true); break; case SE_R2_SHADOW: // smap 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); else C.r_Pass ("shadow_direct_base_aref","shadow_direct_base_aref",FALSE); C.r_Sampler ("s_base",C.L_textures[0]); C.r_End (); break; } } }
// TODO: DX10: implement CBlender_accum_direct::Compile void CBlender_accum_direct_volumetric_msaa::Compile(CBlender_Compile& C) { IBlender::Compile (C); if( Name ) ::Render->m_MSAASample = atoi( Definition ); else ::Render->m_MSAASample = -1; // BOOL b_HW_smap = RImplementation.o.HW_smap; // BOOL b_HW_PCF = RImplementation.o.HW_smap_PCF; BOOL blend = FALSE; //RImplementation.o.fp16_blend; D3DBLEND dest = blend?D3DBLEND_ONE:D3DBLEND_ZERO; if (RImplementation.o.sunfilter) { blend = FALSE; dest = D3DBLEND_ZERO; } switch (C.iElement) { case 0: // near pass - enable Z-test to perform depth-clipping C.r_Pass ("stub_notransform_2uv","accum_volumetric_sun_msaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_dx10Texture ("s_lmap", C.L_textures[0]); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_noise", "fx\\fx_noise"); C.r_dx10Sampler ("smp_rtlinear"); C.r_dx10Sampler ("smp_linear"); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; } ::Render->m_MSAASample = -1; }
void CBlender_light_occq::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // occlusion testing C.r_Pass ("dumb", "dumb",false,TRUE,FALSE,FALSE); C.r_End (); break; case 1: // NV40 optimization :) C.r_Pass ("null", "dumb",false,FALSE,FALSE,FALSE); C.r_End (); break; } }
void CBlender_Editor_Wire::Compile (CBlender_Compile& C) { IBlender::Compile (C); #if !defined(USE_DX10) && !defined(USE_DX11) if (C.bEditor) { C.PassBegin (); { C.PassSET_ZB (TRUE,TRUE); C.PassSET_Blend (FALSE,D3DBLEND_ONE,D3DBLEND_ZERO, FALSE,0); C.PassSET_LightFog (FALSE,FALSE); // Stage0 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_DIFFUSE, D3DTOP_MODULATE, D3DTA_TFACTOR); C.StageSET_Alpha (D3DTA_DIFFUSE, D3DTOP_MODULATE, D3DTA_TFACTOR); C.Stage_Texture ("$null"); C.Stage_Matrix ("$null", 0); C.Stage_Constant ("$null"); // C.Stage_Constant ("$base0", "$user$wire"); C.StageEnd (); } C.PassEnd (); } else #endif // USE_DX10 { C.r_Pass ("editor","simple_color",FALSE,TRUE,TRUE); C.r_End (); } }
void CBlender_Editor_Selection::Compile (CBlender_Compile& C) { IBlender::Compile (C); if (C.bEditor) { C.PassBegin (); { C.PassSET_ZB (TRUE,FALSE); C.PassSET_Blend (TRUE,D3DBLEND_SRCALPHA,D3DBLEND_INVSRCALPHA, FALSE,0); C.PassSET_LightFog (FALSE,FALSE); // Stage0 - Base texture C.StageBegin (); C.StageSET_Address (D3DTADDRESS_CLAMP); C.StageSET_Color (D3DTA_TFACTOR, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TFACTOR, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.Stage_Texture (oT_Name ); C.Stage_Matrix (oT_xform, 0); C.Stage_Constant ("$null" ); C.StageEnd (); } C.PassEnd (); } else { C.r_Pass ("editor","simple_color",FALSE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA,D3DBLEND_INVSRCALPHA); C.r_End (); } }
void CBlender_Detail_Still::Compile (CBlender_Compile& C) { IBlender::Compile (C); if (C.bEditor) { C.PassBegin (); { C.PassSET_ZB (TRUE,TRUE); if (oBlend.value) C.PassSET_Blend_BLEND (TRUE, 200); else C.PassSET_Blend_SET (TRUE, 200); C.PassSET_LightFog (TRUE,TRUE); // Stage1 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.StageSET_TMC (oT_Name,"$null","$null",0); C.StageEnd (); } C.PassEnd (); } else { switch (C.iElement) { case SE_R1_NORMAL_HQ: C.r_Pass ("detail_wave", "detail",FALSE,TRUE,TRUE,FALSE, D3DBLEND_ONE,D3DBLEND_ZERO,oBlend.value?TRUE:FALSE,oBlend.value?200:0); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; case SE_R1_NORMAL_LQ: C.r_Pass ("detail_still", "detail",FALSE,TRUE,TRUE,FALSE, D3DBLEND_ONE,D3DBLEND_ZERO,oBlend.value?TRUE:FALSE,oBlend.value?200:0); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; case SE_R1_LPOINT: break; case SE_R1_LSPOT: break; case SE_R1_LMODELS: break; } } }
void CBlender_deffer_flat::Compile(CBlender_Compile& C) { IBlender::Compile (C); // codepath is the same, only the shaders differ switch(C.iElement) { case SE_R2_NORMAL_HQ: // deffer uber_deffer (C,true,"base","base",false); break; case SE_R2_NORMAL_LQ: // deffer uber_deffer (C,false,"base","base",false); break; case SE_R2_SHADOW: // smap-direct if (RImplementation.o.HW_smap) C.r_Pass ("shadow_direct_base","dumb", FALSE,TRUE,TRUE,FALSE); else C.r_Pass ("shadow_direct_base","shadow_direct_base",FALSE); C.r_Sampler ("s_base",C.L_textures[0]); C.r_End (); break; } }
void CBlender_Model_EbB::Compile(CBlender_Compile& C) { IBlender::Compile (C); if (oBlend.value) { // forward LPCSTR vsname = 0; LPCSTR psname = 0; switch(C.iElement) { case 0: case 1: vsname = psname = "model_env_lq"; C.r_Pass (vsname,psname,TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_End (); break; } } else { // deferred switch(C.iElement) { case SE_R2_NORMAL_HQ: // deffer uber_deffer (C,true, "model","base",false); break; case SE_R2_NORMAL_LQ: // deffer uber_deffer (C,false, "model","base",false); break; case SE_R2_SHADOW: // smap if (RImplementation.o.HW_smap) C.r_Pass ("shadow_direct_model","dumb", FALSE,TRUE,TRUE,FALSE); else C.r_Pass ("shadow_direct_model","shadow_direct_base", FALSE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; } } }
void CBlender_luminance::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // 256x256 => 64x64 C.r_Pass ("null", "bloom_luminance_1",false,FALSE,FALSE, FALSE); C.r_Sampler_clf ("s_image", r2_RT_bloom1); C.r_End (); break; case 1: // 64x64 => 8x8 C.r_Pass ("null", "bloom_luminance_2",false,FALSE,FALSE, FALSE); C.r_Sampler_clf ("s_image", r2_RT_luminance_t64); C.r_End (); break; case 2: // 8x8 => 1x1, blending with old result C.r_Pass ("null", "bloom_luminance_3",false,FALSE,FALSE, FALSE); C.r_Sampler_clf ("s_image", r2_RT_luminance_t8 ); C.r_Sampler_clf ("s_tonemap", r2_RT_luminance_src ); C.r_End (); break; } }
void CBlender_Particle::Compile (CBlender_Compile& C) { IBlender::Compile (C); switch (oBlend.IDselected) { case 0: C.r_Pass ("particle","particle",TRUE, TRUE,TRUE, FALSE, D3DBLEND_ONE, D3DBLEND_ZERO, TRUE,200); break; // SET case 1: C.r_Pass ("particle","particle",FALSE, TRUE,FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); break; // BLEND case 2: C.r_Pass ("particle","particle",FALSE, TRUE,FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE, TRUE,0); break; // ADD case 3: C.r_Pass ("particle","particle",FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // MUL case 4: C.r_Pass ("particle","particle",FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_SRCCOLOR, TRUE,0); break; // MUL_2X case 5: C.r_Pass ("particle","particle",FALSE, TRUE,FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_ONE, TRUE,0); break; // ALPHA-ADD } C.r_Sampler ("s_base", C.L_textures[0],false,oClamp.value?D3DTADDRESS_CLAMP:D3DTADDRESS_WRAP); C.r_End (); }
// TODO: DX10: implement CBlender_accum_direct::Compile void CBlender_accum_direct_volumetric_sun_msaa::Compile(CBlender_Compile& C) { IBlender::Compile (C); if( Name ) ::Render->m_MSAASample = atoi( Definition ); else ::Render->m_MSAASample = -1; switch (C.iElement) { case 0: // near pass - enable Z-test to perform depth-clipping C.r_Pass ("stub_notransform_2uv","accum_volumetric_sun_msaa", false, false, false, true,D3DBLEND_ONE,D3DBLEND_ONE,false,0); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_position", r2_RT_P); jitter (C); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; } ::Render->m_MSAASample = -1; }
void CBlender_accum_direct_mask::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case SE_MASK_SPOT: // spot or omni-part C.r_Pass ("accum_mask", "dumb", false, TRUE,FALSE); C.r_Sampler_rtf ("s_position", r2_RT_P); C.r_End (); break; case SE_MASK_POINT: // point C.r_Pass ("accum_mask", "dumb", false, TRUE,FALSE); C.r_Sampler_rtf ("s_position", r2_RT_P); C.r_End (); break; case SE_MASK_DIRECT: // stencil mask for directional light C.r_Pass ("null", "accum_sun_mask", false, FALSE,FALSE,TRUE,D3DBLEND_ZERO,D3DBLEND_ONE,TRUE,1); C.r_Sampler_rtf ("s_normal", r2_RT_N); C.r_End (); break; case SE_MASK_ACCUM_VOL: // copy accumulator (temp -> real), volumetric (usually after blend) C.r_Pass ("accum_volume", "copy_p", false, FALSE,FALSE); C.r_Sampler_rtf ("s_base", r2_RT_accum_temp ); C.r_End (); break; case SE_MASK_ACCUM_2D: // copy accumulator (temp -> real), 2D (usually after sun-blend) C.r_Pass ("null", "copy", false, FALSE,FALSE); C.r_Sampler_rtf ("s_base", r2_RT_accum_temp ); C.r_End (); break; case SE_MASK_ALBEDO: // copy accumulator, 2D (for accum->color, albedo_wo) C.r_Pass ("null", "copy", false, FALSE,FALSE); C.r_Sampler_rtf ("s_base", r2_RT_accum ); C.r_End (); break; } }
adopt_compiler& _pass (LPCSTR vs, LPCSTR ps) { C->r_Pass (vs,ps,true); return *this; }
void CBlender_Model::Compile (CBlender_Compile& C) { IBlender::Compile (C); if (C.bEditor) { C.PassBegin (); { C.PassSET_ZB (TRUE,oBlend.value&&(oAREF.value<200)?FALSE:TRUE); if (oBlend.value) C.PassSET_Blend_BLEND (TRUE,oAREF.value); else C.PassSET_Blend_SET (); C.PassSET_LightFog (TRUE,TRUE); C.StageBegin (); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE); C.StageSET_TMC (oT_Name, "$null", "$null", 0 ); C.StageEnd (); } C.PassEnd (); } else { LPCSTR vsname = 0; LPCSTR psname = 0; switch (C.iElement) { case SE_R1_NORMAL_HQ: vsname = psname = "model_def_hq"; if (oBlend.value) C.r_Pass (vsname,psname,TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,oAREF.value); else C.r_Pass (vsname,psname,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", "$user$projector",true); C.r_End (); break; case SE_R1_NORMAL_LQ: vsname = psname = "model_def_lq"; if (oBlend.value) C.r_Pass (vsname,psname,TRUE,TRUE,TRUE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,oAREF.value); else C.r_Pass (vsname,psname,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; case SE_R1_LPOINT: vsname = "model_def_point"; psname = "add_point"; if (oBlend.value) C.r_Pass (vsname,psname,FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE, D3DBLEND_ONE,TRUE,oAREF.value); else C.r_Pass (vsname,psname,FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE, D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", TEX_POINT_ATT); C.r_Sampler_clf ("s_att", TEX_POINT_ATT); C.r_End (); break; case SE_R1_LSPOT: vsname = "model_def_spot"; psname = "add_spot"; if (oBlend.value) C.r_Pass (vsname,psname,FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE, D3DBLEND_ONE,TRUE,oAREF.value); else C.r_Pass (vsname,psname,FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE, D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", "internal\\internal_light_att", true); C.r_Sampler_clf ("s_att", TEX_SPOT_ATT); C.r_End (); break; case SE_R1_LMODELS: vsname = "model_def_shadow"; psname = "model_shadow"; C.r_Pass (vsname,psname,FALSE,FALSE,FALSE,TRUE,D3DBLEND_ZERO,D3DBLEND_SRCCOLOR,FALSE,0); C.r_End (); break; } } }
void CBlender_combine::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // combine C.r_Pass ("combine_1", "combine_1_nomsaa", FALSE, FALSE, FALSE, TRUE, D3DBLEND_INVSRCALPHA, D3DBLEND_SRCALPHA); //. MRT-blend? C.r_Stencil (TRUE,D3DCMP_LESSEQUAL,0xff,0x00); // stencil should be >= 1 C.r_StencilRef (0x01); //C.r_Sampler_rtf ("s_position", r2_RT_P ); //C.r_Sampler_rtf ("s_normal", r2_RT_N ); //C.r_Sampler_rtf ("s_diffuse", r2_RT_albedo ); //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); //C.r_Sampler_rtf ("s_depth", r2_RT_depth ); //C.r_Sampler_rtf ("s_tonemap", r2_RT_luminance_cur ); //C.r_Sampler_clw ("s_material", r2_material ); //C.r_Sampler_clf ("env_s0", r2_T_envs0 ); //C.r_Sampler_clf ("env_s1", r2_T_envs1 ); //C.r_Sampler_clf ("sky_s0", r2_T_sky0 ); //C.r_Sampler_clf ("sky_s1", r2_T_sky1 ); C.r_dx10Texture ("s_position", r2_RT_P ); C.r_dx10Texture ("s_normal", r2_RT_N ); C.r_dx10Texture ("s_diffuse", r2_RT_albedo ); C.r_dx10Texture ("s_accumulator", r2_RT_accum ); C.r_dx10Texture ("s_depth", r2_RT_depth ); C.r_dx10Texture ("s_tonemap", r2_RT_luminance_cur ); C.r_dx10Texture ("s_material", r2_material ); C.r_dx10Texture ("env_s0", r2_T_envs0 ); C.r_dx10Texture ("env_s1", r2_T_envs1 ); C.r_dx10Texture ("sky_s0", r2_T_sky0 ); C.r_dx10Texture ("sky_s1", r2_T_sky1 ); C.r_dx10Texture ("s_occ", r2_RT_ssao_temp ); C.r_dx10Texture ("s_half_depth", r2_RT_half_depth ); jitter(C); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_rtlinear"); C.r_End (); break; case 1: // aa-edge-detection + AA :) C.r_Pass ("stub_notransform_aa_AA","combine_2_AA", FALSE, FALSE, FALSE); //C.r_Sampler_rtf ("s_position", r2_RT_P); //C.r_Sampler_rtf ("s_normal", r2_RT_N); //C.r_Sampler_clf ("s_image", r2_RT_generic0); //C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); //C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_image", r2_RT_generic0); C.r_dx10Texture ("s_bloom", r2_RT_bloom1); C.r_dx10Texture ("s_distort", r2_RT_generic1); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_rtlinear"); C.r_End (); break; case 2: // non-AA // Can use simpler VS (need only Tex0) C.r_Pass ("stub_notransform_aa_AA","combine_2_NAA", FALSE, FALSE, FALSE); //C.r_Sampler_rtf ("s_position", r2_RT_P); //C.r_Sampler_rtf ("s_normal", r2_RT_N); //C.r_Sampler_clf ("s_image", r2_RT_generic0); //C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); //C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_image", r2_RT_generic0); C.r_dx10Texture ("s_bloom", r2_RT_bloom1); C.r_dx10Texture ("s_distort", r2_RT_generic1); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_rtlinear"); C.r_End (); break; case 3: // aa-edge-detection + AA :) + DISTORTION C.r_Pass ("stub_notransform_aa_AA","combine_2_AA_D", FALSE, FALSE, FALSE); //C.r_Sampler_rtf ("s_position", r2_RT_P); //C.r_Sampler_rtf ("s_normal", r2_RT_N); //C.r_Sampler_clf ("s_image", r2_RT_generic0); //C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); //C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_image", r2_RT_generic0); C.r_dx10Texture ("s_bloom", r2_RT_bloom1); C.r_dx10Texture ("s_distort", r2_RT_generic1); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_rtlinear"); C.r_End (); break; case 4: // non-AA + DISTORTION // Can use simpler VS (need only Tex0) C.r_Pass ("stub_notransform_aa_AA","combine_2_NAA_D", FALSE, FALSE, FALSE); //C.r_Sampler_rtf ("s_position", r2_RT_P); //C.r_Sampler_rtf ("s_normal", r2_RT_N); //C.r_Sampler_clf ("s_image", r2_RT_generic0); //C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); //C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_image", r2_RT_generic0); C.r_dx10Texture ("s_bloom", r2_RT_bloom1); C.r_dx10Texture ("s_distort", r2_RT_generic1); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_rtlinear"); C.r_End (); break; case 5: // post-processing break; } }
void CBlender_Model_EbB::Compile(CBlender_Compile& C) { IBlender::Compile (C); if (C.bEditor) { C.PassBegin (); { if (oBlend.value) { C.PassSET_ZB (TRUE,FALSE); C.PassSET_Blend_BLEND (); } else { C.PassSET_ZB (TRUE,TRUE); C.PassSET_Blend_SET (); } C.PassSET_LightFog (TRUE,TRUE); // Stage1 - Env texture C.StageBegin (); C.StageSET_Address (D3DTADDRESS_CLAMP); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE); C.StageSET_TMC (oT2_Name, oT2_xform, "$null", 0); C.StageEnd (); // Stage2 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT); C.StageSET_TMC (oT_Name, oT_xform, "$null", 0); C.StageEnd (); // Stage3 - Lighting - should work on all 2tex hardware C.StageBegin (); C.StageSET_Color (D3DTA_DIFFUSE, D3DTOP_MODULATE, D3DTA_CURRENT); C.StageSET_Alpha (D3DTA_DIFFUSE, D3DTOP_SELECTARG2, D3DTA_CURRENT); C.Stage_Texture ("$null" ); C.Stage_Matrix ("$null", 0); C.Stage_Constant ("$null" ); C.StageEnd (); } C.PassEnd (); } else { LPCSTR vsname = 0; LPCSTR psname = 0; switch (C.iElement) { case SE_R1_NORMAL_HQ: vsname = psname = "model_env_hq"; if (oBlend.value) C.r_Pass (vsname,psname,TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); else C.r_Pass (vsname,psname,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_Sampler_clf ("s_lmap", "$user$projector",true); C.r_End (); break; case SE_R1_NORMAL_LQ: vsname = psname = "model_env_lq"; if (oBlend.value) C.r_Pass (vsname,psname,TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); else C.r_Pass (vsname,psname,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_End (); break; case SE_R1_LPOINT: vsname = "model_def_point"; psname = "add_point"; C.r_Pass (vsname,psname,FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE, D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", TEX_POINT_ATT); C.r_Sampler_clf ("s_att", TEX_POINT_ATT); C.r_End (); break; case SE_R1_LSPOT: vsname = "model_def_spot"; psname = "add_spot"; C.r_Pass (vsname,psname,FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE, D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", "internal\\internal_light_att", true); C.r_Sampler_clf ("s_att", TEX_SPOT_ATT); C.r_End (); break; case SE_R1_LMODELS: vsname = "model_def_shadow"; psname = "model_shadow"; C.r_Pass (vsname,psname,FALSE,FALSE,FALSE,TRUE,D3DBLEND_ZERO,D3DBLEND_SRCCOLOR,FALSE,0); C.r_End (); break; } } }
////////////////////////////////////////////////////////////////////////// // R1 ////////////////////////////////////////////////////////////////////////// void CBlender_LmEbB::Compile(CBlender_Compile& C) { IBlender::Compile (C); if (C.bEditor) { C.PassBegin (); { C.PassSET_ZB (TRUE,TRUE); C.PassSET_Blend_SET (); C.PassSET_LightFog (TRUE,TRUE); // Stage1 - Env texture C.StageBegin (); C.StageSET_Address (D3DTADDRESS_CLAMP); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_DIFFUSE); C.StageSET_TMC (oT2_Name, oT2_xform, "$null", 0); C.StageEnd (); // Stage2 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT); C.StageSET_TMC (oT_Name, oT_xform, "$null", 0); C.StageEnd (); // Stage3 - Lighting - should work on all 2tex hardware C.StageBegin (); C.StageSET_Color (D3DTA_DIFFUSE, D3DTOP_MODULATE, D3DTA_CURRENT); C.StageSET_Alpha (D3DTA_DIFFUSE, D3DTOP_SELECTARG2, D3DTA_CURRENT); C.Stage_Texture ("$null" ); C.Stage_Matrix ("$null", 0); C.Stage_Constant ("$null" ); C.StageEnd (); } C.PassEnd (); } else { if (C.L_textures.size()<2) Debug.fatal (DEBUG_INFO,"Not enought textures for shader, base tex: %s",*C.L_textures[0]); switch (C.iElement) { case SE_R1_NORMAL_HQ: case SE_R1_NORMAL_LQ: // Level view /* if (C.bDetail_Diffuse) { if (oBlend.value) C.r_Pass ("lmapE_dt","lmapE_dt",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA,D3DBLEND_INVSRCALPHA,TRUE,0); else C.r_Pass ("lmapE_dt","lmapE_dt",TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler ("s_lmap", C.L_textures[1]); C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_Sampler ("s_detail",C.detail_texture); C.r_End (); } else { */ if (oBlend.value) C.r_Pass ("lmapE","lmapE",TRUE,TRUE,FALSE,TRUE,D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); else C.r_Pass ("lmapE","lmapE",TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler ("s_lmap", C.L_textures[1]); C.r_Sampler_clf ("s_hemi", *C.L_textures[2]); C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP); C.r_End (); // } break; case SE_R1_LPOINT: C.r_Pass ("lmap_point","add_point",FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE,D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0] ); C.r_Sampler_clf ("s_lmap", TEX_POINT_ATT ); C.r_Sampler_clf ("s_att", TEX_POINT_ATT ); C.r_End (); break; case SE_R1_LSPOT: C.r_Pass ("lmap_spot","add_spot",FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE,D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", "internal\\internal_light_att", true); C.r_Sampler_clf ("s_att", TEX_SPOT_ATT ); C.r_End (); break; case SE_R1_LMODELS: // Lighting only, not use alpha-channel C.r_Pass ("lmap_l","lmap_l",FALSE); C.r_Sampler ("s_base",C.L_textures[0]); C.r_Sampler ("s_lmap",C.L_textures[1]); C.r_Sampler_clf ("s_hemi",*C.L_textures[2]); C.r_End (); break; } } }
// TODO: DX10: implement CBlender_accum_direct::Compile void CBlender_accum_direct_msaa::Compile(CBlender_Compile& C) { IBlender::Compile (C); if( Name ) ::Render->m_MSAASample = atoi( Definition ); else ::Render->m_MSAASample = -1; // BOOL b_HW_smap = RImplementation.o.HW_smap; // BOOL b_HW_PCF = RImplementation.o.HW_smap_PCF; BOOL blend = FALSE; //RImplementation.o.fp16_blend; D3DBLEND dest = blend?D3DBLEND_ONE:D3DBLEND_ZERO; if (RImplementation.o.sunfilter) { blend = FALSE; dest = D3DBLEND_ZERO; } switch (C.iElement) { case SE_SUN_NEAR: // near pass - enable Z-test to perform depth-clipping case SE_SUN_MIDDLE: // middle pass - enable Z-test to perform depth-clipping // FVF::TL2uv //C.r_Pass ("null", "accum_sun_near", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_Pass ("accum_sun","accum_sun_near_msaa_nominmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); 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 ); //if (b_HW_smap) { // if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); // else { // C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); // } //} //else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; case SE_SUN_FAR: // far pass, only stencil clipping performed // FVF::TL2uv //C.r_Pass ("null", "accum_sun_far", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_Pass ("accum_sun","accum_sun_far_msaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); //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 ); //if (b_HW_smap) { // if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); // else { // C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); // } //} //else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); { u32 s = C.r_dx10Sampler("smp_smap"); C.i_dx10Address (s, D3DTADDRESS_BORDER); C.i_dx10BorderColor (s, D3DCOLOR_ARGB(255, 255, 255, 255)); } C.r_End (); break; case SE_SUN_LUMINANCE: // luminance pass //C.r_Pass ("null", "accum_sun", false, FALSE, FALSE); C.r_Pass ("stub_notransform_aa_AA","accum_sun_msaa", false, FALSE, FALSE); C.r_CullMode (D3DCULL_NONE); //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_clf ("s_smap", r2_RT_generic0 ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_smap", r2_RT_generic0); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); jitter (C); C.r_End (); break; // SE_SUN_NEAR for minmax case SE_SUN_NEAR_MINMAX: // near pass - enable Z-test to perform depth-clipping // FVF::TL2uv C.r_Pass ("accum_sun","accum_sun_near_msaa_minmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_smap_minmax", r2_RT_smap_depth_minmax); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; } ::Render->m_MSAASample = -1; }
void CBlender_accum_direct::Compile(CBlender_Compile& C) { IBlender::Compile (C); // BOOL b_HW_smap = RImplementation.o.HW_smap; // BOOL b_HW_PCF = RImplementation.o.HW_smap_PCF; BOOL blend = FALSE; //RImplementation.o.fp16_blend; D3DBLEND dest = blend?D3DBLEND_ONE:D3DBLEND_ZERO; if (RImplementation.o.sunfilter) { blend = FALSE; dest = D3DBLEND_ZERO; } switch (C.iElement) { case SE_SUN_NEAR: // near pass - enable Z-test to perform depth-clipping // FVF::TL2uv C.r_Pass ("stub_notransform_2uv","accum_sun_near_nomsaa_nominmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_smap_minmax", r2_RT_smap_depth_minmax); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; case SE_SUN_FAR: // far pass, only stencil clipping performed // FVF::TL2uv //C.r_Pass ("null", "accum_sun_far", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_Pass ("stub_notransform_2uv","accum_sun_far_nomsaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); //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 ); //if (b_HW_smap) { // if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); // else { // C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); // } //} //else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; case SE_SUN_LUMINANCE: // luminance pass //C.r_Pass ("null", "accum_sun", false, FALSE, FALSE); C.r_Pass ("stub_notransform_aa_AA","accum_sun_nomsaa", false, FALSE, FALSE); C.r_CullMode (D3DCULL_NONE); //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_clf ("s_smap", r2_RT_generic0 ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_smap", r2_RT_generic0); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); jitter (C); C.r_End (); break; // SE_SUN_NEAR for min/max case SE_SUN_NEAR_MINMAX: // near pass - enable Z-test to perform depth-clipping // FVF::TL2uv C.r_Pass ("stub_notransform_2uv","accum_sun_near_nomsaa_minmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_smap_minmax", r2_RT_smap_depth_minmax); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; /* // SE_SUN_FAR for min/max case 5: // far pass, only stencil clipping performed // FVF::TL2uv C.r_Pass ("stub_notransform_2uv","accum_sun_far_nomsaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; */ } }
void CBlender_Particle::Compile (CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case SE_R2_NORMAL_HQ: // deffer case SE_R2_NORMAL_LQ: // deffer switch (oBlend.IDselected) { case 0: C.r_Pass ("deffer_particle", "deffer_particle", FALSE, TRUE,TRUE, FALSE, D3DBLEND_ONE, D3DBLEND_ZERO, FALSE,200); break; // SET case 1: C.r_Pass ("particle", "particle", FALSE, TRUE,FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA, TRUE,0); break; // BLEND case 2: C.r_Pass ("particle", "particle", FALSE, TRUE,FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE, TRUE,0); break; // ADD case 3: C.r_Pass ("particle", "particle", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // MUL case 4: C.r_Pass ("particle", "particle", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_SRCCOLOR, TRUE,0); break; // MUL_2X case 5: C.r_Pass ("particle", "particle", FALSE, TRUE,FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_ONE, TRUE,0); break; // ALPHA-ADD }; C.r_Sampler ("s_base", C.L_textures[0],false,oClamp.value?D3DTADDRESS_CLAMP:D3DTADDRESS_WRAP); C.r_Sampler_rtf ("s_position", "$user$position"); // Nummer: for soft particles C.r_End (); break; case SE_R2_SHADOW: // smap // HARD or SOFT: shadow-map switch (oBlend.IDselected) { case 0: C.r_Pass ("particle", "particle", FALSE, TRUE,TRUE, FALSE, D3DBLEND_ONE, D3DBLEND_ZERO, TRUE,200); break; // SET case 1: C.r_Pass ("particle-clip", "particle_s-blend", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // BLEND case 2: C.r_Pass ("particle-clip", "particle_s-add", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // ADD case 3: C.r_Pass ("particle-clip", "particle_s-mul", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // MUL case 4: C.r_Pass ("particle-clip", "particle_s-mul", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // MUL_2X case 5: C.r_Pass ("particle-clip", "particle_s-aadd", FALSE, TRUE,FALSE, TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_ZERO, TRUE,0); break; // ALPHA-ADD }; C.r_Sampler ("s_base", C.L_textures[0],false,oClamp.value?D3DTADDRESS_CLAMP:D3DTADDRESS_WRAP); C.r_Sampler_rtf ("s_position", "$user$position"); // Nummer: for soft particles C.r_End (); break; case 4: // deffer-EMAP break; }; }
void uber_shadow(CBlender_Compile& C, LPCSTR _vspec) { // Uber-parse string256 fname,fnameA,fnameB; xr_strcpy (fname,*C.L_textures[0]); //. andy if (strext(fname)) *strext(fname)=0; fix_texture_name(fname); ref_texture _t; _t.create (fname); bool bump = _t.bump_exist (); // detect lmap bool lmap = true; if (C.L_textures.size()<3) lmap = false; else { pcstr tex = C.L_textures[2].c_str(); if (tex[0]=='l' && tex[1]=='m' && tex[2]=='a' && tex[3]=='p') lmap = true ; else lmap = false; } string256 vs,dt; xr_strcpy (dt,sizeof(dt),C.detail_texture?C.detail_texture:""); // detect detail bump string256 texDetailBump = {'\0'}; string256 texDetailBumpX = {'\0'}; bool bHasDetailBump = false; if (C.bDetail_Bump) { LPCSTR detail_bump_texture = DEV->m_textures_description.GetBumpName(dt).c_str(); // Detect and use detail bump if ( detail_bump_texture ) { bHasDetailBump = true; xr_strcpy ( texDetailBump, sizeof(texDetailBump), detail_bump_texture); xr_strcpy ( texDetailBumpX, sizeof(texDetailBumpX), detail_bump_texture); xr_strcat ( texDetailBumpX, "#"); } } if (!bump) { fnameA[0] = fnameB[0] = 0; } else { xr_strcpy (fnameA,_t.bump_get().c_str()); strconcat (sizeof(fnameB),fnameB,fnameA,"#"); } if (bump && RImplementation.o.dx11_enable_tessellation && C.TessMethod!=0) { char hs[256], ds[256];// = "DX11\\tess", ds[256] = "DX11\\tess"; char params[256] = "("; if (C.TessMethod == CBlender_Compile::TESS_PN || C.TessMethod == CBlender_Compile::TESS_PN_HM) { RImplementation.addShaderOption("TESS_PN", "1"); xr_strcat(params, "TESS_PN,"); } if (C.TessMethod == CBlender_Compile::TESS_HM || C.TessMethod == CBlender_Compile::TESS_PN_HM) { RImplementation.addShaderOption("TESS_HM", "1"); xr_strcat(params, "TESS_HM,"); } if (lmap) { RImplementation.addShaderOption("USE_LM_HEMI", "1"); xr_strcat(params, "USE_LM_HEMI,"); } if (C.bDetail_Diffuse) { RImplementation.addShaderOption("USE_TDETAIL", "1"); xr_strcat(params, "USE_TDETAIL,"); } if (C.bDetail_Bump) { RImplementation.addShaderOption("USE_TDETAIL_BUMP", "1"); xr_strcat(params, "USE_TDETAIL_BUMP,"); } xr_strcat(params, ")"); strconcat(sizeof(vs),vs,"deffer_", _vspec, "_bump", params); strconcat(sizeof(hs),hs,"DX11\\tess", params); strconcat(sizeof(ds),ds,"DX11\\tess_shadow", params); C.r_TessPass (vs, hs, ds, "null", "dumb", FALSE,TRUE,TRUE,FALSE); RImplementation.clearAllShaderOptions(); C.r_dx10Texture ("s_base", C.L_textures[0]); C.r_dx10Texture ("s_bumpX", fnameB); // should be before base bump C.r_dx10Texture ("s_bump", fnameA); if (bHasDetailBump) { C.r_dx10Texture ("s_detailBump", texDetailBump); C.r_dx10Texture ("s_detailBumpX", texDetailBumpX); } u32 stage = C.r_dx10Sampler("smp_bump_ds"); if (stage != -1) { C.i_dx10Address(stage, D3DTADDRESS_WRAP); C.i_dx10FilterAnizo(stage, TRUE); } if (ps_r2_ls_flags_ext.test(R2FLAGEXT_WIREFRAME)) C.R().SetRS(D3DRS_FILLMODE, D3DFILL_WIREFRAME); } else C.r_Pass ("shadow_direct_base","dumb", FALSE,TRUE,TRUE,FALSE); }
void CBlender_Vertex::Compile (CBlender_Compile& C) { IBlender::Compile (C); if (C.bEditor) { // Editor shader C.PassBegin (); { C.PassSET_ZB (TRUE,TRUE); C.PassSET_Blend (FALSE,D3DBLEND_ONE,D3DBLEND_ZERO, FALSE,0); C.PassSET_LightFog (TRUE,TRUE); // Stage0 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_DIFFUSE); C.Stage_Texture (oT_Name); C.Stage_Matrix (oT_xform,0); C.Stage_Constant ("$null"); C.StageEnd (); } C.PassEnd (); } else { switch (C.iElement) { case SE_R1_NORMAL_HQ: // Level view if (C.bDetail_Diffuse) { C.r_Pass ("vert_dt","vert_dt",TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler ("s_detail",C.detail_texture); C.r_End (); } else { C.r_Pass ("vert","vert",TRUE); C.r_Sampler ("s_base",C.L_textures[0]); C.r_End (); } break; case SE_R1_NORMAL_LQ: // Level view C.r_Pass ("vert","vert",TRUE); C.r_Sampler ("s_base",C.L_textures[0]); C.r_End (); break; case SE_R1_LPOINT: C.r_Pass ("vert_point","add_point",FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE,D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", TEX_POINT_ATT ); C.r_Sampler_clf ("s_att", TEX_POINT_ATT ); C.r_End (); break; case SE_R1_LSPOT: C.r_Pass ("vert_spot","add_spot",FALSE,TRUE,FALSE,TRUE,D3DBLEND_ONE,D3DBLEND_ONE,TRUE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_Sampler_clf ("s_lmap", "internal\\internal_light_att", true); C.r_Sampler_clf ("s_att", TEX_SPOT_ATT ); C.r_End (); break; case SE_R1_LMODELS: // Lighting only C.r_Pass ("vert_l","vert_l",FALSE); C.r_Sampler ("s_base",C.L_textures[0]); C.r_End (); break; } } }
void CBlender_combine::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // combine C.r_Pass ("combine_1", "combine_1", FALSE, FALSE, FALSE, TRUE, D3DBLEND_INVSRCALPHA, D3DBLEND_SRCALPHA); //. MRT-blend? C.r_Sampler_rtf ("s_position", r2_RT_P ); C.r_Sampler_rtf ("s_normal", r2_RT_N ); C.r_Sampler_rtf ("s_diffuse", r2_RT_albedo ); C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); C.r_Sampler_rtf ("s_depth", r2_RT_depth ); C.r_Sampler_rtf ("s_tonemap", r2_RT_luminance_cur ); C.r_Sampler_clw ("s_material", r2_material ); C.r_Sampler_clw ("s_occ", r2_RT_ssao_temp ); C.r_Sampler_rtf ("s_half_depth", r2_RT_half_depth); C.r_Sampler_clf ("env_s0", r2_T_envs0 ); C.r_Sampler_clf ("env_s1", r2_T_envs1 ); C.r_Sampler_clf ("sky_s0", r2_T_sky0 ); C.r_Sampler_clf ("sky_s1", r2_T_sky1 ); jitter(C); C.r_End (); break; case 1: // aa-edge-detection + AA :) C.r_Pass ("null", "combine_2_AA", FALSE, FALSE, FALSE); C.r_Sampler_rtf ("s_position", r2_RT_P); C.r_Sampler_rtf ("s_normal", r2_RT_N); C.r_Sampler_clf ("s_image", r2_RT_generic0); C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_End (); break; case 2: // non-AA C.r_Pass ("null", "combine_2_NAA", FALSE, FALSE, FALSE); C.r_Sampler_rtf ("s_position", r2_RT_P); C.r_Sampler_rtf ("s_normal", r2_RT_N); C.r_Sampler_clf ("s_image", r2_RT_generic0); C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_End (); break; case 3: // aa-edge-detection + AA :) + DISTORTION C.r_Pass ("null", "combine_2_AA_D", FALSE, FALSE, FALSE); C.r_Sampler_rtf ("s_position", r2_RT_P); C.r_Sampler_rtf ("s_normal", r2_RT_N); C.r_Sampler_clf ("s_image", r2_RT_generic0); C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_End (); break; case 4: // non-AA + DISTORTION C.r_Pass ("null", "combine_2_NAA_D", FALSE, FALSE, FALSE); C.r_Sampler_rtf ("s_position", r2_RT_P); C.r_Sampler_rtf ("s_normal", r2_RT_N); C.r_Sampler_clf ("s_image", r2_RT_generic0); C.r_Sampler_clf ("s_bloom", r2_RT_bloom1); C.r_Sampler_clf ("s_distort", r2_RT_generic1); C.r_End (); break; case 5: // post-processing break; } }
void CBlender_accum_spot::Compile(CBlender_Compile& C) { IBlender::Compile (C); BOOL b_HW_smap = RImplementation.o.HW_smap; BOOL b_HW_PCF = RImplementation.o.HW_smap_PCF; BOOL blend = RImplementation.o.fp16_blend; D3DBLEND dest = blend?D3DBLEND_ONE:D3DBLEND_ZERO; switch (C.iElement) { case SE_L_FILL: // masking C.r_Pass ("null", "copy", false, FALSE, FALSE); C.r_Sampler ("s_base", C.L_textures[0]); C.r_End (); break; case SE_L_UNSHADOWED: // unshadowed C.r_Pass ("accum_volume", "accum_spot_unshadowed", false, FALSE,FALSE,blend,D3DBLEND_ONE,dest); 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 ("s_lmap", C.L_textures[0],false,D3DTADDRESS_CLAMP); C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); C.r_End (); break; case SE_L_NORMAL: // normal C.r_Pass ("accum_volume", "accum_spot_normal", false, FALSE,FALSE,blend,D3DBLEND_ONE,dest); 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 ("s_lmap", C.L_textures[0],false,D3DTADDRESS_CLAMP); if (b_HW_smap) { if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); else C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); } else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); jitter (C); C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); C.r_End (); break; case SE_L_FULLSIZE: // normal-fullsize C.r_Pass ("accum_volume", "accum_spot_fullsize", false, FALSE,FALSE,blend,D3DBLEND_ONE,dest); 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 ("s_lmap", C.L_textures[0],false,D3DTADDRESS_CLAMP); if (b_HW_smap) { if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); else C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); } else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); jitter (C); C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); C.r_End (); break; case SE_L_TRANSLUENT: // shadowed + transluency C.r_Pass ("accum_volume", "accum_spot_fullsize", false, FALSE,FALSE,blend,D3DBLEND_ONE,dest); 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_clf ("s_lmap", r2_RT_smap_surf); // diff here if (b_HW_smap) { if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); else C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); } else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); jitter (C); C.r_End (); break; } }
void uber_deffer (CBlender_Compile& C, bool hq, LPCSTR _vspec, LPCSTR _pspec, BOOL _aref, LPCSTR _detail_replace, bool DO_NOT_FINISH) { // Uber-parse string256 fname,fnameA,fnameB; xr_strcpy (fname,*C.L_textures[0]); //. andy if (strext(fname)) *strext(fname)=0; fix_texture_name(fname); ref_texture _t; _t.create (fname); bool bump = _t.bump_exist (); // detect lmap bool lmap = true; if (C.L_textures.size()<3) lmap = false; else { pcstr tex = C.L_textures[2].c_str(); if (tex[0]=='l' && tex[1]=='m' && tex[2]=='a' && tex[3]=='p') lmap = true ; else lmap = false; } string256 ps,vs,dt; strconcat (sizeof(vs),vs,"deffer_", _vspec, lmap?"_lmh":"" ); strconcat (sizeof(ps),ps,"deffer_", _pspec, lmap?"_lmh":"" ); xr_strcpy (dt,sizeof(dt),_detail_replace?_detail_replace:( C.detail_texture?C.detail_texture:"" ) ); // detect detail bump string256 texDetailBump = {'\0'}; string256 texDetailBumpX = {'\0'}; bool bHasDetailBump = false; if (C.bDetail_Bump) { LPCSTR detail_bump_texture = DEV->m_textures_description.GetBumpName(dt).c_str(); // Detect and use detail bump if ( detail_bump_texture ) { bHasDetailBump = true; xr_strcpy ( texDetailBump, sizeof(texDetailBump), detail_bump_texture); xr_strcpy ( texDetailBumpX, sizeof(texDetailBumpX), detail_bump_texture); xr_strcat ( texDetailBumpX, "#"); } } if (_aref) { xr_strcat(ps,"_aref"); } if (!bump) { fnameA[0] = fnameB[0] = 0; xr_strcat (vs,"_flat"); xr_strcat (ps,"_flat"); if (hq && (C.bDetail_Diffuse || C.bDetail_Bump) ) { xr_strcat (vs,"_d"); xr_strcat (ps,"_d"); } } else { xr_strcpy (fnameA,_t.bump_get().c_str()); strconcat (sizeof(fnameB),fnameB,fnameA,"#"); xr_strcat (vs,"_bump"); if (hq && C.bUseSteepParallax) { xr_strcat (ps,"_steep"); } else { xr_strcat (ps,"_bump"); } if (hq && (C.bDetail_Diffuse || C.bDetail_Bump) ) { xr_strcat (vs,"_d" ); if (bHasDetailBump) xr_strcat (ps,"_db" ); // bump & detail & hq else xr_strcat (ps,"_d" ); } } // HQ if (bump && hq) { xr_strcat (vs,"-hq"); xr_strcat (ps,"-hq"); } // Uber-construct #if defined(USE_DX10) || defined(USE_DX11) # ifdef USE_DX11 if (bump && hq && RImplementation.o.dx11_enable_tessellation && C.TessMethod!=0) { char hs[256], ds[256];// = "DX11\\tess", ds[256] = "DX11\\tess"; char params[256] = "("; if (C.TessMethod == CBlender_Compile::TESS_PN || C.TessMethod == CBlender_Compile::TESS_PN_HM) { RImplementation.addShaderOption("TESS_PN", "1"); xr_strcat(params, "TESS_PN,"); } if (C.TessMethod == CBlender_Compile::TESS_HM || C.TessMethod == CBlender_Compile::TESS_PN_HM) { RImplementation.addShaderOption("TESS_HM", "1"); xr_strcat(params, "TESS_HM,"); } if (lmap) { RImplementation.addShaderOption("USE_LM_HEMI", "1"); xr_strcat(params, "USE_LM_HEMI,"); } if (C.bDetail_Diffuse) { RImplementation.addShaderOption("USE_TDETAIL", "1"); xr_strcat(params, "USE_TDETAIL,"); } if (C.bDetail_Bump) { RImplementation.addShaderOption("USE_TDETAIL_BUMP", "1"); xr_strcat(params, "USE_TDETAIL_BUMP,"); } xr_strcat(params, ")"); strconcat(sizeof(vs),vs,"deffer_", _vspec, "_bump", params); strconcat(sizeof(ps),ps,"deffer_", _pspec, _aref?"_aref":"", "_bump", params); strconcat(sizeof(hs),hs,"DX11\\tess", params); strconcat(sizeof(ds),ds,"DX11\\tess", params); VERIFY(strstr(vs, "bump")!=0); VERIFY(strstr(ps, "bump")!=0); C.r_TessPass (vs, hs, ds, "null", ps, FALSE); RImplementation.clearAllShaderOptions(); u32 stage = C.r_dx10Sampler("smp_bump_ds"); if (stage != -1) { C.i_dx10Address(stage, D3DTADDRESS_WRAP); C.i_dx10FilterAnizo(stage, TRUE); } if (ps_r2_ls_flags_ext.test(R2FLAGEXT_WIREFRAME)) C.R().SetRS(D3DRS_FILLMODE, D3DFILL_WIREFRAME); C.r_dx10Texture ("s_tbump", fnameA); C.r_dx10Texture ("s_tbumpX", fnameB); // should be before base bump if (bHasDetailBump) { C.r_dx10Texture ("s_tdetailBumpX", texDetailBumpX); } } else # endif C.r_Pass (vs,ps, FALSE); //C.r_Sampler ("s_base", C.L_textures[0], false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); //C.r_Sampler ("s_bumpX", fnameB, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); // should be before base bump //C.r_Sampler ("s_bump", fnameA, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); //C.r_Sampler ("s_bumpD", dt, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); //C.r_Sampler ("s_detail", dt, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); C.r_dx10Texture ("s_base", C.L_textures[0]); C.r_dx10Texture ("s_bumpX", fnameB); // should be before base bump C.r_dx10Texture ("s_bump", fnameA); C.r_dx10Texture ("s_bumpD", dt); C.r_dx10Texture ("s_detail", dt); if (bHasDetailBump) { C.r_dx10Texture ("s_detailBump", texDetailBump); C.r_dx10Texture ("s_detailBumpX", texDetailBumpX); } C.r_dx10Sampler ("smp_base"); if (lmap) { //C.r_Sampler("s_hemi", C.L_textures[2], false, D3DTADDRESS_CLAMP, D3DTEXF_LINEAR, D3DTEXF_NONE, D3DTEXF_LINEAR); C.r_dx10Texture ("s_hemi", C.L_textures[2]); C.r_dx10Sampler ("smp_rtlinear"); } #else // USE_DX10 C.r_Pass (vs,ps, FALSE); VERIFY(C.L_textures[0].size()); if(bump) { VERIFY2(xr_strlen(fnameB), C.L_textures[0].c_str()); VERIFY2(xr_strlen(fnameA), C.L_textures[0].c_str()); } if(bHasDetailBump) { VERIFY2(xr_strlen(texDetailBump), C.L_textures[0].c_str()); VERIFY2(xr_strlen(texDetailBumpX), C.L_textures[0].c_str()); } C.r_Sampler ("s_base", C.L_textures[0], false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); C.r_Sampler ("s_bumpX", fnameB, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); // should be before base bump C.r_Sampler ("s_bump", fnameA, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); C.r_Sampler ("s_bumpD", dt, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); C.r_Sampler ("s_detail", dt, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); if (bHasDetailBump) { C.r_Sampler ("s_detailBump", texDetailBump, false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); C.r_Sampler ("s_detailBumpX",texDetailBumpX,false, D3DTADDRESS_WRAP, D3DTEXF_ANISOTROPIC,D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC); } if (lmap)C.r_Sampler("s_hemi", C.L_textures[2], false, D3DTADDRESS_CLAMP, D3DTEXF_LINEAR, D3DTEXF_NONE, D3DTEXF_LINEAR); #endif // USE_DX10 if (!DO_NOT_FINISH) C.r_End (); }