mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 18:47:06 +01:00
Resolved for the rename to EU07M: the stale-file check is eu07m_up_to_date() before LoadFromEU07M, the loader catches what reading throws, and the new tests name eu07m::.
This commit is contained in:
+26
-1
@@ -27,6 +27,8 @@ Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others
|
||||
#include "utilities/wholefile.h"
|
||||
|
||||
#include <bit>
|
||||
#include <filesystem>
|
||||
#include <initializer_list>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -1774,6 +1776,27 @@ glm::vec3 TSubModel::offset(float const Geometrytestoffsetthreshold) const
|
||||
|
||||
namespace
|
||||
{
|
||||
// modelformat eu07m: an .eu07m older than the .e3d / .t3d it was made from isn't used, the model was changed after it was
|
||||
// converted (the hash of the source in its header would need the source read whole to be compared)
|
||||
bool eu07m_up_to_date(std::string const &Eu07m, std::initializer_list<std::string> const Sources)
|
||||
{
|
||||
std::error_code error;
|
||||
auto const made{std::filesystem::last_write_time(Eu07m, error)};
|
||||
if (error)
|
||||
return false;
|
||||
for (auto const &source : Sources)
|
||||
{
|
||||
if (source.empty())
|
||||
continue;
|
||||
if (auto const changed{std::filesystem::last_write_time(source, error)}; (false == bool(error)) && (changed > made))
|
||||
{
|
||||
WriteLog("Model \"" + source + "\" is newer than its \"" + Eu07m + "\", which isn't used", logtype::model);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fazy szczegółowości nazwane "<nazwa>_LOD<n>" (części sieci trakcyjnej) dostają zakresy widoczności tutaj,
|
||||
// żeby nie trzeba było wpisywać ich w modelach: kolejne fazy zmieniają się na 20, 40, 100, 300 i 400 m,
|
||||
// a ostatnia faza, jaką część ma, zostaje widoczna do 400 m (drobnica: model mieszczący się w promieniu 0,5 m
|
||||
@@ -1875,7 +1898,8 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
|
||||
Init();
|
||||
assign_lod_ranges(Root, name);
|
||||
}
|
||||
else if (auto const eu07mfile{Global.modelformat_eu07m ? FileCased(name + ".eu07m") : std::string{}}; (false == eu07mfile.empty()) && LoadFromEU07M(eu07mfile, dynamic))
|
||||
else if (auto const eu07mfile{Global.modelformat_eu07m ? FileCased(name + ".eu07m") : std::string{}};
|
||||
(false == eu07mfile.empty()) && eu07m_up_to_date(eu07mfile, {binaryfile, textfile}) && LoadFromEU07M(eu07mfile, dynamic))
|
||||
{
|
||||
// modelformat eu07m: the .eu07m made from the model takes its place; one which doesn't load leaves the .e3d / .t3d to go on
|
||||
asBinary = "";
|
||||
@@ -2748,6 +2772,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
|
||||
float opacity = mat->get_or_guess_opacity();
|
||||
|
||||
// set phase flag based on material opacity
|
||||
m_passguessed = true;
|
||||
if (opacity == 0.0f)
|
||||
iFlags |= 0x20; // translucent
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user