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>
This commit is contained in:
Nik
2023-12-05 10:49:51 +01:00
committed by GitHub
parent d5a40d46bc
commit f9a9ed4846
29 changed files with 3122 additions and 781 deletions

View File

@@ -0,0 +1,28 @@
#include <hex/helpers/utils.hpp>
#include <content/pl_visualizers/visualizer_helpers.hpp>
#include <implot.h>
#include <imgui.h>
#include <content/helpers/diagrams.hpp>
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::builtin {
void drawChunkBasedEntropyVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
// Variable used to store the result to avoid having to recalculate the result at each frame
static DiagramChunkBasedEntropyAnalysis analyzer;
// Compute data
if (shouldReset) {
auto pattern = arguments[0].toPattern();
auto chunkSize = arguments[1].toUnsigned();
analyzer.process(pattern->getBytes(), chunkSize);
}
// Show results
analyzer.draw(ImVec2(400, 250), ImPlotFlags_CanvasOnly);
}
}