Добавление swap функций для векторов, кватернионов и матриц / Swap functions have been added for vectors, quaternions and matrixes

This commit is contained in:
Andrey Pokidov 2024-11-27 16:49:58 +07:00
parent a30629df67
commit 5fd14e4627
10 changed files with 363 additions and 12 deletions

View file

@ -66,6 +66,38 @@ static inline void bg_fp64_vector3_copy(const BgFP64Vector3* from, BgFP64Vector3
to->x3 = from->x3;
}
// ==================== Swap ==================== //
static inline void bg_fp32_vector3_swap(BgFP32Vector3* vector1, BgFP32Vector3* vector2)
{
const float x1 = vector2->x1;
const float x2 = vector2->x2;
const float x3 = vector2->x3;
vector2->x1 = vector1->x1;
vector2->x2 = vector1->x2;
vector2->x3 = vector1->x3;
vector1->x1 = x1;
vector1->x2 = x2;
vector1->x3 = x3;
}
static inline void bg_fp64_vector3_swap(BgFP64Vector3* vector1, BgFP64Vector3* vector2)
{
const double x1 = vector2->x1;
const double x2 = vector2->x2;
const double x3 = vector2->x3;
vector2->x1 = vector1->x1;
vector2->x2 = vector1->x2;
vector2->x3 = vector1->x3;
vector1->x1 = x1;
vector1->x2 = x2;
vector1->x3 = x3;
}
// ============= Copy to twin type ============== //
static inline void bg_fp32_vector3_set_from_fp64(const BgFP64Vector3* from, BgFP32Vector3* to)