Reworks the terrain loader code to work with the assets.

Fixes the terrain asset creation, makes the loading logic go through the asset auto-import behavior when a filename or assetid is bound that is not found.
Corrects terrain material binding to properly save and load
Makes the terrain asset inspector fields work as expected.
This commit is contained in:
Areloch 2020-06-25 23:33:01 -05:00
parent 3e1795ba1d
commit 4ce558f042
15 changed files with 500 additions and 283 deletions

View file

@ -84,7 +84,10 @@ void TerrainBlock::_onFlushMaterials()
}
void TerrainBlock::_updateMaterials()
{
{
if (!mFile)
return;
mBaseTextures.setSize( mFile->mMaterials.size() );
mMaxDetailDistance = 0.0f;
@ -363,6 +366,9 @@ void TerrainBlock::_renderBlock( SceneRenderState *state )
{
PROFILE_SCOPE( TerrainBlock_RenderBlock );
if (!mFile)
return;
// Prevent rendering shadows if feature is disabled
if ( !mCastShadows && state->isShadowPass() )
return;
@ -529,4 +535,4 @@ void TerrainBlock::_renderDebug( ObjectRenderInst *ri,
mDebugCells[i]->renderBounds();
mDebugCells.clear();
}
}