Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
This commit is contained in:
commit
5dea42e012
|
|
@ -984,6 +984,17 @@ public:
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr qmat<T, NCol, NRow> transpose() const
|
||||
{
|
||||
qmat<T, NCol, NRow> res;
|
||||
for (size_t i = 0; i < NRow; i++) {
|
||||
for (size_t j = 0; j < NCol; j++) {
|
||||
res.at(j, i) = at(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
// Fmt support
|
||||
|
|
|
|||
|
|
@ -772,7 +772,7 @@ static void FindAreaPortalExits_R(node_t *n, std::unordered_set<node_t *> &visit
|
|||
continue;
|
||||
|
||||
// continue exploding
|
||||
return FindAreaPortalExits_R(neighbour, visited, exits);
|
||||
FindAreaPortalExits_R(neighbour, visited, exits);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1536,7 +1536,7 @@ static void LoadTextureData()
|
|||
miptex.height = tex->meta.height;
|
||||
|
||||
// only mips can be embedded directly
|
||||
if (!pos.archive->external && tex->meta.extension == img::ext::MIP) {
|
||||
if (!qbsp_options.notextures.value() && !pos.archive->external && tex->meta.extension == img::ext::MIP) {
|
||||
miptex.data = std::move(file.value());
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,3 +294,21 @@ TEST_SUITE("common")
|
|||
CHECK(texture->height_scale == 1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE("qmat")
|
||||
{
|
||||
TEST_CASE("transpose")
|
||||
{
|
||||
// clang-format off
|
||||
auto in = qmat<float, 2, 3>::row_major(
|
||||
{1.0, 2.0, 3.0,
|
||||
4.0, 5.0, 6.0});
|
||||
auto exp = qmat<float, 3, 2>::row_major(
|
||||
{1.0, 4.0,
|
||||
2.0, 5.0,
|
||||
3.0, 6.0});
|
||||
// clang-format on
|
||||
|
||||
CHECK(in.transpose() == exp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
19
vis/vis.cc
19
vis/vis.cc
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <bit> // for std::countr_zero
|
||||
|
||||
#include <vis/leafbits.hh>
|
||||
#include <vis/vis.hh>
|
||||
|
|
@ -11,22 +12,6 @@
|
|||
#include <common/parallel.hh>
|
||||
#include <fmt/chrono.h>
|
||||
|
||||
/* Use some GCC builtins */
|
||||
#if !defined(ffsl) && defined(__GNUC__)
|
||||
#define ffsl __builtin_ffsl
|
||||
#elif defined(_WIN32)
|
||||
#include <intrin.h>
|
||||
inline int ffsl(long int val)
|
||||
{
|
||||
unsigned long indexout;
|
||||
unsigned char res = _BitScanForward(&indexout, val);
|
||||
if (!res)
|
||||
return 0;
|
||||
else
|
||||
return indexout + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the portal file is "PRT2" format, then the leafs we are dealing with are
|
||||
* really clusters of leaves. So, after the vis job is done we need to expand
|
||||
|
|
@ -357,7 +342,7 @@ static void PortalCompleted(visportal_t *completed)
|
|||
* Update mightsee for any of the changed bits that survived
|
||||
*/
|
||||
while (changed) {
|
||||
bit = ffsl(changed) - 1;
|
||||
bit = std::countr_zero(changed);
|
||||
changed &= ~nth_bit(bit);
|
||||
leafnum = (j << leafbits_t::shift) + bit;
|
||||
UpdateMightsee(leafs[leafnum], myleaf);
|
||||
|
|
|
|||
Loading…
Reference in New Issue