From a6297e2c32a9309c084d87db8e4b1eea1ec839a7 Mon Sep 17 00:00:00 2001 From: Duion Date: Wed, 14 Oct 2015 00:01:14 +0200 Subject: [PATCH] extra option for terrain block to disable the update of the basetexture file --- Engine/source/terrain/terrData.cpp | 11 +++++++++-- Engine/source/terrain/terrData.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index 356e5140b..ff3964348 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -197,7 +197,8 @@ TerrainBlock::TerrainBlock() mBaseTexScaleConst( NULL ), mBaseTexIdConst( NULL ), mPhysicsRep( NULL ), - mZoningDirty( false ) + mZoningDirty( false ), + mUpdateBasetex ( true ) { mTypeMask = TerrainObjectType | StaticObjectType | StaticShapeObjectType; mNetFlags.set(Ghostable | ScopeAlways); @@ -962,7 +963,7 @@ bool TerrainBlock::onAdd() // If the cached base texture is older that the terrain file or // it doesn't exist then generate and cache it. String baseCachePath = _getBaseTexCacheFileName(); - if ( Platform::compareModifiedTimes( baseCachePath, mTerrFileName ) < 0 ) + if ( Platform::compareModifiedTimes( baseCachePath, mTerrFileName ) < 0 && mUpdateBasetex ) _updateBaseTexture( true ); // The base texture should have been cached by now... so load it. @@ -1146,6 +1147,8 @@ void TerrainBlock::initPersistFields() "Light map dimensions in pixels." ); addField( "screenError", TypeS32, Offset( mScreenError, TerrainBlock ), "Not yet implemented." ); + + addField( "updateBasetex", TypeBool, Offset( mUpdateBasetex, TerrainBlock ), "Whether or not to update the Base Texture" ); endGroup( "Misc" ); @@ -1199,6 +1202,8 @@ U32 TerrainBlock::packUpdate(NetConnection* con, U32 mask, BitStream *stream) stream->write( mScreenError ); stream->writeInt(mBaseTexFormat, 32); + + stream->writeFlag( mUpdateBasetex ); return retMask; } @@ -1268,6 +1273,8 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) stream->read( &mScreenError ); mBaseTexFormat = (BaseTexFormat)stream->readInt(32); + + mUpdateBasetex = stream->readFlag(); } void TerrainBlock::getMinMaxHeight( F32 *minHeight, F32 *maxHeight ) const diff --git a/Engine/source/terrain/terrData.h b/Engine/source/terrain/terrData.h index 2982de3e9..c689c3897 100644 --- a/Engine/source/terrain/terrData.h +++ b/Engine/source/terrain/terrData.h @@ -200,6 +200,9 @@ protected: /// True if the zoning needs to be recalculated for the terrain. bool mZoningDirty; + + /// For disabling of Basetexture generation + bool mUpdateBasetex; String _getBaseTexCacheFileName() const;