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

vehicle mesh load fail crash fix, material and texture loading tweaks, minor bug fixes

This commit is contained in:
tmj-fstate
2018-05-21 03:34:01 +02:00
parent 6fd7dfc2fe
commit e12529243d
6 changed files with 158 additions and 98 deletions

View File

@@ -326,12 +326,14 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
m_material = -4;
iFlags |= (Opacity < 1.0) ? 8 : 0x10; // zmienna tekstura 4
}
else
{ // jeśli tylko nazwa pliku, to dawać bieżącą ścieżkę do tekstur
else {
Name_Material(material);
/*
if( material.find_first_of( "/\\" ) == material.npos ) {
// jeśli tylko nazwa pliku, to dawać bieżącą ścieżkę do tekstur
material.insert( 0, Global.asCurrentTexturePath );
}
*/
m_material = GfxRenderer.Fetch_Material( material );
// renderowanie w cyklu przezroczystych tylko jeśli:
// 1. Opacity=0 (przejściowo <1, czy tam <100) oraz
@@ -1657,9 +1659,11 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
auto const materialindex = static_cast<std::size_t>( iTexture );
if( materialindex < t->size() ) {
m_materialname = t->at( materialindex );
/*
if( m_materialname.find_last_of( "/\\" ) == std::string::npos ) {
m_materialname = Global.asCurrentTexturePath + m_materialname;
}
*/
m_material = GfxRenderer.Fetch_Material( m_materialname );
if( ( iFlags & 0x30 ) == 0 ) {
// texture-alpha based fallback if for some reason we don't have opacity flag set yet