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

Method _renderBlock

Engine/source/terrain/terrRender.cpp:493–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493void TerrainBlock::_renderBlock( SceneRenderState *state )
494{
495 PROFILE_SCOPE( TerrainBlock_RenderBlock );
496
497 if (!mFile)
498 return;
499
500 // Prevent rendering shadows if feature is disabled
501 if ( !mCastShadows && state->isShadowPass() )
502 return;
503
504 MatrixF worldViewXfm = state->getWorldViewMatrix();
505 worldViewXfm.mul( getRenderTransform() );
506
507 MatrixF worldViewProjXfm = state->getProjectionMatrix();
508 worldViewProjXfm.mul( worldViewXfm );
509
510 const MatrixF &objectXfm = getRenderWorldTransform();
511
512 Point3F objCamPos = state->getDiffuseCameraPosition();
513 objectXfm.mulP( objCamPos );
514
515 // Get the shadow material.
516 if ( !mDefaultMatInst )
517 mDefaultMatInst = TerrainCellMaterial::getShadowMat();
518
519 // Make sure we have a base material.
520 if ( !mBaseMaterial )
521 {
522 mBaseMaterial = new TerrainCellMaterial();
523 mBaseMaterial->init( this, 0, false, false, true );
524 }
525
526 // Did the detail layers change?
527 if ( mDetailsDirty )
528 {
529 _updateMaterials();
530 mDetailsDirty = false;
531 }
532
533 // If the layer texture has been cleared or is
534 // dirty then update it.
535 if ( mLayerTex.isNull() || mLayerTexDirty )
536 _updateLayerTexture();
537
538 // If the layer texture is dirty or we lost the base
539 // texture then regenerate it.
540 if ( mLayerTexDirty || mBaseTex.isNull() )
541 {
542 _updateBaseTexture( false );
543 mLayerTexDirty = false;
544 }
545
546 static Vector<TerrCell*> renderCells;
547 renderCells.clear();
548
549 mCell->cullCells( state,
550 objCamPos,

Callers

nothing calls this directly

Calls 15

mSquaredFunction · 0.85
isShadowPassMethod · 0.80
getProjectionMatrixMethod · 0.80
mulPMethod · 0.80
cullCellsMethod · 0.80
allocUniqueXformMethod · 0.80
isDiffusePassMethod · 0.80
isReflectPassMethod · 0.80
getOverrideMaterialMethod · 0.80
getSphereBoundsMethod · 0.80
getLightsMethod · 0.80

Tested by

no test coverage detected