@@ -15,7 +15,7 @@ using namespace GITechDemoApp;
15
15
namespace GITechDemoApp
16
16
{
17
17
bool LENS_FLARE_ENABLED = true ;
18
- float LENS_FLARE_BRIGHTNESS_THRESHOLD = 4 .f ;
18
+ float LENS_FLARE_BRIGHTNESS_THRESHOLD = 3 . 5f ;
19
19
20
20
const unsigned int LENS_FLARE_BLUR_KERNEL_COUNT = 3 ;
21
21
const unsigned int LENS_FLARE_BLUR_KERNEL[LENS_FLARE_BLUR_KERNEL_COUNT] = { 0 , 1 , 2 };
@@ -86,6 +86,11 @@ void LensFlarePass::Update(const float fDeltaTime)
86
86
0 .f , 0 .f , 1 .f );
87
87
88
88
f33LensFlareStarBurstMat = scaleBias2 * rotMat * scaleBias1;
89
+
90
+ if (bAnamorphic)
91
+ CurrentLensFlareBuffer = AnamorphicLensFlareBuffer;
92
+ else
93
+ CurrentLensFlareBuffer = SphericalLensFlareBuffer;
89
94
}
90
95
91
96
void LensFlarePass::Draw ()
@@ -107,7 +112,7 @@ void LensFlarePass::ApplyBrightnessFilter()
107
112
108
113
PUSH_PROFILE_MARKER (" Brightness filter" );
109
114
110
- LensFlareBuffer [0 ]->Enable ();
115
+ CurrentLensFlareBuffer [0 ]->Enable ();
111
116
112
117
// Not necesarry
113
118
// RenderContext->Clear(Vec4f(0.f, 0.f, 0.f, 0.f), 1.f, 0);
@@ -131,7 +136,7 @@ void LensFlarePass::ApplyBrightnessFilter()
131
136
132
137
fBrightnessThreshold = bkp;
133
138
134
- LensFlareBuffer [0 ]->Disable ();
139
+ CurrentLensFlareBuffer [0 ]->Disable ();
135
140
136
141
POP_PROFILE_MARKER ();
137
142
}
@@ -149,33 +154,33 @@ void LensFlarePass::GenerateFeatures()
149
154
PUSH_PROFILE_MARKER (" Feature generation" );
150
155
151
156
ResourceMgr->GetTexture (
152
- LensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
153
- )->SetAddressingMode (SAM_WRAP );
157
+ CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
158
+ )->SetAddressingMode (SAM_CLAMP );
154
159
155
160
ResourceMgr->GetTexture (
156
- LensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
161
+ CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
157
162
)->SetFilter (SF_MIN_MAG_LINEAR_MIP_NONE);
158
163
159
- LensFlareBuffer [1 ]->Enable ();
164
+ CurrentLensFlareBuffer [1 ]->Enable ();
160
165
161
166
// Not necesarry
162
167
// RenderContext->Clear(Vec4f(0.f, 0.f, 0.f, 0.f), 1.f, 0);
163
168
164
169
f2HalfTexelOffset = Vec2f (
165
- 0 .5f / LensFlareBuffer [0 ]->GetRenderTarget ()->GetWidth (),
166
- 0 .5f / LensFlareBuffer [0 ]->GetRenderTarget ()->GetHeight ()
170
+ 0 .5f / CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetWidth (),
171
+ 0 .5f / CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetHeight ()
167
172
);
168
173
f2TexelSize = Vec2f (
169
- 1 .f / LensFlareBuffer [0 ]->GetRenderTarget ()->GetWidth (),
170
- 1 .f / LensFlareBuffer [0 ]->GetRenderTarget ()->GetHeight ()
174
+ 1 .f / CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetWidth (),
175
+ 1 .f / CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetHeight ()
171
176
);
172
- texSource = LensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer ();
177
+ texSource = CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer ();
173
178
174
179
LensFlareFeaturesShader.Enable ();
175
180
RenderContext->DrawVertexBuffer (FullScreenTri);
176
181
LensFlareFeaturesShader.Disable ();
177
182
178
- LensFlareBuffer [1 ]->Disable ();
183
+ CurrentLensFlareBuffer [1 ]->Disable ();
179
184
180
185
POP_PROFILE_MARKER ();
181
186
}
@@ -193,17 +198,17 @@ void LensFlarePass::Blur()
193
198
PUSH_PROFILE_MARKER (" Blur" );
194
199
195
200
ResourceMgr->GetTexture (
196
- LensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
201
+ CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
197
202
)->SetAddressingMode (SAM_CLAMP);
198
203
ResourceMgr->GetTexture (
199
- LensFlareBuffer [1 ]->GetRenderTarget ()->GetColorBuffer (0 )
204
+ CurrentLensFlareBuffer [1 ]->GetRenderTarget ()->GetColorBuffer (0 )
200
205
)->SetAddressingMode (SAM_CLAMP);
201
206
202
207
ResourceMgr->GetTexture (
203
- LensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
208
+ CurrentLensFlareBuffer [0 ]->GetRenderTarget ()->GetColorBuffer (0 )
204
209
)->SetFilter (SF_MIN_MAG_POINT_MIP_NONE);
205
210
ResourceMgr->GetTexture (
206
- LensFlareBuffer [1 ]->GetRenderTarget ()->GetColorBuffer (0 )
211
+ CurrentLensFlareBuffer [1 ]->GetRenderTarget ()->GetColorBuffer (0 )
207
212
)->SetFilter (SF_MIN_MAG_POINT_MIP_NONE);
208
213
209
214
for (unsigned int i = 0 ; i < LENS_FLARE_BLUR_KERNEL_COUNT; i++)
@@ -214,31 +219,28 @@ void LensFlarePass::Blur()
214
219
#endif
215
220
PUSH_PROFILE_MARKER (label);
216
221
217
- LensFlareBuffer [i % 2 ]->Enable ();
222
+ CurrentLensFlareBuffer [i % 2 ]->Enable ();
218
223
219
224
// Not necesarry
220
225
// RenderContext->Clear(Vec4f(0.f, 0.f, 0.f, 0.f), 1.f, 0);
221
226
222
227
f2HalfTexelOffset = Vec2f (
223
- 0 .5f / LensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetWidth (),
224
- 0 .5f / LensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetHeight ()
228
+ 0 .5f / CurrentLensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetWidth (),
229
+ 0 .5f / CurrentLensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetHeight ()
225
230
);
226
- ResourceMgr->GetTexture (
227
- LensFlareBuffer[(i + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer (0 )
228
- )->SetFilter (SF_MIN_MAG_POINT_MIP_NONE);
229
- texSource = LensFlareBuffer[(i + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer (0 );
230
231
f2TexelSize = Vec2f (
231
- 1 .f / LensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetWidth (),
232
- 1 .f / LensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetHeight ()
232
+ 1 .f / CurrentLensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetWidth (),
233
+ 1 .f / CurrentLensFlareBuffer [(i + 1 ) % 2 ]->GetRenderTarget ()->GetHeight ()
233
234
);
235
+ texSource = CurrentLensFlareBuffer[(i + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer (0 );
234
236
nKernel = LENS_FLARE_BLUR_KERNEL[i];
235
237
236
238
// Reuse bloom shader for Kawase blur
237
239
BloomShader.Enable ();
238
240
RenderContext->DrawVertexBuffer (FullScreenTri);
239
241
BloomShader.Disable ();
240
242
241
- LensFlareBuffer [i % 2 ]->Disable ();
243
+ CurrentLensFlareBuffer [i % 2 ]->Disable ();
242
244
243
245
POP_PROFILE_MARKER ();
244
246
}
@@ -272,11 +274,11 @@ void LensFlarePass::UpscaleAndBlend()
272
274
RenderContext->GetRenderStateManager ()->SetZWriteEnabled (false );
273
275
RenderContext->GetRenderStateManager ()->SetZFunc (CMP_ALWAYS);
274
276
275
- f2HalfTexelOffset = Vec2f (0 .5f / LensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetWidth (), 0 .5f / LensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetHeight ());
277
+ f2HalfTexelOffset = Vec2f (0 .5f / CurrentLensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetWidth (), 0 .5f / CurrentLensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetHeight ());
276
278
ResourceMgr->GetTexture (
277
- LensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer (0 )
279
+ CurrentLensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer (0 )
278
280
)->SetFilter (SF_MIN_MAG_LINEAR_MIP_NONE);
279
- texLensFlareFeatures = LensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer ();
281
+ texLensFlareFeatures = CurrentLensFlareBuffer [(LENS_FLARE_BLUR_KERNEL_COUNT + 1 ) % 2 ]->GetRenderTarget ()->GetColorBuffer ();
280
282
281
283
LensFlareApplyShader.Enable ();
282
284
RenderContext->DrawVertexBuffer (FullScreenTri);
0 commit comments