mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Merge branch 'master' of https://github.com/epezent/implot
This commit is contained in:
commit
9ef3a97966
29
.github/CMakeLists.txt
vendored
29
.github/CMakeLists.txt
vendored
|
@ -71,22 +71,21 @@ if (UNIX)
|
|||
target_link_libraries(implot PUBLIC m stdc++)
|
||||
endif()
|
||||
|
||||
# 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()
|
||||
# Define supported types via command line:
|
||||
# - With no choice all types are supported (so that the CI provides support for all known types)
|
||||
# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="default" the default set defined in implot_items.cpp is used
|
||||
# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="(int)(float)(double)" only int, float and double are supported
|
||||
if (NOT DEFINED IMPLOT_CUSTOM_NUMERIC_TYPES)
|
||||
set(IMPLOT_CUSTOM_NUMERIC_TYPES "all")
|
||||
endif()
|
||||
if ("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "default")
|
||||
message("==== Compiling for default types ====")
|
||||
elseif("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "all")
|
||||
message("==== Compiling for all types ====")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_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()
|
||||
# By default, the CI provides support for all known types
|
||||
target_compile_definitions(implot PRIVATE IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES)
|
||||
message("==== Compiling for custom types: ${IMPLOT_CUSTOM_NUMERIC_TYPES} ====")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=${IMPLOT_CUSTOM_NUMERIC_TYPES}")
|
||||
endif()
|
||||
|
||||
#
|
||||
|
|
16
README.md
16
README.md
|
@ -95,6 +95,20 @@ You should be good to go!
|
|||
|
||||
If you want to test ImPlot quickly, consider trying [mahi-gui](https://github.com/mahilab/mahi-gui), which bundles ImGui, ImPlot, and several other packages for you.
|
||||
|
||||
## Installing ImPlot using vcpkg
|
||||
|
||||
You can download and install ImPlot using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
./vcpkg install implot
|
||||
```
|
||||
|
||||
The ImPlot port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
## Extremely Important Note
|
||||
|
||||
Dear ImGui uses **16-bit indexing by default**, so high-density ImPlot widgets like `ImPlot::PlotHeatmap()` may produce too many vertices into `ImDrawList`, which causes an assertion failure and will result in data truncation and/or visual glitches. Therefore, it is **HIGHLY** recommended that you EITHER:
|
||||
|
@ -123,7 +137,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. Also, you can fully customize the list of accepted types: see doc in `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. You can fully customize the list of accepted types by defining `IMPLOT_CUSTOM_NUMERIC_TYPES` at compile time: see doc in `implot_items.cpp`.
|
||||
|
||||
**Q: Can plot styles be modified?**
|
||||
|
||||
|
|
|
@ -83,13 +83,14 @@ static IMPLOT_INLINE float ImInvSqrt(float x) { return 1.0f / sqrtf(x); }
|
|||
//
|
||||
// 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.
|
||||
// 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)"
|
||||
// In order to support all known C++ types, use:
|
||||
// -DIMPLOT_CUSTOM_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)"
|
||||
|
||||
#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 IMPLOT_NUMERIC_TYPES (ImS8)(ImU8)(ImS16)(ImU16)(ImS32)(ImU32)(ImS64)(ImU64)(float)(double)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user