From 49db527db1a9d0e3583fbbcc7305137a8d22e48f Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Sun, 11 Sep 2022 16:43:27 +0200 Subject: [PATCH] Support long & long double, add macro INSTANTIATE_FOR_NUMERIC_TYPES (Fix #319) (#397) * implot_items: INSTANTIATE_FOR_NUMERIC_TYPES / add long & long double (Fix #319) - INSTANTIATE_FOR_NUMERIC_TYPES is a macro which instantiates templated plotting functions for numeric types. This macro helps reduce some boilerplate code for template functions instantiations. - Added optional support for more numeric types (long and long double) The numeric type list does not include "long", "unsigned long" and "long double". Most of the time, it is not an issue when linking statically. However, when linking dynamically, issues related to undefined functions can arise: although those types might have the same size, they are considered separate. define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES) in order to define versions for those types In this case, the compilation time for this specific file will be 33% longer - implot_internal.h / ImMean and ImStdDev: added cast to double (suppress MSVC warning about downcasting) - Notes about numeric types "synonyms": Even if "long double" and "double" might occupy the same size, they are not complete synonyms, and it is legal to define overloads for both double and long double. On some platforms, "unsigned long" might be the same size as "unsigned long long", but it is nonetheless a separate type: see https://godbolt.org/z/1KWv5re7q (example with GCC 64 bits) On some other platforms, "long double" might be the same size as "double", but it is nonetheless a separate type: see https://godbolt.org/z/ae71P7rqG (example with MSVC 64 bits) * IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES: disabled by default * uppercase template instantiatation macros & group them * implot_items.cpp: reword comments on IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES * README.md: mention compile-time option IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES * Github CI: IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1 --- .github/CMakeLists.txt | 1 + README.md | 2 +- implot_internal.h | 4 +- implot_items.cpp | 307 ++++++++++------------------------------- 4 files changed, 78 insertions(+), 236 deletions(-) diff --git a/.github/CMakeLists.txt b/.github/CMakeLists.txt index e6e32cc..8bb8e71 100644 --- a/.github/CMakeLists.txt +++ b/.github/CMakeLists.txt @@ -23,3 +23,4 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND DEFINED GCC_ARCH) endif () target_include_directories(implot PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../imgui) +target_compile_definitions(implot PRIVATE IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1) diff --git a/README.md b/README.md index 5bbd2bf..5585290 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ A: Yes, within reason. You can plot tens to hundreds of thousands of points with **Q: What data types can I plot?** A: ImPlot plotting functions accept most scalar types: -`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`. Arrays of custom structs or classes (e.g. `Vector2f` or similar) are easily passed to ImPlot functions using the built in striding features (see `implot.h` for documentation), and many plotters provide a "getter" overload which accepts data generating callbacks. +`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`. Arrays of custom structs or classes (e.g. `Vector2f` or similar) are easily passed to ImPlot functions using the built-in striding features (see `implot.h` for documentation), and many plotters provide a "getter" overload which accepts data generating callbacks. Additional support for `long`, `unsigned long` and `long double` can be added by defining `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` at compile-time (see `implot_items.cpp`). **Q: Can plot styles be modified?** diff --git a/implot_internal.h b/implot_internal.h index 2651ab2..80487b8 100644 --- a/implot_internal.h +++ b/implot_internal.h @@ -167,7 +167,7 @@ static inline double ImMean(const T* values, int count) { double den = 1.0 / count; double mu = 0; for (int i = 0; i < count; ++i) - mu += values[i] * den; + mu += (double)values[i] * den; return mu; } // Finds the sample standard deviation of an array @@ -177,7 +177,7 @@ static inline double ImStdDev(const T* values, int count) { double mu = ImMean(values, count); double x = 0; for (int i = 0; i < count; ++i) - x += (values[i] - mu) * (values[i] - mu) * den; + x += ((double)values[i] - mu) * ((double)values[i] - mu) * den; return sqrt(x); } // Mix color a and b by factor s in [0 256] diff --git a/implot_items.cpp b/implot_items.cpp index 8244542..6708e28 100644 --- a/implot_items.cpp +++ b/implot_items.cpp @@ -66,6 +66,36 @@ static IMPLOT_INLINE float ImInvSqrt(float x) { return 1.0f / sqrtf(x); } #define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All #endif +//----------------------------------------------------------------------------- +// [SECTION] Template instantiation utility +//----------------------------------------------------------------------------- + +// By default, templates are instantiated for the following types, which are defined in imgui.h. Note: this list does not include `long`, `unsigned long` and `long double`: define `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` at compile-time to add support for them. +#define INSTANTIATE_FOR_STANDARD_NUMERIC_TYPES(instantiate_macro) \ + instantiate_macro(ImS8); /* typedef signed char ImS8; // 8-bit signed integer */ \ + instantiate_macro(ImU8); /* typedef unsigned char ImU8; // 8-bit unsigned integer */ \ + instantiate_macro(ImS16); /* typedef signed short ImS16; // 16-bit signed integer */ \ + instantiate_macro(ImU16); /* typedef unsigned short ImU16; // 16-bit unsigned integer */ \ + instantiate_macro(ImS32); /* typedef signed int ImS32; // 32-bit signed integer == int */ \ + instantiate_macro(ImU32); /* typedef unsigned int ImU32; // 32-bit unsigned integer */ \ + instantiate_macro(ImS64); /* typedef signed long long ImS64; // 64-bit signed integer */ \ + instantiate_macro(ImU64); /* typedef unsigned long long ImU64; // 64-bit unsigned integer */ \ + instantiate_macro(float); \ + instantiate_macro(double); + +#define INSTANTIATE_FOR_REMAINING_NUMERIC_TYPES(instantiate_macro) \ + instantiate_macro(long); \ + instantiate_macro(unsigned long); \ + instantiate_macro(long double); + +#ifdef IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES + #define INSTANTIATE_FOR_NUMERIC_TYPES(instantiate_macro) \ + INSTANTIATE_FOR_STANDARD_NUMERIC_TYPES(instantiate_macro) \ + INSTANTIATE_FOR_REMAINING_NUMERIC_TYPES(instantiate_macro) +#else + #define INSTANTIATE_FOR_NUMERIC_TYPES(instantiate_macro) INSTANTIATE_FOR_STANDARD_NUMERIC_TYPES(instantiate_macro) +#endif + namespace ImPlot { //----------------------------------------------------------------------------- @@ -1577,33 +1607,16 @@ void PlotLine(const char* label_id, const T* values, int count, double xscale, d PlotLineEx(label_id, getter, flags); } -template IMPLOT_API void PlotLine (const char* label_id, const ImS8* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine (const char* label_id, const ImU8* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS16* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU16* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS32* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU32* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS64* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU64* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const float* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const double* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); - template void PlotLine(const char* label_id, const T* xs, const T* ys, int count, ImPlotLineFlags flags, int offset, int stride) { GetterXY,IndexerIdx> getter(IndexerIdx(xs,count,offset,stride),IndexerIdx(ys,count,offset,stride),count); PlotLineEx(label_id, getter, flags); } -template IMPLOT_API void PlotLine(const char* label_id, const ImS8* xs, const ImS8* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU8* xs, const ImU8* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS16* xs, const ImS16* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU16* xs, const ImU16* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS32* xs, const ImS32* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU32* xs, const ImU32* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS64* xs, const ImS64* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU64* xs, const ImU64* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const float* xs, const float* ys, int count, ImPlotLineFlags flags, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const double* xs, const double* ys, int count, ImPlotLineFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_LINE(T) \ + template IMPLOT_API void PlotLine (const char* label_id, const T* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotLine(const char* label_id, const T* xs, const T* ys, int count, ImPlotLineFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_LINE); // custom void PlotLineG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotLineFlags flags) { @@ -1639,33 +1652,16 @@ void PlotScatter(const char* label_id, const T* values, int count, double xscale PlotScatterEx(label_id, getter, flags); } -template IMPLOT_API void PlotScatter(const char* label_id, const ImS8* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU8* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS16* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU16* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS32* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU32* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS64* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU64* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const float* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const double* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); - template void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, ImPlotScatterFlags flags, int offset, int stride) { GetterXY,IndexerIdx> getter(IndexerIdx(xs,count,offset,stride),IndexerIdx(ys,count,offset,stride),count); return PlotScatterEx(label_id, getter, flags); } -template IMPLOT_API void PlotScatter(const char* label_id, const ImS8* xs, const ImS8* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU8* xs, const ImU8* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS16* xs, const ImS16* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU16* xs, const ImU16* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS32* xs, const ImS32* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU32* xs, const ImU32* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS64* xs, const ImS64* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU64* xs, const ImU64* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const float* xs, const float* ys, int count, ImPlotScatterFlags flags, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const double* xs, const double* ys, int count, ImPlotScatterFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_SCATTER(T) \ + template IMPLOT_API void PlotScatter(const char* label_id, const T* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, ImPlotScatterFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_SCATTER); // custom void PlotScatterG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotScatterFlags flags) { @@ -1715,33 +1711,16 @@ void PlotStairs(const char* label_id, const T* values, int count, double xscale, PlotStairsEx(label_id, getter, flags); } -template IMPLOT_API void PlotStairs (const char* label_id, const ImS8* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs (const char* label_id, const ImU8* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImS16* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU16* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImS32* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU32* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImS64* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU64* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const float* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const double* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); - template void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, ImPlotStairsFlags flags, int offset, int stride) { GetterXY,IndexerIdx> getter(IndexerIdx(xs,count,offset,stride),IndexerIdx(ys,count,offset,stride),count); return PlotStairsEx(label_id, getter, flags); } -template IMPLOT_API void PlotStairs(const char* label_id, const ImS8* xs, const ImS8* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU8* xs, const ImU8* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImS16* xs, const ImS16* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU16* xs, const ImU16* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImS32* xs, const ImS32* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU32* xs, const ImU32* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImS64* xs, const ImS64* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const ImU64* xs, const ImU64* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const float* xs, const float* ys, int count, ImPlotStairsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStairs(const char* label_id, const double* xs, const double* ys, int count, ImPlotStairsFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_STAIRS(T) \ + template IMPLOT_API void PlotStairs (const char* label_id, const T* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, ImPlotStairsFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_STAIRS); // custom void PlotStairsG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotStairsFlags flags) { @@ -1776,17 +1755,6 @@ void PlotShaded(const char* label_id, const T* values, int count, double y_ref, PlotShadedEx(label_id, getter1, getter2, flags); } -template IMPLOT_API void PlotShaded(const char* label_id, const ImS8* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU8* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS16* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU16* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS32* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU32* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS64* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU64* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const float* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const double* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); - template void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride) { if (y_ref == -HUGE_VAL) @@ -1798,16 +1766,6 @@ void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, doubl PlotShadedEx(label_id, getter1, getter2, flags); } -template IMPLOT_API void PlotShaded(const char* label_id, const ImS8* xs, const ImS8* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU8* xs, const ImU8* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS16* xs, const ImS16* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU16* xs, const ImU16* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS32* xs, const ImS32* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU32* xs, const ImU32* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS64* xs, const ImS64* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU64* xs, const ImU64* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const float* xs, const float* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const double* xs, const double* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); template void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, ImPlotShadedFlags flags, int offset, int stride) { @@ -1816,16 +1774,11 @@ void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, i PlotShadedEx(label_id, getter1, getter2, flags); } -template IMPLOT_API void PlotShaded(const char* label_id, const ImS8* xs, const ImS8* ys1, const ImS8* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU8* xs, const ImU8* ys1, const ImU8* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS16* xs, const ImS16* ys1, const ImS16* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU16* xs, const ImU16* ys1, const ImU16* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS32* xs, const ImS32* ys1, const ImS32* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU32* xs, const ImU32* ys1, const ImU32* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS64* xs, const ImS64* ys1, const ImS64* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU64* xs, const ImU64* ys1, const ImU64* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const float* xs, const float* ys1, const float* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const double* xs, const double* ys1, const double* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_SHADED(T) \ + template IMPLOT_API void PlotShaded(const char* label_id, const T* values, int count, double y_ref, double xscale, double x0, ImPlotShadedFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref, ImPlotShadedFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, ImPlotShadedFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_SHADED); // custom void PlotShadedG(const char* label_id, ImPlotGetter getter_func1, void* data1, ImPlotGetter getter_func2, void* data2, int count, ImPlotShadedFlags flags) { @@ -1892,17 +1845,6 @@ void PlotBars(const char* label_id, const T* values, int count, double bar_size, } } -template IMPLOT_API void PlotBars(const char* label_id, const ImS8* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU8* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImS16* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU16* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImS32* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU32* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImS64* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU64* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const float* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const double* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); - template void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride) { if (ImHasFlag(flags, ImPlotBarsFlags_Horizontal)) { @@ -1917,16 +1859,10 @@ void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double } } -template IMPLOT_API void PlotBars(const char* label_id, const ImS8* xs, const ImS8* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU8* xs, const ImU8* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImS16* xs, const ImS16* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU16* xs, const ImU16* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImS32* xs, const ImS32* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU32* xs, const ImU32* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImS64* xs, const ImS64* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const ImU64* xs, const ImU64* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const float* xs, const float* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotBars(const char* label_id, const double* xs, const double* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_BARS(T) \ + template IMPLOT_API void PlotBars(const char* label_id, const T* values, int count, double bar_size, double shift, ImPlotBarsFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double bar_size, ImPlotBarsFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_BARS); void PlotBarsG(const char* label_id, ImPlotGetter getter_func, void* data, int count, double bar_size, ImPlotBarsFlags flags) { if (ImHasFlag(flags, ImPlotBarsFlags_Horizontal)) { @@ -2021,16 +1957,8 @@ void PlotBarGroups(const char* const label_ids[], const T* values, int item_coun } } -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImS8* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImU8* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImS16* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImU16* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImS32* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImU32* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImS64* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const ImU64* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const float* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); -template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const double* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); +#define INSTANTIATE_PLOT_BAR_GROUPS(T) template IMPLOT_API void PlotBarGroups(const char* const label_ids[], const T* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_BAR_GROUPS); //----------------------------------------------------------------------------- // [SECTION] PlotErrorBars @@ -2083,17 +2011,6 @@ void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, PlotErrorBars(label_id, xs, ys, err, err, count, flags, offset, stride); } -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS8* xs, const ImS8* ys, const ImS8* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU8* xs, const ImU8* ys, const ImU8* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS16* xs, const ImS16* ys, const ImS16* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU16* xs, const ImU16* ys, const ImU16* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS32* xs, const ImS32* ys, const ImS32* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU32* xs, const ImU32* ys, const ImU32* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS64* xs, const ImS64* ys, const ImS64* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU64* xs, const ImU64* ys, const ImU64* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const float* xs, const float* ys, const float* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const double* xs, const double* ys, const double* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); - template void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride) { IndexerIdx indexer_x(xs, count,offset,stride); @@ -2117,16 +2034,10 @@ void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, } } -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS8* xs, const ImS8* ys, const ImS8* neg, const ImS8* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU8* xs, const ImU8* ys, const ImU8* neg, const ImU8* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS16* xs, const ImS16* ys, const ImS16* neg, const ImS16* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU16* xs, const ImU16* ys, const ImU16* neg, const ImU16* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS32* xs, const ImS32* ys, const ImS32* neg, const ImS32* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU32* xs, const ImU32* ys, const ImU32* neg, const ImU32* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImS64* xs, const ImS64* ys, const ImS64* neg, const ImS64* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const ImU64* xs, const ImU64* ys, const ImU64* neg, const ImU64* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const float* xs, const float* ys, const float* neg, const float* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); -template IMPLOT_API void PlotErrorBars(const char* label_id, const double* xs, const double* ys, const double* neg, const double* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_ERROR_BARS(T) \ + template IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, ImPlotErrorBarsFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, ImPlotErrorBarsFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_ERROR_BARS); //----------------------------------------------------------------------------- // [SECTION] PlotStems @@ -2167,17 +2078,6 @@ void PlotStems(const char* label_id, const T* values, int count, double ref, dou } } -template IMPLOT_API void PlotStems(const char* label_id, const ImS8* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU8* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS16* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU16* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS32* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU32* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS64* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU64* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const float* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const double* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); - template void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride) { if (ImHasFlag(flags, ImPlotStemsFlags_Horizontal)) { @@ -2192,16 +2092,11 @@ void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double } } -template IMPLOT_API void PlotStems(const char* label_id, const ImS8* xs, const ImS8* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU8* xs, const ImU8* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS16* xs, const ImS16* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU16* xs, const ImU16* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS32* xs, const ImS32* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU32* xs, const ImU32* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS64* xs, const ImS64* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU64* xs, const ImU64* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const float* xs, const float* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const double* xs, const double* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_STEMS(T) \ + template IMPLOT_API void PlotStems(const char* label_id, const T* values, int count, double ref, double scale, double start, ImPlotStemsFlags flags, int offset, int stride); \ + template IMPLOT_API void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double ref, ImPlotStemsFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_STEMS); + //----------------------------------------------------------------------------- // [SECTION] PlotInfLines @@ -2233,17 +2128,8 @@ void PlotInfLines(const char* label_id, const T* values, int count, ImPlotInfLin } } } - -template IMPLOT_API void PlotInfLines(const char* label_id, const ImS8* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImU8* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImS16* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImU16* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImS32* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImU32* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImS64* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const ImU64* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const float* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); -template IMPLOT_API void PlotInfLines(const char* label_id, const double* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_INF_LINES(T) template IMPLOT_API void PlotInfLines(const char* label_id, const T* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_INF_LINES); //----------------------------------------------------------------------------- // [SECTION] PlotPieChart @@ -2318,17 +2204,8 @@ void PlotPieChart(const char* const label_ids[], const T* values, int count, dou } PopPlotClipRect(); } - -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImS8* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImU8* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImS16* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImU16* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImS32* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImU32* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImS64* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const ImU64* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const float* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const double* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); +#define INSTANTIATE_PLOT_PIE_CHART(T) template IMPLOT_API void PlotPieChart(const char* const label_ids[], const T* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_PIE_CHART); //----------------------------------------------------------------------------- // [SECTION] PlotHeatmap @@ -2483,17 +2360,8 @@ void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, doub EndItem(); } } - -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImS8* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImU8* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImS16* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImU16* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImS32* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImU32* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImS64* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const ImU64* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const float* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); -template IMPLOT_API void PlotHeatmap(const char* label_id, const double* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); +#define INSTANTIATE_PLOT_HEATMAP(T) template IMPLOT_API void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, double scale_min, double scale_max, const char* fmt, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, ImPlotHeatmapFlags flags); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_HEATMAP); //----------------------------------------------------------------------------- // [SECTION] PlotHistogram @@ -2576,17 +2444,8 @@ double PlotHistogram(const char* label_id, const T* values, int count, int bins, PlotBars(label_id, &bin_centers.Data[0], &bin_counts.Data[0], bins, bar_scale*width); return max_count; } - -template IMPLOT_API double PlotHistogram(const char* label_id, const ImS8* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImU8* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImS16* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImU16* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImS32* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImU32* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImS64* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const ImU64* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const float* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram(const char* label_id, const double* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); +#define INSTANTIATE_PLOT_HISTOGRAM(T) template IMPLOT_API double PlotHistogram(const char* label_id, const T* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_HISTOGRAM); //----------------------------------------------------------------------------- // [SECTION] PlotHistogram2D @@ -2661,17 +2520,8 @@ double PlotHistogram2D(const char* label_id, const T* xs, const T* ys, int count } return max_count; } - -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImS8* xs, const ImS8* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImU8* xs, const ImU8* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImS16* xs, const ImS16* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImU16* xs, const ImU16* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImS32* xs, const ImS32* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImU32* xs, const ImU32* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImS64* xs, const ImS64* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const ImU64* xs, const ImU64* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const float* xs, const float* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); -template IMPLOT_API double PlotHistogram2D(const char* label_id, const double* xs, const double* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); +#define INSTANTIATE_PLOT_HISTOGRAM_2D(T) template IMPLOT_API double PlotHistogram2D(const char* label_id, const T* xs, const T* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_HISTOGRAM_2D); //----------------------------------------------------------------------------- // [SECTION] PlotDigital @@ -2744,17 +2594,8 @@ void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, ImPl GetterXY,IndexerIdx> getter(IndexerIdx(xs,count,offset,stride),IndexerIdx(ys,count,offset,stride),count); return PlotDigitalEx(label_id, getter, flags); } - -template IMPLOT_API void PlotDigital(const char* label_id, const ImS8* xs, const ImS8* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImU8* xs, const ImU8* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImS16* xs, const ImS16* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImU16* xs, const ImU16* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImS32* xs, const ImS32* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImU32* xs, const ImU32* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImS64* xs, const ImS64* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const ImU64* xs, const ImU64* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const float* xs, const float* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); -template IMPLOT_API void PlotDigital(const char* label_id, const double* xs, const double* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); +#define INSTANTIATE_PLOT_DIGITAL(T) template IMPLOT_API void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, ImPlotDigitalFlags flags, int offset, int stride); +INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_DIGITAL); // custom void PlotDigitalG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotDigitalFlags flags) {