MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / prepRenderImage

Method prepRenderImage

Engine/source/environment/sun.cpp:344–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342
343
344void 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
389void Sun::setAzimuth( F32 azimuth )
390{

Callers

nothing calls this directly

Calls 14

isDiffusePassMethod · 0.80
isReflectPassMethod · 0.80
getFarPlaneMethod · 0.80
getWorldToScreenScaleMethod · 0.80
getProjectionMatrixMethod · 0.80
getDirectionMethod · 0.45
lenMethod · 0.45
getWorldMatrixMethod · 0.45
getRenderPassMethod · 0.45
bindMethod · 0.45
addInstMethod · 0.45
identityMethod · 0.45

Tested by

no test coverage detected