mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
add hack for proper submodel offset calculation after t3d init, fixes cabin sound positioning
This commit is contained in:
17
Model3d.cpp
17
Model3d.cpp
@@ -781,6 +781,8 @@ uint32_t TSubModel::FlagsCheck()
|
|||||||
// samo pomijanie glBindTexture() nie poprawi wydajności
|
// samo pomijanie glBindTexture() nie poprawi wydajności
|
||||||
// ale można sprawdzić, czy można w ogóle pominąć kod do tekstur (sprawdzanie
|
// ale można sprawdzić, czy można w ogóle pominąć kod do tekstur (sprawdzanie
|
||||||
// replaceskin)
|
// replaceskin)
|
||||||
|
m_rotation_init_done = true;
|
||||||
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
if (Child)
|
if (Child)
|
||||||
{ // Child jest renderowany po danym submodelu
|
{ // Child jest renderowany po danym submodelu
|
||||||
@@ -1245,16 +1247,10 @@ TSubModel::offset( float const Geometrytestoffsetthreshold ) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( true == TestFlag( iFlags, 0x0200 ) ) {
|
if (!m_rotation_init_done)
|
||||||
// flip coordinates for t3d file which wasn't yet initialized
|
// NOTE, HACK: results require flipping if the model wasn't yet initialized,
|
||||||
if( ( false == simulation::is_ready )
|
// TODO: sort out this mess, maybe try unify offset lookups to take place before (or after) initialization,
|
||||||
|| ( 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 };
|
offset = { -offset.x, offset.z, offset.y };
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
@@ -1502,6 +1498,9 @@ void TSubModel::deserialize(std::istream &s)
|
|||||||
fCosFalloffAngle = sn_utils::ld_float32(s);
|
fCosFalloffAngle = sn_utils::ld_float32(s);
|
||||||
fCosHotspotAngle = sn_utils::ld_float32(s);
|
fCosHotspotAngle = sn_utils::ld_float32(s);
|
||||||
fCosViewAngle = 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)
|
void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ private:
|
|||||||
float fCosHotspotAngle { 0.3f }; // cosinus kąta stożka pod którym widać aureolę i zwiększone natężenie światła
|
float fCosHotspotAngle { 0.3f }; // cosinus kąta stożka pod którym widać aureolę i zwiększone natężenie światła
|
||||||
float fCosViewAngle { 0.0f }; // cos kata pod jakim sie teraz patrzy
|
float fCosViewAngle { 0.0f }; // cos kata pod jakim sie teraz patrzy
|
||||||
|
|
||||||
|
bool m_rotation_init_done = false;
|
||||||
|
|
||||||
TSubModel *Next { nullptr };
|
TSubModel *Next { nullptr };
|
||||||
TSubModel *Child { nullptr };
|
TSubModel *Child { nullptr };
|
||||||
public: // temporary access, clean this up during refactoring
|
public: // temporary access, clean this up during refactoring
|
||||||
|
|||||||
Reference in New Issue
Block a user