Revert "revert #1148 as prematurely incorporated"

This reverts commit f946088214.
This commit is contained in:
marauder2k7 2024-01-20 18:01:57 +00:00
parent bd2121b674
commit 7216ba8530
22 changed files with 20385 additions and 1813 deletions

View file

@ -67,14 +67,7 @@ bool TerrainBlock::exportHeightMap( const UTF8 *filePath, const String &format )
}
}
FileStream stream;
if ( !stream.open( filePath, Torque::FS::File::Write ) )
{
Con::errorf( "TerrainBlock::exportHeightMap() - Error opening file for writing: %s !", filePath );
return false;
}
if ( !output.writeBitmap( format, stream ) )
if ( !output.writeBitmap( format, filePath) )
{
Con::errorf( "TerrainBlock::exportHeightMap() - Error writing %s: %s !", format.c_str(), filePath );
return false;
@ -120,14 +113,7 @@ bool TerrainBlock::exportLayerMaps( const UTF8 *filePrefix, const String &format
UTF8 filePath[1024];
dSprintf( filePath, 1024, "%s_%d_%s.%s", filePrefix, i, mFile->mMaterials[i]->getInternalName(), format.c_str() );
FileStream stream;
if ( !stream.open( filePath, Torque::FS::File::Write ) )
{
Con::errorf( "TerrainBlock::exportLayerMaps() - Error opening file for writing: %s !", filePath );
return false;
}
if ( !output.writeBitmap( format, stream ) )
if ( !output.writeBitmap( format, filePath) )
{
Con::errorf( "TerrainBlock::exportLayerMaps() - Error writing %s: %s !", format.c_str(), filePath );
return false;

View file

@ -477,16 +477,9 @@ void TerrainBlock::_updateBaseTexture(bool writeToCache)
}
else
{
FileStream stream;
if (!stream.open(_getBaseTexCacheFileName(), Torque::FS::File::Write))
{
mBaseTex = blendTex;
return;
}
GBitmap bitmap(blendTex->getWidth(), blendTex->getHeight(), false, GFXFormatR8G8B8A8);
blendTex->copyToBmp(&bitmap);
bitmap.writeBitmap(formatToExtension(mBaseTexFormat), stream);
bitmap.writeBitmap(formatToExtension(mBaseTexFormat), _getBaseTexCacheFileName());
}
}