| 342 | |
| 343 | |
| 344 | void Sun::prepRenderImage( SceneRenderState *state ) |
| 345 | { |
| 346 | // Only render into diffuse and reflect passes. |
| 347 | |
| 348 | if( !state->isDiffusePass() && |
| 349 | !state->isReflectPass() ) |
| 350 | return; |
| 351 | |
| 352 | mLightWorldPos = state->getCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f; |
| 353 | F32 dist = ( mLightWorldPos - state->getCameraPosition() ).len(); |
| 354 | |
| 355 | F32 screenRadius = GFX->getViewport().extent.y * mCoronaScale * 0.5f; |
| 356 | mCoronaWorldRadius = screenRadius * dist / state->getWorldToScreenScale().y; |
| 357 | |
| 358 | // Render instance for Corona effect. |
| 359 | if ( mCoronaEnabled && mCoronaMatInst ) |
| 360 | { |
| 361 | mMatrixSet->setSceneProjection( GFX->getProjectionMatrix() ); |
| 362 | mMatrixSet->setSceneView( GFX->getViewMatrix() ); |
| 363 | mMatrixSet->setWorld( GFX->getWorldMatrix() ); |
| 364 | |
| 365 | ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>(); |
| 366 | ri->renderDelegate.bind( this, &Sun::_renderCorona ); |
| 367 | ri->type = RenderPassManager::RIT_Sky; |
| 368 | // Render after sky objects and before CloudLayer! |
| 369 | ri->defaultKey = 5; |
| 370 | ri->defaultKey2 = 0; |
| 371 | state->getRenderPass()->addInst( ri ); |
| 372 | } |
| 373 | |
| 374 | // LightFlareData handles rendering flare effects. |
| 375 | if ( mFlareData ) |
| 376 | { |
| 377 | mFlareState.fullBrightness = mBrightness; |
| 378 | mFlareState.scale = mFlareScale; |
| 379 | mFlareState.lightInfo = mLight; |
| 380 | mFlareState.worldRadius = mCoronaWorldRadius; |
| 381 | |
| 382 | mFlareState.lightMat.identity(); |
| 383 | mFlareState.lightMat.setPosition( mLightWorldPos ); |
| 384 | |
| 385 | mFlareData->prepRender( state, &mFlareState ); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | void Sun::setAzimuth( F32 azimuth ) |
| 390 | { |
nothing calls this directly
no test coverage detected