Browse Source

extra option for terrain block to disable the update of the basetexture
file

Duion 10 years ago
parent
commit
a6297e2c32
2 changed files with 12 additions and 2 deletions
  1. 9 2
      Engine/source/terrain/terrData.cpp
  2. 3 0
      Engine/source/terrain/terrData.h

+ 9 - 2
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 

+ 3 - 0
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;