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

@ -655,6 +655,11 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
state->getRenderPass()->addInst( ri );
}
*/
// Screen flare occlusion fix //sunBokeh feature
F32 screenRadius = GFX->getViewport().extent.y * mFlareScale * 0.01f;
Point3F lightWorldPos = state->getCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f;
F32 dist = ( lightWorldPos - state->getCameraPosition() ).len();
mFlareState.worldRadius = screenRadius * dist / state->getWorldToScreenScale().y;
// Light flare effect render instance.
if ( mFlareData && mNightInterpolant != 1.0f )

View file

@ -109,6 +109,10 @@ public:
F32 getAzimuth() const { return mSunAzimuth; }
///
F32 getElevation() const { return mSunElevation; }
/// sunBokeh feature
F32 getSunVisibility() const { if (mFlareData) return mFlareData->getVisibility(); else return 0; }
// Same method as above, but also checks if the data is valid, needs more CPU time, only use if above method fails
//F32 getSunVisibility() const { if dynamic_cast<LightFlareData*>(mFlareData) return mFlareData->getVisibility(); else return 0; }
protected: