add hack for proper submodel offset calculation after t3d init, fixes cabin sound positioning

This commit is contained in:
milek7
2018-12-09 23:12:18 +01:00
committed by tmj-fstate
parent 57327f9653
commit f56a2b67be
2 changed files with 11 additions and 10 deletions

View File

@@ -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)

View File

@@ -119,6 +119,8 @@ private:
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
bool m_rotation_init_done = false;
TSubModel *Next { nullptr };
TSubModel *Child { nullptr };
public: // temporary access, clean this up during refactoring