1
0
mirror of synced 2024-12-12 16:01:06 +01:00
ImHex/plugins/builtin/include/content/pl_visualizers/visualizer_helpers.hpp
Nik f9a9ed4846
impr: Vastly improved 3D Visualizer (#1456)
Based entirely on @paxcut's amazing PR #1443

---------

Co-authored-by: paxcut <paxcut@outlook.com>
Co-authored-by: paxcut <53811119+paxcut@users.noreply.github.com>
2023-12-05 10:49:51 +01:00

20 lines
509 B
C++

#pragma once
#include <pl/pattern_language.hpp>
#include <pl/patterns/pattern.hpp>
namespace hex::plugin::builtin {
template<typename T>
std::vector<T> patternToArray(pl::ptrn::Pattern *pattern){
const auto bytes = pattern->getBytes();
std::vector<T> result;
result.resize(bytes.size() / sizeof(T));
for (size_t i = 0; i < result.size(); i++)
std::memcpy(&result[i], &bytes[i * sizeof(T)], sizeof(T));
return result;
}
}