#pragma once #include "src/Core/Core.h" #include "src/Core/Maths.h" #include "src/Rendering/Textures/Material.h" #include "src/Rendering/Mesh/Mesh.h" #include "src/Core/Physics/Rigibody.h" namespace Nuake { class BSPBrushComponent { public: std::vector> Meshes; std::vector> Hulls; std::vector> Materials; std::vector> Rigidbody; std::string target = ""; std::vector Targets; bool IsSolid = true; bool IsTrigger = false; bool IsTransparent = false; bool IsFunc = false; BSPBrushComponent() { Meshes = std::vector>(); Materials = std::vector>(); Rigidbody = std::vector>(); Hulls = std::vector>(); } json Serialize() { BEGIN_SERIALIZE(); for (uint32_t i = 0; i < Hulls.size(); i++) { json hullPointsJson; size_t hullSize = Hulls[i].size(); for (uint32_t j = 0; j < hullSize; j++) { hullPointsJson[j]["x"] = Hulls[i][j].x; hullPointsJson[j]["y"] = Hulls[i][j].y; hullPointsJson[j]["z"] = Hulls[i][j].z; } j["Hulls"][i] = hullPointsJson; } j["IsSolid"] = IsSolid; END_SERIALIZE(); } bool Deserialize(const std::string& str) { BEGIN_DESERIALIZE(); if (j.contains("IsSolid")) { IsSolid = j["IsSolid"]; } if (j.contains("Hulls")) { for (auto& h : j["Hulls"]) { std::vector hull; hull.reserve(h.size()); for (auto& point : h) { Vector3 pointPos; DESERIALIZE_VEC3(point, pointPos); hull.push_back((pointPos)); } Hulls.push_back(hull); } } return true; } }; }