diff --git a/Runtime/Collision/CMaterialFilter.cpp b/Runtime/Collision/CMaterialFilter.cpp index 9770b25f4..813662ca4 100644 --- a/Runtime/Collision/CMaterialFilter.cpp +++ b/Runtime/Collision/CMaterialFilter.cpp @@ -3,38 +3,4 @@ namespace urde { const CMaterialFilter CMaterialFilter::skPassEverything({0x00000000FFFFFFFF}, {0}, CMaterialFilter::EFilterType::Always); - -CMaterialFilter::CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, - CMaterialFilter::EFilterType type) -: x0_include(include), x8_exclude(exclude), x10_type(type) {} - -CMaterialFilter CMaterialFilter::MakeInclude(const CMaterialList& include) { - return CMaterialFilter(include, {0ull}, EFilterType::Include); -} - -CMaterialFilter CMaterialFilter::MakeExclude(const CMaterialList& exclude) { - return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::Exclude); -} - -CMaterialFilter CMaterialFilter::MakeIncludeExclude(const CMaterialList& include, const CMaterialList& exclude) { - return CMaterialFilter(include, exclude, EFilterType::IncludeExclude); -} - -bool CMaterialFilter::Passes(const CMaterialList& list) const { - switch (x10_type) { - case EFilterType::Always: - return true; - case EFilterType::Include: - return (list.x0_list & x0_include.x0_list) != 0; - case EFilterType::Exclude: - return (list.x0_list & x8_exclude.x0_list) == 0; - case EFilterType::IncludeExclude: - if ((list.x0_list & x0_include.x0_list) == 0) - return false; - return (list.x0_list & x8_exclude.x0_list) == 0; - default: - return true; - } -} - } // namespace urde diff --git a/Runtime/Collision/CMaterialFilter.hpp b/Runtime/Collision/CMaterialFilter.hpp index 11645c893..198c43bbd 100644 --- a/Runtime/Collision/CMaterialFilter.hpp +++ b/Runtime/Collision/CMaterialFilter.hpp @@ -15,18 +15,42 @@ private: public: static const CMaterialFilter skPassEverything; - CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, EFilterType type); + constexpr CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, EFilterType type) noexcept + : x0_include(include), x8_exclude(exclude), x10_type(type) {} - static CMaterialFilter MakeInclude(const CMaterialList& include); + static constexpr CMaterialFilter MakeInclude(const CMaterialList& include) noexcept { + return CMaterialFilter(include, {}, EFilterType::Include); + } - static CMaterialFilter MakeExclude(const CMaterialList& exclude); + static constexpr CMaterialFilter MakeExclude(const CMaterialList& exclude) noexcept { + return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::Exclude); + } - static CMaterialFilter MakeIncludeExclude(const CMaterialList& include, const CMaterialList& exclude); + static constexpr CMaterialFilter MakeIncludeExclude(const CMaterialList& include, + const CMaterialList& exclude) noexcept { + return CMaterialFilter(include, exclude, EFilterType::IncludeExclude); + } - const CMaterialList& GetIncludeList() const { return x0_include; } - const CMaterialList& GetExcludeList() const { return x8_exclude; } - CMaterialList& IncludeList() { return x0_include; } - CMaterialList& ExcludeList() { return x8_exclude; } - bool Passes(const CMaterialList&) const; + constexpr const CMaterialList& GetIncludeList() const noexcept { return x0_include; } + constexpr const CMaterialList& GetExcludeList() const noexcept { return x8_exclude; } + constexpr CMaterialList& IncludeList() noexcept { return x0_include; } + constexpr CMaterialList& ExcludeList() noexcept { return x8_exclude; } + + constexpr bool Passes(const CMaterialList& list) const noexcept { + switch (x10_type) { + case EFilterType::Always: + return true; + case EFilterType::Include: + return (list.x0_list & x0_include.x0_list) != 0; + case EFilterType::Exclude: + return (list.x0_list & x8_exclude.x0_list) == 0; + case EFilterType::IncludeExclude: + if ((list.x0_list & x0_include.x0_list) == 0) + return false; + return (list.x0_list & x8_exclude.x0_list) == 0; + default: + return true; + } + } }; } // namespace urde