added plots and new style

This commit is contained in:
2026-02-25 14:11:04 +03:00
parent 0a57622f67
commit b530ae06d9
25 changed files with 24897 additions and 100 deletions

View File

@@ -1,15 +1,21 @@
#pragma once
#include "vertex_engine/event/event.hpp" // IWYU pragma: keep
#include "vertex_engine/event/connector.hpp" // IWYU pragma: keep
#include "vertex_engine/event/event_manager.hpp" // IWYU pragma: keep
#include "vertex_engine/event/type.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/gui.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/flags.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/style/icons.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/style/fonts.hpp" // IWYU pragma: keep
#include "vertex_engine/utils/utils.hpp" // IWYU pragma: keep
#include "vertex_engine/layer/layer.hpp" // IWYU pragma: keep
#include "vertex_engine/glfw/glfw.hpp" // IWYU pragma: keep
#include "vertex_engine/opengl/opengl.hpp" // IWYU pragma: keep
#include "vertex_engine/application/application.hpp" // IWYU pragma: keep
#include "vertex_engine/event/event.hpp" // IWYU pragma: keep
#include "vertex_engine/event/connector.hpp" // IWYU pragma: keep
#include "vertex_engine/event/event_manager.hpp" // IWYU pragma: keep
#include "vertex_engine/event/type.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/gui.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/flags.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/style/icons.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/style/fonts.hpp" // IWYU pragma: keep
#include "vertex_engine/utils/utils.hpp" // IWYU pragma: keep
#include "vertex_engine/layer/layer.hpp" // IWYU pragma: keep
#include "vertex_engine/glfw/glfw.hpp" // IWYU pragma: keep
#include "vertex_engine/opengl/opengl.hpp" // IWYU pragma: keep
#include "vertex_engine/application/application.hpp" // IWYU pragma: keep
// plots
#include "vertex_engine/gui/plots/2d/implot.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/plots/2d/implot_internal.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/plots/3d/implot3d.hpp" // IWYU pragma: keep
#include "vertex_engine/gui/plots/3d/implot3d_internal.hpp" // IWYU pragma: keep

View File

@@ -26,6 +26,11 @@ headers = [
'vertex_engine/opengl/shader_program/shader_program.hpp',
'vertex_engine/opengl/opengl.hpp',
'vertex_engine/gui/plots/2d/implot.hpp',
'vertex_engine/gui/plots/2d/implot_internal.hpp',
'vertex_engine/gui/plots/3d/implot3d.hpp',
'vertex_engine/gui/plots/3d/implot3d_internal.hpp',
'VE.hpp'
]
@@ -37,7 +42,15 @@ sources = [
'vertex_engine/gui/gui.cpp',
'vertex_engine/opengl/buffer/buffer.cpp',
'vertex_engine/opengl/shader_program/shader_program.cpp'
'vertex_engine/opengl/shader_program/shader_program.cpp',
'vertex_engine/gui/plots/2d/implot.cpp',
'vertex_engine/gui/plots/2d/implot_demo.cpp',
'vertex_engine/gui/plots/2d/implot_items.cpp',
'vertex_engine/gui/plots/3d/implot3d.cpp',
'vertex_engine/gui/plots/3d/implot3d_items.cpp',
'vertex_engine/gui/plots/3d/implot3d_meshes.cpp',
'vertex_engine/gui/plots/3d/implot3d_demo.cpp',
]
lib = library(

View File

@@ -1,10 +1,6 @@
#pragma once
#include <any>
#include <string>
#include <hack/security/uuid.hpp>
#include <hack/exception/exception.hpp>
#include <hack/logger/logger.hpp>
#include "vertex_engine/utils/include.hpp" // IWYU pragma: keep
namespace VE
{

View File

@@ -1,8 +1,5 @@
#pragma once
#include <hack/patterns/singleton.hpp>
#include <hack/logger/logger.hpp>
#include <hack/security/uuid.hpp>
#include "event.hpp"
#include "vertex_engine/utils/using.hpp"

View File

@@ -1,7 +1,5 @@
#include "context.hpp"
#include "vertex_engine/utils/define.hpp" // IWYU pragma: keep
namespace VE
{
context::context(GLFWwindow* w) : m_win { w }

View File

@@ -1,6 +1,8 @@
#include "gui.hpp"
#include "style/style.hpp"
#include "plots/2d/implot.hpp"
#include "plots/3d/implot3d.hpp"
namespace VE
{
@@ -24,6 +26,9 @@ namespace VE
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 410");
ImPlot3D::CreateContext();
ImPlot::CreateContext();
style::init();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,931 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024-2026 Breno Cunha Queiroz
// ImPlot3D v0.4 WIP
// Acknowledgments:
// ImPlot3D is heavily inspired by ImPlot
// (https://github.com/epezent/implot) by Evan Pezent,
// and follows a similar code style and structure to
// maintain consistency with ImPlot's API.
// Table of Contents:
// [SECTION] Constants
// [SECTION] Generic Helpers
// [SECTION] Internal Enumerations
// [SECTION] Forward Declarations
// [SECTION] Callbacks
// [SECTION] Structs
// [SECTION] Context Pointer
// [SECTION] Context Utils
// [SECTION] Style Utils
// [SECTION] Item Utils
// [SECTION] Plot Utils
// [SECTION] Setup Utils
// [SECTION] Formatter
// [SECTION] Locator
#pragma once
#ifndef IMPLOT3D_VERSION
#include "implot3d.h"
#endif
#ifndef IMGUI_DISABLE
#include "imgui_internal.h"
//-----------------------------------------------------------------------------
// [SECTION] Constants
//-----------------------------------------------------------------------------
// Default label format for axis labels
#define IMPLOT3D_LABEL_FORMAT "%g"
// Max character size for tick labels
#define IMPLOT3D_LABEL_MAX_SIZE 32
//-----------------------------------------------------------------------------
// [SECTION] Generic Helpers
//-----------------------------------------------------------------------------
namespace ImPlot3D {
// Computes the common (base-10) logarithm
static inline double ImLog10(double x) { return log10(x); }
// Computes the hyperbolic sine
static inline double ImSinh(double x) { return sinh(x); }
// Computes the inverse hyperbolic sine
static inline double ImAsinh(double x) { return asinh(x); }
// Returns true if flag is set
template <typename TSet, typename TFlag> static inline bool ImHasFlag(TSet set, TFlag flag) { return (set & flag) == flag; }
// Flips a flag in a flagset
template <typename TSet, typename TFlag> static inline void ImFlipFlag(TSet& set, TFlag flag) { ImHasFlag(set, flag) ? set &= ~flag : set |= flag; }
template <typename T> static inline T ImRemap01(T x, T x0, T x1) { return (x1 - x0) ? ((x - x0) / (x1 - x0)) : 0; }
// Returns always positive modulo (assumes r != 0)
static inline int ImPosMod(int l, int r) { return (l % r + r) % r; }
// Returns true if val is NAN
static inline bool ImNan(double val) { return isnan(val); }
// Returns true if val is NAN or INFINITY
static inline bool ImNanOrInf(double val) { return !(val >= -DBL_MAX && val <= DBL_MAX) || ImNan(val); }
// Turns NANs to 0s
static inline double ImConstrainNan(double val) { return ImNan(val) ? 0 : val; }
// Turns infinity to floating point maximums
// Clamped to half DBL_MAX to prevent overflow in size calculations (Max - Min)
static inline double ImConstrainInf(double val) {
const double max_val = DBL_MAX * 0.5;
return val >= max_val ? max_val : val <= -max_val ? -max_val : val;
}
// True if two numbers are approximately equal using units in the last place.
static inline bool ImAlmostEqual(double v1, double v2, int ulp = 2) {
return ImAbs(v1 - v2) < DBL_EPSILON * ImAbs(v1 + v2) * ulp || ImAbs(v1 - v2) < DBL_MIN;
}
// Set alpha channel of 32-bit color from float in range [0.0 1.0]
static inline ImU32 ImAlphaU32(ImU32 col, float alpha) { return col & ~((ImU32)((1.0f - alpha) * 255) << IM_COL32_A_SHIFT); }
// Mix color a and b by factor s in [0 256]
static inline ImU32 ImMixU32(ImU32 a, ImU32 b, ImU32 s) {
#ifdef IMPLOT3D_MIX64
const ImU32 af = 256 - s;
const ImU32 bf = s;
const ImU64 al = (a & 0x00ff00ff) | (((ImU64)(a & 0xff00ff00)) << 24);
const ImU64 bl = (b & 0x00ff00ff) | (((ImU64)(b & 0xff00ff00)) << 24);
const ImU64 mix = (al * af + bl * bf);
return ((mix >> 32) & 0xff00ff00) | ((mix & 0xff00ff00) >> 8);
#else
const ImU32 af = 256 - s;
const ImU32 bf = s;
const ImU32 al = (a & 0x00ff00ff);
const ImU32 ah = (a & 0xff00ff00) >> 8;
const ImU32 bl = (b & 0x00ff00ff);
const ImU32 bh = (b & 0xff00ff00) >> 8;
const ImU32 ml = (al * af + bl * bf);
const ImU32 mh = (ah * af + bh * bf);
return (mh & 0xff00ff00) | ((ml & 0xff00ff00) >> 8);
#endif
}
// Fills a buffer with n samples linear interpolated from vmin to vmax
template <typename T> void FillRange(ImVector<T>& buffer, int n, T vmin, T vmax) {
buffer.resize(n);
T step = (vmax - vmin) / (n - 1);
for (int i = 0; i < n; ++i) {
buffer[i] = vmin + i * step;
}
}
} // namespace ImPlot3D
//-----------------------------------------------------------------------------
// [SECTION] Internal Enumerations
//-----------------------------------------------------------------------------
enum ImPlot3DMarkerInternal_ {
ImPlot3DMarker_Invalid = -3,
};
//-----------------------------------------------------------------------------
// [SECTION] Forward Declarations
//-----------------------------------------------------------------------------
struct ImPlot3DTicker;
//------------------------------------------------------------------------------
// [SECTION] Callbacks
//------------------------------------------------------------------------------
typedef void (*ImPlot3DLocator)(ImPlot3DTicker& ticker, const ImPlot3DRange& range, float pixels, ImPlot3DFormatter formatter, void* formatter_data);
//-----------------------------------------------------------------------------
// [SECTION] Structs
//-----------------------------------------------------------------------------
struct ImDrawList3D {
// [Internal] Define which texture should be used when rendering triangles.
struct ImTextureBufferItem {
ImTextureRef TexRef;
unsigned int VtxIdx;
};
ImVector<ImDrawIdx> IdxBuffer; // Index buffer
ImVector<ImDrawVert> VtxBuffer; // Vertex buffer
ImVector<double> ZBuffer; // Z buffer. Depth value for each triangle
unsigned int _VtxCurrentIdx; // [Internal] current vertex index
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
double* _ZWritePtr; // [Internal] point within ZBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
ImDrawListFlags _Flags; // [Internal] draw list flags
ImVector<ImTextureBufferItem> _TextureBuffer; // [Internal] buffer for SetTexture/ResetTexture
ImDrawListSharedData* _SharedData; // [Internal] shared draw list data
ImDrawList3D() {
_Flags = ImDrawListFlags_None;
_SharedData = nullptr;
ResetBuffers();
}
void PrimReserve(int idx_count, int vtx_count);
void PrimUnreserve(int idx_count, int vtx_count);
void SetTexture(ImTextureRef tex_ref);
void ResetTexture();
void SortedMoveToImGuiDrawList();
void ResetBuffers() {
IdxBuffer.clear();
VtxBuffer.clear();
ZBuffer.clear();
_VtxCurrentIdx = 0;
_VtxWritePtr = VtxBuffer.Data;
_IdxWritePtr = IdxBuffer.Data;
_ZWritePtr = ZBuffer.Data;
_TextureBuffer.clear();
ResetTexture();
}
constexpr static unsigned int MaxIdx() { return sizeof(ImDrawIdx) == 2 ? 65535 : 4294967295; }
};
struct ImPlot3DNextItemData {
ImPlot3DSpec Spec;
bool RenderLine;
bool RenderFill;
bool RenderMarkerLine;
bool RenderMarkerFill;
bool IsAutoFill;
bool IsAutoLine;
bool Hidden;
ImPlot3DNextItemData() { Reset(); }
void Reset() {
Spec = ImPlot3DSpec();
RenderLine = false;
RenderFill = false;
RenderMarkerLine = true;
RenderMarkerFill = true;
IsAutoFill = true;
IsAutoLine = true;
Hidden = false;
}
};
// Colormap data storage
struct ImPlot3DColormapData {
ImVector<ImU32> Keys;
ImVector<int> KeyCounts;
ImVector<int> KeyOffsets;
ImVector<ImU32> Tables;
ImVector<int> TableSizes;
ImVector<int> TableOffsets;
ImGuiTextBuffer Text;
ImVector<int> TextOffsets;
ImVector<bool> Quals;
ImGuiStorage Map;
int Count;
ImPlot3DColormapData() { Count = 0; }
int Append(const char* name, const ImU32* keys, int count, bool qual) {
if (GetIndex(name) != -1)
return -1;
KeyOffsets.push_back(Keys.size());
KeyCounts.push_back(count);
Keys.reserve(Keys.size() + count);
for (int i = 0; i < count; ++i)
Keys.push_back(keys[i]);
TextOffsets.push_back(Text.size());
Text.append(name, name + strlen(name) + 1);
Quals.push_back(qual);
ImGuiID id = ImHashStr(name);
int idx = Count++;
Map.SetInt(id, idx);
_AppendTable(idx);
return idx;
}
void _AppendTable(ImPlot3DColormap cmap) {
int key_count = GetKeyCount(cmap);
const ImU32* keys = GetKeys(cmap);
int off = Tables.size();
TableOffsets.push_back(off);
if (IsQual(cmap)) {
Tables.reserve(key_count);
for (int i = 0; i < key_count; ++i)
Tables.push_back(keys[i]);
TableSizes.push_back(key_count);
} else {
int max_size = 255 * (key_count - 1) + 1;
Tables.reserve(off + max_size);
// ImU32 last = keys[0];
// Tables.push_back(last);
// int n = 1;
for (int i = 0; i < key_count - 1; ++i) {
for (int s = 0; s < 255; ++s) {
ImU32 a = keys[i];
ImU32 b = keys[i + 1];
ImU32 c = ImPlot3D::ImMixU32(a, b, (ImU32)s);
// if (c != last) {
Tables.push_back(c);
// last = c;
// n++;
// }
}
}
ImU32 c = keys[key_count - 1];
// if (c != last) {
Tables.push_back(c);
// n++;
// }
// TableSizes.push_back(n);
TableSizes.push_back(max_size);
}
}
void RebuildTables() {
Tables.resize(0);
TableSizes.resize(0);
TableOffsets.resize(0);
for (int i = 0; i < Count; ++i)
_AppendTable(i);
}
inline bool IsQual(ImPlot3DColormap cmap) const { return Quals[cmap]; }
inline const char* GetName(ImPlot3DColormap cmap) const { return cmap < Count ? Text.Buf.Data + TextOffsets[cmap] : nullptr; }
inline ImPlot3DColormap GetIndex(const char* name) const {
ImGuiID key = ImHashStr(name);
return Map.GetInt(key, -1);
}
inline const ImU32* GetKeys(ImPlot3DColormap cmap) const { return &Keys[KeyOffsets[cmap]]; }
inline int GetKeyCount(ImPlot3DColormap cmap) const { return KeyCounts[cmap]; }
inline ImU32 GetKeyColor(ImPlot3DColormap cmap, int idx) const { return Keys[KeyOffsets[cmap] + idx]; }
inline void SetKeyColor(ImPlot3DColormap cmap, int idx, ImU32 value) {
Keys[KeyOffsets[cmap] + idx] = value;
RebuildTables();
}
inline const ImU32* GetTable(ImPlot3DColormap cmap) const { return &Tables[TableOffsets[cmap]]; }
inline int GetTableSize(ImPlot3DColormap cmap) const { return TableSizes[cmap]; }
inline ImU32 GetTableColor(ImPlot3DColormap cmap, int idx) const { return Tables[TableOffsets[cmap] + idx]; }
inline ImU32 LerpTable(ImPlot3DColormap cmap, float t) const {
int off = TableOffsets[cmap];
int siz = TableSizes[cmap];
int idx = Quals[cmap] ? ImClamp((int)(siz * t), 0, siz - 1) : (int)((siz - 1) * t + 0.5f);
return Tables[off + idx];
}
};
// State information for plot items
struct ImPlot3DItem {
ImGuiID ID;
ImU32 Color;
ImPlot3DMarker Marker;
int NameOffset;
bool Show;
bool LegendHovered;
bool SeenThisFrame;
ImPlot3DItem() {
ID = 0;
Color = IM_COL32_WHITE;
Marker = ImPlot3DMarker_None;
NameOffset = -1;
Show = true;
LegendHovered = false;
SeenThisFrame = false;
}
~ImPlot3DItem() { ID = 0; }
};
// Holds legend state
struct ImPlot3DLegend {
ImPlot3DLegendFlags Flags;
ImPlot3DLegendFlags PreviousFlags;
ImPlot3DLocation Location;
ImPlot3DLocation PreviousLocation;
ImVector<int> Indices;
ImGuiTextBuffer Labels;
ImRect Rect;
bool Hovered;
bool Held;
ImPlot3DLegend() {
PreviousFlags = Flags = ImPlot3DLegendFlags_None;
Hovered = Held = false;
PreviousLocation = Location = ImPlot3DLocation_NorthWest;
}
void Reset() {
Indices.shrink(0);
Labels.Buf.shrink(0);
}
};
// Holds items
struct ImPlot3DItemGroup {
ImPool<ImPlot3DItem> ItemPool;
ImPlot3DLegend Legend;
int ColormapIdx;
ImPlot3DMarker MarkerIdx;
ImPlot3DItemGroup() {
ColormapIdx = 0;
MarkerIdx = 0;
}
int GetItemCount() const { return ItemPool.GetBufSize(); }
ImGuiID GetItemID(const char* label_id) { return ImGui::GetID(label_id); }
ImPlot3DItem* GetItem(ImGuiID id) { return ItemPool.GetByKey(id); }
ImPlot3DItem* GetItem(const char* label_id) { return GetItem(GetItemID(label_id)); }
ImPlot3DItem* GetOrAddItem(ImGuiID id) { return ItemPool.GetOrAddByKey(id); }
ImPlot3DItem* GetItemByIndex(int i) { return ItemPool.GetByIndex(i); }
int GetItemIndex(ImPlot3DItem* item) { return ItemPool.GetIndex(item); }
int GetLegendCount() const { return Legend.Indices.size(); }
ImPlot3DItem* GetLegendItem(int i) { return ItemPool.GetByIndex(Legend.Indices[i]); }
const char* GetLegendLabel(int i) { return Legend.Labels.Buf.Data + GetLegendItem(i)->NameOffset; }
void Reset() {
ItemPool.Clear();
Legend.Reset();
ColormapIdx = 0;
MarkerIdx = 0;
}
};
// Tick mark info
struct ImPlot3DTick {
double PlotPos;
bool Major;
bool ShowLabel;
ImVec2 LabelSize;
int TextOffset;
int Idx;
ImPlot3DTick(double value, bool major, bool show_label) {
PlotPos = value;
Major = major;
ShowLabel = show_label;
TextOffset = -1;
}
};
// Collection of ticks
struct ImPlot3DTicker {
ImVector<ImPlot3DTick> Ticks;
ImGuiTextBuffer TextBuffer;
ImPlot3DTicker() { Reset(); }
ImPlot3DTick& AddTick(double value, bool major, bool show_label, const char* label) {
ImPlot3DTick tick(value, major, show_label);
if (show_label && label != nullptr) {
tick.TextOffset = TextBuffer.size();
TextBuffer.append(label, label + strlen(label) + 1);
tick.LabelSize = ImGui::CalcTextSize(TextBuffer.Buf.Data + tick.TextOffset);
}
return AddTick(tick);
}
ImPlot3DTick& AddTick(double value, bool major, bool show_label, ImPlot3DFormatter formatter, void* data) {
ImPlot3DTick tick(value, major, show_label);
if (show_label && formatter != nullptr) {
char buff[IMPLOT3D_LABEL_MAX_SIZE];
tick.TextOffset = TextBuffer.size();
formatter(tick.PlotPos, buff, sizeof(buff), data);
TextBuffer.append(buff, buff + strlen(buff) + 1);
tick.LabelSize = ImGui::CalcTextSize(TextBuffer.Buf.Data + tick.TextOffset);
}
return AddTick(tick);
}
inline ImPlot3DTick& AddTick(ImPlot3DTick tick) {
tick.Idx = Ticks.size();
Ticks.push_back(tick);
return Ticks.back();
}
const char* GetText(int idx) const { return TextBuffer.Buf.Data + Ticks[idx].TextOffset; }
const char* GetText(const ImPlot3DTick& tick) const { return GetText(tick.Idx); }
void Reset() {
Ticks.shrink(0);
TextBuffer.Buf.shrink(0);
}
int TickCount() const { return Ticks.Size; }
};
// Holds axis information
struct ImPlot3DAxis {
// Flags
ImPlot3DAxisFlags Flags;
ImPlot3DAxisFlags PreviousFlags;
// Range
ImPlot3DRange Range;
ImPlot3DCond RangeCond;
double NDCScale;
ImPlot3DScale Scale;
// Label
ImGuiTextBuffer Label;
// Ticks
ImPlot3DTicker Ticker;
ImPlot3DFormatter Formatter;
void* FormatterData;
ImPlot3DLocator Locator;
bool ShowDefaultTicks;
// Scale
ImPlot3DTransform TransformForward; // Custom axis forward transform
ImPlot3DTransform TransformInverse; // Custom axis inverse transform
void* TransformData; // Custom transform data set by the user
ImPlot3DRange ScaledRange; // Cached scaled range values
// Fit data
bool FitThisFrame;
ImPlot3DRange FitExtents;
// Constraints
ImPlot3DRange ConstraintRange;
ImPlot3DRange ConstraintZoom;
// User input
bool Hovered;
bool Held;
// Constructor
ImPlot3DAxis() {
PreviousFlags = Flags = ImPlot3DAxisFlags_None;
// Range
Range.Min = 0.0;
Range.Max = 1.0;
RangeCond = ImPlot3DCond_None;
// Scale
NDCScale = 1.0;
Scale = ImPlot3DScale_Linear;
TransformForward = TransformInverse = nullptr;
TransformData = nullptr;
// Ticks
Formatter = nullptr;
FormatterData = nullptr;
Locator = nullptr;
ShowDefaultTicks = true;
// Fit data
FitThisFrame = true;
FitExtents = ImPlot3DRange(HUGE_VAL, -HUGE_VAL);
// Constraints
ConstraintRange = ImPlot3DRange(-INFINITY, INFINITY);
ConstraintZoom = ImPlot3DRange(DBL_MIN, INFINITY);
// User input
Hovered = false;
Held = false;
}
inline void Reset() {
RangeCond = ImPlot3DCond_None;
// Scale
Scale = ImPlot3DScale_Linear;
TransformForward = TransformInverse = nullptr;
TransformData = nullptr;
// Ticks
Ticker.Reset();
Formatter = nullptr;
FormatterData = nullptr;
Locator = nullptr;
ShowDefaultTicks = true;
// Fit data
FitExtents = ImPlot3DRange(HUGE_VAL, -HUGE_VAL);
// Constraints
ConstraintRange = ImPlot3DRange(-INFINITY, INFINITY);
ConstraintZoom = ImPlot3DRange(DBL_MIN, INFINITY);
}
inline void SetRange(double v1, double v2) {
v1 = ImPlot3D::ImConstrainNan(ImPlot3D::ImConstrainInf(v1));
v2 = ImPlot3D::ImConstrainNan(ImPlot3D::ImConstrainInf(v2));
Range.Min = ImMin(v1, v2);
Range.Max = ImMax(v1, v2);
Constrain();
UpdateTransformCache();
}
inline bool SetMin(double _min, bool force = false) {
if (!force && IsLockedMin())
return false;
_min = ImPlot3D::ImConstrainNan(ImPlot3D::ImConstrainInf(_min));
// Constraints
if (_min < ConstraintRange.Min)
_min = ConstraintRange.Min;
double zoom = Range.Max - _min;
if (zoom < ConstraintZoom.Min)
_min = Range.Max - ConstraintZoom.Min;
if (zoom > ConstraintZoom.Max)
_min = Range.Max - ConstraintZoom.Max;
// Ensure min is less than max
if (_min >= Range.Max)
return false;
Range.Min = _min;
UpdateTransformCache();
return true;
}
inline bool SetMax(double _max, bool force = false) {
if (!force && IsLockedMax())
return false;
_max = ImPlot3D::ImConstrainNan(ImPlot3D::ImConstrainInf(_max));
// Constraints
if (_max > ConstraintRange.Max)
_max = ConstraintRange.Max;
double zoom = _max - Range.Min;
if (zoom < ConstraintZoom.Min)
_max = Range.Min + ConstraintZoom.Min;
if (zoom > ConstraintZoom.Max)
_max = Range.Min + ConstraintZoom.Max;
// Ensure max is greater than min
if (_max <= Range.Min)
return false;
Range.Max = _max;
UpdateTransformCache();
return true;
}
inline void Constrain() {
Range.Min = ImPlot3D::ImConstrainNan(ImPlot3D::ImConstrainInf(Range.Min));
Range.Max = ImPlot3D::ImConstrainNan(ImPlot3D::ImConstrainInf(Range.Max));
if (Range.Min < ConstraintRange.Min)
Range.Min = ConstraintRange.Min;
if (Range.Max > ConstraintRange.Max)
Range.Max = ConstraintRange.Max;
double zoom = Range.Size();
if (zoom < ConstraintZoom.Min) {
double delta = (ConstraintZoom.Min - zoom) * 0.5;
Range.Min -= delta;
Range.Max += delta;
}
if (zoom > ConstraintZoom.Max) {
double delta = (zoom - ConstraintZoom.Max) * 0.5;
Range.Min += delta;
Range.Max -= delta;
}
if (Range.Max <= Range.Min)
Range.Max = Range.Min + DBL_EPSILON;
}
inline void UpdateTransformCache() {
if (TransformForward != nullptr) {
ScaledRange.Min = TransformForward(Range.Min, TransformData);
ScaledRange.Max = TransformForward(Range.Max, TransformData);
} else {
ScaledRange.Min = Range.Min;
ScaledRange.Max = Range.Max;
}
}
inline double PlotToNDC(double plt) const {
if (TransformForward != nullptr) {
double s = TransformForward(plt, TransformData);
return (s - ScaledRange.Min) / (ScaledRange.Max - ScaledRange.Min);
}
return (plt - Range.Min) / (Range.Max - Range.Min);
}
inline double NDCToPlot(double t) const {
if (TransformInverse != nullptr) {
double s = t * (ScaledRange.Max - ScaledRange.Min) + ScaledRange.Min;
return TransformInverse(s, TransformData);
}
return Range.Min + t * (Range.Max - Range.Min);
}
inline bool IsRangeLocked() const { return RangeCond == ImPlot3DCond_Always; }
inline bool IsLockedMin() const { return IsRangeLocked() || ImPlot3D::ImHasFlag(Flags, ImPlot3DAxisFlags_LockMin); }
inline bool IsLockedMax() const { return IsRangeLocked() || ImPlot3D::ImHasFlag(Flags, ImPlot3DAxisFlags_LockMax); }
inline bool IsLocked() const { return IsLockedMin() && IsLockedMax(); }
inline bool IsInputLockedMin() const { return IsLockedMin() || IsAutoFitting(); }
inline bool IsInputLockedMax() const { return IsLockedMax() || IsAutoFitting(); }
inline bool IsInputLocked() const { return IsLocked() || IsAutoFitting(); }
inline bool IsPanLocked(bool increasing) {
if (ImPlot3D::ImHasFlag(Flags, ImPlot3DAxisFlags_PanStretch)) {
return IsInputLocked();
} else {
if (IsLockedMin() || IsLockedMax() || IsAutoFitting())
return false;
if (increasing)
return Range.Max == ConstraintRange.Max;
else
return Range.Min == ConstraintRange.Min;
}
}
inline void SetLabel(const char* label) {
Label.Buf.shrink(0);
if (label && ImGui::FindRenderedTextEnd(label, nullptr) != label)
Label.append(label, label + strlen(label) + 1);
}
inline const char* GetLabel() const { return Label.Buf.Data; }
inline double NDCSize() const {
// By default, the axis span from NDC -0.5 to 0.5, so size is 1.0
// If NDCScale is applied, the size is scaled accordingly
return NDCScale;
}
inline void SetAspect(double units_per_ndc_unit) {
double new_size = units_per_ndc_unit * NDCSize();
double delta = (new_size - Range.Size()) * 0.5;
if (IsLocked())
return;
else if (IsLockedMin() && !IsLockedMax())
SetRange(Range.Min, Range.Max + 2 * delta);
else if (!IsLockedMin() && IsLockedMax())
SetRange(Range.Min - 2 * delta, Range.Max);
else
SetRange(Range.Min - delta, Range.Max + delta);
}
double GetAspect() const { return Range.Size() / NDCSize(); }
bool HasLabel() const;
bool HasGridLines() const;
bool HasTickLabels() const;
bool HasTickMarks() const;
bool IsAutoFitting() const;
void ExtendFit(double value);
void ApplyFit();
};
// Holds plot state information that must persist after EndPlot
struct ImPlot3DPlot {
ImGuiID ID;
ImPlot3DFlags Flags;
ImPlot3DFlags PreviousFlags;
ImGuiTextBuffer Title;
bool JustCreated;
bool Initialized;
// Bounding rectangles
ImRect FrameRect; // Outermost bounding rectangle that encapsulates whole the plot/title/padding/etc
ImRect CanvasRect; // Frame rectangle reduced by padding
ImRect PlotRect; // Bounding rectangle for the actual plot area
// Rotation & axes & box
ImPlot3DQuat InitialRotation; // Initial rotation quaternion
ImPlot3DQuat Rotation; // Current rotation quaternion
ImPlot3DCond RotationCond;
ImPlot3DAxis Axes[3]; // X, Y, Z axes
// Animation
float AnimationTime; // Remaining animation time
ImPlot3DQuat RotationAnimationEnd; // End rotation for animation
// User input
bool SetupLocked;
bool Hovered;
bool Held;
int HeldEdgeIdx; // Index of the edge being held
int HeldPlaneIdx; // Index of the plane being held
ImPlot3DPoint DragRotationAxis; // Axis of rotation for the duration of a drag
// Fit data
bool FitThisFrame;
// Items
ImPlot3DItemGroup Items;
// 3D draw list
ImDrawList3D DrawList;
// Misc
bool ContextClick; // True if context button was clicked (to distinguish from double click)
bool OpenContextThisFrame;
ImPlot3DPlot() {
PreviousFlags = Flags = ImPlot3DFlags_None;
JustCreated = true;
Initialized = false;
InitialRotation = ImPlot3DQuat(-0.513269, -0.212596, -0.318184, 0.76819);
Rotation = ImPlot3DQuat(0.0, 0.0, 0.0, 1.0);
RotationCond = ImPlot3DCond_None;
for (int i = 0; i < 3; i++)
Axes[i] = ImPlot3DAxis();
AnimationTime = 0.0f;
RotationAnimationEnd = Rotation;
SetupLocked = false;
Hovered = Held = false;
HeldEdgeIdx = -1;
HeldPlaneIdx = -1;
DragRotationAxis = ImPlot3DPoint(0.0, 0.0, 0.0);
FitThisFrame = true;
ContextClick = false;
OpenContextThisFrame = false;
}
inline void SetTitle(const char* title) {
Title.Buf.shrink(0);
if (title && ImGui::FindRenderedTextEnd(title, nullptr) != title)
Title.append(title, title + strlen(title) + 1);
}
inline bool HasTitle() const { return !Title.empty() && !ImPlot3D::ImHasFlag(Flags, ImPlot3DFlags_NoTitle); }
inline const char* GetTitle() const { return Title.Buf.Data; }
inline bool IsRotationLocked() const { return RotationCond == ImPlot3DCond_Always; }
// Extends the fit range of all three axes to include the provided point
void ExtendFit(const ImPlot3DPoint& point);
// Returns the minimum of the range in all three dimensions
ImPlot3DPoint RangeMin() const;
// Returns the maximum of the range in all three dimensions
ImPlot3DPoint RangeMax() const;
// Returns the point at the center of the range in all three dimensions
ImPlot3DPoint RangeCenter() const;
// Sets the range of all three axes
void SetRange(const ImPlot3DPoint& min, const ImPlot3DPoint& max);
// Returns the scale of the plot view (constant to convert from NDC coordinates to pixels coordinates)
float GetViewScale() const;
// Returns the scale of the plot box in each dimension
ImPlot3DPoint GetBoxScale() const;
// Applies equal aspect ratio constraint using the specified axis as reference.
// Other axes are adjusted to match the reference axis's aspect ratio (units per NDC unit).
void ApplyEqualAspect(ImAxis3D ref_axis);
};
struct ImPlot3DContext {
ImPool<ImPlot3DPlot> Plots;
ImPlot3DPlot* CurrentPlot;
ImPlot3DItemGroup* CurrentItems;
ImPlot3DItem* CurrentItem;
ImPlot3DNextItemData NextItemData;
ImPlot3DStyle Style;
ImVector<ImGuiColorMod> ColorModifiers;
ImVector<ImGuiStyleMod> StyleModifiers;
ImVector<ImPlot3DColormap> ColormapModifiers;
ImPlot3DColormapData ColormapData;
};
//-----------------------------------------------------------------------------
// [SECTION] Context Pointer
//-----------------------------------------------------------------------------
namespace ImPlot3D {
#ifndef GImPlot3D
extern IMPLOT3D_API ImPlot3DContext* GImPlot3D; // Current context pointer
#endif
//-----------------------------------------------------------------------------
// [SECTION] Context Utils
//-----------------------------------------------------------------------------
IMPLOT3D_API void InitializeContext(ImPlot3DContext* ctx); // Initialize ImPlot3DContext
IMPLOT3D_API void ResetContext(ImPlot3DContext* ctx); // Reset ImPlot3DContext
//-----------------------------------------------------------------------------
// [SECTION] Style Utils
//-----------------------------------------------------------------------------
IMPLOT3D_API bool IsColorAuto(const ImVec4& col);
IMPLOT3D_API bool IsColorAuto(ImPlot3DCol idx);
IMPLOT3D_API ImVec4 GetAutoColor(ImPlot3DCol idx);
IMPLOT3D_API const char* GetStyleColorName(ImPlot3DCol idx);
// Returns white or black text given background color
static inline ImU32 CalcTextColor(const ImVec4& bg) {
return (bg.x * 0.299f + bg.y * 0.587f + bg.z * 0.114f) > 0.5f ? IM_COL32_BLACK : IM_COL32_WHITE;
}
static inline ImU32 CalcTextColor(ImU32 bg) { return CalcTextColor(ImGui::ColorConvertU32ToFloat4(bg)); }
// Get styling data for next item (call between BeginItem/EndItem)
IMPLOT3D_API const ImPlot3DNextItemData& GetItemData();
// Returns a color from the Color map given an index >= 0 (modulo will be performed)
IMPLOT3D_API ImU32 GetColormapColorU32(int idx, ImPlot3DColormap cmap);
// Returns the next unused colormap color and advances the colormap. Can be used to skip colors if desired
IMPLOT3D_API ImU32 NextColormapColorU32();
// Render a colormap bar
IMPLOT3D_API void RenderColorBar(const ImU32* colors, int size, ImDrawList& DrawList, const ImRect& bounds, bool vert, bool reversed,
bool continuous);
//-----------------------------------------------------------------------------
// [SECTION] Item Utils
//-----------------------------------------------------------------------------
// Begins a new item. Returns false if the item should not be plotted
IMPLOT3D_API bool BeginItem(const char* label_id, const ImPlot3DSpec& spec = ImPlot3DSpec(), const ImVec4& item_col = IMPLOT3D_AUTO_COL,
ImPlot3DMarker item_mkr = ImPlot3DMarker_Invalid);
IMPLOT3D_API void EndItem();
// Register or get an existing item from the current plot
IMPLOT3D_API ImPlot3DItem* RegisterOrGetItem(const char* label_id, ImPlot3DItemFlags flags, bool* just_created = nullptr);
// Gets the current item from ImPlot3DContext
IMPLOT3D_API ImPlot3DItem* GetCurrentItem();
// Busts the cache for every item for every plot in the current context
IMPLOT3D_API void BustItemCache();
// TODO move to another place
IMPLOT3D_API void AddTextRotated(ImDrawList* draw_list, ImVec2 pos, float angle, ImU32 col, const char* text_begin, const char* text_end = nullptr);
//-----------------------------------------------------------------------------
// [SECTION] Plot Utils
//-----------------------------------------------------------------------------
// Gets the current plot from ImPlot3DContext
IMPLOT3D_API ImPlot3DPlot* GetCurrentPlot();
// Busts the cache for every plot in the current context
IMPLOT3D_API void BustPlotCache();
IMPLOT3D_API ImVec2 GetFramePos(); // Get the current frame position (top-left) in pixels
IMPLOT3D_API ImVec2 GetFrameSize(); // Get the current frame size in pixels
// Convert a position in the current plot's coordinate system to the current plot's normalized device coordinate system (NDC)
// When the cube's aspect ratio is [1,1,1], the NDC ranges from [-0.5, 0.5] along each axis
IMPLOT3D_API ImPlot3DPoint PlotToNDC(const ImPlot3DPoint& point);
IMPLOT3D_API ImPlot3DPoint NDCToPlot(const ImPlot3DPoint& point);
// Convert a position in the current plot's NDC to pixels
IMPLOT3D_API ImVec2 NDCToPixels(const ImPlot3DPoint& point);
// Convert a pixel coordinate to a ray in the NDC
IMPLOT3D_API ImPlot3DRay PixelsToNDCRay(const ImVec2& pix);
// Convert a ray in the NDC to a ray in the current plot's coordinate system
IMPLOT3D_API ImPlot3DRay NDCRayToPlotRay(const ImPlot3DRay& ray);
//-----------------------------------------------------------------------------
// [SECTION] Setup Utils
//-----------------------------------------------------------------------------
IMPLOT3D_API void SetupLock();
//-----------------------------------------------------------------------------
// [SECTION] Transforms
//-----------------------------------------------------------------------------
static inline double TransformForward_Log10(double v, void*) { return ImLog10(v <= 0.0 ? DBL_MIN : v); }
static inline double TransformInverse_Log10(double v, void*) { return ImPow(10, v); }
static inline double TransformForward_SymLog(double v, void*) { return 2.0 * ImAsinh(v / 2.0); }
static inline double TransformInverse_SymLog(double v, void*) { return 2.0 * ImSinh(v / 2.0); }
//-----------------------------------------------------------------------------
// [SECTION] Formatter
//-----------------------------------------------------------------------------
int Formatter_Default(double value, char* buff, int size, void* data);
//------------------------------------------------------------------------------
// [SECTION] Locator
//------------------------------------------------------------------------------
void Locator_Default(ImPlot3DTicker& ticker, const ImPlot3DRange& range, float pixels, ImPlot3DFormatter formatter, void* formatter_data);
void Locator_Log10(ImPlot3DTicker& ticker, const ImPlot3DRange& range, float pixels, ImPlot3DFormatter formatter, void* formatter_data);
void Locator_SymLog(ImPlot3DTicker& ticker, const ImPlot3DRange& range, float pixels, ImPlot3DFormatter formatter, void* formatter_data);
} // namespace ImPlot3D
#endif // #ifndef IMGUI_DISABLE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,305 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024-2026 Breno Cunha Queiroz
// ImPlot3D v0.4 WIP
// Acknowledgments:
// ImPlot3D is heavily inspired by ImPlot
// (https://github.com/epezent/implot) by Evan Pezent,
// and follows a similar code style and structure to
// maintain consistency with ImPlot's API.
// Table of Contents:
// [SECTION] Includes
// [SECTION] Cube
// [SECTION] Sphere
// [SECTION] Duck
//-----------------------------------------------------------------------------
// [SECTION] Includes
//-----------------------------------------------------------------------------
#include "implot3d.hpp"
//-----------------------------------------------------------------------------
// [SECTION] Cube
//-----------------------------------------------------------------------------
namespace ImPlot3D {
// clang-format off
ImPlot3DPoint cube_vtx[CUBE_VTX_COUNT] = {
{-1.0f, -1.0f, -1.0f}, // 0: Bottom-back-left
{ 1.0f, -1.0f, -1.0f}, // 1: Bottom-back-right
{ 1.0f, 1.0f, -1.0f}, // 2: Top-back-right
{-1.0f, 1.0f, -1.0f}, // 3: Top-back-left
{-1.0f, -1.0f, 1.0f}, // 4: Bottom-front-left
{ 1.0f, -1.0f, 1.0f}, // 5: Bottom-front-right
{ 1.0f, 1.0f, 1.0f}, // 6: Top-front-right
{-1.0f, 1.0f, 1.0f}, // 7: Top-front-left
};
unsigned int cube_idx[CUBE_IDX_COUNT] = {
// Back face
0, 1, 2,
0, 2, 3,
// Front face
4, 5, 6,
4, 6, 7,
// Left face
0, 3, 7,
0, 7, 4,
// Right face
1, 5, 6,
1, 6, 2,
// Top face
3, 2, 6,
3, 6, 7,
// Bottom face
0, 1, 5,
0, 5, 4,
};
// clang-format on
//-----------------------------------------------------------------------------
// [SECTION] Sphere
//-----------------------------------------------------------------------------
ImPlot3DPoint sphere_vtx[SPHERE_VTX_COUNT] = {
{-0.525731f, 0.850651f, 0.000000f}, {0.525731f, 0.850651f, 0.000000f}, {-0.525731f, -0.850651f, 0.000000f},
{0.525731f, -0.850651f, 0.000000f}, {0.000000f, -0.525731f, 0.850651f}, {0.000000f, 0.525731f, 0.850651f},
{0.000000f, -0.525731f, -0.850651f}, {0.000000f, 0.525731f, -0.850651f}, {0.850651f, 0.000000f, -0.525731f},
{0.850651f, 0.000000f, 0.525731f}, {-0.850651f, 0.000000f, -0.525731f}, {-0.850651f, 0.000000f, 0.525731f},
{-0.809017f, 0.500000f, 0.309017f}, {-0.500000f, 0.309017f, 0.809017f}, {-0.309017f, 0.809017f, 0.500000f},
{0.309017f, 0.809017f, 0.500000f}, {0.000000f, 1.000000f, 0.000000f}, {0.309017f, 0.809017f, -0.500000f},
{-0.309017f, 0.809017f, -0.500000f}, {-0.500000f, 0.309017f, -0.809017f}, {-0.809017f, 0.500000f, -0.309017f},
{-1.000000f, 0.000000f, 0.000000f}, {0.500000f, 0.309017f, 0.809017f}, {0.809017f, 0.500000f, 0.309017f},
{-0.500000f, -0.309017f, 0.809017f}, {0.000000f, 0.000000f, 1.000000f}, {-0.809017f, -0.500000f, -0.309017f},
{-0.809017f, -0.500000f, 0.309017f}, {0.000000f, 0.000000f, -1.000000f}, {-0.500000f, -0.309017f, -0.809017f},
{0.809017f, 0.500000f, -0.309017f}, {0.500000f, 0.309017f, -0.809017f}, {0.809017f, -0.500000f, 0.309017f},
{0.500000f, -0.309017f, 0.809017f}, {0.309017f, -0.809017f, 0.500000f}, {-0.309017f, -0.809017f, 0.500000f},
{0.000000f, -1.000000f, 0.000000f}, {-0.309017f, -0.809017f, -0.500000f}, {0.309017f, -0.809017f, -0.500000f},
{0.500000f, -0.309017f, -0.809017f}, {0.809017f, -0.500000f, -0.309017f}, {1.000000f, 0.000000f, 0.000000f},
{-0.693780f, 0.702046f, 0.160622f}, {-0.587785f, 0.688191f, 0.425325f}, {-0.433889f, 0.862668f, 0.259892f},
{-0.862668f, 0.259892f, 0.433889f}, {-0.702046f, 0.160622f, 0.693780f}, {-0.688191f, 0.425325f, 0.587785f},
{-0.425325f, 0.587785f, 0.688191f}, {-0.259892f, 0.433889f, 0.862668f}, {-0.160622f, 0.693780f, 0.702046f},
{-0.162460f, 0.951057f, 0.262866f}, {-0.273267f, 0.961938f, 0.000000f}, {0.160622f, 0.693780f, 0.702046f},
{0.000000f, 0.850651f, 0.525731f}, {0.162460f, 0.951057f, 0.262866f}, {0.433889f, 0.862668f, 0.259892f},
{0.273267f, 0.961938f, 0.000000f}, {-0.162460f, 0.951057f, -0.262866f}, {-0.433889f, 0.862668f, -0.259892f},
{0.433889f, 0.862668f, -0.259892f}, {0.162460f, 0.951057f, -0.262866f}, {0.000000f, 0.850651f, -0.525731f},
{0.160622f, 0.693780f, -0.702046f}, {-0.160622f, 0.693780f, -0.702046f}, {-0.587785f, 0.688191f, -0.425325f},
{-0.693780f, 0.702046f, -0.160622f}, {-0.259892f, 0.433889f, -0.862668f}, {-0.425325f, 0.587785f, -0.688191f},
{-0.688191f, 0.425325f, -0.587785f}, {-0.702046f, 0.160622f, -0.693780f}, {-0.862668f, 0.259892f, -0.433889f},
{-0.850651f, 0.525731f, 0.000000f}, {-0.961938f, 0.000000f, -0.273267f}, {-0.951057f, 0.262866f, -0.162460f},
{-0.951057f, 0.262866f, 0.162460f}, {-0.961938f, 0.000000f, 0.273267f}, {0.587785f, 0.688191f, 0.425325f},
{0.693780f, 0.702046f, 0.160622f}, {0.259892f, 0.433889f, 0.862668f}, {0.425325f, 0.587785f, 0.688191f},
{0.688191f, 0.425325f, 0.587785f}, {0.702046f, 0.160622f, 0.693780f}, {0.862668f, 0.259892f, 0.433889f},
{-0.262866f, 0.162460f, 0.951057f}, {0.000000f, 0.273267f, 0.961938f}, {-0.702046f, -0.160622f, 0.693780f},
{-0.525731f, 0.000000f, 0.850651f}, {-0.262866f, -0.162460f, 0.951057f}, {-0.259892f, -0.433889f, 0.862668f},
{0.000000f, -0.273267f, 0.961938f}, {-0.951057f, -0.262866f, 0.162460f}, {-0.862668f, -0.259892f, 0.433889f},
{-0.862668f, -0.259892f, -0.433889f}, {-0.951057f, -0.262866f, -0.162460f}, {-0.850651f, -0.525731f, 0.000000f},
{-0.693780f, -0.702046f, -0.160622f}, {-0.693780f, -0.702046f, 0.160622f}, {-0.525731f, 0.000000f, -0.850651f},
{-0.702046f, -0.160622f, -0.693780f}, {0.000000f, 0.273267f, -0.961938f}, {-0.262866f, 0.162460f, -0.951057f},
{-0.262866f, -0.162460f, -0.951057f}, {0.000000f, -0.273267f, -0.961938f}, {-0.259892f, -0.433889f, -0.862668f},
{0.425325f, 0.587785f, -0.688191f}, {0.259892f, 0.433889f, -0.862668f}, {0.693780f, 0.702046f, -0.160622f},
{0.587785f, 0.688191f, -0.425325f}, {0.688191f, 0.425325f, -0.587785f}, {0.862668f, 0.259892f, -0.433889f},
{0.702046f, 0.160622f, -0.693780f}, {0.693780f, -0.702046f, 0.160622f}, {0.587785f, -0.688191f, 0.425325f},
{0.433889f, -0.862668f, 0.259892f}, {0.862668f, -0.259892f, 0.433889f}, {0.702046f, -0.160622f, 0.693780f},
{0.688191f, -0.425325f, 0.587785f}, {0.425325f, -0.587785f, 0.688191f}, {0.259892f, -0.433889f, 0.862668f},
{0.160622f, -0.693780f, 0.702046f}, {0.162460f, -0.951057f, 0.262866f}, {0.273267f, -0.961938f, 0.000000f},
{-0.160622f, -0.693780f, 0.702046f}, {0.000000f, -0.850651f, 0.525731f}, {-0.162460f, -0.951057f, 0.262866f},
{-0.433889f, -0.862668f, 0.259892f}, {-0.273267f, -0.961938f, 0.000000f}, {0.162460f, -0.951057f, -0.262866f},
{0.433889f, -0.862668f, -0.259892f}, {-0.433889f, -0.862668f, -0.259892f}, {-0.162460f, -0.951057f, -0.262866f},
{0.000000f, -0.850651f, -0.525731f}, {-0.160622f, -0.693780f, -0.702046f}, {0.160622f, -0.693780f, -0.702046f},
{0.587785f, -0.688191f, -0.425325f}, {0.693780f, -0.702046f, -0.160622f}, {0.259892f, -0.433889f, -0.862668f},
{0.425325f, -0.587785f, -0.688191f}, {0.688191f, -0.425325f, -0.587785f}, {0.702046f, -0.160622f, -0.693780f},
{0.862668f, -0.259892f, -0.433889f}, {0.850651f, -0.525731f, 0.000000f}, {0.961938f, 0.000000f, -0.273267f},
{0.951057f, -0.262866f, -0.162460f}, {0.951057f, -0.262866f, 0.162460f}, {0.961938f, 0.000000f, 0.273267f},
{0.262866f, -0.162460f, 0.951057f}, {0.525731f, 0.000000f, 0.850651f}, {0.262866f, 0.162460f, 0.951057f},
{-0.587785f, -0.688191f, 0.425325f}, {-0.425325f, -0.587785f, 0.688191f}, {-0.688191f, -0.425325f, 0.587785f},
{-0.425325f, -0.587785f, -0.688191f}, {-0.587785f, -0.688191f, -0.425325f}, {-0.688191f, -0.425325f, -0.587785f},
{0.525731f, 0.000000f, -0.850651f}, {0.262866f, -0.162460f, -0.951057f}, {0.262866f, 0.162460f, -0.951057f},
{0.951057f, 0.262866f, 0.162460f}, {0.951057f, 0.262866f, -0.162460f}, {0.850651f, 0.525731f, 0.000000f},
};
unsigned int sphere_idx[SPHERE_IDX_COUNT] = {
0, 42, 44, 42, 12, 43, 44, 43, 14, 42, 43, 44, 12, 45, 47, 45, 11, 46, 47, 46, 13, 45, 46, 47, 14, 48, 50, 48, 13,
49, 50, 49, 5, 48, 49, 50, 12, 47, 43, 47, 13, 48, 43, 48, 14, 47, 48, 43, 0, 44, 52, 44, 14, 51, 52, 51, 16, 44,
51, 52, 14, 50, 54, 50, 5, 53, 54, 53, 15, 50, 53, 54, 16, 55, 57, 55, 15, 56, 57, 56, 1, 55, 56, 57, 14, 54, 51,
54, 15, 55, 51, 55, 16, 54, 55, 51, 0, 52, 59, 52, 16, 58, 59, 58, 18, 52, 58, 59, 16, 57, 61, 57, 1, 60, 61, 60,
17, 57, 60, 61, 18, 62, 64, 62, 17, 63, 64, 63, 7, 62, 63, 64, 16, 61, 58, 61, 17, 62, 58, 62, 18, 61, 62, 58, 0,
59, 66, 59, 18, 65, 66, 65, 20, 59, 65, 66, 18, 64, 68, 64, 7, 67, 68, 67, 19, 64, 67, 68, 20, 69, 71, 69, 19, 70,
71, 70, 10, 69, 70, 71, 18, 68, 65, 68, 19, 69, 65, 69, 20, 68, 69, 65, 0, 66, 42, 66, 20, 72, 42, 72, 12, 66, 72,
42, 20, 71, 74, 71, 10, 73, 74, 73, 21, 71, 73, 74, 12, 75, 45, 75, 21, 76, 45, 76, 11, 75, 76, 45, 20, 74, 72, 74,
21, 75, 72, 75, 12, 74, 75, 72, 1, 56, 78, 56, 15, 77, 78, 77, 23, 56, 77, 78, 15, 53, 80, 53, 5, 79, 80, 79, 22,
53, 79, 80, 23, 81, 83, 81, 22, 82, 83, 82, 9, 81, 82, 83, 15, 80, 77, 80, 22, 81, 77, 81, 23, 80, 81, 77, 5, 49,
85, 49, 13, 84, 85, 84, 25, 49, 84, 85, 13, 46, 87, 46, 11, 86, 87, 86, 24, 46, 86, 87, 25, 88, 90, 88, 24, 89, 90,
89, 4, 88, 89, 90, 13, 87, 84, 87, 24, 88, 84, 88, 25, 87, 88, 84, 11, 76, 92, 76, 21, 91, 92, 91, 27, 76, 91, 92,
21, 73, 94, 73, 10, 93, 94, 93, 26, 73, 93, 94, 27, 95, 97, 95, 26, 96, 97, 96, 2, 95, 96, 97, 21, 94, 91, 94, 26,
95, 91, 95, 27, 94, 95, 91, 10, 70, 99, 70, 19, 98, 99, 98, 29, 70, 98, 99, 19, 67, 101, 67, 7, 100, 101, 100, 28, 67,
100, 101, 29, 102, 104, 102, 28, 103, 104, 103, 6, 102, 103, 104, 19, 101, 98, 101, 28, 102, 98, 102, 29, 101, 102, 98, 7, 63, 106,
63, 17, 105, 106, 105, 31, 63, 105, 106, 17, 60, 108, 60, 1, 107, 108, 107, 30, 60, 107, 108, 31, 109, 111, 109, 30, 110, 111, 110,
8, 109, 110, 111, 17, 108, 105, 108, 30, 109, 105, 109, 31, 108, 109, 105, 3, 112, 114, 112, 32, 113, 114, 113, 34, 112, 113, 114, 32,
115, 117, 115, 9, 116, 117, 116, 33, 115, 116, 117, 34, 118, 120, 118, 33, 119, 120, 119, 4, 118, 119, 120, 32, 117, 113, 117, 33, 118,
113, 118, 34, 117, 118, 113, 3, 114, 122, 114, 34, 121, 122, 121, 36, 114, 121, 122, 34, 120, 124, 120, 4, 123, 124, 123, 35, 120, 123,
124, 36, 125, 127, 125, 35, 126, 127, 126, 2, 125, 126, 127, 34, 124, 121, 124, 35, 125, 121, 125, 36, 124, 125, 121, 3, 122, 129, 122,
36, 128, 129, 128, 38, 122, 128, 129, 36, 127, 131, 127, 2, 130, 131, 130, 37, 127, 130, 131, 38, 132, 134, 132, 37, 133, 134, 133, 6,
132, 133, 134, 36, 131, 128, 131, 37, 132, 128, 132, 38, 131, 132, 128, 3, 129, 136, 129, 38, 135, 136, 135, 40, 129, 135, 136, 38, 134,
138, 134, 6, 137, 138, 137, 39, 134, 137, 138, 40, 139, 141, 139, 39, 140, 141, 140, 8, 139, 140, 141, 38, 138, 135, 138, 39, 139, 135,
139, 40, 138, 139, 135, 3, 136, 112, 136, 40, 142, 112, 142, 32, 136, 142, 112, 40, 141, 144, 141, 8, 143, 144, 143, 41, 141, 143, 144,
32, 145, 115, 145, 41, 146, 115, 146, 9, 145, 146, 115, 40, 144, 142, 144, 41, 145, 142, 145, 32, 144, 145, 142, 4, 119, 90, 119, 33,
147, 90, 147, 25, 119, 147, 90, 33, 116, 148, 116, 9, 82, 148, 82, 22, 116, 82, 148, 25, 149, 85, 149, 22, 79, 85, 79, 5, 149,
79, 85, 33, 148, 147, 148, 22, 149, 147, 149, 25, 148, 149, 147, 2, 126, 97, 126, 35, 150, 97, 150, 27, 126, 150, 97, 35, 123, 151,
123, 4, 89, 151, 89, 24, 123, 89, 151, 27, 152, 92, 152, 24, 86, 92, 86, 11, 152, 86, 92, 35, 151, 150, 151, 24, 152, 150, 152,
27, 151, 152, 150, 6, 133, 104, 133, 37, 153, 104, 153, 29, 133, 153, 104, 37, 130, 154, 130, 2, 96, 154, 96, 26, 130, 96, 154, 29,
155, 99, 155, 26, 93, 99, 93, 10, 155, 93, 99, 37, 154, 153, 154, 26, 155, 153, 155, 29, 154, 155, 153, 8, 140, 111, 140, 39, 156,
111, 156, 31, 140, 156, 111, 39, 137, 157, 137, 6, 103, 157, 103, 28, 137, 103, 157, 31, 158, 106, 158, 28, 100, 106, 100, 7, 158, 100,
106, 39, 157, 156, 157, 28, 158, 156, 158, 31, 157, 158, 156, 9, 146, 83, 146, 41, 159, 83, 159, 23, 146, 159, 83, 41, 143, 160, 143,
8, 110, 160, 110, 30, 143, 110, 160, 23, 161, 78, 161, 30, 107, 78, 107, 1, 161, 107, 78, 41, 160, 159, 160, 30, 161, 159, 161, 23,
160, 161, 159};
//-----------------------------------------------------------------------------
// [SECTION] Duck
//-----------------------------------------------------------------------------
// Rubber Duck by Poly by Google [CC-BY] via Poly Pizza
ImPlot3DPoint duck_vtx[DUCK_VTX_COUNT] = {
{0.263370f, 0.782383f, -0.488235f}, {0.358677f, -0.624396f, -0.546179f}, {0.292714f, 0.782558f, -0.125229f},
{0.349165f, -0.579430f, -0.151545f}, {0.000000f, 0.985995f, 0.055503f}, {0.000000f, -0.771795f, -0.060755f},
{0.000000f, 0.884807f, -0.562217f}, {0.000000f, -0.793724f, -0.609042f}, {0.000000f, -0.299071f, -0.806689f},
{0.416629f, -0.234865f, -0.718575f}, {0.386268f, -0.264259f, -0.087117f}, {0.000000f, -0.154521f, 0.030419f},
{0.170659f, -0.255441f, 0.007066f}, {0.180454f, -0.704124f, -0.061920f}, {0.155948f, 0.918253f, -0.001556f},
{0.155050f, -0.228032f, 0.751753f}, {0.151757f, -0.513087f, 0.744284f}, {0.000000f, -0.182899f, 0.779477f},
{0.000000f, -0.578330f, 0.764610f}, {0.000000f, 0.685169f, -0.739686f}, {0.371476f, 0.629238f, -0.627667f},
{0.331315f, 0.641641f, -0.175468f}, {0.206943f, 0.597766f, -0.089039f}, {0.000000f, 0.614709f, -0.054922f},
{0.000000f, -0.737692f, 0.299441f}, {0.283809f, -0.102660f, 0.299441f}, {0.000000f, 0.014558f, 0.299441f},
{0.000000f, -0.736425f, 0.474106f}, {0.278490f, -0.087547f, 0.474106f}, {0.000000f, 0.025780f, 0.474106f},
{0.164839f, 0.864781f, -0.528560f}, {0.230536f, 0.696343f, -0.704629f}, {0.220279f, -0.294500f, -0.788924f},
{0.216836f, -0.741049f, -0.579700f}, {0.238591f, -0.660227f, 0.299441f}, {0.244763f, -0.660211f, 0.474106f},
{0.000000f, -0.363444f, 0.812572f}, {0.163341f, -0.354552f, 0.773703f}, {0.374463f, -0.372350f, 0.474106f},
{0.379897f, -0.380938f, 0.299441f}, {0.289253f, -0.469584f, -0.048850f}, {0.399568f, -0.463659f, -0.141744f},
{0.416824f, -0.506064f, -0.619739f}, {0.226948f, -0.580280f, -0.719311f}, {0.000000f, -0.596101f, -0.755098f},
{0.199617f, 0.050031f, -0.023613f}, {0.000000f, 0.056331f, -0.812572f}, {0.221169f, 0.056088f, -0.800430f},
{0.414907f, 0.057214f, -0.741319f}, {0.383278f, 0.079881f, -0.106452f}, {0.000000f, 0.066068f, 0.011448f},
{0.485071f, -0.225034f, -0.615697f}, {0.474322f, -0.235931f, -0.130497f}, {0.451926f, -0.378909f, -0.182230f},
{0.464485f, -0.423127f, -0.533935f}, {0.376105f, 0.621725f, -0.201967f}, {0.458732f, 0.078611f, -0.144688f},
{0.414064f, 0.587520f, -0.543056f}, {0.482586f, 0.065612f, -0.653211f}, {0.000000f, -0.672915f, 0.096026f},
{0.146952f, -0.607627f, 0.096026f}, {0.261607f, -0.401487f, 0.096026f}, {0.193018f, -0.190607f, 0.096026f},
{0.000000f, -0.095407f, 0.096026f}, {0.000000f, -0.044418f, 0.665235f}, {0.241792f, -0.132120f, 0.640095f},
{0.312765f, -0.375473f, 0.640095f}, {0.214627f, -0.620202f, 0.640095f}, {0.000000f, -0.694664f, 0.658020f},
{0.000000f, -0.682358f, 0.030419f}, {0.138512f, -0.610831f, 0.030419f}, {0.234026f, -0.438399f, 0.030419f},
{0.000000f, 0.914951f, 0.077360f}, {0.160964f, 0.841809f, 0.024144f}, {0.193354f, 0.741696f, -0.037907f},
{0.000000f, 0.800313f, 0.001882f}, {0.000000f, 0.405613f, -0.811128f}, {0.229117f, 0.399656f, -0.791482f},
{0.409787f, 0.383452f, -0.704163f}, {0.458770f, 0.376363f, -0.605461f}, {0.385168f, 0.580561f, -0.185704f},
{0.344420f, 0.600331f, -0.166386f}, {0.437609f, 0.339612f, -0.230592f}, {0.386172f, 0.365055f, -0.180691f},
{0.203357f, 0.342793f, -0.082669f}, {0.000000f, 0.367574f, -0.043515f}, {0.368402f, 0.509624f, -0.189577f},
{0.408311f, 0.494489f, -0.224777f}, {0.317982f, -0.276765f, -0.036125f}, {0.000000f, -0.705078f, 0.171934f},
{0.194647f, -0.634647f, 0.171934f}, {0.332827f, -0.390756f, 0.171934f}, {0.252044f, -0.153800f, 0.171934f},
{0.000000f, -0.052325f, 0.171934f}, {0.000000f, -0.845971f, -0.319676f}, {0.204859f, -0.774310f, -0.326206f},
{0.382866f, -0.635409f, -0.351147f}, {0.437191f, -0.532057f, -0.362802f}, {0.277419f, 0.820517f, -0.362410f},
{0.165994f, 0.946464f, -0.306175f}, {0.366520f, 0.694046f, -0.383403f}, {0.000000f, 1.000000f, -0.305615f},
{0.554754f, 0.081200f, -0.400087f}, {0.548457f, -0.240710f, -0.371820f}, {0.496187f, -0.443697f, -0.357878f},
{0.410754f, 0.655281f, -0.382353f}, {0.501407f, 0.340701f, -0.406753f}, {-0.263370f, 0.782383f, -0.488235f},
{-0.358677f, -0.624396f, -0.546179f}, {-0.292714f, 0.782558f, -0.125229f}, {-0.349165f, -0.579430f, -0.151545f},
{-0.416629f, -0.234865f, -0.718575f}, {-0.386268f, -0.264259f, -0.087117f}, {-0.170659f, -0.255441f, 0.007066f},
{-0.180454f, -0.704124f, -0.061920f}, {-0.155948f, 0.918253f, -0.001556f}, {-0.155050f, -0.228032f, 0.751753f},
{-0.151757f, -0.513087f, 0.744284f}, {-0.371476f, 0.629238f, -0.627667f}, {-0.331315f, 0.641641f, -0.175468f},
{-0.206943f, 0.597766f, -0.089039f}, {-0.283809f, -0.102660f, 0.299441f}, {-0.278490f, -0.087547f, 0.474106f},
{-0.164839f, 0.864781f, -0.528560f}, {-0.230536f, 0.696343f, -0.704629f}, {-0.220279f, -0.294500f, -0.788924f},
{-0.216836f, -0.741049f, -0.579700f}, {-0.238591f, -0.660227f, 0.299441f}, {-0.244763f, -0.660211f, 0.474106f},
{-0.163341f, -0.354552f, 0.773703f}, {-0.374463f, -0.372350f, 0.474106f}, {-0.379897f, -0.380938f, 0.299441f},
{-0.289253f, -0.469584f, -0.048850f}, {-0.399568f, -0.463659f, -0.141744f}, {-0.416824f, -0.506064f, -0.619739f},
{-0.226948f, -0.580280f, -0.719311f}, {-0.199617f, 0.050031f, -0.023613f}, {-0.221169f, 0.056088f, -0.800430f},
{-0.414907f, 0.057214f, -0.741319f}, {-0.383278f, 0.079881f, -0.106452f}, {-0.485071f, -0.225034f, -0.615697f},
{-0.474322f, -0.235931f, -0.130497f}, {-0.451926f, -0.378909f, -0.182230f}, {-0.464485f, -0.423127f, -0.533935f},
{-0.376105f, 0.621725f, -0.201967f}, {-0.458732f, 0.078611f, -0.144688f}, {-0.414064f, 0.587520f, -0.543056f},
{-0.482586f, 0.065612f, -0.653211f}, {-0.146952f, -0.607627f, 0.096026f}, {-0.261606f, -0.401487f, 0.096026f},
{-0.193018f, -0.190607f, 0.096026f}, {-0.241792f, -0.132120f, 0.640095f}, {-0.312765f, -0.375473f, 0.640095f},
{-0.214627f, -0.620202f, 0.640095f}, {-0.138512f, -0.610831f, 0.030419f}, {-0.234026f, -0.438399f, 0.030419f},
{-0.160964f, 0.841809f, 0.024144f}, {-0.193354f, 0.741696f, -0.037907f}, {-0.229117f, 0.399656f, -0.791482f},
{-0.409787f, 0.383452f, -0.704163f}, {-0.458770f, 0.376363f, -0.605461f}, {-0.385168f, 0.580561f, -0.185704f},
{-0.344420f, 0.600331f, -0.166386f}, {-0.437609f, 0.339612f, -0.230592f}, {-0.386172f, 0.365055f, -0.180691f},
{-0.203357f, 0.342793f, -0.082669f}, {-0.368402f, 0.509624f, -0.189577f}, {-0.408311f, 0.494489f, -0.224777f},
{-0.317982f, -0.276765f, -0.036125f}, {-0.194647f, -0.634647f, 0.171934f}, {-0.332827f, -0.390756f, 0.171934f},
{-0.252044f, -0.153800f, 0.171934f}, {-0.204859f, -0.774310f, -0.326206f}, {-0.382866f, -0.635409f, -0.351147f},
{-0.437191f, -0.532057f, -0.362802f}, {-0.277419f, 0.820517f, -0.362410f}, {-0.165994f, 0.946464f, -0.306175f},
{-0.366520f, 0.694046f, -0.383403f}, {-0.554754f, 0.081200f, -0.400087f}, {-0.548457f, -0.240710f, -0.371820f},
{-0.496187f, -0.443697f, -0.357878f}, {-0.410754f, 0.655281f, -0.382353f}, {-0.501407f, 0.340701f, -0.406753f},
{-0.147251f, -0.668523f, 0.330326f}, {-0.047291f, -0.930817f, 0.472716f}, {-0.224222f, -0.665336f, 0.415767f},
{-0.075450f, -0.918607f, 0.533818f}, {-0.075797f, -0.674119f, 0.541030f}, {-0.096675f, -0.818748f, 0.395991f},
{-0.159031f, -0.798414f, 0.462927f}, {-0.223648f, -0.656683f, 0.331961f}, {-0.072544f, -0.935279f, 0.500884f},
{0.000000f, -0.961081f, 0.579077f}, {0.000000f, -0.726138f, 0.328549f}, {0.000000f, -0.969221f, 0.509585f},
{-0.176269f, -0.669386f, 0.471817f}, {-0.051675f, -0.862571f, 0.538304f}, {0.000000f, -0.680106f, 0.554423f},
{0.000000f, -0.974061f, 0.546160f}, {-0.152228f, -0.819158f, 0.418117f}, {0.000000f, -0.867770f, 0.561794f},
{0.000000f, -0.827887f, 0.404080f}, {-0.123466f, -0.788030f, 0.489190f}, {0.147251f, -0.668523f, 0.330326f},
{0.047291f, -0.930817f, 0.472716f}, {0.224222f, -0.665336f, 0.415767f}, {0.075450f, -0.918607f, 0.533818f},
{0.075797f, -0.674119f, 0.541030f}, {0.096675f, -0.818748f, 0.395991f}, {0.159031f, -0.798414f, 0.462927f},
{0.223648f, -0.656683f, 0.331961f}, {0.072544f, -0.935279f, 0.500884f}, {0.176269f, -0.669386f, 0.471817f},
{0.051675f, -0.862571f, 0.538304f}, {0.152228f, -0.819158f, 0.418117f}, {0.123466f, -0.788030f, 0.489190f},
{0.000000f, -0.994773f, 0.345730f}, {0.000000f, -0.647443f, 0.199203f}, {0.000000f, -0.986165f, 0.291566f},
{0.000000f, -0.703971f, 0.341994f}, {0.000000f, -1.000000f, 0.315210f}, {0.000000f, -0.787658f, 0.226787f},
{0.000000f, -0.961085f, 0.352303f}, {-0.133409f, -0.653443f, 0.222877f}, {-0.060090f, -0.929363f, 0.267589f},
{-0.224222f, -0.658853f, 0.342353f}, {-0.094843f, -0.932646f, 0.343060f}, {-0.151330f, -0.675024f, 0.346911f},
{0.000000f, -0.932532f, 0.323403f}, {-0.120579f, -0.791706f, 0.239478f}, {-0.187682f, -0.791724f, 0.341367f},
{-0.213355f, -0.651997f, 0.277443f}, {-0.092940f, -0.939719f, 0.301090f}, {-0.176269f, -0.666860f, 0.352303f},
{-0.130777f, -0.793601f, 0.328226f}, {-0.075297f, -0.913539f, 0.352303f}, {-0.182747f, -0.797038f, 0.284545f},
{-0.150873f, -0.786911f, 0.352303f}, {-0.055104f, -0.898766f, 0.325273f}, {0.133409f, -0.653443f, 0.222877f},
{0.060090f, -0.929363f, 0.267589f}, {0.224222f, -0.658853f, 0.342353f}, {0.094843f, -0.932646f, 0.343060f},
{0.151330f, -0.675024f, 0.346911f}, {0.120579f, -0.791706f, 0.239478f}, {0.187682f, -0.791724f, 0.341367f},
{0.213355f, -0.651997f, 0.277443f}, {0.092940f, -0.939719f, 0.301090f}, {0.176269f, -0.666860f, 0.352303f},
{0.130777f, -0.793601f, 0.328226f}, {0.075297f, -0.913539f, 0.352303f}, {0.182747f, -0.797038f, 0.284545f},
{0.150873f, -0.786911f, 0.352303f}, {0.055104f, -0.898766f, 0.325273f}};
unsigned int duck_idx[DUCK_IDX_COUNT] = {
2, 73, 74, 2, 74, 21, 30, 0, 20, 30, 20, 31, 43, 42, 1, 43, 1, 33, 41, 40, 13, 41, 13, 3, 40, 71, 70, 40, 70,
13, 48, 9, 32, 48, 32, 47, 45, 88, 10, 45, 10, 49, 39, 38, 35, 39, 35, 34, 66, 37, 16, 66, 16, 67, 6, 30, 31, 6,
31, 19, 46, 47, 32, 46, 32, 8, 44, 43, 33, 44, 33, 7, 70, 69, 5, 70, 5, 13, 35, 27, 24, 35, 24, 34, 16, 18, 68,
16, 68, 67, 36, 18, 16, 36, 16, 37, 64, 17, 15, 64, 15, 65, 26, 29, 28, 26, 28, 25, 50, 11, 12, 50, 12, 45, 72, 75,
74, 72, 74, 73, 17, 36, 37, 17, 37, 15, 65, 15, 37, 65, 37, 66, 25, 28, 38, 25, 38, 39, 40, 88, 12, 40, 12, 71, 10,
88, 40, 10, 40, 41, 32, 9, 42, 32, 42, 43, 8, 32, 43, 8, 43, 44, 85, 84, 22, 85, 22, 23, 20, 78, 77, 20, 77, 31,
19, 31, 77, 19, 77, 76, 48, 58, 51, 48, 51, 9, 10, 52, 56, 10, 56, 49, 41, 53, 52, 41, 52, 10, 9, 51, 54, 9, 54,
42, 81, 80, 55, 81, 55, 21, 20, 57, 79, 20, 79, 78, 90, 89, 59, 90, 59, 60, 61, 91, 90, 61, 90, 60, 62, 92, 91, 62,
91, 61, 63, 93, 92, 63, 92, 62, 29, 64, 65, 29, 65, 28, 28, 65, 66, 28, 66, 38, 38, 66, 67, 38, 67, 35, 68, 27, 35,
68, 35, 67, 60, 59, 69, 60, 69, 70, 71, 61, 60, 71, 60, 70, 12, 62, 61, 12, 61, 71, 11, 63, 62, 11, 62, 12, 14, 4,
72, 14, 72, 73, 2, 14, 73, 22, 81, 21, 22, 21, 74, 75, 23, 22, 75, 22, 74, 83, 82, 87, 83, 87, 86, 76, 77, 47, 76,
47, 46, 78, 48, 47, 78, 47, 77, 79, 58, 48, 79, 48, 78, 49, 56, 82, 49, 82, 83, 84, 45, 49, 84, 49, 83, 85, 50, 45,
85, 45, 84, 87, 80, 81, 87, 81, 86, 22, 84, 83, 22, 83, 86, 45, 12, 88, 34, 24, 89, 34, 89, 90, 91, 39, 34, 91, 34,
90, 92, 25, 39, 92, 39, 91, 93, 26, 25, 93, 25, 92, 0, 98, 100, 0, 100, 20, 1, 96, 95, 1, 95, 33, 30, 99, 98, 30,
98, 0, 97, 96, 1, 97, 1, 42, 96, 3, 13, 96, 13, 95, 41, 3, 96, 41, 96, 97, 98, 2, 21, 98, 21, 100, 99, 14, 2,
99, 2, 98, 102, 103, 51, 102, 51, 58, 56, 52, 103, 56, 103, 102, 101, 4, 14, 101, 14, 99, 6, 101, 99, 6, 99, 30, 95, 94,
7, 95, 7, 33, 13, 5, 94, 13, 94, 95, 52, 53, 104, 52, 104, 103, 103, 104, 54, 103, 54, 51, 105, 106, 79, 105, 79, 57, 97,
104, 53, 97, 53, 41, 42, 54, 104, 42, 104, 97, 21, 55, 105, 21, 105, 100, 100, 105, 57, 100, 57, 20, 106, 105, 87, 106, 87, 82,
106, 102, 58, 106, 58, 79, 82, 56, 102, 82, 102, 106, 22, 86, 81, 80, 87, 105, 80, 105, 55, 109, 119, 157, 109, 157, 156, 123, 124,
118, 123, 118, 107, 135, 126, 108, 135, 108, 134, 133, 110, 114, 133, 114, 132, 132, 114, 154, 132, 154, 155, 138, 137, 125, 138, 125, 111, 136,
139, 112, 136, 112, 168, 131, 127, 128, 131, 128, 130, 152, 153, 117, 152, 117, 129, 6, 19, 124, 6, 124, 123, 46, 8, 125, 46, 125, 137,
44, 7, 126, 44, 126, 135, 154, 114, 5, 154, 5, 69, 128, 127, 24, 128, 24, 27, 117, 153, 68, 117, 68, 18, 36, 129, 117, 36, 117,
18, 64, 151, 116, 64, 116, 17, 26, 121, 122, 26, 122, 29, 50, 136, 113, 50, 113, 11, 72, 156, 157, 72, 157, 75, 17, 116, 129, 17,
129, 36, 151, 152, 129, 151, 129, 116, 121, 131, 130, 121, 130, 122, 132, 155, 113, 132, 113, 168, 112, 133, 132, 112, 132, 168, 125, 135, 134,
125, 134, 111, 8, 44, 135, 8, 135, 125, 85, 23, 120, 85, 120, 165, 118, 124, 158, 118, 158, 159, 19, 76, 158, 19, 158, 124, 138, 111,
140, 138, 140, 147, 112, 139, 145, 112, 145, 141, 133, 112, 141, 133, 141, 142, 111, 134, 143, 111, 143, 140, 162, 119, 144, 162, 144, 161, 118,
159, 160, 118, 160, 146, 169, 148, 59, 169, 59, 89, 149, 148, 169, 149, 169, 170, 150, 149, 170, 150, 170, 171, 63, 150, 171, 63, 171, 93,
29, 122, 151, 29, 151, 64, 122, 130, 152, 122, 152, 151, 130, 128, 153, 130, 153, 152, 68, 153, 128, 68, 128, 27, 148, 154, 69, 148, 69,
59, 155, 154, 148, 155, 148, 149, 113, 155, 149, 113, 149, 150, 11, 113, 150, 11, 150, 63, 115, 156, 72, 115, 72, 4, 109, 156, 115, 120,
157, 119, 120, 119, 162, 75, 157, 120, 75, 120, 23, 164, 166, 167, 164, 167, 163, 76, 46, 137, 76, 137, 158, 159, 158, 137, 159, 137, 138,
160, 159, 138, 160, 138, 147, 139, 164, 163, 139, 163, 145, 165, 164, 139, 165, 139, 136, 85, 165, 136, 85, 136, 50, 167, 166, 162, 167, 162,
161, 120, 166, 164, 120, 164, 165, 136, 168, 113, 127, 169, 89, 127, 89, 24, 170, 169, 127, 170, 127, 131, 171, 170, 131, 171, 131, 121, 93,
171, 121, 93, 121, 26, 107, 118, 177, 107, 177, 175, 108, 126, 172, 108, 172, 173, 123, 107, 175, 123, 175, 176, 174, 134, 108, 174, 108, 173,
173, 172, 114, 173, 114, 110, 133, 174, 173, 133, 173, 110, 175, 177, 119, 175, 119, 109, 176, 175, 109, 176, 109, 115, 178, 147, 140, 178, 140,
179, 145, 178, 179, 145, 179, 141, 101, 176, 115, 101, 115, 4, 6, 123, 176, 6, 176, 101, 172, 126, 7, 172, 7, 94, 114, 172, 94, 114,
94, 5, 141, 179, 180, 141, 180, 142, 179, 140, 143, 179, 143, 180, 181, 146, 160, 181, 160, 182, 174, 133, 142, 174, 142, 180, 134, 174, 180,
134, 180, 143, 119, 177, 181, 119, 181, 144, 177, 118, 146, 177, 146, 181, 182, 163, 167, 182, 167, 181, 182, 160, 147, 182, 147, 178, 163, 182,
178, 163, 178, 145, 120, 162, 166, 161, 144, 181, 161, 181, 167, 189, 185, 190, 189, 190, 199, 190, 183, 188, 190, 188, 199, 197, 187, 196, 197,
196, 200, 188, 183, 193, 188, 193, 201, 192, 186, 191, 192, 191, 198, 191, 184, 194, 191, 194, 198, 188, 184, 191, 188, 191, 199, 191, 186, 189,
191, 189, 199, 194, 184, 188, 194, 188, 201, 196, 187, 195, 196, 195, 202, 195, 185, 189, 195, 189, 202, 189, 186, 196, 189, 196, 202, 196, 186,
192, 196, 192, 200, 209, 214, 210, 209, 210, 205, 210, 214, 208, 210, 208, 203, 197, 200, 213, 197, 213, 207, 208, 201, 193, 208, 193, 203, 192,
198, 211, 192, 211, 206, 211, 198, 194, 211, 194, 204, 208, 214, 211, 208, 211, 204, 211, 214, 209, 211, 209, 206, 194, 201, 208, 194, 208, 204,
213, 215, 212, 213, 212, 207, 212, 215, 209, 212, 209, 205, 209, 215, 213, 209, 213, 206, 213, 200, 192, 213, 192, 206, 230, 225, 231, 230, 231,
236, 231, 223, 229, 231, 229, 236, 219, 227, 234, 229, 223, 217, 229, 217, 221, 216, 226, 232, 216, 232, 220, 232, 224, 218, 232, 218, 220, 229,
224, 232, 229, 232, 236, 232, 226, 230, 232, 230, 236, 234, 238, 228, 234, 228, 219, 218, 224, 229, 218, 229, 221, 234, 227, 233, 234, 233, 237,
233, 225, 230, 233, 230, 237, 230, 226, 235, 230, 235, 237, 235, 238, 234, 235, 234, 237, 228, 238, 235, 228, 235, 222, 235, 226, 216, 235, 216,
222, 245, 251, 246, 245, 246, 241, 246, 251, 244, 246, 244, 239, 219, 249, 243, 244, 221, 217, 244, 217, 239, 216, 220, 247, 216, 247, 242, 247,
220, 218, 247, 218, 240, 244, 251, 247, 244, 247, 240, 247, 251, 245, 247, 245, 242, 249, 219, 228, 249, 228, 253, 218, 221, 244, 218, 244, 240,
249, 252, 248, 249, 248, 243, 248, 252, 245, 248, 245, 241, 245, 252, 250, 245, 250, 242, 250, 252, 249, 250, 249, 253, 228, 222, 250, 228, 250,
253, 250, 222, 216, 250, 216, 242};
} // namespace ImPlot3D

View File

@@ -1,13 +1,6 @@
#pragma once
#include <string>
#include <vector>
#include <map>
#include "imgui.h"
#include "icons.hpp"
#include "vertex_engine/utils/utils.hpp" // IWYU pragma: keep
namespace VE::style::fonts

View File

@@ -3,83 +3,151 @@
#include "vertex_engine/utils/utils.hpp" // IWYU pragma: keep
#include "icons.hpp" // IWYU pragma: keep
#include "fonts.hpp"
#include "vertex_engine/utils/func.hpp"
#include "vertex_engine/gui/plots/2d/implot.hpp"
namespace VE::style
{
inline void set_style()
{
const ImVec4 bg_mid = func::color("#303446", 0.99f);
const ImVec4 accent_dark = func::color("#272B38", 0.99f);
const ImVec4 accent_light = func::color("#3d4153", 0.99f);
const ImVec4 active = func::color("#414553", 0.99f);
const ImVec4 attention = func::color("#14172B", 0.99f);
ImVec4* col = ImGui::GetStyle().Colors;
col[ImGuiCol_Tab] = func::color("#34384A", 0.99f);
col[ImGuiCol_TabActive] = accent_dark;
col[ImGuiCol_TabHovered] = accent_light;
col[ImGuiCol_Tab] = func::color("#34384A", 0.19f);
col[ImGuiCol_TabUnfocusedActive] = active;
col[ImGuiCol_TitleBg] = accent_dark;
col[ImGuiCol_TitleBgActive] = accent_dark;
col[ImGuiCol_TitleBgCollapsed] = accent_dark;
col[ImGuiCol_Text] = func::color("#E1E1E9", 0.99f);
col[ImGuiCol_TextDisabled] = func::color("#5E6E9D", 0.99f);
col[ImGuiCol_TextSelectedBg] = accent_light;
col[ImGuiCol_Border] = func::color("#303446", 0.99f);
col[ImGuiCol_BorderShadow] = func::color("#303446", 0.49f);
col[ImGuiCol_FrameBg] = func::color("#34384A", 0.90f);
col[ImGuiCol_FrameBgActive] = active;
col[ImGuiCol_FrameBgHovered] = accent_light;
col[ImGuiCol_ScrollbarBg] = bg_mid;
col[ImGuiCol_ScrollbarGrab] = func::color("#606373", 0.99f);
col[ImGuiCol_ScrollbarGrabActive] = active;
col[ImGuiCol_ScrollbarGrabHovered] = accent_light;
col[ImGuiCol_SliderGrab] = accent_dark;
col[ImGuiCol_SliderGrabActive] = accent_light;
col[ImGuiCol_Button] = accent_dark;
col[ImGuiCol_ButtonHovered] = accent_light;
col[ImGuiCol_ButtonActive] = active;
col[ImGuiCol_Header] = accent_dark;
col[ImGuiCol_HeaderActive] = active;
col[ImGuiCol_HeaderHovered] = accent_light;
col[ImGuiCol_Separator] = accent_dark;
col[ImGuiCol_SeparatorActive] = active;
col[ImGuiCol_SeparatorHovered] = accent_light;
col[ImGuiCol_ResizeGrip] = accent_dark;
col[ImGuiCol_ResizeGripActive] = active;
col[ImGuiCol_ResizeGripHovered] = accent_light;
col[ImGuiCol_PlotLines] = accent_light;
col[ImGuiCol_PlotHistogram] = accent_light;
col[ImGuiCol_PlotLinesHovered] = active;
col[ImGuiCol_PlotHistogramHovered] = active;
col[ImGuiCol_TableRowBg] = func::color("#303445", 0.99f);
col[ImGuiCol_TableHeaderBg] = accent_dark;
col[ImGuiCol_TableRowBgAlt] = func::color("#343849", 0.99f);
col[ImGuiCol_TableBorderLight] = func::color("#343849", 0.91f);
col[ImGuiCol_TableBorderStrong] = func::color("#343849", 0.91f);
col[ImGuiCol_NavHighlight] = func::color("#343849", 0.70f);
col[ImGuiCol_NavWindowingDimBg] = func::color("#343849", 0.20f);
col[ImGuiCol_NavWindowingHighlight] = func::color("#343849", 0.70f);
// col[ImGuiCol_NavHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
// col[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
// col[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
col[ImGuiCol_ChildBg] = func::color("#303446", 0.f);
col[ImGuiCol_PopupBg] = bg_mid;
col[ImGuiCol_WindowBg] = bg_mid;
col[ImGuiCol_MenuBarBg] = accent_dark;
col[ImGuiCol_ModalWindowDimBg] = func::color("#303446", 0.5f);
col[ImGuiCol_CheckMark] = accent_dark;
col[ImGuiCol_DragDropTarget] = attention;
#ifdef IMGUI_HAS_DOCK
colors[ImGuiCol_DockingPreview] = ImVec4(0.85f, 0.85f, 0.85f, 0.28f);
colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.38f, 0.38f, 0.38f, 1.00f);
#endif
ImPlot::StyleColorsAuto();
ImVec4* pcol = ImPlot::GetStyle().Colors;
pcol[ImPlotCol_PlotBg] = ImVec4(0, 0, 0, 0);
pcol[ImPlotCol_PlotBorder] = ImVec4(0, 0, 0, 0);
pcol[ImPlotCol_Selection] = attention;
pcol[ImPlotCol_Crosshairs] = col[ImGuiCol_Text];
ImPlot::GetStyle().DigitalPadding = 20;
auto& st = ImPlot::GetStyle();
st.PlotPadding = st.LegendPadding = {12, 12};
st.LabelPadding = st.LegendInnerPadding = {6, 6};
st.LegendSpacing = {10, 2};
st.AnnotationPadding = {4,2};
const ImU32 Dracula[] = {4288967266, 4285315327, 4286315088, 4283782655, 4294546365, 4287429361, 4291197439, 4294830475, 4294113528, 4284106564 };
ImPlot::GetStyle().Colormap = ImPlot::AddColormap("Dracula",Dracula,10);
}
inline void init()
{
/* use this - https://www.unknowncheats.me/forum/c-and-c-/189635-imgui-style-settings.html */
ImGuiStyle& st = ImGui::GetStyle();
st.WindowPadding = ImVec2(5.0f, 5.0f);
st.WindowRounding = 0.0f;
st.FramePadding = ImVec2(5.0f, 5.0f);
st.FrameRounding = 0.0f;
st.ItemSpacing = ImVec2(8.0f, 8.0f);
st.ItemInnerSpacing = ImVec2(8.0f, 6.0f);
st.IndentSpacing = 25.0f;
st.ScrollbarSize = 12.0f;
st.ScrollbarRounding = 0.0f;
st.GrabMinSize = 5.0f;
st.GrabRounding = 0.0f;
st.TabRounding = 0.0f;
st.WindowBorderSize = 0.0f;
st.ChildRounding = 0.0f;
st.PopupRounding = 0.0f;
st.PopupBorderSize = 0.0f;
st.WindowMenuButtonPosition = ImGuiDir_None;
st.WindowRounding = st.ChildRounding = st.PopupRounding = st.ScrollbarRounding = st.GrabRounding = st.TabRounding = 1.f;
st.WindowBorderSize = st.ChildBorderSize = st.PopupBorderSize = st.TabBorderSize = 0.f;
st.WindowMenuButtonPosition = ImGuiDir_None;
st.WindowPadding = ImVec2(5.f, 5.f);
/* tab */
st.Colors[ImGuiCol_Tab] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_TabHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_TabActive] = ImVec4(0.20f, 0.19f, 0.21f, 1.00f);
st.FramePadding = ImVec2{ 6.f, 3.f };
st.FramePadding = ImVec2(5.f, 5.f);
st.FrameBorderSize = 1;
st.FrameRounding = 0.f;
/* title */
st.Colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
st.ItemSpacing = ImVec2(8.f, 8.f);
st.ItemInnerSpacing = ImVec2(8.f, 6.f);
st.Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
st.Colors[ImGuiCol_TextDisabled] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_ChildBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
st.Colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
st.Colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
st.Colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.ScrollbarSize = 12.f;
st.ScrollbarRounding = 0.f;
// st.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
// st.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.GrabMinSize = 5.f;
st.GrabRounding = 0.f;
st.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
st.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
st.Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
st.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_Button] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ButtonActive] = ImVec4(0.12f, 0.11f, 0.14f, 1.00f);
st.Colors[ImGuiCol_Header] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_Separator] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
st.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
st.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
st.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
st.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
st.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f);
st.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
st.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.PopupRounding = 0.f;
st.PopupBorderSize = 0.f;
st.IndentSpacing = 25.f;
st.TabRounding = 0.f;
st.ChildRounding = 0.f;
st.CellPadding = ImVec2{ 6.f, 3.f };
set_style();
fonts::init();
};
};

View File

@@ -0,0 +1,227 @@
#pragma once
#include "vertex_engine/utils/utils.hpp" // IWYU pragma: keep
#include "icons.hpp" // IWYU pragma: keep
#include "fonts.hpp"
#include "vertex_engine/utils/func.hpp"
#include "vertex_engine/gui/plots/2d/implot.hpp"
namespace VE::style
{
inline void set_base_style()
{
ImVec4* col = ImGui::GetStyle().Colors;
col[ImGuiCol_Tab] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_TabActive] = ImVec4(0.2f, 0.19f, 0.21f, 1.f);
col[ImGuiCol_TabHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
// colors[ImGuiCol_TabUnfocused] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
// colors[ImGuiCol_TabUnfocusedActive] = active;
col[ImGuiCol_TitleBg] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.f);
col[ImGuiCol_TitleBgCollapsed] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_Text] = ImVec4(0.8f, 0.8f, 0.83f, 1.f);
col[ImGuiCol_TextDisabled] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.f, 0.f, 0.43f);
col[ImGuiCol_Border] = ImVec4(0.8f, 0.8f, 0.83f, 0.88f);
col[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.f);
col[ImGuiCol_FrameBg] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_FrameBgActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_FrameBgHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_ScrollbarBg] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_ScrollbarGrab] = ImVec4(0.8f, 0.8f, 0.83f, 0.31f);
col[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.f);
col[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_SliderGrab] = ImVec4(0.8f, 0.8f, 0.83f, 0.31f);
col[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.f);
col[ImGuiCol_Button] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_ButtonActive] = ImVec4(0.12f, 0.11f, 0.14f, 1.f);
col[ImGuiCol_ButtonHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_Header] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.f);
col[ImGuiCol_HeaderHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_Separator] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_SeparatorActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_SeparatorHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_ResizeGrip] = ImVec4(0.f, 0.f, 0.f, 0.f);
col[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.f);
col[ImGuiCol_ResizeGripHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.f);
col[ImGuiCol_PlotLines] = ImVec4(0.4f, 0.39f, 0.38f, 0.63f);
col[ImGuiCol_PlotHistogram] = ImVec4(0.4f, 0.39f, 0.38f, 0.63f);
col[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.f, 0.f, 1.f);
col[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.f, 0.f, 1.f);
// colors[ImGuiCol_TableRowBg] = ImVec4(0, 0, 0, 0);
// colors[ImGuiCol_TableHeaderBg] = accent_dark;
// colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.02f);
// colors[ImGuiCol_TableBorderLight] = ImVec4(1.00f, 1.00f, 1.00f, 0.02f);
// colors[ImGuiCol_TableBorderStrong] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
// colors[ImGuiCol_NavHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
// colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
// colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
col[ImGuiCol_ChildBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.f);
col[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.f);
col[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.f);
col[ImGuiCol_MenuBarBg] = ImVec4(0.1f, 0.09f, 0.12f, 1.f);
col[ImGuiCol_ModalWindowDimBg] = ImVec4(1.f, 0.98f, 0.95f, 0.73f);
col[ImGuiCol_CheckMark] = ImVec4(0.8f, 0.8f, 0.83f, 0.31f);
// colors[ImGuiCol_DragDropTarget] = attention;
}
inline void set_system_style()
{
const ImVec4 bg_dark = ImVec4(0.15f, 0.16f, 0.21f, 1.00f);
const ImVec4 bg_mid = ImVec4(0.20f, 0.21f, 0.27f, 1.00f);
const ImVec4 accent_dark = ImVec4(0.292f, 0.360f, 0.594f, 1.000f);
const ImVec4 accent_light = ImVec4(0.409f, 0.510f, 0.835f, 1.000f);
const ImVec4 active = ImVec4(0.107f, 0.118f, 0.157f, 1.000f);
// const ImVec4 active = func::color("#89B4FB", 0.99f);
const ImVec4 attention = ImVec4(0.821f, 1.000f, 0.000f, 1.000f);
ImVec4* col = ImGui::GetStyle().Colors;
col[ImGuiCol_Tab] = ImVec4(1.00f, 1.00f, 1.00f, 0.02f);
col[ImGuiCol_TabActive] = accent_dark;
col[ImGuiCol_TabHovered] = accent_light;
col[ImGuiCol_TabUnfocused] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
col[ImGuiCol_TabUnfocusedActive] = active;
col[ImGuiCol_TitleBg] = accent_dark;
col[ImGuiCol_TitleBgActive] = accent_dark;
col[ImGuiCol_TitleBgCollapsed] = accent_dark;
col[ImGuiCol_Text] = ImVec4(0.89f, 0.89f, 0.92f, 1.00f);
col[ImGuiCol_TextDisabled] = ImVec4(0.38f, 0.45f, 0.64f, 1.00f);
col[ImGuiCol_TextSelectedBg] = accent_light;
col[ImGuiCol_Border] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
col[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.06f);
col[ImGuiCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.02f);
col[ImGuiCol_FrameBgActive] = active;
col[ImGuiCol_FrameBgHovered] = accent_light;
col[ImGuiCol_ScrollbarBg] = bg_mid;
col[ImGuiCol_ScrollbarGrab] = ImVec4(0.89f, 0.89f, 0.93f, 0.27f);
col[ImGuiCol_ScrollbarGrabActive] = active;
col[ImGuiCol_ScrollbarGrabHovered] = accent_light;
col[ImGuiCol_SliderGrab] = accent_dark;
col[ImGuiCol_SliderGrabActive] = accent_light;
col[ImGuiCol_Button] = accent_dark;
col[ImGuiCol_ButtonHovered] = accent_light;
col[ImGuiCol_ButtonActive] = active;
col[ImGuiCol_Header] = accent_dark;
col[ImGuiCol_HeaderActive] = active;
col[ImGuiCol_HeaderHovered] = accent_light;
col[ImGuiCol_Separator] = accent_dark;
col[ImGuiCol_SeparatorActive] = active;
col[ImGuiCol_SeparatorHovered] = accent_light;
col[ImGuiCol_ResizeGrip] = accent_dark;
col[ImGuiCol_ResizeGripActive] = active;
col[ImGuiCol_ResizeGripHovered] = accent_light;
col[ImGuiCol_PlotLines] = accent_light;
col[ImGuiCol_PlotHistogram] = accent_light;
col[ImGuiCol_PlotLinesHovered] = active;
col[ImGuiCol_PlotHistogramHovered] = active;
col[ImGuiCol_TableRowBg] = ImVec4(0, 0, 0, 0);
col[ImGuiCol_TableHeaderBg] = accent_dark;
col[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.02f);
col[ImGuiCol_TableBorderLight] = ImVec4(1.00f, 1.00f, 1.00f, 0.02f);
col[ImGuiCol_TableBorderStrong] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
col[ImGuiCol_NavHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
col[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
col[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
col[ImGuiCol_ChildBg] = ImVec4(0.2f, 0.21f, 0.27f, 0.f);
col[ImGuiCol_PopupBg] = bg_mid;
col[ImGuiCol_WindowBg] = bg_mid;
col[ImGuiCol_MenuBarBg] = accent_dark;
col[ImGuiCol_ModalWindowDimBg] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
col[ImGuiCol_CheckMark] = accent_dark;
col[ImGuiCol_DragDropTarget] = attention;
#ifdef IMGUI_HAS_DOCK
colors[ImGuiCol_DockingPreview] = ImVec4(0.85f, 0.85f, 0.85f, 0.28f);
colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.38f, 0.38f, 0.38f, 1.00f);
#endif
ImPlot::StyleColorsAuto();
ImVec4* pcol = ImPlot::GetStyle().Colors;
pcol[ImPlotCol_PlotBg] = ImVec4(0, 0, 0, 0);
pcol[ImPlotCol_PlotBorder] = ImVec4(0, 0, 0, 0);
pcol[ImPlotCol_Selection] = attention;
pcol[ImPlotCol_Crosshairs] = col[ImGuiCol_Text];
ImPlot::GetStyle().DigitalPadding = 20;
auto& st = ImPlot::GetStyle();
st.PlotPadding = st.LegendPadding = {12, 12};
st.LabelPadding = st.LegendInnerPadding = {6, 6};
st.LegendSpacing = {10, 2};
st.AnnotationPadding = {4,2};
const ImU32 Dracula[] = {4288967266, 4285315327, 4286315088, 4283782655, 4294546365, 4287429361, 4291197439, 4294830475, 4294113528, 4284106564 };
ImPlot::GetStyle().Colormap = ImPlot::AddColormap("Dracula",Dracula,10);
}
inline void init()
{
/* use this - https://www.unknowncheats.me/forum/c-and-c-/189635-imgui-style-settings.html */
ImGuiStyle& st = ImGui::GetStyle();
st.WindowRounding = st.ChildRounding = st.PopupRounding = st.ScrollbarRounding = st.GrabRounding = st.TabRounding = 1.f;
st.WindowBorderSize = st.ChildBorderSize = st.PopupBorderSize = st.TabBorderSize = 0.f;
st.WindowMenuButtonPosition = ImGuiDir_None;
st.WindowPadding = ImVec2(5.f, 5.f);
st.FramePadding = ImVec2{ 6.f, 3.f };
st.FramePadding = ImVec2(5.f, 5.f);
st.FrameBorderSize = 1;
st.FrameRounding = 0.f;
st.ItemSpacing = ImVec2(8.f, 8.f);
st.ItemInnerSpacing = ImVec2(8.f, 6.f);
st.ScrollbarSize = 12.f;
st.ScrollbarRounding = 0.f;
st.GrabMinSize = 5.f;
st.GrabRounding = 0.f;
st.PopupRounding = 0.f;
st.PopupBorderSize = 0.f;
st.IndentSpacing = 25.f;
st.TabRounding = 0.f;
st.ChildRounding = 0.f;
st.CellPadding = ImVec2{ 6.f, 3.f };
// set_base_style();
set_system_style();
fonts::init();
};
};

View File

@@ -1,6 +1,5 @@
#pragma once
#include <glm/gtc/type_ptr.hpp>
#include "vertex_engine/utils/utils.hpp" // IWYU pragma: keep
namespace VE

View File

@@ -22,4 +22,24 @@ namespace VE::func
return IM_COL32(r, g, b, alpha);
}
inline ImVec4 color(std::string hex, float alpha = 1.f)
{
// Удаляем # если есть
if (!hex.empty() && hex[0] == '#') hex.erase(0, 1);
// Значения по умолчанию (белый)
unsigned int r = 255, g = 255, b = 255;
// Парсим HEX
if (hex.length() >= 6) std::sscanf(hex.c_str(), "%2x%2x%2x", &r, &g, &b);
// Конвертируем в float (0.0-1.0)
return ImVec4(
r / 255.0f,
g / 255.0f,
b / 255.0f,
alpha
);
}
}

View File

@@ -10,6 +10,7 @@
#include <fstream> // IWYU pragma: keep
#include <numeric> // IWYU pragma: keep
#include <filesystem> // IWYU pragma: keep
#include <any> // IWYU pragma: keep
/*
Если первым включен glad
@@ -31,6 +32,9 @@
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include <misc/cpp/imgui_stdlib.h>
#include <hack/security/uuid.hpp>
#include <hack/exception/exception.hpp>
#include <hack/logger/logger.hpp>
// такой порядок imgui.h
#ifndef IMGUI_DEFINE_MATH_OPERATORS