From ce4c3b46f373a1c054d9fa8216ba33a864a66374 Mon Sep 17 00:00:00 2001 From: Hirek Date: Fri, 28 Feb 2025 13:54:10 +0100 Subject: [PATCH] Revert "Add security locks for material manager" This reverts commit 8b3baa84fe03c9908924be88960174da0fe483fc. --- Globals.h | 2 -- Model3d.cpp | 96 +++++++++++++++++++++++++---------------------------- 2 files changed, 45 insertions(+), 53 deletions(-) diff --git a/Globals.h b/Globals.h index 1056fd37..d54b9f4a 100644 --- a/Globals.h +++ b/Globals.h @@ -18,7 +18,6 @@ http://mozilla.org/MPL/2.0/. #include "motiontelemetry.h" #include "ref/discord-rpc/include/discord_rpc.h" #include -#include #ifdef WITH_UART #include "uart.h" @@ -36,7 +35,6 @@ struct global_settings { /// Mapa z watkami w formacie /// std::map threads = {}; - std::thread::id mainThreadId = std::this_thread::get_id(); bool shiftState{ false }; //m7todo: brzydko bool ctrlState{ false }; bool altState{ false }; diff --git a/Model3d.cpp b/Model3d.cpp index 1537ea60..13ad449d 100644 --- a/Model3d.cpp +++ b/Model3d.cpp @@ -29,8 +29,6 @@ Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others using namespace Mtable; -std::mutex materialLoadLock; - float TSubModel::fSquareDist = 0.f; std::uintptr_t TSubModel::iInstance; // numer renderowanego egzemplarza obiektu texture_handle const *TSubModel::ReplacableSkinId = NULL; @@ -379,56 +377,52 @@ std::pair TSubModel::Load( cParser &parser, bool dynamic ) if (!parser.expectToken("map:")) Error("Model map parse failure!"); - materialLoadLock.lock(); - - std::string material = parser.getToken(); - std::replace(material.begin(), material.end(), '\\', '/'); - if (material == "none") - { // rysowanie podanym kolorem - Name_Material( "colored" ); - m_material = GfxRenderer->Fetch_Material( m_materialname ); - iFlags |= 0x10; // rysowane w cyklu nieprzezroczystych + std::string material = parser.getToken(); + std::replace(material.begin(), material.end(), '\\', '/'); + if (material == "none") + { // rysowanie podanym kolorem + Name_Material( "colored" ); + m_material = GfxRenderer->Fetch_Material( m_materialname ); + iFlags |= 0x10; // rysowane w cyklu nieprzezroczystych + } + else if (material.find("replacableskin") != material.npos) + { // McZapkie-060702: zmienialne skory modelu + m_material = -1; + iFlags |= (Opacity < 0.999) ? 1 : 0x10; // zmienna tekstura 1 + } + else if (material == "-1") + { + m_material = -1; + iFlags |= (Opacity < 0.999) ? 1 : 0x10; // zmienna tekstura 1 + } + else if (material == "-2") + { + m_material = -2; + iFlags |= (Opacity < 0.999) ? 2 : 0x10; // zmienna tekstura 2 + } + else if (material == "-3") + { + m_material = -3; + iFlags |= (Opacity < 0.999) ? 4 : 0x10; // zmienna tekstura 3 + } + else if (material == "-4") + { + m_material = -4; + iFlags |= (Opacity < 0.999) ? 8 : 0x10; // zmienna tekstura 4 + } + 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 ); } - else if (material.find("replacableskin") != material.npos) - { // McZapkie-060702: zmienialne skory modelu - m_material = -1; - iFlags |= (Opacity < 0.999) ? 1 : 0x10; // zmienna tekstura 1 - } - else if (material == "-1") - { - m_material = -1; - iFlags |= (Opacity < 0.999) ? 1 : 0x10; // zmienna tekstura 1 - } - else if (material == "-2") - { - m_material = -2; - iFlags |= (Opacity < 0.999) ? 2 : 0x10; // zmienna tekstura 2 - } - else if (material == "-3") - { - m_material = -3; - iFlags |= (Opacity < 0.999) ? 4 : 0x10; // zmienna tekstura 3 - } - else if (material == "-4") - { - m_material = -4; - iFlags |= (Opacity < 0.999) ? 8 : 0x10; // zmienna tekstura 4 - } - 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) - iFlags |= Opacity < 0.999f ? 0x20 : 0x10 ; // 0x20-przezroczysta, 0x10-nieprzezroczysta - }; - - materialLoadLock.unlock(); +*/ + m_material = GfxRenderer->Fetch_Material( material ); + // renderowanie w cyklu przezroczystych tylko jeśli: + // 1. Opacity=0 (przejściowo <1, czy tam <100) + iFlags |= Opacity < 0.999f ? 0x20 : 0x10 ; // 0x20-przezroczysta, 0x10-nieprzezroczysta + }; } else if (eType == TP_STARS) {