Rewrite collision detection

This commit is contained in:
Yousef Khadadeh 2026-05-24 11:58:52 +03:00
parent 7b472fe18d
commit 60ab8f3c73
35 changed files with 292 additions and 258 deletions

View file

@ -32,7 +32,7 @@ template <class T> std::weak_ptr<T> make_weak_ptr(std::shared_ptr<T> ptr) { retu
#define RELIABLE_COMMAND_CHANNEL "reliableCommand"
#define UNRELIABLE_COMMAND_CHANNEL "unreliableCommand"
#define RESOURCE_COMMAND_CHANNEL "resourceCommand"
#define MAIN_NETLIBRARY_CHANNEL "main00009" // NOTE: Change this value whenever netcode is incompatible with the previous version
#define MAIN_NETLIBRARY_CHANNEL "main00010" // NOTE: Change this value whenever netcode is incompatible with the previous version
typedef uint8_t MessageCommandType;
typedef uint8_t NetTypeIDType;

View file

@ -40,8 +40,8 @@ namespace SCollision {
max(initMax)
{}
AABB(const SkRect& r):
min(r.TL),
max(r.BR)
min(r.TL().x(), r.TL().y()),
max(r.BR().x(), r.BR().y())
{}
Vector<T, 2> min;
Vector<T, 2> max;

View file

@ -5,8 +5,9 @@
#include <boost/multiprecision/cpp_int.hpp>
#include "FixedPoint.hpp"
#include <include/core/SkString.h>
#include <include/core/SkPoint.h>
#include <include/core/SkColor.h>
#include "ConvertVec.hpp"
template <class Archive> void save(Archive& ar, SkString const & str) {
ar(cereal::make_size_tag(static_cast<uint64_t>(str.size())));
@ -20,6 +21,16 @@ template <class Archive> void load(Archive& ar, SkString& str) {
ar(cereal::binary_data(const_cast<char*>(str.data()), static_cast<size_t>(size) * sizeof(char)));
}
template <class Archive> void save(Archive& ar, const SkPoint& s) {
ar(convert_vec2<Eigen::Vector2f>(s));
}
template <class Archive> void load(Archive& ar, SkPoint& s) {
Eigen::Vector2f f;
ar(f);
s = convert_vec2<SkPoint>(f);
}
namespace cereal
{
// https://stackoverflow.com/questions/22884216/serializing-eigenmatrix-using-cereal-library (with some modifications using constexpr)