Compare commits
2 commits
7e4041e50f
...
a40fc77762
Author | SHA1 | Date | |
---|---|---|---|
a40fc77762 | |||
82d4613b93 |
2 changed files with 58 additions and 53 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Upcoming Changes
|
||||||
|
|
||||||
|
Refactoring of internally used function.
|
||||||
|
|
||||||
## Version 2.1.0
|
## Version 2.1.0
|
||||||
|
|
||||||
Refactoring of internally used function(s).
|
Refactoring of internally used function(s).
|
||||||
|
|
107
src/sc_sacd.cpp
107
src/sc_sacd.cpp
|
@ -146,67 +146,68 @@ std::array<SC_SACD_Vec3, 3> SC_SACD_Get_Box_Normals_Normalized(
|
||||||
return normals;
|
return normals;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SC_SACD_Vec3> SC_SACD_Get_Box_Corners(
|
std::array<SC_SACD_Vec3, 8> SC_SACD_Get_Box_Corners(
|
||||||
const SC_SACD_Generic_Box *box) {
|
const SC_SACD_Generic_Box *box) {
|
||||||
std::vector<SC_SACD_Vec3> corners;
|
SC_SACD_Vec3 corner_0 =
|
||||||
|
box->transform *
|
||||||
|
SC_SACD_Vec3{-box->width / 2.0F, -box->height / 2.0F, -box->depth / 2.0F};
|
||||||
|
corner_0.x += box->x;
|
||||||
|
corner_0.y += box->y;
|
||||||
|
corner_0.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{-box->width / 2.0F,
|
SC_SACD_Vec3 corner_1 =
|
||||||
-box->height / 2.0F,
|
box->transform *
|
||||||
-box->depth / 2.0F});
|
SC_SACD_Vec3{box->width / 2.0F, -box->height / 2.0F, -box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_1.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_1.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_1.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{box->width / 2.0F,
|
SC_SACD_Vec3 corner_2 =
|
||||||
-box->height / 2.0F,
|
box->transform *
|
||||||
-box->depth / 2.0F});
|
SC_SACD_Vec3{-box->width / 2.0F, box->height / 2.0F, -box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_2.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_2.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_2.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{-box->width / 2.0F,
|
SC_SACD_Vec3 corner_3 =
|
||||||
box->height / 2.0F,
|
box->transform *
|
||||||
-box->depth / 2.0F});
|
SC_SACD_Vec3{box->width / 2.0F, box->height / 2.0F, -box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_3.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_3.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_3.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{box->width / 2.0F,
|
SC_SACD_Vec3 corner_4 =
|
||||||
box->height / 2.0F,
|
box->transform *
|
||||||
-box->depth / 2.0F});
|
SC_SACD_Vec3{-box->width / 2.0F, -box->height / 2.0F, box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_4.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_4.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_4.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{-box->width / 2.0F,
|
SC_SACD_Vec3 corner_5 =
|
||||||
-box->height / 2.0F,
|
box->transform *
|
||||||
box->depth / 2.0F});
|
SC_SACD_Vec3{box->width / 2.0F, -box->height / 2.0F, box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_5.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_5.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_5.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{box->width / 2.0F,
|
SC_SACD_Vec3 corner_6 =
|
||||||
-box->height / 2.0F,
|
box->transform *
|
||||||
box->depth / 2.0F});
|
SC_SACD_Vec3{-box->width / 2.0F, box->height / 2.0F, box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_6.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_6.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_6.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{-box->width / 2.0F,
|
SC_SACD_Vec3 corner_7 =
|
||||||
box->height / 2.0F,
|
box->transform *
|
||||||
box->depth / 2.0F});
|
SC_SACD_Vec3{box->width / 2.0F, box->height / 2.0F, box->depth / 2.0F};
|
||||||
corners.back().x += box->x;
|
corner_7.x += box->x;
|
||||||
corners.back().y += box->y;
|
corner_7.y += box->y;
|
||||||
corners.back().z += box->z;
|
corner_7.z += box->z;
|
||||||
|
|
||||||
corners.push_back(box->transform * SC_SACD_Vec3{box->width / 2.0F,
|
return {
|
||||||
box->height / 2.0F,
|
corner_0, corner_1, corner_2, corner_3,
|
||||||
box->depth / 2.0F});
|
corner_4, corner_5, corner_6, corner_7,
|
||||||
corners.back().x += box->x;
|
};
|
||||||
corners.back().y += box->y;
|
|
||||||
corners.back().z += box->z;
|
|
||||||
|
|
||||||
return corners;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SC_SACD_MinMax {
|
struct SC_SACD_MinMax {
|
||||||
|
@ -217,7 +218,7 @@ std::vector<SC_SACD_MinMax> SC_SACD_Get_Box_MinMax(
|
||||||
const SC_SACD_Generic_Box *box, const std::span<SC_SACD_Vec3> normals) {
|
const SC_SACD_Generic_Box *box, const std::span<SC_SACD_Vec3> normals) {
|
||||||
std::vector<SC_SACD_MinMax> minmaxes;
|
std::vector<SC_SACD_MinMax> minmaxes;
|
||||||
|
|
||||||
std::vector<SC_SACD_Vec3> corners = SC_SACD_Get_Box_Corners(box);
|
auto corners = SC_SACD_Get_Box_Corners(box);
|
||||||
|
|
||||||
// Assuming normals are not normalized, and will not normalize anyway.
|
// Assuming normals are not normalized, and will not normalize anyway.
|
||||||
// MinMax count should be same as normals count.
|
// MinMax count should be same as normals count.
|
||||||
|
|
Loading…
Reference in a new issue