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

Method _renderCorona

Engine/source/environment/sun.cpp:453–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 14

isReflectPassMethod · 0.80
mulVMethod · 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
setTransformsMethod · 0.45

Tested by

no test coverage detected