mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
add hack for proper submodel offset calculation after t3d init, fixes cabin sound positioning
This commit is contained in:
19
Model3d.cpp
19
Model3d.cpp
@@ -779,6 +779,8 @@ int TSubModel::FlagsCheck()
|
||||
// samo pomijanie glBindTexture() nie poprawi wydajności
|
||||
// ale można sprawdzić, czy można w ogóle pominąć kod do tekstur (sprawdzanie
|
||||
// replaceskin)
|
||||
m_rotation_init_done = true;
|
||||
|
||||
int i = 0;
|
||||
if (Child)
|
||||
{ // Child jest renderowany po danym submodelu
|
||||
@@ -1237,16 +1239,10 @@ TSubModel::offset( float const Geometrytestoffsetthreshold ) const {
|
||||
}
|
||||
}
|
||||
|
||||
if( true == TestFlag( iFlags, 0x0200 ) ) {
|
||||
// flip coordinates for t3d file which wasn't yet initialized
|
||||
if( ( false == simulation::is_ready )
|
||||
|| ( false == Vertices.empty() ) ) {
|
||||
// NOTE, HACK: results require flipping if the model wasn't yet initialized, so we're using crude method to detect possible cases
|
||||
// TODO: sort out this mess, either unify offset lookups to take place before (or after) initialization,
|
||||
// or provide way to determine on submodel level whether the initialization took place
|
||||
offset = { -offset.x, offset.z, offset.y };
|
||||
}
|
||||
}
|
||||
if (!m_rotation_init_done)
|
||||
// NOTE, HACK: results require flipping if the model wasn't yet initialized,
|
||||
// TODO: sort out this mess, maybe try unify offset lookups to take place before (or after) initialization,
|
||||
offset = { -offset.x, offset.z, offset.y };
|
||||
|
||||
return offset;
|
||||
}
|
||||
@@ -1494,6 +1490,9 @@ void TSubModel::deserialize(std::istream &s)
|
||||
fCosFalloffAngle = sn_utils::ld_float32(s);
|
||||
fCosHotspotAngle = sn_utils::ld_float32(s);
|
||||
fCosViewAngle = sn_utils::ld_float32(s);
|
||||
|
||||
// necessary rotations were already done during t3d->e3d conversion
|
||||
m_rotation_init_done = true;
|
||||
}
|
||||
|
||||
void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||
|
||||
Reference in New Issue
Block a user