16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

Use the sq function to force constexpr expressions for numeric literals and enhance readability

This commit is contained in:
docentYT
2026-04-28 13:23:14 +02:00
parent 6be1b0886d
commit ca839652bf
15 changed files with 64 additions and 59 deletions

View File

@@ -97,7 +97,7 @@ void TAnimContainer::UpdateModel() {
{
auto dif = vTranslateTo - vTranslation; // wektor w kierunku docelowym
double l2 = glm::length2(dif); // długość wektora potrzebnego przemieszczenia
if (l2 >= 0.0001)
if (l2 >= sq(0.01))
{ // jeśli do przemieszczenia jest ponad 1cm
auto s = glm::normalize(dif); // jednostkowy wektor kierunku // Długość wektora nie jest równa 0, sprawdzane wcześniej więc wektor normalny będzie zawsze prawidłowy.
s = s *
@@ -113,7 +113,7 @@ void TAnimContainer::UpdateModel() {
{ // koniec animowania
vTranslation = vTranslateTo;
fTranslateSpeed = 0.0; // wyłączenie przeliczania wektora
if (glm::length2(vTranslation) <= 0.0001) // jeśli jest w punkcie początkowym
if (glm::length2(vTranslation) <= sq(0.01)) // jeśli jest w punkcie początkowym
iAnim &= ~2; // wyłączyć zmianę pozycji submodelu
if( evDone ) {
// wykonanie eventu informującego o zakończeniu