16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 22:09:19 +02:00

texture-related log message filtering

This commit is contained in:
tmj-fstate
2018-01-17 18:00:13 +01:00
parent b96f254679
commit 872abc2c00
3 changed files with 14 additions and 13 deletions

3
Logs.h
View File

@@ -14,7 +14,8 @@ enum logtype : unsigned int {
generic = 0x1, generic = 0x1,
file = 0x2, file = 0x2,
model = 0x4 model = 0x4,
texture = 0x8
}; };
void WriteLog( const char *str, logtype const Type = logtype::generic ); void WriteLog( const char *str, logtype const Type = logtype::generic );

View File

@@ -1234,7 +1234,7 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem
if (false == result) if (false == result)
{ {
ErrorLog("Failed to load 3d model \"" + FileName + "\""); ErrorLog("Bad model: failed to load 3d model \"" + FileName + "\"");
} }
return result; return result;
}; };
@@ -1697,7 +1697,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic) void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic)
{ // wczytanie modelu z pliku binarnego { // wczytanie modelu z pliku binarnego
WriteLog("Loading binary format 3d model data from \"" + FileName + "\"..."); WriteLog( "Loading binary format 3d model data from \"" + FileName + "\"...", logtype::model );
std::ifstream file(FileName, std::ios::binary); std::ifstream file(FileName, std::ios::binary);
@@ -1710,12 +1710,12 @@ void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic)
deserialize(file, size, dynamic); deserialize(file, size, dynamic);
file.close(); file.close();
WriteLog("Finished loading 3d model data from \"" + FileName + "\""); WriteLog( "Finished loading 3d model data from \"" + FileName + "\"", logtype::model );
}; };
void TModel3d::LoadFromTextFile(std::string const &FileName, bool dynamic) void TModel3d::LoadFromTextFile(std::string const &FileName, bool dynamic)
{ // wczytanie submodelu z pliku tekstowego { // wczytanie submodelu z pliku tekstowego
WriteLog("Loading text format 3d model data from \"" + FileName + "\"..."); WriteLog( "Loading text format 3d model data from \"" + FileName + "\"...", logtype::model );
iFlags |= 0x0200; // wczytano z pliku tekstowego (właścicielami tablic są submodle) iFlags |= 0x0200; // wczytano z pliku tekstowego (właścicielami tablic są submodle)
cParser parser(FileName, cParser::buffer_FILE); // Ra: tu powinno być "models\\"... cParser parser(FileName, cParser::buffer_FILE); // Ra: tu powinno być "models\\"...
TSubModel *SubModel; TSubModel *SubModel;

View File

@@ -39,7 +39,7 @@ opengl_texture::load() {
if( name.size() < 3 ) { goto fail; } if( name.size() < 3 ) { goto fail; }
WriteLog( "Loading texture data from \"" + name + "\"" ); WriteLog( "Loading texture data from \"" + name + "\"", logtype::texture );
data_state = resource_state::loading; data_state = resource_state::loading;
{ {
@@ -67,7 +67,7 @@ opengl_texture::load() {
fail: fail:
data_state = resource_state::failed; data_state = resource_state::failed;
ErrorLog( "Failed to load texture \"" + name + "\"" ); ErrorLog( "Bad texture: failed to load texture \"" + name + "\"" );
// NOTE: temporary workaround for texture assignment errors // NOTE: temporary workaround for texture assignment errors
id = 0; id = 0;
return; return;
@@ -91,7 +91,7 @@ opengl_texture::load_BMP() {
BITMAPINFO info; BITMAPINFO info;
unsigned int infosize = header.bfOffBits - sizeof( BITMAPFILEHEADER ); unsigned int infosize = header.bfOffBits - sizeof( BITMAPFILEHEADER );
if( infosize > sizeof( info ) ) { if( infosize > sizeof( info ) ) {
WriteLog( "Warning - BMP header is larger than expected, possible format difference." ); WriteLog( "Warning - BMP header is larger than expected, possible format difference.", logtype::texture );
} }
file.read( (char *)&info, std::min( (size_t)infosize, sizeof( info ) ) ); file.read( (char *)&info, std::min( (size_t)infosize, sizeof( info ) ) );
@@ -100,7 +100,7 @@ opengl_texture::load_BMP() {
if( info.bmiHeader.biCompression != BI_RGB ) { if( info.bmiHeader.biCompression != BI_RGB ) {
ErrorLog( "Compressed BMP textures aren't supported." ); ErrorLog( "Bad texture: compressed BMP textures aren't supported.", logtype::texture );
data_state = resource_state::failed; data_state = resource_state::failed;
return; return;
} }
@@ -289,7 +289,7 @@ opengl_texture::load_DDS() {
*/ */
if( datasize == 0 ) { if( datasize == 0 ) {
// catch malformed .dds files // catch malformed .dds files
WriteLog( "File \"" + name + "\" is malformed and holds no texture data." ); WriteLog( "Bad texture: file \"" + name + "\" is malformed and holds no texture data.", logtype::texture );
data_state = resource_state::failed; data_state = resource_state::failed;
return; return;
} }
@@ -330,7 +330,7 @@ opengl_texture::load_TEX() {
hasalpha = true; hasalpha = true;
} }
else { else {
ErrorLog( "Unrecognized TEX texture sub-format: " + std::string(head) ); ErrorLog( "Bad texture: unrecognized TEX texture sub-format: " + std::string(head), logtype::texture );
data_state = resource_state::failed; data_state = resource_state::failed;
return; return;
}; };
@@ -793,7 +793,7 @@ texture_manager::create( std::string Filename, bool const Loadnow ) {
if( true == filename.empty() ) { if( true == filename.empty() ) {
// there's nothing matching in the databank nor on the disk, report failure // there's nothing matching in the databank nor on the disk, report failure
ErrorLog( "Texture file missing: \"" + Filename + "\"" ); ErrorLog( "Bad file: failed do locate texture file \"" + Filename + "\"", logtype::file );
return npos; return npos;
} }
@@ -808,7 +808,7 @@ texture_manager::create( std::string Filename, bool const Loadnow ) {
m_textures.emplace_back( texture, std::chrono::steady_clock::time_point() ); m_textures.emplace_back( texture, std::chrono::steady_clock::time_point() );
m_texturemappings.emplace( filename, textureindex ); m_texturemappings.emplace( filename, textureindex );
WriteLog( "Created texture object for \"" + filename + "\"" ); WriteLog( "Created texture object for \"" + filename + "\"", logtype::texture );
if( true == Loadnow ) { if( true == Loadnow ) {