|
| 1 | +#include "stdafx.h" |
| 2 | +#include "./glRainBlender.h" |
| 3 | + |
| 4 | +void CBlender_rain::Compile(CBlender_Compile& C) |
| 5 | +{ |
| 6 | + IBlender::Compile (C); |
| 7 | + |
| 8 | + switch (C.iElement) |
| 9 | + { |
| 10 | + case 0: // Test |
| 11 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 12 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 13 | + C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, FALSE); |
| 14 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 15 | + |
| 16 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 17 | + C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 18 | + C.r_Sampler_clw ("s_material", r2_material); |
| 19 | + C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 20 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 21 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 22 | + |
| 23 | + jitter (C); |
| 24 | + |
| 25 | + //C.r_Sampler ("s_water", "water\\water_water"); |
| 26 | + |
| 27 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 28 | + C.r_Sampler ("s_water", "water\\water_normal"); |
| 29 | + |
| 30 | + C.r_End (); |
| 31 | + |
| 32 | + break; |
| 33 | + |
| 34 | + case 1: // Patch normals |
| 35 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 36 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 37 | + C.r_Pass ("stub_notransform_2uv", "rain_patch_normal_nomsaa", false, TRUE, FALSE, FALSE); |
| 38 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 39 | + |
| 40 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 41 | + C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 42 | + C.r_Sampler_clw ("s_material", r2_material); |
| 43 | + //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 44 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 45 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 46 | + |
| 47 | + C.r_Sampler_rtf ("s_diffuse", r2_RT_albedo); |
| 48 | + |
| 49 | + jitter (C); |
| 50 | + |
| 51 | + // C.r_Sampler ("s_water", "water\\water_water"); |
| 52 | + |
| 53 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 54 | + //C.r_Sampler ("s_water", "water\\water_normal"); |
| 55 | + |
| 56 | + C.r_Sampler ("s_water", "water\\water_SBumpVolume"); |
| 57 | + //C.r_Sampler ("s_waterFall", "water\\water_normal"); |
| 58 | + C.r_Sampler ("s_waterFall", "water\\water_flowing_nmap"); |
| 59 | + |
| 60 | + C.r_End (); |
| 61 | + |
| 62 | + break; |
| 63 | + |
| 64 | + case 2: // Apply normals |
| 65 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 66 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 67 | + C.r_Pass ("stub_notransform_2uv", "rain_apply_normal_nomsaa", false, TRUE, FALSE, FALSE); |
| 68 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 69 | + |
| 70 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 71 | + //C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 72 | + C.r_Sampler_clw ("s_material", r2_material); |
| 73 | + //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 74 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 75 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 76 | + |
| 77 | + jitter (C); |
| 78 | + |
| 79 | + // C.r_Sampler ("s_water", "water\\water_water"); |
| 80 | + |
| 81 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 82 | + C.r_Sampler ("s_patched_normal", r2_RT_accum); |
| 83 | + |
| 84 | + // Normal can be packed into R and G |
| 85 | + if (RImplementation.o.dx10_gbuffer_opt) |
| 86 | + C.r_ColorWriteEnable( true, true, false, false ); |
| 87 | + else |
| 88 | + C.r_ColorWriteEnable( true, true, true, false ); |
| 89 | + |
| 90 | + C.r_End (); |
| 91 | + |
| 92 | + break; |
| 93 | + |
| 94 | + case 3: // Apply gloss |
| 95 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 96 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 97 | + C.r_Pass ("stub_notransform_2uv", "rain_apply_gloss_nomsaa", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 98 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 99 | + |
| 100 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 101 | + //C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 102 | + C.r_Sampler_clw ("s_material", r2_material); |
| 103 | + //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 104 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 105 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 106 | + |
| 107 | + jitter (C); |
| 108 | + |
| 109 | + // C.r_Sampler ("s_water", "water\\water_water"); |
| 110 | + |
| 111 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 112 | + C.r_Sampler ("s_patched_normal", r2_RT_accum); |
| 113 | + |
| 114 | + //C.r_ColorWriteEnable( false, false, false, true ); |
| 115 | + |
| 116 | + C.RS.SetRS(D3DRS_SRCBLEND, D3DBLEND_ZERO ); |
| 117 | + C.RS.SetRS(D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR ); |
| 118 | + |
| 119 | + C.r_End (); |
| 120 | + |
| 121 | + break; |
| 122 | + } |
| 123 | +} |
| 124 | + |
| 125 | +void CBlender_rain_msaa::SetDefine( LPCSTR Name, LPCSTR Definition ) |
| 126 | +{ |
| 127 | + this->Name = Name; |
| 128 | + this->Definition = Definition; |
| 129 | +} |
| 130 | + |
| 131 | +void CBlender_rain_msaa::Compile(CBlender_Compile& C) |
| 132 | +{ |
| 133 | + IBlender::Compile (C); |
| 134 | + |
| 135 | + if( Name ) |
| 136 | + GEnv.Render->m_MSAASample = atoi( Definition ); |
| 137 | + else |
| 138 | + GEnv.Render->m_MSAASample = -1; |
| 139 | + |
| 140 | + switch (C.iElement) |
| 141 | + { |
| 142 | + case 0: // Patch normals |
| 143 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 144 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 145 | + C.r_Pass ("stub_notransform_2uv", "rain_patch_normal_msaa", false, TRUE, FALSE, FALSE); |
| 146 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 147 | + |
| 148 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 149 | + C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 150 | + C.r_Sampler_clw ("s_material", r2_material); |
| 151 | + //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 152 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 153 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 154 | + |
| 155 | + C.r_Sampler_rtf ("s_diffuse", r2_RT_albedo); |
| 156 | + |
| 157 | + jitter (C); |
| 158 | + |
| 159 | + // C.r_Sampler ("s_water", "water\\water_water"); |
| 160 | + |
| 161 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 162 | + //C.r_Sampler ("s_water", "water\\water_normal"); |
| 163 | + |
| 164 | + C.r_Sampler ("s_water", "water\\water_SBumpVolume"); |
| 165 | + //C.r_dx10Texture ("s_waterFall", "water\\water_normal"); |
| 166 | + C.r_Sampler ("s_waterFall", "water\\water_flowing_nmap"); |
| 167 | + |
| 168 | + C.r_End (); |
| 169 | + |
| 170 | + break; |
| 171 | + |
| 172 | + case 1: // Apply normals |
| 173 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 174 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 175 | + C.r_Pass ("stub_notransform_2uv", "rain_apply_normal_msaa", false, TRUE, FALSE, FALSE); |
| 176 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 177 | + |
| 178 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 179 | + //C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 180 | + C.r_Sampler_clw ("s_material", r2_material); |
| 181 | + //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 182 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 183 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 184 | + |
| 185 | + jitter (C); |
| 186 | + |
| 187 | + // C.r_Sampler ("s_water", "water\\water_water"); |
| 188 | + |
| 189 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 190 | + C.r_Sampler("s_patched_normal", r2_RT_accum); |
| 191 | + |
| 192 | + // Normal can be packed into R and G |
| 193 | + if (RImplementation.o.dx10_gbuffer_opt) |
| 194 | + C.r_ColorWriteEnable( true, true, false, false ); |
| 195 | + else |
| 196 | + C.r_ColorWriteEnable( true, true, true, false ); |
| 197 | + |
| 198 | + C.r_End (); |
| 199 | + |
| 200 | + break; |
| 201 | + |
| 202 | + case 2: // Apply gloss |
| 203 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 204 | + //C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); |
| 205 | + C.r_Pass ("stub_notransform_2uv", "rain_apply_gloss_msaa", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE); |
| 206 | + C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer |
| 207 | + |
| 208 | + C.r_Sampler_rtf ("s_position", r2_RT_P); |
| 209 | + //C.r_Sampler_rtf ("s_normal", r2_RT_N); |
| 210 | + C.r_Sampler_clw ("s_material", r2_material); |
| 211 | + //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum); |
| 212 | + C.r_Sampler ("s_lmap", r2_sunmask); |
| 213 | + C.r_Sampler_cmp ("s_smap", r2_RT_smap_depth); |
| 214 | + |
| 215 | + jitter (C); |
| 216 | + |
| 217 | + // C.r_Sampler ("s_water", "water\\water_water"); |
| 218 | + |
| 219 | + //C.r_Sampler ("s_water", "water\\water_studen"); |
| 220 | + C.r_Sampler("s_patched_normal", r2_RT_accum); |
| 221 | + |
| 222 | + //C.r_ColorWriteEnable( false, false, false, true ); |
| 223 | + |
| 224 | + C.RS.SetRS(D3DRS_SRCBLEND, D3DBLEND_ZERO ); |
| 225 | + C.RS.SetRS(D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR ); |
| 226 | + |
| 227 | + C.r_End (); |
| 228 | + |
| 229 | + break; |
| 230 | + } |
| 231 | + GEnv.Render->m_MSAASample = -1; |
| 232 | +} |
| 233 | + |
0 commit comments