mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Misc changes
- Rename implot_gpu.h -> implot_backend.h - Rename IMPLOT_ENABLE_OPENGL3_ACCELERATION -> IMPLOT_BACKEND_ENABLE_OPENGL3 - Use gp.CurrentItem->ID over gp.CurrentPlot->ID - Add flags for different features supported by backends
This commit is contained in:
parent
50407e5279
commit
541521fe69
|
@ -26,6 +26,12 @@
|
|||
|
||||
#include "../implot.h"
|
||||
|
||||
#ifdef IMPLOT_BACKEND_ENABLE_OPENGL3
|
||||
#define IMPLOT_BACKEND_ENABLED
|
||||
#define IMPLOT_BACKEND_HAS_HEATMAP
|
||||
#define IMPLOT_BACKEND_HAS_COLORMAP
|
||||
#endif
|
||||
|
||||
namespace ImPlot {
|
||||
namespace Backend {
|
||||
|
||||
|
@ -136,19 +142,27 @@ IMPLOT_API void BustPlotCache();
|
|||
/** @brief Bust item cache. Called from @ref ImPlot::BustItemCache() */
|
||||
IMPLOT_API void BustItemCache();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(IMPLOT_ENABLE_OPENGL3_ACCELERATION)
|
||||
namespace ImPlot {
|
||||
namespace Backend {
|
||||
|
||||
#ifndef IMPLOT_BACKEND_ENABLED
|
||||
|
||||
// Dummy implementation for backend functions
|
||||
inline void* CreateContext() { return nullptr; }
|
||||
inline void DestroyContext() {}
|
||||
|
||||
inline void AddColormap(const ImU32*, int, bool) {}
|
||||
|
||||
inline void BustPlotCache() {}
|
||||
inline void BustItemCache() {}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef IMPLOT_BACKEND_HAS_COLORMAP
|
||||
|
||||
inline void AddColormap(const ImU32*, int, bool) {}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#ifdef IMPLOT_ENABLE_OPENGL3_ACCELERATION
|
||||
#ifdef IMPLOT_BACKEND_ENABLE_OPENGL3
|
||||
|
||||
#include "../implot.h"
|
||||
#include "../implot_internal.h"
|
||||
#include "implot_gpu.h"
|
||||
#include "implot_backend.h"
|
||||
|
||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||
#include <GLES2/gl2.h>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <time.h>
|
||||
#include "imgui_internal.h"
|
||||
#include "backends/implot_gpu.h"
|
||||
#include "backends/implot_backend.h"
|
||||
|
||||
#ifndef IMPLOT_VERSION
|
||||
#error Must include implot.h before implot_internal.h
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "implot.h"
|
||||
#include "implot_internal.h"
|
||||
#include "backends/implot_gpu.h"
|
||||
#include "backends/implot_backend.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define sprintf sprintf_s
|
||||
|
@ -1892,13 +1892,13 @@ void RenderHeatmap(Transformer transformer, ImDrawList& DrawList, const T* value
|
|||
}
|
||||
const double yref = reverse_y ? bounds_max.y : bounds_min.y;
|
||||
const double ydir = reverse_y ? -1 : 1;
|
||||
#ifdef IMPLOT_ENABLE_OPENGL3_ACCELERATION
|
||||
// NOTE: Order is important!
|
||||
#ifdef IMPLOT_BACKEND_HAS_HEATMAP
|
||||
ImVec2 bmin = transformer(bounds_min);
|
||||
ImVec2 bmax = transformer(bounds_max);
|
||||
|
||||
Backend::RenderHeatmap(gp.CurrentPlot->ID, DrawList, bmin, bmax, scale_min, scale_max, gp.Style.Colormap);
|
||||
Backend::SetHeatmapData(gp.CurrentPlot->ID, values, rows, cols);
|
||||
// NOTE: Order is important!
|
||||
Backend::RenderHeatmap(gp.CurrentItem->ID, DrawList, bmin, bmax, scale_min, scale_max, gp.Style.Colormap);
|
||||
Backend::SetHeatmapData(gp.CurrentItem->ID, values, rows, cols);
|
||||
#else
|
||||
GetterHeatmap<T> getter(values, rows, cols, scale_min, scale_max, (bounds_max.x - bounds_min.x) / cols, (bounds_max.y - bounds_min.y) / rows, bounds_min.x, yref, ydir);
|
||||
switch (GetCurrentScale()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user