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:
@@ -1413,7 +1413,7 @@ TDynamicObject * TDynamicObject::ABuFindNearestObject(glm::vec3 pos, TTrack *Tra
|
||||
if( CouplNr == -2 ) {
|
||||
// wektor [kamera-obiekt] - poszukiwanie obiektu
|
||||
// length2 is better than length for comparing because it does not require sqrt function
|
||||
if (glm::length2(glm::dvec3(pos) - dynamic->vPosition) < 10.0 * 10.0)
|
||||
if (glm::length2(glm::dvec3(pos) - dynamic->vPosition) < sq(10.0))
|
||||
{
|
||||
// 10 metrów
|
||||
return dynamic;
|
||||
@@ -1422,13 +1422,13 @@ TDynamicObject * TDynamicObject::ABuFindNearestObject(glm::vec3 pos, TTrack *Tra
|
||||
else {
|
||||
// jeśli (CouplNr) inne niz -2, szukamy sprzęgu
|
||||
// length2 is better than length for comparing because it does not require sqrt function
|
||||
if (glm::length2(glm::dvec3(pos) - dynamic->vCoulpler[0]) < 5.0 * 5.0) {
|
||||
if (glm::length2(glm::dvec3(pos) - dynamic->vCoulpler[0]) < sq(5.0)) {
|
||||
// 5 metrów
|
||||
CouplNr = 0;
|
||||
return dynamic;
|
||||
}
|
||||
// length2 is better than length for comparing because it does not require sqrt function
|
||||
if (glm::length2(glm::dvec3(pos) - dynamic->vCoulpler[1]) < 5.0 * 5.0) {
|
||||
if (glm::length2(glm::dvec3(pos) - dynamic->vCoulpler[1]) < sq(5.0)) {
|
||||
// 5 metrów
|
||||
CouplNr = 1;
|
||||
return dynamic;
|
||||
|
||||
Reference in New Issue
Block a user