mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 00:59:19 +02:00
Merge branch 'tmj-dev'
This commit is contained in:
18
material.cpp
18
material.cpp
@@ -69,14 +69,14 @@ opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool c
|
||||
else if( key == "texture1:" ) {
|
||||
if( ( texture1 == null_handle )
|
||||
|| ( Priority > priority1 ) ) {
|
||||
texture1 = GfxRenderer.Fetch_Texture( path( name ) + value, Loadnow );
|
||||
texture1 = GfxRenderer.Fetch_Texture( value, Loadnow );
|
||||
priority1 = Priority;
|
||||
}
|
||||
}
|
||||
else if( key == "texture2:" ) {
|
||||
if( ( texture2 == null_handle )
|
||||
|| ( Priority > priority2 ) ) {
|
||||
texture2 = GfxRenderer.Fetch_Texture( path( name ) + value, Loadnow );
|
||||
texture2 = GfxRenderer.Fetch_Texture( value, Loadnow );
|
||||
priority2 = Priority;
|
||||
}
|
||||
}
|
||||
@@ -120,12 +120,10 @@ material_manager::create( std::string const &Filename, bool const Loadnow ) {
|
||||
}
|
||||
filename += ".mat";
|
||||
|
||||
std::replace(filename.begin(), filename.end(), '\\', '/'); // fix slashes
|
||||
|
||||
if( filename.find( '/' ) == std::string::npos ) {
|
||||
// jeśli bieżaca ścieżka do tekstur nie została dodana to dodajemy domyślną
|
||||
filename = global_texture_path + filename;
|
||||
}
|
||||
// change slashes to llinux-compatible
|
||||
std::replace(
|
||||
std::begin( filename ), std::end( filename ),
|
||||
'\\', '/' );
|
||||
|
||||
// try to locate requested material in the databank
|
||||
auto const databanklookup = find_in_databank( filename );
|
||||
@@ -168,7 +166,7 @@ material_manager::find_in_databank( std::string const &Materialname ) const {
|
||||
return lookup->second;
|
||||
}
|
||||
// jeszcze próba z dodatkową ścieżką
|
||||
lookup = m_materialmappings.find( global_texture_path + Materialname );
|
||||
lookup = m_materialmappings.find( szTexturePath + Materialname );
|
||||
|
||||
return (
|
||||
lookup != m_materialmappings.end() ?
|
||||
@@ -183,7 +181,7 @@ material_manager::find_on_disk( std::string const &Materialname ) const {
|
||||
|
||||
return(
|
||||
FileExists( Materialname ) ? Materialname :
|
||||
FileExists( global_texture_path + Materialname ) ? global_texture_path + Materialname :
|
||||
FileExists( szTexturePath + Materialname ) ? szTexturePath + Materialname :
|
||||
"" );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user