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

Method _renderCorona

Engine/source/environment/sun.cpp:461–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
462{
463 // Calculate Billboard Radius (in world units) to be constant, independent of distance.
464 // Takes into account distance, viewport size, and specified size in editor
465 F32 BBRadius = mCoronaWorldRadius;
466
467 mMatrixSet->restoreSceneViewProjection();
468
469 if ( state->isReflectPass() )
470 mMatrixSet->setProjection( state->getSceneManager()->getNonClipProjection() );
471
472 //mMatrixSet->setWorld( MatrixF::Identity );
473
474 // Initialize points with basic info
475 Point3F points[4];
476 points[0] = Point3F(-BBRadius, 0.0, -BBRadius);
477 points[1] = Point3F( -BBRadius, 0.0, BBRadius);
478 points[2] = Point3F( BBRadius, 0.0, -BBRadius);
479 points[3] = Point3F(BBRadius, 0.0, BBRadius);
480
481 static const Point2F sCoords[4] =
482 {
483 Point2F( 0.0f, 0.0f ),
484 Point2F( 0.0f, 1.0f ),
485 Point2F( 1.0f, 0.0f ),
486 Point2F(1.0f, 1.0f)
487 };
488
489 // Get info we need to adjust points
490 const MatrixF &camView = state->getCameraTransform();
491
492 // Finalize points
493 for(S32 i = 0; i < 4; i++)
494 {
495 // align with camera
496 camView.mulV(points[i]);
497 // offset
498 points[i] += mLightWorldPos;
499 }
500
501 LinearColorF vertColor;
502 if ( mCoronaUseLightColor )
503 vertColor = mLightColor;
504 else
505 vertColor = mCoronaTint;
506
507 GFXVertexBufferHandle< GFXVertexPCT > vb;
508 vb.set( GFX, 4, GFXBufferTypeVolatile );
509 GFXVertexPCT *pVert = vb.lock();
510 if(!pVert) return;
511
512 for ( S32 i = 0; i < 4; i++ )
513 {
514 pVert->color.set( vertColor.toColorI());
515 pVert->point.set( points[i] );
516 pVert->texCoord.set( sCoords[i].x, sCoords[i].y );
517 pVert++;
518 }

Callers

nothing calls this directly

Calls 15

isReflectPassMethod · 0.80
mulVMethod · 0.80
toColorIMethod · 0.80
setVertexBufferMethod · 0.80
Point3FClass · 0.50
Point2FClass · 0.50
getSceneManagerMethod · 0.45
getCameraTransformMethod · 0.45
setMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45
setupPassMethod · 0.45

Tested by

no test coverage detected