#ifndef DUST3D_SNAPSHOT_H #define DUST3D_SNAPSHOT_H #include #include #include #include #include extern "C" { #include } class Snapshot { public: std::map canvas; std::map> nodes; std::map> edges; std::map> parts; std::map> components; std::map rootComponent; std::vector, std::vector, std::map>>>>> poses; // std::pair frame: std::pair std::vector, std::vector>>> motions; // std::pair std::vector, std::vector, std::vector>>>>> materials; // std::pair layer: std::pair uint64_t hash() const { std::vector buffer; auto addQStringToBuffer = [&buffer](const QString &str) { auto byteArray = str.toUtf8(); for (const auto &byte: byteArray) buffer.push_back(byte); }; for (const auto &item: canvas) { addQStringToBuffer(item.first); addQStringToBuffer(item.second); } for (const auto &item: nodes) { addQStringToBuffer(item.first); for (const auto &subItem: item.second) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } } for (const auto &item: edges) { addQStringToBuffer(item.first); for (const auto &subItem: item.second) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } } for (const auto &item: parts) { addQStringToBuffer(item.first); for (const auto &subItem: item.second) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } } for (const auto &item: components) { addQStringToBuffer(item.first); for (const auto &subItem: item.second) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } } for (const auto &item: rootComponent) { addQStringToBuffer(item.first); addQStringToBuffer(item.second); } for (const auto &item: poses) { for (const auto &subItem: item.first) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } for (const auto &subItem: item.second) { for (const auto &subSubItem: subItem.first) { addQStringToBuffer(subSubItem.first); addQStringToBuffer(subSubItem.second); } for (const auto &subSubItem: subItem.second) { addQStringToBuffer(subSubItem.first); for (const auto &subSubSubItem: subSubItem.second) { addQStringToBuffer(subSubSubItem.first); addQStringToBuffer(subSubSubItem.second); } } } } for (const auto &item: motions) { for (const auto &subItem: item.first) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } for (const auto &subItem: item.second) { for (const auto &subSubItem: subItem) { addQStringToBuffer(subSubItem.first); addQStringToBuffer(subSubItem.second); } } } for (const auto &item: materials) { for (const auto &subItem: item.first) { addQStringToBuffer(subItem.first); addQStringToBuffer(subItem.second); } for (const auto &subItem: item.second) { for (const auto &subSubItem: subItem.first) { addQStringToBuffer(subSubItem.first); addQStringToBuffer(subSubItem.second); } for (const auto &subSubItem: subItem.second) { for (const auto &subSubSubItem: subSubItem) { addQStringToBuffer(subSubSubItem.first); addQStringToBuffer(subSubSubItem.second); } } } } return crc64(0, buffer.data(), buffer.size()); } void resolveBoundingBox(QRectF *mainProfile, QRectF *sideProfile, const QString &partId=QString()) const; }; #endif