mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Support custom numeric types (#399)
* implot_items.cpp: support types customization You can customize the supported types in two ways: 1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types. 2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double. -DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)" Details: - `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES` - `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation * CI: link example app, with null backend Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend). It serves as a proof that an app can be built, linked, and run, with type customization. - .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot This app uses implot and imgui, but does not output to any backend! If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported. - Corrected arch matrix options: 32 bits or 64 bits for win and linux x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode) - Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList This switch is currently not used in CI, but can be used during development. It could be later be used in the matrix options, at the cost of increasing the number of build per workflow. Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
This commit is contained in:
parent
49db527db1
commit
f719a180ff
86
.github/CMakeLists.txt
vendored
86
.github/CMakeLists.txt
vendored
|
@ -2,9 +2,59 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
project(implot)
|
||||
|
||||
#
|
||||
# Global options
|
||||
#
|
||||
|
||||
# Same as Dear ImGui
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# Arch option for linux
|
||||
if (NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND DEFINED GCC_ARCH)
|
||||
if ("${GCC_ARCH}" MATCHES "Win32|x86|32")
|
||||
add_compile_options(-m32)
|
||||
add_link_options(-m32)
|
||||
elseif ("${GCC_ARCH}" MATCHES "Win64|x64|64")
|
||||
add_compile_options(-m64)
|
||||
add_link_options(-m64)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Arch option for Mac: arm64 for M1 or x86_64 for intel (32 bits build are deprecated on Mac)
|
||||
if(APPLE AND DEFINED OSX_ARCH)
|
||||
if ("${OSX_ARCH}" MATCHES "x86_64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
elseif ("${OSX_ARCH}" MATCHES "arm64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unhandled OSX_ARCH=${OSX_ARCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Dear ImGui library with no backend
|
||||
#
|
||||
|
||||
set(imgui_sources
|
||||
../imgui/imconfig.h
|
||||
../imgui/imgui.cpp
|
||||
../imgui/imgui.h
|
||||
../imgui/imgui_demo.cpp
|
||||
../imgui/imgui_draw.cpp
|
||||
../imgui/imgui_internal.h
|
||||
../imgui/imgui_tables.cpp
|
||||
../imgui/imgui_widgets.cpp
|
||||
../imgui/imstb_rectpack.h
|
||||
../imgui/imstb_textedit.h
|
||||
../imgui/imstb_truetype.h
|
||||
)
|
||||
add_library(imgui ${imgui_sources})
|
||||
target_include_directories(imgui PUBLIC ../imgui)
|
||||
|
||||
#
|
||||
# ImPlot library
|
||||
#
|
||||
|
||||
file(GLOB SOURCE_CODE ../implot*.*)
|
||||
add_library(implot STATIC ${SOURCE_CODE})
|
||||
|
||||
|
@ -14,13 +64,33 @@ else()
|
|||
target_compile_options(implot PRIVATE -Wall -Werror -pedantic)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND DEFINED GCC_ARCH)
|
||||
if ("${GCC_ARCH}" MATCHES "Win32|x86|32")
|
||||
target_compile_options(implot PRIVATE -m32)
|
||||
elseif ("${GCC_ARCH}" MATCHES "Win64|x64|64")
|
||||
target_compile_options(implot PRIVATE -m64)
|
||||
endif ()
|
||||
target_include_directories(implot PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
target_link_libraries(implot PUBLIC imgui)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(implot PUBLIC m stdc++)
|
||||
endif()
|
||||
|
||||
target_include_directories(implot PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../imgui)
|
||||
target_compile_definitions(implot PRIVATE IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1)
|
||||
# Switch between several sets of numeric types (by adding `-DIMPLOT_NUMERIC_SET=default|custom|all`)
|
||||
if (DEFINED IMPLOT_NUMERIC_SET)
|
||||
if ("${IMPLOT_NUMERIC_SET}" STREQUAL "default")
|
||||
message(STATUS "Compiling for default types")
|
||||
elseif("${IMPLOT_NUMERIC_SET}" STREQUAL "custom")
|
||||
message(STATUS "Compiling for custom types (float and double)")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=(float)(double)")
|
||||
elseif("${IMPLOT_NUMERIC_SET}" STREQUAL "all")
|
||||
message(STATUS "Compiling for all types")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1")
|
||||
else()
|
||||
message(FATAL_ERROR "unhandled IMPLOT_NUMERIC_SET=${IMPLOT_NUMERIC_SET}")
|
||||
endif()
|
||||
else()
|
||||
# By default, the CI provides support for all known types
|
||||
target_compile_definitions(implot PRIVATE IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES)
|
||||
endif()
|
||||
|
||||
#
|
||||
# implot example binary application (with no backend)
|
||||
#
|
||||
add_executable(example_implot example_implot.cpp)
|
||||
target_link_libraries(example_implot PRIVATE implot)
|
||||
|
|
55
.github/example_implot.cpp
vendored
Normal file
55
.github/example_implot.cpp
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Sample app built with Dear ImGui and ImPlot
|
||||
// This app uses implot and imgui, but does not output to any backend! It only serves as a proof that an app can be built, linked, and run.
|
||||
|
||||
#include "imgui.h"
|
||||
#include "implot.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("sample_implot: start\n");
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImPlot::CreateContext();
|
||||
|
||||
// Additional imgui initialization needed when no backend is present
|
||||
ImGui::GetIO().DisplaySize = ImVec2(400.f, 400.f);
|
||||
ImGui::GetIO().Fonts->Build();
|
||||
|
||||
// Render 500 frames
|
||||
for(int counter = 0; counter < 500; ++counter)
|
||||
{
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (ImGui::Begin("Hello, world!"))
|
||||
{
|
||||
ImGui::Text("Hello again");
|
||||
|
||||
if (ImPlot::BeginPlot("My Plot"))
|
||||
{
|
||||
static double values[] = {1., 3., 5.};
|
||||
ImPlot::PlotLine("Values", values, 3);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
#ifdef IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES
|
||||
if (ImPlot::BeginPlot("My Plot (long double)"))
|
||||
{
|
||||
static long double values[] = {1., 3., 5.};
|
||||
ImPlot::PlotLine("Values", values, 3);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
#endif
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
}
|
||||
|
||||
ImPlot::DestroyContext();
|
||||
ImGui::DestroyContext();
|
||||
printf("sample_implot: end\n");
|
||||
return 0;
|
||||
}
|
75
.github/workflows/build.yml
vendored
75
.github/workflows/build.yml
vendored
|
@ -38,6 +38,10 @@ jobs:
|
|||
- name: Build
|
||||
run: cmake --build cmake-build --parallel $(nproc)
|
||||
|
||||
- name: Run
|
||||
run: |
|
||||
file cmake-build/example_implot
|
||||
cmake-build/example_implot
|
||||
|
||||
MacOS:
|
||||
runs-on: macos-11
|
||||
|
@ -49,7 +53,42 @@ jobs:
|
|||
- debug
|
||||
- release
|
||||
arch:
|
||||
- x86
|
||||
- x86_64
|
||||
- arm64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ocornut/imgui
|
||||
path: imgui
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DOSX_ARCH=${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cmake --build cmake-build --parallel $(sysctl -n hw.ncpu)
|
||||
|
||||
- name: Run
|
||||
if: matrix.arch == 'x86_64' # github's CI hosts seem to be running intel and can not run ARM
|
||||
run: |
|
||||
file cmake-build/example_implot
|
||||
cmake-build/example_implot
|
||||
|
||||
Windows_MSVC:
|
||||
runs-on: windows-2022
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type:
|
||||
- debug
|
||||
- release
|
||||
arch:
|
||||
- Win32
|
||||
- x64
|
||||
|
||||
steps:
|
||||
|
@ -62,13 +101,16 @@ jobs:
|
|||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DGCC_ARCH=${{ matrix.arch }} -B cmake-build -S .github
|
||||
run: cmake -G 'Visual Studio 17 2022' -A ${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cmake --build cmake-build --parallel $(sysctl -n hw.ncpu)
|
||||
run: cmake --build cmake-build -- -p:Configuration=${{ matrix.build_type }} -maxcpucount:$NUMBER_OF_PROCESSORS
|
||||
|
||||
Windows:
|
||||
- name: Run
|
||||
run: .\cmake-build\${{matrix.build_type}}\example_implot.exe
|
||||
|
||||
Windows_MingW: # MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries.
|
||||
runs-on: windows-2022
|
||||
|
||||
strategy:
|
||||
|
@ -78,11 +120,8 @@ jobs:
|
|||
- debug
|
||||
- release
|
||||
arch:
|
||||
- Win32
|
||||
- x64
|
||||
compiler:
|
||||
- msvc
|
||||
- mingw
|
||||
# - Win32
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -92,22 +131,14 @@ jobs:
|
|||
repository: ocornut/imgui
|
||||
path: imgui
|
||||
|
||||
- name: Configure (MSVC)
|
||||
if: matrix.compiler == 'msvc'
|
||||
shell: bash
|
||||
run: cmake -G 'Visual Studio 17 2022' -A ${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build (MSVC)
|
||||
if: matrix.compiler == 'msvc'
|
||||
shell: bash
|
||||
run: cmake --build cmake-build -- -p:Configuration=${{ matrix.build_type }} -maxcpucount:$NUMBER_OF_PROCESSORS
|
||||
|
||||
- name: Configure (MingW)
|
||||
if: matrix.compiler == 'mingw'
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: cmake -G 'MinGW Makefiles' -DGCC_ARCH=${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build (MingW)
|
||||
if: matrix.compiler == 'mingw'
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cmake --build cmake-build --parallel $NUMBER_OF_PROCESSORS
|
||||
|
||||
- name: Run (MingW)
|
||||
run: .\cmake-build\example_implot.exe
|
||||
|
|
@ -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. 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`).
|
||||
`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. Also, you can fully customize the list of accepted types: see doc in `implot_items.cpp`.
|
||||
|
||||
**Q: Can plot styles be modified?**
|
||||
|
||||
|
|
122
implot_items.cpp
122
implot_items.cpp
|
@ -70,32 +70,40 @@ static IMPLOT_INLINE float ImInvSqrt(float x) { return 1.0f / sqrtf(x); }
|
|||
// [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);
|
||||
// By default, templates are instantiated for `float`, `double`, and for the following integer types, which are defined in imgui.h:
|
||||
// signed char ImS8; // 8-bit signed integer
|
||||
// unsigned char ImU8; // 8-bit unsigned integer
|
||||
// signed short ImS16; // 16-bit signed integer
|
||||
// unsigned short ImU16; // 16-bit unsigned integer
|
||||
// signed int ImS32; // 32-bit signed integer == int
|
||||
// unsigned int ImU32; // 32-bit unsigned integer
|
||||
// signed long long ImS64; // 64-bit signed integer
|
||||
// unsigned long long ImU64; // 64-bit unsigned integer
|
||||
// (note: this list does *not* include `long`, `unsigned long` and `long double`)
|
||||
//
|
||||
// You can customize the supported types in two ways:
|
||||
// 1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
|
||||
// 2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
|
||||
// -DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(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)
|
||||
#ifdef IMPLOT_CUSTOM_NUMERIC_TYPES
|
||||
#define IMPLOT_NUMERIC_TYPES IMPLOT_CUSTOM_NUMERIC_TYPES
|
||||
#elif defined(IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES)
|
||||
#define IMPLOT_NUMERIC_TYPES (signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)
|
||||
#else
|
||||
#define INSTANTIATE_FOR_NUMERIC_TYPES(instantiate_macro) INSTANTIATE_FOR_STANDARD_NUMERIC_TYPES(instantiate_macro)
|
||||
#define IMPLOT_NUMERIC_TYPES (ImS8)(ImU8)(ImS16)(ImU16)(ImS32)(ImU32)(ImS64)(ImU64)(float)(double)
|
||||
#endif
|
||||
|
||||
// CALL_INSTANTIATE_FOR_NUMERIC_TYPES will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types.
|
||||
#define _CAT(x, y) _CAT_(x, y)
|
||||
#define _CAT_(x,y) x ## y
|
||||
#define _INSTANTIATE_FOR_NUMERIC_TYPES(chain) _CAT(_INSTANTIATE_FOR_NUMERIC_TYPES_1 chain, _END)
|
||||
#define _INSTANTIATE_FOR_NUMERIC_TYPES_1(T) INSTANTIATE_MACRO(T); _INSTANTIATE_FOR_NUMERIC_TYPES_2
|
||||
#define _INSTANTIATE_FOR_NUMERIC_TYPES_2(T) INSTANTIATE_MACRO(T); _INSTANTIATE_FOR_NUMERIC_TYPES_1
|
||||
#define _INSTANTIATE_FOR_NUMERIC_TYPES_1_END
|
||||
#define _INSTANTIATE_FOR_NUMERIC_TYPES_2_END
|
||||
#define CALL_INSTANTIATE_FOR_NUMERIC_TYPES() _INSTANTIATE_FOR_NUMERIC_TYPES(IMPLOT_NUMERIC_TYPES);
|
||||
|
||||
namespace ImPlot {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1613,10 +1621,11 @@ void PlotLine(const char* label_id, const T* xs, const T* ys, int count, ImPlotL
|
|||
PlotLineEx(label_id, getter, flags);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_LINE(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotLine<T> (const char* label_id, const T* values, int count, double xscale, double x0, ImPlotLineFlags flags, int offset, int stride); \
|
||||
template IMPLOT_API void PlotLine<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
// custom
|
||||
void PlotLineG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotLineFlags flags) {
|
||||
|
@ -1658,10 +1667,11 @@ void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, ImPl
|
|||
return PlotScatterEx(label_id, getter, flags);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_SCATTER(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotScatter<T>(const char* label_id, const T* values, int count, double xscale, double x0, ImPlotScatterFlags flags, int offset, int stride); \
|
||||
template IMPLOT_API void PlotScatter<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
// custom
|
||||
void PlotScatterG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotScatterFlags flags) {
|
||||
|
@ -1717,10 +1727,11 @@ void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, ImPlo
|
|||
return PlotStairsEx(label_id, getter, flags);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_STAIRS(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotStairs<T> (const char* label_id, const T* values, int count, double xscale, double x0, ImPlotStairsFlags flags, int offset, int stride); \
|
||||
template IMPLOT_API void PlotStairs<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
// custom
|
||||
void PlotStairsG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotStairsFlags flags) {
|
||||
|
@ -1774,11 +1785,12 @@ void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, i
|
|||
PlotShadedEx(label_id, getter1, getter2, flags);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_SHADED(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotShaded<T>(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<T>(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<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
// custom
|
||||
void PlotShadedG(const char* label_id, ImPlotGetter getter_func1, void* data1, ImPlotGetter getter_func2, void* data2, int count, ImPlotShadedFlags flags) {
|
||||
|
@ -1859,10 +1871,11 @@ void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double
|
|||
}
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_BARS(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotBars<T>(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<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
void PlotBarsG(const char* label_id, ImPlotGetter getter_func, void* data, int count, double bar_size, ImPlotBarsFlags flags) {
|
||||
if (ImHasFlag(flags, ImPlotBarsFlags_Horizontal)) {
|
||||
|
@ -1957,8 +1970,9 @@ void PlotBarGroups(const char* const label_ids[], const T* values, int item_coun
|
|||
}
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_BAR_GROUPS(T) template IMPLOT_API void PlotBarGroups<T>(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);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API void PlotBarGroups<T>(const char* const label_ids[], const T* values, int items, int groups, double width, double shift, ImPlotBarGroupsFlags flags);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotErrorBars
|
||||
|
@ -2034,10 +2048,11 @@ void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg,
|
|||
}
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_ERROR_BARS(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotErrorBars<T>(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<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotStems
|
||||
|
@ -2092,10 +2107,11 @@ void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double
|
|||
}
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PLOT_STEMS(T) \
|
||||
#define INSTANTIATE_MACRO(T) \
|
||||
template IMPLOT_API void PlotStems<T>(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<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2128,8 +2144,9 @@ void PlotInfLines(const char* label_id, const T* values, int count, ImPlotInfLin
|
|||
}
|
||||
}
|
||||
}
|
||||
#define INSTANTIATE_PLOT_INF_LINES(T) template IMPLOT_API void PlotInfLines<T>(const char* label_id, const T* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride);
|
||||
INSTANTIATE_FOR_NUMERIC_TYPES(INSTANTIATE_PLOT_INF_LINES);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API void PlotInfLines<T>(const char* label_id, const T* xs, int count, ImPlotInfLinesFlags flags, int offset, int stride);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotPieChart
|
||||
|
@ -2204,8 +2221,9 @@ void PlotPieChart(const char* const label_ids[], const T* values, int count, dou
|
|||
}
|
||||
PopPlotClipRect();
|
||||
}
|
||||
#define INSTANTIATE_PLOT_PIE_CHART(T) template IMPLOT_API void PlotPieChart<T>(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);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API void PlotPieChart<T>(const char* const label_ids[], const T* values, int count, double x, double y, double radius, const char* fmt, double angle0, ImPlotPieChartFlags flags);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotHeatmap
|
||||
|
@ -2360,8 +2378,9 @@ void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, doub
|
|||
EndItem();
|
||||
}
|
||||
}
|
||||
#define INSTANTIATE_PLOT_HEATMAP(T) template IMPLOT_API void PlotHeatmap<T>(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);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API void PlotHeatmap<T>(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);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotHistogram
|
||||
|
@ -2444,8 +2463,9 @@ 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;
|
||||
}
|
||||
#define INSTANTIATE_PLOT_HISTOGRAM(T) template IMPLOT_API double PlotHistogram<T>(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);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API double PlotHistogram<T>(const char* label_id, const T* values, int count, int bins, double bar_scale, ImPlotRange range, ImPlotHistogramFlags flags);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotHistogram2D
|
||||
|
@ -2520,8 +2540,9 @@ double PlotHistogram2D(const char* label_id, const T* xs, const T* ys, int count
|
|||
}
|
||||
return max_count;
|
||||
}
|
||||
#define INSTANTIATE_PLOT_HISTOGRAM_2D(T) template IMPLOT_API double PlotHistogram2D<T>(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);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API double PlotHistogram2D<T>(const char* label_id, const T* xs, const T* ys, int count, int x_bins, int y_bins, ImPlotRect range, ImPlotHistogramFlags flags);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] PlotDigital
|
||||
|
@ -2594,8 +2615,9 @@ void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, ImPl
|
|||
GetterXY<IndexerIdx<T>,IndexerIdx<T>> getter(IndexerIdx<T>(xs,count,offset,stride),IndexerIdx<T>(ys,count,offset,stride),count);
|
||||
return PlotDigitalEx(label_id, getter, flags);
|
||||
}
|
||||
#define INSTANTIATE_PLOT_DIGITAL(T) template IMPLOT_API void PlotDigital<T>(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);
|
||||
#define INSTANTIATE_MACRO(T) template IMPLOT_API void PlotDigital<T>(const char* label_id, const T* xs, const T* ys, int count, ImPlotDigitalFlags flags, int offset, int stride);
|
||||
CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
|
||||
#undef INSTANTIATE_MACRO
|
||||
|
||||
// custom
|
||||
void PlotDigitalG(const char* label_id, ImPlotGetter getter_func, void* data, int count, ImPlotDigitalFlags flags) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user