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

Method _renderBlock

Engine/source/terrain/terrRender.cpp:351–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void TerrainBlock::_renderBlock( SceneRenderState *state )
352{
353 PROFILE_SCOPE( TerrainBlock_RenderBlock );
354
355 // Prevent rendering shadows if feature is disabled
356 if ( !mCastShadows && state->isShadowPass() )
357 return;
358
359 MatrixF worldViewXfm = state->getWorldViewMatrix();
360 worldViewXfm.mul( getRenderTransform() );
361
362 MatrixF worldViewProjXfm = state->getProjectionMatrix();
363 worldViewProjXfm.mul( worldViewXfm );
364
365 const MatrixF &objectXfm = getRenderWorldTransform();
366
367 Point3F objCamPos = state->getDiffuseCameraPosition();
368 objectXfm.mulP( objCamPos );
369
370 // Get the shadow material.
371 if ( !mDefaultMatInst )
372 mDefaultMatInst = TerrainCellMaterial::getShadowMat();
373
374 // Make sure we have a base material.
375 if ( !mBaseMaterial )
376 {
377 mBaseMaterial = new TerrainCellMaterial();
378 mBaseMaterial->init( this, 0, false, false, true );
379 }
380
381 // Did the detail layers change?
382 if ( mDetailsDirty )
383 {
384 _updateMaterials();
385 mDetailsDirty = false;
386 }
387
388 // If the layer texture has been cleared or is
389 // dirty then update it.
390 if ( mLayerTex.isNull() || mLayerTexDirty )
391 _updateLayerTexture();
392
393 // If the layer texture is dirty or we lost the base
394 // texture then regenerate it.
395 if ( mLayerTexDirty || mBaseTex.isNull() )
396 {
397 _updateBaseTexture( false );
398 mLayerTexDirty = false;
399 }
400
401 static Vector<TerrCell*> renderCells;
402 renderCells.clear();
403
404 mCell->cullCells( state,
405 objCamPos,
406 &renderCells );
407
408 RenderPassManager *renderPass = state->getRenderPass();

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