libs/imgui/src/eu/imgui/ui.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "dear_imgui/imgui.h" | ||
| 4 | |||
| 5 | #include "eu/imgui/scurve.h" | ||
| 6 | |||
| 7 | namespace eu::render | ||
| 8 | { | ||
| 9 | struct FrameBuffer; | ||
| 10 | } | ||
| 11 | |||
| 12 | namespace eu::imgui | ||
| 13 | { | ||
| 14 | |||
| 15 | struct ImguiShaderProgram | ||
| 16 | { | ||
| 17 | unsigned int program_handle = 0; | ||
| 18 | int texture_attrib = 0; | ||
| 19 | int projection_attrib = 0; | ||
| 20 | }; | ||
| 21 | |||
| 22 | struct ImguiShaderCache | ||
| 23 | { | ||
| 24 | ImguiShaderCache(); | ||
| 25 | ~ImguiShaderCache(); | ||
| 26 | |||
| 27 | ImguiShaderCache(const ImguiShaderCache&) = delete; | ||
| 28 | ImguiShaderCache(ImguiShaderCache&&) = delete; | ||
| 29 | ImguiShaderCache& operator=(const ImguiShaderCache&) = delete; | ||
| 30 | ImguiShaderCache& operator=(ImguiShaderCache&&) = delete; | ||
| 31 | |||
| 32 | ImguiShaderProgram linear_to_gamma_shader; | ||
| 33 | ImguiShaderProgram depth_ortho_shader; | ||
| 34 | }; | ||
| 35 | |||
| 36 | enum class ImageShader | ||
| 37 | { | ||
| 38 | none, | ||
| 39 | tonemap_and_gamma, | ||
| 40 | depth_ortho | ||
| 41 | }; | ||
| 42 | |||
| 43 | void setup_colors(); | ||
| 44 | |||
| 45 | void label(const char* label); | ||
| 46 | bool button(const char* label); | ||
| 47 | bool centered_button(const char* label); | ||
| 48 | |||
| 49 | bool header(const char* label, bool* closeable = nullptr); | ||
| 50 | |||
| 51 | void imgui_text(const std::string& str); | ||
| 52 | |||
| 53 | bool imgui_edit(const char* label, std::string* str); | ||
| 54 | |||
| 55 | void imgui_readonly(const char* label, const std::string& text); | ||
| 56 | void imgui_readonly(const char* label, const v3& v); | ||
| 57 | void imgui_readonly(const char* label, const Ypr& y); | ||
| 58 | |||
| 59 | void imgui_image(const char* name, const render::FrameBuffer& img, ImguiShaderCache* cache, ImageShader shader); | ||
| 60 | // bool simple_gamma_slider(const char* label, float* gamma, float curve = 1.5f, float min_gamma = 1.6f, float max_gamma = 2.8f); | ||
| 61 | |||
| 62 | // bool drag(const char* label, v3* drag); | ||
| 63 | // bool drag(const char* label, Ypr* drag); | ||
| 64 | |||
| 65 | // bool gear(const char* label, v3* drag); | ||
| 66 | // bool gear(const char* label, Rui* drag); | ||
| 67 | // bool gear(const char* label, Ypr* drag); | ||
| 68 | |||
| 69 | void transform(const m4& m); | ||
| 70 | bool transform(m4* m); | ||
| 71 | |||
| 72 | struct PropTable | ||
| 73 | { | ||
| 74 | PropTable(const PropTable&) = delete; | ||
| 75 | void operator=(const PropTable&) = delete; | ||
| 76 | void operator=(const PropTable&&) = delete; | ||
| 77 | |||
| 78 | PropTable(PropTable&& r) noexcept; | ||
| 79 | |||
| 80 | ✗ | constexpr operator bool() const { return started; } | |
| 81 | |||
| 82 | static PropTable begin(const char* label = "properties"); | ||
| 83 | ~PropTable(); | ||
| 84 | |||
| 85 | bool check(const char* label, bool* v) const; | ||
| 86 | bool slider(const char* label, float* v, float min, float max) const; | ||
| 87 | bool slider(const char* label, float* v) const; | ||
| 88 | void text(const char* label, const std::string& str) const; | ||
| 89 | bool edit(const char* label, std::string* str) const; | ||
| 90 | |||
| 91 | void display(const char* label, bool b) const; | ||
| 92 | void readonly(const char* label, const std::string& text) const; | ||
| 93 | void readonly(const char* label, const eu::v3& v) const; | ||
| 94 | void readonly(const char* label, const eu::Ypr& y) const; | ||
| 95 | bool color(const char* label, Rgb* color) const; | ||
| 96 | bool simple_gamma_slider(const char* label, float* gamma, float curve = 1.5f, float min_gamma = 1.6f, float max_gamma = 2.8f) const; | ||
| 97 | bool drag(const char* label, eu::v3* drag) const; | ||
| 98 | bool drag(const char* label, eu::Ypr* drag) const; | ||
| 99 | bool drag(const char* label, float* drag, float speed = 1.0f) const; | ||
| 100 | bool drag(const char* label, int* drag) const; | ||
| 101 | bool gear(const char* label, eu::v3* drag) const; | ||
| 102 | bool gear(const char* label, eu::Rui* drag) const; | ||
| 103 | bool gear(const char* label, eu::Ypr* drag) const; | ||
| 104 | void transform(const eu::m4& m) const; | ||
| 105 | bool transform(eu::m4* m) const; | ||
| 106 | bool scurve(const char* label, eu::core::SCurve* scurve, eu::imgui::SCurveGuiState* gui, eu::imgui::FlipX flip_x, const eu::imgui::SCurveImguiSettings& settings, bool force_init_curve) const; | ||
| 107 | |||
| 108 | void image(const char* label, const render::FrameBuffer& img, ImguiShaderCache* cache, ImageShader shader) const; | ||
| 109 | private: | ||
| 110 | bool started; | ||
| 111 | |||
| 112 | PropTable() = default; | ||
| 113 | explicit PropTable(bool b); | ||
| 114 | }; | ||
| 115 | |||
| 116 | |||
| 117 | } | ||
| 118 |