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_ShWorld::Compile (CBlender_Compile& C) { IBlender::Compile (C); C.PassBegin (); { C.PassSET_ZB (TRUE, FALSE); C.PassSET_Blend_MUL (); C.PassSET_LightFog (FALSE, FALSE); // Stage0 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_DIFFUSE); C.StageSET_Alpha (D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_DIFFUSE); C.Stage_Texture ("$base0"); C.Stage_Matrix ("$null",0); C.Stage_Constant ("$null"); C.StageEnd (); } C.PassEnd (); }
void CBlender_ShTex::Compile (CBlender_Compile& C) { IBlender::Compile (C); C.PassBegin (); { C.PassSET_ZB (FALSE, FALSE); C.PassSET_Blend_SET (); C.PassSET_LightFog (FALSE, FALSE); // Stage0 - Base texture C.StageBegin (); C.StageSET_Color (D3DTA_TFACTOR, D3DTOP_SELECTARG1, D3DTA_TFACTOR); C.StageSET_Alpha (D3DTA_TFACTOR, D3DTOP_SELECTARG1, D3DTA_TFACTOR); C.Stage_Texture ("$null"); C.Stage_Matrix ("$null",0); C.Stage_Constant ("$null"); C.StageEnd (); // C.R().SetRS (D3DRS_TEXTUREFACTOR,0); } C.PassEnd (); }
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; } } }
adopt_compiler& _ZB (bool _test, bool _write) { C->PassSET_ZB (_test,_write); 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_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; */ } }
// 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; }
////////////////////////////////////////////////////////////////////////// // 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; } } }
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; } } }