sunBokeh feature added

This commit is contained in:
Duion 2016-06-02 20:52:46 +02:00
parent 5d52864c9f
commit 637a804fd7
6 changed files with 29 additions and 1 deletions

View file

@ -121,6 +121,7 @@ LightFlareData::LightFlareData()
mElementCount( 0 ),
mScale( 1.0f ),
mOcclusionRadius( 0.0f ),
mVisibility( 1.0f ), //sunBokeh feature
mRenderReflectPass( true )
{
dMemset( mElementRect, 0, sizeof( RectF ) * MAX_ELEMENTS );
@ -445,6 +446,8 @@ void LightFlareData::prepRender( SceneRenderState *state, LightFlareState *flare
const RectI &viewport = GFX->getViewport();
Point3F oneOverViewportExtent( 1.0f / (F32)viewport.extent.x, 1.0f / (F32)viewport.extent.y, 0.0f );
// Sun visibility, assume 0 at start of frame
mVisibility = 0; //sunBokeh feature
// Really convert it to screen space.
lightPosSS.x -= viewport.point.x;
lightPosSS.y -= viewport.point.y;
@ -514,6 +517,7 @@ void LightFlareData::prepRender( SceneRenderState *state, LightFlareState *flare
// These are the factors which affect the "alpha" of the flare effect.
// Modulate more in as appropriate.
ColorF baseColor = ColorF::WHITE * lightSourceBrightnessScale * occlusionFade;
mVisibility = lightSourceBrightnessScale * fadeInOutScale * occlusionFade; //sunBokeh feature
// Setup the vertex buffer for the maximum flare elements.
const U32 vertCount = 4 * mElementCount;

View file

@ -94,6 +94,8 @@ public:
/// Submits render instances for corona and flare effects.
void prepRender( SceneRenderState *state, LightFlareState *flareState );
/// sunBokeh feature
F32 getVisibility() const { return mVisibility; }
protected:
@ -112,7 +114,7 @@ protected:
static Point3F sBasePoints[4];
// Fields...
F32 mVisibility; //sunBokeh feature
F32 mScale;
bool mFlareEnabled;
String mFlareTextureName;